feat: update dependencies and enhance UI components
- Added new dependencies for drag-and-drop functionality with @dnd-kit packages. - Updated package versions for @tanstack/react-virtual and date-fns. - Refactored AppShell component to utilize AppSidebar and SiteHeader for improved layout. - Enhanced Frame component with new theming capabilities and improved structure. - Introduced filtering capabilities in Agents and Lists pages with new UI elements. - Added new utility functions for authentication claims management. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
import {
|
||||
ChartBarIcon,
|
||||
CloudIcon,
|
||||
GlobeIcon,
|
||||
LayoutDashboardIcon,
|
||||
ServerIcon,
|
||||
type LucideIcon,
|
||||
} from 'lucide-react'
|
||||
import type { AppSwitcherConfig, AppSwitcherEntry } from '@evofw/shared'
|
||||
|
||||
/** JWT / portal app id for this product */
|
||||
export const CURRENT_APP_ID = 'fw'
|
||||
|
||||
export type AppSwitcherIconName = keyof typeof APP_SWITCHER_ICONS
|
||||
|
||||
export const APP_SWITCHER_ICONS: Record<
|
||||
'server' | 'cloud' | 'globe' | 'dashboard' | 'chart',
|
||||
LucideIcon
|
||||
> = {
|
||||
server: ServerIcon,
|
||||
cloud: CloudIcon,
|
||||
globe: GlobeIcon,
|
||||
dashboard: LayoutDashboardIcon,
|
||||
chart: ChartBarIcon,
|
||||
}
|
||||
|
||||
/** Offline fallback when auth-portal is unreachable */
|
||||
export const DEFAULT_APP_SWITCHER_CONFIG: AppSwitcherConfig = {
|
||||
menuLabel: 'Приложения',
|
||||
apps: [
|
||||
{
|
||||
id: 'fw',
|
||||
name: 'EvoFirewall',
|
||||
subtitle: 'Firewall controller',
|
||||
url: 'http://localhost:5177',
|
||||
icon: 'server',
|
||||
},
|
||||
{
|
||||
id: 'vps',
|
||||
name: 'VPS Tracker',
|
||||
subtitle: 'Учёт виртуальных серверов',
|
||||
url: 'https://vps.shnt.top',
|
||||
icon: 'server',
|
||||
},
|
||||
{
|
||||
id: 'cfdm',
|
||||
name: 'CF Domain Manager',
|
||||
subtitle: 'Управление доменами',
|
||||
url: 'https://cfdm.shnt.top',
|
||||
icon: 'cloud',
|
||||
},
|
||||
{
|
||||
id: 'bgp',
|
||||
name: 'EvoBGP',
|
||||
subtitle: 'BGP маршрутизация',
|
||||
url: 'https://bgp.shnt.top',
|
||||
icon: 'globe',
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
export function getAppUrl(
|
||||
appId: string,
|
||||
config: AppSwitcherConfig = DEFAULT_APP_SWITCHER_CONFIG,
|
||||
): string | undefined {
|
||||
return config.apps.find((app) => app.id === appId)?.url
|
||||
}
|
||||
|
||||
export function getCurrentApp(
|
||||
config: AppSwitcherConfig = DEFAULT_APP_SWITCHER_CONFIG,
|
||||
): AppSwitcherEntry {
|
||||
return config.apps.find((app) => app.id === CURRENT_APP_ID) ?? config.apps[0]!
|
||||
}
|
||||
@@ -118,6 +118,12 @@ export function redirectToPortalLogin(returnTo: string) {
|
||||
window.location.href = url
|
||||
}
|
||||
|
||||
export function getClaims(): AccessClaims | null {
|
||||
const t = getToken()
|
||||
if (!t) return null
|
||||
return parseClaims(t)
|
||||
}
|
||||
|
||||
export function logout() {
|
||||
clearToken()
|
||||
window.location.href = `${authPortalUrl()}/logout`
|
||||
|
||||
Reference in New Issue
Block a user