From 054ea88a450a0d8f5537c03848c50341b39e46e8 Mon Sep 17 00:00:00 2001 From: hasyed-akamai Date: Mon, 14 Oct 2024 12:11:17 +0530 Subject: [PATCH] feat: [M3-8703] - Disable Create VPC button with tooltip text on empty 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](https://github.com/linode/manager/pull/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 --- .../.changeset/pr-11052-changed-1728305995058.md | 5 +++++ .../src/features/VPCs/VPCLanding/VPCEmptyState.tsx | 12 ++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 packages/manager/.changeset/pr-11052-changed-1728305995058.md diff --git a/packages/manager/.changeset/pr-11052-changed-1728305995058.md b/packages/manager/.changeset/pr-11052-changed-1728305995058.md new file mode 100644 index 00000000000..b799c9bd432 --- /dev/null +++ b/packages/manager/.changeset/pr-11052-changed-1728305995058.md @@ -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)) diff --git a/packages/manager/src/features/VPCs/VPCLanding/VPCEmptyState.tsx b/packages/manager/src/features/VPCs/VPCLanding/VPCEmptyState.tsx index 858e9315b1d..721707b9b9f 100644 --- a/packages/manager/src/features/VPCs/VPCLanding/VPCEmptyState.tsx +++ b/packages/manager/src/features/VPCs/VPCLanding/VPCEmptyState.tsx @@ -4,6 +4,8 @@ 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'; @@ -11,11 +13,16 @@ import { headers, linkAnalyticsEvent } from './VPCEmptyStateData'; export const VPCEmptyState = () => { const { push } = useHistory(); + const isVPCCreationRestricted = useRestrictedGlobalGrantCheck({ + globalGrantType: 'add_vpcs', + }); + return ( { sendEvent({ action: 'Click:button', @@ -24,6 +31,11 @@ export const VPCEmptyState = () => { }); push('/vpcs/create'); }, + tooltipText: getRestrictedResourceText({ + action: 'create', + isSingular: false, + resourceType: 'VPCs', + }), }, ]} gettingStartedGuidesData={gettingStartedGuides}