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

UI: wrap client count card in permission conditional #26848

Merged

Conversation

hellobontempo
Copy link
Contributor

@hellobontempo hellobontempo commented May 7, 2024

In #26729 I removed the @license arg because the card no longer required the start time to pass to the activity log query. Inadvertently, this showed the card for users with just a default policy because the @license call would fail if a user didn't have permission.

This PR wraps the card in an explicit permissions conditional, which is the same one we use to hide the link in the sidebar for users who do not have permission to /activity. Tests have also been added to avoid a future regression.

User with default policy
Screenshot 2024-05-07 at 11 51 55 AM

@hellobontempo hellobontempo added this to the 1.17.0-rc milestone May 7, 2024
@hellobontempo hellobontempo requested a review from a team as a code owner May 7, 2024 10:39
@github-actions github-actions bot added the hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed label May 7, 2024
Copy link

github-actions bot commented May 7, 2024

Build Results:
All builds succeeded! ✅

Copy link

github-actions bot commented May 7, 2024

CI Results:
All Go tests succeeded! ✅

@@ -0,0 +1,3 @@
```release-note:improvement
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even though I removed the license call in 1.17, I thought a changelog might be prudent because we're changing behavior here.

@@ -9,10 +9,10 @@
<div class="is-flex-row gap-24">
{{#if (and @version.isEnterprise @isRootNamespace)}}
<div class="is-flex-column is-flex-1 gap-24">
<Dashboard::ClientCountCard @isEnterprise={{@version.isEnterprise}} />
{{#if
(and @isRootNamespace (has-permission "status" routeParams="replication") (not (is-empty-value @replication)))
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 removed @isRootNamespace since that check happens above on line 10

Copy link
Contributor

@hashishaw hashishaw left a comment

Choose a reason for hiding this comment

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

🚀 Thank you!

@@ -79,7 +79,7 @@
/>
<small class="has-left-margin-xs has-text-grey">
Updated
{{date-format @updatedAt "MMM dd, yyyy hh:mm:ss"}}
{{date-format @updatedAt "MMM d yyyy, h:mm:ss aaa" withTimeZone=true}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

consistent with our response timestamp format elsewhere in the app

@@ -64,30 +59,19 @@ module('Integration | Component | dashboard/client-count-card', function (hooks)
await click('[data-test-refresh]');
});

test('it does not query activity for community edition', async function (assert) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this whole component is wrapped in an isEnterprise conditional so moved this assertion to the dashboard/overview-test

@tracked activityData = null;
@tracked updatedAt = timestamp.now().toISOString();
@tracked hasActivity = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be false instead of null?

Copy link
Contributor Author

@hellobontempo hellobontempo May 7, 2024

Choose a reason for hiding this comment

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

probably good to keep it type consistent! will update

@hellobontempo hellobontempo enabled auto-merge (squash) May 7, 2024 16:54
@hellobontempo hellobontempo merged commit 1e8eefa into main May 7, 2024
31 checks passed
@hellobontempo hellobontempo deleted the ui/VAULT-26825/wrap-dashboard-cards-in-permissions branch May 7, 2024 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants