@trops/dash-core 0.1.124 → 0.1.125

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.esm.js CHANGED
@@ -32981,15 +32981,11 @@ var DashboardsSection = function DashboardsSection(_ref) {
32981
32981
  _useState10 = _slicedToArray(_useState1, 2),
32982
32982
  viewMode = _useState10[0],
32983
32983
  setViewMode = _useState10[1];
32984
- // null | "marketplace" | "import-result"
32984
+ // null | "marketplace"
32985
32985
  var _useState11 = useState(null),
32986
32986
  _useState12 = _slicedToArray(_useState11, 2),
32987
32987
  installMode = _useState12[0],
32988
32988
  setInstallMode = _useState12[1];
32989
- var _useState13 = useState(null),
32990
- _useState14 = _slicedToArray(_useState13, 2),
32991
- importResult = _useState14[0],
32992
- setImportResult = _useState14[1];
32993
32989
  var appId = credentials === null || credentials === void 0 ? void 0 : credentials.appId;
32994
32990
  var _useContext = useContext(ThemeContext),
32995
32991
  currentTheme = _useContext.currentTheme;
@@ -33076,7 +33072,6 @@ var DashboardsSection = function DashboardsSection(_ref) {
33076
33072
  if (createRequested && !prevCreateRequested.current) {
33077
33073
  setSelectedId(null);
33078
33074
  setInstallMode("marketplace");
33079
- setImportResult(null);
33080
33075
  }
33081
33076
  prevCreateRequested.current = createRequested;
33082
33077
  if (createRequested && onCreateAcknowledged) {
@@ -33084,69 +33079,6 @@ var DashboardsSection = function DashboardsSection(_ref) {
33084
33079
  }
33085
33080
  // eslint-disable-next-line react-hooks/exhaustive-deps
33086
33081
  }, [createRequested]);
33087
- function handleImport() {
33088
- return _handleImport.apply(this, arguments);
33089
- }
33090
- function _handleImport() {
33091
- _handleImport = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
33092
- var result, _result$workspace, _t;
33093
- return _regeneratorRuntime.wrap(function (_context) {
33094
- while (1) switch (_context.prev = _context.next) {
33095
- case 0:
33096
- if (appId) {
33097
- _context.next = 1;
33098
- break;
33099
- }
33100
- return _context.abrupt("return");
33101
- case 1:
33102
- setInstallMode("import-result");
33103
- setImportResult({
33104
- status: "loading",
33105
- message: "Importing dashboard..."
33106
- });
33107
- _context.prev = 2;
33108
- _context.next = 3;
33109
- return window.mainApi.dashboardConfig.importDashboardConfig(appId);
33110
- case 3:
33111
- result = _context.sent;
33112
- if (!(!result || result.canceled)) {
33113
- _context.next = 4;
33114
- break;
33115
- }
33116
- // User cancelled the file picker
33117
- setInstallMode(null);
33118
- setImportResult(null);
33119
- return _context.abrupt("return");
33120
- case 4:
33121
- if (result.success) {
33122
- setImportResult({
33123
- status: "success",
33124
- message: "Dashboard \"".concat(((_result$workspace = result.workspace) === null || _result$workspace === void 0 ? void 0 : _result$workspace.name) || "Untitled", "\" imported successfully.")
33125
- });
33126
- onReloadWorkspaces && onReloadWorkspaces();
33127
- } else {
33128
- setImportResult({
33129
- status: "error",
33130
- message: result.error || "Import failed."
33131
- });
33132
- }
33133
- _context.next = 6;
33134
- break;
33135
- case 5:
33136
- _context.prev = 5;
33137
- _t = _context["catch"](2);
33138
- setImportResult({
33139
- status: "error",
33140
- message: _t.message || "Failed to import dashboard."
33141
- });
33142
- case 6:
33143
- case "end":
33144
- return _context.stop();
33145
- }
33146
- }, _callee, null, [[2, 5]]);
33147
- }));
33148
- return _handleImport.apply(this, arguments);
33149
- }
33150
33082
  var selectedWorkspace = workspaces.find(function (ws) {
33151
33083
  return ws.id === selectedId;
33152
33084
  });
