@sentio/ui-dashboard 0.3.10 → 0.3.11

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