From 449c3bd0ed527dedbe9781cb0db6848e35c9e63d Mon Sep 17 00:00:00 2001 From: hasyed-akamai Date: Mon, 14 Oct 2024 14:57:24 +0530 Subject: [PATCH 1/2] feat: [M3-8704] - Disable Create Firewalls button with tooltip text on empty state Landing Page for restricted users --- .../FirewallLanding/FirewallLandingEmptyState.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/manager/src/features/Firewalls/FirewallLanding/FirewallLandingEmptyState.tsx b/packages/manager/src/features/Firewalls/FirewallLanding/FirewallLandingEmptyState.tsx index 1a5ccbab7d0..7822e9e81eb 100644 --- a/packages/manager/src/features/Firewalls/FirewallLanding/FirewallLandingEmptyState.tsx +++ b/packages/manager/src/features/Firewalls/FirewallLanding/FirewallLandingEmptyState.tsx @@ -2,6 +2,8 @@ import * as React from 'react'; import FirewallIcon from 'src/assets/icons/entityIcons/firewall.svg'; import { ResourcesSection } from 'src/components/EmptyLandingPageResources/ResourcesSection'; +import { useRestrictedGlobalGrantCheck } from 'src/hooks/useRestrictedGlobalGrantCheck'; +import { getRestrictedResourceText } from 'src/features/Account/utils'; import { sendEvent } from 'src/utilities/analytics/utils'; import { @@ -18,11 +20,16 @@ interface Props { export const FirewallLandingEmptyState = (props: Props) => { const { openAddFirewallDrawer } = props; + const isFirewallsCreationRestricted = useRestrictedGlobalGrantCheck({ + globalGrantType: 'add_firewalls', + }); + return ( { sendEvent({ action: 'Click:button', @@ -31,6 +38,11 @@ export const FirewallLandingEmptyState = (props: Props) => { }); openAddFirewallDrawer(); }, + tooltipText: getRestrictedResourceText({ + action: 'create', + isSingular: false, + resourceType: 'Firewalls', + }), }, ]} gettingStartedGuidesData={gettingStartedGuides} From 17b9ff88111e0b65a0dddd72cd3247aa0896dc50 Mon Sep 17 00:00:00 2001 From: hasyed-akamai Date: Mon, 14 Oct 2024 15:09:27 +0530 Subject: [PATCH 2/2] Added changeset: Disable Create Firewall button with tooltip text on empty state Landing Page for restricted users --- packages/manager/.changeset/pr-11093-fixed-1728898767762.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 packages/manager/.changeset/pr-11093-fixed-1728898767762.md diff --git a/packages/manager/.changeset/pr-11093-fixed-1728898767762.md b/packages/manager/.changeset/pr-11093-fixed-1728898767762.md new file mode 100644 index 00000000000..eb9f6d41006 --- /dev/null +++ b/packages/manager/.changeset/pr-11093-fixed-1728898767762.md @@ -0,0 +1,5 @@ +--- +"@linode/manager": Fixed +--- + +Disable Create Firewall button with tooltip text on empty state Landing Page for restricted users ([#11093](https://github.com/linode/manager/pull/11093))