@trops/dash-core 0.1.116 → 0.1.117

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -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, SearchInput, ButtonIcon, SubHeading3, InputText, Button, FontAwesomeIcon, Tag, Modal, Panel, Stepper, Paragraph, Heading3, MenuItem3, FormLabel, SelectMenu, Switch, 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, 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';
3
+ import { isObject, ThemeContext, deepCopy, MainSection, getUUID, getStylesForItem, themeObjects, Heading, SearchInput, ButtonIcon, SubHeading3, InputText, Button, FontAwesomeIcon, Tag, Sidebar, Paragraph, Modal, Panel, Stepper, Heading3, MenuItem3, FormLabel, SelectMenu, Switch, CodeEditorInline, 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, 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';
@@ -13,13 +13,13 @@ import _createClass from '@babel/runtime/helpers/createClass';
13
13
  import * as jsxRuntime from 'react/jsx-runtime';
14
14
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
15
15
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
16
+ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
17
+ import _regeneratorRuntime from '@babel/runtime/regenerator';
16
18
  import { Menu, Transition, Popover, Dialog, Disclosure } from '@headlessui/react';
17
19
  import { EllipsisVerticalIcon } from '@heroicons/react/20/solid';
18
20
  import clsx from 'clsx';
19
21
  import { DndProvider, useDrag, useDrop } from 'react-dnd';
20
22
  import { HTML5Backend } from 'react-dnd-html5-backend';
21
- import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
22
- import _regeneratorRuntime from '@babel/runtime/regenerator';
23
23
  import _possibleConstructorReturn from '@babel/runtime/helpers/possibleConstructorReturn';
24
24
  import _getPrototypeOf from '@babel/runtime/helpers/getPrototypeOf';
25
25
  import _inherits from '@babel/runtime/helpers/inherits';
@@ -3272,6 +3272,642 @@ var FolderDetail = function FolderDetail(_ref) {
3272
3272
  });
3273
3273
  };
3274
3274
 
