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

Jamie/4343 surface connected services filter in UI #4452

Merged
merged 13 commits into from
Dec 1, 2020

Conversation

SEAjamieD
Copy link
Contributor

@SEAjamieD SEAjamieD commented Nov 25, 2020

🔩 Description: What code changed, and why?

with the addition of #4339, we have the backend ability to filter service groups by only connected services. This branch adds this ability to the UI

small UX bonus - hide the checkbox for deleting selected services when there all no services to select from

⛓️ Related Resources

Backend Work: #4339

👍 Definition of Done

User is able to filter on connected services in services sidebar.

👟 How to Build and Test the Change

Terminal 1 - in Automate root folder
hab studio enter
build components/automate-ui-devproxy
applications_populate_database

Terminal 2 - cd into components/automate-ui
make serve

Navigate to https://a2-dev.test/applications/service-groups
in the services sidebar, see the "connected" option in the group of filter options
Click on the connected services option to see it filter

✅ Checklist

📷 Screenshots, if applicable

After:
Screen Shot 2020-11-25 at 11 32 48 AM

@netlify
Copy link

netlify bot commented Nov 25, 2020

Deploy preview for chef-automate ready!

Built with commit 4e57fe0

https://deploy-preview-4452--chef-automate.netlify.app

Comment on lines 49 to 59
<chef-option class="filter connected" value='connected' (click)="updateHealthFilter('connected')" (keyup.enter)="updateHealthFilter('connected')">
<chef-icon class="filter-icon">link</chef-icon>
<div class="filter-label">Connected</div>
<div class="filter-total">{{ serviceGroupsHealthSummary.total - serviceGroupsHealthSummary.disconnected }}</div>
</chef-option>
<chef-option class="filter disconnected" value='disconnected' (click)="updateHealthFilter('disconnected')" (keyup.enter)="updateHealthFilter('disconnected')">
<chef-icon class="filter-icon"></chef-icon>
<div class="filter-label">Disconnected</div>
<div class="filter-total">{{ serviceGroupsHealthSummary.disconnected }}</div>
</chef-option>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved these to the end of the group, per design spec

</chef-status-filter-group>
</div>
<div class="bulk-action-bar">
<div class="bulk-action-bar" [class.hidden]="(services$ | async)?.length === 0" [attr.aria-hidden]="(services$ | async)?.length === 0">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I noticed this checkbox/button was still visible even when there are no services to be selected. This just hides the checkbox/button for UX purposes when theres none to be selected anyways.

Copy link
Contributor

Choose a reason for hiding this comment

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

💯

