diff --git a/packages/manager/.changeset/pr-11108-changed-1729059614823.md b/packages/manager/.changeset/pr-11108-changed-1729059614823.md new file mode 100644 index 00000000000..9339b47b880 --- /dev/null +++ b/packages/manager/.changeset/pr-11108-changed-1729059614823.md @@ -0,0 +1,5 @@ +--- +"@linode/manager": Changed +--- + +Disable Longview 'Add Client' button with tooltip text on landing page for restricted users. ([#11108](https://github.com/linode/manager/pull/11108)) diff --git a/packages/manager/src/features/Longview/LongviewLanding/LongviewLanding.tsx b/packages/manager/src/features/Longview/LongviewLanding/LongviewLanding.tsx index b14810020cb..138ed3d0cf4 100644 --- a/packages/manager/src/features/Longview/LongviewLanding/LongviewLanding.tsx +++ b/packages/manager/src/features/Longview/LongviewLanding/LongviewLanding.tsx @@ -19,6 +19,8 @@ import withLongviewClients from 'src/containers/longview.container'; import { useAPIRequest } from 'src/hooks/useAPIRequest'; import { useAccountSettings } from 'src/queries/account/settings'; import { getAPIErrorOrDefault } from 'src/utilities/errorUtils'; +import { useRestrictedGlobalGrantCheck } from 'src/hooks/useRestrictedGlobalGrantCheck'; +import { getRestrictedResourceText } from 'src/features/Account/utils'; import { SubscriptionDialog } from './SubscriptionDialog'; @@ -71,6 +73,10 @@ export const LongviewLanding = (props: LongviewLandingProps) => { }, ]; + const isLongviewCreationRestricted = useRestrictedGlobalGrantCheck({ + globalGrantType: 'add_longview', + }); + const matches = (p: string) => { return Boolean(matchPath(p, { path: props.location.pathname })); }; @@ -134,6 +140,14 @@ export const LongviewLanding = (props: LongviewLandingProps) => { onButtonClick={handleAddClient} removeCrumbX={1} title="Longview" + disabledCreateButton={isLongviewCreationRestricted} + buttonDataAttrs={{ + tooltipText: getRestrictedResourceText({ + action: 'create', + isSingular: false, + resourceType: 'Longview Clients', + }), + }} />