-
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
[A2-763] Hide "Access Management" on sidebar #385
Conversation
70a412b
to
182c368
Compare
@@ -26,8 +26,8 @@ | |||
<chef-sidebar-entry route="/settings/tokens" icon="vpn_key">API Tokens</chef-sidebar-entry> | |||
</app-authorized> | |||
|
|||
<div *ngIf="(iamMajorVersion$ | async) !== 'v1'"> | |||
<div class="group" *ngIf="policies.visible || roles.visible || projects.visible">Access Management</div> | |||
<div *ngIf="(iamMajorVersion$ | async) === 'v2'"> |
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 could see the case for keeping this as a !== v1
(if we bump to a 3?) . . . I just found the positive ===
so much easier to read 🤷♂
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 right!
@@ -26,8 +26,8 @@ | |||
<chef-sidebar-entry route="/settings/tokens" icon="vpn_key">API Tokens</chef-sidebar-entry> | |||
</app-authorized> | |||
|
|||
<div *ngIf="(iamMajorVersion$ | async) !== 'v1'"> | |||
<div class="group" *ngIf="policies.visible || roles.visible || projects.visible">Access Management</div> | |||
<div *ngIf="(iamMajorVersion$ | async) === 'v2'"> |
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.
Better to keep the not-equal-v1 because if we go to v3, etc. we likely want it still to work.
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.
LOL -- just refreshed and saw your comment on the very same thing!
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.
So I will add in that not-equal-v1 is also consistent with all the other uses in the front-end.
<div *ngIf="(iamMajorVersion$ | async) !== 'v1'"> | ||
<div class="group" *ngIf="policies.visible || roles.visible || projects.visible">Access Management</div> | ||
<div *ngIf="(iamMajorVersion$ | async) === 'v2'"> | ||
<div class="group" *ngIf="policies.visible || roles.visible || projects.visible && (iamMinorVersion$ | async) === 'v1'">Access Management</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.
Seemed like this was being slightly redundant putting it here--why not just move the one on the chef-sidebar up to its parent app-authorized?--but as we discovered, doing that, and changing this to projects?.visible
failed! Seems like the Angular reference variable (projects
) is not quite like a real variable after all, so this is a good solution!
@@ -27,7 +27,7 @@ | |||
</app-authorized> | |||
|
|||
<div *ngIf="(iamMajorVersion$ | async) !== 'v1'"> | |||
<div class="group" *ngIf="policies.visible || roles.visible || projects.visible">Access Management</div> | |||
<div class="group" *ngIf="policies.visible || roles.visible || projects.visible && (iamMinorVersion$ | async) === 'v1'">Access Management</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.
Sorry, got distracted and forgot one comment.
I would urge adding parentheses around the new expression (projects.visible && (iamMinorVersion$ | async) === 'v1'")
. Should not rely on assumptions about operator precedence.
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.
This is fine, but I wonder a bit if this isn't asking for a general solution -- feels like a general problem: "if any of the sub-categories exist, display the category header"
ℹ️ I'll rebase out of politeness and merge this when green. |
Signed-off-by: Blake Johnson <[email protected]>
Signed-off-by: Blake Johnson <[email protected]>
0d66b62
to
c3010d5
Compare
🔩 Description
Previously, if logged in as an "Editor" on 2.0, we were seeing the "Access Management" title in the sidebar without any subcategories.
With this change, an Editor does not see the title on 2.0. However, on 2.1, the editor can see both the title and "Projects" underneath.
On 2.0:

On 2.1:
