@trops/dash-core 0.1.109 → 0.1.110
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 +540 -153
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +453 -108
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +452 -107
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.esm.js
CHANGED
|
@@ -13,7 +13,7 @@ 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 { Menu, Transition, Dialog, Disclosure } from '@headlessui/react';
|
|
16
|
+
import { Menu, Transition, Popover, Dialog, Disclosure } from '@headlessui/react';
|
|
17
17
|
import { EllipsisVerticalIcon } from '@heroicons/react/20/solid';
|
|
18
18
|
import clsx from 'clsx';
|
|
19
19
|
import { DndProvider, useDrag, useDrop } from 'react-dnd';
|
|
@@ -39019,17 +39019,22 @@ var DashSidebar = function DashSidebar(_ref) {
|
|
|
39019
39019
|
menuItems = _ref$menuItems === void 0 ? [] : _ref$menuItems,
|
|
39020
39020
|
_ref$activeTabId = _ref.activeTabId,
|
|
39021
39021
|
activeTabId = _ref$activeTabId === void 0 ? null : _ref$activeTabId,
|
|
39022
|
+
_ref$recentDashboards = _ref.recentDashboards,
|
|
39023
|
+
recentDashboards = _ref$recentDashboards === void 0 ? [] : _ref$recentDashboards,
|
|
39024
|
+
_ref$authStatus = _ref.authStatus,
|
|
39025
|
+
authStatus = _ref$authStatus === void 0 ? "loading" : _ref$authStatus,
|
|
39026
|
+
_ref$authProfile = _ref.authProfile,
|
|
39027
|
+
authProfile = _ref$authProfile === void 0 ? null : _ref$authProfile,
|
|
39022
39028
|
onOpenWorkspace = _ref.onOpenWorkspace,
|
|
39023
39029
|
onNewDashboard = _ref.onNewDashboard,
|
|
39024
|
-
onGoHome = _ref.onGoHome,
|
|
39025
|
-
onOpenProviders = _ref.onOpenProviders,
|
|
39026
|
-
onOpenThemeManager = _ref.onOpenThemeManager,
|
|
39027
|
-
onOpenFolders = _ref.onOpenFolders,
|
|
39028
39030
|
onOpenSettings = _ref.onOpenSettings,
|
|
39029
|
-
onOpenCommandPalette = _ref.onOpenCommandPalette
|
|
39031
|
+
onOpenCommandPalette = _ref.onOpenCommandPalette,
|
|
39032
|
+
onSignIn = _ref.onSignIn,
|
|
39033
|
+
onSignOut = _ref.onSignOut;
|
|
39030
39034
|
var _useContext = useContext(ThemeContext),
|
|
39031
39035
|
themeVariant = _useContext.themeVariant,
|
|
39032
39036
|
changeThemeVariant = _useContext.changeThemeVariant;
|
|
39037
|
+
_useContext.currentTheme;
|
|
39033
39038
|
var workspacesForFolder = function workspacesForFolder(folderId) {
|
|
39034
39039
|
return workspaces.filter(function (ws) {
|
|
39035
39040
|
return ws.menuId === folderId;
|
|
@@ -39040,6 +39045,13 @@ var DashSidebar = function DashSidebar(_ref) {
|
|
|
39040
39045
|
return mi.id === ws.menuId;
|
|
39041
39046
|
});
|
|
39042
39047
|
});
|
|
39048
|
+
|
|
39049
|
+
// Filter recents: only show workspaces that still exist, max 5
|
|
39050
|
+
var visibleRecents = recentDashboards.filter(function (r) {
|
|
39051
|
+
return workspaces.some(function (ws) {
|
|
39052
|
+
return ws.id === r.workspaceId;
|
|
39053
|
+
});
|
|
39054
|
+
}).slice(0, 5);
|
|
39043
39055
|
return /*#__PURE__*/jsxs(Sidebar, {
|
|
39044
39056
|
collapsed: collapsed,
|
|
39045
39057
|
onCollapsedChange: onCollapsedChange,
|
|
@@ -39055,57 +39067,32 @@ var DashSidebar = function DashSidebar(_ref) {
|
|
|
39055
39067
|
})
|
|
39056
39068
|
}), /*#__PURE__*/jsxs(Sidebar.Content, {
|
|
39057
39069
|
children: [/*#__PURE__*/jsx(Sidebar.Item, {
|
|
39058
|
-
icon: /*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
39059
|
-
icon: "home",
|
|
39060
|
-
className: "h-3.5 w-3.5"
|
|
39061
|
-
}),
|
|
39062
|
-
active: activeTabId === null,
|
|
39063
|
-
onClick: onGoHome,
|
|
39064
|
-
children: "Home"
|
|
39065
|
-
}), /*#__PURE__*/jsx(Sidebar.Item, {
|
|
39066
39070
|
icon: /*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
39067
39071
|
icon: "magnifying-glass",
|
|
39068
39072
|
className: "h-3.5 w-3.5"
|
|
39069
39073
|
}),
|
|
39070
39074
|
onClick: onOpenCommandPalette,
|
|
39071
39075
|
children: "Search"
|
|
39072
|
-
}), /*#__PURE__*/jsx(Sidebar.
|
|
39073
|
-
|
|
39074
|
-
|
|
39075
|
-
|
|
39076
|
-
|
|
39077
|
-
|
|
39078
|
-
|
|
39079
|
-
|
|
39080
|
-
|
|
39081
|
-
|
|
39082
|
-
|
|
39083
|
-
|
|
39084
|
-
|
|
39085
|
-
|
|
39086
|
-
|
|
39087
|
-
|
|
39088
|
-
|
|
39089
|
-
|
|
39090
|
-
|
|
39091
|
-
|
|
39092
|
-
children: "Folders"
|
|
39093
|
-
}), /*#__PURE__*/jsx(Sidebar.Item, {
|
|
39094
|
-
icon: /*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
39095
|
-
icon: "cog",
|
|
39096
|
-
className: "h-3.5 w-3.5"
|
|
39097
|
-
}),
|
|
39098
|
-
onClick: onOpenSettings,
|
|
39099
|
-
children: "Settings"
|
|
39100
|
-
}), /*#__PURE__*/jsx(Sidebar.Item, {
|
|
39101
|
-
icon: /*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
39102
|
-
icon: themeVariant === "dark" ? "sun" : "moon",
|
|
39103
|
-
className: "h-3.5 w-3.5"
|
|
39104
|
-
}),
|
|
39105
|
-
onClick: function onClick() {
|
|
39106
|
-
return changeThemeVariant(themeVariant === "dark" ? "light" : "dark");
|
|
39107
|
-
},
|
|
39108
|
-
children: themeVariant === "dark" ? "Light Mode" : "Dark Mode"
|
|
39076
|
+
}), !collapsed && visibleRecents.length > 0 && /*#__PURE__*/jsx(Sidebar.Group, {
|
|
39077
|
+
label: "Recents",
|
|
39078
|
+
children: visibleRecents.map(function (recent) {
|
|
39079
|
+
var ws = workspaces.find(function (w) {
|
|
39080
|
+
return w.id === recent.workspaceId;
|
|
39081
|
+
});
|
|
39082
|
+
return /*#__PURE__*/jsx(Sidebar.Item, {
|
|
39083
|
+
icon: /*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
39084
|
+
icon: "clock-rotate-left",
|
|
39085
|
+
className: "h-3.5 w-3.5"
|
|
39086
|
+
}),
|
|
39087
|
+
active: recent.workspaceId === activeTabId,
|
|
39088
|
+
onClick: function onClick() {
|
|
39089
|
+
return ws && onOpenWorkspace(ws);
|
|
39090
|
+
},
|
|
39091
|
+
children: (recent.name || "Untitled").replace(/^./, function (c) {
|
|
39092
|
+
return c.toUpperCase();
|
|
39093
|
+
})
|
|
39094
|
+
}, recent.workspaceId);
|
|
39095
|
+
})
|
|
39109
39096
|
}), /*#__PURE__*/jsx(Sidebar.Group, {
|
|
39110
39097
|
label: "Dashboards",
|
|
39111
39098
|
children: /*#__PURE__*/jsx(Sidebar.Item, {
|
|
@@ -39158,6 +39145,107 @@ var DashSidebar = function DashSidebar(_ref) {
|
|
|
39158
39145
|
})
|
|
39159
39146
|
})]
|
|
39160
39147
|
})]
|
|
39148
|
+
}), /*#__PURE__*/jsx(Sidebar.Footer, {
|
|
39149
|
+
children: /*#__PURE__*/jsx(FooterPopover, {
|
|
39150
|
+
collapsed: collapsed,
|
|
39151
|
+
themeVariant: themeVariant,
|
|
39152
|
+
changeThemeVariant: changeThemeVariant,
|
|
39153
|
+
authStatus: authStatus,
|
|
39154
|
+
authProfile: authProfile,
|
|
39155
|
+
onOpenSettings: onOpenSettings,
|
|
39156
|
+
onSignIn: onSignIn,
|
|
39157
|
+
onSignOut: onSignOut
|
|
39158
|
+
})
|
|
39159
|
+
})]
|
|
39160
|
+
});
|
|
39161
|
+
};
|
|
39162
|
+
var FooterPopover = function FooterPopover(_ref2) {
|
|
39163
|
+
var collapsed = _ref2.collapsed,
|
|
39164
|
+
themeVariant = _ref2.themeVariant,
|
|
39165
|
+
changeThemeVariant = _ref2.changeThemeVariant,
|
|
39166
|
+
authStatus = _ref2.authStatus,
|
|
39167
|
+
authProfile = _ref2.authProfile,
|
|
39168
|
+
onOpenSettings = _ref2.onOpenSettings,
|
|
39169
|
+
onSignIn = _ref2.onSignIn,
|
|
39170
|
+
onSignOut = _ref2.onSignOut;
|
|
39171
|
+
var displayName = authStatus === "authenticated" && authProfile ? authProfile.displayName || authProfile.username : "Account";
|
|
39172
|
+
return /*#__PURE__*/jsx(Popover, {
|
|
39173
|
+
className: "relative",
|
|
39174
|
+
children: function children(_ref3) {
|
|
39175
|
+
var close = _ref3.close;
|
|
39176
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
39177
|
+
children: [/*#__PURE__*/jsxs(Popover.Button, {
|
|
39178
|
+
className: "flex items-center w-full gap-2 px-3 py-2 rounded-md text-sm opacity-80 hover:opacity-100 transition-colors duration-150 cursor-pointer hover:bg-white/5 focus:outline-none",
|
|
39179
|
+
title: collapsed ? displayName : undefined,
|
|
39180
|
+
children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
39181
|
+
icon: authStatus === "authenticated" ? "circle-user" : "user",
|
|
39182
|
+
className: "h-3.5 w-3.5 flex-shrink-0"
|
|
39183
|
+
}), !collapsed && /*#__PURE__*/jsx("span", {
|
|
39184
|
+
className: "flex-1 text-left truncate",
|
|
39185
|
+
children: displayName
|
|
39186
|
+
})]
|
|
39187
|
+
}), /*#__PURE__*/jsx(Transition, {
|
|
39188
|
+
enter: "transition ease-out duration-100",
|
|
39189
|
+
enterFrom: "transform opacity-0 scale-95",
|
|
39190
|
+
enterTo: "transform opacity-100 scale-100",
|
|
39191
|
+
leave: "transition ease-in duration-75",
|
|
39192
|
+
leaveFrom: "transform opacity-100 scale-100",
|
|
39193
|
+
leaveTo: "transform opacity-0 scale-95",
|
|
39194
|
+
children: /*#__PURE__*/jsx(Popover.Panel, {
|
|
39195
|
+
className: "absolute bottom-full left-0 mb-2 w-52 rounded-lg border border-white/10 bg-neutral-900 shadow-xl z-50",
|
|
39196
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
39197
|
+
className: "p-1.5 space-y-0.5",
|
|
39198
|
+
children: [/*#__PURE__*/jsx(PopoverItem, {
|
|
39199
|
+
icon: "cog",
|
|
39200
|
+
label: "Settings",
|
|
39201
|
+
onClick: function onClick() {
|
|
39202
|
+
onOpenSettings();
|
|
39203
|
+
close();
|
|
39204
|
+
}
|
|
39205
|
+
}), /*#__PURE__*/jsx(PopoverItem, {
|
|
39206
|
+
icon: themeVariant === "dark" ? "sun" : "moon",
|
|
39207
|
+
label: themeVariant === "dark" ? "Light Mode" : "Dark Mode",
|
|
39208
|
+
onClick: function onClick() {
|
|
39209
|
+
changeThemeVariant(themeVariant === "dark" ? "light" : "dark");
|
|
39210
|
+
close();
|
|
39211
|
+
}
|
|
39212
|
+
}), /*#__PURE__*/jsx("div", {
|
|
39213
|
+
className: "border-t border-white/10 my-1"
|
|
39214
|
+
}), authStatus === "authenticated" ? /*#__PURE__*/jsx(PopoverItem, {
|
|
39215
|
+
icon: "right-from-bracket",
|
|
39216
|
+
label: "Sign Out",
|
|
39217
|
+
onClick: function onClick() {
|
|
39218
|
+
onSignOut();
|
|
39219
|
+
close();
|
|
39220
|
+
}
|
|
39221
|
+
}) : /*#__PURE__*/jsx(PopoverItem, {
|
|
39222
|
+
icon: "right-to-bracket",
|
|
39223
|
+
label: "Sign In",
|
|
39224
|
+
onClick: function onClick() {
|
|
39225
|
+
onSignIn();
|
|
39226
|
+
close();
|
|
39227
|
+
}
|
|
39228
|
+
})]
|
|
39229
|
+
})
|
|
39230
|
+
})
|
|
39231
|
+
})]
|
|
39232
|
+
});
|
|
39233
|
+
}
|
|
39234
|
+
});
|
|
39235
|
+
};
|
|
39236
|
+
var PopoverItem = function PopoverItem(_ref4) {
|
|
39237
|
+
var icon = _ref4.icon,
|
|
39238
|
+
label = _ref4.label,
|
|
39239
|
+
onClick = _ref4.onClick;
|
|
39240
|
+
return /*#__PURE__*/jsxs("button", {
|
|
39241
|
+
type: "button",
|
|
39242
|
+
onClick: onClick,
|
|
39243
|
+
className: "flex items-center w-full gap-2 px-3 py-2 rounded-md text-sm text-white/80 hover:text-white hover:bg-white/10 transition-colors duration-150 cursor-pointer",
|
|
39244
|
+
children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
39245
|
+
icon: icon,
|
|
39246
|
+
className: "h-3.5 w-3.5 flex-shrink-0"
|
|
39247
|
+
}), /*#__PURE__*/jsx("span", {
|
|
39248
|
+
children: label
|
|
39161
39249
|
})]
|
|
39162
39250
|
});
|
|
39163
39251
|
};
|
|
@@ -39912,6 +40000,23 @@ var DashboardStageInner = function DashboardStageInner(_ref2) {
|
|
|
39912
40000
|
widgetSidebarCollapsed = _useState0[0],
|
|
39913
40001
|
setWidgetSidebarCollapsed = _useState0[1];
|
|
39914
40002
|
|
|
40003
|
+
// ─── Recents + Session ──────────────────────────────────────────
|
|
40004
|
+
var _useState1 = useState([]),
|
|
40005
|
+
_useState10 = _slicedToArray(_useState1, 2),
|
|
40006
|
+
recentDashboards = _useState10[0],
|
|
40007
|
+
setRecentDashboards = _useState10[1];
|
|
40008
|
+
var sessionRestored = useRef(false);
|
|
40009
|
+
|
|
40010
|
+
// ─── Registry Auth (for sidebar) ────────────────────────────────
|
|
40011
|
+
var _useState11 = useState("loading"),
|
|
40012
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
40013
|
+
authStatus = _useState12[0],
|
|
40014
|
+
setAuthStatus = _useState12[1];
|
|
40015
|
+
var _useState13 = useState(null),
|
|
40016
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
40017
|
+
authProfile = _useState14[0],
|
|
40018
|
+
setAuthProfile = _useState14[1];
|
|
40019
|
+
|
|
39915
40020
|
// Derive workspaceSelected from active tab
|
|
39916
40021
|
var workspaceSelected = activeTabId ? (_openTabs$find$worksp = (_openTabs$find = openTabs.find(function (tab) {
|
|
39917
40022
|
return tab.id === activeTabId;
|
|
@@ -39920,66 +40025,92 @@ var DashboardStageInner = function DashboardStageInner(_ref2) {
|
|
|
39920
40025
|
/**
|
|
39921
40026
|
* @param {Boolean} previewMode this is a toggle telling the dash we are editing
|
|
39922
40027
|
*/
|
|
39923
|
-
var
|
|
39924
|
-
|
|
39925
|
-
previewMode =
|
|
39926
|
-
setPreviewMode =
|
|
40028
|
+
var _useState15 = useState(preview),
|
|
40029
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
40030
|
+
previewMode = _useState16[0],
|
|
40031
|
+
setPreviewMode = _useState16[1];
|
|
39927
40032
|
|
|
39928
40033
|
/**
|
|
39929
40034
|
* @param {String["layout", "workspace", "widget"]} editMode this is the actual mode we are in
|
|
39930
40035
|
*/
|
|
39931
|
-
var
|
|
39932
|
-
|
|
39933
|
-
editMode =
|
|
40036
|
+
var _useState17 = useState("all"),
|
|
40037
|
+
_useState18 = _slicedToArray(_useState17, 1),
|
|
40038
|
+
editMode = _useState18[0]; // for the time being use "all" as our "old" way
|
|
39934
40039
|
|
|
39935
40040
|
// Workspace Management (loading)
|
|
39936
|
-
var
|
|
39937
|
-
_useState14 = _slicedToArray(_useState13, 2),
|
|
39938
|
-
isLoadingWorkspaces = _useState14[0],
|
|
39939
|
-
setIsLoadingWorkspaces = _useState14[1];
|
|
39940
|
-
var _useState15 = useState(false),
|
|
39941
|
-
_useState16 = _slicedToArray(_useState15, 2),
|
|
39942
|
-
isLoadingMenuItems = _useState16[0],
|
|
39943
|
-
setIsLoadingMenuItems = _useState16[1];
|
|
39944
|
-
var _useState17 = useState([]),
|
|
39945
|
-
_useState18 = _slicedToArray(_useState17, 2),
|
|
39946
|
-
menuItems = _useState18[0],
|
|
39947
|
-
setMenuItems = _useState18[1];
|
|
39948
|
-
var _useState19 = useState([]),
|
|
40041
|
+
var _useState19 = useState(false),
|
|
39949
40042
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
39950
|
-
|
|
39951
|
-
|
|
39952
|
-
|
|
39953
|
-
// Modal state
|
|
40043
|
+
isLoadingWorkspaces = _useState20[0],
|
|
40044
|
+
setIsLoadingWorkspaces = _useState20[1];
|
|
39954
40045
|
var _useState21 = useState(false),
|
|
39955
40046
|
_useState22 = _slicedToArray(_useState21, 2),
|
|
39956
|
-
|
|
39957
|
-
|
|
39958
|
-
var _useState23 = useState(
|
|
40047
|
+
isLoadingMenuItems = _useState22[0],
|
|
40048
|
+
setIsLoadingMenuItems = _useState22[1];
|
|
40049
|
+
var _useState23 = useState([]),
|
|
39959
40050
|
_useState24 = _slicedToArray(_useState23, 2),
|
|
39960
|
-
|
|
39961
|
-
|
|
39962
|
-
var _useState25 = useState(
|
|
40051
|
+
menuItems = _useState24[0],
|
|
40052
|
+
setMenuItems = _useState24[1];
|
|
40053
|
+
var _useState25 = useState([]),
|
|
39963
40054
|
_useState26 = _slicedToArray(_useState25, 2),
|
|
39964
|
-
|
|
39965
|
-
|
|
40055
|
+
workspaceConfig = _useState26[0],
|
|
40056
|
+
setWorkspaceConfig = _useState26[1];
|
|
39966
40057
|
|
|
39967
|
-
//
|
|
40058
|
+
// Modal state
|
|
39968
40059
|
var _useState27 = useState(false),
|
|
39969
40060
|
_useState28 = _slicedToArray(_useState27, 2),
|
|
39970
|
-
|
|
39971
|
-
|
|
39972
|
-
var _useState29 = useState(
|
|
40061
|
+
isThemeManagerOpen = _useState28[0],
|
|
40062
|
+
setIsThemeManagerOpen = _useState28[1];
|
|
40063
|
+
var _useState29 = useState(false),
|
|
39973
40064
|
_useState30 = _slicedToArray(_useState29, 2),
|
|
39974
|
-
|
|
39975
|
-
|
|
40065
|
+
isDashboardLoaderOpen = _useState30[0],
|
|
40066
|
+
setIsDashboardLoaderOpen = _useState30[1];
|
|
40067
|
+
var _useState31 = useState(false),
|
|
40068
|
+
_useState32 = _slicedToArray(_useState31, 2),
|
|
40069
|
+
isLayoutPickerOpen = _useState32[0],
|
|
40070
|
+
setIsLayoutPickerOpen = _useState32[1];
|
|
40071
|
+
|
|
40072
|
+
// Unified App Settings Modal
|
|
40073
|
+
var _useState33 = useState(false),
|
|
40074
|
+
_useState34 = _slicedToArray(_useState33, 2),
|
|
40075
|
+
isAppSettingsOpen = _useState34[0],
|
|
40076
|
+
setIsAppSettingsOpen = _useState34[1];
|
|
40077
|
+
var _useState35 = useState("dashboards"),
|
|
40078
|
+
_useState36 = _slicedToArray(_useState35, 2),
|
|
40079
|
+
appSettingsInitialSection = _useState36[0],
|
|
40080
|
+
setAppSettingsInitialSection = _useState36[1];
|
|
39976
40081
|
function openAppSettings() {
|
|
39977
|
-
var section = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "
|
|
40082
|
+
var section = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "general";
|
|
39978
40083
|
setAppSettingsInitialSection(section);
|
|
39979
40084
|
setIsAppSettingsOpen(true);
|
|
39980
40085
|
}
|
|
39981
|
-
|
|
39982
|
-
|
|
40086
|
+
function handleProfileUpdated() {
|
|
40087
|
+
return _handleProfileUpdated.apply(this, arguments);
|
|
40088
|
+
} // Ref to access LayoutBuilder's current workspace without re-render cascades
|
|
40089
|
+
function _handleProfileUpdated() {
|
|
40090
|
+
_handleProfileUpdated = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
40091
|
+
var _window$mainApi11, profile;
|
|
40092
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
40093
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
40094
|
+
case 0:
|
|
40095
|
+
_context2.prev = 0;
|
|
40096
|
+
_context2.next = 1;
|
|
40097
|
+
return (_window$mainApi11 = window.mainApi) === null || _window$mainApi11 === void 0 || (_window$mainApi11 = _window$mainApi11.registryAuth) === null || _window$mainApi11 === void 0 ? void 0 : _window$mainApi11.getProfile();
|
|
40098
|
+
case 1:
|
|
40099
|
+
profile = _context2.sent;
|
|
40100
|
+
if (profile) setAuthProfile(profile);
|
|
40101
|
+
_context2.next = 3;
|
|
40102
|
+
break;
|
|
40103
|
+
case 2:
|
|
40104
|
+
_context2.prev = 2;
|
|
40105
|
+
_context2["catch"](0);
|
|
40106
|
+
case 3:
|
|
40107
|
+
case "end":
|
|
40108
|
+
return _context2.stop();
|
|
40109
|
+
}
|
|
40110
|
+
}, _callee2, null, [[0, 2]]);
|
|
40111
|
+
}));
|
|
40112
|
+
return _handleProfileUpdated.apply(this, arguments);
|
|
40113
|
+
}
|
|
39983
40114
|
var currentWorkspaceRef = useRef(null);
|
|
39984
40115
|
|
|
39985
40116
|
// Snapshot of the workspace before editing — used to restore on Cancel
|
|
@@ -40025,6 +40156,114 @@ var DashboardStageInner = function DashboardStageInner(_ref2) {
|
|
|
40025
40156
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
40026
40157
|
}, [popout]);
|
|
40027
40158
|
|
|
40159
|
+
// ─── Load recents on mount ───────────────────────────────────────
|
|
40160
|
+
useEffect(function () {
|
|
40161
|
+
var _window$mainApi4;
|
|
40162
|
+
if (popout) return;
|
|
40163
|
+
(_window$mainApi4 = window.mainApi) === null || _window$mainApi4 === void 0 || (_window$mainApi4 = _window$mainApi4.session) === null || _window$mainApi4 === void 0 || _window$mainApi4.getRecents().then(function (recents) {
|
|
40164
|
+
if (recents) setRecentDashboards(recents);
|
|
40165
|
+
});
|
|
40166
|
+
}, [popout]);
|
|
40167
|
+
|
|
40168
|
+
// ─── Session save (continuous) ──────────────────────────────────
|
|
40169
|
+
useEffect(function () {
|
|
40170
|
+
var _window$mainApi5;
|
|
40171
|
+
if (popout) return;
|
|
40172
|
+
var tabIds = openTabs.map(function (t) {
|
|
40173
|
+
return t.id;
|
|
40174
|
+
});
|
|
40175
|
+
(_window$mainApi5 = window.mainApi) === null || _window$mainApi5 === void 0 || (_window$mainApi5 = _window$mainApi5.session) === null || _window$mainApi5 === void 0 || _window$mainApi5.saveState(tabIds, activeTabId);
|
|
40176
|
+
}, [openTabs, activeTabId, popout]);
|
|
40177
|
+
|
|
40178
|
+
// ─── Session restore on launch ─────────────────────────────────
|
|
40179
|
+
useEffect(function () {
|
|
40180
|
+
var _window$mainApi6;
|
|
40181
|
+
if (popout || workspaceConfig.length === 0 || sessionRestored.current) return;
|
|
40182
|
+
sessionRestored.current = true;
|
|
40183
|
+
(_window$mainApi6 = window.mainApi) === null || _window$mainApi6 === void 0 || (_window$mainApi6 = _window$mainApi6.session) === null || _window$mainApi6 === void 0 || _window$mainApi6.getState().then(function (state) {
|
|
40184
|
+
var _state$openTabIds, _window$mainApi7;
|
|
40185
|
+
if (!(state !== null && state !== void 0 && (_state$openTabIds = state.openTabIds) !== null && _state$openTabIds !== void 0 && _state$openTabIds.length)) return;
|
|
40186
|
+
state.openTabIds.forEach(function (wsId) {
|
|
40187
|
+
var ws = workspaceConfig.find(function (w) {
|
|
40188
|
+
return w.id === wsId;
|
|
40189
|
+
});
|
|
40190
|
+
if (ws) handleOpenTab(ws);
|
|
40191
|
+
});
|
|
40192
|
+
if (state.activeTabId) setActiveTabId(state.activeTabId);
|
|
40193
|
+
(_window$mainApi7 = window.mainApi) === null || _window$mainApi7 === void 0 || (_window$mainApi7 = _window$mainApi7.session) === null || _window$mainApi7 === void 0 || _window$mainApi7.clearState();
|
|
40194
|
+
});
|
|
40195
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
40196
|
+
}, [workspaceConfig, popout]);
|
|
40197
|
+
|
|
40198
|
+
// ─── Auth status check (for sidebar) ────────────────────────────
|
|
40199
|
+
useEffect(function () {
|
|
40200
|
+
if (popout) return;
|
|
40201
|
+
var cancelled = false;
|
|
40202
|
+
function checkAuth() {
|
|
40203
|
+
return _checkAuth.apply(this, arguments);
|
|
40204
|
+
}
|
|
40205
|
+
function _checkAuth() {
|
|
40206
|
+
_checkAuth = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
40207
|
+
var _window$mainApi8, status, _window$mainApi9, profile;
|
|
40208
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
40209
|
+
while (1) switch (_context.prev = _context.next) {
|
|
40210
|
+
case 0:
|
|
40211
|
+
_context.prev = 0;
|
|
40212
|
+
_context.next = 1;
|
|
40213
|
+
return (_window$mainApi8 = window.mainApi) === null || _window$mainApi8 === void 0 || (_window$mainApi8 = _window$mainApi8.registryAuth) === null || _window$mainApi8 === void 0 ? void 0 : _window$mainApi8.getStatus();
|
|
40214
|
+
case 1:
|
|
40215
|
+
status = _context.sent;
|
|
40216
|
+
if (!cancelled) {
|
|
40217
|
+
_context.next = 2;
|
|
40218
|
+
break;
|
|
40219
|
+
}
|
|
40220
|
+
return _context.abrupt("return");
|
|
40221
|
+
case 2:
|
|
40222
|
+
if (!(status !== null && status !== void 0 && status.authenticated)) {
|
|
40223
|
+
_context.next = 5;
|
|
40224
|
+
break;
|
|
40225
|
+
}
|
|
40226
|
+
_context.next = 3;
|
|
40227
|
+
return (_window$mainApi9 = window.mainApi) === null || _window$mainApi9 === void 0 || (_window$mainApi9 = _window$mainApi9.registryAuth) === null || _window$mainApi9 === void 0 ? void 0 : _window$mainApi9.getProfile();
|
|
40228
|
+
case 3:
|
|
40229
|
+
profile = _context.sent;
|
|
40230
|
+
if (!cancelled) {
|
|
40231
|
+
_context.next = 4;
|
|
40232
|
+
break;
|
|
40233
|
+
}
|
|
40234
|
+
return _context.abrupt("return");
|
|
40235
|
+
case 4:
|
|
40236
|
+
if (profile) {
|
|
40237
|
+
setAuthProfile(profile);
|
|
40238
|
+
setAuthStatus("authenticated");
|
|
40239
|
+
} else {
|
|
40240
|
+
setAuthStatus("unauthenticated");
|
|
40241
|
+
}
|
|
40242
|
+
_context.next = 6;
|
|
40243
|
+
break;
|
|
40244
|
+
case 5:
|
|
40245
|
+
setAuthStatus("unauthenticated");
|
|
40246
|
+
case 6:
|
|
40247
|
+
_context.next = 8;
|
|
40248
|
+
break;
|
|
40249
|
+
case 7:
|
|
40250
|
+
_context.prev = 7;
|
|
40251
|
+
_context["catch"](0);
|
|
40252
|
+
if (!cancelled) setAuthStatus("unauthenticated");
|
|
40253
|
+
case 8:
|
|
40254
|
+
case "end":
|
|
40255
|
+
return _context.stop();
|
|
40256
|
+
}
|
|
40257
|
+
}, _callee, null, [[0, 7]]);
|
|
40258
|
+
}));
|
|
40259
|
+
return _checkAuth.apply(this, arguments);
|
|
40260
|
+
}
|
|
40261
|
+
checkAuth();
|
|
40262
|
+
return function () {
|
|
40263
|
+
cancelled = true;
|
|
40264
|
+
};
|
|
40265
|
+
}, [popout]);
|
|
40266
|
+
|
|
40028
40267
|
// ─── Tab Handlers ─────────────────────────────────────────────────
|
|
40029
40268
|
|
|
40030
40269
|
function handleOpenTab(workspaceItem) {
|
|
@@ -40057,6 +40296,14 @@ var DashboardStageInner = function DashboardStageInner(_ref2) {
|
|
|
40057
40296
|
}
|
|
40058
40297
|
setPreviewMode(true);
|
|
40059
40298
|
setSidebarCollapsed(true);
|
|
40299
|
+
|
|
40300
|
+
// Track in recents
|
|
40301
|
+
if (!popout) {
|
|
40302
|
+
var _window$mainApi0;
|
|
40303
|
+
(_window$mainApi0 = window.mainApi) === null || _window$mainApi0 === void 0 || (_window$mainApi0 = _window$mainApi0.session) === null || _window$mainApi0 === void 0 || _window$mainApi0.addRecent(workspaceItem.id, workspaceItem.name || "Untitled").then(function (updated) {
|
|
40304
|
+
if (updated) setRecentDashboards(updated);
|
|
40305
|
+
});
|
|
40306
|
+
}
|
|
40060
40307
|
}
|
|
40061
40308
|
function handleCloseTab(tabId) {
|
|
40062
40309
|
setOpenTabs(function (prev) {
|
|
@@ -40409,15 +40656,113 @@ var DashboardStageInner = function DashboardStageInner(_ref2) {
|
|
|
40409
40656
|
function handleToggleThemeVariant() {
|
|
40410
40657
|
changeThemeVariant(themeVariant === "dark" ? "light" : "dark");
|
|
40411
40658
|
}
|
|
40659
|
+
function handleSidebarSignIn() {
|
|
40660
|
+
return _handleSidebarSignIn.apply(this, arguments);
|
|
40661
|
+
}
|
|
40662
|
+
function _handleSidebarSignIn() {
|
|
40663
|
+
_handleSidebarSignIn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
40664
|
+
var flow, interval, poll;
|
|
40665
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
40666
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
40667
|
+
case 0:
|
|
40668
|
+
_context4.prev = 0;
|
|
40669
|
+
_context4.next = 1;
|
|
40670
|
+
return window.mainApi.registryAuth.initiateLogin();
|
|
40671
|
+
case 1:
|
|
40672
|
+
flow = _context4.sent;
|
|
40673
|
+
if (flow.verificationUrlComplete) {
|
|
40674
|
+
window.mainApi.shell.openExternal(flow.verificationUrlComplete);
|
|
40675
|
+
}
|
|
40676
|
+
interval = (flow.interval || 5) * 1000;
|
|
40677
|
+
poll = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
40678
|
+
var result, profile;
|
|
40679
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
40680
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
40681
|
+
case 0:
|
|
40682
|
+
_context3.prev = 0;
|
|
40683
|
+
_context3.next = 1;
|
|
40684
|
+
return window.mainApi.registryAuth.pollToken(flow.deviceCode);
|
|
40685
|
+
case 1:
|
|
40686
|
+
result = _context3.sent;
|
|
40687
|
+
if (!(result.status === "authorized")) {
|
|
40688
|
+
_context3.next = 3;
|
|
40689
|
+
break;
|
|
40690
|
+
}
|
|
40691
|
+
clearInterval(poll);
|
|
40692
|
+
_context3.next = 2;
|
|
40693
|
+
return window.mainApi.registryAuth.getProfile();
|
|
40694
|
+
case 2:
|
|
40695
|
+
profile = _context3.sent;
|
|
40696
|
+
setAuthProfile(profile);
|
|
40697
|
+
setAuthStatus("authenticated");
|
|
40698
|
+
_context3.next = 4;
|
|
40699
|
+
break;
|
|
40700
|
+
case 3:
|
|
40701
|
+
if (result.status === "expired") {
|
|
40702
|
+
clearInterval(poll);
|
|
40703
|
+
}
|
|
40704
|
+
case 4:
|
|
40705
|
+
_context3.next = 6;
|
|
40706
|
+
break;
|
|
40707
|
+
case 5:
|
|
40708
|
+
_context3.prev = 5;
|
|
40709
|
+
_context3["catch"](0);
|
|
40710
|
+
clearInterval(poll);
|
|
40711
|
+
case 6:
|
|
40712
|
+
case "end":
|
|
40713
|
+
return _context3.stop();
|
|
40714
|
+
}
|
|
40715
|
+
}, _callee3, null, [[0, 5]]);
|
|
40716
|
+
})), interval);
|
|
40717
|
+
_context4.next = 3;
|
|
40718
|
+
break;
|
|
40719
|
+
case 2:
|
|
40720
|
+
_context4.prev = 2;
|
|
40721
|
+
_context4["catch"](0);
|
|
40722
|
+
case 3:
|
|
40723
|
+
case "end":
|
|
40724
|
+
return _context4.stop();
|
|
40725
|
+
}
|
|
40726
|
+
}, _callee4, null, [[0, 2]]);
|
|
40727
|
+
}));
|
|
40728
|
+
return _handleSidebarSignIn.apply(this, arguments);
|
|
40729
|
+
}
|
|
40730
|
+
function handleSidebarSignOut() {
|
|
40731
|
+
return _handleSidebarSignOut.apply(this, arguments);
|
|
40732
|
+
}
|
|
40733
|
+
function _handleSidebarSignOut() {
|
|
40734
|
+
_handleSidebarSignOut = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
40735
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
40736
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
40737
|
+
case 0:
|
|
40738
|
+
_context5.prev = 0;
|
|
40739
|
+
_context5.next = 1;
|
|
40740
|
+
return window.mainApi.registryAuth.logout();
|
|
40741
|
+
case 1:
|
|
40742
|
+
setAuthStatus("unauthenticated");
|
|
40743
|
+
setAuthProfile(null);
|
|
40744
|
+
_context5.next = 3;
|
|
40745
|
+
break;
|
|
40746
|
+
case 2:
|
|
40747
|
+
_context5.prev = 2;
|
|
40748
|
+
_context5["catch"](0);
|
|
40749
|
+
case 3:
|
|
40750
|
+
case "end":
|
|
40751
|
+
return _context5.stop();
|
|
40752
|
+
}
|
|
40753
|
+
}, _callee5, null, [[0, 2]]);
|
|
40754
|
+
}));
|
|
40755
|
+
return _handleSidebarSignOut.apply(this, arguments);
|
|
40756
|
+
}
|
|
40412
40757
|
function handlePopout() {
|
|
40413
|
-
var _window$
|
|
40414
|
-
if (workspaceSelected && (_window$
|
|
40758
|
+
var _window$mainApi1;
|
|
40759
|
+
if (workspaceSelected && (_window$mainApi1 = window.mainApi) !== null && _window$mainApi1 !== void 0 && (_window$mainApi1 = _window$mainApi1.popout) !== null && _window$mainApi1 !== void 0 && _window$mainApi1.open) {
|
|
40415
40760
|
window.mainApi.popout.open(workspaceSelected.id);
|
|
40416
40761
|
}
|
|
40417
40762
|
}
|
|
40418
40763
|
function handleWidgetPopout(widgetId) {
|
|
40419
|
-
var _window$
|
|
40420
|
-
if (workspaceSelected && (_window$
|
|
40764
|
+
var _window$mainApi10;
|
|
40765
|
+
if (workspaceSelected && (_window$mainApi10 = window.mainApi) !== null && _window$mainApi10 !== void 0 && (_window$mainApi10 = _window$mainApi10.widgetPopout) !== null && _window$mainApi10 !== void 0 && _window$mainApi10.open) {
|
|
40421
40766
|
window.mainApi.widgetPopout.open(workspaceSelected.id, widgetId);
|
|
40422
40767
|
}
|
|
40423
40768
|
}
|
|
@@ -40439,26 +40784,21 @@ var DashboardStageInner = function DashboardStageInner(_ref2) {
|
|
|
40439
40784
|
workspaces: workspaceConfig,
|
|
40440
40785
|
menuItems: menuItems,
|
|
40441
40786
|
activeTabId: activeTabId,
|
|
40787
|
+
recentDashboards: recentDashboards,
|
|
40788
|
+
authStatus: authStatus,
|
|
40789
|
+
authProfile: authProfile,
|
|
40442
40790
|
onOpenWorkspace: handleOpenTab,
|
|
40443
40791
|
onNewDashboard: function onNewDashboard() {
|
|
40444
40792
|
return setIsLayoutPickerOpen(true);
|
|
40445
40793
|
},
|
|
40446
|
-
onGoHome: function onGoHome() {
|
|
40447
|
-
return activeTabId && handleCloseTab(activeTabId);
|
|
40448
|
-
},
|
|
40449
|
-
onOpenProviders: function onOpenProviders() {
|
|
40450
|
-
return openAppSettings("providers");
|
|
40451
|
-
},
|
|
40452
|
-
onOpenThemeManager: handleOpenThemeManager,
|
|
40453
|
-
onOpenFolders: function onOpenFolders() {
|
|
40454
|
-
return openAppSettings("folders");
|
|
40455
|
-
},
|
|
40456
40794
|
onOpenSettings: function onOpenSettings() {
|
|
40457
40795
|
return openAppSettings("general");
|
|
40458
40796
|
},
|
|
40459
40797
|
onOpenCommandPalette: function onOpenCommandPalette() {
|
|
40460
40798
|
return setIsCommandPaletteOpen(true);
|
|
40461
|
-
}
|
|
40799
|
+
},
|
|
40800
|
+
onSignIn: handleSidebarSignIn,
|
|
40801
|
+
onSignOut: handleSidebarSignOut
|
|
40462
40802
|
}), /*#__PURE__*/jsx("div", {
|
|
40463
40803
|
className: "flex flex-col flex-1 min-w-0 overflow-hidden",
|
|
40464
40804
|
children: workspaceSelected !== null ? /*#__PURE__*/jsxs(Fragment, {
|
|
@@ -40532,7 +40872,12 @@ var DashboardStageInner = function DashboardStageInner(_ref2) {
|
|
|
40532
40872
|
onOpenThemeEditor: function onOpenThemeEditor() {
|
|
40533
40873
|
setIsAppSettingsOpen(false);
|
|
40534
40874
|
setIsThemeManagerOpen(true);
|
|
40535
|
-
}
|
|
40875
|
+
},
|
|
40876
|
+
authStatus: authStatus,
|
|
40877
|
+
authProfile: authProfile,
|
|
40878
|
+
onSignIn: handleSidebarSignIn,
|
|
40879
|
+
onSignOut: handleSidebarSignOut,
|
|
40880
|
+
onProfileUpdated: handleProfileUpdated
|
|
40536
40881
|
}), /*#__PURE__*/jsx(ThemeManagerModal, {
|
|
40537
40882
|
open: isThemeManagerOpen,
|
|
40538
40883
|
setIsOpen: function setIsOpen() {
|