-
Notifications
You must be signed in to change notification settings - Fork 111
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
Conversation
Deploy preview for chef-automate ready! Built with commit 4e57fe0 |
<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> |
There was a problem hiding this comment.
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"> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
chef-option.filter.unknown { | ||
margin-right: 50px; // forces remaining filters into new row | ||
} | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
chef-option.filter.unknown { | ||
margin-right: 50px; // forces remaining filters into new row | ||
} | ||
|
There was a problem hiding this comment.
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"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
There was a problem hiding this 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')"> |
There was a problem hiding this comment.
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. 🤷
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 👍
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. |
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>
Signed-off-by: seajamied <jdegnan@chef.io>
625ce03
to
4e57fe0
Compare
There was a problem hiding this 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> |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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:
<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.
There was a problem hiding this comment.
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
🔩 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](https://user-images.githubusercontent.com/16737484/100273734-1a2cea00-2f12-11eb-9b88-11303ec138ad.png)