@trops/dash-core 0.1.444 → 0.1.445

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
@@ -50,8 +50,8 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
50
50
  var jsxRuntime__namespace = /*#__PURE__*/_interopNamespaceDefault(jsxRuntime);
51
51
  var ReactDOM__namespace = /*#__PURE__*/_interopNamespaceDefault(ReactDOM);
52
52
 
53
- function ownKeys$$(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
54
- function _objectSpread$$(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$$(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$$(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
53
+ function ownKeys$Z(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
54
+ function _objectSpread$Z(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$Z(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$Z(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
55
55
  var event = {
56
56
  list: new Map(),
57
57
  // Map(1) { '<widget-UUID>' => { 'CustomSearchbar[10].searchQueryChanged': [] } }
@@ -113,7 +113,7 @@ var event = {
113
113
  uuid: subscriber["uuid"]
114
114
  };
115
115
  if ("action" in subscriber && subscriber.action !== undefined) {
116
- subscriber["action"](_objectSpread$$({}, objectToSend));
116
+ subscriber["action"](_objectSpread$Z({}, objectToSend));
117
117
  }
118
118
  });
119
119
  }
@@ -2891,8 +2891,8 @@ var DashboardWrapper = function DashboardWrapper(_ref) {
2891
2891
  });
2892
2892
  };
2893
2893
 
2894
- function ownKeys$_(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2895
- function _objectSpread$_(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$_(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$_(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2894
+ function ownKeys$Y(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2895
+ function _objectSpread$Y(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$Y(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$Y(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2896
2896
  function ThemeBroadcast(_ref) {
2897
2897
  var ctx = _ref.ctx;
2898
2898
  React.useEffect(function () {
@@ -2925,7 +2925,7 @@ var DashboardThemeProvider = function DashboardThemeProvider(_ref2) {
2925
2925
  var dashboardTheme = themes[themeKey];
2926
2926
  var themeValue = dashboardTheme ? dashboardTheme[themeVariant] || null : null;
2927
2927
  if (!themeValue) return null;
2928
- return _objectSpread$_(_objectSpread$_({}, parentContext), {}, {
2928
+ return _objectSpread$Y(_objectSpread$Y({}, parentContext), {}, {
2929
2929
  currentTheme: themeValue,
2930
2930
  currentThemeKey: themeKey,
2931
2931
  theme: themeValue,
@@ -2952,8 +2952,8 @@ var DashboardThemeProvider = function DashboardThemeProvider(_ref2) {
2952
2952
  });
2953
2953
  };
2954
2954
 
2955
- function ownKeys$Z(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2956
- function _objectSpread$Z(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$Z(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$Z(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2955
+ function ownKeys$X(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2956
+ function _objectSpread$X(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$X(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$X(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2957
2957
  var AppThemeScope = function AppThemeScope(_ref) {
2958
2958
  var children = _ref.children;
2959
2959
  var ctx = React.useContext(DashReact.ThemeContext);
@@ -2961,7 +2961,7 @@ var AppThemeScope = function AppThemeScope(_ref) {
2961
2961
  children: children
2962
2962
  });
2963
2963
  return /*#__PURE__*/jsxRuntime.jsx(DashReact.ThemeContext.Provider, {
2964
- value: _objectSpread$Z(_objectSpread$Z({}, ctx), {}, {
2964
+ value: _objectSpread$X(_objectSpread$X({}, ctx), {}, {
2965
2965
  currentTheme: ctx.appTheme,
2966
2966
  currentThemeKey: ctx.appThemeKey,
2967
2967
  theme: ctx.appTheme,
@@ -3073,8 +3073,8 @@ var LayoutContainer = function LayoutContainer(_ref) {
3073
3073
  });
3074
3074
  };
3075
3075
 
3076
- function ownKeys$Y(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3077
- function _objectSpread$Y(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$Y(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$Y(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3076
+ function ownKeys$W(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3077
+ function _objectSpread$W(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$W(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$W(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3078
3078
  function _createForOfIteratorHelper$x(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$x(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
3079
3079
  function _unsupportedIterableToArray$x(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$x(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$x(r, a) : void 0; } }
3080
3080
  function _arrayLikeToArray$x(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
@@ -3356,7 +3356,7 @@ function createLayoutFromTemplate(template) {
3356
3356
  try {
3357
3357
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
3358
3358
  var cell = _step.value;
3359
- grid[cell.key] = _objectSpread$Y({
3359
+ grid[cell.key] = _objectSpread$W({
3360
3360
  component: null,
3361
3361
  hide: cell.hide || false
3362
3362
  }, cell.span ? {
@@ -4282,11 +4282,261 @@ var RegistryAuthModal = function RegistryAuthModal(_ref) {
4282
4282
  });
4283
4283
  };
4284
4284
 
4285
+ var DashboardInstallOptionsModal = function DashboardInstallOptionsModal(_ref) {
4286
+ var _menuItems$;
4287
+ var isOpen = _ref.isOpen,
4288
+ setIsOpen = _ref.setIsOpen,
4289
+ pkg = _ref.pkg,
4290
+ _ref$menuItems = _ref.menuItems,
4291
+ menuItems = _ref$menuItems === void 0 ? [] : _ref$menuItems,
4292
+ onCreateFolder = _ref.onCreateFolder,
4293
+ onConfirm = _ref.onConfirm;
4294
+ var _useContext = React.useContext(DashReact.ThemeContext),
4295
+ currentTheme = _useContext.currentTheme;
4296
+ var panelStyles = DashReact.getStylesForItem(DashReact.themeObjects.PANEL, currentTheme, {
4297
+ grow: false
4298
+ });
4299
+ var defaultName = (pkg === null || pkg === void 0 ? void 0 : pkg.displayName) || (pkg === null || pkg === void 0 ? void 0 : pkg.name) || "";
4300
+ var _useState = React.useState(defaultName),
4301
+ _useState2 = _slicedToArray(_useState, 2),
4302
+ name = _useState2[0],
4303
+ setName = _useState2[1];
4304
+ var _useState3 = React.useState(((_menuItems$ = menuItems[0]) === null || _menuItems$ === void 0 ? void 0 : _menuItems$.id) != null ? String(menuItems[0].id) : ""),
4305
+ _useState4 = _slicedToArray(_useState3, 2),
4306
+ selectedMenuId = _useState4[0],
4307
+ setSelectedMenuId = _useState4[1];
4308
+ var _useState5 = React.useState(false),
4309
+ _useState6 = _slicedToArray(_useState5, 2),
4310
+ newFolderMode = _useState6[0],
4311
+ setNewFolderMode = _useState6[1];
4312
+ var _useState7 = React.useState(""),
4313
+ _useState8 = _slicedToArray(_useState7, 2),
4314
+ newFolderName = _useState8[0],
4315
+ setNewFolderName = _useState8[1];
4316
+ var _useState9 = React.useState(false),
4317
+ _useState0 = _slicedToArray(_useState9, 2),
4318
+ creating = _useState0[0],
4319
+ setCreating = _useState0[1];
4320
+ var _useState1 = React.useState(null),
4321
+ _useState10 = _slicedToArray(_useState1, 2),
4322
+ error = _useState10[0],
4323
+ setError = _useState10[1];
4324
+
4325
+ // Reset state every time the modal opens with a new package.
4326
+ React.useEffect(function () {
4327
+ var _menuItems$2;
4328
+ if (!isOpen) return;
4329
+ setName(defaultName);
4330
+ setSelectedMenuId(((_menuItems$2 = menuItems[0]) === null || _menuItems$2 === void 0 ? void 0 : _menuItems$2.id) != null ? String(menuItems[0].id) : "");
4331
+ setNewFolderMode(false);
4332
+ setNewFolderName("");
4333
+ setError(null);
4334
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4335
+ }, [isOpen, pkg === null || pkg === void 0 ? void 0 : pkg.name]);
4336
+ var sortedFolders = React.useMemo(function () {
4337
+ return _toConsumableArray(menuItems || []).filter(function (m) {
4338
+ return m && m.id != null;
4339
+ }).sort(function (a, b) {
4340
+ return String(a.name || "").localeCompare(String(b.name || ""));
4341
+ });
4342
+ }, [menuItems]);
4343
+ function handleConfirm() {
4344
+ return _handleConfirm.apply(this, arguments);
4345
+ }
4346
+ function _handleConfirm() {
4347
+ _handleConfirm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
4348
+ var menuId, trimmed, newId, created, _t;
4349
+ return _regeneratorRuntime.wrap(function (_context) {
4350
+ while (1) switch (_context.prev = _context.next) {
4351
+ case 0:
4352
+ setError(null);
4353
+ menuId = selectedMenuId ? selectedMenuId : null;
4354
+ if (!newFolderMode) {
4355
+ _context.next = 7;
4356
+ break;
4357
+ }
4358
+ trimmed = (newFolderName || "").trim();
4359
+ if (trimmed) {
4360
+ _context.next = 1;
4361
+ break;
4362
+ }
4363
+ setError("New folder name is required.");
4364
+ return _context.abrupt("return");
4365
+ case 1:
4366
+ if (!(typeof onCreateFolder !== "function")) {
4367
+ _context.next = 2;
4368
+ break;
4369
+ }
4370
+ setError("Folder creation is unavailable.");
4371
+ return _context.abrupt("return");
4372
+ case 2:
4373
+ _context.prev = 2;
4374
+ setCreating(true);
4375
+ newId = Date.now();
4376
+ _context.next = 3;
4377
+ return onCreateFolder({
4378
+ id: newId,
4379
+ name: trimmed,
4380
+ icon: "folder"
4381
+ });
4382
+ case 3:
4383
+ created = _context.sent;
4384
+ if (!(created !== null && created !== void 0 && created.error || (created === null || created === void 0 ? void 0 : created.success) === false)) {
4385
+ _context.next = 4;
4386
+ break;
4387
+ }
4388
+ setError((created === null || created === void 0 ? void 0 : created.message) || "Could not create folder.");
4389
+ return _context.abrupt("return");
4390
+ case 4:
4391
+ menuId = newId;
4392
+ _context.next = 6;
4393
+ break;
4394
+ case 5:
4395
+ _context.prev = 5;
4396
+ _t = _context["catch"](2);
4397
+ setError((_t === null || _t === void 0 ? void 0 : _t.message) || "Could not create folder.");
4398
+ return _context.abrupt("return");
4399
+ case 6:
4400
+ _context.prev = 6;
4401
+ setCreating(false);
4402
+ return _context.finish(6);
4403
+ case 7:
4404
+ onConfirm({
4405
+ name: (name || "").trim() || defaultName,
4406
+ menuId: menuId
4407
+ });
4408
+ case 8:
4409
+ case "end":
4410
+ return _context.stop();
4411
+ }
4412
+ }, _callee, null, [[2, 5, 6, 7]]);
4413
+ }));
4414
+ return _handleConfirm.apply(this, arguments);
4415
+ }
4416
+ if (!isOpen) return null;
4417
+ return /*#__PURE__*/jsxRuntime.jsx(DashReact.Modal, {
4418
+ isOpen: isOpen,
4419
+ setIsOpen: setIsOpen,
4420
+ width: "w-full max-w-md",
4421
+ height: "h-auto",
4422
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
4423
+ className: "flex flex-col rounded-lg overflow-hidden border ".concat(panelStyles.backgroundColor || "", " ").concat(panelStyles.borderColor || "", " ").concat(panelStyles.textColor || ""),
4424
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
4425
+ className: "flex flex-row items-center justify-between p-4 border-b border-white/10",
4426
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
4427
+ className: "flex items-center gap-3",
4428
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
4429
+ icon: "download",
4430
+ className: "h-4 w-4 opacity-70"
4431
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
4432
+ className: "text-lg font-semibold",
4433
+ children: "Install dashboard"
4434
+ })]
4435
+ }), /*#__PURE__*/jsxRuntime.jsx("button", {
4436
+ type: "button",
4437
+ onClick: function onClick() {
4438
+ return setIsOpen(false);
4439
+ },
4440
+ className: "opacity-50 hover:opacity-100 transition-opacity cursor-pointer",
4441
+ "aria-label": "Close",
4442
+ children: /*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
4443
+ icon: "xmark",
4444
+ className: "h-5 w-5"
4445
+ })
4446
+ })]
4447
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
4448
+ className: "flex flex-col gap-4 p-4",
4449
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
4450
+ className: "flex flex-col gap-1",
4451
+ children: [/*#__PURE__*/jsxRuntime.jsx("label", {
4452
+ className: "text-sm font-medium",
4453
+ children: "Name"
4454
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
4455
+ value: name,
4456
+ onChange: function onChange(v) {
4457
+ return setName(v);
4458
+ },
4459
+ placeholder: defaultName
4460
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
4461
+ className: "text-[10px] opacity-50",
4462
+ children: "The local display name only. Doesn't change the published scope or package id."
4463
+ })]
4464
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
4465
+ className: "flex flex-col gap-1",
4466
+ children: [/*#__PURE__*/jsxRuntime.jsx("label", {
4467
+ className: "text-sm font-medium",
4468
+ children: "Folder"
4469
+ }), !newFolderMode ? /*#__PURE__*/jsxRuntime.jsxs("div", {
4470
+ className: "flex flex-row gap-2 items-center",
4471
+ children: [/*#__PURE__*/jsxRuntime.jsxs("select", {
4472
+ value: selectedMenuId,
4473
+ onChange: function onChange(e) {
4474
+ return setSelectedMenuId(e.target.value);
4475
+ },
4476
+ className: "flex-1 px-3 py-2 bg-gray-900 border border-white/10 rounded text-sm text-gray-200",
4477
+ children: [sortedFolders.length === 0 && /*#__PURE__*/jsxRuntime.jsx("option", {
4478
+ value: "",
4479
+ children: "\u2014 No folders yet \u2014"
4480
+ }), sortedFolders.map(function (m) {
4481
+ return /*#__PURE__*/jsxRuntime.jsx("option", {
4482
+ value: String(m.id),
4483
+ children: m.name
4484
+ }, m.id);
4485
+ })]
4486
+ }), /*#__PURE__*/jsxRuntime.jsx("button", {
4487
+ type: "button",
4488
+ onClick: function onClick() {
4489
+ return setNewFolderMode(true);
4490
+ },
4491
+ className: "px-3 py-2 text-xs bg-indigo-600 hover:bg-indigo-500 text-white rounded transition-colors",
4492
+ children: "+ New"
4493
+ })]
4494
+ }) : /*#__PURE__*/jsxRuntime.jsxs("div", {
4495
+ className: "flex flex-row gap-2 items-center",
4496
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
4497
+ value: newFolderName,
4498
+ onChange: function onChange(v) {
4499
+ return setNewFolderName(v);
4500
+ },
4501
+ placeholder: "New folder name",
4502
+ autoFocus: true
4503
+ }), /*#__PURE__*/jsxRuntime.jsx("button", {
4504
+ type: "button",
4505
+ onClick: function onClick() {
4506
+ setNewFolderMode(false);
4507
+ setNewFolderName("");
4508
+ setError(null);
4509
+ },
4510
+ className: "px-3 py-2 text-xs bg-gray-700 hover:bg-gray-600 text-gray-100 rounded transition-colors",
4511
+ children: "Cancel"
4512
+ })]
4513
+ })]
4514
+ }), error && /*#__PURE__*/jsxRuntime.jsx("div", {
4515
+ className: "text-xs text-red-300 bg-red-900/30 border border-red-700/40 rounded px-3 py-2",
4516
+ children: error
4517
+ })]
4518
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
4519
+ className: "flex flex-row justify-end gap-2 p-4 border-t border-white/10",
4520
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Button3, {
4521
+ title: "Cancel",
4522
+ onClick: function onClick() {
4523
+ return setIsOpen(false);
4524
+ }
4525
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button2, {
4526
+ title: creating ? "Creating folder…" : "Install",
4527
+ onClick: handleConfirm,
4528
+ disabled: creating || !name.trim()
4529
+ })]
4530
+ })]
4531
+ })
4532
+ });
4533
+ };
4534
+
4285
4535
  function _createForOfIteratorHelper$w(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$w(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
4286
4536
  function _unsupportedIterableToArray$w(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$w(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$w(r, a) : void 0; } }
4287
4537
  function _arrayLikeToArray$w(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
4288
- function ownKeys$X(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4289
- function _objectSpread$X(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$X(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$X(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4538
+ function ownKeys$V(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4539
+ function _objectSpread$V(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$V(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$V(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4290
4540
  var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
4291
4541
  var dashboardPackage = _ref.dashboardPackage,
4292
4542
  appId = _ref.appId,
@@ -4326,6 +4576,18 @@ var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
4326
4576
  setProgressComplete = _useState12[1];
4327
4577
  var progressResultRef = React.useRef(null);
4328
4578
  var cleanupProgressRef = React.useRef(null);
4579
+
4580
+ // Pre-install options modal: choose folder + rename. Lets the user
4581
+ // override the publisher's menuId (which would otherwise collide
4582
+ // with their local folder ids) and pick a friendlier display name.
4583
+ var _useState13 = React.useState(false),
4584
+ _useState14 = _slicedToArray(_useState13, 2),
4585
+ showOptionsModal = _useState14[0],
4586
+ setShowOptionsModal = _useState14[1];
4587
+ var _useState15 = React.useState([]),
4588
+ _useState16 = _slicedToArray(_useState15, 2),
4589
+ menuItems = _useState16[0],
4590
+ setMenuItems = _useState16[1];
4329
4591
  var pkg = dashboardPackage;
4330
4592
  if (!pkg) return null;
4331
4593
 
@@ -4356,12 +4618,16 @@ var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
4356
4618
  cancelled = true;
4357
4619
  };
4358
4620
  }, [pkg.name]);
4359
- function handleInstall() {
4360
- return _handleInstall.apply(this, arguments);
4361
- } // eslint-disable-next-line react-hooks/rules-of-hooks
4362
- function _handleInstall() {
4363
- _handleInstall = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
4364
- var deps, items, _window$mainApi2, _window$mainApi2$onIn, result, _result$workspace2, _t;
4621
+
4622
+ // Click handler on the "Install" button: load the user's existing
4623
+ // folders + open the options modal. The actual install fires from
4624
+ // the modal's onConfirm so we have the user's name/menuId choice.
4625
+ function handleInstallClick() {
4626
+ return _handleInstallClick.apply(this, arguments);
4627
+ }
4628
+ function _handleInstallClick() {
4629
+ _handleInstallClick = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
4630
+ var _window$mainApi2, _window$mainApi2$list, result, list;
4365
4631
  return _regeneratorRuntime.wrap(function (_context) {
4366
4632
  while (1) switch (_context.prev = _context.next) {
4367
4633
  case 0:
@@ -4370,6 +4636,107 @@ var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
4370
4636
  break;
4371
4637
  }
4372
4638
  return _context.abrupt("return");
4639
+ case 1:
4640
+ setInstallResult(null);
4641
+ _context.prev = 2;
4642
+ _context.next = 3;
4643
+ return (_window$mainApi2 = window.mainApi) === null || _window$mainApi2 === void 0 || (_window$mainApi2 = _window$mainApi2.menuItems) === null || _window$mainApi2 === void 0 || (_window$mainApi2$list = _window$mainApi2.listMenuItems) === null || _window$mainApi2$list === void 0 ? void 0 : _window$mainApi2$list.call(_window$mainApi2, appId);
4644
+ case 3:
4645
+ result = _context.sent;
4646
+ list = ((result === null || result === void 0 ? void 0 : result.menuItems) || []).filter(function (m) {
4647
+ return m && m.id != null;
4648
+ });
4649
+ setMenuItems(list);
4650
+ _context.next = 5;
4651
+ break;
4652
+ case 4:
4653
+ _context.prev = 4;
4654
+ _context["catch"](2);
4655
+ setMenuItems([]);
4656
+ case 5:
4657
+ setShowOptionsModal(true);
4658
+ case 6:
4659
+ case "end":
4660
+ return _context.stop();
4661
+ }
4662
+ }, _callee, null, [[2, 4]]);
4663
+ }));
4664
+ return _handleInstallClick.apply(this, arguments);
4665
+ }
4666
+ function handleCreateFolder(_x) {
4667
+ return _handleCreateFolder.apply(this, arguments);
4668
+ }
4669
+ function _handleCreateFolder() {
4670
+ _handleCreateFolder = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(menuItem) {
4671
+ var _window$mainApi3, _window$mainApi3$save;
4672
+ return _regeneratorRuntime.wrap(function (_context2) {
4673
+ while (1) switch (_context2.prev = _context2.next) {
4674
+ case 0:
4675
+ if (appId) {
4676
+ _context2.next = 1;
4677
+ break;
4678
+ }
4679
+ return _context2.abrupt("return", {
4680
+ success: false,
4681
+ message: "No appId"
4682
+ });
4683
+ case 1:
4684
+ return _context2.abrupt("return", (_window$mainApi3 = window.mainApi) === null || _window$mainApi3 === void 0 || (_window$mainApi3 = _window$mainApi3.menuItems) === null || _window$mainApi3 === void 0 || (_window$mainApi3$save = _window$mainApi3.saveMenuItem) === null || _window$mainApi3$save === void 0 ? void 0 : _window$mainApi3$save.call(_window$mainApi3, appId, menuItem));
4685
+ case 2:
4686
+ case "end":
4687
+ return _context2.stop();
4688
+ }
4689
+ }, _callee2);
4690
+ }));
4691
+ return _handleCreateFolder.apply(this, arguments);
4692
+ }
4693
+ function handleOptionsConfirm(_x2) {
4694
+ return _handleOptionsConfirm.apply(this, arguments);
4695
+ }
4696
+ function _handleOptionsConfirm() {
4697
+ _handleOptionsConfirm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref2) {
4698
+ var name, menuId;
4699
+ return _regeneratorRuntime.wrap(function (_context3) {
4700
+ while (1) switch (_context3.prev = _context3.next) {
4701
+ case 0:
4702
+ name = _ref2.name, menuId = _ref2.menuId;
4703
+ setShowOptionsModal(false);
4704
+ _context3.next = 1;
4705
+ return runInstall({
4706
+ name: name,
4707
+ menuId: menuId
4708
+ });
4709
+ case 1:
4710
+ case "end":
4711
+ return _context3.stop();
4712
+ }
4713
+ }, _callee3);
4714
+ }));
4715
+ return _handleOptionsConfirm.apply(this, arguments);
4716
+ }
4717
+ function runInstall() {
4718
+ return _runInstall.apply(this, arguments);
4719
+ } // eslint-disable-next-line react-hooks/rules-of-hooks
4720
+ function _runInstall() {
4721
+ _runInstall = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
4722
+ var installOptions,
4723
+ deps,
4724
+ items,
4725
+ _window$mainApi4,
4726
+ _window$mainApi4$onIn,
4727
+ result,
4728
+ _result$workspace2,
4729
+ _args4 = arguments,
4730
+ _t2;
4731
+ return _regeneratorRuntime.wrap(function (_context4) {
4732
+ while (1) switch (_context4.prev = _context4.next) {
4733
+ case 0:
4734
+ installOptions = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
4735
+ if (!(!appId || !pkg.name)) {
4736
+ _context4.next = 1;
4737
+ break;
4738
+ }
4739
+ return _context4.abrupt("return");
4373
4740
  case 1:
4374
4741
  setIsInstalling(true);
4375
4742
  setInstallResult(null);
@@ -4398,11 +4765,11 @@ var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
4398
4765
 
4399
4766
  // Register progress listener
4400
4767
  if (cleanupProgressRef.current) cleanupProgressRef.current();
4401
- cleanupProgressRef.current = (_window$mainApi2 = window.mainApi) === null || _window$mainApi2 === void 0 || (_window$mainApi2 = _window$mainApi2.dashboardConfig) === null || _window$mainApi2 === void 0 || (_window$mainApi2$onIn = _window$mainApi2.onInstallProgress) === null || _window$mainApi2$onIn === void 0 ? void 0 : _window$mainApi2$onIn.call(_window$mainApi2, function (data) {
4768
+ cleanupProgressRef.current = (_window$mainApi4 = window.mainApi) === null || _window$mainApi4 === void 0 || (_window$mainApi4 = _window$mainApi4.dashboardConfig) === null || _window$mainApi4 === void 0 || (_window$mainApi4$onIn = _window$mainApi4.onInstallProgress) === null || _window$mainApi4$onIn === void 0 ? void 0 : _window$mainApi4$onIn.call(_window$mainApi4, function (data) {
4402
4769
  setProgressWidgets(function (prev) {
4403
4770
  var next = _toConsumableArray(prev);
4404
4771
  if (data.index >= 0 && data.index < next.length) {
4405
- next[data.index] = _objectSpread$X(_objectSpread$X({}, next[data.index]), {}, {
4772
+ next[data.index] = _objectSpread$V(_objectSpread$V({}, next[data.index]), {}, {
4406
4773
  status: data.status,
4407
4774
  error: data.error || null
4408
4775
  });
@@ -4411,13 +4778,13 @@ var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
4411
4778
  });
4412
4779
  });
4413
4780
  }
4414
- _context.prev = 2;
4415
- _context.next = 3;
4416
- return window.mainApi.dashboardConfig.installDashboardFromRegistry(appId, pkg.name);
4781
+ _context4.prev = 2;
4782
+ _context4.next = 3;
4783
+ return window.mainApi.dashboardConfig.installDashboardFromRegistry(appId, pkg.name, installOptions);
4417
4784
  case 3:
4418
- result = _context.sent;
4785
+ result = _context4.sent;
4419
4786
  if (!(result !== null && result !== void 0 && result.authRequired)) {
4420
- _context.next = 4;
4787
+ _context4.next = 4;
4421
4788
  break;
4422
4789
  }
4423
4790
  // Auth needed — close progress modal, show inline auth prompt
@@ -4431,7 +4798,7 @@ var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
4431
4798
  cleanupProgressRef.current();
4432
4799
  cleanupProgressRef.current = null;
4433
4800
  }
4434
- return _context.abrupt("return");
4801
+ return _context4.abrupt("return");
4435
4802
  case 4:
4436
4803
  // Store result for use when modal closes
4437
4804
  progressResultRef.current = result;
@@ -4447,33 +4814,33 @@ var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
4447
4814
  onInstallComplete(result);
4448
4815
  }
4449
4816
  }
4450
- _context.next = 6;
4817
+ _context4.next = 6;
4451
4818
  break;
4452
4819
  case 5:
4453
- _context.prev = 5;
4454
- _t = _context["catch"](2);
4820
+ _context4.prev = 5;
4821
+ _t2 = _context4["catch"](2);
4455
4822
  setProgressComplete(true);
4456
4823
  if (items.length === 0) {
4457
4824
  setInstallResult({
4458
4825
  status: "error",
4459
- message: _t.message || "Failed to install dashboard."
4826
+ message: _t2.message || "Failed to install dashboard."
4460
4827
  });
4461
4828
  }
4462
4829
  case 6:
4463
- _context.prev = 6;
4830
+ _context4.prev = 6;
4464
4831
  setIsInstalling(false);
4465
4832
  if (cleanupProgressRef.current) {
4466
4833
  cleanupProgressRef.current();
4467
4834
  cleanupProgressRef.current = null;
4468
4835
  }
4469
- return _context.finish(6);
4836
+ return _context4.finish(6);
4470
4837
  case 7:
4471
4838
  case "end":
4472
- return _context.stop();
4839
+ return _context4.stop();
4473
4840
  }
4474
- }, _callee, null, [[2, 5, 6, 7]]);
4841
+ }, _callee4, null, [[2, 5, 6, 7]]);
4475
4842
  }));
4476
- return _handleInstall.apply(this, arguments);
4843
+ return _runInstall.apply(this, arguments);
4477
4844
  }
4478
4845
  var handleProgressDone = React.useCallback(function () {
4479
4846
  setShowProgressModal(false);
@@ -4498,7 +4865,7 @@ var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
4498
4865
  var raw = preview === null || preview === void 0 ? void 0 : preview.compatibility;
4499
4866
  if (!raw) return raw;
4500
4867
  var cMap = ComponentManager.componentMap();
4501
- var augWidgets = _objectSpread$X({}, raw.widgets);
4868
+ var augWidgets = _objectSpread$V({}, raw.widgets);
4502
4869
  var fixedCount = 0;
4503
4870
  var _loop = function _loop() {
4504
4871
  var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
@@ -4741,9 +5108,16 @@ var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
4741
5108
  hoverBackgroundColor: isInstalling ? "" : "hover:bg-blue-700",
4742
5109
  textSize: "text-sm",
4743
5110
  padding: "py-1.5 px-4",
4744
- onClick: handleInstall,
5111
+ onClick: handleInstallClick,
4745
5112
  disabled: isInstalling
4746
5113
  })
5114
+ }), /*#__PURE__*/jsxRuntime.jsx(DashboardInstallOptionsModal, {
5115
+ isOpen: showOptionsModal,
5116
+ setIsOpen: setShowOptionsModal,
5117
+ pkg: pkg,
5118
+ menuItems: menuItems,
5119
+ onCreateFolder: handleCreateFolder,
5120
+ onConfirm: handleOptionsConfirm
4747
5121
  }), /*#__PURE__*/jsxRuntime.jsx(InstallProgressModal, {
4748
5122
  isOpen: showProgressModal,
4749
5123
  setIsOpen: setShowProgressModal,
@@ -4757,7 +5131,10 @@ var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
4757
5131
  },
4758
5132
  onAuthenticated: function onAuthenticated() {
4759
5133
  setInstallResult(null);
4760
- handleInstall();
5134
+ // Re-open the options modal so the user can confirm again
5135
+ // post-auth (cheaper than caching their first selection
5136
+ // through the auth round-trip).
5137
+ handleInstallClick();
4761
5138
  },
4762
5139
  onCancel: function onCancel() {
4763
5140
  return setInstallResult(null);
@@ -5081,8 +5458,6 @@ var DiscoverDashboardsDetail = function DiscoverDashboardsDetail(_ref) {
5081
5458
  });
5082
5459
  };
5083
5460
 
5084
- function ownKeys$W(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5085
- function _objectSpread$W(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$W(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$W(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5086
5461
  var LayoutManagerModal = function LayoutManagerModal(_ref) {
5087
5462
  var open = _ref.open,
5088
5463
  setIsOpen = _ref.setIsOpen,
@@ -5130,31 +5505,25 @@ var LayoutManagerModal = function LayoutManagerModal(_ref) {
5130
5505
  localMenuItems = _useState12[0],
5131
5506
  setLocalMenuItems = _useState12[1];
5132
5507
 
5133
- // Post-install workspace for registry stepper customization
5508
+ // Pre-import file selection (file preview, not yet saved)
5134
5509
  var _useState13 = React.useState(null),
5135
5510
  _useState14 = _slicedToArray(_useState13, 2),
5136
- importedWorkspace = _useState14[0],
5137
- setImportedWorkspace = _useState14[1];
5138
-
5139
- // Pre-import file selection (file preview, not yet saved)
5140
- var _useState15 = React.useState(null),
5141
- _useState16 = _slicedToArray(_useState15, 2),
5142
- selectedFile = _useState16[0],
5143
- setSelectedFile = _useState16[1];
5511
+ selectedFile = _useState14[0],
5512
+ setSelectedFile = _useState14[1];
5144
5513
 
5145
5514
  // Inline new-folder form state
5146
- var _useState17 = React.useState(false),
5515
+ var _useState15 = React.useState(false),
5516
+ _useState16 = _slicedToArray(_useState15, 2),
5517
+ isCreatingFolder = _useState16[0],
5518
+ setIsCreatingFolder = _useState16[1];
5519
+ var _useState17 = React.useState(""),
5147
5520
  _useState18 = _slicedToArray(_useState17, 2),
5148
- isCreatingFolder = _useState18[0],
5149
- setIsCreatingFolder = _useState18[1];
5150
- var _useState19 = React.useState(""),
5521
+ newFolderName = _useState18[0],
5522
+ setNewFolderName = _useState18[1];
5523
+ var _useState19 = React.useState(null),
5151
5524
  _useState20 = _slicedToArray(_useState19, 2),
5152
- newFolderName = _useState20[0],
5153
- setNewFolderName = _useState20[1];
5154
- var _useState21 = React.useState(null),
5155
- _useState22 = _slicedToArray(_useState21, 2),
5156
- newFolderIcon = _useState22[0],
5157
- setNewFolderIcon = _useState22[1];
5525
+ newFolderIcon = _useState20[0],
5526
+ setNewFolderIcon = _useState20[1];
5158
5527
 
5159
5528
  // Reset state when modal opens
5160
5529
  React.useEffect(function () {
@@ -5174,7 +5543,6 @@ var LayoutManagerModal = function LayoutManagerModal(_ref) {
5174
5543
  return (a.name || "").localeCompare(b.name || "");
5175
5544
  })[0]) === null || _Object$entries$sort$ === void 0 ? void 0 : _Object$entries$sort$[0]) || null : null;
5176
5545
  setSelectedThemeKey(appThemeKey || fallback);
5177
- setImportedWorkspace(null);
5178
5546
  setSelectedFile(null);
5179
5547
  setIsCreatingFolder(false);
5180
5548
  setNewFolderName("");
@@ -5261,22 +5629,34 @@ var LayoutManagerModal = function LayoutManagerModal(_ref) {
5261
5629
  return _handleImportFromFile.apply(this, arguments);
5262
5630
  }
5263
5631
  function handleRegistryInstallComplete(result) {
5264
- var _result$workspace, _result$workspace2, _result$workspace3;
5265
- setImportedWorkspace(result.workspace);
5266
- setDashboardName(((_result$workspace = result.workspace) === null || _result$workspace === void 0 ? void 0 : _result$workspace.name) || "");
5267
- setSelectedMenuId(((_result$workspace2 = result.workspace) === null || _result$workspace2 === void 0 ? void 0 : _result$workspace2.menuId) || (menuItems.length > 0 ? menuItems[0].id : 1));
5268
- setSelectedThemeKey(((_result$workspace3 = result.workspace) === null || _result$workspace3 === void 0 ? void 0 : _result$workspace3.themeKey) || null);
5269
- setActiveStep(0);
5270
- }
5271
- function handleImportRegistryConfirm() {
5272
- return _handleImportRegistryConfirm.apply(this, arguments);
5273
- }
5274
- function _handleImportRegistryConfirm() {
5275
- _handleImportRegistryConfirm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
5276
- var menuId, newItem, result, updatedWorkspace;
5632
+ // The pre-install DashboardInstallOptionsModal already collected
5633
+ // the user's name + folder choice and the install IPC applied
5634
+ // them, so the workspace on disk is final. Skip the legacy
5635
+ // post-install Name/Organize/Theme stepper (it would just ask
5636
+ // for the same fields again) close out and open the new
5637
+ // dashboard.
5638
+ if (onReloadWorkspaces) onReloadWorkspaces();
5639
+ loadThemes();
5640
+ if (onOpenWorkspace && result !== null && result !== void 0 && result.workspace) {
5641
+ onOpenWorkspace(result.workspace);
5642
+ }
5643
+ handleClose();
5644
+ }
5645
+ function handleImportConfirm() {
5646
+ return _handleImportConfirm.apply(this, arguments);
5647
+ }
5648
+ function _handleImportConfirm() {
5649
+ _handleImportConfirm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
5650
+ var menuId, newItem, result;
5277
5651
  return _regeneratorRuntime.wrap(function (_context2) {
5278
5652
  while (1) switch (_context2.prev = _context2.next) {
5279
5653
  case 0:
5654
+ if (selectedFile) {
5655
+ _context2.next = 1;
5656
+ break;
5657
+ }
5658
+ return _context2.abrupt("return");
5659
+ case 1:
5280
5660
  menuId = selectedMenuId;
5281
5661
  if (isCreatingFolder && newFolderName.trim() && newFolderIcon) {
5282
5662
  newItem = {
@@ -5289,21 +5669,15 @@ var LayoutManagerModal = function LayoutManagerModal(_ref) {
5289
5669
  onSaveMenuItem(newItem);
5290
5670
  }
5291
5671
  }
5292
-
5293
- // Import flow: file not yet saved, call importDashboardConfig with overrides
5294
- if (!(creationMethod === "import" && selectedFile)) {
5295
- _context2.next = 5;
5296
- break;
5297
- }
5298
- _context2.prev = 1;
5299
- _context2.next = 2;
5672
+ _context2.prev = 2;
5673
+ _context2.next = 3;
5300
5674
  return window.mainApi.dashboardConfig.importDashboardConfig(appId, {
5301
5675
  filePath: selectedFile.filePath,
5302
5676
  name: dashboardName.trim(),
5303
5677
  menuId: menuId,
5304
5678
  themeKey: selectedThemeKey
5305
5679
  });
5306
- case 2:
5680
+ case 3:
5307
5681
  result = _context2.sent;
5308
5682
  if (result && result.success) {
5309
5683
  onReloadWorkspaces && onReloadWorkspaces();
@@ -5313,47 +5687,18 @@ var LayoutManagerModal = function LayoutManagerModal(_ref) {
5313
5687
  }
5314
5688
  handleClose();
5315
5689
  }
5316
- _context2.next = 4;
5690
+ _context2.next = 5;
5317
5691
  break;
5318
- case 3:
5319
- _context2.prev = 3;
5320
- _context2["catch"](1);
5321
5692
  case 4:
5322
- return _context2.abrupt("return");
5693
+ _context2.prev = 4;
5694
+ _context2["catch"](2);
5323
5695
  case 5:
5324
- if (importedWorkspace) {
5325
- _context2.next = 6;
5326
- break;
5327
- }
5328
- return _context2.abrupt("return");
5329
- case 6:
5330
- updatedWorkspace = _objectSpread$W(_objectSpread$W({}, importedWorkspace), {}, {
5331
- name: dashboardName.trim(),
5332
- menuId: menuId,
5333
- themeKey: selectedThemeKey
5334
- });
5335
- _context2.prev = 7;
5336
- _context2.next = 8;
5337
- return window.mainApi.workspace.saveWorkspaceForApplication(appId, updatedWorkspace);
5338
- case 8:
5339
- onReloadWorkspaces && onReloadWorkspaces();
5340
- loadThemes();
5341
- if (onOpenWorkspace) {
5342
- onOpenWorkspace(updatedWorkspace);
5343
- }
5344
- handleClose();
5345
- _context2.next = 10;
5346
- break;
5347
- case 9:
5348
- _context2.prev = 9;
5349
- _context2["catch"](7);
5350
- case 10:
5351
5696
  case "end":
5352
5697
  return _context2.stop();
5353
5698
  }
5354
- }, _callee2, null, [[1, 3], [7, 9]]);
5699
+ }, _callee2, null, [[2, 4]]);
5355
5700
  }));
5356
- return _handleImportRegistryConfirm.apply(this, arguments);
5701
+ return _handleImportConfirm.apply(this, arguments);
5357
5702
  }
5358
5703
  var selectedFolder = localMenuItems.find(function (item) {
5359
5704
  return item.id === selectedMenuId;
@@ -5641,8 +5986,10 @@ var LayoutManagerModal = function LayoutManagerModal(_ref) {
5641
5986
  });
5642
5987
  }
5643
5988
 
5644
- // Registry browser: show until install completes
5645
- if (creationMethod === "registry" && !importedWorkspace) {
5989
+ // Registry browser: install completes inside DiscoverDashboardsDetail
5990
+ // (via the DashboardInstallOptionsModal) and the onInstallComplete
5991
+ // handler closes this modal directly — no post-install stepper.
5992
+ if (creationMethod === "registry") {
5646
5993
  return /*#__PURE__*/jsxRuntime.jsx(DashReact.Panel, {
5647
5994
  backgroundColor: "bg-slate-800",
5648
5995
  padding: false,
@@ -5695,37 +6042,6 @@ var LayoutManagerModal = function LayoutManagerModal(_ref) {
5695
6042
  });
5696
6043
  }
5697
6044
 
5698
- // Registry stepper: 3 steps (Name, Folder, Theme)
5699
- if (creationMethod === "registry" && importedWorkspace) {
5700
- return /*#__PURE__*/jsxRuntime.jsx(DashReact.Panel, {
5701
- backgroundColor: "bg-slate-800",
5702
- padding: false,
5703
- children: /*#__PURE__*/jsxRuntime.jsx(DashReact.Panel.Body, {
5704
- scrollable: false,
5705
- className: "h-full",
5706
- children: /*#__PURE__*/jsxRuntime.jsxs(DashReact.Stepper, {
5707
- activeStep: activeStep,
5708
- onStepChange: setActiveStep,
5709
- showNavigation: false,
5710
- className: "h-full p-6 pb-0",
5711
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Stepper.Step, {
5712
- label: "Name",
5713
- description: "Name your dashboard",
5714
- children: renderNameStep()
5715
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Stepper.Step, {
5716
- label: "Organize",
5717
- description: "Choose a folder",
5718
- children: renderFolderStep()
5719
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Stepper.Step, {
5720
- label: "Choose Theme",
5721
- description: "Dashboard theme",
5722
- children: renderThemeStep()
5723
- })]
5724
- })
5725
- })
5726
- });
5727
- }
5728
-
5729
6045
  // creationMethod === "template" — existing 4-step wizard
5730
6046
  return /*#__PURE__*/jsxRuntime.jsx(DashReact.Panel, {
5731
6047
  backgroundColor: "bg-slate-800",
@@ -5786,7 +6102,7 @@ var LayoutManagerModal = function LayoutManagerModal(_ref) {
5786
6102
  }
5787
6103
 
5788
6104
  // Registry browser: Cancel only (DiscoverDashboardsDetail has its own inline back button)
5789
- if (creationMethod === "registry" && !importedWorkspace) {
6105
+ if (creationMethod === "registry") {
5790
6106
  return /*#__PURE__*/jsxRuntime.jsx(DashReact.Modal.Footer, {
5791
6107
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
5792
6108
  className: "flex flex-row space-x-2",
@@ -5894,86 +6210,7 @@ var LayoutManagerModal = function LayoutManagerModal(_ref) {
5894
6210
  hoverTextColor: "hover:text-gray-100",
5895
6211
  hoverBackgroundColor: "hover:bg-gray-600"
5896
6212
  }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
5897
- onClick: handleImportRegistryConfirm,
5898
- title: "Save",
5899
- textSize: "text-base xl:text-lg",
5900
- padding: "py-2 px-4",
5901
- backgroundColor: "bg-blue-600",
5902
- textColor: "text-white",
5903
- hoverTextColor: "hover:text-white",
5904
- hoverBackgroundColor: "hover:bg-blue-500"
5905
- })]
5906
- })]
5907
- })
5908
- });
5909
- }
5910
-
5911
- // Registry stepper footer: 3 steps (Name, Organize, Theme)
5912
- if (creationMethod === "registry" && importedWorkspace) {
5913
- return /*#__PURE__*/jsxRuntime.jsx(DashReact.Modal.Footer, {
5914
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
5915
- className: "flex flex-row space-x-2",
5916
- children: [activeStep === 0 && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
5917
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
5918
- onClick: handleClose,
5919
- title: "Cancel",
5920
- textSize: "text-base xl:text-lg",
5921
- padding: "py-2 px-4",
5922
- backgroundColor: "bg-gray-700",
5923
- textColor: "text-gray-300",
5924
- hoverTextColor: "hover:text-gray-100",
5925
- hoverBackgroundColor: "hover:bg-gray-600"
5926
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
5927
- onClick: function onClick() {
5928
- return setActiveStep(1);
5929
- },
5930
- title: "Next",
5931
- textSize: "text-base xl:text-lg",
5932
- padding: "py-2 px-4",
5933
- backgroundColor: "bg-blue-600",
5934
- textColor: "text-white",
5935
- hoverTextColor: "hover:text-white",
5936
- hoverBackgroundColor: "hover:bg-blue-500",
5937
- disabled: !dashboardName.trim()
5938
- })]
5939
- }), activeStep === 1 && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
5940
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
5941
- onClick: function onClick() {
5942
- return setActiveStep(0);
5943
- },
5944
- title: "Back",
5945
- textSize: "text-base xl:text-lg",
5946
- padding: "py-2 px-4",
5947
- backgroundColor: "bg-gray-700",
5948
- textColor: "text-gray-300",
5949
- hoverTextColor: "hover:text-gray-100",
5950
- hoverBackgroundColor: "hover:bg-gray-600"
5951
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
5952
- onClick: function onClick() {
5953
- return setActiveStep(2);
5954
- },
5955
- title: "Next",
5956
- textSize: "text-base xl:text-lg",
5957
- padding: "py-2 px-4",
5958
- backgroundColor: "bg-blue-600",
5959
- textColor: "text-white",
5960
- hoverTextColor: "hover:text-white",
5961
- hoverBackgroundColor: "hover:bg-blue-500"
5962
- })]
5963
- }), activeStep === 2 && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
5964
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
5965
- onClick: function onClick() {
5966
- return setActiveStep(1);
5967
- },
5968
- title: "Back",
5969
- textSize: "text-base xl:text-lg",
5970
- padding: "py-2 px-4",
5971
- backgroundColor: "bg-gray-700",
5972
- textColor: "text-gray-300",
5973
- hoverTextColor: "hover:text-gray-100",
5974
- hoverBackgroundColor: "hover:bg-gray-600"
5975
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
5976
- onClick: handleImportRegistryConfirm,
6213
+ onClick: handleImportConfirm,
5977
6214
  title: "Save",
5978
6215
  textSize: "text-base xl:text-lg",
5979
6216
  padding: "py-2 px-4",
@@ -7085,8 +7322,6 @@ function applyFilters(items, filters, mode) {
7085
7322
  function _createForOfIteratorHelper$u(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$u(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
7086
7323
  function _unsupportedIterableToArray$u(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$u(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$u(r, a) : void 0; } }
7087
7324
  function _arrayLikeToArray$u(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
7088
- function ownKeys$V(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7089
- function _objectSpread$V(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$V(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$V(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7090
7325
  var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
7091
7326
  var _state$selectedDashbo, _state$selectedDashbo2;
7092
7327
  var state = _ref.state,
@@ -7206,7 +7441,7 @@ var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
7206
7441
 
7207
7442
  // --- Create logic (DASH-191: moved above useEffect so ref captures actual function) ---
7208
7443
  var handleCreate = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
7209
- var _state$customization, name, menuId, theme, result, _window$mainApi, installResult, updatedWorkspace, _window$mainApi2, _window$mainApi3, template, installedList, installedNames, _iterator, _step, widget, scopedId, resolvedUrl, layoutObj, widgetOrder, cells, widgetItems, nextId, _loop, i, fullLayout, workspace, _t, _t2, _t3;
7444
+ var _state$customization, name, menuId, theme, result, _window$mainApi, installResult, _window$mainApi2, _window$mainApi3, template, installedList, installedNames, _iterator, _step, widget, scopedId, resolvedUrl, layoutObj, widgetOrder, cells, widgetItems, nextId, _loop, i, fullLayout, workspace, _t, _t2, _t3;
7210
7445
  return _regeneratorRuntime.wrap(function (_context2) {
7211
7446
  while (1) switch (_context2.prev = _context2.next) {
7212
7447
  case 0:
@@ -7216,7 +7451,7 @@ var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
7216
7451
  _context2.prev = 1;
7217
7452
  _state$customization = state.customization, name = _state$customization.name, menuId = _state$customization.menuId, theme = _state$customization.theme;
7218
7453
  if (!(isPrebuilt && state.selectedDashboard)) {
7219
- _context2.next = 9;
7454
+ _context2.next = 8;
7220
7455
  break;
7221
7456
  }
7222
7457
  if (!onInstallDashboard) {
@@ -7233,15 +7468,19 @@ var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
7233
7468
  });
7234
7469
  case 2:
7235
7470
  result = _context2.sent;
7236
- _context2.next = 8;
7471
+ _context2.next = 7;
7237
7472
  break;
7238
7473
  case 3:
7239
7474
  if (!((_window$mainApi = window.mainApi) !== null && _window$mainApi !== void 0 && (_window$mainApi = _window$mainApi.dashboardConfig) !== null && _window$mainApi !== void 0 && _window$mainApi.installDashboardFromRegistry)) {
7240
- _context2.next = 8;
7475
+ _context2.next = 7;
7241
7476
  break;
7242
7477
  }
7243
7478
  _context2.next = 4;
7244
- return window.mainApi.dashboardConfig.installDashboardFromRegistry(appId, state.selectedDashboard.name || state.selectedDashboard.key);
7479
+ return window.mainApi.dashboardConfig.installDashboardFromRegistry(appId, state.selectedDashboard.name || state.selectedDashboard.key, {
7480
+ name: name.trim(),
7481
+ menuId: menuId || 1,
7482
+ themeKey: theme
7483
+ });
7245
7484
  case 4:
7246
7485
  installResult = _context2.sent;
7247
7486
  if (!(installResult !== null && installResult !== void 0 && installResult.authRequired)) {
@@ -7253,103 +7492,95 @@ var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
7253
7492
  return _context2.abrupt("return");
7254
7493
  case 5:
7255
7494
  if (!(installResult !== null && installResult !== void 0 && installResult.workspace)) {
7256
- _context2.next = 7;
7495
+ _context2.next = 6;
7257
7496
  break;
7258
7497
  }
7259
- updatedWorkspace = _objectSpread$V(_objectSpread$V({}, installResult.workspace), {}, {
7260
- name: name.trim(),
7261
- menuId: menuId || 1,
7262
- themeKey: theme
7263
- });
7264
- _context2.next = 6;
7265
- return window.mainApi.workspace.saveWorkspaceForApplication(appId, updatedWorkspace);
7266
- case 6:
7267
7498
  result = {
7268
7499
  success: true,
7269
- workspace: updatedWorkspace
7500
+ workspace: installResult.workspace
7270
7501
  };
7271
- _context2.next = 8;
7502
+ _context2.next = 7;
7272
7503
  break;
7273
- case 7:
7504
+ case 6:
7274
7505
  if (!(installResult !== null && installResult !== void 0 && installResult.error)) {
7275
- _context2.next = 8;
7506
+ _context2.next = 7;
7276
7507
  break;
7277
7508
  }
7278
7509
  throw new Error(installResult.error);
7279
- case 8:
7280
- _context2.next = 27;
7510
+ case 7:
7511
+ _context2.next = 26;
7281
7512
  break;
7282
- case 9:
7513
+ case 8:
7283
7514
  // Build-your-own path: create layout from template + place widgets
7284
7515
  template = layoutTemplates.find(function (t) {
7285
7516
  return t.id === state.layout.templateKey;
7286
7517
  });
7287
7518
  if (template) {
7288
- _context2.next = 10;
7519
+ _context2.next = 9;
7289
7520
  break;
7290
7521
  }
7291
7522
  throw new Error("No layout template selected.");
7292
- case 10:
7523
+ case 9:
7293
7524
  if (!((_window$mainApi2 = window.mainApi) !== null && _window$mainApi2 !== void 0 && _window$mainApi2.widgets)) {
7294
- _context2.next = 20;
7525
+ _context2.next = 19;
7295
7526
  break;
7296
7527
  }
7297
- _context2.next = 11;
7528
+ _context2.next = 10;
7298
7529
  return window.mainApi.widgets.list();
7299
- case 11:
7530
+ case 10:
7300
7531
  _t = _context2.sent;
7301
7532
  if (_t) {
7302
- _context2.next = 12;
7533
+ _context2.next = 11;
7303
7534
  break;
7304
7535
  }
7305
7536
  _t = [];
7306
- case 12:
7537
+ case 11:
7307
7538
  installedList = _t;
7308
7539
  installedNames = new Set(installedList.map(function (w) {
7309
7540
  return w.name;
7310
7541
  }));
7311
7542
  _iterator = _createForOfIteratorHelper$u(state.selectedWidgets);
7312
- _context2.prev = 13;
7543
+ _context2.prev = 12;
7313
7544
  _iterator.s();
7314
- case 14:
7545
+ case 13:
7315
7546
  if ((_step = _iterator.n()).done) {
7316
- _context2.next = 17;
7547
+ _context2.next = 16;
7317
7548
  break;
7318
7549
  }
7319
7550
  widget = _step.value;
7320
7551
  if (widget.isRegistry) {
7321
- _context2.next = 15;
7552
+ _context2.next = 14;
7322
7553
  break;
7323
7554
  }
7324
- return _context2.abrupt("continue", 16);
7325
- case 15:
7555
+ return _context2.abrupt("continue", 15);
7556
+ case 14:
7326
7557
  scopedId = widget.packageScope ? "@".concat(widget.packageScope.replace(/^@/, ""), "/").concat(widget.packageName) : widget.packageName;
7327
7558
  if (!(!installedNames.has(scopedId) && !installedNames.has(widget.packageName))) {
7328
- _context2.next = 16;
7559
+ _context2.next = 15;
7329
7560
  break;
7330
7561
  }
7331
7562
  resolvedUrl = (widget.downloadUrl || "").replace(/\{version\}/g, widget.packageVersion || "").replace(/\{name\}/g, widget.packageName || "");
7332
7563
  if (!resolvedUrl) {
7333
- _context2.next = 16;
7564
+ _context2.next = 15;
7334
7565
  break;
7335
7566
  }
7336
- _context2.next = 16;
7567
+ _context2.next = 15;
7337
7568
  return window.mainApi.widgets.install(scopedId, resolvedUrl);
7569
+ case 15:
7570
+ _context2.next = 13;
7571
+ break;
7338
7572
  case 16:
7339
- _context2.next = 14;
7573
+ _context2.next = 18;
7340
7574
  break;
7341
7575
  case 17:
7342
- _context2.next = 19;
7343
- break;
7576
+ _context2.prev = 17;
7577
+ _t2 = _context2["catch"](12);
7578
+ _iterator.e(_t2);
7344
7579
  case 18:
7345
7580
  _context2.prev = 18;
7346
- _t2 = _context2["catch"](13);
7347
- _iterator.e(_t2);
7348
- case 19:
7349
- _context2.prev = 19;
7350
7581
  _iterator.f();
7351
- return _context2.finish(19);
7352
- case 20:
7582
+ return _context2.finish(18);
7583
+ case 19:
7353
7584
  layoutObj = createLayoutFromTemplate(template, menuId || 1); // Place widgets into grid cells as proper layout items
7354
7585
  widgetOrder = state.layout.widgetOrder || [];
7355
7586
  cells = template.cells.filter(function (c) {
@@ -7386,31 +7617,31 @@ var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
7386
7617
  }, _loop);
7387
7618
  });
7388
7619
  i = 0;
7389
- case 21:
7620
+ case 20:
7390
7621
  if (!(i < widgetOrder.length && i < cells.length)) {
7391
- _context2.next = 23;
7622
+ _context2.next = 22;
7392
7623
  break;
7393
7624
  }
7394
- return _context2.delegateYield(_loop(i), "t0", 22);
7395
- case 22:
7625
+ return _context2.delegateYield(_loop(i), "t0", 21);
7626
+ case 21:
7396
7627
  i++;
7397
- _context2.next = 21;
7628
+ _context2.next = 20;
7398
7629
  break;
7399
- case 23:
7630
+ case 22:
7400
7631
  fullLayout = [layoutObj].concat(widgetItems);
7401
7632
  if (!onCreateWorkspace) {
7402
- _context2.next = 25;
7633
+ _context2.next = 24;
7403
7634
  break;
7404
7635
  }
7405
- _context2.next = 24;
7636
+ _context2.next = 23;
7406
7637
  return onCreateWorkspace(fullLayout, theme, name.trim());
7407
- case 24:
7638
+ case 23:
7408
7639
  result = _context2.sent;
7409
- _context2.next = 27;
7640
+ _context2.next = 26;
7410
7641
  break;
7411
- case 25:
7642
+ case 24:
7412
7643
  if (!((_window$mainApi3 = window.mainApi) !== null && _window$mainApi3 !== void 0 && (_window$mainApi3 = _window$mainApi3.workspace) !== null && _window$mainApi3 !== void 0 && _window$mainApi3.saveWorkspaceForApplication)) {
7413
- _context2.next = 27;
7644
+ _context2.next = 26;
7414
7645
  break;
7415
7646
  }
7416
7647
  workspace = {
@@ -7419,43 +7650,48 @@ var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
7419
7650
  themeKey: theme,
7420
7651
  layout: fullLayout
7421
7652
  };
7422
- _context2.next = 26;
7653
+ _context2.next = 25;
7423
7654
  return window.mainApi.workspace.saveWorkspaceForApplication(appId, workspace);
7424
- case 26:
7655
+ case 25:
7425
7656
  result = {
7426
7657
  success: true,
7427
7658
  workspace: workspace
7428
7659
  };
7429
- case 27:
7660
+ case 26:
7430
7661
  if (result) {
7431
7662
  setCreatedDashboard(result.workspace || result);
7432
7663
  }
7433
- _context2.next = 29;
7664
+ _context2.next = 28;
7434
7665
  break;
7435
- case 28:
7436
- _context2.prev = 28;
7666
+ case 27:
7667
+ _context2.prev = 27;
7437
7668
  _t3 = _context2["catch"](1);
7438
7669
  setError(_t3.message || "Failed to create dashboard.");
7439
- case 29:
7440
- _context2.prev = 29;
7670
+ case 28:
7671
+ _context2.prev = 28;
7441
7672
  setCreating(false);
7442
- return _context2.finish(29);
7443
- case 30:
7673
+ return _context2.finish(28);
7674
+ case 29:
7444
7675
  case "end":
7445
7676
  return _context2.stop();
7446
7677
  }
7447
- }, _callee, null, [[1, 28, 29, 30], [13, 18, 19, 20]]);
7678
+ }, _callee, null, [[1, 27, 28, 29], [12, 17, 18, 19]]);
7448
7679
  })), [state, isPrebuilt, onInstallDashboard, onCreateWorkspace, appId]);
7449
7680
 
7450
- // Expose handleCreate and creating state to parent via ref (DASH-183)
7681
+ // Expose handleCreate, creating, and createdDashboard state to parent
7682
+ // via ref (DASH-183). The parent uses `createdDashboard` to swap the
7683
+ // footer "Create Dashboard" button out once the success state is
7684
+ // rendered — otherwise the user could accidentally re-fire the
7685
+ // install.
7451
7686
  React.useEffect(function () {
7452
7687
  if (createHandlerRef) {
7453
7688
  createHandlerRef.current = {
7454
7689
  handleCreate: handleCreate,
7455
- creating: creating
7690
+ creating: creating,
7691
+ createdDashboard: createdDashboard
7456
7692
  };
7457
7693
  }
7458
- }, [createHandlerRef, handleCreate, creating]);
7694
+ }, [createHandlerRef, handleCreate, creating, createdDashboard]);
7459
7695
  var handleNameChange = React.useCallback(function (val) {
7460
7696
  dispatch({
7461
7697
  type: "SET_CUSTOMIZATION",
@@ -8220,7 +8456,7 @@ var STEP_LABELS = [{
8220
8456
  * Resets wizard state cleanly on close.
8221
8457
  */
8222
8458
  var DashboardWizardModal = function DashboardWizardModal(_ref) {
8223
- var _createHandlerRef$cur, _createHandlerRef$cur2;
8459
+ var _createHandlerRef$cur, _createHandlerRef$cur2, _createHandlerRef$cur3;
8224
8460
  var open = _ref.open,
8225
8461
  setIsOpen = _ref.setIsOpen,
8226
8462
  _ref$menuItems = _ref.menuItems,
@@ -8267,6 +8503,7 @@ var DashboardWizardModal = function DashboardWizardModal(_ref) {
8267
8503
  }, [canProceed, nextStep]);
8268
8504
  var isLastStep = state.step === 1;
8269
8505
  var isCreating = (_createHandlerRef$cur = (_createHandlerRef$cur2 = createHandlerRef.current) === null || _createHandlerRef$cur2 === void 0 ? void 0 : _createHandlerRef$cur2.creating) !== null && _createHandlerRef$cur !== void 0 ? _createHandlerRef$cur : false;
8506
+ var isCreated = !!((_createHandlerRef$cur3 = createHandlerRef.current) !== null && _createHandlerRef$cur3 !== void 0 && _createHandlerRef$cur3.createdDashboard);
8270
8507
  var canCreate = canProceed && !isCreating;
8271
8508
  return /*#__PURE__*/jsxRuntime.jsx(DashReact.Modal, {
8272
8509
  isOpen: open,
@@ -8336,7 +8573,7 @@ var DashboardWizardModal = function DashboardWizardModal(_ref) {
8336
8573
  })
8337
8574
  })
8338
8575
  })]
8339
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
8576
+ }), !isCreated && /*#__PURE__*/jsxRuntime.jsxs("div", {
8340
8577
  className: "flex flex-row justify-between items-center pt-4 mt-4 border-t border-gray-700/50",
8341
8578
  children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
8342
8579
  onClick: state.step === 0 ? handleClose : prevStep,
@@ -8352,8 +8589,8 @@ var DashboardWizardModal = function DashboardWizardModal(_ref) {
8352
8589
  children: ["Step ", state.step + 1, " of ", STEP_LABELS.length]
8353
8590
  }), isLastStep ? /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
8354
8591
  onClick: function onClick() {
8355
- var _createHandlerRef$cur3, _createHandlerRef$cur4;
8356
- return (_createHandlerRef$cur3 = createHandlerRef.current) === null || _createHandlerRef$cur3 === void 0 || (_createHandlerRef$cur4 = _createHandlerRef$cur3.handleCreate) === null || _createHandlerRef$cur4 === void 0 ? void 0 : _createHandlerRef$cur4.call(_createHandlerRef$cur3);
8592
+ var _createHandlerRef$cur4, _createHandlerRef$cur5;
8593
+ return (_createHandlerRef$cur4 = createHandlerRef.current) === null || _createHandlerRef$cur4 === void 0 || (_createHandlerRef$cur5 = _createHandlerRef$cur4.handleCreate) === null || _createHandlerRef$cur5 === void 0 ? void 0 : _createHandlerRef$cur5.call(_createHandlerRef$cur4);
8357
8594
  },
8358
8595
  title: isCreating ? "Creating..." : "Create Dashboard",
8359
8596
  textSize: "text-sm",