1import { PanelModel } from '../dashboard/state';
2import { Dispatch } from 'react';
3import { AnyAction } from '@reduxjs/toolkit';
4
5export enum LibraryElementKind {
6  Panel = 1,
7  Variable,
8}
9
10export enum LibraryElementConnectionKind {
11  Dashboard = 1,
12}
13
14export interface LibraryElementConnectionDTO {
15  id: number;
16  kind: LibraryElementConnectionKind;
17  elementId: number;
18  connectionId: number;
19  created: string;
20  createdBy: LibraryElementDTOMetaUser;
21}
22
23export interface LibraryElementsSearchResult {
24  totalCount: number;
25  elements: LibraryElementDTO[];
26  perPage: number;
27  page: number;
28}
29
30export interface LibraryElementDTO {
31  id: number;
32  orgId: number;
33  folderId: number;
34  uid: string;
35  name: string;
36  kind: LibraryElementKind;
37  type: string;
38  description: string;
39  model: any;
40  version: number;
41  meta: LibraryElementDTOMeta;
42}
43
44export interface LibraryElementDTOMeta {
45  folderName: string;
46  folderUid: string;
47  connectedDashboards: number;
48  created: string;
49  updated: string;
50  createdBy: LibraryElementDTOMetaUser;
51  updatedBy: LibraryElementDTOMetaUser;
52}
53
54export interface LibraryElementDTOMetaUser {
55  id: number;
56  name: string;
57  avatarUrl: string;
58}
59
60export type PanelModelLibraryPanel = Pick<LibraryElementDTO, 'uid' | 'name' | 'meta' | 'version'>;
61
62export interface PanelModelWithLibraryPanel extends PanelModel {
63  libraryPanel: PanelModelLibraryPanel;
64}
65
66export type DispatchResult = (dispatch: Dispatch<AnyAction>) => void;
67