@ssa-ui-kit/infra-dash 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/LICENSE +21 -0
  2. package/dist/components/BasePanel/BasePanel.d.ts +4 -0
  3. package/dist/components/BasePanel/index.d.ts +1 -0
  4. package/dist/components/DashboardError/DashboardError.d.ts +4 -0
  5. package/dist/components/DashboardError/index.d.ts +1 -0
  6. package/dist/components/ErrorPanel/ErrorPanel.d.ts +5 -0
  7. package/dist/components/ErrorPanel/index.d.ts +1 -0
  8. package/dist/components/LoadingDashboard/LoadingDashboard.d.ts +4 -0
  9. package/dist/components/LoadingDashboard/index.d.ts +1 -0
  10. package/dist/components/LoadingPanel/LoadingPanel.d.ts +5 -0
  11. package/dist/components/LoadingPanel/index.d.ts +1 -0
  12. package/dist/entities/dashboard/index.d.ts +71 -0
  13. package/dist/entities/grafana-dashboard/index.d.ts +25 -0
  14. package/dist/entities/grafana-panel/index.d.ts +25 -0
  15. package/dist/entities/panel/index.d.ts +2 -0
  16. package/dist/entities/panel/usePanelData.d.ts +29 -0
  17. package/dist/entities/panel/withPanelData.d.ts +17 -0
  18. package/dist/features/DashboardPanelGrid.d.ts +19 -0
  19. package/dist/index.d.ts +7 -0
  20. package/dist/index.js +2971 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/panels/BarGaugePanel/BarGaugePanel.d.ts +11 -0
  23. package/dist/panels/BarGaugePanel/data-adapters/grafana.d.ts +16 -0
  24. package/dist/panels/BarGaugePanel/index.d.ts +1 -0
  25. package/dist/panels/GaugePanel/GaugePanel.d.ts +9 -0
  26. package/dist/panels/GaugePanel/data-adapters/grafana.d.ts +17 -0
  27. package/dist/panels/GaugePanel/index.d.ts +1 -0
  28. package/dist/panels/TimeseriesPanel/TimeseriesPanel.d.ts +9 -0
  29. package/dist/panels/TimeseriesPanel/data-adapters/grafana.d.ts +18 -0
  30. package/dist/panels/TimeseriesPanel/index.d.ts +1 -0
  31. package/dist/panels/index.d.ts +3 -0
  32. package/dist/provider.d.ts +11 -0
  33. package/dist/shared/context.d.ts +13 -0
  34. package/dist/shared/dashboard.d.ts +22 -0
  35. package/dist/shared/dataAdapter.d.ts +14 -0
  36. package/dist/shared/exception.d.ts +1 -0
  37. package/dist/shared/grafana.d.ts +50 -0
  38. package/dist/shared/icons/DashboardIcon.d.ts +2 -0
  39. package/dist/shared/icons/ErrorIcon.d.ts +1 -0
  40. package/dist/shared/icons/SidebarIcon.d.ts +2 -0
  41. package/dist/shared/icons/index.d.ts +3 -0
  42. package/dist/shared/panel.d.ts +96 -0
  43. package/dist/shared/panelRegistry.d.ts +9 -0
  44. package/dist/shared/query/index.d.ts +4 -0
  45. package/dist/shared/query/key.d.ts +4 -0
  46. package/dist/shared/query/mutation.d.ts +35 -0
  47. package/dist/shared/query/query.d.ts +52 -0
  48. package/dist/shared/query/useMutation.d.ts +11 -0
  49. package/dist/shared/query/useQuery.d.ts +22 -0
  50. package/dist/shared/transport/baseTransport.d.ts +35 -0
  51. package/dist/shared/transport/index.d.ts +3 -0
  52. package/dist/shared/transport/restTransport.d.ts +29 -0
  53. package/dist/shared/transport/useTransport.d.ts +2 -0
  54. package/dist/widgets/DashboardEditor/DashboardEditor.d.ts +15 -0
  55. package/dist/widgets/DashboardEditor/__mock__/index.d.ts +20 -0
  56. package/dist/widgets/DashboardEditor/components/DashboardSelectorDrawer.d.ts +6 -0
  57. package/dist/widgets/DashboardEditor/components/ExternalDashboardsList.d.ts +5 -0
  58. package/dist/widgets/DashboardEditor/components/PanelControl.d.ts +8 -0
  59. package/dist/widgets/DashboardEditor/components/PanelSettings.d.ts +7 -0
  60. package/dist/widgets/DashboardEditor/components/PanelSettingsDrawer.d.ts +6 -0
  61. package/dist/widgets/DashboardEditor/helpers.d.ts +39 -0
  62. package/dist/widgets/DashboardEditor/index.d.ts +1 -0
  63. package/dist/widgets/DashboardViewer/DashboardViewer.d.ts +7 -0
  64. package/dist/widgets/DashboardViewer/__mock__/index.d.ts +16 -0
  65. package/dist/widgets/DashboardViewer/index.d.ts +1 -0
  66. package/package.json +70 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 SSA Group
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,4 @@
1
+ export type PanelProps = {
2
+ children: React.ReactNode;
3
+ };
4
+ export declare const BasePanel: ({ children }: PanelProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './BasePanel';
@@ -0,0 +1,4 @@
1
+ export type DashboardErrorProps = {
2
+ children?: React.ReactNode;
3
+ };
4
+ export declare const DashboardError: ({ children }: DashboardErrorProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './DashboardError';
@@ -0,0 +1,5 @@
1
+ export type ErrorPanelProps = {
2
+ title?: string;
3
+ children?: React.ReactNode;
4
+ };
5
+ export declare const ErrorPanel: ({ title, children }: ErrorPanelProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './ErrorPanel';
@@ -0,0 +1,4 @@
1
+ export type LoadingDashboardProps = {
2
+ children?: React.ReactNode;
3
+ };
4
+ export declare const LoadingDashboard: ({ children }: LoadingDashboardProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './LoadingDashboard';
@@ -0,0 +1,5 @@
1
+ export type LoadingPanelProps = {
2
+ title?: string;
3
+ children?: React.ReactNode;
4
+ };
5
+ export declare const LoadingPanel: ({ title, children }: LoadingPanelProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './LoadingPanel';
@@ -0,0 +1,71 @@
1
+ import { QueryOptions, MutationOptions } from '../../shared/query';
2
+ import { CreateDashboardPayload, InfraDashTransport, UpdateDashboardPayload } from '../../shared/transport';
3
+ type QOptions = QueryOptions & {
4
+ transport?: InfraDashTransport;
5
+ };
6
+ type MOptions<T, V> = MutationOptions<T, V> & {
7
+ transport?: InfraDashTransport;
8
+ };
9
+ export declare const useDashboards: (options?: QOptions) => {
10
+ refetch: () => void;
11
+ isLoaded: false;
12
+ isFetching: boolean;
13
+ data: undefined;
14
+ error: null;
15
+ } | {
16
+ refetch: () => void;
17
+ isLoaded: true;
18
+ isFetching: boolean;
19
+ data: undefined;
20
+ error: Error;
21
+ } | {
22
+ refetch: () => void;
23
+ isLoaded: true;
24
+ isFetching: boolean;
25
+ data: Pick<import("../../shared/dashboard").Dashboard, "title" | "id">[];
26
+ error: null;
27
+ };
28
+ export declare const useDashboard: (dashboardId: number, options?: QOptions) => {
29
+ refetch: () => void;
30
+ isLoaded: false;
31
+ isFetching: boolean;
32
+ data: undefined;
33
+ error: null;
34
+ } | {
35
+ refetch: () => void;
36
+ isLoaded: true;
37
+ isFetching: boolean;
38
+ data: undefined;
39
+ error: Error;
40
+ } | {
41
+ refetch: () => void;
42
+ isLoaded: true;
43
+ isFetching: boolean;
44
+ data: import("../../shared/dashboard").Dashboard;
45
+ error: null;
46
+ };
47
+ export declare const useCreateDashboard: (options?: MOptions<unknown, CreateDashboardPayload>) => {
48
+ mutate: (args_0: CreateDashboardPayload) => Promise<unknown>;
49
+ data: unknown;
50
+ error: unknown;
51
+ isLoading: boolean;
52
+ reset: () => void;
53
+ cancel: () => void;
54
+ };
55
+ export declare const useUpdateDashboard: (dashboardId: number, options?: MOptions<unknown, Omit<UpdateDashboardPayload, "dashboardId">>) => {
56
+ mutate: (args_0: Omit<UpdateDashboardPayload, "dashboardId">) => Promise<unknown>;
57
+ data: unknown;
58
+ error: unknown;
59
+ isLoading: boolean;
60
+ reset: () => void;
61
+ cancel: () => void;
62
+ };
63
+ export declare const useDeleteDashboard: (dashboardId: number, options?: MOptions<unknown, undefined>) => {
64
+ mutate: () => Promise<unknown>;
65
+ data: unknown;
66
+ error: unknown;
67
+ isLoading: boolean;
68
+ reset: () => void;
69
+ cancel: () => void;
70
+ };
71
+ export {};
@@ -0,0 +1,25 @@
1
+ import { QueryOptions } from '../../shared/query';
2
+ import { InfraDashTransport } from '../../shared/transport';
3
+ type Options = QueryOptions & {
4
+ transport?: InfraDashTransport;
5
+ };
6
+ export declare const useGrafanaDashboards: (options?: Options) => {
7
+ refetch: () => void;
8
+ isLoaded: false;
9
+ isFetching: boolean;
10
+ data: undefined;
11
+ error: null;
12
+ } | {
13
+ refetch: () => void;
14
+ isLoaded: true;
15
+ isFetching: boolean;
16
+ data: undefined;
17
+ error: Error;
18
+ } | {
19
+ refetch: () => void;
20
+ isLoaded: true;
21
+ isFetching: boolean;
22
+ data: import("../../shared/grafana").GrafanaDashboard[];
23
+ error: null;
24
+ };
25
+ export {};
@@ -0,0 +1,25 @@
1
+ import { QueryOptions } from '../../shared/query';
2
+ import { InfraDashTransport } from '../../shared/transport';
3
+ type Options = QueryOptions & {
4
+ transport?: InfraDashTransport;
5
+ };
6
+ export declare const useGrafanaPanels: (grafanaDashboardUid: string, options?: Options) => {
7
+ refetch: () => void;
8
+ isLoaded: false;
9
+ isFetching: boolean;
10
+ data: undefined;
11
+ error: null;
12
+ } | {
13
+ refetch: () => void;
14
+ isLoaded: true;
15
+ isFetching: boolean;
16
+ data: undefined;
17
+ error: Error;
18
+ } | {
19
+ refetch: () => void;
20
+ isLoaded: true;
21
+ isFetching: boolean;
22
+ data: import("../../shared/grafana").GrafanaPanel[];
23
+ error: null;
24
+ };
25
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './usePanelData';
2
+ export * from './withPanelData';
@@ -0,0 +1,29 @@
1
+ import { Panel } from '../../shared/panel';
2
+ import { QueryOptions } from '../../shared/query';
3
+ import { InfraDashTransport } from '../../shared/transport';
4
+ type Options = QueryOptions & {
5
+ transport?: InfraDashTransport;
6
+ };
7
+ export declare const usePanelData: (panel: Panel, options?: Options) => {
8
+ refetch: () => void;
9
+ isLoaded: false;
10
+ isFetching: boolean;
11
+ data: undefined;
12
+ error: null;
13
+ } | {
14
+ refetch: () => void;
15
+ isLoaded: true;
16
+ isFetching: boolean;
17
+ data: undefined;
18
+ error: Error;
19
+ } | {
20
+ refetch: () => void;
21
+ isLoaded: true;
22
+ isFetching: boolean;
23
+ data: {
24
+ source: "grafana";
25
+ data: import("../../shared/grafana").GrafanaPanelData;
26
+ };
27
+ error: null;
28
+ };
29
+ export {};
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { Panel, PanelData } from '../../shared/panel';
3
+ type WithPanelDataOptions = {
4
+ LoadingComponent?: React.ComponentType<{
5
+ title: string;
6
+ }>;
7
+ ErrorComponent?: React.ComponentType<{
8
+ title: string;
9
+ }>;
10
+ };
11
+ type InnerProps<D> = {
12
+ panel: Panel;
13
+ title?: string;
14
+ panelData: D;
15
+ };
16
+ export declare function withPanelData<D extends PanelData>(Wrapped: React.ComponentType<InnerProps<D>>, { LoadingComponent, ErrorComponent }?: WithPanelDataOptions): React.FC<Omit<InnerProps<D>, 'panelData'>>;
17
+ export {};
@@ -0,0 +1,19 @@
1
+ import GridLayout from 'react-grid-layout';
2
+ import { Dashboard } from '../shared/dashboard';
3
+ import { Panel } from '../shared/panel';
4
+ import 'react-grid-layout/css/styles.css';
5
+ import 'react-resizable/css/styles.css';
6
+ export type DashboardPanelGridProps = {
7
+ dashboard: Dashboard;
8
+ header?: React.ReactNode | ((dashboard: Dashboard) => React.ReactNode);
9
+ cols?: number;
10
+ rowHeight?: number;
11
+ draggable?: boolean;
12
+ resizable?: boolean;
13
+ refetchIntervalMs?: number;
14
+ onLayoutChange?: (layout: GridLayout.Layout[]) => void;
15
+ onDragStart?: GridLayout.ItemCallback;
16
+ onResizeStart?: GridLayout.ItemCallback;
17
+ renderPanelControl?: (panel: Panel) => React.ReactNode;
18
+ } & Omit<React.HTMLAttributes<HTMLDivElement>, 'onDrag'>;
19
+ export declare const DashboardPanelGrid: ({ dashboard, header, cols, rowHeight, draggable, resizable, refetchIntervalMs, onLayoutChange, onDragStart, onResizeStart, renderPanelControl, ...divProps }: DashboardPanelGridProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ export * from './widgets/DashboardViewer';
2
+ export * from './widgets/DashboardEditor';
3
+ export * from './entities/dashboard';
4
+ export * from './shared/transport';
5
+ export { useInfraDashContext } from './shared/context';
6
+ export { useQueryClient, useMutationClient } from './shared/query';
7
+ export * from './provider';