Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-13307-changed-1769076848249.md
Original file line number Diff line number Diff line change
@@ -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))
11 changes: 9 additions & 2 deletions packages/manager/src/features/Delivery/Shared/PathSample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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 => {
Expand Down Expand Up @@ -92,7 +97,9 @@ export const PathSample = (props: PathSampleProps) => {
text={
<Stack spacing={2}>
<Typography>Default paths:</Typography>
<Typography>{`${getStreamTypeOption(streamType.LKEAuditLogs)?.label} - {stream_type}/{log_type}/ {account}/{partition}/ {%Y/%m/%d/}`}</Typography>
{isLkeEAuditLogsTypeSelectionEnabled && (
<Typography>{`${getStreamTypeOption(streamType.LKEAuditLogs)?.label} - {stream_type}/{log_type}/ {account}/{partition}/ {%Y/%m/%d/}`}</Typography>
)}
<Typography>{`${getStreamTypeOption(streamType.AuditLogs)?.label} - {stream_type}/{log_type}/ {account}/{%Y/%m/%d/}`}</Typography>
</Stack>
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { streamType } from '@linode/api-v4';
import { useAccount } from '@linode/queries';
import {
Autocomplete,
Box,
Expand All @@ -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';

Expand All @@ -36,10 +36,8 @@ export const StreamFormGeneralInfo = (props: StreamFormGeneralInfoProps) => {

const theme = useTheme();
const { control, setValue } = useFormContext<StreamAndDestinationFormType>();
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 = {
Expand Down
7 changes: 7 additions & 0 deletions packages/manager/src/features/Delivery/deliveryUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
};