@industry-theme/principal-view-panels 0.12.86 → 0.12.87
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.
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { PanelComponentProps } from '@principal-ade/panel-framework-core';
|
|
3
|
-
import type {
|
|
3
|
+
import type { MetricSource, DiscoveredCanvas, DataProvider } from '@principal-ai/principal-view-core';
|
|
4
4
|
export interface DashboardPanelProps extends PanelComponentProps {
|
|
5
5
|
/**
|
|
6
|
-
* The discovered dashboard
|
|
6
|
+
* The discovered dashboard to display.
|
|
7
7
|
* Must be a DiscoveredCanvas with type 'dashboard'.
|
|
8
|
+
* The panel will load the dashboard definition from the file path.
|
|
8
9
|
*/
|
|
9
10
|
selectedDashboard?: DiscoveredCanvas | null;
|
|
10
11
|
/**
|
|
11
|
-
* Optional
|
|
12
|
-
* If provided,
|
|
12
|
+
* Optional data provider for fetching metric values.
|
|
13
|
+
* If not provided, the dashboard will render without data.
|
|
14
|
+
* Use MockDataProvider from @principal-ai/principal-view-react for testing.
|
|
13
15
|
*/
|
|
14
|
-
|
|
16
|
+
dataProvider?: DataProvider;
|
|
15
17
|
/**
|
|
16
18
|
* Callback when a metric source link is clicked.
|
|
17
19
|
* Use this to navigate to the referenced workflow/canvas.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardPanel.d.ts","sourceRoot":"","sources":["../../src/panels/DashboardPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"DashboardPanel.d.ts","sourceRoot":"","sources":["../../src/panels/DashboardPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAI/E,OAAO,KAAK,EAEV,YAAY,EAGZ,gBAAgB,EAChB,YAAY,EACb,MAAM,mCAAmC,CAAC;AAG3C,MAAM,WAAW,mBAAoB,SAAQ,mBAAmB;IAC9D;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAE5C;;;;OAIG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;IAE5B;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IAE/C;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAyMxD,CAAC"}
|
package/dist/panels.bundle.js
CHANGED
|
@@ -206077,13 +206077,13 @@ const DashboardPanel = ({
|
|
|
206077
206077
|
actions,
|
|
206078
206078
|
events,
|
|
206079
206079
|
selectedDashboard,
|
|
206080
|
-
|
|
206080
|
+
dataProvider,
|
|
206081
206081
|
onSourceClick,
|
|
206082
206082
|
onMetricClick
|
|
206083
206083
|
}) => {
|
|
206084
206084
|
const { theme: theme2 } = useTheme();
|
|
206085
206085
|
const panelRef = useRef(null);
|
|
206086
|
-
const [dashboard, setDashboard] = useState(
|
|
206086
|
+
const [dashboard, setDashboard] = useState(null);
|
|
206087
206087
|
const [loading, setLoading] = useState(false);
|
|
206088
206088
|
const [error, setError] = useState(null);
|
|
206089
206089
|
const [timeRange, setTimeRange] = useState({ preset: "last_1h" });
|
|
@@ -206093,11 +206093,6 @@ const DashboardPanel = ({
|
|
|
206093
206093
|
return (_a2 = panelRef.current) == null ? void 0 : _a2.focus();
|
|
206094
206094
|
});
|
|
206095
206095
|
useEffect(() => {
|
|
206096
|
-
if (propDashboard) {
|
|
206097
|
-
setDashboard(propDashboard);
|
|
206098
|
-
setError(null);
|
|
206099
|
-
return;
|
|
206100
|
-
}
|
|
206101
206096
|
if (!selectedDashboard) {
|
|
206102
206097
|
setDashboard(null);
|
|
206103
206098
|
return;
|
|
@@ -206122,7 +206117,7 @@ const DashboardPanel = ({
|
|
|
206122
206117
|
}
|
|
206123
206118
|
};
|
|
206124
206119
|
loadDashboard();
|
|
206125
|
-
}, [selectedDashboard,
|
|
206120
|
+
}, [selectedDashboard, actions]);
|
|
206126
206121
|
const handleSourceClick = useCallback(
|
|
206127
206122
|
(source2) => {
|
|
206128
206123
|
if (onSourceClick) {
|
|
@@ -206158,10 +206153,6 @@ const DashboardPanel = ({
|
|
|
206158
206153
|
},
|
|
206159
206154
|
[onMetricClick, events]
|
|
206160
206155
|
);
|
|
206161
|
-
const dataProvider = useMemo(() => {
|
|
206162
|
-
if (!dashboard) return void 0;
|
|
206163
|
-
return new MockDataProvider(dashboard);
|
|
206164
|
-
}, [dashboard]);
|
|
206165
206156
|
if (loading) {
|
|
206166
206157
|
return /* @__PURE__ */ jsxs(
|
|
206167
206158
|
"div",
|