@trops/dash-core 0.1.206 → 0.1.208
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 +24 -9
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +176 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +175 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3599,9 +3599,30 @@ var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
|
|
|
3599
3599
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
3600
3600
|
installResult = _useState8[0],
|
|
3601
3601
|
setInstallResult = _useState8[1];
|
|
3602
|
+
var _useState9 = React.useState(null),
|
|
3603
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
3604
|
+
authFlow = _useState0[0],
|
|
3605
|
+
setAuthFlow = _useState0[1];
|
|
3606
|
+
var _useState1 = React.useState(false),
|
|
3607
|
+
_useState10 = _slicedToArray(_useState1, 2),
|
|
3608
|
+
isPolling = _useState10[0],
|
|
3609
|
+
setIsPolling = _useState10[1];
|
|
3610
|
+
var _useState11 = React.useState(null),
|
|
3611
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
3612
|
+
authError = _useState12[0],
|
|
3613
|
+
setAuthError = _useState12[1];
|
|
3614
|
+
var pollIntervalRef = React.useRef(null);
|
|
3602
3615
|
var pkg = dashboardPackage;
|
|
3603
3616
|
if (!pkg) return null;
|
|
3604
3617
|
|
|
3618
|
+
// Clean up polling on unmount
|
|
3619
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
3620
|
+
React.useEffect(function () {
|
|
3621
|
+
return function () {
|
|
3622
|
+
if (pollIntervalRef.current) clearInterval(pollIntervalRef.current);
|
|
3623
|
+
};
|
|
3624
|
+
}, []);
|
|
3625
|
+
|
|
3605
3626
|
// Load preview data on mount
|
|
3606
3627
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
3607
3628
|
React.useEffect(function () {
|
|
@@ -3611,6 +3632,10 @@ var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
|
|
|
3611
3632
|
setPreviewLoading(true);
|
|
3612
3633
|
setPreview(null);
|
|
3613
3634
|
setInstallResult(null);
|
|
3635
|
+
setAuthFlow(null);
|
|
3636
|
+
setIsPolling(false);
|
|
3637
|
+
setAuthError(null);
|
|
3638
|
+
if (pollIntervalRef.current) clearInterval(pollIntervalRef.current);
|
|
3614
3639
|
(_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) {
|
|
3615
3640
|
if (!cancelled) setPreview(result);
|
|
3616
3641
|
})["catch"](function (err) {
|
|
@@ -3638,11 +3663,25 @@ var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
|
|
|
3638
3663
|
case 1:
|
|
3639
3664
|
setIsInstalling(true);
|
|
3640
3665
|
setInstallResult(null);
|
|
3666
|
+
setAuthFlow(null);
|
|
3667
|
+
setAuthError(null);
|
|
3641
3668
|
_context.prev = 2;
|
|
3642
3669
|
_context.next = 3;
|
|
3643
3670
|
return window.mainApi.dashboardConfig.installDashboardFromRegistry(appId, pkg.name);
|
|
3644
3671
|
case 3:
|
|
3645
3672
|
result = _context.sent;
|
|
3673
|
+
if (!(result !== null && result !== void 0 && result.authRequired)) {
|
|
3674
|
+
_context.next = 4;
|
|
3675
|
+
break;
|
|
3676
|
+
}
|
|
3677
|
+
// Auth needed — show inline auth prompt (DASH-135)
|
|
3678
|
+
setIsInstalling(false);
|
|
3679
|
+
setInstallResult({
|
|
3680
|
+
status: "auth",
|
|
3681
|
+
message: result.error || "Sign in to install this dashboard."
|
|
3682
|
+
});
|
|
3683
|
+
return _context.abrupt("return");
|
|
3684
|
+
case 4:
|
|
3646
3685
|
setInstallResult({
|
|
3647
3686
|
status: result !== null && result !== void 0 && result.success ? "success" : "error",
|
|
3648
3687
|
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."
|
|
@@ -3650,27 +3689,104 @@ var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
|
|
|
3650
3689
|
if (result !== null && result !== void 0 && result.success && onInstallComplete) {
|
|
3651
3690
|
onInstallComplete(result);
|
|
3652
3691
|
}
|
|
3653
|
-
_context.next =
|
|
3692
|
+
_context.next = 6;
|
|
3654
3693
|
break;
|
|
3655
|
-
case
|
|
3656
|
-
_context.prev =
|
|
3694
|
+
case 5:
|
|
3695
|
+
_context.prev = 5;
|
|
3657
3696
|
_t = _context["catch"](2);
|
|
3658
3697
|
setInstallResult({
|
|
3659
3698
|
status: "error",
|
|
3660
3699
|
message: _t.message || "Failed to install dashboard."
|
|
3661
3700
|
});
|
|
3662
|
-
case 5:
|
|
3663
|
-
_context.prev = 5;
|
|
3664
|
-
setIsInstalling(false);
|
|
3665
|
-
return _context.finish(5);
|
|
3666
3701
|
case 6:
|
|
3702
|
+
_context.prev = 6;
|
|
3703
|
+
setIsInstalling(false);
|
|
3704
|
+
return _context.finish(6);
|
|
3705
|
+
case 7:
|
|
3667
3706
|
case "end":
|
|
3668
3707
|
return _context.stop();
|
|
3669
3708
|
}
|
|
3670
|
-
}, _callee, null, [[2,
|
|
3709
|
+
}, _callee, null, [[2, 5, 6, 7]]);
|
|
3671
3710
|
}));
|
|
3672
3711
|
return _handleInstall.apply(this, arguments);
|
|
3673
3712
|
}
|
|
3713
|
+
function handleSignIn() {
|
|
3714
|
+
return _handleSignIn.apply(this, arguments);
|
|
3715
|
+
}
|
|
3716
|
+
function _handleSignIn() {
|
|
3717
|
+
_handleSignIn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
3718
|
+
var flow, interval;
|
|
3719
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
3720
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
3721
|
+
case 0:
|
|
3722
|
+
setAuthError(null);
|
|
3723
|
+
_context3.prev = 1;
|
|
3724
|
+
_context3.next = 2;
|
|
3725
|
+
return window.mainApi.registryAuth.initiateLogin();
|
|
3726
|
+
case 2:
|
|
3727
|
+
flow = _context3.sent;
|
|
3728
|
+
setAuthFlow(flow);
|
|
3729
|
+
|
|
3730
|
+
// Open verification URL in browser
|
|
3731
|
+
if (flow.verificationUrlComplete) {
|
|
3732
|
+
window.mainApi.shell.openExternal(flow.verificationUrlComplete);
|
|
3733
|
+
}
|
|
3734
|
+
|
|
3735
|
+
// Start polling for token
|
|
3736
|
+
setIsPolling(true);
|
|
3737
|
+
interval = (flow.interval || 5) * 1000;
|
|
3738
|
+
pollIntervalRef.current = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
3739
|
+
var pollResult;
|
|
3740
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
3741
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
3742
|
+
case 0:
|
|
3743
|
+
_context2.prev = 0;
|
|
3744
|
+
_context2.next = 1;
|
|
3745
|
+
return window.mainApi.registryAuth.pollToken(flow.deviceCode);
|
|
3746
|
+
case 1:
|
|
3747
|
+
pollResult = _context2.sent;
|
|
3748
|
+
if (pollResult.status === "authorized") {
|
|
3749
|
+
clearInterval(pollIntervalRef.current);
|
|
3750
|
+
pollIntervalRef.current = null;
|
|
3751
|
+
setIsPolling(false);
|
|
3752
|
+
setAuthFlow(null);
|
|
3753
|
+
// DASH-136: Auto-retry install after successful auth
|
|
3754
|
+
handleInstall();
|
|
3755
|
+
} else if (pollResult.status === "expired") {
|
|
3756
|
+
clearInterval(pollIntervalRef.current);
|
|
3757
|
+
pollIntervalRef.current = null;
|
|
3758
|
+
setIsPolling(false);
|
|
3759
|
+
setAuthFlow(null);
|
|
3760
|
+
setAuthError("Authorization expired. Please try again.");
|
|
3761
|
+
}
|
|
3762
|
+
_context2.next = 3;
|
|
3763
|
+
break;
|
|
3764
|
+
case 2:
|
|
3765
|
+
_context2.prev = 2;
|
|
3766
|
+
_context2["catch"](0);
|
|
3767
|
+
clearInterval(pollIntervalRef.current);
|
|
3768
|
+
pollIntervalRef.current = null;
|
|
3769
|
+
setIsPolling(false);
|
|
3770
|
+
case 3:
|
|
3771
|
+
case "end":
|
|
3772
|
+
return _context2.stop();
|
|
3773
|
+
}
|
|
3774
|
+
}, _callee2, null, [[0, 2]]);
|
|
3775
|
+
})), interval);
|
|
3776
|
+
_context3.next = 4;
|
|
3777
|
+
break;
|
|
3778
|
+
case 3:
|
|
3779
|
+
_context3.prev = 3;
|
|
3780
|
+
_context3["catch"](1);
|
|
3781
|
+
setAuthError("Could not reach the registry. Check your connection and try again.");
|
|
3782
|
+
case 4:
|
|
3783
|
+
case "end":
|
|
3784
|
+
return _context3.stop();
|
|
3785
|
+
}
|
|
3786
|
+
}, _callee3, null, [[1, 3]]);
|
|
3787
|
+
}));
|
|
3788
|
+
return _handleSignIn.apply(this, arguments);
|
|
3789
|
+
}
|
|
3674
3790
|
var compatibility = preview === null || preview === void 0 ? void 0 : preview.compatibility;
|
|
3675
3791
|
var widgetDeps = (preview === null || preview === void 0 ? void 0 : preview.widgets) || pkg.widgets || [];
|
|
3676
3792
|
var providers = (preview === null || preview === void 0 ? void 0 : preview.providers) || [];
|
|
@@ -3840,7 +3956,7 @@ var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
|
|
|
3840
3956
|
}, idx);
|
|
3841
3957
|
})
|
|
3842
3958
|
})]
|
|
3843
|
-
}), installResult && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3959
|
+
}), installResult && installResult.status !== "auth" && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3844
3960
|
className: "p-2 rounded border ".concat(installResult.status === "success" ? "bg-green-900/20 border-green-700" : "bg-red-900/30 border-red-700"),
|
|
3845
3961
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3846
3962
|
className: "flex items-center gap-2",
|
|
@@ -3852,8 +3968,57 @@ var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
|
|
|
3852
3968
|
children: installResult.message
|
|
3853
3969
|
})]
|
|
3854
3970
|
})
|
|
3971
|
+
}), (installResult === null || installResult === void 0 ? void 0 : installResult.status) === "auth" && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3972
|
+
className: "space-y-3",
|
|
3973
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3974
|
+
className: "bg-yellow-500/10 border border-yellow-500/20 rounded-lg p-3",
|
|
3975
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3976
|
+
className: "flex items-start gap-2",
|
|
3977
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
3978
|
+
icon: "lock",
|
|
3979
|
+
className: "h-3.5 w-3.5 text-yellow-400 mt-0.5 flex-shrink-0"
|
|
3980
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
3981
|
+
className: "text-sm text-yellow-300/90",
|
|
3982
|
+
children: installResult.message
|
|
3983
|
+
})]
|
|
3984
|
+
})
|
|
3985
|
+
}), !authFlow && !isPolling && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3986
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("button", {
|
|
3987
|
+
type: "button",
|
|
3988
|
+
onClick: handleSignIn,
|
|
3989
|
+
className: "px-4 py-2 rounded-lg text-sm bg-blue-500/20 border border-blue-500/30 text-blue-300 hover:bg-blue-500/30 transition-colors cursor-pointer",
|
|
3990
|
+
children: "Sign in to Registry"
|
|
3991
|
+
}), authError && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3992
|
+
className: "bg-red-500/10 border border-red-500/20 rounded-lg p-3",
|
|
3993
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3994
|
+
className: "flex items-start gap-2",
|
|
3995
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
3996
|
+
icon: "circle-xmark",
|
|
3997
|
+
className: "h-3.5 w-3.5 text-red-400 mt-0.5 flex-shrink-0"
|
|
3998
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
3999
|
+
className: "text-xs text-red-300/90",
|
|
4000
|
+
children: authError
|
|
4001
|
+
})]
|
|
4002
|
+
})
|
|
4003
|
+
})]
|
|
4004
|
+
}), authFlow && isPolling && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4005
|
+
className: "bg-blue-500/10 border border-blue-500/20 rounded-lg p-4 space-y-3",
|
|
4006
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("p", {
|
|
4007
|
+
className: "text-xs text-blue-300/90",
|
|
4008
|
+
children: "Enter this code in your browser:"
|
|
4009
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4010
|
+
className: "text-center",
|
|
4011
|
+
children: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
4012
|
+
className: "text-2xl font-mono font-bold tracking-widest text-white",
|
|
4013
|
+
children: authFlow.userCode
|
|
4014
|
+
})
|
|
4015
|
+
}), /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
4016
|
+
className: "text-xs text-blue-300/70 text-center",
|
|
4017
|
+
children: "Waiting for authorization \u2014 install will resume automatically..."
|
|
4018
|
+
})]
|
|
4019
|
+
})]
|
|
3855
4020
|
})]
|
|
3856
|
-
}), (installResult === null || installResult === void 0 ? void 0 : installResult.status) !== "success" && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4021
|
+
}), (installResult === null || installResult === void 0 ? void 0 : installResult.status) !== "success" && (installResult === null || installResult === void 0 ? void 0 : installResult.status) !== "auth" && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3857
4022
|
className: "flex items-center justify-end px-6 py-3 border-t ".concat(currentTheme["border-primary-medium"]),
|
|
3858
4023
|
children: /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
|
|
3859
4024
|
title: isInstalling ? "Installing..." : "Install Dashboard",
|