@trops/dash-core 0.1.93 → 0.1.96
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/electron/index.js +196 -163
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +1553 -254
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1552 -253
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import * as DashReact from '@trops/dash-react';
|
|
3
|
-
import { isObject, ThemeContext, deepCopy, MainSection, getUUID, getStylesForItem, themeObjects, Heading, SubHeading3, InputText, Button, FontAwesomeIcon, Tag, SearchInput, ButtonIcon, Modal, Panel, Stepper, Paragraph, Heading3, MenuItem3, FormLabel, SelectMenu, CodeEditorInline, Sidebar, SettingsModal, SubHeading2, tailwindHeightFractions, Menu3, Panel3, DropdownPanel, MenuItem2, ButtonIcon2, DragComponent, ConfirmationModal, DropComponent, getStyleName, capitalizeFirstLetter, colorTypes, getCSSStyleForClassname, Panel2, Heading2, SubHeading, Paragraph2, Paragraph3, Button2, Button3, MenuItem, Tag2, Tag3, ButtonIcon3, DashPanel, colorNames, shades, themeVariants, Tabs3, DataList, Checkbox, Switch, StatCard, Card, Tabs, Accordion, Alert, Toast, ProgressBar, Toggle, Breadcrumbs, Card2, Tabs2, Accordion2, Alert2, Toast2, ProgressBar2, Toggle2, Breadcrumbs2, Card3, Accordion3, Alert3, Toast3, ProgressBar3, Toggle3, Breadcrumbs3, SelectInput, Icon2, AlgoliaSearchBox, CommandPalette, EmptyState, Navbar, withRouter, Menu as Menu$1 } from '@trops/dash-react';
|
|
3
|
+
import { isObject, ThemeContext, deepCopy, MainSection, getUUID, getStylesForItem, themeObjects, Heading, SubHeading3, InputText, Button, FontAwesomeIcon, Tag, SearchInput, ButtonIcon, Modal, Panel, Stepper, Paragraph, Heading3, MenuItem3, FormLabel, SelectMenu, CodeEditorInline, Sidebar, SettingsModal, SubHeading2, tailwindHeightFractions, Menu3, Panel3, DropdownPanel, MenuItem2, ButtonIcon2, DragComponent, ConfirmationModal, DropComponent, getStyleName, capitalizeFirstLetter, colorTypes, getCSSStyleForClassname, Panel2, Heading2, SubHeading, Paragraph2, Paragraph3, Button2, Button3, MenuItem, Tag2, Tag3, ButtonIcon3, DashPanel, colorNames, shades, themeVariants, Tabs3, DataList, Checkbox, Switch, StatCard, Card, Tabs, Accordion, Alert, Toast, ProgressBar, Toggle, Breadcrumbs, Card2, Tabs2, Accordion2, Alert2, Toast2, ProgressBar2, Toggle2, Breadcrumbs2, Card3, Accordion3, Alert3, Toast3, ProgressBar3, Toggle3, Breadcrumbs3, TextArea, SelectInput, Icon2, AlgoliaSearchBox, CommandPalette, EmptyState, Navbar, withRouter, Menu as Menu$1 } from '@trops/dash-react';
|
|
4
4
|
export * from '@trops/dash-react';
|
|
5
5
|
export { ThemeContext } from '@trops/dash-react';
|
|
6
6
|
import _typeof from '@babel/runtime/helpers/typeof';
|
|
@@ -3061,7 +3061,7 @@ var LayoutManagerPicker = function LayoutManagerPicker(_ref2) {
|
|
|
3061
3061
|
});
|
|
3062
3062
|
};
|
|
3063
3063
|
|
|
3064
|
-
var FOLDER_ICONS = [
|
|
3064
|
+
var FOLDER_ICONS$1 = [
|
|
3065
3065
|
// General / UI
|
|
3066
3066
|
"home", "folder", "star", "heart", "bookmark", "tag", "flag", "bell", "circle", "square", "circle-check", "thumbs-up", "clone", "signal",
|
|
3067
3067
|
// Communication
|
|
@@ -3084,7 +3084,7 @@ var FOLDER_ICONS = [
|
|
|
3084
3084
|
"file", "file-code", "clipboard", "book", "pen", "pencil",
|
|
3085
3085
|
// Misc
|
|
3086
3086
|
"magnifying-glass", "eye", "lock", "key", "shield", "clock", "calendar", "link"];
|
|
3087
|
-
var ALL_ICON_NAMES = Object.keys(DashReact).filter(function (key) {
|
|
3087
|
+
var ALL_ICON_NAMES$1 = Object.keys(DashReact).filter(function (key) {
|
|
3088
3088
|
return key.startsWith("fa") && key !== "fas";
|
|
3089
3089
|
}).map(function (key) {
|
|
3090
3090
|
var _DashReact$key;
|
|
@@ -3092,8 +3092,8 @@ var ALL_ICON_NAMES = Object.keys(DashReact).filter(function (key) {
|
|
|
3092
3092
|
}).filter(Boolean).filter(function (name, index, arr) {
|
|
3093
3093
|
return arr.indexOf(name) === index;
|
|
3094
3094
|
}).sort();
|
|
3095
|
-
var CURATED_SET = new Set(FOLDER_ICONS);
|
|
3096
|
-
var IconPicker = function IconPicker(_ref) {
|
|
3095
|
+
var CURATED_SET$1 = new Set(FOLDER_ICONS$1);
|
|
3096
|
+
var IconPicker$1 = function IconPicker(_ref) {
|
|
3097
3097
|
var selectedIcon = _ref.selectedIcon,
|
|
3098
3098
|
onSelectIcon = _ref.onSelectIcon;
|
|
3099
3099
|
var _useState = useState(""),
|
|
@@ -3102,13 +3102,13 @@ var IconPicker = function IconPicker(_ref) {
|
|
|
3102
3102
|
setSearch = _useState2[1];
|
|
3103
3103
|
var query = search.trim().toLowerCase();
|
|
3104
3104
|
var filteredCurated = useMemo(function () {
|
|
3105
|
-
return query ? FOLDER_ICONS.filter(function (name) {
|
|
3105
|
+
return query ? FOLDER_ICONS$1.filter(function (name) {
|
|
3106
3106
|
return name.includes(query);
|
|
3107
|
-
}) : FOLDER_ICONS;
|
|
3107
|
+
}) : FOLDER_ICONS$1;
|
|
3108
3108
|
}, [query]);
|
|
3109
3109
|
var remainingIcons = useMemo(function () {
|
|
3110
|
-
var all = ALL_ICON_NAMES.filter(function (name) {
|
|
3111
|
-
return !CURATED_SET.has(name);
|
|
3110
|
+
var all = ALL_ICON_NAMES$1.filter(function (name) {
|
|
3111
|
+
return !CURATED_SET$1.has(name);
|
|
3112
3112
|
});
|
|
3113
3113
|
return query ? all.filter(function (name) {
|
|
3114
3114
|
return name.includes(query);
|
|
@@ -3209,7 +3209,7 @@ var FolderDetail = function FolderDetail(_ref2) {
|
|
|
3209
3209
|
children: [/*#__PURE__*/jsx("span", {
|
|
3210
3210
|
className: "flex-shrink-0 text-sm font-medium opacity-70",
|
|
3211
3211
|
children: "Icon"
|
|
3212
|
-
}), /*#__PURE__*/jsx(IconPicker, {
|
|
3212
|
+
}), /*#__PURE__*/jsx(IconPicker$1, {
|
|
3213
3213
|
selectedIcon: formIcon,
|
|
3214
3214
|
onSelectIcon: setFormIcon
|
|
3215
3215
|
})]
|
|
@@ -3500,7 +3500,7 @@ var LayoutManagerModal = function LayoutManagerModal(_ref) {
|
|
|
3500
3500
|
placeholder: "Folder name"
|
|
3501
3501
|
}), /*#__PURE__*/jsx("div", {
|
|
3502
3502
|
className: "grid grid-cols-10 gap-2",
|
|
3503
|
-
children: FOLDER_ICONS.map(function (icon) {
|
|
3503
|
+
children: FOLDER_ICONS$1.map(function (icon) {
|
|
3504
3504
|
var isIconSelected = icon === newFolderIcon;
|
|
3505
3505
|
return /*#__PURE__*/jsx("div", {
|
|
3506
3506
|
className: "flex items-center justify-center p-2 rounded cursor-pointer transition-all ".concat(isIconSelected ? "bg-blue-600 ring-2 ring-blue-400 text-white" : "bg-gray-700 text-gray-400 hover:bg-gray-600 hover:text-gray-200"),
|
|
@@ -26365,236 +26365,1378 @@ var ThemeManagerModal = function ThemeManagerModal(_ref) {
|
|
|
26365
26365
|
});
|
|
26366
26366
|
};
|
|
26367
26367
|
|
|
26368
|
-
|
|
26369
|
-
|
|
26370
|
-
|
|
26371
|
-
|
|
26372
|
-
|
|
26373
|
-
return item.component === "LayoutGridContainer";
|
|
26374
|
-
});
|
|
26375
|
-
var grid = (gridRoot === null || gridRoot === void 0 ? void 0 : gridRoot.grid) || null;
|
|
26376
|
-
if (!grid || !grid.rows || !grid.cols) return null;
|
|
26377
|
-
|
|
26378
|
-
// Build preview cells from grid keys (e.g. "1.1", "2.3")
|
|
26379
|
-
var previewCells = [];
|
|
26380
|
-
for (var r = 1; r <= grid.rows; r++) {
|
|
26381
|
-
for (var c = 1; c <= grid.cols; c++) {
|
|
26382
|
-
var _cell$span, _cell$span2;
|
|
26383
|
-
var key = "".concat(r, ".").concat(c);
|
|
26384
|
-
var cell = grid[key];
|
|
26385
|
-
if (!cell || cell.hide) continue;
|
|
26386
|
-
var colSpan = ((_cell$span = cell.span) === null || _cell$span === void 0 ? void 0 : _cell$span.col) || undefined;
|
|
26387
|
-
var rowSpan = ((_cell$span2 = cell.span) === null || _cell$span2 === void 0 ? void 0 : _cell$span2.row) || undefined;
|
|
26388
|
-
previewCells.push({
|
|
26389
|
-
row: r,
|
|
26390
|
-
col: c,
|
|
26391
|
-
colSpan: colSpan,
|
|
26392
|
-
rowSpan: rowSpan
|
|
26393
|
-
});
|
|
26394
|
-
}
|
|
26395
|
-
}
|
|
26396
|
-
if (previewCells.length === 0) return null;
|
|
26397
|
-
return /*#__PURE__*/jsx("div", {
|
|
26398
|
-
className: "flex-1 min-h-0 w-full rounded bg-white/5 border border-white/10 p-2 overflow-hidden",
|
|
26399
|
-
style: {
|
|
26400
|
-
display: "grid",
|
|
26401
|
-
gridTemplateRows: "repeat(".concat(grid.rows, ", 1fr)"),
|
|
26402
|
-
gridTemplateColumns: "repeat(".concat(grid.cols, ", 1fr)"),
|
|
26403
|
-
gap: "4px"
|
|
26404
|
-
},
|
|
26405
|
-
children: previewCells.map(function (cell, i) {
|
|
26406
|
-
return /*#__PURE__*/jsxs("div", {
|
|
26407
|
-
className: "rounded-sm overflow-hidden border border-white/10 bg-white/5",
|
|
26408
|
-
style: {
|
|
26409
|
-
gridColumn: cell.colSpan ? "span ".concat(cell.colSpan) : undefined,
|
|
26410
|
-
gridRow: cell.rowSpan ? "span ".concat(cell.rowSpan) : undefined
|
|
26411
|
-
},
|
|
26412
|
-
children: [/*#__PURE__*/jsx("div", {
|
|
26413
|
-
className: "h-1.5 bg-white/10"
|
|
26414
|
-
}), /*#__PURE__*/jsxs("div", {
|
|
26415
|
-
className: "p-1 space-y-0.5",
|
|
26416
|
-
children: [/*#__PURE__*/jsx("div", {
|
|
26417
|
-
className: "h-0.5 w-3/4 rounded-full bg-white/5"
|
|
26418
|
-
}), /*#__PURE__*/jsx("div", {
|
|
26419
|
-
className: "h-0.5 w-1/2 rounded-full bg-white/5"
|
|
26420
|
-
})]
|
|
26421
|
-
})]
|
|
26422
|
-
}, i);
|
|
26423
|
-
})
|
|
26424
|
-
});
|
|
26425
|
-
};
|
|
26426
|
-
var DashboardDetail = function DashboardDetail(_ref2) {
|
|
26427
|
-
var workspace = _ref2.workspace,
|
|
26428
|
-
_ref2$menuItems = _ref2.menuItems,
|
|
26429
|
-
menuItems = _ref2$menuItems === void 0 ? [] : _ref2$menuItems,
|
|
26430
|
-
editingId = _ref2.editingId,
|
|
26431
|
-
editName = _ref2.editName,
|
|
26432
|
-
setEditName = _ref2.setEditName,
|
|
26433
|
-
onStartRename = _ref2.onStartRename,
|
|
26434
|
-
onSaveRename = _ref2.onSaveRename,
|
|
26435
|
-
onCancelRename = _ref2.onCancelRename,
|
|
26436
|
-
onDuplicate = _ref2.onDuplicate,
|
|
26437
|
-
onDelete = _ref2.onDelete,
|
|
26438
|
-
_ref2$dashApi = _ref2.dashApi,
|
|
26439
|
-
dashApi = _ref2$dashApi === void 0 ? null : _ref2$dashApi,
|
|
26440
|
-
_ref2$credentials = _ref2.credentials,
|
|
26441
|
-
credentials = _ref2$credentials === void 0 ? null : _ref2$credentials,
|
|
26442
|
-
_ref2$onReloadWorkspa = _ref2.onReloadWorkspaces,
|
|
26443
|
-
onReloadWorkspaces = _ref2$onReloadWorkspa === void 0 ? null : _ref2$onReloadWorkspa;
|
|
26444
|
-
var ws = workspace;
|
|
26445
|
-
var isEditing = editingId === ws.id;
|
|
26446
|
-
var widgetCount = (ws.layout || []).length;
|
|
26447
|
-
var appId = credentials === null || credentials === void 0 ? void 0 : credentials.appId;
|
|
26368
|
+
var StarRating = function StarRating(_ref) {
|
|
26369
|
+
var appId = _ref.appId,
|
|
26370
|
+
packageName = _ref.packageName,
|
|
26371
|
+
_ref$interactive = _ref.interactive,
|
|
26372
|
+
interactive = _ref$interactive === void 0 ? true : _ref$interactive;
|
|
26448
26373
|
var _useContext = useContext(ThemeContext),
|
|
26449
|
-
|
|
26450
|
-
var
|
|
26451
|
-
|
|
26452
|
-
|
|
26453
|
-
|
|
26454
|
-
|
|
26455
|
-
|
|
26456
|
-
|
|
26457
|
-
|
|
26458
|
-
|
|
26459
|
-
|
|
26460
|
-
|
|
26461
|
-
|
|
26462
|
-
|
|
26463
|
-
|
|
26464
|
-
|
|
26465
|
-
|
|
26466
|
-
|
|
26467
|
-
|
|
26468
|
-
|
|
26469
|
-
|
|
26470
|
-
|
|
26471
|
-
|
|
26472
|
-
|
|
26473
|
-
updated.layout = (updated.layout || []).map(function (layoutItem) {
|
|
26474
|
-
var cleaned = _objectSpread$8({}, layoutItem);
|
|
26475
|
-
delete cleaned.widgetConfig;
|
|
26476
|
-
return cleaned;
|
|
26477
|
-
});
|
|
26478
|
-
dashApi.saveWorkspace(appId, updated, function () {
|
|
26479
|
-
onReloadWorkspaces && onReloadWorkspaces();
|
|
26480
|
-
}, function (e, err) {
|
|
26481
|
-
return (void 0);
|
|
26374
|
+
currentTheme = _useContext.currentTheme;
|
|
26375
|
+
var _useState = useState(0),
|
|
26376
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
26377
|
+
rating = _useState2[0],
|
|
26378
|
+
setRating = _useState2[1];
|
|
26379
|
+
var _useState3 = useState(0),
|
|
26380
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
26381
|
+
hoverRating = _useState4[0],
|
|
26382
|
+
setHoverRating = _useState4[1];
|
|
26383
|
+
var _useState5 = useState(true),
|
|
26384
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
26385
|
+
loading = _useState6[0],
|
|
26386
|
+
setLoading = _useState6[1];
|
|
26387
|
+
useEffect(function () {
|
|
26388
|
+
var _window$mainApi;
|
|
26389
|
+
if (!appId || !packageName) return;
|
|
26390
|
+
var cancelled = false;
|
|
26391
|
+
setLoading(true);
|
|
26392
|
+
(_window$mainApi = window.mainApi) === null || _window$mainApi === void 0 || (_window$mainApi = _window$mainApi.dashboardRatings) === null || _window$mainApi === void 0 || _window$mainApi.getDashboardRating(appId, packageName).then(function (result) {
|
|
26393
|
+
if (!cancelled && result !== null && result !== void 0 && result.rating) {
|
|
26394
|
+
setRating(result.rating);
|
|
26395
|
+
}
|
|
26396
|
+
})["catch"](function () {})["finally"](function () {
|
|
26397
|
+
if (!cancelled) setLoading(false);
|
|
26482
26398
|
});
|
|
26399
|
+
return function () {
|
|
26400
|
+
cancelled = true;
|
|
26401
|
+
};
|
|
26402
|
+
}, [appId, packageName]);
|
|
26403
|
+
function handleClick(_x) {
|
|
26404
|
+
return _handleClick.apply(this, arguments);
|
|
26483
26405
|
}
|
|
26484
|
-
function
|
|
26485
|
-
|
|
26486
|
-
|
|
26487
|
-
|
|
26488
|
-
|
|
26489
|
-
|
|
26490
|
-
|
|
26491
|
-
|
|
26492
|
-
|
|
26493
|
-
|
|
26494
|
-
|
|
26495
|
-
|
|
26496
|
-
|
|
26497
|
-
|
|
26406
|
+
function _handleClick() {
|
|
26407
|
+
_handleClick = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(value) {
|
|
26408
|
+
var newRating, _window$mainApi2;
|
|
26409
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
26410
|
+
while (1) switch (_context.prev = _context.next) {
|
|
26411
|
+
case 0:
|
|
26412
|
+
if (!(!interactive || !appId || !packageName)) {
|
|
26413
|
+
_context.next = 1;
|
|
26414
|
+
break;
|
|
26415
|
+
}
|
|
26416
|
+
return _context.abrupt("return");
|
|
26417
|
+
case 1:
|
|
26418
|
+
newRating = value === rating ? 0 : value;
|
|
26419
|
+
setRating(newRating);
|
|
26420
|
+
_context.prev = 2;
|
|
26421
|
+
_context.next = 3;
|
|
26422
|
+
return (_window$mainApi2 = window.mainApi) === null || _window$mainApi2 === void 0 || (_window$mainApi2 = _window$mainApi2.dashboardRatings) === null || _window$mainApi2 === void 0 ? void 0 : _window$mainApi2.saveDashboardRating(appId, packageName, newRating);
|
|
26423
|
+
case 3:
|
|
26424
|
+
_context.next = 5;
|
|
26425
|
+
break;
|
|
26426
|
+
case 4:
|
|
26427
|
+
_context.prev = 4;
|
|
26428
|
+
_context["catch"](2);
|
|
26429
|
+
case 5:
|
|
26430
|
+
case "end":
|
|
26431
|
+
return _context.stop();
|
|
26432
|
+
}
|
|
26433
|
+
}, _callee, null, [[2, 4]]);
|
|
26434
|
+
}));
|
|
26435
|
+
return _handleClick.apply(this, arguments);
|
|
26498
26436
|
}
|
|
26499
|
-
|
|
26500
|
-
|
|
26501
|
-
|
|
26502
|
-
|
|
26503
|
-
|
|
26504
|
-
|
|
26505
|
-
|
|
26506
|
-
|
|
26507
|
-
|
|
26508
|
-
|
|
26509
|
-
|
|
26510
|
-
return setEditName(value);
|
|
26511
|
-
},
|
|
26512
|
-
placeholder: "Dashboard name",
|
|
26513
|
-
className: "flex-1"
|
|
26514
|
-
}), /*#__PURE__*/jsx(ButtonIcon, {
|
|
26515
|
-
icon: "check",
|
|
26516
|
-
onClick: function onClick() {
|
|
26517
|
-
return onSaveRename(ws);
|
|
26518
|
-
},
|
|
26519
|
-
size: "sm"
|
|
26520
|
-
}), /*#__PURE__*/jsx(ButtonIcon, {
|
|
26521
|
-
icon: "xmark",
|
|
26522
|
-
onClick: onCancelRename,
|
|
26523
|
-
size: "sm"
|
|
26524
|
-
})]
|
|
26525
|
-
}) : /*#__PURE__*/jsx(SubHeading, {
|
|
26526
|
-
title: ws.name || "Untitled",
|
|
26527
|
-
padding: false
|
|
26528
|
-
})
|
|
26529
|
-
}), /*#__PURE__*/jsxs("div", {
|
|
26530
|
-
className: "flex-shrink-0 flex flex-col space-y-3",
|
|
26531
|
-
children: [/*#__PURE__*/jsx(SelectInput, {
|
|
26532
|
-
label: "Folder",
|
|
26533
|
-
value: String(ws.menuId || ""),
|
|
26534
|
-
onChange: function onChange(val) {
|
|
26535
|
-
return handleChangeFolder(val);
|
|
26536
|
-
},
|
|
26537
|
-
options: folderOptions,
|
|
26538
|
-
placeholder: "No folder"
|
|
26539
|
-
}), /*#__PURE__*/jsx(SelectInput, {
|
|
26540
|
-
label: "Theme",
|
|
26541
|
-
value: ws.themeKey || "",
|
|
26542
|
-
onChange: function onChange(val) {
|
|
26543
|
-
return handleChangeTheme(val);
|
|
26544
|
-
},
|
|
26545
|
-
options: themeOptions,
|
|
26546
|
-
placeholder: "App Default"
|
|
26547
|
-
}), /*#__PURE__*/jsxs("div", {
|
|
26548
|
-
className: "flex flex-row items-center gap-2",
|
|
26549
|
-
children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
26550
|
-
icon: "th-large",
|
|
26551
|
-
className: "h-3 w-3 opacity-50"
|
|
26552
|
-
}), /*#__PURE__*/jsxs("span", {
|
|
26553
|
-
className: "text-sm opacity-70",
|
|
26554
|
-
children: [widgetCount, " widget", widgetCount !== 1 ? "s" : ""]
|
|
26555
|
-
})]
|
|
26556
|
-
})]
|
|
26557
|
-
}), /*#__PURE__*/jsx(LayoutPreview, {
|
|
26558
|
-
layout: ws.layout
|
|
26559
|
-
})]
|
|
26560
|
-
}), !isEditing && /*#__PURE__*/jsxs("div", {
|
|
26561
|
-
className: "flex-shrink-0 flex flex-row justify-end gap-2 px-6 py-4 border-t border-white/10",
|
|
26562
|
-
children: [/*#__PURE__*/jsx(Button, {
|
|
26563
|
-
title: "Rename",
|
|
26564
|
-
onClick: function onClick() {
|
|
26565
|
-
return onStartRename(ws);
|
|
26566
|
-
},
|
|
26567
|
-
size: "sm"
|
|
26568
|
-
}), /*#__PURE__*/jsx(Button, {
|
|
26569
|
-
title: "Duplicate",
|
|
26437
|
+
if (loading) return null;
|
|
26438
|
+
var displayRating = hoverRating || rating;
|
|
26439
|
+
return /*#__PURE__*/jsx("div", {
|
|
26440
|
+
className: "flex items-center gap-0.5",
|
|
26441
|
+
onMouseLeave: function onMouseLeave() {
|
|
26442
|
+
return setHoverRating(0);
|
|
26443
|
+
},
|
|
26444
|
+
children: [1, 2, 3, 4, 5].map(function (star) {
|
|
26445
|
+
return /*#__PURE__*/jsx("button", {
|
|
26446
|
+
type: "button",
|
|
26447
|
+
disabled: !interactive,
|
|
26570
26448
|
onClick: function onClick() {
|
|
26571
|
-
return
|
|
26449
|
+
return handleClick(star);
|
|
26572
26450
|
},
|
|
26573
|
-
|
|
26574
|
-
|
|
26575
|
-
title: "Delete",
|
|
26576
|
-
onClick: function onClick() {
|
|
26577
|
-
return onDelete(ws);
|
|
26451
|
+
onMouseEnter: function onMouseEnter() {
|
|
26452
|
+
return interactive && setHoverRating(star);
|
|
26578
26453
|
},
|
|
26579
|
-
|
|
26580
|
-
|
|
26581
|
-
|
|
26454
|
+
className: "p-0.5 transition-colors ".concat(interactive ? "cursor-pointer hover:scale-110" : "cursor-default"),
|
|
26455
|
+
children: /*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
26456
|
+
icon: star <= displayRating ? "star" : ["far", "star"],
|
|
26457
|
+
className: "h-3.5 w-3.5 ".concat(star <= displayRating ? "text-yellow-400" : currentTheme["text-primary-medium"] || "text-gray-500")
|
|
26458
|
+
})
|
|
26459
|
+
}, star);
|
|
26460
|
+
})
|
|
26582
26461
|
});
|
|
26583
26462
|
};
|
|
26584
26463
|
|
|
26585
|
-
|
|
26586
|
-
|
|
26587
|
-
|
|
26588
|
-
|
|
26589
|
-
|
|
26590
|
-
|
|
26464
|
+
var FOLDER_ICONS = [
|
|
26465
|
+
// General / UI
|
|
26466
|
+
"home", "folder", "star", "heart", "bookmark", "tag", "flag", "bell", "circle", "square", "circle-check", "thumbs-up", "clone", "signal",
|
|
26467
|
+
// Communication
|
|
26468
|
+
"phone", "envelope", "comment", "message", "paper-plane",
|
|
26469
|
+
// Media
|
|
26470
|
+
"image", "camera", "music", "video", "film", "headphones",
|
|
26471
|
+
// Tech
|
|
26472
|
+
"code", "terminal", "database", "server", "wifi", "plug", "robot", "microchip", "globe",
|
|
26473
|
+
// Nature
|
|
26474
|
+
"leaf", "seedling", "tree", "sun", "moon", "cloud", "bolt", "fire", "snowflake", "water",
|
|
26475
|
+
// Objects
|
|
26476
|
+
"hammer", "wrench", "gear", "briefcase", "cart-shopping", "truck", "car", "plane", "rocket",
|
|
26477
|
+
// People / Activity
|
|
26478
|
+
"user", "users", "trophy", "gamepad", "dumbbell", "graduation-cap", "baby", "baby-carriage",
|
|
26479
|
+
// Arrows / Navigation
|
|
26480
|
+
"arrow-up", "arrow-down", "arrow-left", "arrow-right", "arrows-up-down", "arrows-left-right", "minus",
|
|
26481
|
+
// Data / Charts
|
|
26482
|
+
"chart-bar", "chart-line", "chart-pie", "table", "list", "layer-group",
|
|
26483
|
+
// Files
|
|
26484
|
+
"file", "file-code", "clipboard", "book", "pen", "pencil",
|
|
26485
|
+
// Misc
|
|
26486
|
+
"magnifying-glass", "eye", "lock", "key", "shield", "clock", "calendar", "link"];
|
|
26487
|
+
var ALL_ICON_NAMES = Object.keys(DashReact).filter(function (key) {
|
|
26488
|
+
return key.startsWith("fa") && key !== "fas";
|
|
26489
|
+
}).map(function (key) {
|
|
26490
|
+
var _DashReact$key;
|
|
26491
|
+
return (_DashReact$key = DashReact[key]) === null || _DashReact$key === void 0 ? void 0 : _DashReact$key.iconName;
|
|
26492
|
+
}).filter(Boolean).filter(function (name, index, arr) {
|
|
26493
|
+
return arr.indexOf(name) === index;
|
|
26494
|
+
}).sort();
|
|
26495
|
+
var CURATED_SET = new Set(FOLDER_ICONS);
|
|
26496
|
+
var IconPicker = function IconPicker(_ref) {
|
|
26497
|
+
var selectedIcon = _ref.selectedIcon,
|
|
26498
|
+
onSelectIcon = _ref.onSelectIcon;
|
|
26499
|
+
var _useState = useState(""),
|
|
26500
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
26501
|
+
search = _useState2[0],
|
|
26502
|
+
setSearch = _useState2[1];
|
|
26503
|
+
var query = search.trim().toLowerCase();
|
|
26504
|
+
var filteredCurated = useMemo(function () {
|
|
26505
|
+
return query ? FOLDER_ICONS.filter(function (name) {
|
|
26506
|
+
return name.includes(query);
|
|
26507
|
+
}) : FOLDER_ICONS;
|
|
26508
|
+
}, [query]);
|
|
26509
|
+
var remainingIcons = useMemo(function () {
|
|
26510
|
+
var all = ALL_ICON_NAMES.filter(function (name) {
|
|
26511
|
+
return !CURATED_SET.has(name);
|
|
26512
|
+
});
|
|
26513
|
+
return query ? all.filter(function (name) {
|
|
26514
|
+
return name.includes(query);
|
|
26515
|
+
}) : all;
|
|
26516
|
+
}, [query]);
|
|
26517
|
+
var hasResults = filteredCurated.length > 0 || remainingIcons.length > 0;
|
|
26518
|
+
var renderIcon = function renderIcon(icon) {
|
|
26519
|
+
return /*#__PURE__*/jsx(ButtonIcon, {
|
|
26520
|
+
icon: icon,
|
|
26521
|
+
selected: icon === selectedIcon,
|
|
26522
|
+
onClick: function onClick() {
|
|
26523
|
+
return onSelectIcon(icon);
|
|
26524
|
+
},
|
|
26525
|
+
iconSize: "h-6 w-6",
|
|
26526
|
+
backgroundColor: "transparent",
|
|
26527
|
+
className: icon !== selectedIcon ? "opacity-50 hover:!opacity-80" : ""
|
|
26528
|
+
}, icon);
|
|
26529
|
+
};
|
|
26530
|
+
return /*#__PURE__*/jsxs("div", {
|
|
26531
|
+
className: "flex flex-col flex-1 min-h-0 space-y-3",
|
|
26532
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
26533
|
+
className: "flex-shrink-0",
|
|
26534
|
+
children: /*#__PURE__*/jsx(SearchInput, {
|
|
26535
|
+
value: search,
|
|
26536
|
+
onChange: setSearch,
|
|
26537
|
+
placeholder: "Search icons..."
|
|
26538
|
+
})
|
|
26539
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
26540
|
+
className: "flex-1 min-h-0 overflow-y-auto space-y-3",
|
|
26541
|
+
children: [!hasResults && /*#__PURE__*/jsxs("span", {
|
|
26542
|
+
className: "text-sm opacity-50 py-2",
|
|
26543
|
+
children: ["No icons match \"", search, "\""]
|
|
26544
|
+
}), filteredCurated.length > 0 && /*#__PURE__*/jsxs("div", {
|
|
26545
|
+
className: "flex flex-col space-y-1.5",
|
|
26546
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
26547
|
+
className: "text-xs font-medium opacity-50",
|
|
26548
|
+
children: "Suggested"
|
|
26549
|
+
}), /*#__PURE__*/jsx("div", {
|
|
26550
|
+
className: "grid grid-cols-6 gap-2",
|
|
26551
|
+
children: filteredCurated.map(renderIcon)
|
|
26552
|
+
})]
|
|
26553
|
+
}), remainingIcons.length > 0 && /*#__PURE__*/jsxs("div", {
|
|
26554
|
+
className: "flex flex-col space-y-1.5",
|
|
26555
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
26556
|
+
className: "text-xs font-medium opacity-50",
|
|
26557
|
+
children: "All Icons"
|
|
26558
|
+
}), /*#__PURE__*/jsx("div", {
|
|
26559
|
+
className: "grid grid-cols-6 gap-2",
|
|
26560
|
+
children: remainingIcons.map(renderIcon)
|
|
26561
|
+
})]
|
|
26562
|
+
})]
|
|
26563
|
+
})]
|
|
26564
|
+
});
|
|
26565
|
+
};
|
|
26566
|
+
|
|
26567
|
+
var DASHBOARD_TAGS = ["productivity", "monitoring", "analytics", "communication", "developer", "sales", "marketing", "finance", "project-management", "social", "news", "utilities"];
|
|
26568
|
+
|
|
26569
|
+
/**
|
|
26570
|
+
* PublishDashboardModal — multi-step stepper for preparing a dashboard
|
|
26571
|
+
* for registry publishing.
|
|
26572
|
+
*
|
|
26573
|
+
* Steps:
|
|
26574
|
+
* 1. Details — Author name (required) + description (textarea)
|
|
26575
|
+
* 2. Tags — Predefined tag selection with toggle-pill styling
|
|
26576
|
+
* 3. Icon — Full icon picker with search
|
|
26577
|
+
* 4. Publish — Review summary, publish action, result display
|
|
26578
|
+
*/
|
|
26579
|
+
var PublishDashboardModal = function PublishDashboardModal(_ref) {
|
|
26580
|
+
var isOpen = _ref.isOpen,
|
|
26581
|
+
setIsOpen = _ref.setIsOpen,
|
|
26582
|
+
appId = _ref.appId,
|
|
26583
|
+
workspaceId = _ref.workspaceId,
|
|
26584
|
+
workspaceName = _ref.workspaceName;
|
|
26585
|
+
var _useContext = useContext(ThemeContext),
|
|
26586
|
+
currentTheme = _useContext.currentTheme;
|
|
26587
|
+
var panelStyles = getStylesForItem(themeObjects.PANEL, currentTheme, {
|
|
26588
|
+
grow: false
|
|
26589
|
+
});
|
|
26590
|
+
// Stepper state
|
|
26591
|
+
var _useState = useState(0),
|
|
26592
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
26593
|
+
step = _useState2[0],
|
|
26594
|
+
setStep = _useState2[1];
|
|
26595
|
+
|
|
26596
|
+
// Step 1: Details
|
|
26597
|
+
var _useState3 = useState(""),
|
|
26598
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
26599
|
+
authorName = _useState4[0],
|
|
26600
|
+
setAuthorName = _useState4[1];
|
|
26601
|
+
var _useState5 = useState(""),
|
|
26602
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
26603
|
+
description = _useState6[0],
|
|
26604
|
+
setDescription = _useState6[1];
|
|
26605
|
+
|
|
26606
|
+
// Step 2: Tags
|
|
26607
|
+
var _useState7 = useState([]),
|
|
26608
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
26609
|
+
selectedTags = _useState8[0],
|
|
26610
|
+
setSelectedTags = _useState8[1];
|
|
26611
|
+
|
|
26612
|
+
// Step 3: Icon
|
|
26613
|
+
var _useState9 = useState("grip"),
|
|
26614
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
26615
|
+
icon = _useState0[0],
|
|
26616
|
+
setIcon = _useState0[1];
|
|
26617
|
+
|
|
26618
|
+
// Step 4: Publish
|
|
26619
|
+
var _useState1 = useState(false),
|
|
26620
|
+
_useState10 = _slicedToArray(_useState1, 2),
|
|
26621
|
+
isPublishing = _useState10[0],
|
|
26622
|
+
setIsPublishing = _useState10[1];
|
|
26623
|
+
var _useState11 = useState(null),
|
|
26624
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
26625
|
+
result = _useState12[0],
|
|
26626
|
+
setResult = _useState12[1];
|
|
26627
|
+
function resetState() {
|
|
26628
|
+
setStep(0);
|
|
26629
|
+
setAuthorName("");
|
|
26630
|
+
setDescription("");
|
|
26631
|
+
setSelectedTags([]);
|
|
26632
|
+
setIcon("grip");
|
|
26633
|
+
setIsPublishing(false);
|
|
26634
|
+
setResult(null);
|
|
26635
|
+
}
|
|
26636
|
+
function handleClose() {
|
|
26637
|
+
setIsOpen(false);
|
|
26638
|
+
setTimeout(resetState, 200);
|
|
26639
|
+
}
|
|
26640
|
+
function handleStepChange(nextStep) {
|
|
26641
|
+
if (step === 0 && nextStep > 0 && !authorName.trim()) return;
|
|
26642
|
+
if (step === 1 && nextStep > 1 && selectedTags.length === 0) return;
|
|
26643
|
+
setStep(nextStep);
|
|
26644
|
+
}
|
|
26645
|
+
function toggleTag(tag) {
|
|
26646
|
+
setSelectedTags(function (prev) {
|
|
26647
|
+
return prev.includes(tag) ? prev.filter(function (t) {
|
|
26648
|
+
return t !== tag;
|
|
26649
|
+
}) : [].concat(_toConsumableArray(prev), [tag]);
|
|
26650
|
+
});
|
|
26651
|
+
}
|
|
26652
|
+
function handlePublish() {
|
|
26653
|
+
return _handlePublish.apply(this, arguments);
|
|
26654
|
+
}
|
|
26655
|
+
function _handlePublish() {
|
|
26656
|
+
_handlePublish = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
26657
|
+
var options, res, _t;
|
|
26658
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
26659
|
+
while (1) switch (_context.prev = _context.next) {
|
|
26660
|
+
case 0:
|
|
26661
|
+
if (!(!appId || !workspaceId)) {
|
|
26662
|
+
_context.next = 1;
|
|
26663
|
+
break;
|
|
26664
|
+
}
|
|
26665
|
+
return _context.abrupt("return");
|
|
26666
|
+
case 1:
|
|
26667
|
+
setIsPublishing(true);
|
|
26668
|
+
setResult(null);
|
|
26669
|
+
_context.prev = 2;
|
|
26670
|
+
options = {
|
|
26671
|
+
authorName: authorName.trim(),
|
|
26672
|
+
description: description.trim() || undefined,
|
|
26673
|
+
tags: selectedTags,
|
|
26674
|
+
icon: icon || undefined
|
|
26675
|
+
};
|
|
26676
|
+
_context.next = 3;
|
|
26677
|
+
return window.mainApi.dashboardConfig.prepareDashboardForPublish(appId, workspaceId, options);
|
|
26678
|
+
case 3:
|
|
26679
|
+
res = _context.sent;
|
|
26680
|
+
setResult(res);
|
|
26681
|
+
_context.next = 5;
|
|
26682
|
+
break;
|
|
26683
|
+
case 4:
|
|
26684
|
+
_context.prev = 4;
|
|
26685
|
+
_t = _context["catch"](2);
|
|
26686
|
+
setResult({
|
|
26687
|
+
success: false,
|
|
26688
|
+
error: _t.message || "Failed to prepare dashboard for publish."
|
|
26689
|
+
});
|
|
26690
|
+
case 5:
|
|
26691
|
+
_context.prev = 5;
|
|
26692
|
+
setIsPublishing(false);
|
|
26693
|
+
return _context.finish(5);
|
|
26694
|
+
case 6:
|
|
26695
|
+
case "end":
|
|
26696
|
+
return _context.stop();
|
|
26697
|
+
}
|
|
26698
|
+
}, _callee, null, [[2, 4, 5, 6]]);
|
|
26699
|
+
}));
|
|
26700
|
+
return _handlePublish.apply(this, arguments);
|
|
26701
|
+
}
|
|
26702
|
+
var isLastStep = step === 3;
|
|
26703
|
+
var canAdvance = step === 0 ? !!authorName.trim() : step === 1 ? selectedTags.length > 0 : true;
|
|
26704
|
+
return /*#__PURE__*/jsx(Modal, {
|
|
26705
|
+
isOpen: isOpen,
|
|
26706
|
+
setIsOpen: handleClose,
|
|
26707
|
+
width: "w-full max-w-2xl",
|
|
26708
|
+
height: "h-[70vh]",
|
|
26709
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
26710
|
+
className: "flex flex-col h-full rounded-lg overflow-clip border ".concat(panelStyles.backgroundColor || "", " ").concat(panelStyles.borderColor || "", " ").concat(panelStyles.textColor || ""),
|
|
26711
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
26712
|
+
className: "flex-shrink-0 flex flex-row items-center justify-between p-4 border-b border-white/10",
|
|
26713
|
+
children: [/*#__PURE__*/jsxs("span", {
|
|
26714
|
+
className: "text-lg font-semibold",
|
|
26715
|
+
children: ["Publish \"", workspaceName || "Dashboard", "\""]
|
|
26716
|
+
}), /*#__PURE__*/jsx("button", {
|
|
26717
|
+
type: "button",
|
|
26718
|
+
onClick: handleClose,
|
|
26719
|
+
className: "opacity-50 hover:opacity-100 transition-opacity cursor-pointer",
|
|
26720
|
+
children: /*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
26721
|
+
icon: "xmark",
|
|
26722
|
+
className: "h-5 w-5"
|
|
26723
|
+
})
|
|
26724
|
+
})]
|
|
26725
|
+
}), /*#__PURE__*/jsxs(Stepper, {
|
|
26726
|
+
activeStep: step,
|
|
26727
|
+
onStepChange: handleStepChange,
|
|
26728
|
+
showNavigation: false,
|
|
26729
|
+
className: "flex-1 min-h-0 flex flex-col px-6 pt-2",
|
|
26730
|
+
children: [/*#__PURE__*/jsx(Stepper.Step, {
|
|
26731
|
+
label: "Details",
|
|
26732
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
26733
|
+
className: "flex-1 min-h-0 overflow-y-auto pb-4 space-y-5",
|
|
26734
|
+
children: [/*#__PURE__*/jsx("p", {
|
|
26735
|
+
className: "text-sm opacity-70",
|
|
26736
|
+
children: "Provide details about your dashboard for the registry listing."
|
|
26737
|
+
}), /*#__PURE__*/jsx(InputText, {
|
|
26738
|
+
label: "Author Name *",
|
|
26739
|
+
value: authorName,
|
|
26740
|
+
onChange: setAuthorName,
|
|
26741
|
+
placeholder: "Your name"
|
|
26742
|
+
}), /*#__PURE__*/jsx(TextArea, {
|
|
26743
|
+
label: "Description",
|
|
26744
|
+
value: description,
|
|
26745
|
+
onChange: setDescription,
|
|
26746
|
+
placeholder: "A brief description of this dashboard...",
|
|
26747
|
+
rows: 3
|
|
26748
|
+
})]
|
|
26749
|
+
})
|
|
26750
|
+
}), /*#__PURE__*/jsx(Stepper.Step, {
|
|
26751
|
+
label: "Tags",
|
|
26752
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
26753
|
+
className: "flex-1 min-h-0 overflow-y-auto pb-4 space-y-5",
|
|
26754
|
+
children: [/*#__PURE__*/jsx("p", {
|
|
26755
|
+
className: "text-sm opacity-70",
|
|
26756
|
+
children: "Select at least one tag to categorize your dashboard."
|
|
26757
|
+
}), /*#__PURE__*/jsx("div", {
|
|
26758
|
+
className: "grid grid-cols-3 gap-2",
|
|
26759
|
+
children: DASHBOARD_TAGS.map(function (tag) {
|
|
26760
|
+
var isSelected = selectedTags.includes(tag);
|
|
26761
|
+
return /*#__PURE__*/jsx("button", {
|
|
26762
|
+
type: "button",
|
|
26763
|
+
onClick: function onClick() {
|
|
26764
|
+
return toggleTag(tag);
|
|
26765
|
+
},
|
|
26766
|
+
className: "px-3 py-1.5 rounded-full text-sm border transition-colors cursor-pointer ".concat(isSelected ? "bg-white/15 border-white/30 text-white" : "bg-transparent border-white/10 text-white/60 hover:border-white/20 hover:text-white/80"),
|
|
26767
|
+
children: tag
|
|
26768
|
+
}, tag);
|
|
26769
|
+
})
|
|
26770
|
+
})]
|
|
26771
|
+
})
|
|
26772
|
+
}), /*#__PURE__*/jsx(Stepper.Step, {
|
|
26773
|
+
label: "Icon",
|
|
26774
|
+
children: /*#__PURE__*/jsx("div", {
|
|
26775
|
+
className: "flex-1 min-h-0 flex flex-col pb-4",
|
|
26776
|
+
children: /*#__PURE__*/jsx(IconPicker, {
|
|
26777
|
+
selectedIcon: icon,
|
|
26778
|
+
onSelectIcon: setIcon
|
|
26779
|
+
})
|
|
26780
|
+
})
|
|
26781
|
+
}), /*#__PURE__*/jsx(Stepper.Step, {
|
|
26782
|
+
label: "Publish",
|
|
26783
|
+
children: /*#__PURE__*/jsx("div", {
|
|
26784
|
+
className: "flex-1 min-h-0 overflow-y-auto pb-4 space-y-4",
|
|
26785
|
+
children: !result ? /*#__PURE__*/jsxs(Fragment, {
|
|
26786
|
+
children: [/*#__PURE__*/jsx("p", {
|
|
26787
|
+
className: "text-sm opacity-70",
|
|
26788
|
+
children: "Review your dashboard details before publishing."
|
|
26789
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
26790
|
+
className: "bg-white/5 border border-white/10 rounded-lg p-4 space-y-2 text-sm",
|
|
26791
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
26792
|
+
className: "flex gap-2",
|
|
26793
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
26794
|
+
className: "opacity-50 w-20 flex-shrink-0",
|
|
26795
|
+
children: "Author"
|
|
26796
|
+
}), /*#__PURE__*/jsx("span", {
|
|
26797
|
+
children: authorName
|
|
26798
|
+
})]
|
|
26799
|
+
}), description.trim() && /*#__PURE__*/jsxs("div", {
|
|
26800
|
+
className: "flex gap-2",
|
|
26801
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
26802
|
+
className: "opacity-50 w-20 flex-shrink-0",
|
|
26803
|
+
children: "Description"
|
|
26804
|
+
}), /*#__PURE__*/jsx("span", {
|
|
26805
|
+
children: description
|
|
26806
|
+
})]
|
|
26807
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
26808
|
+
className: "flex gap-2",
|
|
26809
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
26810
|
+
className: "opacity-50 w-20 flex-shrink-0",
|
|
26811
|
+
children: "Tags"
|
|
26812
|
+
}), /*#__PURE__*/jsx("span", {
|
|
26813
|
+
children: selectedTags.length > 0 ? selectedTags.join(", ") : "None"
|
|
26814
|
+
})]
|
|
26815
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
26816
|
+
className: "flex gap-2 items-center",
|
|
26817
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
26818
|
+
className: "opacity-50 w-20 flex-shrink-0",
|
|
26819
|
+
children: "Icon"
|
|
26820
|
+
}), /*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
26821
|
+
icon: icon || "grip",
|
|
26822
|
+
className: "h-4 w-4"
|
|
26823
|
+
}), /*#__PURE__*/jsx("span", {
|
|
26824
|
+
className: "opacity-70",
|
|
26825
|
+
children: icon || "grip"
|
|
26826
|
+
})]
|
|
26827
|
+
})]
|
|
26828
|
+
})]
|
|
26829
|
+
}) : result.success ? /*#__PURE__*/jsxs("div", {
|
|
26830
|
+
className: "space-y-3",
|
|
26831
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
26832
|
+
className: "flex items-center gap-2",
|
|
26833
|
+
children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
26834
|
+
icon: "circle-check",
|
|
26835
|
+
className: "h-4 w-4 text-green-400"
|
|
26836
|
+
}), /*#__PURE__*/jsx("span", {
|
|
26837
|
+
className: "text-sm",
|
|
26838
|
+
children: "Dashboard prepared for publishing."
|
|
26839
|
+
})]
|
|
26840
|
+
}), result.filePath && /*#__PURE__*/jsxs("div", {
|
|
26841
|
+
className: "text-xs opacity-50 break-all",
|
|
26842
|
+
children: ["Saved to: ", result.filePath]
|
|
26843
|
+
}), result.warnings && result.warnings.length > 0 && /*#__PURE__*/jsxs("div", {
|
|
26844
|
+
className: "bg-amber-500/10 border border-amber-500/20 rounded-lg p-3 space-y-2",
|
|
26845
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
26846
|
+
className: "flex items-start gap-2",
|
|
26847
|
+
children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
26848
|
+
icon: "triangle-exclamation",
|
|
26849
|
+
className: "h-3.5 w-3.5 text-amber-400 mt-0.5 flex-shrink-0"
|
|
26850
|
+
}), /*#__PURE__*/jsx("span", {
|
|
26851
|
+
className: "text-xs text-amber-300/90",
|
|
26852
|
+
children: "The following widgets are not currently on the registry. This may be intentional if they are private. Dashboards referencing these widgets can only be installed by users who already have them."
|
|
26853
|
+
})]
|
|
26854
|
+
}), /*#__PURE__*/jsx("ul", {
|
|
26855
|
+
className: "text-xs opacity-60 pl-5 list-disc space-y-0.5",
|
|
26856
|
+
children: result.warnings.map(function (w) {
|
|
26857
|
+
return /*#__PURE__*/jsx("li", {
|
|
26858
|
+
children: w
|
|
26859
|
+
}, w);
|
|
26860
|
+
})
|
|
26861
|
+
})]
|
|
26862
|
+
}), result.registryCheckFailed && /*#__PURE__*/jsx("div", {
|
|
26863
|
+
className: "bg-amber-500/10 border border-amber-500/20 rounded-lg p-3",
|
|
26864
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
26865
|
+
className: "flex items-start gap-2",
|
|
26866
|
+
children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
26867
|
+
icon: "triangle-exclamation",
|
|
26868
|
+
className: "h-3.5 w-3.5 text-amber-400 mt-0.5 flex-shrink-0"
|
|
26869
|
+
}), /*#__PURE__*/jsx("span", {
|
|
26870
|
+
className: "text-xs text-amber-300/90",
|
|
26871
|
+
children: "Unable to reach the registry to verify widget availability. Your dashboard was still prepared successfully."
|
|
26872
|
+
})]
|
|
26873
|
+
})
|
|
26874
|
+
})]
|
|
26875
|
+
}) : /*#__PURE__*/jsxs("div", {
|
|
26876
|
+
className: "flex items-center gap-2",
|
|
26877
|
+
children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
26878
|
+
icon: "circle-xmark",
|
|
26879
|
+
className: "h-4 w-4 text-red-400"
|
|
26880
|
+
}), /*#__PURE__*/jsx("span", {
|
|
26881
|
+
className: "text-sm text-red-400",
|
|
26882
|
+
children: result.error || "Publish preparation failed."
|
|
26883
|
+
})]
|
|
26884
|
+
})
|
|
26885
|
+
})
|
|
26886
|
+
})]
|
|
26887
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
26888
|
+
className: "flex-shrink-0 flex flex-row items-center px-6 py-4 border-t border-white/10",
|
|
26889
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
26890
|
+
className: "flex flex-row gap-2",
|
|
26891
|
+
children: /*#__PURE__*/jsx(Button3, {
|
|
26892
|
+
title: step === 0 ? "Cancel" : "Back",
|
|
26893
|
+
onClick: step === 0 ? handleClose : function () {
|
|
26894
|
+
return setStep(step - 1);
|
|
26895
|
+
},
|
|
26896
|
+
disabled: isPublishing
|
|
26897
|
+
})
|
|
26898
|
+
}), /*#__PURE__*/jsx("div", {
|
|
26899
|
+
className: "flex-1 text-center",
|
|
26900
|
+
children: /*#__PURE__*/jsxs("span", {
|
|
26901
|
+
className: "text-xs opacity-40",
|
|
26902
|
+
children: ["Step ", step + 1, " of 4"]
|
|
26903
|
+
})
|
|
26904
|
+
}), /*#__PURE__*/jsx("div", {
|
|
26905
|
+
className: "flex flex-row gap-2",
|
|
26906
|
+
children: result !== null && result !== void 0 && result.success ? /*#__PURE__*/jsx(Button2, {
|
|
26907
|
+
title: "Done",
|
|
26908
|
+
onClick: handleClose
|
|
26909
|
+
}) : isLastStep ? /*#__PURE__*/jsx(Button2, {
|
|
26910
|
+
title: isPublishing ? "Preparing..." : "Publish",
|
|
26911
|
+
onClick: handlePublish,
|
|
26912
|
+
disabled: isPublishing
|
|
26913
|
+
}) : /*#__PURE__*/jsx(Button2, {
|
|
26914
|
+
title: "Next",
|
|
26915
|
+
onClick: function onClick() {
|
|
26916
|
+
return handleStepChange(step + 1);
|
|
26917
|
+
},
|
|
26918
|
+
disabled: !canAdvance
|
|
26919
|
+
})
|
|
26920
|
+
})]
|
|
26921
|
+
})]
|
|
26922
|
+
})
|
|
26923
|
+
});
|
|
26924
|
+
};
|
|
26925
|
+
|
|
26926
|
+
function ownKeys$8(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; }
|
|
26927
|
+
function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$8(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$8(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
26928
|
+
var LayoutPreview = function LayoutPreview(_ref) {
|
|
26929
|
+
var layout = _ref.layout;
|
|
26930
|
+
var gridRoot = (layout || []).find(function (item) {
|
|
26931
|
+
return item.component === "LayoutGridContainer";
|
|
26932
|
+
});
|
|
26933
|
+
var grid = (gridRoot === null || gridRoot === void 0 ? void 0 : gridRoot.grid) || null;
|
|
26934
|
+
if (!grid || !grid.rows || !grid.cols) return null;
|
|
26935
|
+
|
|
26936
|
+
// Build preview cells from grid keys (e.g. "1.1", "2.3")
|
|
26937
|
+
var previewCells = [];
|
|
26938
|
+
for (var r = 1; r <= grid.rows; r++) {
|
|
26939
|
+
for (var c = 1; c <= grid.cols; c++) {
|
|
26940
|
+
var _cell$span, _cell$span2;
|
|
26941
|
+
var key = "".concat(r, ".").concat(c);
|
|
26942
|
+
var cell = grid[key];
|
|
26943
|
+
if (!cell || cell.hide) continue;
|
|
26944
|
+
var colSpan = ((_cell$span = cell.span) === null || _cell$span === void 0 ? void 0 : _cell$span.col) || undefined;
|
|
26945
|
+
var rowSpan = ((_cell$span2 = cell.span) === null || _cell$span2 === void 0 ? void 0 : _cell$span2.row) || undefined;
|
|
26946
|
+
previewCells.push({
|
|
26947
|
+
row: r,
|
|
26948
|
+
col: c,
|
|
26949
|
+
colSpan: colSpan,
|
|
26950
|
+
rowSpan: rowSpan
|
|
26951
|
+
});
|
|
26952
|
+
}
|
|
26953
|
+
}
|
|
26954
|
+
if (previewCells.length === 0) return null;
|
|
26955
|
+
return /*#__PURE__*/jsx("div", {
|
|
26956
|
+
className: "flex-1 min-h-0 w-full rounded bg-white/5 border border-white/10 p-2 overflow-hidden",
|
|
26957
|
+
style: {
|
|
26958
|
+
display: "grid",
|
|
26959
|
+
gridTemplateRows: "repeat(".concat(grid.rows, ", 1fr)"),
|
|
26960
|
+
gridTemplateColumns: "repeat(".concat(grid.cols, ", 1fr)"),
|
|
26961
|
+
gap: "4px"
|
|
26962
|
+
},
|
|
26963
|
+
children: previewCells.map(function (cell, i) {
|
|
26964
|
+
return /*#__PURE__*/jsxs("div", {
|
|
26965
|
+
className: "rounded-sm overflow-hidden border border-white/10 bg-white/5",
|
|
26966
|
+
style: {
|
|
26967
|
+
gridColumn: cell.colSpan ? "span ".concat(cell.colSpan) : undefined,
|
|
26968
|
+
gridRow: cell.rowSpan ? "span ".concat(cell.rowSpan) : undefined
|
|
26969
|
+
},
|
|
26970
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
26971
|
+
className: "h-1.5 bg-white/10"
|
|
26972
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
26973
|
+
className: "p-1 space-y-0.5",
|
|
26974
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
26975
|
+
className: "h-0.5 w-3/4 rounded-full bg-white/5"
|
|
26976
|
+
}), /*#__PURE__*/jsx("div", {
|
|
26977
|
+
className: "h-0.5 w-1/2 rounded-full bg-white/5"
|
|
26978
|
+
})]
|
|
26979
|
+
})]
|
|
26980
|
+
}, i);
|
|
26981
|
+
})
|
|
26982
|
+
});
|
|
26983
|
+
};
|
|
26984
|
+
var DashboardDetail = function DashboardDetail(_ref2) {
|
|
26985
|
+
var _ws$_dashboardConfig, _ws$_dashboardConfig2;
|
|
26986
|
+
var workspace = _ref2.workspace,
|
|
26987
|
+
_ref2$menuItems = _ref2.menuItems,
|
|
26988
|
+
menuItems = _ref2$menuItems === void 0 ? [] : _ref2$menuItems,
|
|
26989
|
+
editingId = _ref2.editingId,
|
|
26990
|
+
editName = _ref2.editName,
|
|
26991
|
+
setEditName = _ref2.setEditName,
|
|
26992
|
+
onStartRename = _ref2.onStartRename,
|
|
26993
|
+
onSaveRename = _ref2.onSaveRename,
|
|
26994
|
+
onCancelRename = _ref2.onCancelRename,
|
|
26995
|
+
onDuplicate = _ref2.onDuplicate,
|
|
26996
|
+
onDelete = _ref2.onDelete,
|
|
26997
|
+
_ref2$dashApi = _ref2.dashApi,
|
|
26998
|
+
dashApi = _ref2$dashApi === void 0 ? null : _ref2$dashApi,
|
|
26999
|
+
_ref2$credentials = _ref2.credentials,
|
|
27000
|
+
credentials = _ref2$credentials === void 0 ? null : _ref2$credentials,
|
|
27001
|
+
_ref2$onReloadWorkspa = _ref2.onReloadWorkspaces,
|
|
27002
|
+
onReloadWorkspaces = _ref2$onReloadWorkspa === void 0 ? null : _ref2$onReloadWorkspa;
|
|
27003
|
+
var ws = workspace;
|
|
27004
|
+
var isEditing = editingId === ws.id;
|
|
27005
|
+
var widgetCount = (ws.layout || []).length;
|
|
27006
|
+
var appId = credentials === null || credentials === void 0 ? void 0 : credentials.appId;
|
|
27007
|
+
var _useContext = useContext(ThemeContext),
|
|
27008
|
+
themes = _useContext.themes;
|
|
27009
|
+
var _useState = useState(null),
|
|
27010
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
27011
|
+
exportStatus = _useState2[0],
|
|
27012
|
+
setExportStatus = _useState2[1];
|
|
27013
|
+
var _useState3 = useState(false),
|
|
27014
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
27015
|
+
publishOpen = _useState4[0],
|
|
27016
|
+
setPublishOpen = _useState4[1];
|
|
27017
|
+
var registryPackage = (_ws$_dashboardConfig = ws._dashboardConfig) === null || _ws$_dashboardConfig === void 0 ? void 0 : _ws$_dashboardConfig.registryPackage;
|
|
27018
|
+
var isShareable = ((_ws$_dashboardConfig2 = ws._dashboardConfig) === null || _ws$_dashboardConfig2 === void 0 ? void 0 : _ws$_dashboardConfig2.shareable) !== false;
|
|
27019
|
+
function handleExport() {
|
|
27020
|
+
return _handleExport.apply(this, arguments);
|
|
27021
|
+
}
|
|
27022
|
+
function _handleExport() {
|
|
27023
|
+
_handleExport = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
27024
|
+
var result, _t;
|
|
27025
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
27026
|
+
while (1) switch (_context.prev = _context.next) {
|
|
27027
|
+
case 0:
|
|
27028
|
+
if (appId) {
|
|
27029
|
+
_context.next = 1;
|
|
27030
|
+
break;
|
|
27031
|
+
}
|
|
27032
|
+
return _context.abrupt("return");
|
|
27033
|
+
case 1:
|
|
27034
|
+
setExportStatus({
|
|
27035
|
+
status: "loading"
|
|
27036
|
+
});
|
|
27037
|
+
_context.prev = 2;
|
|
27038
|
+
_context.next = 3;
|
|
27039
|
+
return window.mainApi.dashboardConfig.exportDashboardConfig(appId, ws.id, {});
|
|
27040
|
+
case 3:
|
|
27041
|
+
result = _context.sent;
|
|
27042
|
+
if (result !== null && result !== void 0 && result.success) {
|
|
27043
|
+
setExportStatus({
|
|
27044
|
+
status: "success",
|
|
27045
|
+
message: "Exported successfully."
|
|
27046
|
+
});
|
|
27047
|
+
} else {
|
|
27048
|
+
setExportStatus({
|
|
27049
|
+
status: "error",
|
|
27050
|
+
message: (result === null || result === void 0 ? void 0 : result.error) || "Export failed."
|
|
27051
|
+
});
|
|
27052
|
+
}
|
|
27053
|
+
_context.next = 5;
|
|
27054
|
+
break;
|
|
27055
|
+
case 4:
|
|
27056
|
+
_context.prev = 4;
|
|
27057
|
+
_t = _context["catch"](2);
|
|
27058
|
+
setExportStatus({
|
|
27059
|
+
status: "error",
|
|
27060
|
+
message: _t.message || "Export failed."
|
|
27061
|
+
});
|
|
27062
|
+
case 5:
|
|
27063
|
+
setTimeout(function () {
|
|
27064
|
+
return setExportStatus(null);
|
|
27065
|
+
}, 3000);
|
|
27066
|
+
case 6:
|
|
27067
|
+
case "end":
|
|
27068
|
+
return _context.stop();
|
|
27069
|
+
}
|
|
27070
|
+
}, _callee, null, [[2, 4]]);
|
|
27071
|
+
}));
|
|
27072
|
+
return _handleExport.apply(this, arguments);
|
|
27073
|
+
}
|
|
27074
|
+
var folderOptions = menuItems.map(function (m) {
|
|
27075
|
+
return {
|
|
27076
|
+
label: m.name,
|
|
27077
|
+
value: String(m.id)
|
|
27078
|
+
};
|
|
27079
|
+
});
|
|
27080
|
+
var themeOptions = [{
|
|
27081
|
+
label: "App Default",
|
|
27082
|
+
value: ""
|
|
27083
|
+
}].concat(_toConsumableArray(Object.entries(themes || {}).map(function (_ref3) {
|
|
27084
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
27085
|
+
key = _ref4[0],
|
|
27086
|
+
t = _ref4[1];
|
|
27087
|
+
return {
|
|
27088
|
+
label: t.name || key,
|
|
27089
|
+
value: key
|
|
27090
|
+
};
|
|
27091
|
+
})));
|
|
27092
|
+
function handleChangeFolder(val) {
|
|
27093
|
+
if (!dashApi || !appId) return;
|
|
27094
|
+
var updated = deepCopy(ws);
|
|
27095
|
+
updated.menuId = val ? Number(val) : null;
|
|
27096
|
+
// Strip widgetConfig from layout before saving
|
|
27097
|
+
updated.layout = (updated.layout || []).map(function (layoutItem) {
|
|
27098
|
+
var cleaned = _objectSpread$8({}, layoutItem);
|
|
27099
|
+
delete cleaned.widgetConfig;
|
|
27100
|
+
return cleaned;
|
|
27101
|
+
});
|
|
27102
|
+
dashApi.saveWorkspace(appId, updated, function () {
|
|
27103
|
+
onReloadWorkspaces && onReloadWorkspaces();
|
|
27104
|
+
}, function (e, err) {
|
|
27105
|
+
return (void 0);
|
|
27106
|
+
});
|
|
27107
|
+
}
|
|
27108
|
+
function handleChangeTheme(val) {
|
|
27109
|
+
if (!dashApi || !appId) return;
|
|
27110
|
+
var updated = deepCopy(ws);
|
|
27111
|
+
updated.themeKey = val || null;
|
|
27112
|
+
updated.layout = (updated.layout || []).map(function (layoutItem) {
|
|
27113
|
+
var cleaned = _objectSpread$8({}, layoutItem);
|
|
27114
|
+
delete cleaned.widgetConfig;
|
|
27115
|
+
return cleaned;
|
|
27116
|
+
});
|
|
27117
|
+
dashApi.saveWorkspace(appId, updated, function () {
|
|
27118
|
+
onReloadWorkspaces && onReloadWorkspaces();
|
|
27119
|
+
}, function (e, err) {
|
|
27120
|
+
return (void 0);
|
|
27121
|
+
});
|
|
27122
|
+
}
|
|
27123
|
+
return /*#__PURE__*/jsxs("div", {
|
|
27124
|
+
className: "flex flex-col flex-1 min-h-0",
|
|
27125
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
27126
|
+
className: "flex flex-col flex-1 min-h-0 overflow-y-auto p-6 gap-6",
|
|
27127
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
27128
|
+
className: "flex-shrink-0 flex flex-row items-center justify-between",
|
|
27129
|
+
children: isEditing ? /*#__PURE__*/jsxs("div", {
|
|
27130
|
+
className: "flex flex-row items-center gap-2 flex-1",
|
|
27131
|
+
children: [/*#__PURE__*/jsx(InputText, {
|
|
27132
|
+
value: editName,
|
|
27133
|
+
onChange: function onChange(value) {
|
|
27134
|
+
return setEditName(value);
|
|
27135
|
+
},
|
|
27136
|
+
placeholder: "Dashboard name",
|
|
27137
|
+
className: "flex-1"
|
|
27138
|
+
}), /*#__PURE__*/jsx(ButtonIcon, {
|
|
27139
|
+
icon: "check",
|
|
27140
|
+
onClick: function onClick() {
|
|
27141
|
+
return onSaveRename(ws);
|
|
27142
|
+
},
|
|
27143
|
+
size: "sm"
|
|
27144
|
+
}), /*#__PURE__*/jsx(ButtonIcon, {
|
|
27145
|
+
icon: "xmark",
|
|
27146
|
+
onClick: onCancelRename,
|
|
27147
|
+
size: "sm"
|
|
27148
|
+
})]
|
|
27149
|
+
}) : /*#__PURE__*/jsx(SubHeading, {
|
|
27150
|
+
title: ws.name || "Untitled",
|
|
27151
|
+
padding: false
|
|
27152
|
+
})
|
|
27153
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
27154
|
+
className: "flex-shrink-0 flex flex-col space-y-3",
|
|
27155
|
+
children: [/*#__PURE__*/jsx(SelectInput, {
|
|
27156
|
+
label: "Folder",
|
|
27157
|
+
value: String(ws.menuId || ""),
|
|
27158
|
+
onChange: function onChange(val) {
|
|
27159
|
+
return handleChangeFolder(val);
|
|
27160
|
+
},
|
|
27161
|
+
options: folderOptions,
|
|
27162
|
+
placeholder: "No folder"
|
|
27163
|
+
}), /*#__PURE__*/jsx(SelectInput, {
|
|
27164
|
+
label: "Theme",
|
|
27165
|
+
value: ws.themeKey || "",
|
|
27166
|
+
onChange: function onChange(val) {
|
|
27167
|
+
return handleChangeTheme(val);
|
|
27168
|
+
},
|
|
27169
|
+
options: themeOptions,
|
|
27170
|
+
placeholder: "App Default"
|
|
27171
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
27172
|
+
className: "flex flex-row items-center gap-2",
|
|
27173
|
+
children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
27174
|
+
icon: "th-large",
|
|
27175
|
+
className: "h-3 w-3 opacity-50"
|
|
27176
|
+
}), /*#__PURE__*/jsxs("span", {
|
|
27177
|
+
className: "text-sm opacity-70",
|
|
27178
|
+
children: [widgetCount, " widget", widgetCount !== 1 ? "s" : ""]
|
|
27179
|
+
})]
|
|
27180
|
+
})]
|
|
27181
|
+
}), registryPackage && /*#__PURE__*/jsxs("div", {
|
|
27182
|
+
className: "flex-shrink-0 flex items-center gap-2",
|
|
27183
|
+
children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
27184
|
+
icon: "store",
|
|
27185
|
+
className: "h-3 w-3 opacity-50"
|
|
27186
|
+
}), /*#__PURE__*/jsxs("span", {
|
|
27187
|
+
className: "text-xs opacity-60",
|
|
27188
|
+
children: ["Imported from registry:", " ", /*#__PURE__*/jsx("span", {
|
|
27189
|
+
className: "font-medium",
|
|
27190
|
+
children: registryPackage
|
|
27191
|
+
})]
|
|
27192
|
+
})]
|
|
27193
|
+
}), registryPackage && appId && /*#__PURE__*/jsx("div", {
|
|
27194
|
+
className: "flex-shrink-0",
|
|
27195
|
+
children: /*#__PURE__*/jsx(StarRating, {
|
|
27196
|
+
appId: appId,
|
|
27197
|
+
packageName: registryPackage,
|
|
27198
|
+
interactive: true
|
|
27199
|
+
})
|
|
27200
|
+
}), exportStatus && /*#__PURE__*/jsxs("div", {
|
|
27201
|
+
className: "flex-shrink-0 flex items-center gap-2",
|
|
27202
|
+
children: [exportStatus.status === "loading" && /*#__PURE__*/jsx("div", {
|
|
27203
|
+
className: "animate-spin rounded-full h-3.5 w-3.5 border-b-2 border-blue-500"
|
|
27204
|
+
}), exportStatus.status === "success" && /*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
27205
|
+
icon: "circle-check",
|
|
27206
|
+
className: "h-3.5 w-3.5 text-green-400"
|
|
27207
|
+
}), exportStatus.status === "error" && /*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
27208
|
+
icon: "circle-xmark",
|
|
27209
|
+
className: "h-3.5 w-3.5 text-red-400"
|
|
27210
|
+
}), /*#__PURE__*/jsx("span", {
|
|
27211
|
+
className: "text-xs ".concat(exportStatus.status === "error" ? "text-red-400" : "opacity-60"),
|
|
27212
|
+
children: exportStatus.message
|
|
27213
|
+
})]
|
|
27214
|
+
}), /*#__PURE__*/jsx(LayoutPreview, {
|
|
27215
|
+
layout: ws.layout
|
|
27216
|
+
})]
|
|
27217
|
+
}), !isEditing && /*#__PURE__*/jsxs("div", {
|
|
27218
|
+
className: "flex-shrink-0 flex flex-row justify-end gap-2 px-6 py-4 border-t border-white/10",
|
|
27219
|
+
children: [/*#__PURE__*/jsx(Button, {
|
|
27220
|
+
title: "Export ZIP",
|
|
27221
|
+
onClick: handleExport,
|
|
27222
|
+
size: "sm"
|
|
27223
|
+
}), isShareable && /*#__PURE__*/jsx(Button, {
|
|
27224
|
+
title: "Publish",
|
|
27225
|
+
onClick: function onClick() {
|
|
27226
|
+
return setPublishOpen(true);
|
|
27227
|
+
},
|
|
27228
|
+
size: "sm"
|
|
27229
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
27230
|
+
title: "Rename",
|
|
27231
|
+
onClick: function onClick() {
|
|
27232
|
+
return onStartRename(ws);
|
|
27233
|
+
},
|
|
27234
|
+
size: "sm"
|
|
27235
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
27236
|
+
title: "Duplicate",
|
|
27237
|
+
onClick: function onClick() {
|
|
27238
|
+
return onDuplicate(ws);
|
|
27239
|
+
},
|
|
27240
|
+
size: "sm"
|
|
27241
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
27242
|
+
title: "Delete",
|
|
27243
|
+
onClick: function onClick() {
|
|
27244
|
+
return onDelete(ws);
|
|
27245
|
+
},
|
|
27246
|
+
size: "sm"
|
|
27247
|
+
})]
|
|
27248
|
+
}), /*#__PURE__*/jsx(PublishDashboardModal, {
|
|
27249
|
+
isOpen: publishOpen,
|
|
27250
|
+
setIsOpen: setPublishOpen,
|
|
27251
|
+
appId: appId,
|
|
27252
|
+
workspaceId: ws.id,
|
|
27253
|
+
workspaceName: ws.name
|
|
27254
|
+
})]
|
|
27255
|
+
});
|
|
27256
|
+
};
|
|
27257
|
+
|
|
27258
|
+
var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
|
|
27259
|
+
var dashboardPackage = _ref.dashboardPackage,
|
|
27260
|
+
appId = _ref.appId;
|
|
27261
|
+
var _useContext = useContext(ThemeContext),
|
|
27262
|
+
currentTheme = _useContext.currentTheme;
|
|
27263
|
+
var panelStyles = getStylesForItem(themeObjects.PANEL, currentTheme, {
|
|
27264
|
+
grow: false
|
|
27265
|
+
});
|
|
27266
|
+
var _useState = useState(null),
|
|
27267
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
27268
|
+
preview = _useState2[0],
|
|
27269
|
+
setPreview = _useState2[1];
|
|
27270
|
+
var _useState3 = useState(false),
|
|
27271
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
27272
|
+
previewLoading = _useState4[0],
|
|
27273
|
+
setPreviewLoading = _useState4[1];
|
|
27274
|
+
var _useState5 = useState(false),
|
|
27275
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
27276
|
+
isInstalling = _useState6[0],
|
|
27277
|
+
setIsInstalling = _useState6[1];
|
|
27278
|
+
var _useState7 = useState(null),
|
|
27279
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
27280
|
+
installResult = _useState8[0],
|
|
27281
|
+
setInstallResult = _useState8[1];
|
|
27282
|
+
var pkg = dashboardPackage;
|
|
27283
|
+
if (!pkg) return null;
|
|
27284
|
+
|
|
27285
|
+
// Load preview data on mount
|
|
27286
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
27287
|
+
useEffect(function () {
|
|
27288
|
+
var _window$mainApi;
|
|
27289
|
+
if (!pkg.name) return;
|
|
27290
|
+
var cancelled = false;
|
|
27291
|
+
setPreviewLoading(true);
|
|
27292
|
+
setPreview(null);
|
|
27293
|
+
setInstallResult(null);
|
|
27294
|
+
(_window$mainApi = window.mainApi) === null || _window$mainApi === void 0 || (_window$mainApi = _window$mainApi.dashboardConfig) === null || _window$mainApi === void 0 || _window$mainApi.getDashboardPreview(pkg.name).then(function (result) {
|
|
27295
|
+
if (!cancelled) setPreview(result);
|
|
27296
|
+
})["catch"](function (err) {
|
|
27297
|
+
})["finally"](function () {
|
|
27298
|
+
if (!cancelled) setPreviewLoading(false);
|
|
27299
|
+
});
|
|
27300
|
+
return function () {
|
|
27301
|
+
cancelled = true;
|
|
27302
|
+
};
|
|
27303
|
+
}, [pkg.name]);
|
|
27304
|
+
function handleInstall() {
|
|
27305
|
+
return _handleInstall.apply(this, arguments);
|
|
27306
|
+
}
|
|
27307
|
+
function _handleInstall() {
|
|
27308
|
+
_handleInstall = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
27309
|
+
var _result$workspace, result, _t;
|
|
27310
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
27311
|
+
while (1) switch (_context.prev = _context.next) {
|
|
27312
|
+
case 0:
|
|
27313
|
+
if (!(!appId || !pkg.name)) {
|
|
27314
|
+
_context.next = 1;
|
|
27315
|
+
break;
|
|
27316
|
+
}
|
|
27317
|
+
return _context.abrupt("return");
|
|
27318
|
+
case 1:
|
|
27319
|
+
setIsInstalling(true);
|
|
27320
|
+
setInstallResult(null);
|
|
27321
|
+
_context.prev = 2;
|
|
27322
|
+
_context.next = 3;
|
|
27323
|
+
return window.mainApi.dashboardConfig.installDashboardFromRegistry(appId, pkg.name);
|
|
27324
|
+
case 3:
|
|
27325
|
+
result = _context.sent;
|
|
27326
|
+
setInstallResult({
|
|
27327
|
+
status: result !== null && result !== void 0 && result.success ? "success" : "error",
|
|
27328
|
+
message: result !== null && result !== void 0 && result.success ? "Dashboard \"".concat(((_result$workspace = result.workspace) === null || _result$workspace === void 0 ? void 0 : _result$workspace.name) || pkg.name, "\" installed successfully.") : (result === null || result === void 0 ? void 0 : result.error) || "Installation failed."
|
|
27329
|
+
});
|
|
27330
|
+
_context.next = 5;
|
|
27331
|
+
break;
|
|
27332
|
+
case 4:
|
|
27333
|
+
_context.prev = 4;
|
|
27334
|
+
_t = _context["catch"](2);
|
|
27335
|
+
setInstallResult({
|
|
27336
|
+
status: "error",
|
|
27337
|
+
message: _t.message || "Failed to install dashboard."
|
|
27338
|
+
});
|
|
27339
|
+
case 5:
|
|
27340
|
+
_context.prev = 5;
|
|
27341
|
+
setIsInstalling(false);
|
|
27342
|
+
return _context.finish(5);
|
|
27343
|
+
case 6:
|
|
27344
|
+
case "end":
|
|
27345
|
+
return _context.stop();
|
|
27346
|
+
}
|
|
27347
|
+
}, _callee, null, [[2, 4, 5, 6]]);
|
|
27348
|
+
}));
|
|
27349
|
+
return _handleInstall.apply(this, arguments);
|
|
27350
|
+
}
|
|
27351
|
+
var compatibility = preview === null || preview === void 0 ? void 0 : preview.compatibility;
|
|
27352
|
+
var widgetDeps = (preview === null || preview === void 0 ? void 0 : preview.widgets) || pkg.widgets || [];
|
|
27353
|
+
var providers = (preview === null || preview === void 0 ? void 0 : preview.providers) || [];
|
|
27354
|
+
var wiring = (preview === null || preview === void 0 ? void 0 : preview.wiring) || [];
|
|
27355
|
+
function getCompatIcon(status) {
|
|
27356
|
+
if (status === "installed") return {
|
|
27357
|
+
icon: "circle-check",
|
|
27358
|
+
color: "text-green-400"
|
|
27359
|
+
};
|
|
27360
|
+
if (status === "available") return {
|
|
27361
|
+
icon: "circle-down",
|
|
27362
|
+
color: "text-blue-400"
|
|
27363
|
+
};
|
|
27364
|
+
return {
|
|
27365
|
+
icon: "circle-xmark",
|
|
27366
|
+
color: "text-red-400"
|
|
27367
|
+
};
|
|
27368
|
+
}
|
|
27369
|
+
return /*#__PURE__*/jsxs("div", {
|
|
27370
|
+
className: "flex flex-col flex-1 min-h-0",
|
|
27371
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
27372
|
+
className: "flex-1 min-h-0 overflow-y-auto p-6 space-y-6 ".concat(panelStyles.textColor || "text-gray-200"),
|
|
27373
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
27374
|
+
className: "flex flex-row items-center gap-3",
|
|
27375
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
27376
|
+
className: "h-5 w-5 flex-shrink-0 flex items-center justify-center",
|
|
27377
|
+
children: /*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
27378
|
+
icon: pkg.icon || "clone",
|
|
27379
|
+
className: "h-5 w-5"
|
|
27380
|
+
})
|
|
27381
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
27382
|
+
children: [/*#__PURE__*/jsx(SubHeading3, {
|
|
27383
|
+
title: pkg.displayName || pkg.name,
|
|
27384
|
+
padding: false
|
|
27385
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
27386
|
+
className: "flex items-center gap-2 mt-0.5",
|
|
27387
|
+
children: [/*#__PURE__*/jsxs("span", {
|
|
27388
|
+
className: "text-sm opacity-60",
|
|
27389
|
+
children: ["by ", pkg.author || "Unknown"]
|
|
27390
|
+
}), pkg.version && /*#__PURE__*/jsxs("span", {
|
|
27391
|
+
className: "text-xs px-2 py-0.5 rounded ".concat(currentTheme["bg-primary-medium"], " opacity-70"),
|
|
27392
|
+
children: ["v", pkg.version]
|
|
27393
|
+
})]
|
|
27394
|
+
})]
|
|
27395
|
+
})]
|
|
27396
|
+
}), appId && /*#__PURE__*/jsx(StarRating, {
|
|
27397
|
+
appId: appId,
|
|
27398
|
+
packageName: pkg.name,
|
|
27399
|
+
interactive: false
|
|
27400
|
+
}), /*#__PURE__*/jsx("hr", {
|
|
27401
|
+
className: currentTheme["border-primary-medium"]
|
|
27402
|
+
}), pkg.description && /*#__PURE__*/jsx("p", {
|
|
27403
|
+
className: "text-sm",
|
|
27404
|
+
children: pkg.description
|
|
27405
|
+
}), pkg.tags && pkg.tags.length > 0 && /*#__PURE__*/jsx("div", {
|
|
27406
|
+
className: "flex flex-wrap gap-1",
|
|
27407
|
+
children: pkg.tags.map(function (tag) {
|
|
27408
|
+
return /*#__PURE__*/jsx("span", {
|
|
27409
|
+
className: "text-xs px-2 py-0.5 rounded ".concat(currentTheme["bg-primary-medium"], " opacity-60"),
|
|
27410
|
+
children: tag
|
|
27411
|
+
}, tag);
|
|
27412
|
+
})
|
|
27413
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
27414
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
27415
|
+
className: "text-xs font-semibold opacity-50 mb-1 block",
|
|
27416
|
+
children: "REQUIRED WIDGETS"
|
|
27417
|
+
}), previewLoading ? /*#__PURE__*/jsxs("div", {
|
|
27418
|
+
className: "flex items-center gap-2 py-2",
|
|
27419
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
27420
|
+
className: "animate-spin rounded-full h-4 w-4 border-b-2 border-blue-500"
|
|
27421
|
+
}), /*#__PURE__*/jsx("span", {
|
|
27422
|
+
className: "text-xs opacity-50",
|
|
27423
|
+
children: "Checking compatibility..."
|
|
27424
|
+
})]
|
|
27425
|
+
}) : /*#__PURE__*/jsx("div", {
|
|
27426
|
+
className: "space-y-1.5",
|
|
27427
|
+
children: widgetDeps.map(function (w, idx) {
|
|
27428
|
+
var _compatibility$widget;
|
|
27429
|
+
var status = (compatibility === null || compatibility === void 0 || (_compatibility$widget = compatibility.widgets) === null || _compatibility$widget === void 0 ? void 0 : _compatibility$widget[w.name || w.packageName]) || "unknown";
|
|
27430
|
+
var compat = getCompatIcon(status);
|
|
27431
|
+
return /*#__PURE__*/jsxs("div", {
|
|
27432
|
+
className: "p-2 rounded ".concat(currentTheme["bg-primary-medium"], " flex items-center gap-2"),
|
|
27433
|
+
children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
27434
|
+
icon: compat.icon,
|
|
27435
|
+
className: "h-3.5 w-3.5 ".concat(compat.color)
|
|
27436
|
+
}), /*#__PURE__*/jsx("span", {
|
|
27437
|
+
className: "text-sm",
|
|
27438
|
+
children: w.displayName || w.name || w.packageName
|
|
27439
|
+
}), /*#__PURE__*/jsx("span", {
|
|
27440
|
+
className: "text-xs opacity-40 ml-auto",
|
|
27441
|
+
children: status === "installed" ? "Installed" : status === "available" ? "Will install" : "Unavailable"
|
|
27442
|
+
})]
|
|
27443
|
+
}, idx);
|
|
27444
|
+
})
|
|
27445
|
+
})]
|
|
27446
|
+
}), providers.length > 0 && /*#__PURE__*/jsxs("div", {
|
|
27447
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
27448
|
+
className: "text-xs font-semibold opacity-50 mb-1 block",
|
|
27449
|
+
children: "REQUIRED PROVIDERS"
|
|
27450
|
+
}), /*#__PURE__*/jsx("div", {
|
|
27451
|
+
className: "space-y-1",
|
|
27452
|
+
children: providers.map(function (p, idx) {
|
|
27453
|
+
return /*#__PURE__*/jsxs("div", {
|
|
27454
|
+
className: "flex items-center gap-2",
|
|
27455
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
27456
|
+
className: "text-xs px-1.5 py-0.5 rounded bg-blue-900/30 text-blue-400",
|
|
27457
|
+
children: p.type
|
|
27458
|
+
}), p.required && /*#__PURE__*/jsx("span", {
|
|
27459
|
+
className: "text-[10px] opacity-40",
|
|
27460
|
+
children: "Required"
|
|
27461
|
+
})]
|
|
27462
|
+
}, idx);
|
|
27463
|
+
})
|
|
27464
|
+
})]
|
|
27465
|
+
}), wiring.length > 0 && /*#__PURE__*/jsxs("div", {
|
|
27466
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
27467
|
+
className: "text-xs font-semibold opacity-50 mb-1 block",
|
|
27468
|
+
children: "EVENT WIRING"
|
|
27469
|
+
}), /*#__PURE__*/jsx("div", {
|
|
27470
|
+
className: "space-y-1",
|
|
27471
|
+
children: wiring.map(function (w, idx) {
|
|
27472
|
+
return /*#__PURE__*/jsxs("div", {
|
|
27473
|
+
className: "text-xs p-2 rounded ".concat(currentTheme["bg-primary-medium"], " opacity-70"),
|
|
27474
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
27475
|
+
className: "font-medium",
|
|
27476
|
+
children: w.from || "Source"
|
|
27477
|
+
}), /*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
27478
|
+
icon: "arrow-right",
|
|
27479
|
+
className: "h-2.5 w-2.5 mx-1.5 opacity-50"
|
|
27480
|
+
}), /*#__PURE__*/jsx("span", {
|
|
27481
|
+
className: "font-medium",
|
|
27482
|
+
children: w.to || "Target"
|
|
27483
|
+
}), w.event && /*#__PURE__*/jsxs("span", {
|
|
27484
|
+
className: "opacity-50 ml-1.5",
|
|
27485
|
+
children: ["(", w.event, ")"]
|
|
27486
|
+
})]
|
|
27487
|
+
}, idx);
|
|
27488
|
+
})
|
|
27489
|
+
})]
|
|
27490
|
+
}), installResult && /*#__PURE__*/jsx("div", {
|
|
27491
|
+
className: "p-2 rounded border ".concat(installResult.status === "success" ? "bg-green-900/20 border-green-700" : "bg-red-900/30 border-red-700"),
|
|
27492
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
27493
|
+
className: "flex items-center gap-2",
|
|
27494
|
+
children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
27495
|
+
icon: installResult.status === "success" ? "circle-check" : "circle-xmark",
|
|
27496
|
+
className: "h-4 w-4 ".concat(installResult.status === "success" ? "text-green-400" : "text-red-400")
|
|
27497
|
+
}), /*#__PURE__*/jsx("span", {
|
|
27498
|
+
className: "text-sm ".concat(installResult.status === "error" ? "text-red-400" : ""),
|
|
27499
|
+
children: installResult.message
|
|
27500
|
+
})]
|
|
27501
|
+
})
|
|
27502
|
+
})]
|
|
27503
|
+
}), (installResult === null || installResult === void 0 ? void 0 : installResult.status) !== "success" && /*#__PURE__*/jsx("div", {
|
|
27504
|
+
className: "flex items-center justify-end px-6 py-3 border-t ".concat(currentTheme["border-primary-medium"]),
|
|
27505
|
+
children: /*#__PURE__*/jsx(Button, {
|
|
27506
|
+
title: isInstalling ? "Installing..." : "Install Dashboard",
|
|
27507
|
+
bgColor: "bg-blue-600",
|
|
27508
|
+
hoverBackgroundColor: isInstalling ? "" : "hover:bg-blue-700",
|
|
27509
|
+
textSize: "text-sm",
|
|
27510
|
+
padding: "py-1.5 px-4",
|
|
27511
|
+
onClick: handleInstall,
|
|
27512
|
+
disabled: isInstalling
|
|
27513
|
+
})
|
|
27514
|
+
})]
|
|
27515
|
+
});
|
|
27516
|
+
};
|
|
27517
|
+
|
|
27518
|
+
var DiscoverDashboardsDetail = function DiscoverDashboardsDetail(_ref) {
|
|
27519
|
+
var onBack = _ref.onBack,
|
|
27520
|
+
appId = _ref.appId;
|
|
27521
|
+
var _useContext = useContext(ThemeContext),
|
|
27522
|
+
currentTheme = _useContext.currentTheme;
|
|
27523
|
+
var panelStyles = getStylesForItem(themeObjects.PANEL, currentTheme, {
|
|
27524
|
+
grow: false
|
|
27525
|
+
});
|
|
27526
|
+
var _useState = useState([]),
|
|
27527
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
27528
|
+
packages = _useState2[0],
|
|
27529
|
+
setPackages = _useState2[1];
|
|
27530
|
+
var _useState3 = useState(false),
|
|
27531
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
27532
|
+
isLoading = _useState4[0],
|
|
27533
|
+
setIsLoading = _useState4[1];
|
|
27534
|
+
var _useState5 = useState(null),
|
|
27535
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
27536
|
+
error = _useState6[0],
|
|
27537
|
+
setError = _useState6[1];
|
|
27538
|
+
var _useState7 = useState(""),
|
|
27539
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
27540
|
+
searchQuery = _useState8[0],
|
|
27541
|
+
setSearchQuery = _useState8[1];
|
|
27542
|
+
var _useState9 = useState(null),
|
|
27543
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
27544
|
+
selectedPackageName = _useState0[0],
|
|
27545
|
+
setSelectedPackageName = _useState0[1];
|
|
27546
|
+
var search = useCallback(/*#__PURE__*/function () {
|
|
27547
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(query) {
|
|
27548
|
+
var _window$mainApi;
|
|
27549
|
+
var result, _t;
|
|
27550
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
27551
|
+
while (1) switch (_context.prev = _context.next) {
|
|
27552
|
+
case 0:
|
|
27553
|
+
if ((_window$mainApi = window.mainApi) !== null && _window$mainApi !== void 0 && (_window$mainApi = _window$mainApi.registry) !== null && _window$mainApi !== void 0 && _window$mainApi.searchDashboards) {
|
|
27554
|
+
_context.next = 1;
|
|
27555
|
+
break;
|
|
27556
|
+
}
|
|
27557
|
+
setPackages([]);
|
|
27558
|
+
return _context.abrupt("return");
|
|
27559
|
+
case 1:
|
|
27560
|
+
setIsLoading(true);
|
|
27561
|
+
setError(null);
|
|
27562
|
+
_context.prev = 2;
|
|
27563
|
+
_context.next = 3;
|
|
27564
|
+
return window.mainApi.registry.searchDashboards(query || "", {});
|
|
27565
|
+
case 3:
|
|
27566
|
+
result = _context.sent;
|
|
27567
|
+
setPackages((result === null || result === void 0 ? void 0 : result.packages) || []);
|
|
27568
|
+
_context.next = 5;
|
|
27569
|
+
break;
|
|
27570
|
+
case 4:
|
|
27571
|
+
_context.prev = 4;
|
|
27572
|
+
_t = _context["catch"](2);
|
|
27573
|
+
setError(_t.message || "Failed to search dashboard registry");
|
|
27574
|
+
setPackages([]);
|
|
27575
|
+
case 5:
|
|
27576
|
+
_context.prev = 5;
|
|
27577
|
+
setIsLoading(false);
|
|
27578
|
+
return _context.finish(5);
|
|
27579
|
+
case 6:
|
|
27580
|
+
case "end":
|
|
27581
|
+
return _context.stop();
|
|
27582
|
+
}
|
|
27583
|
+
}, _callee, null, [[2, 4, 5, 6]]);
|
|
27584
|
+
}));
|
|
27585
|
+
return function (_x) {
|
|
27586
|
+
return _ref2.apply(this, arguments);
|
|
27587
|
+
};
|
|
27588
|
+
}(), []);
|
|
27589
|
+
|
|
27590
|
+
// Debounce search on query changes
|
|
27591
|
+
useEffect(function () {
|
|
27592
|
+
var timer = setTimeout(function () {
|
|
27593
|
+
search(searchQuery);
|
|
27594
|
+
}, 300);
|
|
27595
|
+
return function () {
|
|
27596
|
+
return clearTimeout(timer);
|
|
27597
|
+
};
|
|
27598
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
27599
|
+
}, [searchQuery]);
|
|
27600
|
+
var retry = function retry() {
|
|
27601
|
+
return search(searchQuery);
|
|
27602
|
+
};
|
|
27603
|
+
var selectedPackage = selectedPackageName ? packages.find(function (p) {
|
|
27604
|
+
return p.name === selectedPackageName;
|
|
27605
|
+
}) : null;
|
|
27606
|
+
|
|
27607
|
+
// If a package is selected, show its detail inline
|
|
27608
|
+
if (selectedPackage) {
|
|
27609
|
+
return /*#__PURE__*/jsxs("div", {
|
|
27610
|
+
className: "flex flex-col flex-1 min-h-0",
|
|
27611
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
27612
|
+
className: "flex-shrink-0 px-4 pt-4",
|
|
27613
|
+
children: /*#__PURE__*/jsxs("button", {
|
|
27614
|
+
type: "button",
|
|
27615
|
+
onClick: function onClick() {
|
|
27616
|
+
return setSelectedPackageName(null);
|
|
27617
|
+
},
|
|
27618
|
+
className: "flex items-center gap-1.5 text-sm opacity-60 hover:opacity-100 transition-opacity",
|
|
27619
|
+
children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
27620
|
+
icon: "arrow-left",
|
|
27621
|
+
className: "h-3 w-3"
|
|
27622
|
+
}), /*#__PURE__*/jsx("span", {
|
|
27623
|
+
children: "Back"
|
|
27624
|
+
})]
|
|
27625
|
+
})
|
|
27626
|
+
}), /*#__PURE__*/jsx(RegistryDashboardDetail, {
|
|
27627
|
+
dashboardPackage: selectedPackage,
|
|
27628
|
+
appId: appId
|
|
27629
|
+
})]
|
|
27630
|
+
});
|
|
27631
|
+
}
|
|
27632
|
+
|
|
27633
|
+
// Package list view
|
|
27634
|
+
var listBody;
|
|
27635
|
+
if (isLoading) {
|
|
27636
|
+
listBody = /*#__PURE__*/jsx("div", {
|
|
27637
|
+
className: "flex items-center justify-center py-12",
|
|
27638
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
27639
|
+
className: "text-center",
|
|
27640
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
27641
|
+
className: "animate-spin rounded-full h-6 w-6 border-b-2 border-blue-500 mx-auto mb-3"
|
|
27642
|
+
}), /*#__PURE__*/jsx(Paragraph, {
|
|
27643
|
+
className: "text-sm opacity-50",
|
|
27644
|
+
children: "Loading dashboards..."
|
|
27645
|
+
})]
|
|
27646
|
+
})
|
|
27647
|
+
});
|
|
27648
|
+
} else if (error) {
|
|
27649
|
+
listBody = /*#__PURE__*/jsxs("div", {
|
|
27650
|
+
className: "px-4 py-8 text-center",
|
|
27651
|
+
children: [/*#__PURE__*/jsx(Paragraph, {
|
|
27652
|
+
className: "text-sm text-red-400 mb-3",
|
|
27653
|
+
children: error
|
|
27654
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
27655
|
+
title: "Retry",
|
|
27656
|
+
bgColor: "bg-gray-700",
|
|
27657
|
+
hoverBackgroundColor: "hover:bg-gray-600",
|
|
27658
|
+
textSize: "text-sm",
|
|
27659
|
+
padding: "py-1 px-3",
|
|
27660
|
+
onClick: retry
|
|
27661
|
+
})]
|
|
27662
|
+
});
|
|
27663
|
+
} else if (packages.length === 0) {
|
|
27664
|
+
listBody = /*#__PURE__*/jsx("div", {
|
|
27665
|
+
className: "px-4 py-8 text-center",
|
|
27666
|
+
children: /*#__PURE__*/jsx(Paragraph, {
|
|
27667
|
+
className: "text-sm opacity-50",
|
|
27668
|
+
children: searchQuery ? "No dashboards match your search." : "No dashboard packages available."
|
|
27669
|
+
})
|
|
27670
|
+
});
|
|
27671
|
+
} else {
|
|
27672
|
+
listBody = /*#__PURE__*/jsx("div", {
|
|
27673
|
+
className: "space-y-1",
|
|
27674
|
+
children: packages.map(function (pkg) {
|
|
27675
|
+
var widgetCount = (pkg.widgets || []).length;
|
|
27676
|
+
return /*#__PURE__*/jsx(Sidebar.Item, {
|
|
27677
|
+
icon: /*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
27678
|
+
icon: pkg.icon || "clone",
|
|
27679
|
+
className: "h-3.5 w-3.5"
|
|
27680
|
+
}),
|
|
27681
|
+
onClick: function onClick() {
|
|
27682
|
+
return setSelectedPackageName(pkg.name);
|
|
27683
|
+
},
|
|
27684
|
+
badge: widgetCount > 0 ? "".concat(widgetCount) : undefined,
|
|
27685
|
+
children: pkg.displayName || pkg.name
|
|
27686
|
+
}, pkg.name);
|
|
27687
|
+
})
|
|
27688
|
+
});
|
|
27689
|
+
}
|
|
27690
|
+
return /*#__PURE__*/jsxs("div", {
|
|
27691
|
+
className: "flex flex-col flex-1 min-h-0 ".concat(panelStyles.textColor || "text-gray-200"),
|
|
27692
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
27693
|
+
className: "flex-shrink-0 px-4 pt-4",
|
|
27694
|
+
children: /*#__PURE__*/jsxs("button", {
|
|
27695
|
+
type: "button",
|
|
27696
|
+
onClick: onBack,
|
|
27697
|
+
className: "flex items-center gap-1.5 text-sm opacity-60 hover:opacity-100 transition-opacity",
|
|
27698
|
+
children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
27699
|
+
icon: "arrow-left",
|
|
27700
|
+
className: "h-3 w-3"
|
|
27701
|
+
}), /*#__PURE__*/jsx("span", {
|
|
27702
|
+
children: "Back"
|
|
27703
|
+
})]
|
|
27704
|
+
})
|
|
27705
|
+
}), /*#__PURE__*/jsx("div", {
|
|
27706
|
+
className: "flex-shrink-0 px-4 py-3",
|
|
27707
|
+
children: /*#__PURE__*/jsx(SearchInput, {
|
|
27708
|
+
value: searchQuery,
|
|
27709
|
+
onChange: setSearchQuery,
|
|
27710
|
+
placeholder: "Search dashboards...",
|
|
27711
|
+
inputClassName: "py-1.5 text-xs"
|
|
27712
|
+
})
|
|
27713
|
+
}), /*#__PURE__*/jsx("div", {
|
|
27714
|
+
className: "flex-1 min-h-0 overflow-y-auto px-2",
|
|
27715
|
+
children: listBody
|
|
27716
|
+
}), !isLoading && !error && packages.length > 0 && /*#__PURE__*/jsxs("div", {
|
|
27717
|
+
className: "flex-shrink-0 px-4 py-2 text-[10px] opacity-40 border-t border-white/10",
|
|
27718
|
+
children: [packages.length, " dashboard", packages.length !== 1 ? "s" : ""]
|
|
27719
|
+
})]
|
|
27720
|
+
});
|
|
27721
|
+
};
|
|
27722
|
+
|
|
27723
|
+
function ownKeys$7(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; }
|
|
27724
|
+
function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
27725
|
+
var DashboardsSection = function DashboardsSection(_ref) {
|
|
27726
|
+
var _ref$workspaces = _ref.workspaces,
|
|
27727
|
+
workspaces = _ref$workspaces === void 0 ? [] : _ref$workspaces,
|
|
27728
|
+
_ref$menuItems = _ref.menuItems,
|
|
26591
27729
|
menuItems = _ref$menuItems === void 0 ? [] : _ref$menuItems,
|
|
26592
27730
|
_ref$dashApi = _ref.dashApi,
|
|
26593
27731
|
dashApi = _ref$dashApi === void 0 ? null : _ref$dashApi,
|
|
26594
27732
|
_ref$credentials = _ref.credentials,
|
|
26595
27733
|
credentials = _ref$credentials === void 0 ? null : _ref$credentials,
|
|
26596
27734
|
_ref$onReloadWorkspac = _ref.onReloadWorkspaces,
|
|
26597
|
-
onReloadWorkspaces = _ref$onReloadWorkspac === void 0 ? null : _ref$onReloadWorkspac
|
|
27735
|
+
onReloadWorkspaces = _ref$onReloadWorkspac === void 0 ? null : _ref$onReloadWorkspac,
|
|
27736
|
+
_ref$createRequested = _ref.createRequested,
|
|
27737
|
+
createRequested = _ref$createRequested === void 0 ? false : _ref$createRequested,
|
|
27738
|
+
_ref$onCreateAcknowle = _ref.onCreateAcknowledged,
|
|
27739
|
+
onCreateAcknowledged = _ref$onCreateAcknowle === void 0 ? null : _ref$onCreateAcknowle;
|
|
26598
27740
|
var _useState = useState(null),
|
|
26599
27741
|
_useState2 = _slicedToArray(_useState, 2),
|
|
26600
27742
|
selectedId = _useState2[0],
|
|
@@ -26619,6 +27761,15 @@ var DashboardsSection = function DashboardsSection(_ref) {
|
|
|
26619
27761
|
_useState10 = _slicedToArray(_useState1, 2),
|
|
26620
27762
|
viewMode = _useState10[0],
|
|
26621
27763
|
setViewMode = _useState10[1];
|
|
27764
|
+
// null | "marketplace" | "import-result"
|
|
27765
|
+
var _useState11 = useState(null),
|
|
27766
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
27767
|
+
installMode = _useState12[0],
|
|
27768
|
+
setInstallMode = _useState12[1];
|
|
27769
|
+
var _useState13 = useState(null),
|
|
27770
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
27771
|
+
importResult = _useState14[0],
|
|
27772
|
+
setImportResult = _useState14[1];
|
|
26622
27773
|
var appId = credentials === null || credentials === void 0 ? void 0 : credentials.appId;
|
|
26623
27774
|
var _useContext = useContext(ThemeContext),
|
|
26624
27775
|
currentTheme = _useContext.currentTheme;
|
|
@@ -26698,6 +27849,84 @@ var DashboardsSection = function DashboardsSection(_ref) {
|
|
|
26698
27849
|
setDeleteTarget(null);
|
|
26699
27850
|
});
|
|
26700
27851
|
}
|
|
27852
|
+
|
|
27853
|
+
// Respond to external create trigger from header button (marketplace)
|
|
27854
|
+
var prevCreateRequested = useRef(false);
|
|
27855
|
+
useEffect(function () {
|
|
27856
|
+
if (createRequested && !prevCreateRequested.current) {
|
|
27857
|
+
setSelectedId(null);
|
|
27858
|
+
setInstallMode("marketplace");
|
|
27859
|
+
setImportResult(null);
|
|
27860
|
+
}
|
|
27861
|
+
prevCreateRequested.current = createRequested;
|
|
27862
|
+
if (createRequested && onCreateAcknowledged) {
|
|
27863
|
+
onCreateAcknowledged();
|
|
27864
|
+
}
|
|
27865
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
27866
|
+
}, [createRequested]);
|
|
27867
|
+
function handleImport() {
|
|
27868
|
+
return _handleImport.apply(this, arguments);
|
|
27869
|
+
}
|
|
27870
|
+
function _handleImport() {
|
|
27871
|
+
_handleImport = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
27872
|
+
var result, _result$workspace, _t;
|
|
27873
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
27874
|
+
while (1) switch (_context.prev = _context.next) {
|
|
27875
|
+
case 0:
|
|
27876
|
+
if (appId) {
|
|
27877
|
+
_context.next = 1;
|
|
27878
|
+
break;
|
|
27879
|
+
}
|
|
27880
|
+
return _context.abrupt("return");
|
|
27881
|
+
case 1:
|
|
27882
|
+
setInstallMode("import-result");
|
|
27883
|
+
setImportResult({
|
|
27884
|
+
status: "loading",
|
|
27885
|
+
message: "Importing dashboard..."
|
|
27886
|
+
});
|
|
27887
|
+
_context.prev = 2;
|
|
27888
|
+
_context.next = 3;
|
|
27889
|
+
return window.mainApi.dashboardConfig.importDashboardConfig(appId);
|
|
27890
|
+
case 3:
|
|
27891
|
+
result = _context.sent;
|
|
27892
|
+
if (result) {
|
|
27893
|
+
_context.next = 4;
|
|
27894
|
+
break;
|
|
27895
|
+
}
|
|
27896
|
+
// User cancelled the file picker
|
|
27897
|
+
setInstallMode(null);
|
|
27898
|
+
setImportResult(null);
|
|
27899
|
+
return _context.abrupt("return");
|
|
27900
|
+
case 4:
|
|
27901
|
+
if (result.success) {
|
|
27902
|
+
setImportResult({
|
|
27903
|
+
status: "success",
|
|
27904
|
+
message: "Dashboard \"".concat(((_result$workspace = result.workspace) === null || _result$workspace === void 0 ? void 0 : _result$workspace.name) || "Untitled", "\" imported successfully.")
|
|
27905
|
+
});
|
|
27906
|
+
onReloadWorkspaces && onReloadWorkspaces();
|
|
27907
|
+
} else {
|
|
27908
|
+
setImportResult({
|
|
27909
|
+
status: "error",
|
|
27910
|
+
message: result.error || "Import failed."
|
|
27911
|
+
});
|
|
27912
|
+
}
|
|
27913
|
+
_context.next = 6;
|
|
27914
|
+
break;
|
|
27915
|
+
case 5:
|
|
27916
|
+
_context.prev = 5;
|
|
27917
|
+
_t = _context["catch"](2);
|
|
27918
|
+
setImportResult({
|
|
27919
|
+
status: "error",
|
|
27920
|
+
message: _t.message || "Failed to import dashboard."
|
|
27921
|
+
});
|
|
27922
|
+
case 6:
|
|
27923
|
+
case "end":
|
|
27924
|
+
return _context.stop();
|
|
27925
|
+
}
|
|
27926
|
+
}, _callee, null, [[2, 5]]);
|
|
27927
|
+
}));
|
|
27928
|
+
return _handleImport.apply(this, arguments);
|
|
27929
|
+
}
|
|
26701
27930
|
var selectedWorkspace = workspaces.find(function (ws) {
|
|
26702
27931
|
return ws.id === selectedId;
|
|
26703
27932
|
});
|
|
@@ -26747,13 +27976,33 @@ var DashboardsSection = function DashboardsSection(_ref) {
|
|
|
26747
27976
|
className: "flex flex-col h-full",
|
|
26748
27977
|
children: [/*#__PURE__*/jsxs("div", {
|
|
26749
27978
|
className: "flex-shrink-0 flex flex-col gap-2 px-3 pt-3 pb-2 ".concat(headerStyles.backgroundColor || ""),
|
|
26750
|
-
children: [/*#__PURE__*/
|
|
26751
|
-
|
|
26752
|
-
|
|
26753
|
-
|
|
27979
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
27980
|
+
className: "flex items-center gap-2",
|
|
27981
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
27982
|
+
className: "flex-1",
|
|
27983
|
+
children: /*#__PURE__*/jsx(SearchInput, {
|
|
27984
|
+
value: searchQuery,
|
|
27985
|
+
onChange: setSearchQuery,
|
|
27986
|
+
placeholder: "Search dashboards..."
|
|
27987
|
+
})
|
|
27988
|
+
}), /*#__PURE__*/jsx(ButtonIcon, {
|
|
27989
|
+
icon: "file-import",
|
|
27990
|
+
onClick: handleImport,
|
|
27991
|
+
size: "sm",
|
|
27992
|
+
title: "Import dashboard"
|
|
27993
|
+
})]
|
|
26754
27994
|
}), /*#__PURE__*/jsx(Tabs3, {
|
|
26755
|
-
value: viewMode,
|
|
26756
|
-
onValueChange:
|
|
27995
|
+
value: installMode === "marketplace" ? "marketplace" : viewMode,
|
|
27996
|
+
onValueChange: function onValueChange(val) {
|
|
27997
|
+
if (val === "marketplace") {
|
|
27998
|
+
setInstallMode("marketplace");
|
|
27999
|
+
setSelectedId(null);
|
|
28000
|
+
} else {
|
|
28001
|
+
setInstallMode(null);
|
|
28002
|
+
setImportResult(null);
|
|
28003
|
+
setViewMode(val);
|
|
28004
|
+
}
|
|
28005
|
+
},
|
|
26757
28006
|
backgroundColor: "bg-transparent",
|
|
26758
28007
|
spacing: "p-0",
|
|
26759
28008
|
children: /*#__PURE__*/jsxs(Tabs3.List, {
|
|
@@ -26767,6 +28016,10 @@ var DashboardsSection = function DashboardsSection(_ref) {
|
|
|
26767
28016
|
value: "alphabetical",
|
|
26768
28017
|
className: "flex-1",
|
|
26769
28018
|
children: "A-Z"
|
|
28019
|
+
}), /*#__PURE__*/jsx(Tabs3.Trigger, {
|
|
28020
|
+
value: "marketplace",
|
|
28021
|
+
className: "flex-1",
|
|
28022
|
+
children: "Marketplace"
|
|
26770
28023
|
})]
|
|
26771
28024
|
})
|
|
26772
28025
|
})]
|
|
@@ -26780,26 +28033,68 @@ var DashboardsSection = function DashboardsSection(_ref) {
|
|
|
26780
28033
|
})
|
|
26781
28034
|
})]
|
|
26782
28035
|
});
|
|
26783
|
-
var detailContent =
|
|
26784
|
-
|
|
26785
|
-
|
|
26786
|
-
|
|
26787
|
-
|
|
26788
|
-
|
|
26789
|
-
|
|
26790
|
-
|
|
26791
|
-
|
|
26792
|
-
|
|
26793
|
-
|
|
26794
|
-
|
|
26795
|
-
|
|
26796
|
-
|
|
26797
|
-
|
|
26798
|
-
|
|
26799
|
-
|
|
26800
|
-
|
|
26801
|
-
|
|
26802
|
-
|
|
28036
|
+
var detailContent = null;
|
|
28037
|
+
if (installMode === "marketplace") {
|
|
28038
|
+
detailContent = /*#__PURE__*/jsx(DiscoverDashboardsDetail, {
|
|
28039
|
+
onBack: function onBack() {
|
|
28040
|
+
setInstallMode(null);
|
|
28041
|
+
setViewMode("grouped");
|
|
28042
|
+
},
|
|
28043
|
+
appId: appId
|
|
28044
|
+
});
|
|
28045
|
+
} else if (installMode === "import-result") {
|
|
28046
|
+
detailContent = /*#__PURE__*/jsxs("div", {
|
|
28047
|
+
className: "flex flex-col flex-1 min-h-0 p-6 space-y-4",
|
|
28048
|
+
children: [(importResult === null || importResult === void 0 ? void 0 : importResult.status) === "loading" && /*#__PURE__*/jsxs("div", {
|
|
28049
|
+
className: "flex items-center gap-3",
|
|
28050
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
28051
|
+
className: "animate-spin rounded-full h-5 w-5 border-b-2 border-blue-500"
|
|
28052
|
+
}), /*#__PURE__*/jsx("span", {
|
|
28053
|
+
className: "text-sm opacity-70",
|
|
28054
|
+
children: importResult.message
|
|
28055
|
+
})]
|
|
28056
|
+
}), (importResult === null || importResult === void 0 ? void 0 : importResult.status) === "success" && /*#__PURE__*/jsxs("div", {
|
|
28057
|
+
className: "flex items-center gap-2",
|
|
28058
|
+
children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
28059
|
+
icon: "circle-check",
|
|
28060
|
+
className: "h-4 w-4 text-green-400"
|
|
28061
|
+
}), /*#__PURE__*/jsx("span", {
|
|
28062
|
+
className: "text-sm",
|
|
28063
|
+
children: importResult.message
|
|
28064
|
+
})]
|
|
28065
|
+
}), (importResult === null || importResult === void 0 ? void 0 : importResult.status) === "error" && /*#__PURE__*/jsxs("div", {
|
|
28066
|
+
className: "flex items-center gap-2",
|
|
28067
|
+
children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
28068
|
+
icon: "circle-xmark",
|
|
28069
|
+
className: "h-4 w-4 text-red-400"
|
|
28070
|
+
}), /*#__PURE__*/jsx("span", {
|
|
28071
|
+
className: "text-sm text-red-400",
|
|
28072
|
+
children: importResult.message
|
|
28073
|
+
})]
|
|
28074
|
+
})]
|
|
28075
|
+
});
|
|
28076
|
+
} else if (selectedWorkspace) {
|
|
28077
|
+
detailContent = /*#__PURE__*/jsx(DashboardDetail, {
|
|
28078
|
+
workspace: selectedWorkspace,
|
|
28079
|
+
menuItems: menuItems,
|
|
28080
|
+
editingId: editingId,
|
|
28081
|
+
editName: editName,
|
|
28082
|
+
setEditName: setEditName,
|
|
28083
|
+
onStartRename: handleStartRename,
|
|
28084
|
+
onSaveRename: handleSaveRename,
|
|
28085
|
+
onCancelRename: function onCancelRename() {
|
|
28086
|
+
setEditingId(null);
|
|
28087
|
+
setEditName("");
|
|
28088
|
+
},
|
|
28089
|
+
onDuplicate: handleDuplicate,
|
|
28090
|
+
onDelete: function onDelete(ws) {
|
|
28091
|
+
return setDeleteTarget(ws);
|
|
28092
|
+
},
|
|
28093
|
+
dashApi: dashApi,
|
|
28094
|
+
credentials: credentials,
|
|
28095
|
+
onReloadWorkspaces: onReloadWorkspaces
|
|
28096
|
+
});
|
|
28097
|
+
}
|
|
26803
28098
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
26804
28099
|
children: [/*#__PURE__*/jsx(SectionLayout, {
|
|
26805
28100
|
listContent: listContent,
|
|
@@ -32130,9 +33425,9 @@ var AppSettingsModal = function AppSettingsModal(_ref) {
|
|
|
32130
33425
|
children: [/*#__PURE__*/jsx(SubHeading2, {
|
|
32131
33426
|
title: activeDef.label,
|
|
32132
33427
|
padding: false
|
|
32133
|
-
}), (activeSection === "folders" || activeSection === "providers" || activeSection === "themes" || activeSection === "widgets") && /*#__PURE__*/jsx(ButtonIcon3, {
|
|
33428
|
+
}), (activeSection === "dashboards" || activeSection === "folders" || activeSection === "providers" || activeSection === "themes" || activeSection === "widgets") && /*#__PURE__*/jsx(ButtonIcon3, {
|
|
32134
33429
|
icon: "plus",
|
|
32135
|
-
text: activeSection === "folders" ? "New Folder" : activeSection === "providers" ? "New Provider" : activeSection === "widgets" ? "Install Widgets" : "New Theme",
|
|
33430
|
+
text: activeSection === "dashboards" ? "Marketplace" : activeSection === "folders" ? "New Folder" : activeSection === "providers" ? "New Provider" : activeSection === "widgets" ? "Install Widgets" : "New Theme",
|
|
32136
33431
|
onClick: function onClick() {
|
|
32137
33432
|
return setCreateRequested(true);
|
|
32138
33433
|
},
|
|
@@ -32149,7 +33444,11 @@ var AppSettingsModal = function AppSettingsModal(_ref) {
|
|
|
32149
33444
|
menuItems: menuItems,
|
|
32150
33445
|
dashApi: dashApi,
|
|
32151
33446
|
credentials: credentials,
|
|
32152
|
-
onReloadWorkspaces: onReloadWorkspaces
|
|
33447
|
+
onReloadWorkspaces: onReloadWorkspaces,
|
|
33448
|
+
createRequested: createRequested,
|
|
33449
|
+
onCreateAcknowledged: function onCreateAcknowledged() {
|
|
33450
|
+
return setCreateRequested(false);
|
|
33451
|
+
}
|
|
32153
33452
|
}), activeSection === "folders" && /*#__PURE__*/jsx(FoldersSection, {
|
|
32154
33453
|
menuItems: menuItems,
|
|
32155
33454
|
workspaces: workspaces,
|