@@ -33162,7 +33094,6 @@ var DashboardsSection = function DashboardsSection(_ref) {
33162
33094
  onClick: function onClick() {
33163
33095
  setSelectedId(ws.id);
33164
33096
  setInstallMode(null);
33165
- setImportResult(null);
33166
33097
  },
33167
33098
  badge: String(widgetCount),
33168
33099
  className: isSelected ? "bg-white/10 opacity-100" : "",
@@ -33198,9 +33129,9 @@ var DashboardsSection = function DashboardsSection(_ref) {
33198
33129
  className: "flex flex-col h-full",
33199
33130
  children: [/*#__PURE__*/jsxs("div", {
33200
33131
  className: "flex-shrink-0 flex flex-col gap-2 px-3 py-2 ".concat(headerStyles.backgroundColor || ""),
33201
- children: [/*#__PURE__*/jsxs("div", {
33132
+ children: [/*#__PURE__*/jsx("div", {
33202
33133
  className: "flex items-center gap-2",
33203
- children: [/*#__PURE__*/jsx("div", {
33134
+ children: /*#__PURE__*/jsx("div", {
33204
33135
  className: "flex-1",
33205
33136
  children: /*#__PURE__*/jsx(SearchInput, {
33206
33137
  value: searchQuery,
@@ -33208,12 +33139,7 @@ var DashboardsSection = function DashboardsSection(_ref) {
33208
33139
  placeholder: "Search dashboards...",
33209
33140
  inputClassName: "py-1.5 text-xs"
33210
33141
  })
33211
- }), /*#__PURE__*/jsx(ButtonIcon, {
33212
- icon: "file-import",
33213
- onClick: handleImport,
33214
- size: "sm",
33215
- title: "Import dashboard"
33216
- })]
33142
+ })
33217
33143
  }), /*#__PURE__*/jsx("div", {
33218
33144
  className: "flex bg-white/5 rounded-md p-0.5",
33219
33145
  children: [{
@@ -33235,7 +33161,6 @@ var DashboardsSection = function DashboardsSection(_ref) {
33235
33161
  setSelectedId(null);
33236
33162
  } else {
33237
33163
  setInstallMode(null);
33238
- setImportResult(null);
33239
33164
  setViewMode(tab.key);
33240
33165
  }
33241
33166
  },
@@ -33263,37 +33188,6 @@ var DashboardsSection = function DashboardsSection(_ref) {
33263
33188
  },
33264
33189
  appId: appId
33265
33190
  });
33266
- } else if (installMode === "import-result") {
33267
- detailContent = /*#__PURE__*/jsxs("div", {
33268
- className: "flex flex-col flex-1 min-h-0 p-6 space-y-4",
33269
- children: [(importResult === null || importResult === void 0 ? void 0 : importResult.status) === "loading" && /*#__PURE__*/jsxs("div", {
33270
- className: "flex items-center gap-3",
33271
- children: [/*#__PURE__*/jsx("div", {
33272
- className: "animate-spin rounded-full h-5 w-5 border-b-2 border-blue-500"
33273
- }), /*#__PURE__*/jsx("span", {
33274
- className: "text-sm opacity-70",
33275
- children: importResult.message
33276
- })]
33277
- }), (importResult === null || importResult === void 0 ? void 0 : importResult.status) === "success" && /*#__PURE__*/jsxs("div", {
33278
- className: "flex items-center gap-2",
33279
- children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
33280
- icon: "circle-check",
33281
- className: "h-4 w-4 text-green-400"
33282
- }), /*#__PURE__*/jsx("span", {
33283
- className: "text-sm",
33284
- children: importResult.message
33285
- })]
33286
- }), (importResult === null || importResult === void 0 ? void 0 : importResult.status) === "error" && /*#__PURE__*/jsxs("div", {
33287
- className: "flex items-center gap-2",
33288
- children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
33289
- icon: "circle-xmark",
33290
- className: "h-4 w-4 text-red-400"
33291
- }), /*#__PURE__*/jsx("span", {
33292
- className: "text-sm text-red-400",
33293
- children: importResult.message
33294
- })]
33295
- })]
33296
- });
33297
33191
  } else if (selectedWorkspace) {
33298
33192
  detailContent = /*#__PURE__*/jsx(DashboardDetail, {
33299
33193
  workspace: selectedWorkspace,