3275
+ var OptionCard$1 = function OptionCard(_ref) {
3276
+ var icon = _ref.icon,
3277
+ title = _ref.title,
3278
+ description = _ref.description,
3279
+ onClick = _ref.onClick;
3280
+ return /*#__PURE__*/jsxs("button", {
3281
+ type: "button",
3282
+ onClick: onClick,
3283
+ className: "w-full flex flex-row items-center gap-4 p-4 rounded-lg text-left transition-all bg-gray-700/50 hover:bg-gray-700 hover:ring-1 hover:ring-gray-600",
3284
+ children: [/*#__PURE__*/jsx("div", {
3285
+ className: "flex-shrink-0 h-8 w-8 flex items-center justify-center text-gray-400",
3286
+ children: /*#__PURE__*/jsx(FontAwesomeIcon, {
3287
+ icon: icon,
3288
+ className: "h-5 w-5"
3289
+ })
3290
+ }), /*#__PURE__*/jsxs("div", {
3291
+ className: "flex flex-col min-w-0",
3292
+ children: [/*#__PURE__*/jsx("span", {
3293
+ className: "text-sm font-medium text-gray-200",
3294
+ children: title
3295
+ }), /*#__PURE__*/jsx("span", {
3296
+ className: "text-xs text-gray-500 mt-0.5",
3297
+ children: description
3298
+ })]
3299
+ }), /*#__PURE__*/jsx("div", {
3300
+ className: "flex-shrink-0 ml-auto text-gray-600",
3301
+ children: /*#__PURE__*/jsx(FontAwesomeIcon, {
3302
+ icon: "chevron-right",
3303
+ className: "h-3 w-3"
3304
+ })
3305
+ })]
3306
+ });
3307
+ };
3308
+ var CreationMethodPicker = function CreationMethodPicker(_ref2) {
3309
+ var onSelect = _ref2.onSelect;
3310
+ return /*#__PURE__*/jsxs("div", {
3311
+ className: "flex flex-row w-full h-full",
3312
+ children: [/*#__PURE__*/jsxs("div", {
3313
+ className: "flex flex-col w-1/3 p-6 py-10 space-y-4 justify-start",
3314
+ children: [/*#__PURE__*/jsx(Heading, {
3315
+ title: "New Dashboard",
3316
+ padding: false,
3317
+ textColor: "text-gray-300"
3318
+ }), /*#__PURE__*/jsx("p", {
3319
+ className: "text-base font-normal text-gray-400",
3320
+ children: "Choose how you'd like to create your new dashboard."
3321
+ })]
3322
+ }), /*#__PURE__*/jsxs("div", {
3323
+ className: "flex flex-col w-2/3 p-6 pt-10 space-y-3",
3324
+ children: [/*#__PURE__*/jsx(OptionCard$1, {
3325
+ icon: "plus",
3326
+ title: "New Dashboard",
3327
+ description: "Start from a blank template and customize your layout",
3328
+ onClick: function onClick() {
3329
+ return onSelect("template");
3330
+ }
3331
+ }), /*#__PURE__*/jsx(OptionCard$1, {
3332
+ icon: "file-zipper",
3333
+ title: "Import from File",
3334
+ description: "Import a dashboard from a .zip file on your computer",
3335
+ onClick: function onClick() {
3336
+ return onSelect("import");
3337
+ }
3338
+ }), /*#__PURE__*/jsx(OptionCard$1, {
3339
+ icon: "compass",
3340
+ title: "Search Registry",
3341
+ description: "Browse and install dashboards from the online registry",
3342
+ onClick: function onClick() {
3343
+ return onSelect("registry");
3344
+ }
3345
+ })]
3346
+ })]
3347
+ });
3348
+ };
3349
+
3350
+ var StarRating = function StarRating(_ref) {
3351
+ var appId = _ref.appId,
3352
+ packageName = _ref.packageName,
3353
+ _ref$interactive = _ref.interactive,
3354
+ interactive = _ref$interactive === void 0 ? true : _ref$interactive;
3355
+ var _useContext = useContext(ThemeContext),
3356
+ currentTheme = _useContext.currentTheme;
3357
+ var _useState = useState(0),
3358
+ _useState2 = _slicedToArray(_useState, 2),
3359
+ rating = _useState2[0],
3360
+ setRating = _useState2[1];
3361
+ var _useState3 = useState(0),
3362
+ _useState4 = _slicedToArray(_useState3, 2),
3363
+ hoverRating = _useState4[0],
3364
+ setHoverRating = _useState4[1];
3365
+ var _useState5 = useState(true),
3366
+ _useState6 = _slicedToArray(_useState5, 2),
3367
+ loading = _useState6[0],
3368
+ setLoading = _useState6[1];
3369
+ useEffect(function () {
3370
+ var _window$mainApi;
3371
+ if (!appId || !packageName) return;
3372
+ var cancelled = false;
3373
+ setLoading(true);
3374
+ (_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) {
3375
+ if (!cancelled && result !== null && result !== void 0 && result.rating) {
3376
+ setRating(result.rating);
3377
+ }
3378
+ })["catch"](function () {})["finally"](function () {
3379
+ if (!cancelled) setLoading(false);
3380
+ });
3381
+ return function () {
3382
+ cancelled = true;
3383
+ };
3384
+ }, [appId, packageName]);
3385
+ function handleClick(_x) {
3386
+ return _handleClick.apply(this, arguments);
3387
+ }
3388
+ function _handleClick() {
3389
+ _handleClick = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(value) {
3390
+ var newRating, _window$mainApi2;
3391
+ return _regeneratorRuntime.wrap(function (_context) {
3392
+ while (1) switch (_context.prev = _context.next) {
3393
+ case 0:
3394
+ if (!(!interactive || !appId || !packageName)) {
3395
+ _context.next = 1;
3396
+ break;
3397
+ }
3398
+ return _context.abrupt("return");
3399
+ case 1:
3400
+ newRating = value === rating ? 0 : value;
3401
+ setRating(newRating);
3402
+ _context.prev = 2;
3403
+ _context.next = 3;
3404
+ 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);
3405
+ case 3:
3406
+ _context.next = 5;
3407
+ break;
3408
+ case 4:
3409
+ _context.prev = 4;
3410
+ _context["catch"](2);
3411
+ case 5:
3412
+ case "end":
3413
+ return _context.stop();
3414
+ }
3415
+ }, _callee, null, [[2, 4]]);
3416
+ }));
3417
+ return _handleClick.apply(this, arguments);
3418
+ }
3419
+ if (loading) return null;
3420
+ var displayRating = hoverRating || rating;
3421
+ return /*#__PURE__*/jsx("div", {
3422
+ className: "flex items-center gap-0.5",
3423
+ onMouseLeave: function onMouseLeave() {
3424
+ return setHoverRating(0);
3425
+ },
3426
+ children: [1, 2, 3, 4, 5].map(function (star) {
3427
+ return /*#__PURE__*/jsx("button", {
3428
+ type: "button",
3429
+ disabled: !interactive,
3430
+ onClick: function onClick() {
3431
+ return handleClick(star);
3432
+ },
3433
+ onMouseEnter: function onMouseEnter() {
3434
+ return interactive && setHoverRating(star);
3435
+ },
3436
+ className: "p-0.5 transition-colors ".concat(interactive ? "cursor-pointer hover:scale-110" : "cursor-default"),
3437
+ children: /*#__PURE__*/jsx(FontAwesomeIcon, {
3438
+ icon: star <= displayRating ? "star" : ["far", "star"],
3439
+ className: "h-3.5 w-3.5 ".concat(star <= displayRating ? "text-yellow-400" : currentTheme["text-primary-medium"] || "text-gray-500")
3440
+ })
3441
+ }, star);
3442
+ })
3443
+ });
3444
+ };
3445
+
3446
+ var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
3447
+ var dashboardPackage = _ref.dashboardPackage,
3448
+ appId = _ref.appId;
3449
+ var _useContext = useContext(ThemeContext),
3450
+ currentTheme = _useContext.currentTheme;
3451
+ var panelStyles = getStylesForItem(themeObjects.PANEL, currentTheme, {
3452
+ grow: false
3453
+ });
3454
+ var _useState = useState(null),
3455
+ _useState2 = _slicedToArray(_useState, 2),
3456
+ preview = _useState2[0],
3457
+ setPreview = _useState2[1];
3458
+ var _useState3 = useState(false),
3459
+ _useState4 = _slicedToArray(_useState3, 2),
3460
+ previewLoading = _useState4[0],
3461
+ setPreviewLoading = _useState4[1];
3462
+ var _useState5 = useState(false),
3463
+ _useState6 = _slicedToArray(_useState5, 2),
3464
+ isInstalling = _useState6[0],
3465
+ setIsInstalling = _useState6[1];
3466
+ var _useState7 = useState(null),
3467
+ _useState8 = _slicedToArray(_useState7, 2),
3468
+ installResult = _useState8[0],
3469
+ setInstallResult = _useState8[1];
3470
+ var pkg = dashboardPackage;
3471
+ if (!pkg) return null;
3472
+
3473
+ // Load preview data on mount
3474
+ // eslint-disable-next-line react-hooks/rules-of-hooks
3475
+ useEffect(function () {
3476
+ var _window$mainApi;
3477
+ if (!pkg.name) return;
3478
+ var cancelled = false;
3479
+ setPreviewLoading(true);
3480
+ setPreview(null);
3481
+ setInstallResult(null);
3482
+ (_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) {
3483
+ if (!cancelled) setPreview(result);
3484
+ })["catch"](function (err) {
3485
+ })["finally"](function () {
3486
+ if (!cancelled) setPreviewLoading(false);
3487
+ });
3488
+ return function () {
3489
+ cancelled = true;
3490
+ };
3491
+ }, [pkg.name]);
3492
+ function handleInstall() {
3493
+ return _handleInstall.apply(this, arguments);
3494
+ }
3495
+ function _handleInstall() {
3496
+ _handleInstall = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
3497
+ var _result$workspace, result, _t;
3498
+ return _regeneratorRuntime.wrap(function (_context) {
3499
+ while (1) switch (_context.prev = _context.next) {
3500
+ case 0:
3501
+ if (!(!appId || !pkg.name)) {
3502
+ _context.next = 1;
3503
+ break;
3504
+ }
3505
+ return _context.abrupt("return");
3506
+ case 1:
3507
+ setIsInstalling(true);
3508
+ setInstallResult(null);
3509
+ _context.prev = 2;
3510
+ _context.next = 3;
3511
+ return window.mainApi.dashboardConfig.installDashboardFromRegistry(appId, pkg.name);
3512
+ case 3:
3513
+ result = _context.sent;
3514
+ setInstallResult({
3515
+ status: result !== null && result !== void 0 && result.success ? "success" : "error",
3516
+ 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."
3517
+ });
3518
+ _context.next = 5;
3519
+ break;
3520
+ case 4:
3521
+ _context.prev = 4;
3522
+ _t = _context["catch"](2);
3523
+ setInstallResult({
3524
+ status: "error",
3525
+ message: _t.message || "Failed to install dashboard."
3526
+ });
3527
+ case 5:
3528
+ _context.prev = 5;
3529
+ setIsInstalling(false);
3530
+ return _context.finish(5);
3531
+ case 6:
3532
+ case "end":
3533
+ return _context.stop();
3534
+ }
3535
+ }, _callee, null, [[2, 4, 5, 6]]);
3536
+ }));
3537
+ return _handleInstall.apply(this, arguments);
3538
+ }
3539
+ var compatibility = preview === null || preview === void 0 ? void 0 : preview.compatibility;
3540
+ var widgetDeps = (preview === null || preview === void 0 ? void 0 : preview.widgets) || pkg.widgets || [];
3541
+ var providers = (preview === null || preview === void 0 ? void 0 : preview.providers) || [];
3542
+ var wiring = (preview === null || preview === void 0 ? void 0 : preview.wiring) || [];
3543
+ function getCompatIcon(status) {
3544
+ if (status === "installed") return {
3545
+ icon: "circle-check",
3546
+ color: "text-green-400"
3547
+ };
3548
+ if (status === "available") return {
3549
+ icon: "circle-down",
3550
+ color: "text-blue-400"
3551
+ };
3552
+ return {
3553
+ icon: "circle-xmark",
3554
+ color: "text-red-400"
3555
+ };
3556
+ }
3557
+ return /*#__PURE__*/jsxs("div", {
3558
+ className: "flex flex-col flex-1 min-h-0",
3559
+ children: [/*#__PURE__*/jsxs("div", {
3560
+ className: "flex-1 min-h-0 overflow-y-auto p-6 space-y-6 ".concat(panelStyles.textColor || "text-gray-200"),
3561
+ children: [/*#__PURE__*/jsxs("div", {
3562
+ className: "flex flex-row items-center gap-3",
3563
+ children: [/*#__PURE__*/jsx("div", {
3564
+ className: "h-5 w-5 flex-shrink-0 flex items-center justify-center",
3565
+ children: /*#__PURE__*/jsx(FontAwesomeIcon, {
3566
+ icon: pkg.icon || "clone",
3567
+ className: "h-5 w-5"
3568
+ })
3569
+ }), /*#__PURE__*/jsxs("div", {
3570
+ children: [/*#__PURE__*/jsx(SubHeading3, {
3571
+ title: pkg.displayName || pkg.name,
3572
+ padding: false
3573
+ }), /*#__PURE__*/jsxs("div", {
3574
+ className: "flex items-center gap-2 mt-0.5",
3575
+ children: [/*#__PURE__*/jsxs("span", {
3576
+ className: "text-sm opacity-60",
3577
+ children: ["by ", pkg.author || "Unknown"]
3578
+ }), pkg.version && /*#__PURE__*/jsxs("span", {
3579
+ className: "text-xs px-2 py-0.5 rounded ".concat(currentTheme["bg-primary-medium"], " opacity-70"),
3580
+ children: ["v", pkg.version]
3581
+ })]
3582
+ })]
3583
+ })]
3584
+ }), appId && /*#__PURE__*/jsx(StarRating, {
3585
+ appId: appId,
3586
+ packageName: pkg.name,
3587
+ interactive: false
3588
+ }), /*#__PURE__*/jsx("hr", {
3589
+ className: currentTheme["border-primary-medium"]
3590
+ }), pkg.description && /*#__PURE__*/jsx("p", {
3591
+ className: "text-sm",
3592
+ children: pkg.description
3593
+ }), pkg.tags && pkg.tags.length > 0 && /*#__PURE__*/jsx("div", {
3594
+ className: "flex flex-wrap gap-1",
3595
+ children: pkg.tags.map(function (tag) {
3596
+ return /*#__PURE__*/jsx("span", {
3597
+ className: "text-xs px-2 py-0.5 rounded ".concat(currentTheme["bg-primary-medium"], " opacity-60"),
3598
+ children: tag
3599
+ }, tag);
3600
+ })
3601
+ }), /*#__PURE__*/jsxs("div", {
3602
+ children: [/*#__PURE__*/jsx("span", {
3603
+ className: "text-xs font-semibold opacity-50 mb-1 block",
3604
+ children: "REQUIRED WIDGETS"
3605
+ }), previewLoading ? /*#__PURE__*/jsxs("div", {
3606
+ className: "flex items-center gap-2 py-2",
3607
+ children: [/*#__PURE__*/jsx("div", {
3608
+ className: "animate-spin rounded-full h-4 w-4 border-b-2 border-blue-500"
3609
+ }), /*#__PURE__*/jsx("span", {
3610
+ className: "text-xs opacity-50",
3611
+ children: "Checking compatibility..."
3612
+ })]
3613
+ }) : /*#__PURE__*/jsx("div", {
3614
+ className: "space-y-1.5",
3615
+ children: widgetDeps.map(function (w, idx) {
3616
+ var _compatibility$widget;
3617
+ 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";
3618
+ var compat = getCompatIcon(status);
3619
+ return /*#__PURE__*/jsxs("div", {
3620
+ className: "p-2 rounded ".concat(currentTheme["bg-primary-medium"], " flex items-center gap-2"),
3621
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
3622
+ icon: compat.icon,
3623
+ className: "h-3.5 w-3.5 ".concat(compat.color)
3624
+ }), /*#__PURE__*/jsx("span", {
3625
+ className: "text-sm",
3626
+ children: w.displayName || w.name || w.packageName
3627
+ }), /*#__PURE__*/jsx("span", {
3628
+ className: "text-xs opacity-40 ml-auto",
3629
+ children: status === "installed" ? "Installed" : status === "available" ? "Will install" : "Unavailable"
3630
+ })]
3631
+ }, idx);
3632
+ })
3633
+ })]
3634
+ }), providers.length > 0 && /*#__PURE__*/jsxs("div", {
3635
+ children: [/*#__PURE__*/jsx("span", {
3636
+ className: "text-xs font-semibold opacity-50 mb-1 block",
3637
+ children: "REQUIRED PROVIDERS"
3638
+ }), /*#__PURE__*/jsx("div", {
3639
+ className: "space-y-1",
3640
+ children: providers.map(function (p, idx) {
3641
+ return /*#__PURE__*/jsxs("div", {
3642
+ className: "flex items-center gap-2",
3643
+ children: [/*#__PURE__*/jsx("span", {
3644
+ className: "text-xs px-1.5 py-0.5 rounded bg-blue-900/30 text-blue-400",
3645
+ children: p.type
3646
+ }), p.required && /*#__PURE__*/jsx("span", {
3647
+ className: "text-[10px] opacity-40",
3648
+ children: "Required"
3649
+ })]
3650
+ }, idx);
3651
+ })
3652
+ })]
3653
+ }), wiring.length > 0 && /*#__PURE__*/jsxs("div", {
3654
+ children: [/*#__PURE__*/jsx("span", {
3655
+ className: "text-xs font-semibold opacity-50 mb-1 block",
3656
+ children: "EVENT WIRING"
3657
+ }), /*#__PURE__*/jsx("div", {
3658
+ className: "space-y-1",
3659
+ children: wiring.map(function (w, idx) {
3660
+ return /*#__PURE__*/jsxs("div", {
3661
+ className: "text-xs p-2 rounded ".concat(currentTheme["bg-primary-medium"], " opacity-70"),
3662
+ children: [/*#__PURE__*/jsx("span", {
3663
+ className: "font-medium",
3664
+ children: w.from || "Source"
3665
+ }), /*#__PURE__*/jsx(FontAwesomeIcon, {
3666
+ icon: "arrow-right",
3667
+ className: "h-2.5 w-2.5 mx-1.5 opacity-50"
3668
+ }), /*#__PURE__*/jsx("span", {
3669
+ className: "font-medium",
3670
+ children: w.to || "Target"
3671
+ }), w.event && /*#__PURE__*/jsxs("span", {
3672
+ className: "opacity-50 ml-1.5",
3673
+ children: ["(", w.event, ")"]
3674
+ })]
3675
+ }, idx);
3676
+ })
3677
+ })]
3678
+ }), installResult && /*#__PURE__*/jsx("div", {
3679
+ className: "p-2 rounded border ".concat(installResult.status === "success" ? "bg-green-900/20 border-green-700" : "bg-red-900/30 border-red-700"),
3680
+ children: /*#__PURE__*/jsxs("div", {
3681
+ className: "flex items-center gap-2",
3682
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
3683
+ icon: installResult.status === "success" ? "circle-check" : "circle-xmark",
3684
+ className: "h-4 w-4 ".concat(installResult.status === "success" ? "text-green-400" : "text-red-400")
3685
+ }), /*#__PURE__*/jsx("span", {
3686
+ className: "text-sm ".concat(installResult.status === "error" ? "text-red-400" : ""),
3687
+ children: installResult.message
3688
+ })]
3689
+ })
3690
+ })]
3691
+ }), (installResult === null || installResult === void 0 ? void 0 : installResult.status) !== "success" && /*#__PURE__*/jsx("div", {
3692
+ className: "flex items-center justify-end px-6 py-3 border-t ".concat(currentTheme["border-primary-medium"]),
3693
+ children: /*#__PURE__*/jsx(Button, {
3694
+ title: isInstalling ? "Installing..." : "Install Dashboard",
3695
+ bgColor: "bg-blue-600",
3696
+ hoverBackgroundColor: isInstalling ? "" : "hover:bg-blue-700",
3697
+ textSize: "text-sm",
3698
+ padding: "py-1.5 px-4",
3699
+ onClick: handleInstall,
3700
+ disabled: isInstalling
3701
+ })
3702
+ })]
3703
+ });
3704
+ };
3705
+
3706
+ var DiscoverDashboardsDetail = function DiscoverDashboardsDetail(_ref) {
3707
+ var onBack = _ref.onBack,
3708
+ appId = _ref.appId;
3709
+ var _useContext = useContext(ThemeContext),
3710
+ currentTheme = _useContext.currentTheme;
3711
+ var panelStyles = getStylesForItem(themeObjects.PANEL, currentTheme, {
3712
+ grow: false
3713
+ });
3714
+ var _useState = useState([]),
3715
+ _useState2 = _slicedToArray(_useState, 2),
3716
+ packages = _useState2[0],
3717
+ setPackages = _useState2[1];
3718
+ var _useState3 = useState(false),
3719
+ _useState4 = _slicedToArray(_useState3, 2),
3720
+ isLoading = _useState4[0],
3721
+ setIsLoading = _useState4[1];
3722
+ var _useState5 = useState(null),
3723
+ _useState6 = _slicedToArray(_useState5, 2),
3724
+ error = _useState6[0],
3725
+ setError = _useState6[1];
3726
+ var _useState7 = useState(""),
3727
+ _useState8 = _slicedToArray(_useState7, 2),
3728
+ searchQuery = _useState8[0],
3729
+ setSearchQuery = _useState8[1];
3730
+ var _useState9 = useState(null),
3731
+ _useState0 = _slicedToArray(_useState9, 2),
3732
+ selectedPackageName = _useState0[0],
3733
+ setSelectedPackageName = _useState0[1];
3734
+ var search = useCallback(/*#__PURE__*/function () {
3735
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(query) {
3736
+ var _window$mainApi;
3737
+ var result, _t;
3738
+ return _regeneratorRuntime.wrap(function (_context) {
3739
+ while (1) switch (_context.prev = _context.next) {
3740
+ case 0:
3741
+ if ((_window$mainApi = window.mainApi) !== null && _window$mainApi !== void 0 && (_window$mainApi = _window$mainApi.registry) !== null && _window$mainApi !== void 0 && _window$mainApi.searchDashboards) {
3742
+ _context.next = 1;
3743
+ break;
3744
+ }
3745
+ setPackages([]);
3746
+ return _context.abrupt("return");
3747
+ case 1:
3748
+ setIsLoading(true);
3749
+ setError(null);
3750
+ _context.prev = 2;
3751
+ _context.next = 3;
3752
+ return window.mainApi.registry.searchDashboards(query || "", {});
3753
+ case 3:
3754
+ result = _context.sent;
3755
+ setPackages((result === null || result === void 0 ? void 0 : result.packages) || []);
3756
+ _context.next = 5;
3757
+ break;
3758
+ case 4:
3759
+ _context.prev = 4;
3760
+ _t = _context["catch"](2);
3761
+ setError(_t.message || "Failed to search dashboard registry");
3762
+ setPackages([]);
3763
+ case 5:
3764
+ _context.prev = 5;
3765
+ setIsLoading(false);
3766
+ return _context.finish(5);
3767
+ case 6:
3768
+ case "end":
3769
+ return _context.stop();
3770
+ }
3771
+ }, _callee, null, [[2, 4, 5, 6]]);
3772
+ }));
3773
+ return function (_x) {
3774
+ return _ref2.apply(this, arguments);
3775
+ };
3776
+ }(), []);
3777
+
3778
+ // Debounce search on query changes
3779
+ useEffect(function () {
3780
+ var timer = setTimeout(function () {
3781
+ search(searchQuery);
3782
+ }, 300);
3783
+ return function () {
3784
+ return clearTimeout(timer);
3785
+ };
3786
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3787
+ }, [searchQuery]);
3788
+ var retry = function retry() {
3789
+ return search(searchQuery);
3790
+ };
3791
+ var selectedPackage = selectedPackageName ? packages.find(function (p) {
3792
+ return p.name === selectedPackageName;
3793
+ }) : null;
3794
+
3795
+ // If a package is selected, show its detail inline
3796
+ if (selectedPackage) {
3797
+ return /*#__PURE__*/jsxs("div", {
3798
+ className: "flex flex-col flex-1 min-h-0",
3799
+ children: [/*#__PURE__*/jsx("div", {
3800
+ className: "flex-shrink-0 px-4 pt-4",
3801
+ children: /*#__PURE__*/jsxs("button", {
3802
+ type: "button",
3803
+ onClick: function onClick() {
3804
+ return setSelectedPackageName(null);
3805
+ },
3806
+ className: "flex items-center gap-1.5 text-sm opacity-60 hover:opacity-100 transition-opacity",
3807
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
3808
+ icon: "arrow-left",
3809
+ className: "h-3 w-3"
3810
+ }), /*#__PURE__*/jsx("span", {
3811
+ children: "Back"
3812
+ })]
3813
+ })
3814
+ }), /*#__PURE__*/jsx(RegistryDashboardDetail, {
3815
+ dashboardPackage: selectedPackage,
3816
+ appId: appId
3817
+ })]
3818
+ });
3819
+ }
3820
+
3821
+ // Package list view
3822
+ var listBody;
3823
+ if (isLoading) {
3824
+ listBody = /*#__PURE__*/jsx("div", {
3825
+ className: "flex items-center justify-center py-12",
3826
+ children: /*#__PURE__*/jsxs("div", {
3827
+ className: "text-center",
3828
+ children: [/*#__PURE__*/jsx("div", {
3829
+ className: "animate-spin rounded-full h-6 w-6 border-b-2 border-blue-500 mx-auto mb-3"
3830
+ }), /*#__PURE__*/jsx(Paragraph, {
3831
+ className: "text-sm opacity-50",
3832
+ children: "Loading dashboards..."
3833
+ })]
3834
+ })
3835
+ });
3836
+ } else if (error) {
3837
+ listBody = /*#__PURE__*/jsxs("div", {
3838
+ className: "px-4 py-8 text-center",
3839
+ children: [/*#__PURE__*/jsx(Paragraph, {
3840
+ className: "text-sm text-red-400 mb-3",
3841
+ children: error
3842
+ }), /*#__PURE__*/jsx(Button, {
3843
+ title: "Retry",
3844
+ bgColor: "bg-gray-700",
3845
+ hoverBackgroundColor: "hover:bg-gray-600",
3846
+ textSize: "text-sm",
3847
+ padding: "py-1 px-3",
3848
+ onClick: retry
3849
+ })]
3850
+ });
3851
+ } else if (packages.length === 0) {
3852
+ listBody = /*#__PURE__*/jsx("div", {
3853
+ className: "px-4 py-8 text-center",
3854
+ children: /*#__PURE__*/jsx(Paragraph, {
3855
+ className: "text-sm opacity-50",
3856
+ children: searchQuery ? "No dashboards match your search." : "No dashboard packages available."
3857
+ })
3858
+ });
3859
+ } else {
3860
+ listBody = /*#__PURE__*/jsx("div", {
3861
+ className: "space-y-1",
3862
+ children: packages.map(function (pkg) {
3863
+ var widgetCount = (pkg.widgets || []).length;
3864
+ return /*#__PURE__*/jsx(Sidebar.Item, {
3865
+ icon: /*#__PURE__*/jsx(FontAwesomeIcon, {
3866
+ icon: pkg.icon || "clone",
3867
+ className: "h-3.5 w-3.5"
3868
+ }),
3869
+ onClick: function onClick() {
3870
+ return setSelectedPackageName(pkg.name);
3871
+ },
3872
+ badge: widgetCount > 0 ? "".concat(widgetCount) : undefined,
3873
+ children: pkg.displayName || pkg.name
3874
+ }, pkg.name);
3875
+ })
3876
+ });
3877
+ }
3878
+ return /*#__PURE__*/jsxs("div", {
3879
+ className: "flex flex-col flex-1 min-h-0 ".concat(panelStyles.textColor || "text-gray-200"),
3880
+ children: [/*#__PURE__*/jsx("div", {
3881
+ className: "flex-shrink-0 px-4 pt-4",
3882
+ children: /*#__PURE__*/jsxs("button", {
3883
+ type: "button",
3884
+ onClick: onBack,
3885
+ className: "flex items-center gap-1.5 text-sm opacity-60 hover:opacity-100 transition-opacity",
3886
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
3887
+ icon: "arrow-left",
3888
+ className: "h-3 w-3"
3889
+ }), /*#__PURE__*/jsx("span", {
3890
+ children: "Back"
3891
+ })]
3892
+ })
3893
+ }), /*#__PURE__*/jsx("div", {
3894
+ className: "flex-shrink-0 px-4 py-3",
3895
+ children: /*#__PURE__*/jsx(SearchInput, {
3896
+ value: searchQuery,
3897
+ onChange: setSearchQuery,
3898
+ placeholder: "Search dashboards...",
3899
+ inputClassName: "py-1.5 text-xs"
3900
+ })
3901
+ }), /*#__PURE__*/jsx("div", {
3902
+ className: "flex-1 min-h-0 overflow-y-auto px-2",
3903
+ children: listBody
3904
+ }), !isLoading && !error && packages.length > 0 && /*#__PURE__*/jsxs("div", {
3905
+ className: "flex-shrink-0 px-4 py-2 text-[10px] opacity-40 border-t border-white/10",
3906
+ children: [packages.length, " dashboard", packages.length !== 1 ? "s" : ""]
3907
+ })]
3908
+ });
3909
+ };
3910
+
3275
3911
  var LayoutManagerModal = function LayoutManagerModal(_ref) {
3276
3912
  var open = _ref.open,
3277
3913
  setIsOpen = _ref.setIsOpen,
@@ -3279,52 +3915,59 @@ var LayoutManagerModal = function LayoutManagerModal(_ref) {
3279
3915
  _ref$menuItems = _ref.menuItems,
3280
3916
  menuItems = _ref$menuItems === void 0 ? [] : _ref$menuItems,
3281
3917
  _ref$onSaveMenuItem = _ref.onSaveMenuItem,
3282
- onSaveMenuItem = _ref$onSaveMenuItem === void 0 ? null : _ref$onSaveMenuItem;
3918
+ onSaveMenuItem = _ref$onSaveMenuItem === void 0 ? null : _ref$onSaveMenuItem,
3919
+ appId = _ref.appId,
3920
+ onReloadWorkspaces = _ref.onReloadWorkspaces;
3283
3921
  var _useContext = useContext(ThemeContext),
3284
3922
  themes = _useContext.themes,
3285
3923
  appThemeKey = _useContext.themeKey;
3286
- var _useState = useState(""),
3924
+ var _useState = useState(null),
3287
3925
  _useState2 = _slicedToArray(_useState, 2),
3288
- dashboardName = _useState2[0],
3289
- setDashboardName = _useState2[1];
3290
- var _useState3 = useState(layoutTemplates[0]),
3926
+ creationMethod = _useState2[0],
3927
+ setCreationMethod = _useState2[1];
3928
+ var _useState3 = useState(""),
3291
3929
  _useState4 = _slicedToArray(_useState3, 2),
3292
- selectedTemplate = _useState4[0],
3293
- setSelectedTemplate = _useState4[1];
3294
- var _useState5 = useState(0),
3930
+ dashboardName = _useState4[0],
3931
+ setDashboardName = _useState4[1];
3932
+ var _useState5 = useState(layoutTemplates[0]),
3295
3933
  _useState6 = _slicedToArray(_useState5, 2),
3296
- activeStep = _useState6[0],
3297
- setActiveStep = _useState6[1];
3298
- var _useState7 = useState(null),
3934
+ selectedTemplate = _useState6[0],
3935
+ setSelectedTemplate = _useState6[1];
3936
+ var _useState7 = useState(0),
3299
3937
  _useState8 = _slicedToArray(_useState7, 2),
3300
- selectedMenuId = _useState8[0],
3301
- setSelectedMenuId = _useState8[1];
3938
+ activeStep = _useState8[0],
3939
+ setActiveStep = _useState8[1];
3302
3940
  var _useState9 = useState(null),
3303
3941
  _useState0 = _slicedToArray(_useState9, 2),
3304
- selectedThemeKey = _useState0[0],
3305
- setSelectedThemeKey = _useState0[1];
3306
- var _useState1 = useState([]),
3942
+ selectedMenuId = _useState0[0],
3943
+ setSelectedMenuId = _useState0[1];
3944
+ var _useState1 = useState(null),
3307
3945
  _useState10 = _slicedToArray(_useState1, 2),
3308
- localMenuItems = _useState10[0],
3309
- setLocalMenuItems = _useState10[1];
3946
+ selectedThemeKey = _useState10[0],
3947
+ setSelectedThemeKey = _useState10[1];
3948
+ var _useState11 = useState([]),
3949
+ _useState12 = _slicedToArray(_useState11, 2),
3950
+ localMenuItems = _useState12[0],
3951
+ setLocalMenuItems = _useState12[1];
3310
3952
 
3311
3953
  // Inline new-folder form state
3312
- var _useState11 = useState(false),
3313
- _useState12 = _slicedToArray(_useState11, 2),
3314
- isCreatingFolder = _useState12[0],
3315
- setIsCreatingFolder = _useState12[1];
3316
- var _useState13 = useState(""),
3954
+ var _useState13 = useState(false),
3317
3955
  _useState14 = _slicedToArray(_useState13, 2),
3318
- newFolderName = _useState14[0],
3319
- setNewFolderName = _useState14[1];
3320
- var _useState15 = useState(null),
3956
+ isCreatingFolder = _useState14[0],
3957
+ setIsCreatingFolder = _useState14[1];
3958
+ var _useState15 = useState(""),
3321
3959
  _useState16 = _slicedToArray(_useState15, 2),
3322
- newFolderIcon = _useState16[0],
3323
- setNewFolderIcon = _useState16[1];
3960
+ newFolderName = _useState16[0],
3961
+ setNewFolderName = _useState16[1];
3962
+ var _useState17 = useState(null),
3963
+ _useState18 = _slicedToArray(_useState17, 2),
3964
+ newFolderIcon = _useState18[0],
3965
+ setNewFolderIcon = _useState18[1];
3324
3966
 
3325
3967
  // Reset state when modal opens
3326
3968
  useEffect(function () {
3327
3969
  if (open) {
3970
+ setCreationMethod(null);
3328
3971
  setDashboardName("");
3329
3972
  setActiveStep(0);
3330
3973
  setLocalMenuItems(menuItems || []);
@@ -3372,16 +4015,85 @@ var LayoutManagerModal = function LayoutManagerModal(_ref) {
3372
4015
  setSelectedTemplate(template);
3373
4016
  setActiveStep(2);
3374
4017
  }
4018
+ function handleMethodSelect(method) {
4019
+ if (method === "import") {
4020
+ handleImportFromFile();
4021
+ } else {
4022
+ setCreationMethod(method);
4023
+ }
4024
+ }
4025
+ function handleImportFromFile() {
4026
+ return _handleImportFromFile.apply(this, arguments);
4027
+ }
4028
+ function _handleImportFromFile() {
4029
+ _handleImportFromFile = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
4030
+ var result;
4031
+ return _regeneratorRuntime.wrap(function (_context) {
4032
+ while (1) switch (_context.prev = _context.next) {
4033
+ case 0:
4034
+ handleClose();
4035
+ _context.prev = 1;
4036
+ _context.next = 2;
4037
+ return window.mainApi.dashboardConfig.importDashboardConfig(appId);
4038
+ case 2:
4039
+ result = _context.sent;
4040
+ if (result && !result.canceled && result.success) {
4041
+ onReloadWorkspaces && onReloadWorkspaces();
4042
+ }
4043
+ _context.next = 4;
4044
+ break;
4045
+ case 3:
4046
+ _context.prev = 3;
4047
+ _context["catch"](1);
4048
+ case 4:
4049
+ case "end":
4050
+ return _context.stop();
4051
+ }
4052
+ }, _callee, null, [[1, 3]]);
4053
+ }));
4054
+ return _handleImportFromFile.apply(this, arguments);
4055
+ }
3375
4056
  var selectedFolder = localMenuItems.find(function (item) {
3376
4057
  return item.id === selectedMenuId;
3377
4058
  });
3378
- return /*#__PURE__*/jsxs(Modal, {
3379
- isOpen: open,
3380
- setIsOpen: setIsOpen,
3381
- width: "w-11/12 xl:w-5/6",
3382
- height: "h-5/6",
3383
- scrollable: false,
3384
- children: [/*#__PURE__*/jsx(Panel, {
4059
+
4060
+ // ─── Render body based on creationMethod ─────────────────────────
4061
+ function renderBody() {
4062
+ if (creationMethod === null) {
4063
+ return /*#__PURE__*/jsx(Panel, {
4064
+ backgroundColor: "bg-slate-800",
4065
+ padding: false,
4066
+ children: /*#__PURE__*/jsx(Panel.Body, {
4067
+ scrollable: false,
4068
+ className: "h-full",
4069
+ children: /*#__PURE__*/jsx("div", {
4070
+ className: "h-full p-6 pb-0",
4071
+ children: /*#__PURE__*/jsx(CreationMethodPicker, {
4072
+ onSelect: handleMethodSelect
4073
+ })
4074
+ })
4075
+ })
4076
+ });
4077
+ }
4078
+ if (creationMethod === "registry") {
4079
+ return /*#__PURE__*/jsx(Panel, {
4080
+ backgroundColor: "bg-slate-800",
4081
+ padding: false,
4082
+ children: /*#__PURE__*/jsx(Panel.Body, {
4083
+ scrollable: false,
4084
+ className: "h-full",
4085
+ children: /*#__PURE__*/jsx(DiscoverDashboardsDetail, {
4086
+ onBack: function onBack() {
4087
+ return setCreationMethod(null);
4088
+ },
4089
+ appId: appId
4090
+ })
4091
+ })
4092
+ });
4093
+ }
4094
+
4095
+ // creationMethod === "template" — existing 4-step wizard
4096
+ return /*#__PURE__*/jsx(Panel, {
3385
4097
  backgroundColor: "bg-slate-800",
3386
4098
  padding: false,
3387
4099
  children: /*#__PURE__*/jsx(Panel.Body, {
@@ -3639,13 +4351,45 @@ var LayoutManagerModal = function LayoutManagerModal(_ref) {
3639
4351
  })]
3640
4352
  })
3641
4353
  })
3642
- }), /*#__PURE__*/jsx(Modal.Footer, {
4354
+ });
4355
+ }
4356
+
4357
+ // ─── Render footer based on creationMethod ───────────────────────
4358
+ function renderFooter() {
4359
+ // Picker screen: just Cancel
4360
+ if (creationMethod === null) {
4361
+ return /*#__PURE__*/jsx(Modal.Footer, {
4362
+ children: /*#__PURE__*/jsx("div", {
4363
+ className: "flex flex-row space-x-2",
4364
+ children: /*#__PURE__*/jsx(Button, {
4365
+ onClick: handleClose,
4366
+ title: "Cancel",
4367
+ textSize: "text-base xl:text-lg",
4368
+ padding: "py-2 px-4",
4369
+ backgroundColor: "bg-gray-700",
4370
+ textColor: "text-gray-300",
4371
+ hoverTextColor: "hover:text-gray-100",
4372
+ hoverBackgroundColor: "hover:bg-gray-600"
4373
+ })
4374
+ })
4375
+ });
4376
+ }
4377
+
4378
+ // Registry screen: no footer (DiscoverDashboardsDetail has its own back button)
4379
+ if (creationMethod === "registry") {
4380
+ return null;
4381
+ }
4382
+
4383
+ // Template wizard footer
4384
+ return /*#__PURE__*/jsx(Modal.Footer, {
3643
4385
  children: /*#__PURE__*/jsxs("div", {
3644
4386
  className: "flex flex-row space-x-2",
3645
4387
  children: [activeStep === 0 && /*#__PURE__*/jsxs(Fragment, {
3646
4388
  children: [/*#__PURE__*/jsx(Button, {
3647
- onClick: handleClose,
3648
- title: "Cancel",
4389
+ onClick: function onClick() {
4390
+ return setCreationMethod(null);
4391
+ },
4392
+ title: "Back",
3649
4393
  textSize: "text-base xl:text-lg",
3650
4394
  padding: "py-2 px-4",
3651
4395
  backgroundColor: "bg-gray-700",
@@ -3738,7 +4482,15 @@ var LayoutManagerModal = function LayoutManagerModal(_ref) {
3738
4482
  })]
3739
4483
  })]
3740
4484
  })
3741
- })]
4485
+ });
4486
+ }
4487
+ return /*#__PURE__*/jsxs(Modal, {
4488
+ isOpen: open,
4489
+ setIsOpen: setIsOpen,
4490
+ width: "w-11/12 xl:w-5/6",
4491
+ height: "h-5/6",
4492
+ scrollable: false,
4493
+ children: [renderBody(), renderFooter()]
3742
4494
  });
3743
4495
  };
