-
Notifications
You must be signed in to change notification settings - Fork 114
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
Infra UI cleanup -- and learning resource! #4875
Conversation
Signed-off-by: michael sorens <[email protected]>
Best way to see the consistency/inconsistency is to search for all occurrences of "message:" in *.effects.ts. Signed-off-by: michael sorens <[email protected]>
Signed-off-by: michael sorens <[email protected]>
Signed-off-by: michael sorens <[email protected]>
Signed-off-by: michael sorens <[email protected]>
Signed-off-by: michael sorens <[email protected]>
Signed-off-by: michael sorens <[email protected]>
Signed-off-by: michael sorens <[email protected]>
Signed-off-by: michael sorens <[email protected]>
Signed-off-by: michael sorens <[email protected]>
Signed-off-by: michael sorens <[email protected]>
Signed-off-by: michael sorens <[email protected]>
Signed-off-by: michael sorens <[email protected]>
Signed-off-by: michael sorens <[email protected]>
Signed-off-by: michael sorens <[email protected]>
Signed-off-by: seajamied <[email protected]>
…ough These should really get worked through in a more global sense. I'll connect with UX about how these will look in the future Signed-off-by: seajamied <[email protected]>
Signed-off-by: seajamied <[email protected]>
Signed-off-by: seajamied <[email protected]>
I mostly reworked the search bar first so that it is accessible and next to get all the pixels in the right place. It could likely be cleaned up more as well but I think this is a great start Signed-off-by: seajamied <[email protected]>
Signed-off-by: seajamied <[email protected]>
Deploy preview for chef-automate processing. Building with commit 27a81ec https://app.netlify.com/sites/chef-automate/deploys/605d43daa01e330008617248 |
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.
Lots of author notes below. You will see a high correlation between these types of fixes and the new suggested PR template in #4874
@@ -114,7 +114,7 @@ export class CdsEffects { | |||
map((action: DownloadContentItemSuccess) => { | |||
return new CreateNotification({ | |||
type: Type.info, | |||
message: `Content Item "${action.payload.name}" was download` | |||
message: `Content Item "${action.payload.name}" was downloaded` |
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.
Author note: grammar
@@ -119,7 +119,7 @@ export class ClientEffects { | |||
map(({ payload: { name } }: DeleteClientSuccess) => { | |||
return new CreateNotification({ | |||
type: Type.info, | |||
message: `Successfully Deleted Client - ${name}.` | |||
message: `Successfully deleted client - ${name}.` |
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.
Author note: case consistency -- only the first word should be capitalized.
@@ -51,7 +51,7 @@ export class DataBagItemsEffects { | |||
const msg = payload.error.error; | |||
return new CreateNotification({ | |||
type: Type.error, | |||
message: `Could not get infra data bag items: ${msg || payload.error}` | |||
message: `Could not get data bag items: ${msg || payload.error}` |
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.
Author note: consistency -- majority of uses omit the "infra" so several occurrences changed.
@@ -64,7 +64,7 @@ export class DataBagsEffects { | |||
map(({ payload: { databag: dataBag } }: CreateDataBagSuccess) => { | |||
return new CreateNotification({ | |||
type: Type.info, | |||
message: `Successfully Created Data Bag ${dataBag.name}.` | |||
message: `Successfully created data bag - ${dataBag.name}.` |
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.
Author note: consistency -- this new pattern is supposed to also include the hyphen.
@@ -130,7 +130,7 @@ export class EnvironmentEffects { | |||
filter(({ payload }: CreateEnvironmentFailure) => payload.status !== HttpStatus.CONFLICT), | |||
map(({ payload }: CreateEnvironmentFailure) => new CreateNotification({ | |||
type: Type.error, | |||
message: `Could not create notification: ${payload.error.error || payload}.` | |||
message: `Could not create environment: ${payload.error.error || payload}.` |
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.
Author note: copy/paste error
[jsonText]="jsonText" | ||
[openEvent]="openEnvironmentModal" | ||
[serverId]="serverId" [orgId]="orgId" | ||
[name]="name" [environment]="environment" | ||
[serverId]="serverId" | ||
[orgId]="orgId" | ||
[name]="name" | ||
[environment]="environment" | ||
[label]="label" | ||
[cookbookConstraints]="cookbookConstraints" | ||
[cookbookVersions]="cookbookVersions"> |
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.
Author note: clarity -- do not hide some attributes by putting two on a line just in a couple cases. If short enough, OK to put all on one line. Otherwise, each on a line by itself.
<img alt="Edit" src="/assets/img/content and icon.png" /> | ||
<img alt="Edit" src="/assets/img/content-and-icon.png" /> |
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.
Author note: consistency -- no other file uses spaces in the name. (Besides, having spaces in a filename is asking for maintenance headaches.)
<chef-button class="add-circle" primary (click)="tre.expand()"> | ||
<chef-button class="add-circle" primary (click)="tree.expand()"> |
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.
Author note: typo -- running make spell
would have caught this.
color: #000000; | ||
color: $chef-black; |
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.
Author note: Do not use color literals in CSS files; always use the provided named constants.
[(ngModel)]="leftFilterText" [disabled]="disabled" placeholder="Search.." /> | ||
[(ngModel)]="leftFilterText" [disabled]="disabled" placeholder="Search.." /> <!-- TODO: do not use two-way binding! --> |
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.
A key tenet of automate design is One-Way Binding. The [(ngModel)]
uses two-way binding and needs fixing; just have not done it here.
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.
Agreed, will fix these changes in #4540.
Signed-off-by: seajamied <[email protected]>
Signed-off-by: seajamied <[email protected]>
Signed-off-by: seajamied <[email protected]>
Signed-off-by: seajamied <[email protected]>
Signed-off-by: seajamied <[email protected]>
Signed-off-by: seajamied <[email protected]>
Signed-off-by: michael sorens <[email protected]>
9fdbec6
to
27a81ec
Compare
@@ -48,7 +48,7 @@ export class InfraRoleEffects { | |||
const msg = payload.error.error; | |||
return new CreateNotification({ | |||
type: Type.error, | |||
message: `Could not get infra roles: ${msg || payload.error}` | |||
message: `Could not get roles: ${msg || payload.error}` |
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 infra roles make more sense, as just roles might be confused with internal roles ?
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.
Good question! I considered that, but decided against it for two reasons.
- Omitting it is more consistent with the rest of the infra pages.
- More importantly, the context makes it clear which type of role.
That said, if you have a strong preference I am fine to change it because your point is valid.
@@ -118,7 +118,7 @@ export class OrgEffects { | |||
map(({ payload: { name } }: DeleteOrgSuccess) => { | |||
return new CreateNotification({ | |||
type: Type.info, | |||
message: `Successfully Deleted Organization ${name}.` | |||
message: `Successfully deleted organization ${name}.` |
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.
is -
needed before ${name}
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.
Yes! Good eye! 🔍
@@ -147,7 +147,7 @@ export class OrgEffects { | |||
ofType(OrgActionTypes.UPDATE_SUCCESS), | |||
map(({ payload: { org } }: UpdateOrgSuccess) => new CreateNotification({ | |||
type: Type.info, | |||
message: `Successfully Updated Organization ${org.name}.` | |||
message: `Successfully updated organization ${org.name}.` |
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.
Is -
needed before ${org.name}
?
@@ -97,7 +97,7 @@ export class PolicyEffects { | |||
const removeStr = removed.length === 1 ? removed[0].displayName : `${removed.length} members`; | |||
return new CreateNotification({ | |||
type: Type.info, | |||
message: `Removed ${removeStr}.` | |||
message: `Removed member(s) ${removeStr}.` |
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.
Is -
needed before ${removeStr}
?
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.
OK, the answer here is "no". This is still the old format, the difference is the word "Successfully" is not present here. Jon from UX is well aware of the inconsistencies--I spoke to him about it a couple days ago. Apparently, new code we want to go in with "Successfully - " but I purposely did not change this one because it is "old" code.
@@ -192,7 +192,7 @@ export class ScannerEffects { | |||
}), | |||
map(() => new CreateNotification({ | |||
type: Type.info, | |||
message: 'Deleted a scan job.' | |||
message: 'Deleted scan job.' |
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.
is ID of Deleted scan job needed here ? if yes, we can add a todo for later, here also.
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.
Yes, should mark with TODO. Every such message should have an ID.
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 this detailed information.
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.
Greate work @SEAjamieD , Thanks for these changes. :)
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.
Changes Look good to me.
Just one opinion, as per new Notification UX in success/update notifications we have added Successfully text, and in some cases, it's not added.
eg: In infra-role: L88 : message: `Created role ${name}
and in databag-item: L71: message: Successfully created data bag item ${id}.
we can make these changes in this issue: #4873
@SEAjamieD According to chef-manage, we have a case-sensitive filter within infra-search-bar through API. I have shared a scenario below files. |
Thanks @himanshi-chhabra - Is this by design? or should we update this to catch both upper and lowercase? |
🔩 Description: What code changed, and why?
This was a rough and quick first pass at correcting code throughout the infrastructure pages where we've noticed a multitude of mistakes begin to present themselves. While this doesn't cover every piece that needs to be addressed, it shows the depth of the work needed and can hopefully be used as a learning resource as well--both for code authors and for code reviewers!
As you go through this, keep PR #4874 open next to it, so you can see how that revised checklist helps to point you towards things covered here.
⛓️ Related Resources
msorens' remarks: Following on Jamie's introduction above, I thought this would be a good place to reiterate guidelines I put together (over a span of years!) on authoring and on reviewing code.
Reviewing code is just as important as writing code. Really. Here are some important reasons why:
As a Code Author
As a Code Reviewer
Ultimately your task is to answer the question: do the changes accurately and completely cover the requirements?
References
My Zen of Code Review series:
👍 Definition of Done
For this particular PR "Done" means we've effectively begun a cleanup as well as communicated the need for further review.
👟 How to Build and Test the Change
in hab studio
build components/automate-ui-devproxy && start_all_services
in Automate/components/automate-ui folder
make serve
✅ Checklist
📷 Screenshots, if applicable
While many of the fixes are code-based only, much has been showing up in the UI as added white spaces, missing focus rings, 5 to 10 pixel off alignments, etc.
Below is one example
Before

Search button sits outside the Search container with extra white space at the bottom. Create environment button sits below the place of the search bar.
After

After

Accessibility rings for the input and search button, Text visible even when screen very condensed.