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

Add sortby state to things-list and extend things-inbox for multi-unignore #1096

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

cbrosius
Copy link

@cbrosius cbrosius commented Jun 7, 2021

Fixes #668

@cbrosius cbrosius requested a review from a team as a code owner June 7, 2021 22:28
cbrosius added 3 commits June 9, 2021 22:09
Signed-off-by: Christian Brosius <Christian.Brosius@gmail.com>
add toggleAll to Multiselect in thing-inbox
change Text from 'select' to 'multiselect'

Signed-off-by: Christian Brosius <Christian.Brosius@gmail.com>
Copy link
Member

@ghys ghys left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, I left some comments.
You also need to sign-off your work, see https://www.openhab.org/docs/developer/contributing.html.

@@ -23,6 +23,9 @@
<f7-link color="orange" v-show="selectedItems.length" v-if="!$theme.md" class="ignore" @click="confirmActionOnSelection('ignore')" icon-ios="f7:eye_slash" icon-aurora="f7:eye_slash">
&nbsp;Ignore {{ selectedItems.length }}
</f7-link>
<f7-link color="blue" v-show="selectedItems.length" v-if="!$theme.md" class="unignore" @click="confirmActionOnSelection('unignore')" icon-ios="f7:eye" icon-aurora="f7:eye">
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if there's enough room on a phone screen for 4 links at the bottom - that's why I left the unignore feature out. Unignore could however replace ignore if all checked items are already ignored.

Copy link
Author

Choose a reason for hiding this comment

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

image
On my phone (Android10) there is enough space because the Text is not shown.
But this might be depending on the phone or theme.

When starting, the absence of an 'unignore'-button is not cruical, but over time one may add more and more things to the ignore-list, and then it makes much more sense to have 'unignore' in the multiselect-view, too.

Copy link
Member

Choose a reason for hiding this comment

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

Yep but for instance on a iPhone 12 mini (which would have the iOS theme and a smallish screen), it would look like this:

image

this part of the code is for themes other than Material Design (i.e. Android) so adding a new function needs to account for those as well.

@@ -61,6 +65,7 @@
By binding
</f7-button>
</f7-segmented>
<f7-checkbox v-if="showCheckboxes" @change="masterToggle" />
Copy link
Member

Choose a reason for hiding this comment

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

Not convinced this lone checkbox is the best design for a "select all" feature honestly.

Copy link
Author

Choose a reason for hiding this comment

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

I agree, but until now I could not find a better, simple way to provide the functionality.
I tried a header-row, but that needs much more space without additional improvements.

Do you have a suggestion for this?

Copy link
Member

Choose a reason for hiding this comment

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

Not completely sure but I was thinking about "Select All/Unselect All" buttons like those you have on that screen when you add points to the model from a thing:

image

Though your approach of a "select all" checkbox isn't bad either, maybe it could be made clearer, but in any case we need a common approach. So I would suggest adding these buttons at the bottom of the list when the "select" mode is active.

Copy link
Author

Choose a reason for hiding this comment

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

What do you think about such a composition?
image

This way it would be possible to select all items in bigger lists without scrolling to the bottom.

this.checkAll = !this.checkAll
for (let e in this.inbox) {
if (this.checkAll) {
this.selectedItems.push(this.inbox[e].thingUID)
Copy link
Member

Choose a reason for hiding this comment

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

If an item is already in the selectedItems array it will be added again with this code.

Copy link
Author

Choose a reason for hiding this comment

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

I´m a newbie in vue/javascript programming and contributing. Hopefully this explains a little bit why there are so many issues with my commit :O)
Would it be a solution to empty the selectedItems-Array before setting all items again, or is there a better way to add all items in the list only once?

Copy link
Member

Choose a reason for hiding this comment

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

I´m a newbie in vue/javascript programming and contributing. Hopefully this explains a little bit why there are so many issues with my commit :O)

No worries, first-time contributions are welcome, we'll walk you through this 😃

Copy link
Author

Choose a reason for hiding this comment

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

Suggested change
this.selectedItems.push(this.inbox[e].thingUID)
masterToggle() {
this.checkAll = !this.checkAll
this.selectedItems = []
if (this.checkAll) {
for (let e in this.inbox) {
this.selectedItems.push(this.inbox[e].thingUID)
}
}
},

@cbrosius
Copy link
Author

After writing all the comments I realized, that I already mixed up this PR with another one I wanted to do afterwards.
Initially I intended only doing the 'sortby state' in this PR and open another PR for the inbox-multiselect.

How should I proceed? Is it better to close this one and create two new separate PRs?
Sorry for the inconveniences.

@cbrosius cbrosius changed the title Add sortby state to things-list Add sortby state to things-list and extend things-inbox for multi-unignore Jun 10, 2021
@ghys
Copy link
Member

ghys commented Jun 20, 2021

How should I proceed? Is it better to close this one and create two new separate PRs?
Sorry for the inconveniences.

And sorry for the delay; on principle, it's indeed always better not to bundle several changes in the same PR as the maintainer (that would be me 😅) might welcome a laser-focused fix for a specific issue but be reluctant if it's accompanied by some other unrelated and potentially unwanted changes. Nevertheless I believe we can make it work.

@seime
Copy link
Contributor

seime commented Sep 10, 2023

Any hope for this PR being merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MainUI] Sort 'By state' in Things-View
3 participants