3744
4496
 
@@ -30641,102 +31393,6 @@ var ThemeManagerModal = function ThemeManagerModal(_ref) {
30641
31393
  });
30642
31394
  };
30643
31395
 
30644
- var StarRating = function StarRating(_ref) {
30645
- var appId = _ref.appId,
30646
- packageName = _ref.packageName,
30647
- _ref$interactive = _ref.interactive,
30648
- interactive = _ref$interactive === void 0 ? true : _ref$interactive;
30649
- var _useContext = useContext(ThemeContext),
30650
- currentTheme = _useContext.currentTheme;
30651
- var _useState = useState(0),
30652
- _useState2 = _slicedToArray(_useState, 2),
30653
- rating = _useState2[0],
30654
- setRating = _useState2[1];
30655
- var _useState3 = useState(0),
30656
- _useState4 = _slicedToArray(_useState3, 2),
30657
- hoverRating = _useState4[0],
30658
- setHoverRating = _useState4[1];
30659
- var _useState5 = useState(true),
30660
- _useState6 = _slicedToArray(_useState5, 2),
30661
- loading = _useState6[0],
30662
- setLoading = _useState6[1];
30663
- useEffect(function () {
30664
- var _window$mainApi;
30665
- if (!appId || !packageName) return;
30666
- var cancelled = false;
30667
- setLoading(true);
30668
- (_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) {
30669
- if (!cancelled && result !== null && result !== void 0 && result.rating) {
30670
- setRating(result.rating);
30671
- }
30672
- })["catch"](function () {})["finally"](function () {
30673
- if (!cancelled) setLoading(false);
30674
- });
30675
- return function () {
30676
- cancelled = true;
30677
- };
30678
- }, [appId, packageName]);
30679
- function handleClick(_x) {
30680
- return _handleClick.apply(this, arguments);
30681
- }
30682
- function _handleClick() {
30683
- _handleClick = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(value) {
30684
- var newRating, _window$mainApi2;
30685
- return _regeneratorRuntime.wrap(function (_context) {
30686
- while (1) switch (_context.prev = _context.next) {
30687
- case 0:
30688
- if (!(!interactive || !appId || !packageName)) {
30689
- _context.next = 1;
30690
- break;
30691
- }
30692
- return _context.abrupt("return");
30693
- case 1:
30694
- newRating = value === rating ? 0 : value;
30695
- setRating(newRating);
30696
- _context.prev = 2;
30697
- _context.next = 3;
30698
- 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);
30699
- case 3:
30700
- _context.next = 5;
30701
- break;
30702
- case 4:
30703
- _context.prev = 4;
30704
- _context["catch"](2);
30705
- case 5:
30706
- case "end":
30707
- return _context.stop();
30708
- }
30709
- }, _callee, null, [[2, 4]]);
30710
- }));
30711
- return _handleClick.apply(this, arguments);
30712
- }
30713
- if (loading) return null;
30714
- var displayRating = hoverRating || rating;
30715
- return /*#__PURE__*/jsx("div", {
30716
- className: "flex items-center gap-0.5",
30717
- onMouseLeave: function onMouseLeave() {
30718
- return setHoverRating(0);
30719
- },
30720
- children: [1, 2, 3, 4, 5].map(function (star) {
30721
- return /*#__PURE__*/jsx("button", {
30722
- type: "button",
30723
- disabled: !interactive,
30724
- onClick: function onClick() {
30725
- return handleClick(star);
30726
- },
30727
- onMouseEnter: function onMouseEnter() {
30728
- return interactive && setHoverRating(star);
30729
- },
30730
- className: "p-0.5 transition-colors ".concat(interactive ? "cursor-pointer hover:scale-110" : "cursor-default"),
30731
- children: /*#__PURE__*/jsx(FontAwesomeIcon, {
30732
- icon: star <= displayRating ? "star" : ["far", "star"],
30733
- className: "h-3.5 w-3.5 ".concat(star <= displayRating ? "text-yellow-400" : currentTheme["text-primary-medium"] || "text-gray-500")
30734
- })
30735
- }, star);
30736
- })
30737
- });
30738
- };
30739
-
30740
31396
  var DASHBOARD_TAGS = ["productivity", "monitoring", "analytics", "communication", "developer", "sales", "marketing", "finance", "project-management", "social", "news", "utilities"];
