@trops/dash-core 0.1.596 → 0.1.598
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 +532 -179
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +640 -148
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +638 -146
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
|
2
2
|
import _typeof from '@babel/runtime/helpers/typeof';
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
4
|
import * as DashReact from '@trops/dash-react';
|
|
5
|
-
import { isObject, ThemeContext, Modal, FontAwesomeIcon, deepCopy, MainSection, getUUID, getStylesForItem, themeObjects, Heading, SearchInput, ButtonIcon, SubHeading3, InputText, Button, Tag, Button3, Button2, Paragraph, Sidebar, Panel, Stepper, Tag3, Card2, Card3, Heading3, MenuItem3, FormLabel, SelectMenu, Switch, SelectInput, CodeEditorVS, SettingsModal, SubHeading2, tailwindHeightFractions, Menu3, Panel3, ButtonIcon2, DropdownPanel, MenuItem2, DragComponent, ConfirmationModal, DropComponent, getStyleName, capitalizeFirstLetter, isHexColor as isHexColor$1, deriveShades, colorTypes, TAILWIND_PALETTE, Toggle, normalizeHex as normalizeHex$1, contrastRatio, Caption2, Caption, getColorFamilies, getCuratedColorGrid, DashPanel, hexToRgb as hexToRgb$1, themeVariants, SubHeading, Heading2, Paragraph2, Paragraph3, ButtonIcon3, Tag2, Alert, Alert2, Alert3, Toast, Toast2, Toast3, ProgressBar, ProgressBar2, ProgressBar3, MenuItem, Breadcrumbs, Breadcrumbs2, Breadcrumbs3, Caption3, Code, Code2, Code3, Divider, Divider2, Divider3, DashPanel2, DashPanel3, Tabs, Tabs2, Tabs3, Accordion, Accordion2, Accordion3, Toggle2, Toggle3, TextArea, Checkbox, Slider, RadioGroup, AlertBanner, StatusBadge, Skeleton, StatCard, DataList, EmptyState, Card, Panel2, ThemeFromUrlPane, CodeEditorInline, Icon2, AlgoliaSearchBox, CommandPalette, useSidebar, Navbar, withRouter, Menu as Menu$1 } from '@trops/dash-react';
|
|
5
|
+
import { isObject, ThemeContext, Modal, FontAwesomeIcon, deepCopy, MainSection, getUUID, getStylesForItem, themeObjects, Heading, SearchInput, ButtonIcon, SubHeading3, InputText, Button, Tag, Button3, Button2, Paragraph, Sidebar, Panel, Stepper, Tag3, Card2, Card3, Heading3, MenuItem3, FormLabel, SelectMenu, Switch, SelectInput, CodeEditorVS, SettingsModal, SubHeading2, tailwindHeightFractions, Menu3, Panel3, ButtonIcon2, DropdownPanel, MenuItem2, DragComponent, ConfirmationModal, DropComponent, getStyleName, capitalizeFirstLetter, isHexColor as isHexColor$1, deriveShades, colorTypes, TAILWIND_PALETTE, Toggle, normalizeHex as normalizeHex$1, contrastRatio, Caption2, Caption, getColorFamilies, getCuratedColorGrid, DashPanel, hexToRgb as hexToRgb$1, themeVariants, SubHeading, Heading2, Paragraph2, Paragraph3, ButtonIcon3, Tag2, Alert, Alert2, Alert3, Toast, Toast2, Toast3, ProgressBar, ProgressBar2, ProgressBar3, MenuItem, Breadcrumbs, Breadcrumbs2, Breadcrumbs3, Caption3, Code, Code2, Code3, Divider, Divider2, Divider3, DashPanel2, DashPanel3, Tabs, Tabs2, Tabs3, Accordion, Accordion2, Accordion3, Toggle2, Toggle3, TextArea, Checkbox, Slider, RadioGroup, AlertBanner, StatusBadge as StatusBadge$1, Skeleton, StatCard, DataList, EmptyState, Card, Panel2, ThemeFromUrlPane, CodeEditorInline, Icon2, AlgoliaSearchBox, CommandPalette, useSidebar, Navbar, withRouter, Menu as Menu$1 } from '@trops/dash-react';
|
|
6
6
|
export * from '@trops/dash-react';
|
|
7
7
|
export { FontAwesomeIcon, ThemeContext } from '@trops/dash-react';
|
|
8
8
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
@@ -36479,7 +36479,7 @@ var REGISTRY = {
|
|
|
36479
36479
|
themeKey: "status-badge",
|
|
36480
36480
|
category: "Feedback",
|
|
36481
36481
|
render: function render() {
|
|
36482
|
-
return /*#__PURE__*/jsx(StatusBadge, {
|
|
36482
|
+
return /*#__PURE__*/jsx(StatusBadge$1, {
|
|
36483
36483
|
state: "success",
|
|
36484
36484
|
label: "Active"
|
|
36485
36485
|
});
|
|
@@ -54583,6 +54583,413 @@ var DashboardLoaderModal = function DashboardLoaderModal(_ref) {
|
|
|
54583
54583
|
});
|
|
54584
54584
|
};
|
|
54585
54585
|
|
|
54586
|
+
var KITCHEN_SINK_PACKAGE = "trops/kitchen-sink";
|
|
54587
|
+
var STATE = {
|
|
54588
|
+
WELCOME: "welcome",
|
|
54589
|
+
INSTALLING: "installing",
|
|
54590
|
+
DONE: "done",
|
|
54591
|
+
ERROR: "error"
|
|
54592
|
+
};
|
|
54593
|
+
var OnboardingModal = function OnboardingModal(_ref) {
|
|
54594
|
+
var open = _ref.open,
|
|
54595
|
+
appId = _ref.appId,
|
|
54596
|
+
onOpenDashboard = _ref.onOpenDashboard,
|
|
54597
|
+
onDismiss = _ref.onDismiss,
|
|
54598
|
+
onComplete = _ref.onComplete;
|
|
54599
|
+
var _ref2 = useContext(ThemeContext) || {},
|
|
54600
|
+
currentTheme = _ref2.currentTheme;
|
|
54601
|
+
var _useState = useState(STATE.WELCOME),
|
|
54602
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
54603
|
+
state = _useState2[0],
|
|
54604
|
+
setState = _useState2[1];
|
|
54605
|
+
var _useState3 = useState([]),
|
|
54606
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
54607
|
+
progressItems = _useState4[0],
|
|
54608
|
+
setProgressItems = _useState4[1];
|
|
54609
|
+
var _useState5 = useState(null),
|
|
54610
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
54611
|
+
installError = _useState6[0],
|
|
54612
|
+
setInstallError = _useState6[1];
|
|
54613
|
+
var installResultRef = useRef(null);
|
|
54614
|
+
var cleanupProgressRef = useRef(null);
|
|
54615
|
+
useEffect(function () {
|
|
54616
|
+
if (open) {
|
|
54617
|
+
setState(STATE.WELCOME);
|
|
54618
|
+
setProgressItems([]);
|
|
54619
|
+
setInstallError(null);
|
|
54620
|
+
installResultRef.current = null;
|
|
54621
|
+
}
|
|
54622
|
+
return function () {
|
|
54623
|
+
if (cleanupProgressRef.current) {
|
|
54624
|
+
cleanupProgressRef.current();
|
|
54625
|
+
cleanupProgressRef.current = null;
|
|
54626
|
+
}
|
|
54627
|
+
};
|
|
54628
|
+
}, [open]);
|
|
54629
|
+
var markCompletedAndClose = useCallback(/*#__PURE__*/function () {
|
|
54630
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(source) {
|
|
54631
|
+
var _window$mainApi, _window$mainApi$markC;
|
|
54632
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
54633
|
+
while (1) switch (_context.prev = _context.next) {
|
|
54634
|
+
case 0:
|
|
54635
|
+
_context.prev = 0;
|
|
54636
|
+
_context.next = 1;
|
|
54637
|
+
return (_window$mainApi = window.mainApi) === null || _window$mainApi === void 0 || (_window$mainApi = _window$mainApi.onboarding) === null || _window$mainApi === void 0 || (_window$mainApi$markC = _window$mainApi.markCompleted) === null || _window$mainApi$markC === void 0 ? void 0 : _window$mainApi$markC.call(_window$mainApi, {
|
|
54638
|
+
source: source
|
|
54639
|
+
});
|
|
54640
|
+
case 1:
|
|
54641
|
+
_context.next = 3;
|
|
54642
|
+
break;
|
|
54643
|
+
case 2:
|
|
54644
|
+
_context.prev = 2;
|
|
54645
|
+
_context["catch"](0);
|
|
54646
|
+
case 3:
|
|
54647
|
+
if (onComplete) onComplete({
|
|
54648
|
+
source: source
|
|
54649
|
+
});
|
|
54650
|
+
case 4:
|
|
54651
|
+
case "end":
|
|
54652
|
+
return _context.stop();
|
|
54653
|
+
}
|
|
54654
|
+
}, _callee, null, [[0, 2]]);
|
|
54655
|
+
}));
|
|
54656
|
+
return function (_x) {
|
|
54657
|
+
return _ref3.apply(this, arguments);
|
|
54658
|
+
};
|
|
54659
|
+
}(), [onComplete]);
|
|
54660
|
+
var handleSkip = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
54661
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
54662
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
54663
|
+
case 0:
|
|
54664
|
+
_context2.next = 1;
|
|
54665
|
+
return markCompletedAndClose("dismissed");
|
|
54666
|
+
case 1:
|
|
54667
|
+
if (onDismiss) onDismiss();
|
|
54668
|
+
case 2:
|
|
54669
|
+
case "end":
|
|
54670
|
+
return _context2.stop();
|
|
54671
|
+
}
|
|
54672
|
+
}, _callee2);
|
|
54673
|
+
})), [markCompletedAndClose, onDismiss]);
|
|
54674
|
+
var handleInstall = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
54675
|
+
var _window$mainApi2, _window$mainApi2$onIn;
|
|
54676
|
+
var _window$mainApi3, _window$mainApi3$inst, result, _t2;
|
|
54677
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
54678
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
54679
|
+
case 0:
|
|
54680
|
+
if (appId) {
|
|
54681
|
+
_context3.next = 1;
|
|
54682
|
+
break;
|
|
54683
|
+
}
|
|
54684
|
+
setInstallError("Cannot install — application not initialized. Try again in a moment.");
|
|
54685
|
+
setState(STATE.ERROR);
|
|
54686
|
+
return _context3.abrupt("return");
|
|
54687
|
+
case 1:
|
|
54688
|
+
setState(STATE.INSTALLING);
|
|
54689
|
+
setProgressItems([]);
|
|
54690
|
+
setInstallError(null);
|
|
54691
|
+
if (cleanupProgressRef.current) cleanupProgressRef.current();
|
|
54692
|
+
cleanupProgressRef.current = (_window$mainApi2 = window.mainApi) === null || _window$mainApi2 === void 0 || (_window$mainApi2 = _window$mainApi2.dashboardConfig) === null || _window$mainApi2 === void 0 || (_window$mainApi2$onIn = _window$mainApi2.onInstallProgress) === null || _window$mainApi2$onIn === void 0 ? void 0 : _window$mainApi2$onIn.call(_window$mainApi2, function (data) {
|
|
54693
|
+
setProgressItems(function (prev) {
|
|
54694
|
+
var next = prev.length > 0 ? _toConsumableArray(prev) : [];
|
|
54695
|
+
if (next.length === 0 && typeof data.total === "number") {
|
|
54696
|
+
for (var i = 0; i < data.total; i += 1) {
|
|
54697
|
+
next.push({
|
|
54698
|
+
packageName: i === data.index ? data.packageName : "",
|
|
54699
|
+
displayName: i === data.index ? data.displayName : "",
|
|
54700
|
+
status: "pending"
|
|
54701
|
+
});
|
|
54702
|
+
}
|
|
54703
|
+
}
|
|
54704
|
+
if (typeof data.index === "number" && data.index >= 0 && data.index < next.length) {
|
|
54705
|
+
next[data.index] = {
|
|
54706
|
+
packageName: data.packageName || next[data.index].packageName,
|
|
54707
|
+
displayName: data.displayName || next[data.index].displayName || data.packageName || "",
|
|
54708
|
+
status: data.status || next[data.index].status,
|
|
54709
|
+
error: data.error || null
|
|
54710
|
+
};
|
|
54711
|
+
}
|
|
54712
|
+
return next;
|
|
54713
|
+
});
|
|
54714
|
+
});
|
|
54715
|
+
_context3.prev = 2;
|
|
54716
|
+
_context3.next = 3;
|
|
54717
|
+
return (_window$mainApi3 = window.mainApi) === null || _window$mainApi3 === void 0 || (_window$mainApi3 = _window$mainApi3.dashboardConfig) === null || _window$mainApi3 === void 0 || (_window$mainApi3$inst = _window$mainApi3.installDashboardFromRegistry) === null || _window$mainApi3$inst === void 0 ? void 0 : _window$mainApi3$inst.call(_window$mainApi3, appId, KITCHEN_SINK_PACKAGE, {});
|
|
54718
|
+
case 3:
|
|
54719
|
+
result = _context3.sent;
|
|
54720
|
+
if (cleanupProgressRef.current) {
|
|
54721
|
+
cleanupProgressRef.current();
|
|
54722
|
+
cleanupProgressRef.current = null;
|
|
54723
|
+
}
|
|
54724
|
+
if (!(!result || !result.success)) {
|
|
54725
|
+
_context3.next = 4;
|
|
54726
|
+
break;
|
|
54727
|
+
}
|
|
54728
|
+
setInstallError((result === null || result === void 0 ? void 0 : result.error) || "Failed to install Kitchen Sink. Check your internet connection and try again.");
|
|
54729
|
+
setState(STATE.ERROR);
|
|
54730
|
+
return _context3.abrupt("return");
|
|
54731
|
+
case 4:
|
|
54732
|
+
installResultRef.current = result;
|
|
54733
|
+
setState(STATE.DONE);
|
|
54734
|
+
_context3.next = 6;
|
|
54735
|
+
break;
|
|
54736
|
+
case 5:
|
|
54737
|
+
_context3.prev = 5;
|
|
54738
|
+
_t2 = _context3["catch"](2);
|
|
54739
|
+
if (cleanupProgressRef.current) {
|
|
54740
|
+
cleanupProgressRef.current();
|
|
54741
|
+
cleanupProgressRef.current = null;
|
|
54742
|
+
}
|
|
54743
|
+
setInstallError((_t2 === null || _t2 === void 0 ? void 0 : _t2.message) || "Installation failed.");
|
|
54744
|
+
setState(STATE.ERROR);
|
|
54745
|
+
case 6:
|
|
54746
|
+
case "end":
|
|
54747
|
+
return _context3.stop();
|
|
54748
|
+
}
|
|
54749
|
+
}, _callee3, null, [[2, 5]]);
|
|
54750
|
+
})), [appId]);
|
|
54751
|
+
var handleOpen = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
54752
|
+
var _installResultRef$cur;
|
|
54753
|
+
var workspace;
|
|
54754
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
54755
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
54756
|
+
case 0:
|
|
54757
|
+
workspace = ((_installResultRef$cur = installResultRef.current) === null || _installResultRef$cur === void 0 ? void 0 : _installResultRef$cur.workspace) || null;
|
|
54758
|
+
_context4.next = 1;
|
|
54759
|
+
return markCompletedAndClose("kitchen-sink");
|
|
54760
|
+
case 1:
|
|
54761
|
+
if (workspace && onOpenDashboard) {
|
|
54762
|
+
onOpenDashboard(workspace);
|
|
54763
|
+
}
|
|
54764
|
+
case 2:
|
|
54765
|
+
case "end":
|
|
54766
|
+
return _context4.stop();
|
|
54767
|
+
}
|
|
54768
|
+
}, _callee4);
|
|
54769
|
+
})), [markCompletedAndClose, onOpenDashboard]);
|
|
54770
|
+
var handleRetry = useCallback(function () {
|
|
54771
|
+
setInstallError(null);
|
|
54772
|
+
handleInstall();
|
|
54773
|
+
}, [handleInstall]);
|
|
54774
|
+
|
|
54775
|
+
// The Modal dispatches setIsOpen(false) on Escape / backdrop click.
|
|
54776
|
+
// Route any close attempt through handleSkip so the completion flag
|
|
54777
|
+
// is always stamped (otherwise Escape would silently re-show the
|
|
54778
|
+
// modal on the next launch).
|
|
54779
|
+
var handleSetIsOpen = useCallback(function (next) {
|
|
54780
|
+
if (next === false) handleSkip();
|
|
54781
|
+
}, [handleSkip]);
|
|
54782
|
+
var bgPanel = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["bg-primary-medium"]) || "bg-gray-900";
|
|
54783
|
+
var textPrimary = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["text-primary-light"]) || "text-gray-100";
|
|
54784
|
+
var textMuted = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["text-primary-medium"]) || "text-gray-400";
|
|
54785
|
+
var borderPanel = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["border-primary-medium"]) || "border-gray-700";
|
|
54786
|
+
return /*#__PURE__*/jsx(Modal, {
|
|
54787
|
+
isOpen: open,
|
|
54788
|
+
setIsOpen: handleSetIsOpen,
|
|
54789
|
+
width: "w-full max-w-2xl",
|
|
54790
|
+
height: "h-auto",
|
|
54791
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
54792
|
+
className: "flex flex-col ".concat(bgPanel, " ").concat(textPrimary, " rounded-lg overflow-hidden p-8"),
|
|
54793
|
+
"data-testid": "onboarding-modal",
|
|
54794
|
+
children: [state === STATE.WELCOME && /*#__PURE__*/jsx(WelcomeBody, {
|
|
54795
|
+
onInstall: handleInstall,
|
|
54796
|
+
onSkip: handleSkip,
|
|
54797
|
+
textMuted: textMuted
|
|
54798
|
+
}), state === STATE.INSTALLING && /*#__PURE__*/jsx(InstallingBody, {
|
|
54799
|
+
items: progressItems,
|
|
54800
|
+
borderPanel: borderPanel,
|
|
54801
|
+
textMuted: textMuted
|
|
54802
|
+
}), state === STATE.DONE && /*#__PURE__*/jsx(DoneBody, {
|
|
54803
|
+
onOpen: handleOpen,
|
|
54804
|
+
textMuted: textMuted
|
|
54805
|
+
}), state === STATE.ERROR && /*#__PURE__*/jsx(ErrorBody, {
|
|
54806
|
+
message: installError,
|
|
54807
|
+
onRetry: handleRetry,
|
|
54808
|
+
onSkip: handleSkip,
|
|
54809
|
+
textMuted: textMuted
|
|
54810
|
+
})]
|
|
54811
|
+
})
|
|
54812
|
+
});
|
|
54813
|
+
};
|
|
54814
|
+
function WelcomeBody(_ref7) {
|
|
54815
|
+
var onInstall = _ref7.onInstall,
|
|
54816
|
+
onSkip = _ref7.onSkip,
|
|
54817
|
+
textMuted = _ref7.textMuted;
|
|
54818
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
54819
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
54820
|
+
className: "flex items-center gap-3 mb-2",
|
|
54821
|
+
children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
54822
|
+
icon: "sink",
|
|
54823
|
+
className: "text-2xl"
|
|
54824
|
+
}), /*#__PURE__*/jsx(Heading2, {
|
|
54825
|
+
title: "Welcome to Dash"
|
|
54826
|
+
})]
|
|
54827
|
+
}), /*#__PURE__*/jsxs(Paragraph, {
|
|
54828
|
+
className: "".concat(textMuted, " mb-6"),
|
|
54829
|
+
children: ["Get started with the ", /*#__PURE__*/jsx("strong", {
|
|
54830
|
+
children: "Kitchen Sink"
|
|
54831
|
+
}), " dashboard \u2014 a curated set of widgets that shows what Dash can do. You can swap anything out, or build your own from scratch later."]
|
|
54832
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
54833
|
+
className: "flex items-center justify-end gap-3 mt-2",
|
|
54834
|
+
children: [/*#__PURE__*/jsx(Button, {
|
|
54835
|
+
onClick: onSkip,
|
|
54836
|
+
title: "Skip for now",
|
|
54837
|
+
textSize: "text-sm",
|
|
54838
|
+
padding: "py-2 px-4",
|
|
54839
|
+
backgroundColor: "bg-gray-700",
|
|
54840
|
+
textColor: "text-gray-300",
|
|
54841
|
+
hoverTextColor: "hover:text-white",
|
|
54842
|
+
hoverBackgroundColor: "hover:bg-gray-600",
|
|
54843
|
+
"data-testid": "onboarding-skip-button"
|
|
54844
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
54845
|
+
onClick: onInstall,
|
|
54846
|
+
title: "Install Kitchen Sink",
|
|
54847
|
+
textSize: "text-sm",
|
|
54848
|
+
padding: "py-2 px-4",
|
|
54849
|
+
backgroundColor: "bg-blue-600",
|
|
54850
|
+
textColor: "text-white",
|
|
54851
|
+
hoverTextColor: "hover:text-white",
|
|
54852
|
+
hoverBackgroundColor: "hover:bg-blue-500",
|
|
54853
|
+
icon: "download",
|
|
54854
|
+
"data-testid": "onboarding-install-button"
|
|
54855
|
+
})]
|
|
54856
|
+
})]
|
|
54857
|
+
});
|
|
54858
|
+
}
|
|
54859
|
+
function InstallingBody(_ref8) {
|
|
54860
|
+
var items = _ref8.items,
|
|
54861
|
+
borderPanel = _ref8.borderPanel,
|
|
54862
|
+
textMuted = _ref8.textMuted;
|
|
54863
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
54864
|
+
children: [/*#__PURE__*/jsx(SubHeading, {
|
|
54865
|
+
title: "Installing Kitchen Sink\u2026"
|
|
54866
|
+
}), /*#__PURE__*/jsx(Paragraph, {
|
|
54867
|
+
className: "".concat(textMuted, " mt-2 mb-4"),
|
|
54868
|
+
children: "Downloading widgets, theme, and dashboard configuration from the registry. This usually takes a few seconds."
|
|
54869
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
54870
|
+
className: "border ".concat(borderPanel, " rounded-md max-h-64 overflow-y-auto"),
|
|
54871
|
+
"data-testid": "onboarding-progress-list",
|
|
54872
|
+
children: [items.length === 0 && /*#__PURE__*/jsx("div", {
|
|
54873
|
+
className: "p-3 ".concat(textMuted),
|
|
54874
|
+
children: "Starting install\u2026"
|
|
54875
|
+
}), items.map(function (item, idx) {
|
|
54876
|
+
return /*#__PURE__*/jsxs("div", {
|
|
54877
|
+
className: "flex items-center justify-between px-3 py-2",
|
|
54878
|
+
"data-status": item.status,
|
|
54879
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
54880
|
+
className: "truncate",
|
|
54881
|
+
children: item.displayName || item.packageName || "Item ".concat(idx + 1)
|
|
54882
|
+
}), /*#__PURE__*/jsx(StatusBadge, {
|
|
54883
|
+
status: item.status
|
|
54884
|
+
})]
|
|
54885
|
+
}, "".concat(item.packageName || "slot", "-").concat(idx));
|
|
54886
|
+
})]
|
|
54887
|
+
})]
|
|
54888
|
+
});
|
|
54889
|
+
}
|
|
54890
|
+
function StatusBadge(_ref9) {
|
|
54891
|
+
var status = _ref9.status;
|
|
54892
|
+
switch (status) {
|
|
54893
|
+
case "installed":
|
|
54894
|
+
case "already-installed":
|
|
54895
|
+
return /*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
54896
|
+
icon: "check",
|
|
54897
|
+
className: "text-green-500",
|
|
54898
|
+
"data-testid": "status-installed"
|
|
54899
|
+
});
|
|
54900
|
+
case "failed":
|
|
54901
|
+
return /*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
54902
|
+
icon: "xmark",
|
|
54903
|
+
className: "text-red-500",
|
|
54904
|
+
"data-testid": "status-failed"
|
|
54905
|
+
});
|
|
54906
|
+
case "downloading":
|
|
54907
|
+
case "pending":
|
|
54908
|
+
default:
|
|
54909
|
+
return /*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
54910
|
+
icon: "circle-notch",
|
|
54911
|
+
className: "animate-spin",
|
|
54912
|
+
"data-testid": "status-".concat(status || "pending")
|
|
54913
|
+
});
|
|
54914
|
+
}
|
|
54915
|
+
}
|
|
54916
|
+
function DoneBody(_ref0) {
|
|
54917
|
+
var onOpen = _ref0.onOpen,
|
|
54918
|
+
textMuted = _ref0.textMuted;
|
|
54919
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
54920
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
54921
|
+
className: "flex items-center gap-3 mb-2",
|
|
54922
|
+
children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
54923
|
+
icon: "check",
|
|
54924
|
+
className: "text-2xl text-green-500"
|
|
54925
|
+
}), /*#__PURE__*/jsx(Heading2, {
|
|
54926
|
+
title: "Kitchen Sink Installed"
|
|
54927
|
+
})]
|
|
54928
|
+
}), /*#__PURE__*/jsx(Paragraph, {
|
|
54929
|
+
className: "".concat(textMuted, " mb-6"),
|
|
54930
|
+
children: "Your first dashboard is ready. Open it to explore \u2014 every widget and the theme are now installed locally."
|
|
54931
|
+
}), /*#__PURE__*/jsx("div", {
|
|
54932
|
+
className: "flex items-center justify-end",
|
|
54933
|
+
children: /*#__PURE__*/jsx(Button, {
|
|
54934
|
+
onClick: onOpen,
|
|
54935
|
+
title: "Open Kitchen Sink",
|
|
54936
|
+
textSize: "text-sm",
|
|
54937
|
+
padding: "py-2 px-4",
|
|
54938
|
+
backgroundColor: "bg-green-600",
|
|
54939
|
+
textColor: "text-white",
|
|
54940
|
+
hoverTextColor: "hover:text-white",
|
|
54941
|
+
hoverBackgroundColor: "hover:bg-green-500",
|
|
54942
|
+
icon: "arrow-right",
|
|
54943
|
+
"data-testid": "onboarding-open-button"
|
|
54944
|
+
})
|
|
54945
|
+
})]
|
|
54946
|
+
});
|
|
54947
|
+
}
|
|
54948
|
+
function ErrorBody(_ref1) {
|
|
54949
|
+
var message = _ref1.message,
|
|
54950
|
+
onRetry = _ref1.onRetry,
|
|
54951
|
+
onSkip = _ref1.onSkip,
|
|
54952
|
+
textMuted = _ref1.textMuted;
|
|
54953
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
54954
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
54955
|
+
className: "flex items-center gap-3 mb-2",
|
|
54956
|
+
children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
54957
|
+
icon: "triangle-exclamation",
|
|
54958
|
+
className: "text-2xl text-red-500"
|
|
54959
|
+
}), /*#__PURE__*/jsx(Heading2, {
|
|
54960
|
+
title: "Install Failed"
|
|
54961
|
+
})]
|
|
54962
|
+
}), /*#__PURE__*/jsx(Paragraph, {
|
|
54963
|
+
className: "".concat(textMuted, " mb-6"),
|
|
54964
|
+
children: message || "Something went wrong installing Kitchen Sink."
|
|
54965
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
54966
|
+
className: "flex items-center justify-end gap-3",
|
|
54967
|
+
children: [/*#__PURE__*/jsx(Button, {
|
|
54968
|
+
onClick: onSkip,
|
|
54969
|
+
title: "Skip for now",
|
|
54970
|
+
textSize: "text-sm",
|
|
54971
|
+
padding: "py-2 px-4",
|
|
54972
|
+
backgroundColor: "bg-gray-700",
|
|
54973
|
+
textColor: "text-gray-300",
|
|
54974
|
+
hoverTextColor: "hover:text-white",
|
|
54975
|
+
hoverBackgroundColor: "hover:bg-gray-600",
|
|
54976
|
+
"data-testid": "onboarding-skip-after-error-button"
|
|
54977
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
54978
|
+
onClick: onRetry,
|
|
54979
|
+
title: "Try again",
|
|
54980
|
+
textSize: "text-sm",
|
|
54981
|
+
padding: "py-2 px-4",
|
|
54982
|
+
backgroundColor: "bg-blue-600",
|
|
54983
|
+
textColor: "text-white",
|
|
54984
|
+
hoverTextColor: "hover:text-white",
|
|
54985
|
+
hoverBackgroundColor: "hover:bg-blue-500",
|
|
54986
|
+
icon: "rotate-right",
|
|
54987
|
+
"data-testid": "onboarding-retry-button"
|
|
54988
|
+
})]
|
|
54989
|
+
})]
|
|
54990
|
+
});
|
|
54991
|
+
}
|
|
54992
|
+
|
|
54586
54993
|
var DashCommandPalette = function DashCommandPalette(_ref) {
|
|
54587
54994
|
var isOpen = _ref.isOpen,
|
|
54588
54995
|
setIsOpen = _ref.setIsOpen,
|
|
@@ -60391,64 +60798,75 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
60391
60798
|
isWizardOpen = _useState36[0],
|
|
60392
60799
|
setIsWizardOpen = _useState36[1];
|
|
60393
60800
|
|
|
60801
|
+
// First-run onboarding (Phase 3A). Tri-state:
|
|
60802
|
+
// null — status not yet loaded from main; do not render anything
|
|
60803
|
+
// true — show the OnboardingModal
|
|
60804
|
+
// false — onboarding already completed (or app is not first-run)
|
|
60805
|
+
// The status read happens once per mount; subsequent dismiss/complete
|
|
60806
|
+
// flips this to false without re-fetching.
|
|
60807
|
+
var _useState37 = useState(null),
|
|
60808
|
+
_useState38 = _slicedToArray(_useState37, 2),
|
|
60809
|
+
isOnboardingOpen = _useState38[0],
|
|
60810
|
+
setIsOnboardingOpen = _useState38[1];
|
|
60811
|
+
|
|
60394
60812
|
// Missing widgets detection
|
|
60395
60813
|
var _useMissingWidgets = useMissingWidgets(workspaceSelected),
|
|
60396
60814
|
missingComponents = _useMissingWidgets.missingComponents,
|
|
60397
60815
|
hasMissing = _useMissingWidgets.hasMissing;
|
|
60398
|
-
var
|
|
60399
|
-
_useState38 = _slicedToArray(_useState37, 2),
|
|
60400
|
-
isMissingWidgetsModalOpen = _useState38[0],
|
|
60401
|
-
setIsMissingWidgetsModalOpen = _useState38[1];
|
|
60402
|
-
var _useState39 = useState(new Set()),
|
|
60816
|
+
var _useState39 = useState(false),
|
|
60403
60817
|
_useState40 = _slicedToArray(_useState39, 2),
|
|
60404
|
-
|
|
60405
|
-
|
|
60818
|
+
isMissingWidgetsModalOpen = _useState40[0],
|
|
60819
|
+
setIsMissingWidgetsModalOpen = _useState40[1];
|
|
60820
|
+
var _useState41 = useState(new Set()),
|
|
60821
|
+
_useState42 = _slicedToArray(_useState41, 2),
|
|
60822
|
+
dismissedMissingForWorkspace = _useState42[0],
|
|
60823
|
+
setDismissedMissingForWorkspace = _useState42[1];
|
|
60406
60824
|
|
|
60407
60825
|
// Dashboard Config modal — bulk provider wiring for the current
|
|
60408
60826
|
// workspace. Auto-opens on first load of a workspace with unresolved
|
|
60409
60827
|
// providers (tracked per session via `configModalAutoOpenedFor` so
|
|
60410
60828
|
// switching tabs doesn't re-fire the modal).
|
|
60411
|
-
var
|
|
60412
|
-
_useState42 = _slicedToArray(_useState41, 2),
|
|
60413
|
-
isConfigModalOpen = _useState42[0],
|
|
60414
|
-
setIsConfigModalOpen = _useState42[1];
|
|
60415
|
-
useRef(new Set());
|
|
60416
|
-
var _useState43 = useState(new Set()),
|
|
60829
|
+
var _useState43 = useState(false),
|
|
60417
60830
|
_useState44 = _slicedToArray(_useState43, 2),
|
|
60418
|
-
|
|
60419
|
-
|
|
60831
|
+
isConfigModalOpen = _useState44[0],
|
|
60832
|
+
setIsConfigModalOpen = _useState44[1];
|
|
60833
|
+
useRef(new Set());
|
|
60834
|
+
var _useState45 = useState(new Set()),
|
|
60835
|
+
_useState46 = _slicedToArray(_useState45, 2),
|
|
60836
|
+
dismissedUnresolvedForWorkspace = _useState46[0],
|
|
60837
|
+
setDismissedUnresolvedForWorkspace = _useState46[1];
|
|
60420
60838
|
|
|
60421
60839
|
// Unified App Settings Modal
|
|
60422
|
-
var
|
|
60423
|
-
_useState46 = _slicedToArray(_useState45, 2),
|
|
60424
|
-
isAppSettingsOpen = _useState46[0],
|
|
60425
|
-
setIsAppSettingsOpen = _useState46[1];
|
|
60426
|
-
var _useState47 = useState("dashboards"),
|
|
60840
|
+
var _useState47 = useState(false),
|
|
60427
60841
|
_useState48 = _slicedToArray(_useState47, 2),
|
|
60428
|
-
|
|
60429
|
-
|
|
60430
|
-
var _useState49 = useState(
|
|
60842
|
+
isAppSettingsOpen = _useState48[0],
|
|
60843
|
+
setIsAppSettingsOpen = _useState48[1];
|
|
60844
|
+
var _useState49 = useState("dashboards"),
|
|
60431
60845
|
_useState50 = _slicedToArray(_useState49, 2),
|
|
60432
|
-
|
|
60433
|
-
|
|
60434
|
-
var _useState51 = useState(
|
|
60846
|
+
appSettingsInitialSection = _useState50[0],
|
|
60847
|
+
setAppSettingsInitialSection = _useState50[1];
|
|
60848
|
+
var _useState51 = useState(null),
|
|
60435
60849
|
_useState52 = _slicedToArray(_useState51, 2),
|
|
60436
|
-
|
|
60437
|
-
|
|
60850
|
+
appSettingsInitialProvider = _useState52[0],
|
|
60851
|
+
setAppSettingsInitialProvider = _useState52[1];
|
|
60852
|
+
var _useState53 = useState(false),
|
|
60853
|
+
_useState54 = _slicedToArray(_useState53, 2),
|
|
60854
|
+
appSettingsCreateProvider = _useState54[0],
|
|
60855
|
+
setAppSettingsCreateProvider = _useState54[1];
|
|
60438
60856
|
// Optional pre-fills used by the cross-modal "Add new <type>"
|
|
60439
60857
|
// flow dispatched from dash-electron's WidgetBuilderModal.
|
|
60440
60858
|
// initialProviderType is the type id (e.g. "filesystem", "slack").
|
|
60441
60859
|
// initialProviderClass routes the create flow: "mcp" opens the
|
|
60442
60860
|
// catalog detail with that type pre-selected; otherwise opens
|
|
60443
60861
|
// the credential create form with formType pre-filled.
|
|
60444
|
-
var _useState53 = useState(null),
|
|
60445
|
-
_useState54 = _slicedToArray(_useState53, 2),
|
|
60446
|
-
appSettingsInitialProviderType = _useState54[0],
|
|
60447
|
-
setAppSettingsInitialProviderType = _useState54[1];
|
|
60448
60862
|
var _useState55 = useState(null),
|
|
60449
60863
|
_useState56 = _slicedToArray(_useState55, 2),
|
|
60450
|
-
|
|
60451
|
-
|
|
60864
|
+
appSettingsInitialProviderType = _useState56[0],
|
|
60865
|
+
setAppSettingsInitialProviderType = _useState56[1];
|
|
60866
|
+
var _useState57 = useState(null),
|
|
60867
|
+
_useState58 = _slicedToArray(_useState57, 2),
|
|
60868
|
+
appSettingsInitialProviderClass = _useState58[0],
|
|
60869
|
+
setAppSettingsInitialProviderClass = _useState58[1];
|
|
60452
60870
|
function openAppSettings() {
|
|
60453
60871
|
var section = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "general";
|
|
60454
60872
|
var providerName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
@@ -60466,27 +60884,27 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
60466
60884
|
return _handleProfileUpdated.apply(this, arguments);
|
|
60467
60885
|
} // Ref to access LayoutBuilder's current workspace without re-render cascades
|
|
60468
60886
|
function _handleProfileUpdated() {
|
|
60469
|
-
_handleProfileUpdated = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
60470
|
-
var _window$
|
|
60471
|
-
return _regeneratorRuntime.wrap(function (
|
|
60472
|
-
while (1) switch (
|
|
60887
|
+
_handleProfileUpdated = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
60888
|
+
var _window$mainApi12, profile;
|
|
60889
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
60890
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
60473
60891
|
case 0:
|
|
60474
|
-
|
|
60475
|
-
|
|
60476
|
-
return (_window$
|
|
60892
|
+
_context3.prev = 0;
|
|
60893
|
+
_context3.next = 1;
|
|
60894
|
+
return (_window$mainApi12 = window.mainApi) === null || _window$mainApi12 === void 0 || (_window$mainApi12 = _window$mainApi12.registryAuth) === null || _window$mainApi12 === void 0 ? void 0 : _window$mainApi12.getProfile();
|
|
60477
60895
|
case 1:
|
|
60478
|
-
profile =
|
|
60896
|
+
profile = _context3.sent;
|
|
60479
60897
|
if (profile) setAuthProfile(profile);
|
|
60480
|
-
|
|
60898
|
+
_context3.next = 3;
|
|
60481
60899
|
break;
|
|
60482
60900
|
case 2:
|
|
60483
|
-
|
|
60484
|
-
|
|
60901
|
+
_context3.prev = 2;
|
|
60902
|
+
_context3["catch"](0);
|
|
60485
60903
|
case 3:
|
|
60486
60904
|
case "end":
|
|
60487
|
-
return
|
|
60905
|
+
return _context3.stop();
|
|
60488
60906
|
}
|
|
60489
|
-
},
|
|
60907
|
+
}, _callee3, null, [[0, 2]]);
|
|
60490
60908
|
}));
|
|
60491
60909
|
return _handleProfileUpdated.apply(this, arguments);
|
|
60492
60910
|
}
|
|
@@ -60523,14 +60941,14 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
60523
60941
|
// editing. Shapes:
|
|
60524
60942
|
// { kind: "open-workspace", workspace } — sidebar switch
|
|
60525
60943
|
// { kind: "cancel-edit" } — Cancel button
|
|
60526
|
-
var
|
|
60527
|
-
_useState58 = _slicedToArray(_useState57, 2),
|
|
60528
|
-
isDirty = _useState58[0],
|
|
60529
|
-
setIsDirty = _useState58[1];
|
|
60530
|
-
var _useState59 = useState(null),
|
|
60944
|
+
var _useState59 = useState(false),
|
|
60531
60945
|
_useState60 = _slicedToArray(_useState59, 2),
|
|
60532
|
-
|
|
60533
|
-
|
|
60946
|
+
isDirty = _useState60[0],
|
|
60947
|
+
setIsDirty = _useState60[1];
|
|
60948
|
+
var _useState61 = useState(null),
|
|
60949
|
+
_useState62 = _slicedToArray(_useState61, 2),
|
|
60950
|
+
pendingNavigation = _useState62[0],
|
|
60951
|
+
setPendingNavigation = _useState62[1];
|
|
60534
60952
|
useEffect(function () {
|
|
60535
60953
|
if (typeof globalThis !== "undefined") {
|
|
60536
60954
|
globalThis.__dashboardIsDirty = isDirty;
|
|
@@ -60541,6 +60959,63 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
60541
60959
|
}
|
|
60542
60960
|
};
|
|
60543
60961
|
}, [isDirty]);
|
|
60962
|
+
|
|
60963
|
+
// ─── First-run onboarding gate (Phase 3A) ────────────────────────
|
|
60964
|
+
// Decision fires exactly once per mount after the first workspaces
|
|
60965
|
+
// load completes. We need to wait for `isLoadingWorkspaces` to flip
|
|
60966
|
+
// true→false at least once; otherwise the gate reads workspaceConfig
|
|
60967
|
+
// at its initial empty value and would flash the modal on every
|
|
60968
|
+
// launch.
|
|
60969
|
+
//
|
|
60970
|
+
// Popout windows never show the modal — they're a slave to the
|
|
60971
|
+
// main window's onboarding decision and don't need their own gate.
|
|
60972
|
+
var onboardingCheckedRef = useRef(false);
|
|
60973
|
+
useEffect(function () {
|
|
60974
|
+
if (popout) {
|
|
60975
|
+
setIsOnboardingOpen(false);
|
|
60976
|
+
return;
|
|
60977
|
+
}
|
|
60978
|
+
if (onboardingCheckedRef.current) return;
|
|
60979
|
+
if (isLoadingWorkspaces) return;
|
|
60980
|
+
onboardingCheckedRef.current = true;
|
|
60981
|
+
var cancelled = false;
|
|
60982
|
+
_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
60983
|
+
var _window$mainApi, _window$mainApi$getSt, status;
|
|
60984
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
60985
|
+
while (1) switch (_context.prev = _context.next) {
|
|
60986
|
+
case 0:
|
|
60987
|
+
_context.prev = 0;
|
|
60988
|
+
_context.next = 1;
|
|
60989
|
+
return (_window$mainApi = window.mainApi) === null || _window$mainApi === void 0 || (_window$mainApi = _window$mainApi.onboarding) === null || _window$mainApi === void 0 || (_window$mainApi$getSt = _window$mainApi.getStatus) === null || _window$mainApi$getSt === void 0 ? void 0 : _window$mainApi$getSt.call(_window$mainApi);
|
|
60990
|
+
case 1:
|
|
60991
|
+
status = _context.sent;
|
|
60992
|
+
if (!cancelled) {
|
|
60993
|
+
_context.next = 2;
|
|
60994
|
+
break;
|
|
60995
|
+
}
|
|
60996
|
+
return _context.abrupt("return");
|
|
60997
|
+
case 2:
|
|
60998
|
+
if (status && status.completed === false && workspaceConfig.length === 0) {
|
|
60999
|
+
setIsOnboardingOpen(true);
|
|
61000
|
+
} else {
|
|
61001
|
+
setIsOnboardingOpen(false);
|
|
61002
|
+
}
|
|
61003
|
+
_context.next = 4;
|
|
61004
|
+
break;
|
|
61005
|
+
case 3:
|
|
61006
|
+
_context.prev = 3;
|
|
61007
|
+
_context["catch"](0);
|
|
61008
|
+
if (!cancelled) setIsOnboardingOpen(false);
|
|
61009
|
+
case 4:
|
|
61010
|
+
case "end":
|
|
61011
|
+
return _context.stop();
|
|
61012
|
+
}
|
|
61013
|
+
}, _callee, null, [[0, 3]]);
|
|
61014
|
+
}))();
|
|
61015
|
+
return function () {
|
|
61016
|
+
cancelled = true;
|
|
61017
|
+
};
|
|
61018
|
+
}, [popout, isLoadingWorkspaces, workspaceConfig.length]);
|
|
60544
61019
|
useEffect(function () {
|
|
60545
61020
|
isLoadingWorkspaces === false && loadWorkspaces();
|
|
60546
61021
|
isLoadingMenuItems === false && loadMenuItems();
|
|
@@ -60555,9 +61030,9 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
60555
61030
|
return ws.id === popoutWorkspaceId;
|
|
60556
61031
|
});
|
|
60557
61032
|
if (target) {
|
|
60558
|
-
var _window$
|
|
61033
|
+
var _window$mainApi2;
|
|
60559
61034
|
handleOpenTab(target);
|
|
60560
|
-
if ((_window$
|
|
61035
|
+
if ((_window$mainApi2 = window.mainApi) !== null && _window$mainApi2 !== void 0 && (_window$mainApi2 = _window$mainApi2.popout) !== null && _window$mainApi2 !== void 0 && _window$mainApi2.setTitle) {
|
|
60561
61036
|
window.mainApi.popout.setTitle(popoutWorkspaceId, target.name || "Untitled");
|
|
60562
61037
|
}
|
|
60563
61038
|
}
|
|
@@ -60566,15 +61041,15 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
60566
61041
|
|
|
60567
61042
|
// ─── Listen for workspace:saved broadcasts (MCP tools, popouts) ──
|
|
60568
61043
|
useEffect(function () {
|
|
60569
|
-
var _window$
|
|
60570
|
-
if (!((_window$
|
|
61044
|
+
var _window$mainApi3;
|
|
61045
|
+
if (!((_window$mainApi3 = window.mainApi) !== null && _window$mainApi3 !== void 0 && _window$mainApi3.on)) return;
|
|
60571
61046
|
var handler = function handler() {
|
|
60572
61047
|
loadWorkspaces();
|
|
60573
61048
|
};
|
|
60574
61049
|
window.mainApi.on("workspace:saved", handler);
|
|
60575
61050
|
return function () {
|
|
60576
|
-
var _window$
|
|
60577
|
-
if ((_window$
|
|
61051
|
+
var _window$mainApi4;
|
|
61052
|
+
if ((_window$mainApi4 = window.mainApi) !== null && _window$mainApi4 !== void 0 && _window$mainApi4.removeListener) {
|
|
60578
61053
|
window.mainApi.removeListener("workspace:saved", handler);
|
|
60579
61054
|
}
|
|
60580
61055
|
};
|
|
@@ -60606,9 +61081,9 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
60606
61081
|
// closing the builder modal — this listener only opens Settings.
|
|
60607
61082
|
useEffect(function () {
|
|
60608
61083
|
var handler = function handler(e) {
|
|
60609
|
-
var
|
|
60610
|
-
type =
|
|
60611
|
-
providerClass =
|
|
61084
|
+
var _ref5 = (e === null || e === void 0 ? void 0 : e.detail) || {},
|
|
61085
|
+
type = _ref5.type,
|
|
61086
|
+
providerClass = _ref5.providerClass;
|
|
60612
61087
|
if (!type) return;
|
|
60613
61088
|
openAppSettings("providers", null, true, type, providerClass || null);
|
|
60614
61089
|
};
|
|
@@ -60628,10 +61103,10 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
60628
61103
|
// We record the requested ID and open it once it appears in
|
|
60629
61104
|
// workspaceConfig — handles the case where the workspace was just
|
|
60630
61105
|
// created and the config reload is still in flight.
|
|
60631
|
-
var
|
|
60632
|
-
|
|
60633
|
-
pendingOpenWorkspaceId =
|
|
60634
|
-
setPendingOpenWorkspaceId =
|
|
61106
|
+
var _useState63 = useState(null),
|
|
61107
|
+
_useState64 = _slicedToArray(_useState63, 2),
|
|
61108
|
+
pendingOpenWorkspaceId = _useState64[0],
|
|
61109
|
+
setPendingOpenWorkspaceId = _useState64[1];
|
|
60635
61110
|
useEffect(function () {
|
|
60636
61111
|
var handler = function handler(e) {
|
|
60637
61112
|
var _e$detail2;
|
|
@@ -60659,30 +61134,30 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
60659
61134
|
|
|
60660
61135
|
// ─── Load recents on mount ───────────────────────────────────────
|
|
60661
61136
|
useEffect(function () {
|
|
60662
|
-
var _window$
|
|
61137
|
+
var _window$mainApi5;
|
|
60663
61138
|
if (popout) return;
|
|
60664
|
-
(_window$
|
|
61139
|
+
(_window$mainApi5 = window.mainApi) === null || _window$mainApi5 === void 0 || (_window$mainApi5 = _window$mainApi5.session) === null || _window$mainApi5 === void 0 || _window$mainApi5.getRecents().then(function (recents) {
|
|
60665
61140
|
if (recents) setRecentDashboards(recents);
|
|
60666
61141
|
});
|
|
60667
61142
|
}, [popout]);
|
|
60668
61143
|
|
|
60669
61144
|
// ─── Session save (continuous) ──────────────────────────────────
|
|
60670
61145
|
useEffect(function () {
|
|
60671
|
-
var _window$
|
|
61146
|
+
var _window$mainApi6;
|
|
60672
61147
|
if (popout) return;
|
|
60673
61148
|
var tabIds = openTabs.map(function (t) {
|
|
60674
61149
|
return t.id;
|
|
60675
61150
|
});
|
|
60676
|
-
(_window$
|
|
61151
|
+
(_window$mainApi6 = window.mainApi) === null || _window$mainApi6 === void 0 || (_window$mainApi6 = _window$mainApi6.session) === null || _window$mainApi6 === void 0 || _window$mainApi6.saveState(tabIds, activeTabId);
|
|
60677
61152
|
}, [openTabs, activeTabId, popout]);
|
|
60678
61153
|
|
|
60679
61154
|
// ─── Session restore on launch ─────────────────────────────────
|
|
60680
61155
|
useEffect(function () {
|
|
60681
|
-
var _window$
|
|
61156
|
+
var _window$mainApi7;
|
|
60682
61157
|
if (popout || workspaceConfig.length === 0 || sessionRestored.current) return;
|
|
60683
61158
|
sessionRestored.current = true;
|
|
60684
|
-
(_window$
|
|
60685
|
-
var _state$openTabIds, _window$
|
|
61159
|
+
(_window$mainApi7 = window.mainApi) === null || _window$mainApi7 === void 0 || (_window$mainApi7 = _window$mainApi7.session) === null || _window$mainApi7 === void 0 || _window$mainApi7.getState().then(function (state) {
|
|
61160
|
+
var _state$openTabIds, _window$mainApi8;
|
|
60686
61161
|
if (!(state !== null && state !== void 0 && (_state$openTabIds = state.openTabIds) !== null && _state$openTabIds !== void 0 && _state$openTabIds.length)) return;
|
|
60687
61162
|
state.openTabIds.forEach(function (wsId) {
|
|
60688
61163
|
var ws = workspaceConfig.find(function (w) {
|
|
@@ -60691,7 +61166,7 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
60691
61166
|
if (ws) handleOpenTab(ws);
|
|
60692
61167
|
});
|
|
60693
61168
|
if (state.activeTabId) setActiveTabId(state.activeTabId);
|
|
60694
|
-
(_window$
|
|
61169
|
+
(_window$mainApi8 = window.mainApi) === null || _window$mainApi8 === void 0 || (_window$mainApi8 = _window$mainApi8.session) === null || _window$mainApi8 === void 0 || _window$mainApi8.clearState();
|
|
60695
61170
|
});
|
|
60696
61171
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
60697
61172
|
}, [workspaceConfig, popout]);
|
|
@@ -60704,35 +61179,35 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
60704
61179
|
return _checkAuth.apply(this, arguments);
|
|
60705
61180
|
}
|
|
60706
61181
|
function _checkAuth() {
|
|
60707
|
-
_checkAuth = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
60708
|
-
var _window$
|
|
60709
|
-
return _regeneratorRuntime.wrap(function (
|
|
60710
|
-
while (1) switch (
|
|
61182
|
+
_checkAuth = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
61183
|
+
var _window$mainApi9, status, _window$mainApi0, profile;
|
|
61184
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
61185
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
60711
61186
|
case 0:
|
|
60712
|
-
|
|
60713
|
-
|
|
60714
|
-
return (_window$
|
|
61187
|
+
_context2.prev = 0;
|
|
61188
|
+
_context2.next = 1;
|
|
61189
|
+
return (_window$mainApi9 = window.mainApi) === null || _window$mainApi9 === void 0 || (_window$mainApi9 = _window$mainApi9.registryAuth) === null || _window$mainApi9 === void 0 ? void 0 : _window$mainApi9.getStatus();
|
|
60715
61190
|
case 1:
|
|
60716
|
-
status =
|
|
61191
|
+
status = _context2.sent;
|
|
60717
61192
|
if (!cancelled) {
|
|
60718
|
-
|
|
61193
|
+
_context2.next = 2;
|
|
60719
61194
|
break;
|
|
60720
61195
|
}
|
|
60721
|
-
return
|
|
61196
|
+
return _context2.abrupt("return");
|
|
60722
61197
|
case 2:
|
|
60723
61198
|
if (!(status !== null && status !== void 0 && status.authenticated)) {
|
|
60724
|
-
|
|
61199
|
+
_context2.next = 5;
|
|
60725
61200
|
break;
|
|
60726
61201
|
}
|
|
60727
|
-
|
|
60728
|
-
return (_window$
|
|
61202
|
+
_context2.next = 3;
|
|
61203
|
+
return (_window$mainApi0 = window.mainApi) === null || _window$mainApi0 === void 0 || (_window$mainApi0 = _window$mainApi0.registryAuth) === null || _window$mainApi0 === void 0 ? void 0 : _window$mainApi0.getProfile();
|
|
60729
61204
|
case 3:
|
|
60730
|
-
profile =
|
|
61205
|
+
profile = _context2.sent;
|
|
60731
61206
|
if (!cancelled) {
|
|
60732
|
-
|
|
61207
|
+
_context2.next = 4;
|
|
60733
61208
|
break;
|
|
60734
61209
|
}
|
|
60735
|
-
return
|
|
61210
|
+
return _context2.abrupt("return");
|
|
60736
61211
|
case 4:
|
|
60737
61212
|
if (profile) {
|
|
60738
61213
|
setAuthProfile(profile);
|
|
@@ -60740,22 +61215,22 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
60740
61215
|
} else {
|
|
60741
61216
|
setAuthStatus("unauthenticated");
|
|
60742
61217
|
}
|
|
60743
|
-
|
|
61218
|
+
_context2.next = 6;
|
|
60744
61219
|
break;
|
|
60745
61220
|
case 5:
|
|
60746
61221
|
setAuthStatus("unauthenticated");
|
|
60747
61222
|
case 6:
|
|
60748
|
-
|
|
61223
|
+
_context2.next = 8;
|
|
60749
61224
|
break;
|
|
60750
61225
|
case 7:
|
|
60751
|
-
|
|
60752
|
-
|
|
61226
|
+
_context2.prev = 7;
|
|
61227
|
+
_context2["catch"](0);
|
|
60753
61228
|
if (!cancelled) setAuthStatus("unauthenticated");
|
|
60754
61229
|
case 8:
|
|
60755
61230
|
case "end":
|
|
60756
|
-
return
|
|
61231
|
+
return _context2.stop();
|
|
60757
61232
|
}
|
|
60758
|
-
},
|
|
61233
|
+
}, _callee2, null, [[0, 7]]);
|
|
60759
61234
|
}));
|
|
60760
61235
|
return _checkAuth.apply(this, arguments);
|
|
60761
61236
|
}
|
|
@@ -60882,8 +61357,8 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
60882
61357
|
|
|
60883
61358
|
// Track in recents
|
|
60884
61359
|
if (!popout) {
|
|
60885
|
-
var _window$
|
|
60886
|
-
(_window$
|
|
61360
|
+
var _window$mainApi1;
|
|
61361
|
+
(_window$mainApi1 = window.mainApi) === null || _window$mainApi1 === void 0 || (_window$mainApi1 = _window$mainApi1.session) === null || _window$mainApi1 === void 0 || _window$mainApi1.addRecent(workspaceItem.id, workspaceItem.name || "Untitled").then(function (updated) {
|
|
60887
61362
|
if (updated) setRecentDashboards(updated);
|
|
60888
61363
|
});
|
|
60889
61364
|
}
|
|
@@ -61258,10 +61733,10 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
61258
61733
|
}
|
|
61259
61734
|
|
|
61260
61735
|
// ─── Page State ──────────────────────────────────────────────────
|
|
61261
|
-
var
|
|
61262
|
-
|
|
61263
|
-
activePageId =
|
|
61264
|
-
setActivePageId =
|
|
61736
|
+
var _useState65 = useState(null),
|
|
61737
|
+
_useState66 = _slicedToArray(_useState65, 2),
|
|
61738
|
+
activePageId = _useState66[0],
|
|
61739
|
+
setActivePageId = _useState66[1];
|
|
61265
61740
|
|
|
61266
61741
|
// Page history stack for goBack() — pushes the previous page id
|
|
61267
61742
|
// whenever a navigation happens through navigateToPage().
|
|
@@ -61295,9 +61770,9 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
61295
61770
|
// Listen for programmatic page switches via DashboardActionsApi
|
|
61296
61771
|
useEffect(function () {
|
|
61297
61772
|
function onSwitchPage(e) {
|
|
61298
|
-
var
|
|
61299
|
-
pageId =
|
|
61300
|
-
pageName =
|
|
61773
|
+
var _ref6 = e.detail || {},
|
|
61774
|
+
pageId = _ref6.pageId,
|
|
61775
|
+
pageName = _ref6.pageName;
|
|
61301
61776
|
if (pageId) {
|
|
61302
61777
|
navigateToPage(pageId);
|
|
61303
61778
|
} else if (pageName) {
|
|
@@ -61887,70 +62362,70 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
61887
62362
|
return _handleSidebarSignIn.apply(this, arguments);
|
|
61888
62363
|
}
|
|
61889
62364
|
function _handleSidebarSignIn() {
|
|
61890
|
-
_handleSidebarSignIn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
62365
|
+
_handleSidebarSignIn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
61891
62366
|
var flow, interval, poll;
|
|
61892
|
-
return _regeneratorRuntime.wrap(function (
|
|
61893
|
-
while (1) switch (
|
|
62367
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
62368
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
61894
62369
|
case 0:
|
|
61895
|
-
|
|
61896
|
-
|
|
62370
|
+
_context5.prev = 0;
|
|
62371
|
+
_context5.next = 1;
|
|
61897
62372
|
return window.mainApi.registryAuth.initiateLogin();
|
|
61898
62373
|
case 1:
|
|
61899
|
-
flow =
|
|
62374
|
+
flow = _context5.sent;
|
|
61900
62375
|
if (flow.verificationUrlComplete) {
|
|
61901
62376
|
window.mainApi.shell.openExternal(flow.verificationUrlComplete);
|
|
61902
62377
|
}
|
|
61903
62378
|
interval = (flow.interval || 5) * 1000;
|
|
61904
|
-
poll = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
62379
|
+
poll = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
61905
62380
|
var result, profile;
|
|
61906
|
-
return _regeneratorRuntime.wrap(function (
|
|
61907
|
-
while (1) switch (
|
|
62381
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
62382
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
61908
62383
|
case 0:
|
|
61909
|
-
|
|
61910
|
-
|
|
62384
|
+
_context4.prev = 0;
|
|
62385
|
+
_context4.next = 1;
|
|
61911
62386
|
return window.mainApi.registryAuth.pollToken(flow.deviceCode);
|
|
61912
62387
|
case 1:
|
|
61913
|
-
result =
|
|
62388
|
+
result = _context4.sent;
|
|
61914
62389
|
if (!(result.status === "authorized")) {
|
|
61915
|
-
|
|
62390
|
+
_context4.next = 3;
|
|
61916
62391
|
break;
|
|
61917
62392
|
}
|
|
61918
62393
|
clearInterval(poll);
|
|
61919
|
-
|
|
62394
|
+
_context4.next = 2;
|
|
61920
62395
|
return window.mainApi.registryAuth.getProfile();
|
|
61921
62396
|
case 2:
|
|
61922
|
-
profile =
|
|
62397
|
+
profile = _context4.sent;
|
|
61923
62398
|
setAuthProfile(profile);
|
|
61924
62399
|
setAuthStatus("authenticated");
|
|
61925
|
-
|
|
62400
|
+
_context4.next = 4;
|
|
61926
62401
|
break;
|
|
61927
62402
|
case 3:
|
|
61928
62403
|
if (result.status === "expired") {
|
|
61929
62404
|
clearInterval(poll);
|
|
61930
62405
|
}
|
|
61931
62406
|
case 4:
|
|
61932
|
-
|
|
62407
|
+
_context4.next = 6;
|
|
61933
62408
|
break;
|
|
61934
62409
|
case 5:
|
|
61935
|
-
|
|
61936
|
-
|
|
62410
|
+
_context4.prev = 5;
|
|
62411
|
+
_context4["catch"](0);
|
|
61937
62412
|
clearInterval(poll);
|
|
61938
62413
|
case 6:
|
|
61939
62414
|
case "end":
|
|
61940
|
-
return
|
|
62415
|
+
return _context4.stop();
|
|
61941
62416
|
}
|
|
61942
|
-
},
|
|
62417
|
+
}, _callee4, null, [[0, 5]]);
|
|
61943
62418
|
})), interval);
|
|
61944
|
-
|
|
62419
|
+
_context5.next = 3;
|
|
61945
62420
|
break;
|
|
61946
62421
|
case 2:
|
|
61947
|
-
|
|
61948
|
-
|
|
62422
|
+
_context5.prev = 2;
|
|
62423
|
+
_context5["catch"](0);
|
|
61949
62424
|
case 3:
|
|
61950
62425
|
case "end":
|
|
61951
|
-
return
|
|
62426
|
+
return _context5.stop();
|
|
61952
62427
|
}
|
|
61953
|
-
},
|
|
62428
|
+
}, _callee5, null, [[0, 2]]);
|
|
61954
62429
|
}));
|
|
61955
62430
|
return _handleSidebarSignIn.apply(this, arguments);
|
|
61956
62431
|
}
|
|
@@ -61958,38 +62433,38 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
61958
62433
|
return _handleSidebarSignOut.apply(this, arguments);
|
|
61959
62434
|
}
|
|
61960
62435
|
function _handleSidebarSignOut() {
|
|
61961
|
-
_handleSidebarSignOut = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
61962
|
-
return _regeneratorRuntime.wrap(function (
|
|
61963
|
-
while (1) switch (
|
|
62436
|
+
_handleSidebarSignOut = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
62437
|
+
return _regeneratorRuntime.wrap(function (_context6) {
|
|
62438
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
61964
62439
|
case 0:
|
|
61965
|
-
|
|
61966
|
-
|
|
62440
|
+
_context6.prev = 0;
|
|
62441
|
+
_context6.next = 1;
|
|
61967
62442
|
return window.mainApi.registryAuth.logout();
|
|
61968
62443
|
case 1:
|
|
61969
62444
|
setAuthStatus("unauthenticated");
|
|
61970
62445
|
setAuthProfile(null);
|
|
61971
|
-
|
|
62446
|
+
_context6.next = 3;
|
|
61972
62447
|
break;
|
|
61973
62448
|
case 2:
|
|
61974
|
-
|
|
61975
|
-
|
|
62449
|
+
_context6.prev = 2;
|
|
62450
|
+
_context6["catch"](0);
|
|
61976
62451
|
case 3:
|
|
61977
62452
|
case "end":
|
|
61978
|
-
return
|
|
62453
|
+
return _context6.stop();
|
|
61979
62454
|
}
|
|
61980
|
-
},
|
|
62455
|
+
}, _callee6, null, [[0, 2]]);
|
|
61981
62456
|
}));
|
|
61982
62457
|
return _handleSidebarSignOut.apply(this, arguments);
|
|
61983
62458
|
}
|
|
61984
62459
|
function handlePopout() {
|
|
61985
|
-
var _window$
|
|
61986
|
-
if (workspaceSelected && (_window$
|
|
62460
|
+
var _window$mainApi10;
|
|
62461
|
+
if (workspaceSelected && (_window$mainApi10 = window.mainApi) !== null && _window$mainApi10 !== void 0 && (_window$mainApi10 = _window$mainApi10.popout) !== null && _window$mainApi10 !== void 0 && _window$mainApi10.open) {
|
|
61987
62462
|
window.mainApi.popout.open(workspaceSelected.id);
|
|
61988
62463
|
}
|
|
61989
62464
|
}
|
|
61990
62465
|
function handleWidgetPopout(widgetId) {
|
|
61991
|
-
var _window$
|
|
61992
|
-
if (workspaceSelected && (_window$
|
|
62466
|
+
var _window$mainApi11;
|
|
62467
|
+
if (workspaceSelected && (_window$mainApi11 = window.mainApi) !== null && _window$mainApi11 !== void 0 && (_window$mainApi11 = _window$mainApi11.widgetPopout) !== null && _window$mainApi11 !== void 0 && _window$mainApi11.open) {
|
|
61993
62468
|
window.mainApi.widgetPopout.open(workspaceSelected.id, widgetId);
|
|
61994
62469
|
}
|
|
61995
62470
|
}
|
|
@@ -62309,6 +62784,23 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
62309
62784
|
onSaveListeners: handleBulkListenerBindings,
|
|
62310
62785
|
onSaveUserPrefs: handleBulkUserPrefs,
|
|
62311
62786
|
initialTab: "providers"
|
|
62787
|
+
}), /*#__PURE__*/jsx(OnboardingModal, {
|
|
62788
|
+
open: isOnboardingOpen === true,
|
|
62789
|
+
appId: credentials === null || credentials === void 0 ? void 0 : credentials.appId,
|
|
62790
|
+
onDismiss: function onDismiss() {
|
|
62791
|
+
return setIsOnboardingOpen(false);
|
|
62792
|
+
},
|
|
62793
|
+
onComplete: function onComplete() {
|
|
62794
|
+
return setIsOnboardingOpen(false);
|
|
62795
|
+
},
|
|
62796
|
+
onOpenDashboard: function onOpenDashboard(ws) {
|
|
62797
|
+
setIsOnboardingOpen(false);
|
|
62798
|
+
// Refresh workspaces before opening so the just-
|
|
62799
|
+
// installed Kitchen Sink shows up in the sidebar list
|
|
62800
|
+
// alongside the open tab.
|
|
62801
|
+
loadWorkspaces();
|
|
62802
|
+
handleOpenTab(ws);
|
|
62803
|
+
}
|
|
62312
62804
|
})]
|
|
62313
62805
|
})]
|
|
62314
62806
|
}), !popout && /*#__PURE__*/jsx(DashCommandPalette, {
|