fix: standardize all @lib imports and add missing rbac utility
This commit is contained in:
parent
d266e6e90c
commit
9c0372694e
@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import { InsightState } from '../../insight/store/urlState'
|
||||
import { formatDuration } from '@lib/format'
|
||||
import { formatDuration } from '../../../lib/format'
|
||||
|
||||
interface TimeRangePickerProps {
|
||||
state: InsightState
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
import { useMemo, useState } from 'react'
|
||||
import { InsightState } from '../../insight/store/urlState'
|
||||
import { canAccessSnippet } from '@lib/rbac'
|
||||
import { canAccessSnippet } from '../../../lib/rbac'
|
||||
|
||||
interface Snippet {
|
||||
name: string
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import { LogEntry } from '../../insight/services/adapters/logs'
|
||||
import { getLogLevelColor } from '@lib/format'
|
||||
import { getLogLevelColor } from '../../../lib/format'
|
||||
|
||||
interface LogsTableProps {
|
||||
logs: LogEntry[]
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import { LogEntry } from '../../insight/services/adapters/logs'
|
||||
import { getLogLevelColor } from '@lib/format'
|
||||
import { getLogLevelColor } from '../../../lib/format'
|
||||
|
||||
interface LogsViewerProps {
|
||||
logs: LogEntry[]
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import { PrometheusResponse } from '../../insight/services/adapters/prometheus'
|
||||
import { formatNumber } from '@lib/format'
|
||||
import { formatNumber } from '../../../lib/format'
|
||||
|
||||
interface MetricsChartProps {
|
||||
series: PrometheusResponse[]
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import { PrometheusResponse } from '../../insight/services/adapters/prometheus'
|
||||
import { formatNumber } from '@lib/format'
|
||||
import { formatNumber } from '../../../lib/format'
|
||||
|
||||
interface MetricsTableProps {
|
||||
series: PrometheusResponse[]
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import { PrometheusResponse } from '../../insight/services/adapters/prometheus'
|
||||
import { formatNumber } from '@lib/format'
|
||||
import { formatNumber } from '../../../lib/format'
|
||||
|
||||
interface MetricsTopStatsProps {
|
||||
series: PrometheusResponse[]
|
||||
|
||||
14
workbench/src/lib/rbac.ts
Normal file
14
workbench/src/lib/rbac.ts
Normal file
@ -0,0 +1,14 @@
|
||||
export interface SnippetRBAC {
|
||||
roles?: string[]
|
||||
environments?: string[]
|
||||
}
|
||||
|
||||
export function canAccessSnippet(rbac: SnippetRBAC | undefined, context: {
|
||||
role: string
|
||||
env: string
|
||||
}) {
|
||||
if (!rbac) return true
|
||||
if (rbac.roles && !rbac.roles.includes(context.role)) return false
|
||||
if (rbac.environments && !rbac.environments.includes(context.env)) return false
|
||||
return true
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user