30741
31397
 
30742
31398
  /**
@@ -31826,471 +32482,6 @@ var DashboardDetail = function DashboardDetail(_ref2) {
31826
32482
  });
31827
32483
  };
31828
32484
 
31829
- var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
31830
- var dashboardPackage = _ref.dashboardPackage,
31831
- appId = _ref.appId;
31832
- var _useContext = useContext(ThemeContext),
31833
- currentTheme = _useContext.currentTheme;
31834
- var panelStyles = getStylesForItem(themeObjects.PANEL, currentTheme, {
31835
- grow: false
31836
- });
31837
- var _useState = useState(null),
31838
- _useState2 = _slicedToArray(_useState, 2),
31839
- preview = _useState2[0],
31840
- setPreview = _useState2[1];
31841
- var _useState3 = useState(false),
31842
- _useState4 = _slicedToArray(_useState3, 2),
31843
- previewLoading = _useState4[0],
31844
- setPreviewLoading = _useState4[1];
31845
- var _useState5 = useState(false),
31846
- _useState6 = _slicedToArray(_useState5, 2),
31847
- isInstalling = _useState6[0],
31848
- setIsInstalling = _useState6[1];
31849
- var _useState7 = useState(null),
31850
- _useState8 = _slicedToArray(_useState7, 2),
31851
- installResult = _useState8[0],
31852
- setInstallResult = _useState8[1];
31853
- var pkg = dashboardPackage;
31854
- if (!pkg) return null;
31855
-
31856
- // Load preview data on mount
31857
- // eslint-disable-next-line react-hooks/rules-of-hooks
31858
- useEffect(function () {
31859
- var _window$mainApi;
31860
- if (!pkg.name) return;
31861
- var cancelled = false;
31862
- setPreviewLoading(true);
31863
- setPreview(null);
31864
- setInstallResult(null);
31865
- (_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) {
31866
- if (!cancelled) setPreview(result);
31867
- })["catch"](function (err) {
31868
- })["finally"](function () {
31869
- if (!cancelled) setPreviewLoading(false);
31870
- });
31871
- return function () {
31872
- cancelled = true;
31873
- };
31874
- }, [pkg.name]);
31875
- function handleInstall() {
31876
- return _handleInstall.apply(this, arguments);
31877
- }
31878
- function _handleInstall() {
31879
- _handleInstall = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
31880
- var _result$workspace, result, _t;
31881
- return _regeneratorRuntime.wrap(function (_context) {
31882
- while (1) switch (_context.prev = _context.next) {
31883
- case 0:
31884
- if (!(!appId || !pkg.name)) {
31885
- _context.next = 1;
31886
- break;
31887
- }
31888
- return _context.abrupt("return");
31889
- case 1:
31890
- setIsInstalling(true);
31891
- setInstallResult(null);
31892
- _context.prev = 2;
31893
- _context.next = 3;
31894
- return window.mainApi.dashboardConfig.installDashboardFromRegistry(appId, pkg.name);
31895
- case 3:
31896
- result = _context.sent;
31897
- setInstallResult({
31898
- status: result !== null && result !== void 0 && result.success ? "success" : "error",
31899
- 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."
31900
- });
31901
- _context.next = 5;
31902
- break;
31903
- case 4:
31904
- _context.prev = 4;
31905
- _t = _context["catch"](2);
31906
- setInstallResult({
31907
- status: "error",
31908
- message: _t.message || "Failed to install dashboard."
31909
- });
31910
- case 5:
31911
- _context.prev = 5;
31912
- setIsInstalling(false);
31913
- return _context.finish(5);
31914
- case 6:
31915
- case "end":
31916
- return _context.stop();
31917
- }
31918
- }, _callee, null, [[2, 4, 5, 6]]);
31919
- }));
31920
- return _handleInstall.apply(this, arguments);
31921
- }
31922
- var compatibility = preview === null || preview === void 0 ? void 0 : preview.compatibility;
31923
- var widgetDeps = (preview === null || preview === void 0 ? void 0 : preview.widgets) || pkg.widgets || [];
31924
- var providers = (preview === null || preview === void 0 ? void 0 : preview.providers) || [];
31925
- var wiring = (preview === null || preview === void 0 ? void 0 : preview.wiring) || [];
31926
- function getCompatIcon(status) {
31927
- if (status === "installed") return {
31928
- icon: "circle-check",
31929
- color: "text-green-400"
31930
- };
31931
- if (status === "available") return {
31932
- icon: "circle-down",
31933
- color: "text-blue-400"
31934
- };
31935
- return {
31936
- icon: "circle-xmark",
31937
- color: "text-red-400"
31938
- };
31939
- }
31940
- return /*#__PURE__*/jsxs("div", {
31941
- className: "flex flex-col flex-1 min-h-0",
31942
- children: [/*#__PURE__*/jsxs("div", {
31943
- className: "flex-1 min-h-0 overflow-y-auto p-6 space-y-6 ".concat(panelStyles.textColor || "text-gray-200"),
31944
- children: [/*#__PURE__*/jsxs("div", {
31945
- className: "flex flex-row items-center gap-3",
31946
- children: [/*#__PURE__*/jsx("div", {
31947
- className: "h-5 w-5 flex-shrink-0 flex items-center justify-center",
31948
- children: /*#__PURE__*/jsx(FontAwesomeIcon, {
31949
- icon: pkg.icon || "clone",
31950
- className: "h-5 w-5"
31951
- })
31952
- }), /*#__PURE__*/jsxs("div", {
31953
- children: [/*#__PURE__*/jsx(SubHeading3, {
31954
- title: pkg.displayName || pkg.name,
31955
- padding: false
31956
- }), /*#__PURE__*/jsxs("div", {
31957
- className: "flex items-center gap-2 mt-0.5",
31958
- children: [/*#__PURE__*/jsxs("span", {
31959
- className: "text-sm opacity-60",
31960
- children: ["by ", pkg.author || "Unknown"]
31961
- }), pkg.version && /*#__PURE__*/jsxs("span", {
31962
- className: "text-xs px-2 py-0.5 rounded ".concat(currentTheme["bg-primary-medium"], " opacity-70"),
31963
- children: ["v", pkg.version]
31964
- })]
31965
- })]
31966
- })]
31967
- }), appId && /*#__PURE__*/jsx(StarRating, {
31968
- appId: appId,
31969
- packageName: pkg.name,
31970
- interactive: false
31971
- }), /*#__PURE__*/jsx("hr", {
31972
- className: currentTheme["border-primary-medium"]
31973
- }), pkg.description && /*#__PURE__*/jsx("p", {
31974
- className: "text-sm",
31975
- children: pkg.description
31976
- }), pkg.tags && pkg.tags.length > 0 && /*#__PURE__*/jsx("div", {
31977
- className: "flex flex-wrap gap-1",
31978
- children: pkg.tags.map(function (tag) {
31979
- return /*#__PURE__*/jsx("span", {
31980
- className: "text-xs px-2 py-0.5 rounded ".concat(currentTheme["bg-primary-medium"], " opacity-60"),
31981
- children: tag
31982
- }, tag);
31983
- })
31984
- }), /*#__PURE__*/jsxs("div", {
31985
- children: [/*#__PURE__*/jsx("span", {
31986
- className: "text-xs font-semibold opacity-50 mb-1 block",
31987
- children: "REQUIRED WIDGETS"
31988
- }), previewLoading ? /*#__PURE__*/jsxs("div", {
31989
- className: "flex items-center gap-2 py-2",
31990
- children: [/*#__PURE__*/jsx("div", {
31991
- className: "animate-spin rounded-full h-4 w-4 border-b-2 border-blue-500"
31992
- }), /*#__PURE__*/jsx("span", {
31993
- className: "text-xs opacity-50",
31994
- children: "Checking compatibility..."
31995
- })]
31996
- }) : /*#__PURE__*/jsx("div", {
31997
- className: "space-y-1.5",
31998
- children: widgetDeps.map(function (w, idx) {
31999
- var _compatibility$widget;
32000
- 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";
32001
- var compat = getCompatIcon(status);
32002
- return /*#__PURE__*/jsxs("div", {
32003
- className: "p-2 rounded ".concat(currentTheme["bg-primary-medium"], " flex items-center gap-2"),
32004
- children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
32005
- icon: compat.icon,
32006
- className: "h-3.5 w-3.5 ".concat(compat.color)
32007
- }), /*#__PURE__*/jsx("span", {
32008
- className: "text-sm",
32009
- children: w.displayName || w.name || w.packageName
32010
- }), /*#__PURE__*/jsx("span", {
32011
- className: "text-xs opacity-40 ml-auto",
32012
- children: status === "installed" ? "Installed" : status === "available" ? "Will install" : "Unavailable"
32013
- })]
32014
- }, idx);
32015
- })
32016
- })]
32017
- }), providers.length > 0 && /*#__PURE__*/jsxs("div", {
32018
- children: [/*#__PURE__*/jsx("span", {
32019
- className: "text-xs font-semibold opacity-50 mb-1 block",
32020
- children: "REQUIRED PROVIDERS"
32021
- }), /*#__PURE__*/jsx("div", {
32022
- className: "space-y-1",
32023
- children: providers.map(function (p, idx) {
32024
- return /*#__PURE__*/jsxs("div", {
32025
- className: "flex items-center gap-2",
32026
- children: [/*#__PURE__*/jsx("span", {
32027
- className: "text-xs px-1.5 py-0.5 rounded bg-blue-900/30 text-blue-400",
32028
- children: p.type
32029
- }), p.required && /*#__PURE__*/jsx("span", {
32030
- className: "text-[10px] opacity-40",
32031
- children: "Required"
32032
- })]
32033
- }, idx);
32034
- })
32035
- })]
32036
- }), wiring.length > 0 && /*#__PURE__*/jsxs("div", {
32037
- children: [/*#__PURE__*/jsx("span", {
32038
- className: "text-xs font-semibold opacity-50 mb-1 block",
32039
- children: "EVENT WIRING"
32040
- }), /*#__PURE__*/jsx("div", {
32041
- className: "space-y-1",
32042
- children: wiring.map(function (w, idx) {
32043
- return /*#__PURE__*/jsxs("div", {
32044
- className: "text-xs p-2 rounded ".concat(currentTheme["bg-primary-medium"], " opacity-70"),
32045
- children: [/*#__PURE__*/jsx("span", {
32046
- className: "font-medium",
32047
- children: w.from || "Source"
32048
- }), /*#__PURE__*/jsx(FontAwesomeIcon, {
32049
- icon: "arrow-right",
32050
- className: "h-2.5 w-2.5 mx-1.5 opacity-50"
32051
- }), /*#__PURE__*/jsx("span", {
32052
- className: "font-medium",
32053
- children: w.to || "Target"
32054
- }), w.event && /*#__PURE__*/jsxs("span", {
32055
- className: "opacity-50 ml-1.5",
32056
- children: ["(", w.event, ")"]
32057
- })]
32058
- }, idx);
32059
- })
32060
- })]
32061
- }), installResult && /*#__PURE__*/jsx("div", {
32062
- className: "p-2 rounded border ".concat(installResult.status === "success" ? "bg-green-900/20 border-green-700" : "bg-red-900/30 border-red-700"),
32063
- children: /*#__PURE__*/jsxs("div", {
32064
- className: "flex items-center gap-2",
32065
- children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
32066
- icon: installResult.status === "success" ? "circle-check" : "circle-xmark",
32067
- className: "h-4 w-4 ".concat(installResult.status === "success" ? "text-green-400" : "text-red-400")
32068
- }), /*#__PURE__*/jsx("span", {
32069
- className: "text-sm ".concat(installResult.status === "error" ? "text-red-400" : ""),
32070
- children: installResult.message
32071
- })]
32072
- })
32073
- })]
32074
- }), (installResult === null || installResult === void 0 ? void 0 : installResult.status) !== "success" && /*#__PURE__*/jsx("div", {
32075
- className: "flex items-center justify-end px-6 py-3 border-t ".concat(currentTheme["border-primary-medium"]),
32076
- children: /*#__PURE__*/jsx(Button, {
32077
- title: isInstalling ? "Installing..." : "Install Dashboard",
32078
- bgColor: "bg-blue-600",
32079
- hoverBackgroundColor: isInstalling ? "" : "hover:bg-blue-700",
32080
- textSize: "text-sm",
32081
- padding: "py-1.5 px-4",
32082
- onClick: handleInstall,
32083
- disabled: isInstalling
32084
- })
32085
- })]
32086
- });
32087
- };
32088
-
32089
- var DiscoverDashboardsDetail = function DiscoverDashboardsDetail(_ref) {
32090
- var onBack = _ref.onBack,
32091
- appId = _ref.appId;
32092
- var _useContext = useContext(ThemeContext),
32093
- currentTheme = _useContext.currentTheme;
32094
- var panelStyles = getStylesForItem(themeObjects.PANEL, currentTheme, {
32095
- grow: false
32096
- });
32097
- var _useState = useState([]),
32098
- _useState2 = _slicedToArray(_useState, 2),
32099
- packages = _useState2[0],
32100
- setPackages = _useState2[1];
32101
- var _useState3 = useState(false),
32102
- _useState4 = _slicedToArray(_useState3, 2),
32103
- isLoading = _useState4[0],
32104
- setIsLoading = _useState4[1];
32105
- var _useState5 = useState(null),
32106
- _useState6 = _slicedToArray(_useState5, 2),
32107
- error = _useState6[0],
32108
- setError = _useState6[1];
32109
- var _useState7 = useState(""),
32110
- _useState8 = _slicedToArray(_useState7, 2),
32111
- searchQuery = _useState8[0],
32112
- setSearchQuery = _useState8[1];
32113
- var _useState9 = useState(null),
32114
- _useState0 = _slicedToArray(_useState9, 2),
32115
- selectedPackageName = _useState0[0],
32116
- setSelectedPackageName = _useState0[1];
32117
- var search = useCallback(/*#__PURE__*/function () {
32118
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(query) {
32119
- var _window$mainApi;
32120
- var result, _t;
32121
- return _regeneratorRuntime.wrap(function (_context) {
32122
- while (1) switch (_context.prev = _context.next) {
32123
- case 0:
32124
- if ((_window$mainApi = window.mainApi) !== null && _window$mainApi !== void 0 && (_window$mainApi = _window$mainApi.registry) !== null && _window$mainApi !== void 0 && _window$mainApi.searchDashboards) {
32125
- _context.next = 1;
32126
- break;
32127
- }
32128
- setPackages([]);
32129
- return _context.abrupt("return");
32130
- case 1:
32131
- setIsLoading(true);
32132
- setError(null);
32133
- _context.prev = 2;
32134
- _context.next = 3;
32135
- return window.mainApi.registry.searchDashboards(query || "", {});
32136
- case 3:
32137
- result = _context.sent;
32138
- setPackages((result === null || result === void 0 ? void 0 : result.packages) || []);
32139
- _context.next = 5;
32140
- break;
32141
- case 4:
32142
- _context.prev = 4;
32143
- _t = _context["catch"](2);
32144
- setError(_t.message || "Failed to search dashboard registry");
32145
- setPackages([]);
32146
- case 5:
32147
- _context.prev = 5;
32148
- setIsLoading(false);
32149
- return _context.finish(5);
32150
- case 6:
32151
- case "end":
32152
- return _context.stop();
32153
- }
32154
- }, _callee, null, [[2, 4, 5, 6]]);
32155
- }));
32156
- return function (_x) {
32157
- return _ref2.apply(this, arguments);
32158
- };
32159
- }(), []);
32160
-
32161
- // Debounce search on query changes
32162
- useEffect(function () {
32163
- var timer = setTimeout(function () {
32164
- search(searchQuery);
32165
- }, 300);
32166
- return function () {
32167
- return clearTimeout(timer);
32168
- };
32169
- // eslint-disable-next-line react-hooks/exhaustive-deps
32170
- }, [searchQuery]);
32171
- var retry = function retry() {
32172
- return search(searchQuery);
32173
- };
32174
- var selectedPackage = selectedPackageName ? packages.find(function (p) {
32175
- return p.name === selectedPackageName;
32176
- }) : null;
32177
-
32178
- // If a package is selected, show its detail inline
32179
- if (selectedPackage) {
32180
- return /*#__PURE__*/jsxs("div", {
32181
- className: "flex flex-col flex-1 min-h-0",
32182
- children: [/*#__PURE__*/jsx("div", {
32183
- className: "flex-shrink-0 px-4 pt-4",
32184
- children: /*#__PURE__*/jsxs("button", {
32185
- type: "button",
32186
- onClick: function onClick() {
32187
- return setSelectedPackageName(null);
32188
- },
32189
- className: "flex items-center gap-1.5 text-sm opacity-60 hover:opacity-100 transition-opacity",
32190
- children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
32191
- icon: "arrow-left",
32192
- className: "h-3 w-3"
32193
- }), /*#__PURE__*/jsx("span", {
32194
- children: "Back"
32195
- })]
32196
- })
32197
- }), /*#__PURE__*/jsx(RegistryDashboardDetail, {
32198
- dashboardPackage: selectedPackage,
32199
- appId: appId
32200
- })]
32201
- });
32202
- }
32203
-
32204
- // Package list view
32205
- var listBody;
32206
- if (isLoading) {
32207
- listBody = /*#__PURE__*/jsx("div", {
32208
- className: "flex items-center justify-center py-12",
32209
- children: /*#__PURE__*/jsxs("div", {
32210
- className: "text-center",
32211
- children: [/*#__PURE__*/jsx("div", {
32212
- className: "animate-spin rounded-full h-6 w-6 border-b-2 border-blue-500 mx-auto mb-3"
32213
- }), /*#__PURE__*/jsx(Paragraph, {
32214
- className: "text-sm opacity-50",
32215
- children: "Loading dashboards..."
32216
- })]
32217
- })
32218
- });
32219
- } else if (error) {
32220
- listBody = /*#__PURE__*/jsxs("div", {
32221
- className: "px-4 py-8 text-center",
32222
- children: [/*#__PURE__*/jsx(Paragraph, {
32223
- className: "text-sm text-red-400 mb-3",
32224
- children: error
32225
- }), /*#__PURE__*/jsx(Button, {
32226
- title: "Retry",
32227
- bgColor: "bg-gray-700",
32228
- hoverBackgroundColor: "hover:bg-gray-600",
32229
- textSize: "text-sm",
32230
- padding: "py-1 px-3",
32231
- onClick: retry
32232
- })]
32233
- });
32234
- } else if (packages.length === 0) {
32235
- listBody = /*#__PURE__*/jsx("div", {
32236
- className: "px-4 py-8 text-center",
32237
- children: /*#__PURE__*/jsx(Paragraph, {
32238
- className: "text-sm opacity-50",
32239
- children: searchQuery ? "No dashboards match your search." : "No dashboard packages available."
32240
- })
32241
- });
32242
- } else {
32243
- listBody = /*#__PURE__*/jsx("div", {
32244
- className: "space-y-1",
32245
- children: packages.map(function (pkg) {
32246
- var widgetCount = (pkg.widgets || []).length;
32247
- return /*#__PURE__*/jsx(Sidebar.Item, {
32248
- icon: /*#__PURE__*/jsx(FontAwesomeIcon, {
32249
- icon: pkg.icon || "clone",
32250
- className: "h-3.5 w-3.5"
32251
- }),
32252
- onClick: function onClick() {
32253
- return setSelectedPackageName(pkg.name);
32254
- },
32255
- badge: widgetCount > 0 ? "".concat(widgetCount) : undefined,
32256
- children: pkg.displayName || pkg.name
32257
- }, pkg.name);
32258
- })
32259
- });
32260
- }
32261
- return /*#__PURE__*/jsxs("div", {
32262
- className: "flex flex-col flex-1 min-h-0 ".concat(panelStyles.textColor || "text-gray-200"),
32263
- children: [/*#__PURE__*/jsx("div", {
32264
- className: "flex-shrink-0 px-4 pt-4",
32265
- children: /*#__PURE__*/jsxs("button", {
32266
- type: "button",
32267
- onClick: onBack,
32268
- className: "flex items-center gap-1.5 text-sm opacity-60 hover:opacity-100 transition-opacity",
32269
- children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
32270
- icon: "arrow-left",
32271
- className: "h-3 w-3"
32272
- }), /*#__PURE__*/jsx("span", {
32273
- children: "Back"
32274
- })]
32275
- })
32276
- }), /*#__PURE__*/jsx("div", {
32277
- className: "flex-shrink-0 px-4 py-3",
32278
- children: /*#__PURE__*/jsx(SearchInput, {
32279
- value: searchQuery,
32280
- onChange: setSearchQuery,
32281
- placeholder: "Search dashboards...",
32282
- inputClassName: "py-1.5 text-xs"
32283
- })
32284
- }), /*#__PURE__*/jsx("div", {
32285
- className: "flex-1 min-h-0 overflow-y-auto px-2",
32286
- children: listBody
32287
- }), !isLoading && !error && packages.length > 0 && /*#__PURE__*/jsxs("div", {
32288
- className: "flex-shrink-0 px-4 py-2 text-[10px] opacity-40 border-t border-white/10",
32289
- children: [packages.length, " dashboard", packages.length !== 1 ? "s" : ""]
32290
- })]
32291
- });
32292
- };
32293
-
32294
32485
  function ownKeys$9(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; }
