@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.mjs CHANGED
@@ -6906,6 +6906,67 @@ var EditDashboardDialog = ({
6906
6906
  );
6907
6907
  };
6908
6908
 
6909
+ // src/dashboard/ErrorChart.tsx
6910
+ import React4 from "react";
6911
+ import { BarLoading as BarLoading2, Button as Button5 } from "@sentio/ui-core";
6912
+ import { useResizeDetector as useResizeDetector5 } from "react-resize-detector";
6913
+ import { isString } from "lodash";
6914
+ import { jsx as jsx41, jsxs as jsxs31 } from "react/jsx-runtime";
6915
+ var ErrorChart = React4.memo(function ErrorChart2({
6916
+ data,
6917
+ logoSrc,
6918
+ onNavigateToDatasource
6919
+ }) {
6920
+ const { ref, width, height } = useResizeDetector5();
6921
+ let hintMessage;
6922
+ if (data?.code === 5) {
6923
+ hintMessage = /* @__PURE__ */ jsxs31("span", { children: [
6924
+ "No active processor found",
6925
+ /* @__PURE__ */ jsx41("br", {}),
6926
+ " Check the",
6927
+ /* @__PURE__ */ jsx41(Button5, { role: "link", onClick: onNavigateToDatasource, children: "datasource" }),
6928
+ "page for more details."
6929
+ ] });
6930
+ } else if (data?.status === 429) {
6931
+ return /* @__PURE__ */ jsx41(
6932
+ BarLoading2,
6933
+ {
6934
+ className: "bg-default-bg absolute w-full",
6935
+ hint: /* @__PURE__ */ jsx41("span", { className: "text-xs font-normal", children: "Too many simultaneous requests, retrying later..." }),
6936
+ width: 160
6937
+ }
6938
+ );
6939
+ } else {
6940
+ hintMessage = data?.message ?? "Something went wrong";
6941
+ }
6942
+ const imageSize = Math.min(
6943
+ Math.min(64, width ? width * 0.4 : 64),
6944
+ Math.min(64, height ? height * 0.4 : 64)
6945
+ );
6946
+ return /* @__PURE__ */ jsx41("div", { className: "flex h-full w-full items-center", ref, children: /* @__PURE__ */ jsxs31("div", { className: "w-full space-y-4 text-center", children: [
6947
+ imageSize < 10 || !logoSrc ? null : /* @__PURE__ */ jsx41(
6948
+ "img",
6949
+ {
6950
+ className: "mx-auto",
6951
+ src: logoSrc,
6952
+ width: imageSize,
6953
+ height: imageSize,
6954
+ style: { width: imageSize, height: "auto" },
6955
+ alt: "gray logo"
6956
+ }
6957
+ ),
6958
+ /* @__PURE__ */ jsx41(
6959
+ "div",
6960
+ {
6961
+ title: isString(hintMessage) ? hintMessage : void 0,
6962
+ className: `text-text-foreground-secondary font-icontent text-icontent px-4 ${height && height < 200 ? "line-clamp-1" : "line-clamp-2"}`,
6963
+ children: hintMessage
6964
+ }
6965
+ ),
6966
+ /* @__PURE__ */ jsx41(RefreshButton, {})
6967
+ ] }) });
6968
+ });
6969
+
6909
6970
  // src/dashboard/EditGroupDialog.tsx
6910
6971
  import { useEffect as useEffect11, useMemo as useMemo13, useRef as useRef6, useState as useState12 } from "react";
6911
6972
  import { BaseDialog as BaseDialog2, Select as Select2, classNames as classNames12 } from "@sentio/ui-core";
@@ -6961,9 +7022,9 @@ function resolveHeaderStyle(style, colorKey, isDark) {
6961
7022
  }
6962
7023
 
6963
7024
  // src/dashboard/EditGroupDialog.tsx
