|
|
|
|
@ -1,8 +1,9 @@ |
|
|
|
|
import { css } from '@emotion/css'; |
|
|
|
|
import React, { useState } from 'react'; |
|
|
|
|
|
|
|
|
|
import { arrayUtils, AnnotationQuery } from '@grafana/data'; |
|
|
|
|
import { getDataSourceSrv } from '@grafana/runtime'; |
|
|
|
|
import { Button, DeleteButton, IconButton, VerticalGroup } from '@grafana/ui'; |
|
|
|
|
import { Button, DeleteButton, IconButton, useStyles2, VerticalGroup } from '@grafana/ui'; |
|
|
|
|
import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA'; |
|
|
|
|
|
|
|
|
|
import { DashboardModel } from '../../state/DashboardModel'; |
|
|
|
|
@ -15,6 +16,7 @@ type Props = { |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
export const AnnotationSettingsList = ({ dashboard, onNew, onEdit }: Props) => { |
|
|
|
|
const styles = useStyles2(getStyles); |
|
|
|
|
const [annotations, updateAnnotations] = useState(dashboard.annotations.list); |
|
|
|
|
|
|
|
|
|
const onMove = (idx: number, direction: number) => { |
|
|
|
|
@ -53,6 +55,7 @@ export const AnnotationSettingsList = ({ dashboard, onNew, onEdit }: Props) => { |
|
|
|
|
return ( |
|
|
|
|
<VerticalGroup> |
|
|
|
|
{annotations.length > 0 && ( |
|
|
|
|
<div className={styles.table}> |
|
|
|
|
<table role="grid" className="filter-table filter-table--hover"> |
|
|
|
|
<thead> |
|
|
|
|
<tr> |
|
|
|
|
@ -101,6 +104,7 @@ export const AnnotationSettingsList = ({ dashboard, onNew, onEdit }: Props) => { |
|
|
|
|
))} |
|
|
|
|
</tbody> |
|
|
|
|
</table> |
|
|
|
|
</div> |
|
|
|
|
)} |
|
|
|
|
{showEmptyListCTA && ( |
|
|
|
|
<EmptyListCTA |
|
|
|
|
@ -127,3 +131,10 @@ export const AnnotationSettingsList = ({ dashboard, onNew, onEdit }: Props) => { |
|
|
|
|
</VerticalGroup> |
|
|
|
|
); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const getStyles = () => ({ |
|
|
|
|
table: css` |
|
|
|
|
width: 100%; |
|
|
|
|
overflow-x: scroll; |
|
|
|
|
`,
|
|
|
|
|
}); |
|
|
|
|
|