@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.js CHANGED
@@ -32999,15 +32999,11 @@ var DashboardsSection = function DashboardsSection(_ref) {
32999
32999
  _useState10 = _slicedToArray(_useState1, 2),
33000
33000
  viewMode = _useState10[0],
33001
33001
  setViewMode = _useState10[1];
33002
- // null | "marketplace" | "import-result"
33002
+ // null | "marketplace"
33003
33003
  var _useState11 = React.useState(null),
33004
33004
  _useState12 = _slicedToArray(_useState11, 2),
33005
33005
  installMode = _useState12[0],
33006
33006
  setInstallMode = _useState12[1];
33007
- var _useState13 = React.useState(null),
33008
- _useState14 = _slicedToArray(_useState13, 2),
33009
- importResult = _useState14[0],
33010
- setImportResult = _useState14[1];
33011
33007
  var appId = credentials === null || credentials === void 0 ? void 0 : credentials.appId;
33012
33008
  var _useContext = React.useContext(DashReact.ThemeContext),
33013
33009
  currentTheme = _useContext.currentTheme;
@@ -33094,7 +33090,6 @@ var DashboardsSection = function DashboardsSection(_ref) {
33094
33090
  if (createRequested && !prevCreateRequested.current) {
33095
33091
  setSelectedId(null);
33096
33092
  setInstallMode("marketplace");
33097
- setImportResult(null);
33098
33093
  }
33099
33094
  prevCreateRequested.current = createRequested;
33100
33095
  if (createRequested && onCreateAcknowledged) {
@@ -33102,69 +33097,6 @@ var DashboardsSection = function DashboardsSection(_ref) {
33102
33097
  }
33103
33098
  // eslint-disable-next-line react-hooks/exhaustive-deps
33104
33099
  }, [createRequested]);
33105
- function handleImport() {
33106
- return _handleImport.apply(this, arguments);
33107
- }
33108
- function _handleImport() {
33109
- _handleImport = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
33110
- var result, _result$workspace, _t;
33111
- return _regeneratorRuntime.wrap(function (_context) {
33112
- while (1) switch (_context.prev = _context.next) {
33113
- case 0:
33114
- if (appId) {
33115
- _context.next = 1;
33116
- break;
33117
- }
33118
- return _context.abrupt("return");
33119
- case 1:
33120
- setInstallMode("import-result");
33121
- setImportResult({
33122
- status: "loading",
33123
- message: "Importing dashboard..."
33124
- });
33125
- _context.prev = 2;
33126
- _context.next = 3;
33127
- return window.mainApi.dashboardConfig.importDashboardConfig(appId);
33128
- case 3:
33129
- result = _context.sent;
33130
- if (!(!result || result.canceled)) {
33131
- _context.next = 4;
33132
- break;
33133
- }
33134
- // User cancelled the file picker
33135
- setInstallMode(null);
33136
- setImportResult(null);
33137
- return _context.abrupt("return");
33138
- case 4:
33139
- if (result.success) {
33140
- setImportResult({
33141
- status: "success",
33142
- message: "Dashboard \"".concat(((_result$workspace = result.workspace) === null || _result$workspace === void 0 ? void 0 : _result$workspace.name) || "Untitled", "\" imported successfully.")
33143
- });
33144
- onReloadWorkspaces && onReloadWorkspaces();
33145
- } else {
33146
- setImportResult({
33147
- status: "error",
33148
- message: result.error || "Import failed."
33149
- });
33150
- }
33151
- _context.next = 6;
33152
- break;
33153
- case 5:
33154
- _context.prev = 5;
33155
- _t = _context["catch"](2);
33156
- setImportResult({
33157
- status: "error",
33158
- message: _t.message || "Failed to import dashboard."
33159
- });
33160
- case 6:
33161
- case "end":
33162
- return _context.stop();
33163
- }
33164
- }, _callee, null, [[2, 5]]);
33165
- }));
33166
- return _handleImport.apply(this, arguments);
33167
- }
33168
33100
  var selectedWorkspace = workspaces.find(function (ws) {
33169
33101
  return ws.id === selectedId;
33170
33102
  });