6964
- import { Fragment as Fragment10, jsx as jsx41, jsxs as jsxs31 } from "react/jsx-runtime";
7025
+ import { Fragment as Fragment10, jsx as jsx42, jsxs as jsxs32 } from "react/jsx-runtime";
6965
7026
  function StyleCard({ selected, label, onClick, preview }) {
6966
- return /* @__PURE__ */ jsxs31(
7027
+ return /* @__PURE__ */ jsxs32(
6967
7028
  "button",
6968
7029
  {
6969
7030
  type: "button",
@@ -6973,8 +7034,8 @@ function StyleCard({ selected, label, onClick, preview }) {
6973
7034
  selected ? "border-primary-600 ring-primary-600/30 ring-3 shadow-sm" : "border-main hover:border-primary-400"
6974
7035
  ),
6975
7036
  children: [
6976
- /* @__PURE__ */ jsx41("div", { className: "bg-hover/40 flex h-28 items-center justify-center", children: preview }),
6977
- /* @__PURE__ */ jsxs31(
7037
+ /* @__PURE__ */ jsx42("div", { className: "bg-hover/40 flex h-28 items-center justify-center", children: preview }),
7038
+ /* @__PURE__ */ jsxs32(
6978
7039
  "div",
6979
7040
  {
6980
7041
  className: classNames12(
@@ -6982,7 +7043,7 @@ function StyleCard({ selected, label, onClick, preview }) {
6982
7043
  selected ? "text-primary-600 font-semibold" : "text-text-foreground font-medium"
6983
7044
  ),
6984
7045
  children: [
6985
- selected && /* @__PURE__ */ jsx41(LuCheck2, { className: "h-3.5 w-3.5" }),
7046
+ selected && /* @__PURE__ */ jsx42(LuCheck2, { className: "h-3.5 w-3.5" }),
6986
7047
  label
6987
7048
  ]
6988
7049
  }
@@ -6992,13 +7053,13 @@ function StyleCard({ selected, label, onClick, preview }) {
6992
7053
  );
6993
7054
  }
6994
7055
  function DefaultPreview() {
6995
- return /* @__PURE__ */ jsx41("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" });
7056
+ return /* @__PURE__ */ jsx42("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" });
6996
7057
  }
6997
7058
  function EmphasisPreview({
6998
7059
  color
6999
7060
  }) {
7000
- return /* @__PURE__ */ jsxs31("div", { className: "border-main bg-default-bg flex h-16 w-32 flex-col rounded border", children: [
7001
- /* @__PURE__ */ jsx41(
7061
+ return /* @__PURE__ */ jsxs32("div", { className: "border-main bg-default-bg flex h-16 w-32 flex-col rounded border", children: [
7062
+ /* @__PURE__ */ jsx42(
7002
7063
  "div",
7003
7064
  {
7004
7065
  className: "flex h-9 items-center justify-center text-sm font-semibold",
@@ -7006,7 +7067,7 @@ function EmphasisPreview({
7006
7067
  children: "Title"
7007
7068
  }
7008
7069
  ),
7009
- /* @__PURE__ */ jsx41("div", { className: "flex-1" })
7070
+ /* @__PURE__ */ jsx42("div", { className: "flex-1" })
7010
7071
  ] });
7011
7072
  }
7012
7073
  function EditGroupDialog({
@@ -7056,8 +7117,8 @@ function EditGroupDialog({
7056
7117
  return {
7057
7118
  value: c.key,
7058
7119
  title: c.name,
7059
- label: ({ selected }) => /* @__PURE__ */ jsxs31("div", { className: "flex w-full items-center gap-2.5 pr-2", children: [
7060
- /* @__PURE__ */ jsx41(
7120
+ label: ({ selected }) => /* @__PURE__ */ jsxs32("div", { className: "flex w-full items-center gap-2.5 pr-2", children: [
7121
+ /* @__PURE__ */ jsx42(
7061
7122
  "div",
7062
7123
  {
7063
7124
  className: "flex h-5 w-5 items-center justify-center rounded text-xs font-bold",
@@ -7068,14 +7129,14 @@ function EditGroupDialog({
7068
7129
  children: "T"
7069
7130
  }
7070
7131
  ),
7071
- /* @__PURE__ */ jsx41("span", { className: "flex-1 text-sm", children: c.name }),
7072
- selected && /* @__PURE__ */ jsx41(LuCheck2, { className: "text-primary-600 h-4 w-4" })
7132
+ /* @__PURE__ */ jsx42("span", { className: "flex-1 text-sm", children: c.name }),
7133
+ selected && /* @__PURE__ */ jsx42(LuCheck2, { className: "text-primary-600 h-4 w-4" })
7073
7134
  ] })
7074
7135
  };
7075
7136
  }),
7076
7137
  [isDark]
7077
7138
  );
7078
- return /* @__PURE__ */ jsx41(
7139
+ return /* @__PURE__ */ jsx42(
7079
7140
  BaseDialog2,
7080
7141
  {
7081
7142
  title: "Edit Group",
@@ -7087,10 +7148,10 @@ function EditGroupDialog({
7087
7148
  okText: "Save",
7088
7149
  panelClassName: "sm:max-w-xl",
7089
7150
  initialFocus: titleRef,
7090
- children: /* @__PURE__ */ jsxs31("div", { className: "text-text-foreground px-4 pb-2 pt-4", children: [
7091
- /* @__PURE__ */ jsx41("h4", { className: "text-text-foreground mb-3 text-sm font-semibold", children: "Display options" }),
7092
- /* @__PURE__ */ jsx41("label", { className: "text-text-foreground-secondary text-ilabel mb-1 block", children: "Title" }),
7093
- /* @__PURE__ */ jsx41(
7151
+ children: /* @__PURE__ */ jsxs32("div", { className: "text-text-foreground px-4 pb-2 pt-4", children: [
7152
+ /* @__PURE__ */ jsx42("h4", { className: "text-text-foreground mb-3 text-sm font-semibold", children: "Display options" }),
7153
+ /* @__PURE__ */ jsx42("label", { className: "text-text-foreground-secondary text-ilabel mb-1 block", children: "Title" }),
7154
+ /* @__PURE__ */ jsx42(
7094
7155
  "input",
7095
7156
  {
7096
7157
  ref: titleRef,
@@ -7106,29 +7167,29 @@ function EditGroupDialog({
7106
7167
  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"
7107
7168
  }
7108
7169
  ),
7109
- /* @__PURE__ */ jsxs31("div", { className: "mb-4 grid grid-cols-2 gap-3", children: [
7110
- /* @__PURE__ */ jsx41(
7170
+ /* @__PURE__ */ jsxs32("div", { className: "mb-4 grid grid-cols-2 gap-3", children: [
7171
+ /* @__PURE__ */ jsx42(
7111
7172
  StyleCard,
7112
7173
  {
7113
7174
  selected: draftStyle === "DEFAULT",
7114
7175
  label: "Default",
7115
7176
  onClick: () => onPickStyle("DEFAULT"),
7116
- preview: /* @__PURE__ */ jsx41(DefaultPreview, {})
7177
+ preview: /* @__PURE__ */ jsx42(DefaultPreview, {})
7117
7178
  }
7118
7179
  ),
7119
- /* @__PURE__ */ jsx41(
7180
+ /* @__PURE__ */ jsx42(
7120
7181
  StyleCard,
7121
7182
  {
7122
7183
  selected: draftStyle === "EMPHASIS",
7123
7184
  label: "Emphasis",
7124
7185
  onClick: () => onPickStyle("EMPHASIS"),
7125
- preview: /* @__PURE__ */ jsx41(EmphasisPreview, { color: previewColor })
7186
+ preview: /* @__PURE__ */ jsx42(EmphasisPreview, { color: previewColor })
7126
7187
  }
7127
7188
  )
7128
7189
  ] }),
7129
- draftStyle !== "DEFAULT" && /* @__PURE__ */ jsxs31(Fragment10, { children: [
7130
- /* @__PURE__ */ jsx41("label", { className: "text-text-foreground-secondary text-ilabel mb-1 block", children: "Highlight Color" }),
7131
- /* @__PURE__ */ jsx41(
7190
+ draftStyle !== "DEFAULT" && /* @__PURE__ */ jsxs32(Fragment10, { children: [
7191
+ /* @__PURE__ */ jsx42("label", { className: "text-text-foreground-secondary text-ilabel mb-1 block", children: "Highlight Color" }),
7192
+ /* @__PURE__ */ jsx42(
7132
7193
  Select2,
7133
7194
  {
7134
7195
  value: draftColor || DEFAULT_HIGHLIGHT_KEY,
@@ -7152,7 +7213,7 @@ import { classNames as classNames13 } from "@sentio/ui-core";
7152
7213
  import { useCallback as useCallback7, useEffect as useEffect12, useRef as useRef7, useState as useState13 } from "react";
7153
7214
  import { IoMdRefresh as IoMdRefresh2 } from "react-icons/io";
7154
7215
  import dayjsEn from "dayjs/locale/en";
7155
- import { jsx as jsx42, jsxs as jsxs32 } from "react/jsx-runtime";
7216
+ import { jsx as jsx43, jsxs as jsxs33 } from "react/jsx-runtime";
7156
7217
  dayjs6.extend(relativeTime);
7157
7218
  dayjs6.extend(updateLocale);
7158
7219
  dayjs6.locale("en.short", {
@@ -7216,7 +7277,7 @@ var DashboardRefresh = ({ stats, onRefresh }) => {
7216
7277
  }
7217
7278
  }, []);
7218
7279
  const showReload = fetching || stats?.isRefreshing;
7219
- return /* @__PURE__ */ jsxs32(
7280
+ return /* @__PURE__ */ jsxs33(
7220
7281
  "div",
7221
7282
  {
7222
7283
  className: classNames13(
@@ -7225,8 +7286,8 @@ var DashboardRefresh = ({ stats, onRefresh }) => {
7225
7286
  showReload ? "pr-5" : "pr-1.5 hover:pr-5"
7226
7287
  ),
7227
7288
  children: [
7228
- /* @__PURE__ */ jsx42("span", { className: "cursor-default text-[10px]", ref: timeRef }),
7229
- /* @__PURE__ */ jsx42(
7289
+ /* @__PURE__ */ jsx43("span", { className: "cursor-default text-[10px]", ref: timeRef }),
7290
+ /* @__PURE__ */ jsx43(
7230
7291
  "button",
7231
7292
  {
7232
7293
  onClick,
@@ -7234,7 +7295,7 @@ var DashboardRefresh = ({ stats, onRefresh }) => {
7234
7295
  "absolute right-1",
7235
7296
  showReload ? "block" : "hidden group-hover/refresh:block"
7236
7297
  ),
7237
- children: /* @__PURE__ */ jsx42(
7298
+ children: /* @__PURE__ */ jsx43(
7238
7299
  IoMdRefresh2,
7239
7300
  {
7240
7301
  className: classNames13(
@@ -7258,7 +7319,7 @@ import {
7258
7319
  Checkbox as Checkbox6,
7259
7320
  dateTimeToString as dateTimeToString2
7260
7321
  } from "@sentio/ui-core";
7261
- import { jsx as jsx43, jsxs as jsxs33 } from "react/jsx-runtime";
7322
+ import { jsx as jsx44, jsxs as jsxs34 } from "react/jsx-runtime";
7262
7323
  var ShareDashboardDialog = ({
7263
7324
  open,
7264
7325
  initData,
@@ -7300,7 +7361,7 @@ var ShareDashboardDialog = ({
7300
7361
  setHideModifiers(checked);
7301
7362
  handleConfigChange(isReadonly, checked);
7302
7363
  };
7303
- return /* @__PURE__ */ jsx43(
7364
+ return /* @__PURE__ */ jsx44(
7304
7365
  BaseDialog3,
7305
7366
  {
7306
7367
  title: "Sharing: ON",
@@ -7320,10 +7381,10 @@ var ShareDashboardDialog = ({
7320
7381
  onClose,
7321
7382
  buttonsClassName: "justify-between",
7322
7383
  footerBorder: false,
7323
- children: /* @__PURE__ */ jsxs33("div", { className: "mx-4 my-4", children: [
7324
- /* @__PURE__ */ jsxs33("div", { className: "flex overflow-hidden rounded-md border pl-3", children: [
7325
- /* @__PURE__ */ jsx43("span", { className: "text-ilabel font-ilabel text-text-foreground flex-1 grow truncate leading-8", children: linkText }),
7326
- /* @__PURE__ */ jsx43("div", { className: "group cursor-pointer border-l bg-gray-200 px-2 py-1 hover:bg-gray-100", children: /* @__PURE__ */ jsx43(
7384
+ children: /* @__PURE__ */ jsxs34("div", { className: "mx-4 my-4", children: [
7385
+ /* @__PURE__ */ jsxs34("div", { className: "flex overflow-hidden rounded-md border pl-3", children: [
7386
+ /* @__PURE__ */ jsx44("span", { className: "text-ilabel font-ilabel text-text-foreground flex-1 grow truncate leading-8", children: linkText }),
7387
+ /* @__PURE__ */ jsx44("div", { className: "group cursor-pointer border-l bg-gray-200 px-2 py-1 hover:bg-gray-100", children: /* @__PURE__ */ jsx44(
7327
7388
  CopyButton3,
7328
7389
  {
7329
7390
  text: linkText,
@@ -7332,12 +7393,12 @@ var ShareDashboardDialog = ({
7332
7393
  }
7333
7394
  ) })
7334
7395
  ] }),
7335
- /* @__PURE__ */ jsx43("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." }),
7336
- /* @__PURE__ */ jsxs33("div", { className: "mt-4 space-y-3 border-t pt-4", children: [
7337
- /* @__PURE__ */ jsx43("div", { className: "text-text-foreground text-sm font-medium", children: "Access Settings" }),
7338
- /* @__PURE__ */ jsxs33("div", { className: "space-y-4", children: [
7339
- /* @__PURE__ */ jsxs33("div", { children: [
7340
- /* @__PURE__ */ jsx43(
7396
+ /* @__PURE__ */ jsx44("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." }),
7397
+ /* @__PURE__ */ jsxs34("div", { className: "mt-4 space-y-3 border-t pt-4", children: [
7398
+ /* @__PURE__ */ jsx44("div", { className: "text-text-foreground text-sm font-medium", children: "Access Settings" }),
7399
+ /* @__PURE__ */ jsxs34("div", { className: "space-y-4", children: [
7400
+ /* @__PURE__ */ jsxs34("div", { children: [
7401
+ /* @__PURE__ */ jsx44(
7341
7402
  Checkbox6,
7342
7403
  {
7343
7404
  checked: isReadonly,
@@ -7345,10 +7406,10 @@ var ShareDashboardDialog = ({
7345
7406
  label: "Panel read-only access"
7346
7407
  }
7347
7408
  ),
7348
- /* @__PURE__ */ jsx43("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." })
7409
+ /* @__PURE__ */ jsx44("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." })
7349
7410
  ] }),
7350
- /* @__PURE__ */ jsxs33("div", { children: [
7351
- /* @__PURE__ */ jsx43(
7411
+ /* @__PURE__ */ jsxs34("div", { children: [
7412
+ /* @__PURE__ */ jsx44(
7352
7413
  Checkbox6,
7353
7414
  {
7354
7415
  checked: hideModifiers,
@@ -7356,7 +7417,7 @@ var ShareDashboardDialog = ({
7356
7417
  label: "Hide controls"
7357
7418
  }
7358
7419
  ),
7359
- /* @__PURE__ */ jsx43("div", { className: "text-text-foreground-secondary ml-6 text-xs", children: "Hide panel creator and modifier for viewers" })
7420
+ /* @__PURE__ */ jsx44("div", { className: "text-text-foreground-secondary ml-6 text-xs", children: "Hide panel creator and modifier for viewers" })
7360
7421
  ] })
7361
7422
  ] })
7362
7423
  ] })
@@ -7369,7 +7430,7 @@ var ShareDashboardDialog = ({
7369
7430
  import { defaults as defaults9 } from "lodash";
7370
7431
  import { produce as produce15 } from "immer";
7371
7432
  import { Switch, TimeRangePicker } from "@sentio/ui-core";
7372
- import { jsx as jsx44, jsxs as jsxs34 } from "react/jsx-runtime";
7433
+ import { jsx as jsx45, jsxs as jsxs35 } from "react/jsx-runtime";
7373
7434
  var defaultConfig8 = {
7374
7435
  enabled: false
7375
7436
  };
@@ -7415,8 +7476,8 @@ function TimeRangeOverride({
7415
7476
  onSetGlobalTimeRange(start, end, tz);
7416
7477
  }
7417
7478
  }
7418
- return /* @__PURE__ */ jsxs34("div", { className: "flex flex-wrap items-center gap-4 p-2", children: [
7419
- /* @__PURE__ */ jsx44("div", { className: "flex items-center", children: /* @__PURE__ */ jsx44(
7479
+ return /* @__PURE__ */ jsxs35("div", { className: "flex flex-wrap items-center gap-4 p-2", children: [
7480
+ /* @__PURE__ */ jsx45("div", { className: "flex items-center", children: /* @__PURE__ */ jsx45(
7420
7481
  Switch,
7421
7482
  {
7422
7483
  checked: config.enabled || false,
@@ -7424,7 +7485,7 @@ function TimeRangeOverride({
7424
7485
  label: "Override Global Time"
7425
7486
  }
7426
7487
  ) }),
7427
- /* @__PURE__ */ jsx44(
7488
+ /* @__PURE__ */ jsx45(
7428
7489
  TimeRangePicker,
7429
7490
  {
7430
7491
  startTime: config.enabled ? fromTimeLike(config.timeRange?.start) : globalStartTime,
@@ -7443,33 +7504,33 @@ import { useVirtualizer } from "@tanstack/react-virtual";
7443
7504
  import { LuChevronRight, LuMountainSnow } from "react-icons/lu";
7444
7505
  import { cloneDeep } from "lodash";
7445
7506
  import { Disclosure } from "@headlessui/react";
7446
- import { jsx as jsx45, jsxs as jsxs35 } from "react/jsx-runtime";
7507
+ import { jsx as jsx46, jsxs as jsxs36 } from "react/jsx-runtime";
7447
7508
  var seriesChartTypes = [
7448
7509
  {
7449
7510
  value: "default",
7450
- label: /* @__PURE__ */ jsxs35("div", { className: "flex items-center", children: [
7451
- /* @__PURE__ */ jsx45(LuMountainSnow, { className: "mr-2 h-4 w-4" }),
7511
+ label: /* @__PURE__ */ jsxs36("div", { className: "flex items-center", children: [
7512
+ /* @__PURE__ */ jsx46(LuMountainSnow, { className: "mr-2 h-4 w-4" }),
7452
7513
  "Default"
7453
7514
  ] })
7454
7515
  },
7455
7516
  {
7456
7517
  value: "LINE",
7457
- label: /* @__PURE__ */ jsxs35("div", { className: "flex items-center", children: [
7458
- /* @__PURE__ */ jsx45(LineIcon_default, { className: "mr-2 h-4 w-4" }),
7518
+ label: /* @__PURE__ */ jsxs36("div", { className: "flex items-center", children: [
7519
+ /* @__PURE__ */ jsx46(LineIcon_default, { className: "mr-2 h-4 w-4" }),
7459
7520
  "Line"
7460
7521
  ] })
7461
7522
  },
7462
7523
  {
7463
7524
  value: "BAR",
7464
- label: /* @__PURE__ */ jsxs35("div", { className: "flex items-center", children: [
7465
- /* @__PURE__ */ jsx45(BarIcon_default, { className: "mr-2 h-4 w-4" }),
7525
+ label: /* @__PURE__ */ jsxs36("div", { className: "flex items-center", children: [
7526
+ /* @__PURE__ */ jsx46(BarIcon_default, { className: "mr-2 h-4 w-4" }),
7466
7527
  "Bar"
7467
7528
  ] })
7468
7529
  },
7469
7530
  {
7470
7531
  value: "AREA",
7471
- label: /* @__PURE__ */ jsxs35("div", { className: "flex items-center", children: [
7472
- /* @__PURE__ */ jsx45(AreaIcon_default, { className: "mr-2 h-4 w-4" }),
7532
+ label: /* @__PURE__ */ jsxs36("div", { className: "flex items-center", children: [
7533
+ /* @__PURE__ */ jsx46(AreaIcon_default, { className: "mr-2 h-4 w-4" }),
7473
7534
  "Area"
7474
7535
  ] })
7475
7536
  }
@@ -7522,14 +7583,14 @@ var SeriesControls = ({
7522
7583
  };
7523
7584
  const renderSeriesItem = (seriesName) => {
7524
7585
  const currentType = config?.seriesConfig?.series?.[seriesName]?.type || "default";
7525
- return /* @__PURE__ */ jsxs35(
7586
+ return /* @__PURE__ */ jsxs36(
7526
7587
  "div",
7527
7588
  {
7528
7589
  className: "text-icontent inline-flex h-8 w-full basis-0 px-2",
7529
7590
  children: [
7530
- /* @__PURE__ */ jsx45("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__ */ jsx45("span", { className: "truncate", title: seriesName, children: seriesName }) }),
7531
- /* @__PURE__ */ jsx45("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" }),
7532
- /* @__PURE__ */ jsx45("div", { className: "w-40", children: /* @__PURE__ */ jsx45(
7591
+ /* @__PURE__ */ jsx46("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__ */ jsx46("span", { className: "truncate", title: seriesName, children: seriesName }) }),
7592
+ /* @__PURE__ */ jsx46("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" }),
7593
+ /* @__PURE__ */ jsx46("div", { className: "w-40", children: /* @__PURE__ */ jsx46(
7533
7594
  Select3,
7534
7595
  {
7535
7596
  options: seriesChartTypes,
@@ -7549,9 +7610,9 @@ var SeriesControls = ({
7549
7610
  if (!enabled) {
7550
7611
  return null;
7551
7612
  }
7552
- const titleWithReset = /* @__PURE__ */ jsxs35("div", { className: "flex w-full items-center justify-between pr-2", children: [
7553
- /* @__PURE__ */ jsx45("span", { children: `Series (${series.length})` }),
7554
- /* @__PURE__ */ jsx45(
7613
+ const titleWithReset = /* @__PURE__ */ jsxs36("div", { className: "flex w-full items-center justify-between pr-2", children: [
7614
+ /* @__PURE__ */ jsx46("span", { children: `Series (${series.length})` }),
7615
+ /* @__PURE__ */ jsx46(
7555
7616
  "button",
7556
7617
  {
7557
7618
  type: "button",
@@ -7565,12 +7626,12 @@ var SeriesControls = ({
7565
7626
  }
7566
7627
  )
7567
7628
  ] });
7568
- return /* @__PURE__ */ jsx45(Disclosure, { defaultOpen: true, children: ({ open }) => {
7629
+ return /* @__PURE__ */ jsx46(Disclosure, { defaultOpen: true, children: ({ open }) => {
7569
7630
  useEffect13(() => {
7570
7631
  setIsDisclosureOpen(open);
7571
7632
  }, [open]);
7572
- return /* @__PURE__ */ jsxs35("div", { className: "bg-default-bg w-full rounded-sm", children: [
7573
- /* @__PURE__ */ jsxs35(
7633
+ return /* @__PURE__ */ jsxs36("div", { className: "bg-default-bg w-full rounded-sm", children: [
7634
+ /* @__PURE__ */ jsxs36(
7574
7635
  Disclosure.Button,
7575
7636
  {
7576
7637
  className: classNames14(
@@ -7578,7 +7639,7 @@ var SeriesControls = ({
7578
7639
  "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"
7579
7640
  ),
7580
7641
  children: [
7581
- /* @__PURE__ */ jsx45(
7642
+ /* @__PURE__ */ jsx46(
7582
7643
  LuChevronRight,
7583
7644
  {
7584
7645
  className: classNames14(
@@ -7591,9 +7652,9 @@ var SeriesControls = ({
7591
7652
  ]
7592
7653
  }
7593
7654
  ),
7594
- /* @__PURE__ */ jsx45(Disclosure.Panel, { className: "p-2", children: shouldVirtualize && open ? (
7655
+ /* @__PURE__ */ jsx46(Disclosure.Panel, { className: "p-2", children: shouldVirtualize && open ? (
7595
7656
  // Virtualized rendering for large lists - only render when open
7596
- /* @__PURE__ */ jsx45(
7657
+ /* @__PURE__ */ jsx46(
7597
7658
  "div",
7598
7659
  {
7599
7660
  ref: parentRef,
@@ -7601,7 +7662,7 @@ var SeriesControls = ({
7601
7662
  style: {
7602
7663
  contain: "strict"
7603
7664
  },
7604
- children: /* @__PURE__ */ jsx45(
7665
+ children: /* @__PURE__ */ jsx46(
7605
7666
  "div",
7606
7667
  {
7607
7668
  style: {
@@ -7612,7 +7673,7 @@ var SeriesControls = ({
7612
7673
  children: virtualizer?.getVirtualItems().map((virtualItem) => {
7613
7674
  const seriesName = series[virtualItem.index];
7614
7675
  if (!seriesName) return null;
7615
- return /* @__PURE__ */ jsx45(
7676
+ return /* @__PURE__ */ jsx46(
7616
7677
  "div",
7617
7678
  {
7618
7679
  style: {
@@ -7634,7 +7695,7 @@ var SeriesControls = ({
7634
7695
  )
7635
7696
  ) : (
7636
7697
  // Normal rendering for small lists
7637
- /* @__PURE__ */ jsx45("div", { className: "text-icontent flex max-h-[200px] flex-col gap-2 overflow-y-auto", children: series.map((seriesName) => renderSeriesItem(seriesName)) })
7698
+ /* @__PURE__ */ jsx46("div", { className: "text-icontent flex max-h-[200px] flex-col gap-2 overflow-y-auto", children: series.map((seriesName) => renderSeriesItem(seriesName)) })
7638
7699
  ) })
7639
7700
  ] });
7640
7701
  } });
@@ -7644,7 +7705,7 @@ var SeriesControls = ({
7644
7705
  import { produce as produce16 } from "immer";
7645
7706
  import { defaults as defaults10 } from "lodash";
7646
7707
  import { Checkbox as Checkbox7, DisclosurePanel as DisclosurePanel12 } from "@sentio/ui-core";
7647
- import { jsx as jsx46, jsxs as jsxs36 } from "react/jsx-runtime";
7708
+ import { jsx as jsx47, jsxs as jsxs37 } from "react/jsx-runtime";
7648
7709
  var defaultConfig9 = {
7649
7710
  calculation: "LAST",
7650
7711
  colorTheme: {
@@ -7687,41 +7748,41 @@ function QueryValueControls({
7687
7748
  })
7688
7749
  );
7689
7750
  }
7690
- return /* @__PURE__ */ jsx46(
7751
+ return /* @__PURE__ */ jsx47(
7691
7752
  DisclosurePanel12,
7692
7753
  {
7693
7754
  title: "Query Value Options",
7694
7755
  defaultOpen,
7695
7756
  containerClassName: "w-full bg-default-bg",
7696
- children: /* @__PURE__ */ jsxs36("div", { className: "flex flex-wrap items-center gap-4", children: [
7697
- /* @__PURE__ */ jsxs36("div", { className: "shadow-xs flex h-8 rounded-md", children: [
7698
- /* @__PURE__ */ jsx46("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" }),
7699
- /* @__PURE__ */ jsx46(
7757
+ children: /* @__PURE__ */ jsxs37("div", { className: "flex flex-wrap items-center gap-4", children: [
7758
+ /* @__PURE__ */ jsxs37("div", { className: "shadow-xs flex h-8 rounded-md", children: [
7759
+ /* @__PURE__ */ jsx47("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" }),
7760
+ /* @__PURE__ */ jsx47(
7700
7761
  "select",
7701
7762
  {
7702
7763
  value: config?.calculation,
7703
7764
  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",
7704
7765
  onChange: (e) => onCalculationChange(e.target.value),
7705
- children: CalculationItems4.map((d) => /* @__PURE__ */ jsx46("option", { value: d.value, children: d.label }, d.value))
7766
+ children: CalculationItems4.map((d) => /* @__PURE__ */ jsx47("option", { value: d.value, children: d.label }, d.value))
7706
7767
  }
7707
7768
  ),
7708
- /* @__PURE__ */ jsx46("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" }),
7709
- /* @__PURE__ */ jsx46(
7769
+ /* @__PURE__ */ jsx47("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" }),
7770
+ /* @__PURE__ */ jsx47(
7710
7771
  "select",
7711
7772
  {
7712
7773
  value: config?.seriesCalculation,
7713
7774
  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",
7714
7775
  onChange: (e) => onSeriesCalculationChange(e.target.value),
7715
- children: CalculationItems4.map((d) => /* @__PURE__ */ jsx46("option", { value: d.value, children: d.label }, d.value))
7776
+ children: CalculationItems4.map((d) => /* @__PURE__ */ jsx47("option", { value: d.value, children: d.label }, d.value))
7716
7777
  }
7717
7778
  ),
7718
- /* @__PURE__ */ jsx46("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" })
7779
+ /* @__PURE__ */ jsx47("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" })
7719
7780
  ] }),
7720
- /* @__PURE__ */ jsxs36("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: [
7721
- /* @__PURE__ */ jsx46("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" }),
7781
+ /* @__PURE__ */ jsxs37("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: [
7782
+ /* @__PURE__ */ jsx47("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" }),
7722
7783
  renderColorSelect(config?.colorTheme, onSelectColor)
7723
7784
  ] }),
7724
- /* @__PURE__ */ jsx46(
7785
+ /* @__PURE__ */ jsx47(
7725
7786
  Checkbox7,
7726
7787
  {
7727
7788
  checked: config?.showBackgroundChart,
@@ -7733,6 +7794,194 @@ function QueryValueControls({
7733
7794
  }
7734
7795
  );
7735
7796
  }
7797
+
7798
+ // src/dashboard/ImportPanelDialog.tsx
7799
+ import { useCallback as useCallback8, useEffect as useEffect14, useMemo as useMemo15, useRef as useRef9 } from "react";
7800
+ import { debounce } from "lodash";
7801
+ import { SlideOver, Button as Button6, useBoolean as useBoolean2, classNames as classNames15 } from "@sentio/ui-core";
7802
+ import { PiBracketsCurlyBold } from "react-icons/pi";
7803
+ import { jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
7804
+ var panelExample = `Paste the panel configuration here.
7805
+ Here is an note type example:
7806
+ {
7807
+ "name": "",
7808
+ "chart": {
7809
+ "type": "NOTE",
7810
+ "queries": [],
7811
+ "formulas": [],
7812
+ "config": null,
7813
+ "note": {
7814
+ "content": "* asdasda",
7815
+ "fontSize": "MD",
7816
+ "textAlign": "LEFT"
7817
+ },
7818
+ "datasourceType": "NOTES",
7819
+ "segmentationQueries": [],
7820
+ "insightsQueries": [],
7821
+ "eventLogsConfig": null,
7822
+ "retentionQuery": null,
7823
+ "sqlQuery": ""
7824
+ }
7825
+ }
7826
+ `;
7827
+ function isValidPanelData(data) {
7828
+ try {
7829
+ const parsed = JSON.parse(data);
7830
+ return parsed.name !== void 0 || parsed.chart !== void 0;
7831
+ } catch {
7832
+ return false;
7833
+ }
7834
+ }
7835
+ var ImportPanelDialog = ({
7836
+ show,
7837
+ onClose: _onClose,
7838
+ onSubmit
7839
+ }) => {
7840
+ const textareaRef = useRef9(null);
7841
+ const {
7842
+ value: isInvalid,
7843
+ setTrue: setInvalid,
7844
+ setFalse: setValid
7845
+ } = useBoolean2(false);
7846
+ useEffect14(() => {
7847
+ if (show) {
7848
+ setTimeout(() => {
7849
+ textareaRef.current?.focus();
7850
+ }, 500);
7851
+ }
7852
+ }, [show]);
7853
+ const debouncedValidate = useMemo15(
7854
+ () => debounce((value) => {
7855
+ if (isValidPanelData(value)) {
7856
+ setValid();
7857
+ } else {
7858
+ setInvalid();
7859
+ }
7860
+ }, 500),
7861
+ [setValid, setInvalid]
7862
+ );
7863
+ const handleSubmit = () => {
7864
+ if (isInvalid) return;
7865
+ try {
7866
+ const parsed = JSON.parse(textareaRef.current?.value || "");
7867
+ onSubmit(parsed);
7868
+ } catch {
7869
+ setInvalid();
7870
+ }
7871
+ };
7872
+ const onClose = useCallback8(() => {
7873
+ _onClose();
7874
+ setValid();
7875
+ if (textareaRef.current) {
7876
+ textareaRef.current.value = "";
7877
+ }
7878
+ }, [_onClose, setValid]);
7879
+ return /* @__PURE__ */ jsx48(
7880
+ SlideOver,
7881
+ {
7882
+ title: "Import Panel",
7883
+ open: show,
7884
+ onClose,
7885
+ size: "lg",
7886
+ triggerClose: "button",
7887
+ children: /* @__PURE__ */ jsxs38("div", { className: "w-full space-y-6 p-4", children: [
7888
+ /* @__PURE__ */ jsx48(
7889
+ "textarea",
7890
+ {
7891
+ ref: textareaRef,
7892
+ className: classNames15(
7893
+ "text-icontent text-text-foreground h-[60vh] w-full rounded-sm border",
7894
+ isInvalid ? "border-rose-600! ring-rose-600! focus:border-rose-600! focus:[box-shadow:0_0_0_1px_rgb(225_29_72)]!" : ""
7895
+ ),
7896
+ rows: 10,
7897
+ onChange: (evt) => debouncedValidate(evt.target.value),
7898
+ placeholder: panelExample
7899
+ }
7900
+ ),
7901
+ /* @__PURE__ */ jsxs38("div", { className: "flex w-full items-center justify-between", children: [
7902
+ /* @__PURE__ */ jsx48("span", { children: /* @__PURE__ */ jsx48(Button6, { status: "danger", size: "lg", onClick: onClose, children: "Cancel" }) }),
7903
+ /* @__PURE__ */ jsxs38("span", { className: "inline-flex gap-2", children: [
7904
+ /* @__PURE__ */ jsx48(
7905
+ Button6,
7906
+ {
7907
+ size: "lg",
7908
+ onClick: () => {
7909
+ try {
7910
+ const parsed = JSON.parse(textareaRef.current?.value || "");
7911
+ textareaRef.current.value = JSON.stringify(parsed, null, 2);
7912
+ } catch {
7913
+ setInvalid();
7914
+ }
7915
+ },
7916
+ icon: /* @__PURE__ */ jsx48(PiBracketsCurlyBold, {}),
7917
+ children: "Format"
7918
+ }
7919
+ ),
7920
+ /* @__PURE__ */ jsx48(Button6, { role: "primary", size: "lg", onClick: handleSubmit, children: "Submit" })
7921
+ ] })
7922
+ ] })
7923
+ ] })
7924
+ }
7925
+ );
7926
+ };
7927
+
7928
+ // src/dashboard/ExportDashboardDialog.tsx
7929
+ import { BaseDialog as BaseDialog4, Button as Button7, CopyButton as CopyButton4, useDarkMode as useDarkMode2 } from "@sentio/ui-core";
7930
+ import MonacoEditor from "@monaco-editor/react";
7931
+ import { LuDownload } from "react-icons/lu";
7932
+ import { jsx as jsx49, jsxs as jsxs39 } from "react/jsx-runtime";
7933
+ function ExportDashboardDialog({
7934
+ open,
7935
+ onClose,
7936
+ dashboardId,
7937
+ json,
7938
+ onBeforeMount
7939
+ }) {
7940
+ const isDarkMode = useDarkMode2();
7941
+ return /* @__PURE__ */ jsx49(
7942
+ BaseDialog4,
7943
+ {
7944
+ title: "Export dashboard JSON",
7945
+ open,
7946
+ onClose,
7947
+ onCancel: onClose,
7948
+ cancelText: "Close",
7949
+ footerBorder: false,
7950
+ extraButtons: /* @__PURE__ */ jsx49("div", { className: "absolute left-4 inline-flex", children: /* @__PURE__ */ jsx49(
7951
+ "a",
7952
+ {
7953
+ download: dashboardId ? `dashboard-${dashboardId}.json` : "dashboard.json",
7954
+ href: "data:text/json;charset=utf-8," + encodeURIComponent(json),
7955
+ children: /* @__PURE__ */ jsx49(Button7, { role: "text", icon: /* @__PURE__ */ jsx49(LuDownload, {}), children: "Save to a file" })
7956
+ }
7957
+ ) }),
7958
+ children: /* @__PURE__ */ jsx49("form", { className: "relative", children: /* @__PURE__ */ jsxs39("div", { className: "px-[18px] py-4", children: [
7959
+ /* @__PURE__ */ jsx49(
7960
+ "div",
7961
+ {
7962
+ className: "absolute right-10 top-8 z-10",
7963
+ onClick: (evt) => evt.preventDefault(),
7964
+ children: /* @__PURE__ */ jsx49(CopyButton4, { text: json, size: 16 })
7965
+ }
7966
+ ),
7967
+ /* @__PURE__ */ jsx49("div", { className: "focus-within:border-primary-300 h-[324px] overflow-hidden rounded-sm border", children: /* @__PURE__ */ jsx49(
7968
+ MonacoEditor,
7969
+ {
7970
+ value: json,
7971
+ theme: isDarkMode ? "sentio-dark" : "sentio",
7972
+ language: "json",
7973
+ beforeMount: onBeforeMount,
7974
+ options: {
7975
+ readOnly: true,
7976
+ minimap: { enabled: false },
7977
+ lineNumbers: "off"
7978
+ }
7979
+ }
7980
+ ) })
7981
+ ] }) })
7982
+ }
7983
+ );
7984
+ }
7736
7985
  export {
7737
7986
  AggregateInput,
7738
7987
  AreaIcon_default as AreaIcon,
@@ -7750,13 +7999,16 @@ export {
7750
7999
  DataControls,
7751
8000
  EditDashboardDialog,
7752
8001
  EditGroupDialog,
8002
+ ErrorChart,
7753
8003
  EventsFunctionCategories,
7754
8004
  EventsFunctionMap,
8005
+ ExportDashboardDialog,
7755
8006
  FunctionInput,
7756
8007
  FunctionMap,
7757
8008
  FunctionsCategories,
7758
8009
  FunctionsPanel,
7759
8010
  HIGHLIGHT_COLORS,
8011
+ ImportPanelDialog,
7760
8012
  LabelControls,
7761
8013
  LabelSearchProvider,
7762
8014
  LabelsInput,