@sentio/ui-dashboard 0.3.10 → 0.3.12
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.
- package/dist/index.css +81 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +97 -74
- package/dist/index.d.ts +97 -74
- package/dist/index.js +402 -147
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +342 -90
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +7 -3
package/dist/index.js
CHANGED
|
@@ -46,13 +46,16 @@ __export(index_exports, {
|
|
|
46
46
|
DataControls: () => DataControls,
|
|
47
47
|
EditDashboardDialog: () => EditDashboardDialog,
|
|
48
48
|
EditGroupDialog: () => EditGroupDialog,
|
|
49
|
+
ErrorChart: () => ErrorChart,
|
|
49
50
|
EventsFunctionCategories: () => EventsFunctionCategories,
|
|
50
51
|
EventsFunctionMap: () => EventsFunctionMap,
|
|
52
|
+
ExportDashboardDialog: () => ExportDashboardDialog,
|
|
51
53
|
FunctionInput: () => FunctionInput,
|
|
52
54
|
FunctionMap: () => FunctionMap,
|
|
53
55
|
FunctionsCategories: () => FunctionsCategories,
|
|
54
56
|
FunctionsPanel: () => FunctionsPanel,
|
|
55
57
|
HIGHLIGHT_COLORS: () => HIGHLIGHT_COLORS,
|
|
58
|
+
ImportPanelDialog: () => ImportPanelDialog,
|
|
56
59
|
LabelControls: () => LabelControls,
|
|
57
60
|
LabelSearchProvider: () => LabelSearchProvider,
|
|
58
61
|
LabelsInput: () => LabelsInput,
|
|
@@ -6953,9 +6956,70 @@ var EditDashboardDialog = ({
|
|
|
6953
6956
|
);
|
|
6954
6957
|
};
|
|
6955
6958
|
|
|
6956
|
-
// src/dashboard/
|
|
6957
|
-
var import_react26 = require("react");
|
|
6959
|
+
// src/dashboard/ErrorChart.tsx
|
|
6960
|
+
var import_react26 = __toESM(require("react"));
|
|
6958
6961
|
var import_ui_core29 = require("@sentio/ui-core");
|
|
6962
|
+
var import_react_resize_detector5 = require("react-resize-detector");
|
|
6963
|
+
var import_lodash14 = require("lodash");
|
|
6964
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
6965
|
+
var ErrorChart = import_react26.default.memo(function ErrorChart2({
|
|
6966
|
+
data,
|
|
6967
|
+
logoSrc,
|
|
6968
|
+
onNavigateToDatasource
|
|
6969
|
+
}) {
|
|
6970
|
+
const { ref, width, height } = (0, import_react_resize_detector5.useResizeDetector)();
|
|
6971
|
+
let hintMessage;
|
|
6972
|
+
if (data?.code === 5) {
|
|
6973
|
+
hintMessage = /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("span", { children: [
|
|
6974
|
+
"No active processor found",
|
|
6975
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("br", {}),
|
|
6976
|
+
" Check the",
|
|
6977
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_ui_core29.Button, { role: "link", onClick: onNavigateToDatasource, children: "datasource" }),
|
|
6978
|
+
"page for more details."
|
|
6979
|
+
] });
|
|
6980
|
+
} else if (data?.status === 429) {
|
|
6981
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6982
|
+
import_ui_core29.BarLoading,
|
|
6983
|
+
{
|
|
6984
|
+
className: "bg-default-bg absolute w-full",
|
|
6985
|
+
hint: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "text-xs font-normal", children: "Too many simultaneous requests, retrying later..." }),
|
|
6986
|
+
width: 160
|
|
6987
|
+
}
|
|
6988
|
+
);
|
|
6989
|
+
} else {
|
|
6990
|
+
hintMessage = data?.message ?? "Something went wrong";
|
|
6991
|
+
}
|
|
6992
|
+
const imageSize = Math.min(
|
|
6993
|
+
Math.min(64, width ? width * 0.4 : 64),
|
|
6994
|
+
Math.min(64, height ? height * 0.4 : 64)
|
|
6995
|
+
);
|
|
6996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "flex h-full w-full items-center", ref, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "w-full space-y-4 text-center", children: [
|
|
6997
|
+
imageSize < 10 || !logoSrc ? null : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6998
|
+
"img",
|
|
6999
|
+
{
|
|
7000
|
+
className: "mx-auto",
|
|
7001
|
+
src: logoSrc,
|
|
7002
|
+
width: imageSize,
|
|
7003
|
+
height: imageSize,
|
|
7004
|
+
style: { width: imageSize, height: "auto" },
|
|
7005
|
+
alt: "gray logo"
|
|
7006
|
+
}
|
|
7007
|
+
),
|
|
7008
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7009
|
+
"div",
|
|
7010
|
+
{
|
|
7011
|
+
title: (0, import_lodash14.isString)(hintMessage) ? hintMessage : void 0,
|
|
7012
|
+
className: `text-text-foreground-secondary font-icontent text-icontent px-4 ${height && height < 200 ? "line-clamp-1" : "line-clamp-2"}`,
|
|
7013
|
+
children: hintMessage
|
|
7014
|
+
}
|
|
7015
|
+
),
|
|
7016
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(RefreshButton, {})
|
|
7017
|
+
] }) });
|
|
7018
|
+
});
|
|
7019
|
+
|
|
7020
|
+
// src/dashboard/EditGroupDialog.tsx
|
|
7021
|
+
var import_react27 = require("react");
|
|
7022
|
+
var import_ui_core30 = require("@sentio/ui-core");
|
|
6959
7023
|
var import_lu9 = require("react-icons/lu");
|
|
6960
7024
|
|
|
6961
7025
|
// src/dashboard/group-styles.ts
|
|
@@ -7008,28 +7072,28 @@ function resolveHeaderStyle(style, colorKey, isDark) {
|
|
|
7008
7072
|
}
|
|
7009
7073
|
|
|
7010
7074
|
// src/dashboard/EditGroupDialog.tsx
|
|
7011
|
-
var
|
|
7075
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
7012
7076
|
function StyleCard({ selected, label, onClick, preview }) {
|
|
7013
|
-
return /* @__PURE__ */ (0,
|
|
7077
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
7014
7078
|
"button",
|
|
7015
7079
|
{
|
|
7016
7080
|
type: "button",
|
|
7017
7081
|
onClick,
|
|
7018
|
-
className: (0,
|
|
7082
|
+
className: (0, import_ui_core30.classNames)(
|
|
7019
7083
|
"flex flex-col items-stretch overflow-hidden rounded-lg border text-left transition-colors",
|
|
7020
7084
|
selected ? "border-primary-600 ring-primary-600/30 ring-3 shadow-sm" : "border-main hover:border-primary-400"
|
|
7021
7085
|
),
|
|
7022
7086
|
children: [
|
|
7023
|
-
/* @__PURE__ */ (0,
|
|
7024
|
-
/* @__PURE__ */ (0,
|
|
7087
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "bg-hover/40 flex h-28 items-center justify-center", children: preview }),
|
|
7088
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
7025
7089
|
"div",
|
|
7026
7090
|
{
|
|
7027
|
-
className: (0,
|
|
7091
|
+
className: (0, import_ui_core30.classNames)(
|
|
7028
7092
|
"border-main flex items-center justify-center gap-1.5 border-t px-2 py-2 text-sm",
|
|
7029
7093
|
selected ? "text-primary-600 font-semibold" : "text-text-foreground font-medium"
|
|
7030
7094
|
),
|
|
7031
7095
|
children: [
|
|
7032
|
-
selected && /* @__PURE__ */ (0,
|
|
7096
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_lu9.LuCheck, { className: "h-3.5 w-3.5" }),
|
|
7033
7097
|
label
|
|
7034
7098
|
]
|
|
7035
7099
|
}
|
|
@@ -7039,13 +7103,13 @@ function StyleCard({ selected, label, onClick, preview }) {
|
|
|
7039
7103
|
);
|
|
7040
7104
|
}
|
|
7041
7105
|
function DefaultPreview() {
|
|
7042
|
-
return /* @__PURE__ */ (0,
|
|
7106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "border-main bg-default-bg text-text-foreground flex h-16 w-32 items-center rounded border px-2 text-base", children: "Title" });
|
|
7043
7107
|
}
|
|
7044
7108
|
function EmphasisPreview({
|
|
7045
7109
|
color
|
|
7046
7110
|
}) {
|
|
7047
|
-
return /* @__PURE__ */ (0,
|
|
7048
|
-
/* @__PURE__ */ (0,
|
|
7111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "border-main bg-default-bg flex h-16 w-32 flex-col rounded border", children: [
|
|
7112
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7049
7113
|
"div",
|
|
7050
7114
|
{
|
|
7051
7115
|
className: "flex h-9 items-center justify-center text-sm font-semibold",
|
|
@@ -7053,7 +7117,7 @@ function EmphasisPreview({
|
|
|
7053
7117
|
children: "Title"
|
|
7054
7118
|
}
|
|
7055
7119
|
),
|
|
7056
|
-
/* @__PURE__ */ (0,
|
|
7120
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex-1" })
|
|
7057
7121
|
] });
|
|
7058
7122
|
}
|
|
7059
7123
|
function EditGroupDialog({
|
|
@@ -7064,12 +7128,12 @@ function EditGroupDialog({
|
|
|
7064
7128
|
highlightColor,
|
|
7065
7129
|
onSave
|
|
7066
7130
|
}) {
|
|
7067
|
-
const [draftTitle, setDraftTitle] = (0,
|
|
7068
|
-
const [draftStyle, setDraftStyle] = (0,
|
|
7069
|
-
const [draftColor, setDraftColor] = (0,
|
|
7070
|
-
const titleRef = (0,
|
|
7131
|
+
const [draftTitle, setDraftTitle] = (0, import_react27.useState)(title);
|
|
7132
|
+
const [draftStyle, setDraftStyle] = (0, import_react27.useState)(style);
|
|
7133
|
+
const [draftColor, setDraftColor] = (0, import_react27.useState)(highlightColor);
|
|
7134
|
+
const titleRef = (0, import_react27.useRef)(null);
|
|
7071
7135
|
const isDark = useDarkMode();
|
|
7072
|
-
(0,
|
|
7136
|
+
(0, import_react27.useEffect)(() => {
|
|
7073
7137
|
if (!open) return;
|
|
7074
7138
|
setDraftTitle(title);
|
|
7075
7139
|
setDraftStyle(style || "DEFAULT");
|
|
@@ -7077,7 +7141,7 @@ function EditGroupDialog({
|
|
|
7077
7141
|
highlightColor || (style && style !== "DEFAULT" ? DEFAULT_HIGHLIGHT_KEY : "")
|
|
7078
7142
|
);
|
|
7079
7143
|
}, [open, title, style, highlightColor]);
|
|
7080
|
-
const previewColor = (0,
|
|
7144
|
+
const previewColor = (0, import_react27.useMemo)(
|
|
7081
7145
|
() => resolveHighlight(draftColor, isDark),
|
|
7082
7146
|
[draftColor, isDark]
|
|
7083
7147
|
);
|
|
@@ -7097,14 +7161,14 @@ function EditGroupDialog({
|
|
|
7097
7161
|
});
|
|
7098
7162
|
onClose();
|
|
7099
7163
|
};
|
|
7100
|
-
const colorOptions = (0,
|
|
7164
|
+
const colorOptions = (0, import_react27.useMemo)(
|
|
7101
7165
|
() => HIGHLIGHT_COLORS.map((c) => {
|
|
7102
7166
|
const resolved = resolveHighlight(c.key, isDark);
|
|
7103
7167
|
return {
|
|
7104
7168
|
value: c.key,
|
|
7105
7169
|
title: c.name,
|
|
7106
|
-
label: ({ selected }) => /* @__PURE__ */ (0,
|
|
7107
|
-
/* @__PURE__ */ (0,
|
|
7170
|
+
label: ({ selected }) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex w-full items-center gap-2.5 pr-2", children: [
|
|
7171
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7108
7172
|
"div",
|
|
7109
7173
|
{
|
|
7110
7174
|
className: "flex h-5 w-5 items-center justify-center rounded text-xs font-bold",
|
|
@@ -7115,15 +7179,15 @@ function EditGroupDialog({
|
|
|
7115
7179
|
children: "T"
|
|
7116
7180
|
}
|
|
7117
7181
|
),
|
|
7118
|
-
/* @__PURE__ */ (0,
|
|
7119
|
-
selected && /* @__PURE__ */ (0,
|
|
7182
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "flex-1 text-sm", children: c.name }),
|
|
7183
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_lu9.LuCheck, { className: "text-primary-600 h-4 w-4" })
|
|
7120
7184
|
] })
|
|
7121
7185
|
};
|
|
7122
7186
|
}),
|
|
7123
7187
|
[isDark]
|
|
7124
7188
|
);
|
|
7125
|
-
return /* @__PURE__ */ (0,
|
|
7126
|
-
|
|
7189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7190
|
+
import_ui_core30.BaseDialog,
|
|
7127
7191
|
{
|
|
7128
7192
|
title: "Edit Group",
|
|
7129
7193
|
open,
|
|
@@ -7134,10 +7198,10 @@ function EditGroupDialog({
|
|
|
7134
7198
|
okText: "Save",
|
|
7135
7199
|
panelClassName: "sm:max-w-xl",
|
|
7136
7200
|
initialFocus: titleRef,
|
|
7137
|
-
children: /* @__PURE__ */ (0,
|
|
7138
|
-
/* @__PURE__ */ (0,
|
|
7139
|
-
/* @__PURE__ */ (0,
|
|
7140
|
-
/* @__PURE__ */ (0,
|
|
7201
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "text-text-foreground px-4 pb-2 pt-4", children: [
|
|
7202
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("h4", { className: "text-text-foreground mb-3 text-sm font-semibold", children: "Display options" }),
|
|
7203
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("label", { className: "text-text-foreground-secondary text-ilabel mb-1 block", children: "Title" }),
|
|
7204
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7141
7205
|
"input",
|
|
7142
7206
|
{
|
|
7143
7207
|
ref: titleRef,
|
|
@@ -7153,30 +7217,30 @@ function EditGroupDialog({
|
|
|
7153
7217
|
className: "focus:border-primary-600 focus:ring-primary-600/30 focus:ring-3 hover:border-primary-600 sm:text-ilabel border-main mb-4 block w-full rounded-md"
|
|
7154
7218
|
}
|
|
7155
7219
|
),
|
|
7156
|
-
/* @__PURE__ */ (0,
|
|
7157
|
-
/* @__PURE__ */ (0,
|
|
7220
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "mb-4 grid grid-cols-2 gap-3", children: [
|
|
7221
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7158
7222
|
StyleCard,
|
|
7159
7223
|
{
|
|
7160
7224
|
selected: draftStyle === "DEFAULT",
|
|
7161
7225
|
label: "Default",
|
|
7162
7226
|
onClick: () => onPickStyle("DEFAULT"),
|
|
7163
|
-
preview: /* @__PURE__ */ (0,
|
|
7227
|
+
preview: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DefaultPreview, {})
|
|
7164
7228
|
}
|
|
7165
7229
|
),
|
|
7166
|
-
/* @__PURE__ */ (0,
|
|
7230
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7167
7231
|
StyleCard,
|
|
7168
7232
|
{
|
|
7169
7233
|
selected: draftStyle === "EMPHASIS",
|
|
7170
7234
|
label: "Emphasis",
|
|
7171
7235
|
onClick: () => onPickStyle("EMPHASIS"),
|
|
7172
|
-
preview: /* @__PURE__ */ (0,
|
|
7236
|
+
preview: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(EmphasisPreview, { color: previewColor })
|
|
7173
7237
|
}
|
|
7174
7238
|
)
|
|
7175
7239
|
] }),
|
|
7176
|
-
draftStyle !== "DEFAULT" && /* @__PURE__ */ (0,
|
|
7177
|
-
/* @__PURE__ */ (0,
|
|
7178
|
-
/* @__PURE__ */ (0,
|
|
7179
|
-
|
|
7240
|
+
draftStyle !== "DEFAULT" && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
7241
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("label", { className: "text-text-foreground-secondary text-ilabel mb-1 block", children: "Highlight Color" }),
|
|
7242
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7243
|
+
import_ui_core30.Select,
|
|
7180
7244
|
{
|
|
7181
7245
|
value: draftColor || DEFAULT_HIGHLIGHT_KEY,
|
|
7182
7246
|
onChange: (v) => setDraftColor(v),
|
|
@@ -7195,11 +7259,11 @@ function EditGroupDialog({
|
|
|
7195
7259
|
var import_dayjs6 = __toESM(require("dayjs"));
|
|
7196
7260
|
var import_relativeTime = __toESM(require("dayjs/plugin/relativeTime"));
|
|
7197
7261
|
var import_updateLocale = __toESM(require("dayjs/plugin/updateLocale"));
|
|
7198
|
-
var
|
|
7199
|
-
var
|
|
7262
|
+
var import_ui_core31 = require("@sentio/ui-core");
|
|
7263
|
+
var import_react28 = require("react");
|
|
7200
7264
|
var import_io2 = require("react-icons/io");
|
|
7201
7265
|
var import_en = __toESM(require("dayjs/locale/en"));
|
|
7202
|
-
var
|
|
7266
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
7203
7267
|
import_dayjs6.default.extend(import_relativeTime.default);
|
|
7204
7268
|
import_dayjs6.default.extend(import_updateLocale.default);
|
|
7205
7269
|
import_dayjs6.default.locale("en.short", {
|
|
@@ -7223,10 +7287,10 @@ import_dayjs6.default.locale("en.short", {
|
|
|
7223
7287
|
});
|
|
7224
7288
|
import_dayjs6.default.locale("en");
|
|
7225
7289
|
var DashboardRefresh = ({ stats, onRefresh }) => {
|
|
7226
|
-
const timeRef = (0,
|
|
7227
|
-
const [fetching, setFetching] = (0,
|
|
7228
|
-
const [currentColor, setCurrentColor] = (0,
|
|
7229
|
-
(0,
|
|
7290
|
+
const timeRef = (0, import_react28.useRef)(null);
|
|
7291
|
+
const [fetching, setFetching] = (0, import_react28.useState)(false);
|
|
7292
|
+
const [currentColor, setCurrentColor] = (0, import_react28.useState)("text-[#4CAF1D] border-[#4CAF1D] border" /* NORMAL */);
|
|
7293
|
+
(0, import_react28.useEffect)(() => {
|
|
7230
7294
|
const updateFn = () => {
|
|
7231
7295
|
if (!stats || !stats.computedAt) return;
|
|
7232
7296
|
const computedAt = (0, import_dayjs6.default)(stats.computedAt).locale("en.short");
|
|
@@ -7245,7 +7309,7 @@ var DashboardRefresh = ({ stats, onRefresh }) => {
|
|
|
7245
7309
|
clearInterval(interval);
|
|
7246
7310
|
};
|
|
7247
7311
|
}, [stats]);
|
|
7248
|
-
const onClick = (0,
|
|
7312
|
+
const onClick = (0, import_react28.useCallback)(() => {
|
|
7249
7313
|
setFetching((prevState) => {
|
|
7250
7314
|
if (prevState) return prevState;
|
|
7251
7315
|
onRefresh().finally(() => {
|
|
@@ -7254,7 +7318,7 @@ var DashboardRefresh = ({ stats, onRefresh }) => {
|
|
|
7254
7318
|
return true;
|
|
7255
7319
|
});
|
|
7256
7320
|
}, [onRefresh]);
|
|
7257
|
-
(0,
|
|
7321
|
+
(0, import_react28.useEffect)(() => {
|
|
7258
7322
|
if (typeof window == "object") {
|
|
7259
7323
|
window.addEventListener("refresh_all", onClick);
|
|
7260
7324
|
return () => {
|
|
@@ -7263,28 +7327,28 @@ var DashboardRefresh = ({ stats, onRefresh }) => {
|
|
|
7263
7327
|
}
|
|
7264
7328
|
}, []);
|
|
7265
7329
|
const showReload = fetching || stats?.isRefreshing;
|
|
7266
|
-
return /* @__PURE__ */ (0,
|
|
7330
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
7267
7331
|
"div",
|
|
7268
7332
|
{
|
|
7269
|
-
className: (0,
|
|
7333
|
+
className: (0, import_ui_core31.classNames)(
|
|
7270
7334
|
"group/refresh relative ml-1 flex items-center gap-1 rounded-sm py-px pl-1 text-xs transition-all",
|
|
7271
7335
|
currentColor,
|
|
7272
7336
|
showReload ? "pr-5" : "pr-1.5 hover:pr-5"
|
|
7273
7337
|
),
|
|
7274
7338
|
children: [
|
|
7275
|
-
/* @__PURE__ */ (0,
|
|
7276
|
-
/* @__PURE__ */ (0,
|
|
7339
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "cursor-default text-[10px]", ref: timeRef }),
|
|
7340
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
7277
7341
|
"button",
|
|
7278
7342
|
{
|
|
7279
7343
|
onClick,
|
|
7280
|
-
className: (0,
|
|
7344
|
+
className: (0, import_ui_core31.classNames)(
|
|
7281
7345
|
"absolute right-1",
|
|
7282
7346
|
showReload ? "block" : "hidden group-hover/refresh:block"
|
|
7283
7347
|
),
|
|
7284
|
-
children: /* @__PURE__ */ (0,
|
|
7348
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
7285
7349
|
import_io2.IoMdRefresh,
|
|
7286
7350
|
{
|
|
7287
|
-
className: (0,
|
|
7351
|
+
className: (0, import_ui_core31.classNames)(
|
|
7288
7352
|
"h-3.5 w-3.5",
|
|
7289
7353
|
showReload ? "animate-spin" : ""
|
|
7290
7354
|
)
|
|
@@ -7298,9 +7362,9 @@ var DashboardRefresh = ({ stats, onRefresh }) => {
|
|
|
7298
7362
|
};
|
|
7299
7363
|
|
|
7300
7364
|
// src/dashboard/ShareDashboardDialog.tsx
|
|
7301
|
-
var
|
|
7302
|
-
var
|
|
7303
|
-
var
|
|
7365
|
+
var import_react29 = require("react");
|
|
7366
|
+
var import_ui_core32 = require("@sentio/ui-core");
|
|
7367
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
7304
7368
|
var ShareDashboardDialog = ({
|
|
7305
7369
|
open,
|
|
7306
7370
|
initData,
|
|
@@ -7311,15 +7375,15 @@ var ShareDashboardDialog = ({
|
|
|
7311
7375
|
endTime,
|
|
7312
7376
|
tz
|
|
7313
7377
|
}) => {
|
|
7314
|
-
const [isReadonly, setIsReadonly] = (0,
|
|
7378
|
+
const [isReadonly, setIsReadonly] = (0, import_react29.useState)(
|
|
7315
7379
|
initData?.config?.isReadonly ?? false
|
|
7316
7380
|
);
|
|
7317
|
-
const [hideModifiers, setHideModifiers] = (0,
|
|
7381
|
+
const [hideModifiers, setHideModifiers] = (0, import_react29.useState)(
|
|
7318
7382
|
initData?.config?.hideModifiers ?? false
|
|
7319
7383
|
);
|
|
7320
|
-
const linkText = (0,
|
|
7384
|
+
const linkText = (0, import_react29.useMemo)(() => {
|
|
7321
7385
|
if (initData?.id) {
|
|
7322
|
-
let timeSuffix = startTime && endTime ? `?from=${encodeURIComponent((0,
|
|
7386
|
+
let timeSuffix = startTime && endTime ? `?from=${encodeURIComponent((0, import_ui_core32.dateTimeToString)(startTime))}&to=${encodeURIComponent((0, import_ui_core32.dateTimeToString)(endTime))}&tz=${tz}` : "";
|
|
7323
7387
|
if (tz) {
|
|
7324
7388
|
timeSuffix += `&tz=${tz}`;
|
|
7325
7389
|
}
|
|
@@ -7342,8 +7406,8 @@ var ShareDashboardDialog = ({
|
|
|
7342
7406
|
setHideModifiers(checked);
|
|
7343
7407
|
handleConfigChange(isReadonly, checked);
|
|
7344
7408
|
};
|
|
7345
|
-
return /* @__PURE__ */ (0,
|
|
7346
|
-
|
|
7409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7410
|
+
import_ui_core32.BaseDialog,
|
|
7347
7411
|
{
|
|
7348
7412
|
title: "Sharing: ON",
|
|
7349
7413
|
open,
|
|
@@ -7362,11 +7426,11 @@ var ShareDashboardDialog = ({
|
|
|
7362
7426
|
onClose,
|
|
7363
7427
|
buttonsClassName: "justify-between",
|
|
7364
7428
|
footerBorder: false,
|
|
7365
|
-
children: /* @__PURE__ */ (0,
|
|
7366
|
-
/* @__PURE__ */ (0,
|
|
7367
|
-
/* @__PURE__ */ (0,
|
|
7368
|
-
/* @__PURE__ */ (0,
|
|
7369
|
-
|
|
7429
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "mx-4 my-4", children: [
|
|
7430
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex overflow-hidden rounded-md border pl-3", children: [
|
|
7431
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "text-ilabel font-ilabel text-text-foreground flex-1 grow truncate leading-8", children: linkText }),
|
|
7432
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "group cursor-pointer border-l bg-gray-200 px-2 py-1 hover:bg-gray-100", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7433
|
+
import_ui_core32.CopyButton,
|
|
7370
7434
|
{
|
|
7371
7435
|
text: linkText,
|
|
7372
7436
|
size: 18,
|
|
@@ -7374,31 +7438,31 @@ var ShareDashboardDialog = ({
|
|
|
7374
7438
|
}
|
|
7375
7439
|
) })
|
|
7376
7440
|
] }),
|
|
7377
|
-
/* @__PURE__ */ (0,
|
|
7378
|
-
/* @__PURE__ */ (0,
|
|
7379
|
-
/* @__PURE__ */ (0,
|
|
7380
|
-
/* @__PURE__ */ (0,
|
|
7381
|
-
/* @__PURE__ */ (0,
|
|
7382
|
-
/* @__PURE__ */ (0,
|
|
7383
|
-
|
|
7441
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "text-text-foreground-secondary mt-2 text-[11px]", children: "Anyone with the link can access this dashboard. You can revoke the link at any time." }),
|
|
7442
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "mt-4 space-y-3 border-t pt-4", children: [
|
|
7443
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "text-text-foreground text-sm font-medium", children: "Access Settings" }),
|
|
7444
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "space-y-4", children: [
|
|
7445
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { children: [
|
|
7446
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7447
|
+
import_ui_core32.Checkbox,
|
|
7384
7448
|
{
|
|
7385
7449
|
checked: isReadonly,
|
|
7386
7450
|
onChange: handleReadonlyChange,
|
|
7387
7451
|
label: "Panel read-only access"
|
|
7388
7452
|
}
|
|
7389
7453
|
),
|
|
7390
|
-
/* @__PURE__ */ (0,
|
|
7454
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "text-text-foreground-secondary ml-6 text-xs", children: "Viewers can only view the dashboard without entering panel edit mode or copy configuration." })
|
|
7391
7455
|
] }),
|
|
7392
|
-
/* @__PURE__ */ (0,
|
|
7393
|
-
/* @__PURE__ */ (0,
|
|
7394
|
-
|
|
7456
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { children: [
|
|
7457
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7458
|
+
import_ui_core32.Checkbox,
|
|
7395
7459
|
{
|
|
7396
7460
|
checked: hideModifiers,
|
|
7397
7461
|
onChange: handleHideModifiersChange,
|
|
7398
7462
|
label: "Hide controls"
|
|
7399
7463
|
}
|
|
7400
7464
|
),
|
|
7401
|
-
/* @__PURE__ */ (0,
|
|
7465
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "text-text-foreground-secondary ml-6 text-xs", children: "Hide panel creator and modifier for viewers" })
|
|
7402
7466
|
] })
|
|
7403
7467
|
] })
|
|
7404
7468
|
] })
|
|
@@ -7408,10 +7472,10 @@ var ShareDashboardDialog = ({
|
|
|
7408
7472
|
};
|
|
7409
7473
|
|
|
7410
7474
|
// src/dashboard/TimeRangeOverride.tsx
|
|
7411
|
-
var
|
|
7475
|
+
var import_lodash15 = require("lodash");
|
|
7412
7476
|
var import_immer15 = require("immer");
|
|
7413
|
-
var
|
|
7414
|
-
var
|
|
7477
|
+
var import_ui_core33 = require("@sentio/ui-core");
|
|
7478
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
7415
7479
|
var defaultConfig8 = {
|
|
7416
7480
|
enabled: false
|
|
7417
7481
|
};
|
|
@@ -7423,7 +7487,7 @@ function TimeRangeOverride({
|
|
|
7423
7487
|
globalTz,
|
|
7424
7488
|
onSetGlobalTimeRange
|
|
7425
7489
|
}) {
|
|
7426
|
-
config = (0,
|
|
7490
|
+
config = (0, import_lodash15.defaults)(config || {}, defaultConfig8);
|
|
7427
7491
|
const setEnabled = (enabled) => {
|
|
7428
7492
|
config && onChange(
|
|
7429
7493
|
(0, import_immer15.produce)(config, (draft) => {
|
|
@@ -7457,17 +7521,17 @@ function TimeRangeOverride({
|
|
|
7457
7521
|
onSetGlobalTimeRange(start, end, tz);
|
|
7458
7522
|
}
|
|
7459
7523
|
}
|
|
7460
|
-
return /* @__PURE__ */ (0,
|
|
7461
|
-
/* @__PURE__ */ (0,
|
|
7462
|
-
|
|
7524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex flex-wrap items-center gap-4 p-2", children: [
|
|
7525
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
7526
|
+
import_ui_core33.Switch,
|
|
7463
7527
|
{
|
|
7464
7528
|
checked: config.enabled || false,
|
|
7465
7529
|
onChange: setEnabled,
|
|
7466
7530
|
label: "Override Global Time"
|
|
7467
7531
|
}
|
|
7468
7532
|
) }),
|
|
7469
|
-
/* @__PURE__ */ (0,
|
|
7470
|
-
|
|
7533
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
7534
|
+
import_ui_core33.TimeRangePicker,
|
|
7471
7535
|
{
|
|
7472
7536
|
startTime: config.enabled ? fromTimeLike(config.timeRange?.start) : globalStartTime,
|
|
7473
7537
|
endTime: config.enabled ? fromTimeLike(config.timeRange?.end) : globalEndTime,
|
|
@@ -7479,39 +7543,39 @@ function TimeRangeOverride({
|
|
|
7479
7543
|
}
|
|
7480
7544
|
|
|
7481
7545
|
// src/dashboard/SeriesControls.tsx
|
|
7482
|
-
var
|
|
7483
|
-
var
|
|
7546
|
+
var import_react30 = require("react");
|
|
7547
|
+
var import_ui_core34 = require("@sentio/ui-core");
|
|
7484
7548
|
var import_react_virtual = require("@tanstack/react-virtual");
|
|
7485
7549
|
var import_lu10 = require("react-icons/lu");
|
|
7486
|
-
var
|
|
7487
|
-
var
|
|
7488
|
-
var
|
|
7550
|
+
var import_lodash16 = require("lodash");
|
|
7551
|
+
var import_react31 = require("@headlessui/react");
|
|
7552
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
7489
7553
|
var seriesChartTypes = [
|
|
7490
7554
|
{
|
|
7491
7555
|
value: "default",
|
|
7492
|
-
label: /* @__PURE__ */ (0,
|
|
7493
|
-
/* @__PURE__ */ (0,
|
|
7556
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center", children: [
|
|
7557
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_lu10.LuMountainSnow, { className: "mr-2 h-4 w-4" }),
|
|
7494
7558
|
"Default"
|
|
7495
7559
|
] })
|
|
7496
7560
|
},
|
|
7497
7561
|
{
|
|
7498
7562
|
value: "LINE",
|
|
7499
|
-
label: /* @__PURE__ */ (0,
|
|
7500
|
-
/* @__PURE__ */ (0,
|
|
7563
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center", children: [
|
|
7564
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(LineIcon_default, { className: "mr-2 h-4 w-4" }),
|
|
7501
7565
|
"Line"
|
|
7502
7566
|
] })
|
|
7503
7567
|
},
|
|
7504
7568
|
{
|
|
7505
7569
|
value: "BAR",
|
|
7506
|
-
label: /* @__PURE__ */ (0,
|
|
7507
|
-
/* @__PURE__ */ (0,
|
|
7570
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center", children: [
|
|
7571
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(BarIcon_default, { className: "mr-2 h-4 w-4" }),
|
|
7508
7572
|
"Bar"
|
|
7509
7573
|
] })
|
|
7510
7574
|
},
|
|
7511
7575
|
{
|
|
7512
7576
|
value: "AREA",
|
|
7513
|
-
label: /* @__PURE__ */ (0,
|
|
7514
|
-
/* @__PURE__ */ (0,
|
|
7577
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center", children: [
|
|
7578
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(AreaIcon_default, { className: "mr-2 h-4 w-4" }),
|
|
7515
7579
|
"Area"
|
|
7516
7580
|
] })
|
|
7517
7581
|
}
|
|
@@ -7522,8 +7586,8 @@ var SeriesControls = ({
|
|
|
7522
7586
|
series,
|
|
7523
7587
|
enabled
|
|
7524
7588
|
}) => {
|
|
7525
|
-
const parentRef = (0,
|
|
7526
|
-
const [isDisclosureOpen, setIsDisclosureOpen] = (0,
|
|
7589
|
+
const parentRef = (0, import_react30.useRef)(null);
|
|
7590
|
+
const [isDisclosureOpen, setIsDisclosureOpen] = (0, import_react30.useState)(true);
|
|
7527
7591
|
const shouldVirtualize = series.length > 10;
|
|
7528
7592
|
const virtualizer = (0, import_react_virtual.useVirtualizer)({
|
|
7529
7593
|
count: shouldVirtualize && isDisclosureOpen ? series.length : 0,
|
|
@@ -7532,7 +7596,7 @@ var SeriesControls = ({
|
|
|
7532
7596
|
overscan: 5
|
|
7533
7597
|
// Render 5 extra items outside viewport for smooth scrolling
|
|
7534
7598
|
});
|
|
7535
|
-
(0,
|
|
7599
|
+
(0, import_react30.useLayoutEffect)(() => {
|
|
7536
7600
|
if (isDisclosureOpen && shouldVirtualize && parentRef.current) {
|
|
7537
7601
|
const timeoutId = setTimeout(() => {
|
|
7538
7602
|
virtualizer.measure();
|
|
@@ -7543,7 +7607,7 @@ var SeriesControls = ({
|
|
|
7543
7607
|
const handleSeriesTypeChange = (seriesName, selectedType) => {
|
|
7544
7608
|
const currentSeriesConfig = config?.seriesConfig || { series: {} };
|
|
7545
7609
|
if (selectedType === "default") {
|
|
7546
|
-
const newSeriesConfig2 = (0,
|
|
7610
|
+
const newSeriesConfig2 = (0, import_lodash16.cloneDeep)(currentSeriesConfig);
|
|
7547
7611
|
if (newSeriesConfig2.series && newSeriesConfig2.series[seriesName]) {
|
|
7548
7612
|
delete newSeriesConfig2.series[seriesName];
|
|
7549
7613
|
}
|
|
@@ -7564,15 +7628,15 @@ var SeriesControls = ({
|
|
|
7564
7628
|
};
|
|
7565
7629
|
const renderSeriesItem = (seriesName) => {
|
|
7566
7630
|
const currentType = config?.seriesConfig?.series?.[seriesName]?.type || "default";
|
|
7567
|
-
return /* @__PURE__ */ (0,
|
|
7631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
7568
7632
|
"div",
|
|
7569
7633
|
{
|
|
7570
7634
|
className: "text-icontent inline-flex h-8 w-full basis-0 px-2",
|
|
7571
7635
|
children: [
|
|
7572
|
-
/* @__PURE__ */ (0,
|
|
7573
|
-
/* @__PURE__ */ (0,
|
|
7574
|
-
/* @__PURE__ */ (0,
|
|
7575
|
-
|
|
7636
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "sm:text-icontent bg-sentio-gray-100 dark:bg-sentio-gray-200 border-main inline-flex shrink items-center rounded-l-md border border-r-0 px-2 font-medium sm:min-w-[160px]", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "truncate", title: seriesName, children: seriesName }) }),
|
|
7637
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "sm:text-icontent bg-sentio-gray-100 dark:bg-sentio-gray-200 border-main inline-flex items-center whitespace-nowrap border border-r-0 px-2", children: "Show as" }),
|
|
7638
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "w-40", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
7639
|
+
import_ui_core34.Select,
|
|
7576
7640
|
{
|
|
7577
7641
|
options: seriesChartTypes,
|
|
7578
7642
|
value: currentType,
|
|
@@ -7591,9 +7655,9 @@ var SeriesControls = ({
|
|
|
7591
7655
|
if (!enabled) {
|
|
7592
7656
|
return null;
|
|
7593
7657
|
}
|
|
7594
|
-
const titleWithReset = /* @__PURE__ */ (0,
|
|
7595
|
-
/* @__PURE__ */ (0,
|
|
7596
|
-
/* @__PURE__ */ (0,
|
|
7658
|
+
const titleWithReset = /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex w-full items-center justify-between pr-2", children: [
|
|
7659
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: `Series (${series.length})` }),
|
|
7660
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
7597
7661
|
"button",
|
|
7598
7662
|
{
|
|
7599
7663
|
type: "button",
|
|
@@ -7607,23 +7671,23 @@ var SeriesControls = ({
|
|
|
7607
7671
|
}
|
|
7608
7672
|
)
|
|
7609
7673
|
] });
|
|
7610
|
-
return /* @__PURE__ */ (0,
|
|
7611
|
-
(0,
|
|
7674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react31.Disclosure, { defaultOpen: true, children: ({ open }) => {
|
|
7675
|
+
(0, import_react30.useEffect)(() => {
|
|
7612
7676
|
setIsDisclosureOpen(open);
|
|
7613
7677
|
}, [open]);
|
|
7614
|
-
return /* @__PURE__ */ (0,
|
|
7615
|
-
/* @__PURE__ */ (0,
|
|
7616
|
-
|
|
7678
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "bg-default-bg w-full rounded-sm", children: [
|
|
7679
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
7680
|
+
import_react31.Disclosure.Button,
|
|
7617
7681
|
{
|
|
7618
|
-
className: (0,
|
|
7682
|
+
className: (0, import_ui_core34.classNames)(
|
|
7619
7683
|
open ? "rounded-t" : "rounded-sm",
|
|
7620
7684
|
"focus-visible:ring-primary-500/75 text-ilabel font-ilabel text-text-foreground hover:bg-sentio-gray-100 dark:hover:bg-sentio-gray-400 focus:outline-hidden focus-visible:ring-3 flex w-full px-2 py-1.5 text-left"
|
|
7621
7685
|
),
|
|
7622
7686
|
children: [
|
|
7623
|
-
/* @__PURE__ */ (0,
|
|
7687
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
7624
7688
|
import_lu10.LuChevronRight,
|
|
7625
7689
|
{
|
|
7626
|
-
className: (0,
|
|
7690
|
+
className: (0, import_ui_core34.classNames)(
|
|
7627
7691
|
open ? "rotate-90 transform" : "",
|
|
7628
7692
|
"mr-1 h-5 w-5 self-center transition-all"
|
|
7629
7693
|
)
|
|
@@ -7633,9 +7697,9 @@ var SeriesControls = ({
|
|
|
7633
7697
|
]
|
|
7634
7698
|
}
|
|
7635
7699
|
),
|
|
7636
|
-
/* @__PURE__ */ (0,
|
|
7700
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react31.Disclosure.Panel, { className: "p-2", children: shouldVirtualize && open ? (
|
|
7637
7701
|
// Virtualized rendering for large lists - only render when open
|
|
7638
|
-
/* @__PURE__ */ (0,
|
|
7702
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
7639
7703
|
"div",
|
|
7640
7704
|
{
|
|
7641
7705
|
ref: parentRef,
|
|
@@ -7643,7 +7707,7 @@ var SeriesControls = ({
|
|
|
7643
7707
|
style: {
|
|
7644
7708
|
contain: "strict"
|
|
7645
7709
|
},
|
|
7646
|
-
children: /* @__PURE__ */ (0,
|
|
7710
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
7647
7711
|
"div",
|
|
7648
7712
|
{
|
|
7649
7713
|
style: {
|
|
@@ -7654,7 +7718,7 @@ var SeriesControls = ({
|
|
|
7654
7718
|
children: virtualizer?.getVirtualItems().map((virtualItem) => {
|
|
7655
7719
|
const seriesName = series[virtualItem.index];
|
|
7656
7720
|
if (!seriesName) return null;
|
|
7657
|
-
return /* @__PURE__ */ (0,
|
|
7721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
7658
7722
|
"div",
|
|
7659
7723
|
{
|
|
7660
7724
|
style: {
|
|
@@ -7676,7 +7740,7 @@ var SeriesControls = ({
|
|
|
7676
7740
|
)
|
|
7677
7741
|
) : (
|
|
7678
7742
|
// Normal rendering for small lists
|
|
7679
|
-
/* @__PURE__ */ (0,
|
|
7743
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "text-icontent flex max-h-[200px] flex-col gap-2 overflow-y-auto", children: series.map((seriesName) => renderSeriesItem(seriesName)) })
|
|
7680
7744
|
) })
|
|
7681
7745
|
] });
|
|
7682
7746
|
} });
|
|
@@ -7684,9 +7748,9 @@ var SeriesControls = ({
|
|
|
7684
7748
|
|
|
7685
7749
|
// src/dashboard/QueryValueControls.tsx
|
|
7686
7750
|
var import_immer16 = require("immer");
|
|
7687
|
-
var
|
|
7688
|
-
var
|
|
7689
|
-
var
|
|
7751
|
+
var import_lodash17 = require("lodash");
|
|
7752
|
+
var import_ui_core35 = require("@sentio/ui-core");
|
|
7753
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
7690
7754
|
var defaultConfig9 = {
|
|
7691
7755
|
calculation: "LAST",
|
|
7692
7756
|
colorTheme: {
|
|
@@ -7708,7 +7772,7 @@ function QueryValueControls({
|
|
|
7708
7772
|
onChange,
|
|
7709
7773
|
renderColorSelect
|
|
7710
7774
|
}) {
|
|
7711
|
-
config = (0,
|
|
7775
|
+
config = (0, import_lodash17.defaults)(config, defaultConfig9);
|
|
7712
7776
|
function onCalculationChange(cal) {
|
|
7713
7777
|
config && onChange((0, import_immer16.produce)(config, (draft) => void (draft.calculation = cal)));
|
|
7714
7778
|
}
|
|
@@ -7729,42 +7793,42 @@ function QueryValueControls({
|
|
|
7729
7793
|
})
|
|
7730
7794
|
);
|
|
7731
7795
|
}
|
|
7732
|
-
return /* @__PURE__ */ (0,
|
|
7733
|
-
|
|
7796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
7797
|
+
import_ui_core35.DisclosurePanel,
|
|
7734
7798
|
{
|
|
7735
7799
|
title: "Query Value Options",
|
|
7736
7800
|
defaultOpen,
|
|
7737
7801
|
containerClassName: "w-full bg-default-bg",
|
|
7738
|
-
children: /* @__PURE__ */ (0,
|
|
7739
|
-
/* @__PURE__ */ (0,
|
|
7740
|
-
/* @__PURE__ */ (0,
|
|
7741
|
-
/* @__PURE__ */ (0,
|
|
7802
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-wrap items-center gap-4", children: [
|
|
7803
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "shadow-xs flex h-8 rounded-md", children: [
|
|
7804
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "sm:text-ilabel border-main text-text-foreground inline-flex items-center whitespace-nowrap rounded-l-md border border-r-0 bg-gray-50 px-3", children: "For each series, calculate the" }),
|
|
7805
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
7742
7806
|
"select",
|
|
7743
7807
|
{
|
|
7744
7808
|
value: config?.calculation,
|
|
7745
7809
|
className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 focus:border-primary-600 focus:ring-3 focus:ring-primary-600/30 inline-flex items-center border py-0.5 pl-4 pr-7 focus:relative focus:z-10 focus:outline-none",
|
|
7746
7810
|
onChange: (e) => onCalculationChange(e.target.value),
|
|
7747
|
-
children: CalculationItems4.map((d) => /* @__PURE__ */ (0,
|
|
7811
|
+
children: CalculationItems4.map((d) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: d.value, children: d.label }, d.value))
|
|
7748
7812
|
}
|
|
7749
7813
|
),
|
|
7750
|
-
/* @__PURE__ */ (0,
|
|
7751
|
-
/* @__PURE__ */ (0,
|
|
7814
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "sm:text-ilabel border-main text-text-foreground inline-flex items-center whitespace-nowrap border border-x-0 bg-gray-50 px-3", children: "value, then show the" }),
|
|
7815
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
7752
7816
|
"select",
|
|
7753
7817
|
{
|
|
7754
7818
|
value: config?.seriesCalculation,
|
|
7755
7819
|
className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 focus:border-primary-600 focus:ring-3 focus:ring-primary-600/30 inline-flex items-center border py-0.5 pl-4 pr-7 focus:relative focus:z-10 focus:outline-none",
|
|
7756
7820
|
onChange: (e) => onSeriesCalculationChange(e.target.value),
|
|
7757
|
-
children: CalculationItems4.map((d) => /* @__PURE__ */ (0,
|
|
7821
|
+
children: CalculationItems4.map((d) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: d.value, children: d.label }, d.value))
|
|
7758
7822
|
}
|
|
7759
7823
|
),
|
|
7760
|
-
/* @__PURE__ */ (0,
|
|
7824
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "sm:text-ilabel border-main text-text-foreground inline-flex items-center whitespace-nowrap rounded-r-md border-b border-r border-t bg-gray-50 px-3", children: "value of multiple series" })
|
|
7761
7825
|
] }),
|
|
7762
|
-
/* @__PURE__ */ (0,
|
|
7763
|
-
/* @__PURE__ */ (0,
|
|
7826
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "focus-within:ring-primary-500 shadow-xs border-main flex h-8 divide-x divide-gray-300 rounded-md border focus-within:border-transparent focus-within:ring-2", children: [
|
|
7827
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "sm:text-ilabel text-text-foreground inline-flex items-center whitespace-nowrap rounded-l-md bg-gray-50 px-3", children: "Color Theme" }),
|
|
7764
7828
|
renderColorSelect(config?.colorTheme, onSelectColor)
|
|
7765
7829
|
] }),
|
|
7766
|
-
/* @__PURE__ */ (0,
|
|
7767
|
-
|
|
7830
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
7831
|
+
import_ui_core35.Checkbox,
|
|
7768
7832
|
{
|
|
7769
7833
|
checked: config?.showBackgroundChart,
|
|
7770
7834
|
onChange: toggleShowBackgroundChart,
|
|
@@ -7775,6 +7839,194 @@ function QueryValueControls({
|
|
|
7775
7839
|
}
|
|
7776
7840
|
);
|
|
7777
7841
|
}
|
|
7842
|
+
|
|
7843
|
+
// src/dashboard/ImportPanelDialog.tsx
|
|
7844
|
+
var import_react32 = require("react");
|
|
7845
|
+
var import_lodash18 = require("lodash");
|
|
7846
|
+
var import_ui_core36 = require("@sentio/ui-core");
|
|
7847
|
+
var import_pi = require("react-icons/pi");
|
|
7848
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
7849
|
+
var panelExample = `Paste the panel configuration here.
|
|
7850
|
+
Here is an note type example:
|
|
7851
|
+
{
|
|
7852
|
+
"name": "",
|
|
7853
|
+
"chart": {
|
|
7854
|
+
"type": "NOTE",
|
|
7855
|
+
"queries": [],
|
|
7856
|
+
"formulas": [],
|
|
7857
|
+
"config": null,
|
|
7858
|
+
"note": {
|
|
7859
|
+
"content": "* asdasda",
|
|
7860
|
+
"fontSize": "MD",
|
|
7861
|
+
"textAlign": "LEFT"
|
|
7862
|
+
},
|
|
7863
|
+
"datasourceType": "NOTES",
|
|
7864
|
+
"segmentationQueries": [],
|
|
7865
|
+
"insightsQueries": [],
|
|
7866
|
+
"eventLogsConfig": null,
|
|
7867
|
+
"retentionQuery": null,
|
|
7868
|
+
"sqlQuery": ""
|
|
7869
|
+
}
|
|
7870
|
+
}
|
|
7871
|
+
`;
|
|
7872
|
+
function isValidPanelData(data) {
|
|
7873
|
+
try {
|
|
7874
|
+
const parsed = JSON.parse(data);
|
|
7875
|
+
return parsed.name !== void 0 || parsed.chart !== void 0;
|
|
7876
|
+
} catch {
|
|
7877
|
+
return false;
|
|
7878
|
+
}
|
|
7879
|
+
}
|
|
7880
|
+
var ImportPanelDialog = ({
|
|
7881
|
+
show,
|
|
7882
|
+
onClose: _onClose,
|
|
7883
|
+
onSubmit
|
|
7884
|
+
}) => {
|
|
7885
|
+
const textareaRef = (0, import_react32.useRef)(null);
|
|
7886
|
+
const {
|
|
7887
|
+
value: isInvalid,
|
|
7888
|
+
setTrue: setInvalid,
|
|
7889
|
+
setFalse: setValid
|
|
7890
|
+
} = (0, import_ui_core36.useBoolean)(false);
|
|
7891
|
+
(0, import_react32.useEffect)(() => {
|
|
7892
|
+
if (show) {
|
|
7893
|
+
setTimeout(() => {
|
|
7894
|
+
textareaRef.current?.focus();
|
|
7895
|
+
}, 500);
|
|
7896
|
+
}
|
|
7897
|
+
}, [show]);
|
|
7898
|
+
const debouncedValidate = (0, import_react32.useMemo)(
|
|
7899
|
+
() => (0, import_lodash18.debounce)((value) => {
|
|
7900
|
+
if (isValidPanelData(value)) {
|
|
7901
|
+
setValid();
|
|
7902
|
+
} else {
|
|
7903
|
+
setInvalid();
|
|
7904
|
+
}
|
|
7905
|
+
}, 500),
|
|
7906
|
+
[setValid, setInvalid]
|
|
7907
|
+
);
|
|
7908
|
+
const handleSubmit = () => {
|
|
7909
|
+
if (isInvalid) return;
|
|
7910
|
+
try {
|
|
7911
|
+
const parsed = JSON.parse(textareaRef.current?.value || "");
|
|
7912
|
+
onSubmit(parsed);
|
|
7913
|
+
} catch {
|
|
7914
|
+
setInvalid();
|
|
7915
|
+
}
|
|
7916
|
+
};
|
|
7917
|
+
const onClose = (0, import_react32.useCallback)(() => {
|
|
7918
|
+
_onClose();
|
|
7919
|
+
setValid();
|
|
7920
|
+
if (textareaRef.current) {
|
|
7921
|
+
textareaRef.current.value = "";
|
|
7922
|
+
}
|
|
7923
|
+
}, [_onClose, setValid]);
|
|
7924
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
7925
|
+
import_ui_core36.SlideOver,
|
|
7926
|
+
{
|
|
7927
|
+
title: "Import Panel",
|
|
7928
|
+
open: show,
|
|
7929
|
+
onClose,
|
|
7930
|
+
size: "lg",
|
|
7931
|
+
triggerClose: "button",
|
|
7932
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "w-full space-y-6 p-4", children: [
|
|
7933
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
7934
|
+
"textarea",
|
|
7935
|
+
{
|
|
7936
|
+
ref: textareaRef,
|
|
7937
|
+
className: (0, import_ui_core36.classNames)(
|
|
7938
|
+
"text-icontent text-text-foreground h-[60vh] w-full rounded-sm border",
|
|
7939
|
+
isInvalid ? "border-rose-600! ring-rose-600! focus:border-rose-600! focus:[box-shadow:0_0_0_1px_rgb(225_29_72)]!" : ""
|
|
7940
|
+
),
|
|
7941
|
+
rows: 10,
|
|
7942
|
+
onChange: (evt) => debouncedValidate(evt.target.value),
|
|
7943
|
+
placeholder: panelExample
|
|
7944
|
+
}
|
|
7945
|
+
),
|
|
7946
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex w-full items-center justify-between", children: [
|
|
7947
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_ui_core36.Button, { status: "danger", size: "lg", onClick: onClose, children: "Cancel" }) }),
|
|
7948
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "inline-flex gap-2", children: [
|
|
7949
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
7950
|
+
import_ui_core36.Button,
|
|
7951
|
+
{
|
|
7952
|
+
size: "lg",
|
|
7953
|
+
onClick: () => {
|
|
7954
|
+
try {
|
|
7955
|
+
const parsed = JSON.parse(textareaRef.current?.value || "");
|
|
7956
|
+
textareaRef.current.value = JSON.stringify(parsed, null, 2);
|
|
7957
|
+
} catch {
|
|
7958
|
+
setInvalid();
|
|
7959
|
+
}
|
|
7960
|
+
},
|
|
7961
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_pi.PiBracketsCurlyBold, {}),
|
|
7962
|
+
children: "Format"
|
|
7963
|
+
}
|
|
7964
|
+
),
|
|
7965
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_ui_core36.Button, { role: "primary", size: "lg", onClick: handleSubmit, children: "Submit" })
|
|
7966
|
+
] })
|
|
7967
|
+
] })
|
|
7968
|
+
] })
|
|
7969
|
+
}
|
|
7970
|
+
);
|
|
7971
|
+
};
|
|
7972
|
+
|
|
7973
|
+
// src/dashboard/ExportDashboardDialog.tsx
|
|
7974
|
+
var import_ui_core37 = require("@sentio/ui-core");
|
|
7975
|
+
var import_react33 = __toESM(require("@monaco-editor/react"));
|
|
7976
|
+
var import_lu11 = require("react-icons/lu");
|
|
7977
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
7978
|
+
function ExportDashboardDialog({
|
|
7979
|
+
open,
|
|
7980
|
+
onClose,
|
|
7981
|
+
dashboardId,
|
|
7982
|
+
json,
|
|
7983
|
+
onBeforeMount
|
|
7984
|
+
}) {
|
|
7985
|
+
const isDarkMode = (0, import_ui_core37.useDarkMode)();
|
|
7986
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
7987
|
+
import_ui_core37.BaseDialog,
|
|
7988
|
+
{
|
|
7989
|
+
title: "Export dashboard JSON",
|
|
7990
|
+
open,
|
|
7991
|
+
onClose,
|
|
7992
|
+
onCancel: onClose,
|
|
7993
|
+
cancelText: "Close",
|
|
7994
|
+
footerBorder: false,
|
|
7995
|
+
extraButtons: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "absolute left-4 inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
7996
|
+
"a",
|
|
7997
|
+
{
|
|
7998
|
+
download: dashboardId ? `dashboard-${dashboardId}.json` : "dashboard.json",
|
|
7999
|
+
href: "data:text/json;charset=utf-8," + encodeURIComponent(json),
|
|
8000
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_ui_core37.Button, { role: "text", icon: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lu11.LuDownload, {}), children: "Save to a file" })
|
|
8001
|
+
}
|
|
8002
|
+
) }),
|
|
8003
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("form", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "px-[18px] py-4", children: [
|
|
8004
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
8005
|
+
"div",
|
|
8006
|
+
{
|
|
8007
|
+
className: "absolute right-10 top-8 z-10",
|
|
8008
|
+
onClick: (evt) => evt.preventDefault(),
|
|
8009
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_ui_core37.CopyButton, { text: json, size: 16 })
|
|
8010
|
+
}
|
|
8011
|
+
),
|
|
8012
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "focus-within:border-primary-300 h-[324px] overflow-hidden rounded-sm border", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
8013
|
+
import_react33.default,
|
|
8014
|
+
{
|
|
8015
|
+
value: json,
|
|
8016
|
+
theme: isDarkMode ? "sentio-dark" : "sentio",
|
|
8017
|
+
language: "json",
|
|
8018
|
+
beforeMount: onBeforeMount,
|
|
8019
|
+
options: {
|
|
8020
|
+
readOnly: true,
|
|
8021
|
+
minimap: { enabled: false },
|
|
8022
|
+
lineNumbers: "off"
|
|
8023
|
+
}
|
|
8024
|
+
}
|
|
8025
|
+
) })
|
|
8026
|
+
] }) })
|
|
8027
|
+
}
|
|
8028
|
+
);
|
|
8029
|
+
}
|
|
7778
8030
|
// Annotate the CommonJS export names for ESM import in node:
|
|
7779
8031
|
0 && (module.exports = {
|
|
7780
8032
|
AggregateInput,
|
|
@@ -7793,13 +8045,16 @@ function QueryValueControls({
|
|
|
7793
8045
|
DataControls,
|
|
7794
8046
|
EditDashboardDialog,
|
|
7795
8047
|
EditGroupDialog,
|
|
8048
|
+
ErrorChart,
|
|
7796
8049
|
EventsFunctionCategories,
|
|
7797
8050
|
EventsFunctionMap,
|
|
8051
|
+
ExportDashboardDialog,
|
|
7798
8052
|
FunctionInput,
|
|
7799
8053
|
FunctionMap,
|
|
7800
8054
|
FunctionsCategories,
|
|
7801
8055
|
FunctionsPanel,
|
|
7802
8056
|
HIGHLIGHT_COLORS,
|
|
8057
|
+
ImportPanelDialog,
|
|
7803
8058
|
LabelControls,
|
|
7804
8059
|
LabelSearchProvider,
|
|
7805
8060
|
LabelsInput,
|