@@ -33180,7 +33112,6 @@ var DashboardsSection = function DashboardsSection(_ref) {
33180
33112
  onClick: function onClick() {
33181
33113
  setSelectedId(ws.id);
33182
33114
  setInstallMode(null);
33183
- setImportResult(null);
33184
33115
  },
33185
33116
  badge: String(widgetCount),
33186
33117
  className: isSelected ? "bg-white/10 opacity-100" : "",
@@ -33216,9 +33147,9 @@ var DashboardsSection = function DashboardsSection(_ref) {
33216
33147
  className: "flex flex-col h-full",
33217
33148
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
33218
33149
  className: "flex-shrink-0 flex flex-col gap-2 px-3 py-2 ".concat(headerStyles.backgroundColor || ""),
33219
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
33150
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
33220
33151
  className: "flex items-center gap-2",
33221
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
33152
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
33222
33153
  className: "flex-1",
33223
33154
  children: /*#__PURE__*/jsxRuntime.jsx(DashReact.SearchInput, {
33224
33155
  value: searchQuery,
@@ -33226,12 +33157,7 @@ var DashboardsSection = function DashboardsSection(_ref) {
33226
33157
  placeholder: "Search dashboards...",
33227
33158
  inputClassName: "py-1.5 text-xs"
33228
33159
  })
33229
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.ButtonIcon, {
33230
- icon: "file-import",
33231
- onClick: handleImport,
33232
- size: "sm",
33233
- title: "Import dashboard"
33234
- })]
33160
+ })
33235
33161
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
33236
33162
  className: "flex bg-white/5 rounded-md p-0.5",
33237
33163
  children: [{
@@ -33253,7 +33179,6 @@ var DashboardsSection = function DashboardsSection(_ref) {
33253
33179
  setSelectedId(null);
33254
33180
  } else {
33255
33181
  setInstallMode(null);
33256
- setImportResult(null);
33257
33182
  setViewMode(tab.key);
33258
33183
  }
33259
33184
  },
@@ -33281,37 +33206,6 @@ var DashboardsSection = function DashboardsSection(_ref) {
33281
33206
  },
33282
33207
  appId: appId
33283
33208
  });
33284
- } else if (installMode === "import-result") {
33285
- detailContent = /*#__PURE__*/jsxRuntime.jsxs("div", {
33286
- className: "flex flex-col flex-1 min-h-0 p-6 space-y-4",
33287
- children: [(importResult === null || importResult === void 0 ? void 0 : importResult.status) === "loading" && /*#__PURE__*/jsxRuntime.jsxs("div", {
33288
- className: "flex items-center gap-3",
33289
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
33290
- className: "animate-spin rounded-full h-5 w-5 border-b-2 border-blue-500"
33291
- }), /*#__PURE__*/jsxRuntime.jsx("span", {
33292
- className: "text-sm opacity-70",
33293
- children: importResult.message
33294
- })]
33295
- }), (importResult === null || importResult === void 0 ? void 0 : importResult.status) === "success" && /*#__PURE__*/jsxRuntime.jsxs("div", {
33296
- className: "flex items-center gap-2",
33297
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
33298
- icon: "circle-check",
33299
- className: "h-4 w-4 text-green-400"
33300
- }), /*#__PURE__*/jsxRuntime.jsx("span", {
33301
- className: "text-sm",
33302
- children: importResult.message
33303
- })]
33304
- }), (importResult === null || importResult === void 0 ? void 0 : importResult.status) === "error" && /*#__PURE__*/jsxRuntime.jsxs("div", {
33305
- className: "flex items-center gap-2",
33306
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
33307
- icon: "circle-xmark",
33308
- className: "h-4 w-4 text-red-400"
33309
- }), /*#__PURE__*/jsxRuntime.jsx("span", {
33310
- className: "text-sm text-red-400",
33311
- children: importResult.message
33312
- })]
33313
- })]
33314
- });
33315
33209
  } else if (selectedWorkspace) {
33316
33210
  detailContent = /*#__PURE__*/jsxRuntime.jsx(DashboardDetail, {
33317
33211
  workspace: selectedWorkspace,