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/playlist/PlaylistTable.tsx

38 lines
1.1 KiB

import React from 'react';
import { DragDropContext, Droppable, DropResult } from 'react-beautiful-dnd';
import { PlaylistTableRows } from './PlaylistTableRows';
import { PlaylistItem } from './types';
interface Props {
items: PlaylistItem[];
deleteItem: (idx: number) => void;
moveItem: (src: number, dst: number) => void;
}
export const PlaylistTable = ({ items, deleteItem, moveItem }: Props) => {
const onDragEnd = (d: DropResult) => {
if (d.destination) {
moveItem(d.source.index, d.destination?.index);
}
};
return (
<div className="gf-form-group">
<h3 className="page-headering">Dashboards</h3>
<DragDropContext onDragEnd={onDragEnd}>
<Droppable droppableId="playlist-list" direction="vertical">
{(provided) => {
return (
<div ref={provided.innerRef} {...provided.droppableProps}>
<PlaylistTableRows items={items} onDelete={deleteItem} />
{provided.placeholder}
</div>
);
}}
</Droppable>
</DragDropContext>
</div>
);
};