⚝
One Hat Cyber Team
⚝
Your IP:
216.73.217.4
Server IP:
41.128.143.86
Server:
Linux host.raqmix.cloud 6.8.0-1025-azure #30~22.04.1-Ubuntu SMP Wed Mar 12 15:28:20 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.3.23
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
grafana
/
public
/
app
/
features
/
admin
/
View File Name :
AdminOrgsTable.tsx
import { css } from '@emotion/css'; import React, { useState } from 'react'; import Skeleton from 'react-loading-skeleton'; import { GrafanaTheme2 } from '@grafana/data'; import { Button, ConfirmModal, useStyles2 } from '@grafana/ui'; import { SkeletonComponent, attachSkeleton } from '@grafana/ui/src/unstable'; import { contextSrv } from 'app/core/core'; import { AccessControlAction, Organization } from 'app/types'; interface Props { orgs: Organization[]; onDelete: (orgId: number) => void; } const getTableHeader = () => (
ID
Name
); function AdminOrgsTableComponent({ orgs, onDelete }: Props) { const canDeleteOrgs = contextSrv.hasPermission(AccessControlAction.OrgsDelete); const [deleteOrg, setDeleteOrg] = useState
(); return (
{getTableHeader()}
{orgs.map((org) => (
{org.id}
{org.name}
setDeleteOrg(org)} aria-label="Delete org" disabled={!canDeleteOrgs} />
))}
{deleteOrg && (
Are you sure you want to delete '{deleteOrg.name}'?
All dashboards for this organization will be removed!
} confirmText="Delete" onDismiss={() => setDeleteOrg(undefined)} onConfirm={() => { onDelete(deleteOrg.id); setDeleteOrg(undefined); }} /> )}
); } const AdminOrgsTableSkeleton: SkeletonComponent = ({ rootProps }) => { const styles = useStyles2(getSkeletonStyles); return (
{getTableHeader()}
{new Array(3).fill(null).map((_, index) => (
))}
); }; export const AdminOrgsTable = attachSkeleton(AdminOrgsTableComponent, AdminOrgsTableSkeleton); const getSkeletonStyles = (theme: GrafanaTheme2) => ({ deleteButton: css({ alignItems: 'center', display: 'flex', height: 30, lineHeight: 1, }), });