diff --git a/packages/manager/.changeset/pr-13307-changed-1769076848249.md b/packages/manager/.changeset/pr-13307-changed-1769076848249.md new file mode 100644 index 00000000000..3bd01104de7 --- /dev/null +++ b/packages/manager/.changeset/pr-13307-changed-1769076848249.md @@ -0,0 +1,5 @@ +--- +"@linode/manager": Changed +--- + +Logs Log path sample info tooltip show content restricted by account capablities ([#13307](https://github.com/linode/manager/pull/13307)) diff --git a/packages/manager/src/features/Delivery/Shared/PathSample.tsx b/packages/manager/src/features/Delivery/Shared/PathSample.tsx index 85ee27521f4..b18e11e85ab 100644 --- a/packages/manager/src/features/Delivery/Shared/PathSample.tsx +++ b/packages/manager/src/features/Delivery/Shared/PathSample.tsx @@ -6,7 +6,10 @@ import * as React from 'react'; import { useMemo } from 'react'; import { useFormContext, useWatch } from 'react-hook-form'; -import { getStreamTypeOption } from 'src/features/Delivery/deliveryUtils'; +import { + getStreamTypeOption, + useIsLkeEAuditLogsTypeSelectionEnabled, +} from 'src/features/Delivery/deliveryUtils'; const sxTooltipIcon = { marginLeft: '4px', @@ -43,6 +46,8 @@ export const PathSample = (props: PathSampleProps) => { }); const { data: account } = useAccount(); + const isLkeEAuditLogsTypeSelectionEnabled = + useIsLkeEAuditLogsTypeSelectionEnabled(); const [month, day, year] = new Date().toLocaleDateString('en-US').split('/'); const setStreamType = (): StreamType => { @@ -92,7 +97,9 @@ export const PathSample = (props: PathSampleProps) => { text={ Default paths: - {`${getStreamTypeOption(streamType.LKEAuditLogs)?.label} - {stream_type}/{log_type}/ {account}/{partition}/ {%Y/%m/%d/}`} + {isLkeEAuditLogsTypeSelectionEnabled && ( + {`${getStreamTypeOption(streamType.LKEAuditLogs)?.label} - {stream_type}/{log_type}/ {account}/{partition}/ {%Y/%m/%d/}`} + )} {`${getStreamTypeOption(streamType.AuditLogs)?.label} - {stream_type}/{log_type}/ {account}/{%Y/%m/%d/}`} } diff --git a/packages/manager/src/features/Delivery/Streams/StreamForm/StreamFormGeneralInfo.tsx b/packages/manager/src/features/Delivery/Streams/StreamForm/StreamFormGeneralInfo.tsx index 602477cf379..56097376e38 100644 --- a/packages/manager/src/features/Delivery/Streams/StreamForm/StreamFormGeneralInfo.tsx +++ b/packages/manager/src/features/Delivery/Streams/StreamForm/StreamFormGeneralInfo.tsx @@ -1,5 +1,4 @@ import { streamType } from '@linode/api-v4'; -import { useAccount } from '@linode/queries'; import { Autocomplete, Box, @@ -16,6 +15,7 @@ import { Controller, useFormContext, useWatch } from 'react-hook-form'; import { getStreamTypeOption, isFormInEditMode, + useIsLkeEAuditLogsTypeSelectionEnabled, } from 'src/features/Delivery/deliveryUtils'; import { streamTypeOptions } from 'src/features/Delivery/Shared/types'; @@ -36,10 +36,8 @@ export const StreamFormGeneralInfo = (props: StreamFormGeneralInfoProps) => { const theme = useTheme(); const { control, setValue } = useFormContext(); - const { data: account } = useAccount(); - const isLkeEAuditLogsTypeSelectionDisabled = !account?.capabilities?.includes( - 'Akamai Cloud Pulse Logs LKE-E Audit' - ); + const isLkeEAuditLogsTypeSelectionDisabled = + !useIsLkeEAuditLogsTypeSelectionEnabled(); const capitalizedMode = capitalize(mode); const description = { diff --git a/packages/manager/src/features/Delivery/deliveryUtils.ts b/packages/manager/src/features/Delivery/deliveryUtils.ts index 4710be9407e..a5d27e9989d 100644 --- a/packages/manager/src/features/Delivery/deliveryUtils.ts +++ b/packages/manager/src/features/Delivery/deliveryUtils.ts @@ -97,3 +97,10 @@ export const getStreamDescription = (stream: Stream) => { export const getDestinationDescription = (destination: Destination) => { return `${getDestinationTypeOption(destination.type)?.label}`; }; + +export const useIsLkeEAuditLogsTypeSelectionEnabled = (): boolean => { + const { data: account } = useAccount(); + return !!account?.capabilities?.includes( + 'Akamai Cloud Pulse Logs LKE-E Audit' + ); +};