32295
32486
  function _objectSpread$9(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$9(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$9(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
32296
32487
  var DashboardsSection = function DashboardsSection(_ref) {
@@ -40494,9 +40685,21 @@ var DashboardStageInner = function DashboardStageInner(_ref2) {
40494
40685
  _useState36 = _slicedToArray(_useState35, 2),
40495
40686
  appSettingsInitialSection = _useState36[0],
40496
40687
  setAppSettingsInitialSection = _useState36[1];
40688
+ var _useState37 = useState(null),
40689
+ _useState38 = _slicedToArray(_useState37, 2),
40690
+ appSettingsInitialProvider = _useState38[0],
40691
+ setAppSettingsInitialProvider = _useState38[1];
40692
+ var _useState39 = useState(false),
40693
+ _useState40 = _slicedToArray(_useState39, 2),
40694
+ appSettingsCreateProvider = _useState40[0],
40695
+ setAppSettingsCreateProvider = _useState40[1];
40497
40696
  function openAppSettings() {
40498
40697
  var section = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "general";
40698
+ var providerName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
40699
+ var createProvider = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
40499
40700
  setAppSettingsInitialSection(section);
40701
+ setAppSettingsInitialProvider(providerName);
40702
+ setAppSettingsCreateProvider(createProvider);
40500
40703
  setIsAppSettingsOpen(true);
40501
40704
  }
40502
40705
  function handleProfileUpdated() {
@@ -41277,8 +41480,16 @@ var DashboardStageInner = function DashboardStageInner(_ref2) {
41277
41480
  }), !popout && /*#__PURE__*/jsxs(Fragment, {
41278
41481
  children: [/*#__PURE__*/jsx(AppSettingsModal, {
41279
41482
  isOpen: isAppSettingsOpen,
41280
- setIsOpen: setIsAppSettingsOpen,
41483
+ setIsOpen: function setIsOpen(open) {
41484
+ setIsAppSettingsOpen(open);
41485
+ if (!open) {
41486
+ setAppSettingsInitialProvider(null);
41487
+ setAppSettingsCreateProvider(false);
41488
+ }
41489
+ },
41281
41490
  initialSection: appSettingsInitialSection,
41491
+ initialProviderName: appSettingsInitialProvider,
41492
+ initialCreateProvider: appSettingsCreateProvider,
41282
41493
  workspaces: workspaceConfig,
41283
41494
  menuItems: menuItems,
41284
41495
  dashApi: dashApi,
@@ -41318,7 +41529,9 @@ var DashboardStageInner = function DashboardStageInner(_ref2) {
41318
41529
  setIsOpen: setIsLayoutPickerOpen,
41319
41530
  onCreateWorkspace: handleCreateFromTemplate,
41320
41531
  menuItems: menuItems,
41321
- onSaveMenuItem: handleSaveNewMenuItem
41532
+ onSaveMenuItem: handleSaveNewMenuItem,
41533
+ appId: credentials === null || credentials === void 0 ? void 0 : credentials.appId,
41534
+ onReloadWorkspaces: loadWorkspaces
41322
41535
  })]
41323
41536
  })]
41324
41537
  }), !popout && /*#__PURE__*/jsx(DashCommandPalette, {
@@ -41337,7 +41550,10 @@ var DashboardStageInner = function DashboardStageInner(_ref2) {
41337
41550
  },
41338
41551
  providers: (appContext === null || appContext === void 0 ? void 0 : appContext.providers) || {},
41339
41552
  onCreateNewProvider: function onCreateNewProvider() {
41340
- return openAppSettings("providers");
41553
+ return openAppSettings("providers", null, true);
41554
+ },
41555
+ onOpenProviderDetail: function onOpenProviderDetail(name) {
41556
+ return openAppSettings("providers", name);
41341
41557
  },
41342
41558
  themes: themes || {},
41343
41559
  currentThemeKey: themeKey,