Comment on lines 41 to 44
chef-option.filter.unknown {
margin-right: 50px; // forces remaining filters into new row
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

per the new design spec for the connected filter option, this is a simple way to force the new row to happen, placing connected and disconnected on their on row.

Copy link
Contributor

Choose a reason for hiding this comment

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

The other option is to put in an extra div with 0 height and 100% width which effectively works like ye olde <br>, is that true?

Copy link
Contributor

Choose a reason for hiding this comment

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

My concern here is that you are manipulating the line assuming a constant panel width. If that panel is changed in the future the desired behavior here might be lost. So I would also lean toward something that forces an actual line break.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@danielsdeleo - you absolutely can 👍
@msorens - I see your point, my goal was to add less code, and given that there are no current plans to change anything, simple CSS could give us what we needed.

I'm going to change this to Dan's method above and we'll be all set 👍

<chef-option class="filter connected" value='connected' (click)="updateHealthFilter('connected')" (keyup.enter)="updateHealthFilter('connected')">
<chef-icon class="filter-icon">link</chef-icon>
<div class="filter-label">Connected</div>
<div class="filter-total">{{ serviceGroupsHealthSummary.total - serviceGroupsHealthSummary.disconnected }}</div>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the connected count isn't in the API yet, however its just the total minus the disconnected, so we can calculate this on the frontend for the time being.

@SEAjamieD SEAjamieD requested review from Shadae, tarablack01 and a team November 25, 2020 20:14
@SEAjamieD SEAjamieD marked this pull request as ready for review November 25, 2020 20:15
Copy link
Contributor

@danielsdeleo danielsdeleo left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 41 to 44
chef-option.filter.unknown {
margin-right: 50px; // forces remaining filters into new row
}

Copy link
Contributor

Choose a reason for hiding this comment

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

The other option is to put in an extra div with 0 height and 100% width which effectively works like ye olde <br>, is that true?

</chef-status-filter-group>
</div>
<div class="bulk-action-bar">
<div class="bulk-action-bar" [class.hidden]="(services$ | async)?.length === 0" [attr.aria-hidden]="(services$ | async)?.length === 0">
Copy link
Contributor

Choose a reason for hiding this comment

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

💯

Copy link
Contributor

@msorens msorens left a comment

Choose a reason for hiding this comment

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

Just a couple notes.

@@ -51,9 +46,19 @@
<div class="filter-label">Unknown</div>
<div class="filter-total">{{ serviceGroupsHealthSummary.unknown }}</div>
</chef-option>
<chef-option class="filter connected" value='connected' (click)="updateHealthFilter('connected')" (keyup.enter)="updateHealthFilter('connected')">
Copy link
Contributor

Choose a reason for hiding this comment

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

Would improve the code to tighten the signature of updateHealthFilter to accept only ServiceGroupsFacadeService.allowedStatus (plus "total" with a union type) instead of a general string... but that would require changing allowedStatus to be an enum, I suspect, so may be out of scope for this PR. 🤷

Copy link
Contributor Author

Choose a reason for hiding this comment

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

might as well update it while i'm in here. I've updated now and would appreciate your feedback prior to merging

Copy link
Contributor

Choose a reason for hiding this comment

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

Getting there, but we really only need a single source of truth.
Should be able to eliminate AllowedHealthStatus completely and just use the allowedStatus enum directly (should capitalize to AllowedStatus though). Also, should then delete the entire line health = includes(health, this.allowedHealthStatus) ? health : allowedStatus.TOTAL; in updateHealthFilter; no longer need to check that constraint.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the thoughts - I don't think I realized enums could be used as a type signature 👍

@msorens
Copy link
Contributor

msorens commented Nov 30, 2020

BTW, I would also suggest setting up some persistent data as you have outlined here but on an acceptance box (e.g. a2-local-inplace-upgrade-acceptance.cd.chef.co) so this could be exercised there as well.

seajamied added 13 commits November 30, 2020 14:42
Signed-off-by: seajamied <jdegnan@chef.io>
… from automate

Signed-off-by: seajamied <jdegnan@chef.io>
… services

Signed-off-by: seajamied <jdegnan@chef.io>
Signed-off-by: seajamied <jdegnan@chef.io>
…calculate it on the frontend for now

Signed-off-by: seajamied <jdegnan@chef.io>
… spec

Signed-off-by: seajamied <jdegnan@chef.io>
Signed-off-by: seajamied <jdegnan@chef.io>
Signed-off-by: seajamied <jdegnan@chef.io>
Signed-off-by: seajamied <jdegnan@chef.io>
Signed-off-by: seajamied <jdegnan@chef.io>
Signed-off-by: seajamied <jdegnan@chef.io>
Signed-off-by: seajamied <jdegnan@chef.io>
@SEAjamieD SEAjamieD force-pushed the jamie/4343-connected-services-filter branch from 625ce03 to 4e57fe0 Compare November 30, 2020 22:43
Copy link
Contributor

@msorens msorens left a comment

Choose a reason for hiding this comment

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

Nice!

@@ -21,39 +21,45 @@
<div *ngIf="serviceGroupsId && (serviceGroupsStatus$ | async) === 'loadingSuccess'">
<div class="status-filter-bar">
<chef-status-filter-group [value]="selectedHealth" lean>
<chef-option class="filter general" value="total" (click)="updateHealthFilter('total')" (keyup.enter)="updateHealthFilter('total')" selected>
Copy link
Contributor

Choose a reason for hiding this comment

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

Excellent; was hoping you would notice this improvement! 😉

@@ -21,39 +21,45 @@
<div *ngIf="serviceGroupsId && (serviceGroupsStatus$ | async) === 'loadingSuccess'">
<div class="status-filter-bar">
<chef-status-filter-group [value]="selectedHealth" lean>
<chef-option class="filter general" value="total" (click)="updateHealthFilter('total')" (keyup.enter)="updateHealthFilter('total')" selected>
<chef-option class="filter general" value="total" (click)="updateHealthFilter(allowedStatus.TOTAL)" (keyup.enter)="updateHealthFilter(allowedStatus.TOTAL)" selected>
<chef-icon class="filter-icon">grain</chef-icon>
<div class="filter-label">Total</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

Contrast this with the change above, though just food for thought--you could also do this:

Suggested change
<div class="filter-label">Total</div>
<div class="filter-label">{{allowedStatus.TOTAL | capitalize}}</div>

But I am not really suggesting this; here "Total" is pure presentation so to me is fine as is, whereas on L24 that is code so should be using allowedStatus.TOTAL as you have done.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

food for thought, thanks for pointing it out

@SEAjamieD SEAjamieD merged commit da1749e into master Dec 1, 2020
@SEAjamieD SEAjamieD deleted the jamie/4343-connected-services-filter branch December 1, 2020 22:11
@msorens msorens changed the title Jamie/4343 connected services filter Jamie/4343 surface connected services filter in UI Jan 7, 2021
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.

None yet

3 participants