Skip to content

Commit

Permalink
feat: [M3-8703] - Disable Create VPC button with tooltip text on empt…
Browse files Browse the repository at this point in the history
…y state Landing Page for restricted users (#11052)

* feat: [M3-8703] - Disable Create VPC button with tooltip text on empty state Landing Page for restricted users

* Added changeset: Disable Create VPC button with tooltip text on empty state Landing Page for restricted users ([#11052](#11052))

* Added changeset: Disable Create VPC button with tooltip text on empty state Landing Page for restricted users

* Changed changeset: Disable Create VPC button with tooltip text on empty state Landing Page for restricted users

* refactor: [M3-8703] Making variables more descriptive
  • Loading branch information
hasyed-akamai authored Oct 14, 2024
1 parent d37a032 commit 054ea88
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-11052-changed-1728305995058.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Changed
---

Disable Create VPC button with tooltip text on empty state Landing Page for restricted users ([#11052](https://github.com/linode/manager/pull/11052))
12 changes: 12 additions & 0 deletions packages/manager/src/features/VPCs/VPCLanding/VPCEmptyState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,25 @@ import { useHistory } from 'react-router-dom';
import VPC from 'src/assets/icons/entityIcons/vpc.svg';
import { ResourcesSection } from 'src/components/EmptyLandingPageResources/ResourcesSection';
import { gettingStartedGuides } from 'src/features/VPCs/VPCLanding/VPCLandingEmptyStateData';
import { useRestrictedGlobalGrantCheck } from 'src/hooks/useRestrictedGlobalGrantCheck';
import { getRestrictedResourceText } from 'src/features/Account/utils';
import { sendEvent } from 'src/utilities/analytics/utils';

import { headers, linkAnalyticsEvent } from './VPCEmptyStateData';

export const VPCEmptyState = () => {
const { push } = useHistory();

const isVPCCreationRestricted = useRestrictedGlobalGrantCheck({
globalGrantType: 'add_vpcs',
});

return (
<ResourcesSection
buttonProps={[
{
children: 'Create VPC',
disabled: isVPCCreationRestricted,
onClick: () => {
sendEvent({
action: 'Click:button',
Expand All @@ -24,6 +31,11 @@ export const VPCEmptyState = () => {
});
push('/vpcs/create');
},
tooltipText: getRestrictedResourceText({
action: 'create',
isSingular: false,
resourceType: 'VPCs',
}),
},
]}
gettingStartedGuidesData={gettingStartedGuides}
Expand Down

0 comments on commit 054ea88

Please sign in to comment.