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/variables/inspect/VariablesUnknownTable.tsx

81 lines
2.2 KiB

import React, { FC } from 'react';
import { css } from '@emotion/css';
import { Icon, Tooltip, useStyles } from '@grafana/ui';
import { GrafanaTheme } from '@grafana/data';
import { UsagesToNetwork } from './utils';
import { VariablesUnknownButton } from './VariablesUnknownButton';
interface Props {
usages: UsagesToNetwork[];
}
export const VariablesUnknownTable: FC<Props> = ({ usages }) => {
const style = useStyles(getStyles);
return (
<div className={style.container}>
<h5>
Unknown Variables
<Tooltip content="This table lists all variable references that no longer exist in this dashboard.">
<Icon name="info-circle" className={style.infoIcon} />
</Tooltip>
</h5>
<div>
<table className="filter-table filter-table--hover">
<thead>
<tr>
<th>Variable</th>
<th colSpan={5} />
</tr>
</thead>
<tbody>
{usages.map((usage) => {
const { variable } = usage;
const { id, name } = variable;
return (
<tr key={id}>
<td className={style.firstColumn}>
<span>{name}</span>
</td>
<td className={style.defaultColumn} />
<td className={style.defaultColumn} />
<td className={style.defaultColumn} />
<td className={style.lastColumn}>
<VariablesUnknownButton id={variable.id} usages={usages} />
</td>
</tr>
);
})}
</tbody>
</table>
</div>
</div>
);
};
const getStyles = (theme: GrafanaTheme) => ({
container: css`
margin-top: ${theme.spacing.xl};
padding-top: ${theme.spacing.xl};
border-top: 1px solid ${theme.colors.panelBorder};
`,
infoIcon: css`
margin-left: ${theme.spacing.sm};
`,
defaultColumn: css`
width: 1%;
`,
firstColumn: css`
width: 1%;
vertical-align: top;
color: ${theme.colors.textStrong};
`,
lastColumn: css`
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 100%;
text-align: right;
`,
});