fix: Bail on audit logs permissions (#28096)

This commit is contained in:
Kamil Ogórek authored and GitHub committed 2024-07-19 19:15:52 +00:00
1 parent 0eec3f1de6
commit 057b2f1705
3 files changed
+13 -8

No files matched your search

@@ -69,7 +69,7 @@ const AuditLogs = () => {
{
enabled: canReadAuditLogs,
retry(_failureCount, error) {
if (error.message.endsWith('upgrade to team or Enterprise Plan to access audit logs.')) {
if (error.message.endsWith('upgrade to Team or Enterprise Plan to access audit logs.')) {
return false
}
return true
@@ -144,7 +144,7 @@ const AuditLogs = () => {
)}
{isError ? (
error.message.endsWith('upgrade to team or Enterprise Plan to access audit logs.') ? (
error.message.endsWith('upgrade to Team or Enterprise Plan to access audit logs.') ? (
<Alert_Shadcn_
variant="default"
title="Organization Audit Logs are not available on Free or Pro plans"
@@ -1,6 +1,6 @@
import sumBy from 'lodash/sumBy'
import { Fragment, useState } from 'react'
import { ChevronRight } from 'lucide-react'
import { Fragment, useState } from 'react'
import { useParams } from 'common'
import {
@@ -8,20 +8,20 @@ import {
TextFormatter,
} from 'components/interfaces/Settings/Logs/LogsFormatters'
import Table from 'components/to-be-cleaned/Table'
import AlertError from 'components/ui/AlertError'
import BarChart from 'components/ui/Charts/BarChart'
import { useFillTimeseriesSorted } from 'hooks/analytics/useFillTimeseriesSorted'
import { ResponseError } from 'types'
import {
Alert_Shadcn_,
AlertDescription_Shadcn_,
AlertTitle_Shadcn_,
Button,
Collapsible,
WarningIcon,
} from 'ui'
import { queryParamsToObject } from '../Reports.utils'
import { ReportWidgetProps, ReportWidgetRendererProps } from '../ReportWidget'
import AlertError from 'components/ui/AlertError'
import { ResponseError } from 'types'
import { WarningIcon } from 'ui-patterns/Icons/StatusIcons'
export const NetworkTrafficRenderer = (
props: ReportWidgetProps<{
@@ -17,8 +17,13 @@ import { useEdgeFunctionQuery } from 'data/edge-functions/edge-function-query'
import { useFillTimeseriesSorted } from 'hooks/analytics/useFillTimeseriesSorted'
import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'
import type { ChartIntervals, NextPageWithLayout } from 'types'
import { AlertDescription_Shadcn_, AlertTitle_Shadcn_, Alert_Shadcn_, Button } from 'ui'
import { WarningIcon } from 'ui-patterns/Icons/StatusIcons'
import {
AlertDescription_Shadcn_,
AlertTitle_Shadcn_,
Alert_Shadcn_,
Button,
WarningIcon,
} from 'ui'
const CHART_INTERVALS: ChartIntervals[] = [
{