The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/public/app/features/admin/AdminOrgsTable.tsx

57 lines
1.7 KiB

import React, { FC, useState } from 'react';
import { Organization } from 'app/types';
import { Button, ConfirmModal } from '@grafana/ui';
interface Props {
orgs: Organization[];
onDelete: (orgId: number) => void;
}
export const AdminOrgsTable: FC<Props> = ({ orgs, onDelete }) => {
const [deleteOrg, setDeleteOrg] = useState<Organization>();
return (
<table className="filter-table form-inline filter-table--hover">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th style={{ width: '1%' }}></th>
</tr>
</thead>
<tbody>
{orgs.map((org) => (
<tr key={`${org.id}-${org.name}`}>
<td className="link-td">
<a href={`admin/orgs/edit/${org.id}`}>{org.id}</a>
</td>
<td className="link-td">
<a href={`admin/orgs/edit/${org.id}`}>{org.name}</a>
</td>
<td className="text-right">
<Button variant="destructive" size="sm" icon="times" onClick={() => setDeleteOrg(org)} />
</td>
</tr>
))}
</tbody>
{deleteOrg && (
<ConfirmModal
isOpen
icon="trash-alt"
title="Delete"
body={
<div>
Are you sure you want to delete &apos;{deleteOrg.name}&apos;?
<br /> <small>All dashboards for this organization will be removed!</small>
</div>
}
confirmText="Delete"
onDismiss={() => setDeleteOrg(undefined)}
onConfirm={() => {
onDelete(deleteOrg.id);
setDeleteOrg(undefined);
}}
/>
)}
</table>
);
};