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

feat(hycu): disable activate and regenerate btns when licence is pending #14972

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,24 @@ describe('License Hycu shortcuts tile for dashboard test suite', () => {
);
});

it("Can't see activate button when licence is pending", async () => {
await renderTestApp(`/${licensesHycu[0].serviceName}`, {
licenseStatus: LicenseStatus.PENDING,
});

await waitFor(
() => {
expect(
screen.getByTestId('hycu_link_activated_test_id'),
).toHaveAttribute('disabled');
expect(
screen.getByTestId('hycu_link_regenerate_test_id'),
).toHaveAttribute('disabled');
},
{ timeout: 30_000 },
);
});

it("Can't open activate modal without IAM authorization", async () => {
const user = userEvent.setup();
await renderTestApp(`/${licensesHycu[1].serviceName}`, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,18 @@ const ShortcutsTile = ({ serviceName }: { serviceName: string }) => {
[serviceDetails],
);

const isLicencePending = useMemo(
() => hycuDetail?.data?.licenseStatus === LicenseStatus.PENDING,
[hycuDetail],
);

const links = useMemo(
() => ({
linkActivated: {
id: 'link_activated',
value: (
<ShortcutsItem
disabled={isServiceSuspended}
disabled={isServiceSuspended || isLicencePending}
iamActions={[IAM_ACTIONS.licenseHycuApiOvhActivate]}
urn={hycuDetail?.data?.iam?.urn}
data-testid="hycu_link_activated_test_id"
Expand All @@ -75,7 +80,7 @@ const ShortcutsTile = ({ serviceName }: { serviceName: string }) => {
id: 'link_regenerate',
value: (
<ShortcutsItem
disabled={isServiceSuspended}
disabled={isServiceSuspended || isLicencePending}
iamActions={[IAM_ACTIONS.licenseHycuApiOvhRefresh]}
urn={hycuDetail?.data?.iam?.urn}
data-testid="hycu_link_regenerate_test_id"
Expand Down
Loading