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/sandbox/TestStuffPage.tsx

64 lines
1.8 KiB

/* eslint-disable @grafana/i18n/no-untranslated-strings */
import { NavModelItem } from '@grafana/data';
import { usePluginLinks } from '@grafana/runtime';
import { Button, LinkButton, Stack, Text } from '@grafana/ui';
import { Page } from 'app/core/components/Page/Page';
import { useAppNotification } from 'app/core/copy/appNotification';
export const TestStuffPage = () => {
const node: NavModelItem = {
id: 'test-page',
text: 'Test page',
icon: 'dashboard',
subTitle: 'FOR TESTING!',
url: 'sandbox/test',
};
const notifyApp = useAppNotification();
return (
<Page navModel={{ node: node, main: node }}>
<LinkToBasicApp extensionPointId="grafana/sandbox/testing" />
<Text variant="h5">Application notifications (toasts) testing</Text>
<Stack>
<Button onClick={() => notifyApp.success('Success toast', 'some more text goes here')} variant="primary">
Success
</Button>
<Button
onClick={() => notifyApp.warning('Warning toast', 'some more text goes here', 'bogus-trace-99999')}
variant="secondary"
>
Warning
</Button>
<Button
onClick={() => notifyApp.error('Error toast', 'some more text goes here', 'bogus-trace-fdsfdfsfds')}
variant="destructive"
>
Error
</Button>
</Stack>
</Page>
);
};
function LinkToBasicApp({ extensionPointId }: { extensionPointId: string }) {
const { links } = usePluginLinks({ extensionPointId });
if (links.length === 0) {
return null;
}
return (
<div>
{links.map((link, i) => {
return (
<LinkButton href={link.path} title={link.description} key={link.id}>
{link.title}
</LinkButton>
);
})}
</div>
);
}
export default TestStuffPage;