Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui5-view-settings-dialog): introduce filter section #3616

Merged
merged 16 commits into from
Sep 10, 2021
Merged

Conversation

fifoosid
Copy link
Contributor

@fifoosid fifoosid commented Aug 10, 2021

Fixes #3451
Fixes #3687

BREAKING CHANGE:
ui5-view-settings-dialog now uses ui5-sort-item instead of ui5-li.

@fifoosid fifoosid changed the title [WIP] feat(ui5-view-settings-dialog): introduce filter section feat(ui5-view-settings-dialog): introduce filter section Aug 18, 2021
@ilhan007 ilhan007 requested review from a team and DMihaylova August 18, 2021 20:48
@fifoosid fifoosid closed this Aug 19, 2021
@fifoosid fifoosid reopened this Aug 19, 2021
@unazko unazko self-requested a review August 23, 2021 13:08
Copy link
Contributor

@tsanislavgatev tsanislavgatev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yet to review the VSD.js

@@ -173,7 +173,7 @@ WIZARD_NAV_ARIA_ROLE_DESCRIPTION = Wizard
WIZARD_NAV_STEP_DEFAULT_HEADING=Step

#XTIT: View Settings Dialog dialog title for Sort
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we change the title?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because previously it was with wrong text

</ui5-view-settings-dialog>

<script>
btnOpenDialog.addEventListener("click", function () {
vsd.show();
});
vsd.addEventListener("confirm", function(evt) {
alert("OK button clicked, returned info is: " + JSON.stringify(evt.detail));
// alert("OK button clicked, returned info is: " + JSON.stringify(evt.detail));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which of these two should we use? We can remove the other one

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@unazko
Copy link
Contributor

unazko commented Aug 24, 2021

get _dialogTitle method in ViewSettingsDialog.js file returns "Sort" in all cases, even if we are on Filtering page.

Copy link
Contributor

@tsanislavgatev tsanislavgatev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also see a lot of nested loops, can we think of a cheaper solution? ( If already checked, It's okay.)

}
}

filter.additionalText = !selectedCount ? "" : selectedCount;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO: It's more intuitive to be selectedCount ? selectedCount : "". But it's okay in this way too.

Copy link
Contributor Author

@fifoosid fifoosid Aug 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is like this because of the linter

sortOrderSelected = this._sortOrder.getSelectedItems(),
sortBySelected = this._sortBy.getSelectedItems();
return {
sortOrder: JSON.parse(JSON.stringify(this.initSortOrderItems)),
Copy link
Contributor

@unazko unazko Aug 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we go through this? Could we just use this.initSortOrderItems object the way it is?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we can't use it because it would be a shallow copy of the object and in this case we need a deep copy as we have nested objects & arrays

packages/fiori/src/ViewSettingsDialog.js Outdated Show resolved Hide resolved
@@ -346,28 +595,39 @@ class ViewSettingsDialog extends UI5Element {
* @param {Object} settings
*/
_restoreSettings(settings) {
const sortOrderSelected = settings.sortOrder && settings.sortOrder.innerText,
sortBySelected = settings.sortBy && settings.sortBy.innerText;
this._currentSettings = JSON.parse(JSON.stringify(settings));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need these conversions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already explained

@unazko
Copy link
Contributor

unazko commented Aug 30, 2021

I have no more comments.


/**
* Defines the <code>filterItems</code> list.
* @type {sap.ui.webcomponents.fiori.ListItem}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we say use @type {sap.ui.webcomponents.fiori.ListItem}, but it's not entirely right.
The type is different now - FilterItem for filterItems and SortItem for sortItems. Also, I recommend adding a jsdoc to let the users know they need to import the SortItem, FIlterItem, FilterItemOption, because they are not auto-imported. Could be a note in the slots description or in the overview, or both.

@ilhan007
Copy link
Member

Could you also fix the merge conflict

@fifoosid fifoosid requested a review from ilhan007 September 10, 2021 11:03
@ilhan007
Copy link
Member

ilhan007 commented Sep 10, 2021

I encountered the following state:

  1. Open the dialog
  2. Switch to filter view
  3. Select a Filter to navigate to the Filter subview
  4. Check one of the options
  5. Pres ESC
  6. Open the Dialog again

Screenshot 2021-09-10 at 14 04 28

@fifoosid fifoosid merged commit 52987c2 into master Sep 10, 2021
@fifoosid fifoosid deleted the vsd-filter branch September 10, 2021 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ViewSettingsDialog's sort by option is not working [ui5-dialog for Filter][SF][Urgent] Support Filter dialog
4 participants