@deephaven/app-utils 0.72.1-beta.4 → 0.72.1-core-plugins.9
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/components/AppDashboards.d.ts +18 -0
- package/dist/components/AppDashboards.d.ts.map +1 -0
- package/dist/components/AppDashboards.js +71 -0
- package/dist/components/AppDashboards.js.map +1 -0
- package/dist/components/ConnectionBootstrap.d.ts.map +1 -1
- package/dist/components/ConnectionBootstrap.js +101 -7
- package/dist/components/ConnectionBootstrap.js.map +1 -1
- package/dist/components/FontBootstrap.d.ts +11 -1
- package/dist/components/FontBootstrap.d.ts.map +1 -1
- package/dist/components/FontBootstrap.js +11 -1
- package/dist/components/FontBootstrap.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/plugins/PluginUtils.js +10 -2
- package/dist/plugins/PluginUtils.js.map +1 -1
- package/dist/storage/LayoutStorage.d.ts +35 -0
- package/dist/storage/LayoutStorage.d.ts.map +1 -0
- package/dist/storage/LayoutStorage.js +15 -0
- package/dist/storage/LayoutStorage.js.map +1 -0
- package/dist/storage/LocalWorkspaceStorage.d.ts +18 -0
- package/dist/storage/LocalWorkspaceStorage.d.ts.map +1 -0
- package/dist/storage/LocalWorkspaceStorage.js +131 -0
- package/dist/storage/LocalWorkspaceStorage.js.map +1 -0
- package/dist/storage/UserLayoutUtils.d.ts +20 -0
- package/dist/storage/UserLayoutUtils.d.ts.map +1 -0
- package/dist/storage/UserLayoutUtils.js +131 -0
- package/dist/storage/UserLayoutUtils.js.map +1 -0
- package/dist/storage/grpc/GrpcFileStorage.d.ts +28 -0
- package/dist/storage/grpc/GrpcFileStorage.d.ts.map +1 -0
- package/dist/storage/grpc/GrpcFileStorage.js +126 -0
- package/dist/storage/grpc/GrpcFileStorage.js.map +1 -0
- package/dist/storage/grpc/GrpcFileStorageTable.d.ts +52 -0
- package/dist/storage/grpc/GrpcFileStorageTable.d.ts.map +1 -0
- package/dist/storage/grpc/GrpcFileStorageTable.js +245 -0
- package/dist/storage/grpc/GrpcFileStorageTable.js.map +1 -0
- package/dist/storage/grpc/GrpcLayoutStorage.d.ts +16 -0
- package/dist/storage/grpc/GrpcLayoutStorage.d.ts.map +1 -0
- package/dist/storage/grpc/GrpcLayoutStorage.js +36 -0
- package/dist/storage/grpc/GrpcLayoutStorage.js.map +1 -0
- package/dist/storage/grpc/index.d.ts +4 -0
- package/dist/storage/grpc/index.d.ts.map +1 -0
- package/dist/storage/grpc/index.js +4 -0
- package/dist/storage/grpc/index.js.map +1 -0
- package/dist/storage/index.d.ts +6 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +6 -0
- package/dist/storage/index.js.map +1 -0
- package/package.json +28 -21
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import LayoutManager, { ItemConfigType, Settings as LayoutSettings } from '@deephaven/golden-layout';
|
|
3
|
+
interface AppDashboardsProps {
|
|
4
|
+
dashboards: {
|
|
5
|
+
id: string;
|
|
6
|
+
layoutConfig: ItemConfigType[];
|
|
7
|
+
layoutSettings?: Partial<LayoutSettings>;
|
|
8
|
+
key?: string;
|
|
9
|
+
}[];
|
|
10
|
+
activeDashboard: string;
|
|
11
|
+
onLayoutInitialized?: () => void;
|
|
12
|
+
onGoldenLayoutChange: (goldenLayout: LayoutManager) => void;
|
|
13
|
+
plugins: JSX.Element[];
|
|
14
|
+
emptyDashboard?: JSX.Element;
|
|
15
|
+
}
|
|
16
|
+
export declare function AppDashboards({ dashboards, activeDashboard, onLayoutInitialized, onGoldenLayoutChange, plugins, emptyDashboard, }: AppDashboardsProps): JSX.Element;
|
|
17
|
+
export default AppDashboards;
|
|
18
|
+
//# sourceMappingURL=AppDashboards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppDashboards.d.ts","sourceRoot":"","sources":["../../src/components/AppDashboards.tsx"],"names":[],"mappings":";AAWA,OAAO,aAAa,EAAE,EACpB,cAAc,EACd,QAAQ,IAAI,cAAc,EAC3B,MAAM,0BAA0B,CAAC;AAGlC,UAAU,kBAAkB;IAC1B,UAAU,EAAE;QACV,EAAE,EAAE,MAAM,CAAC;QACX,YAAY,EAAE,cAAc,EAAE,CAAC;QAC/B,cAAc,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;QACzC,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,EAAE,CAAC;IACJ,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,oBAAoB,EAAE,CAAC,YAAY,EAAE,aAAa,KAAK,IAAI,CAAC;IAC5D,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;IACvB,cAAc,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CAC9B;AAED,wBAAgB,aAAa,CAAC,EAC5B,UAAU,EACV,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,OAAO,EACP,cAAmC,GACpC,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAgDlC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
2
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
7
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
+
import React, { useCallback } from 'react';
|
|
9
|
+
import classNames from 'classnames';
|
|
10
|
+
import { DashboardUtils, LazyDashboard } from '@deephaven/dashboard';
|
|
11
|
+
import { sanitizeVariableDescriptor, useObjectFetcher } from '@deephaven/jsapi-bootstrap';
|
|
12
|
+
import { LoadingOverlay } from '@deephaven/components';
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
export function AppDashboards(_ref) {
|
|
15
|
+
var {
|
|
16
|
+
dashboards,
|
|
17
|
+
activeDashboard,
|
|
18
|
+
onLayoutInitialized,
|
|
19
|
+
onGoldenLayoutChange,
|
|
20
|
+
plugins,
|
|
21
|
+
emptyDashboard = /*#__PURE__*/_jsx(LoadingOverlay, {})
|
|
22
|
+
} = _ref;
|
|
23
|
+
var fetchObject = useObjectFetcher();
|
|
24
|
+
var hydratePanel = useCallback((hydrateProps, id) => {
|
|
25
|
+
var {
|
|
26
|
+
metadata
|
|
27
|
+
} = hydrateProps;
|
|
28
|
+
try {
|
|
29
|
+
if (metadata != null) {
|
|
30
|
+
var widget = sanitizeVariableDescriptor(metadata);
|
|
31
|
+
return _objectSpread(_objectSpread({
|
|
32
|
+
fetch: function () {
|
|
33
|
+
var _fetch = _asyncToGenerator(function* () {
|
|
34
|
+
return fetchObject(widget);
|
|
35
|
+
});
|
|
36
|
+
function fetch() {
|
|
37
|
+
return _fetch.apply(this, arguments);
|
|
38
|
+
}
|
|
39
|
+
return fetch;
|
|
40
|
+
}()
|
|
41
|
+
}, hydrateProps), {}, {
|
|
42
|
+
localDashboardId: id
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
} catch (e) {
|
|
46
|
+
// Ignore being unable to get the variable descriptor, do the default dashboard hydration
|
|
47
|
+
}
|
|
48
|
+
return DashboardUtils.hydrate(hydrateProps, id);
|
|
49
|
+
}, [fetchObject]);
|
|
50
|
+
return /*#__PURE__*/_jsx("div", {
|
|
51
|
+
className: "tab-content",
|
|
52
|
+
children: dashboards.map(d => /*#__PURE__*/_jsx("div", {
|
|
53
|
+
className: classNames('tab-pane', {
|
|
54
|
+
active: d.id === activeDashboard
|
|
55
|
+
}),
|
|
56
|
+
children: /*#__PURE__*/_jsx(LazyDashboard, {
|
|
57
|
+
id: d.id,
|
|
58
|
+
isActive: d.id === activeDashboard,
|
|
59
|
+
emptyDashboard: emptyDashboard,
|
|
60
|
+
layoutConfig: d.layoutConfig,
|
|
61
|
+
layoutSettings: d.layoutSettings,
|
|
62
|
+
onLayoutInitialized: onLayoutInitialized,
|
|
63
|
+
onGoldenLayoutChange: onGoldenLayoutChange,
|
|
64
|
+
hydrate: hydratePanel,
|
|
65
|
+
plugins: plugins
|
|
66
|
+
}, d.key)
|
|
67
|
+
}, d.id))
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
export default AppDashboards;
|
|
71
|
+
//# sourceMappingURL=AppDashboards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppDashboards.js","names":["React","useCallback","classNames","DashboardUtils","LazyDashboard","sanitizeVariableDescriptor","useObjectFetcher","LoadingOverlay","jsx","_jsx","AppDashboards","_ref","dashboards","activeDashboard","onLayoutInitialized","onGoldenLayoutChange","plugins","emptyDashboard","fetchObject","hydratePanel","hydrateProps","id","metadata","widget","_objectSpread","fetch","_fetch","_asyncToGenerator","apply","arguments","localDashboardId","e","hydrate","className","children","map","d","active","isActive","layoutConfig","layoutSettings","key"],"sources":["../../src/components/AppDashboards.tsx"],"sourcesContent":["import React, { useCallback } from 'react';\nimport classNames from 'classnames';\nimport {\n DashboardUtils,\n DehydratedDashboardPanelProps,\n LazyDashboard,\n} from '@deephaven/dashboard';\nimport {\n sanitizeVariableDescriptor,\n useObjectFetcher,\n} from '@deephaven/jsapi-bootstrap';\nimport LayoutManager, {\n ItemConfigType,\n Settings as LayoutSettings,\n} from '@deephaven/golden-layout';\nimport { LoadingOverlay } from '@deephaven/components';\n\ninterface AppDashboardsProps {\n dashboards: {\n id: string;\n layoutConfig: ItemConfigType[];\n layoutSettings?: Partial<LayoutSettings>;\n key?: string;\n }[];\n activeDashboard: string;\n onLayoutInitialized?: () => void;\n onGoldenLayoutChange: (goldenLayout: LayoutManager) => void;\n plugins: JSX.Element[];\n emptyDashboard?: JSX.Element;\n}\n\nexport function AppDashboards({\n dashboards,\n activeDashboard,\n onLayoutInitialized,\n onGoldenLayoutChange,\n plugins,\n emptyDashboard = <LoadingOverlay />,\n}: AppDashboardsProps): JSX.Element {\n const fetchObject = useObjectFetcher();\n\n const hydratePanel = useCallback(\n (hydrateProps: DehydratedDashboardPanelProps, id: string) => {\n const { metadata } = hydrateProps;\n try {\n if (metadata != null) {\n const widget = sanitizeVariableDescriptor(metadata);\n return {\n fetch: async () => fetchObject(widget),\n ...hydrateProps,\n localDashboardId: id,\n };\n }\n } catch (e: unknown) {\n // Ignore being unable to get the variable descriptor, do the default dashboard hydration\n }\n return DashboardUtils.hydrate(hydrateProps, id);\n },\n [fetchObject]\n );\n\n return (\n <div className=\"tab-content\">\n {dashboards.map(d => (\n <div\n key={d.id}\n className={classNames('tab-pane', {\n active: d.id === activeDashboard,\n })}\n >\n <LazyDashboard\n id={d.id}\n key={d.key}\n isActive={d.id === activeDashboard}\n emptyDashboard={emptyDashboard}\n layoutConfig={d.layoutConfig}\n layoutSettings={d.layoutSettings}\n onLayoutInitialized={onLayoutInitialized}\n onGoldenLayoutChange={onGoldenLayoutChange}\n hydrate={hydratePanel}\n plugins={plugins}\n />\n </div>\n ))}\n </div>\n );\n}\n\nexport default AppDashboards;\n"],"mappings":";;;;;;;AAAA,OAAOA,KAAK,IAAIC,WAAW,QAAQ,OAAO;AAC1C,OAAOC,UAAU,MAAM,YAAY;AACnC,SACEC,cAAc,EAEdC,aAAa,QACR,sBAAsB;AAC7B,SACEC,0BAA0B,EAC1BC,gBAAgB,QACX,4BAA4B;AAKnC,SAASC,cAAc,QAAQ,uBAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAgBvD,OAAO,SAASC,aAAaA,CAAAC,IAAA,EAOO;EAAA,IAPN;IAC5BC,UAAU;IACVC,eAAe;IACfC,mBAAmB;IACnBC,oBAAoB;IACpBC,OAAO;IACPC,cAAc,gBAAGR,IAAA,CAACF,cAAc,IAAE;EAChB,CAAC,GAAAI,IAAA;EACnB,IAAMO,WAAW,GAAGZ,gBAAgB,CAAC,CAAC;EAEtC,IAAMa,YAAY,GAAGlB,WAAW,CAC9B,CAACmB,YAA2C,EAAEC,EAAU,KAAK;IAC3D,IAAM;MAAEC;IAAS,CAAC,GAAGF,YAAY;IACjC,IAAI;MACF,IAAIE,QAAQ,I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"version":3,"file":"ConnectionBootstrap.d.ts","sourceRoot":"","sources":["../../src/components/ConnectionBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ConnectionBootstrap.d.ts","sourceRoot":"","sources":["../../src/components/ConnectionBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAwBzE,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;OAGG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,GACT,EAAE,wBAAwB,GAAG,GAAG,CAAC,OAAO,CAwMxC;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
2
2
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
3
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
4
|
-
import { LoadingOverlay } from '@deephaven/components';
|
|
5
|
-
import { ObjectFetcherContext, sanitizeVariableDescriptor, useApi, useClient } from '@deephaven/jsapi-bootstrap';
|
|
3
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { BasicModal, DebouncedModal, InfoModal, LoadingOverlay, LoadingSpinner } from '@deephaven/components';
|
|
5
|
+
import { ObjectFetcherContext, ObjectFetchManagerContext, sanitizeVariableDescriptor, useApi, useClient } from '@deephaven/jsapi-bootstrap';
|
|
6
6
|
import Log from '@deephaven/log';
|
|
7
7
|
import { assertNotNull } from '@deephaven/utils';
|
|
8
|
+
import { vsDebugDisconnect } from '@deephaven/icons';
|
|
8
9
|
import ConnectionContext from "./ConnectionContext.js";
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
13
|
var log = Log.module('@deephaven/app-utils.ConnectionBootstrap');
|
|
11
14
|
/**
|
|
12
15
|
* ConnectionBootstrap component. Handles initializing the connection.
|
|
@@ -19,6 +22,11 @@ export function ConnectionBootstrap(_ref) {
|
|
|
19
22
|
var client = useClient();
|
|
20
23
|
var [error, setError] = useState();
|
|
21
24
|
var [connection, setConnection] = useState();
|
|
25
|
+
var [connectionState, setConnectionState] = useState('connecting');
|
|
26
|
+
var isAuthFailed = connectionState === 'failed';
|
|
27
|
+
var isShutdown = connectionState === 'shutdown';
|
|
28
|
+
var isReconnecting = connectionState === 'reconnecting';
|
|
29
|
+
var isNotConnecting = connectionState === 'not_connecting';
|
|
22
30
|
useEffect(function initConnection() {
|
|
23
31
|
var isCanceled = false;
|
|
24
32
|
function loadConnection() {
|
|
@@ -32,11 +40,13 @@ export function ConnectionBootstrap(_ref) {
|
|
|
32
40
|
return;
|
|
33
41
|
}
|
|
34
42
|
setConnection(newConnection);
|
|
43
|
+
setConnectionState('connected');
|
|
35
44
|
} catch (e) {
|
|
36
45
|
if (isCanceled) {
|
|
37
46
|
return;
|
|
38
47
|
}
|
|
39
48
|
setError(e);
|
|
49
|
+
setConnectionState('not_connecting');
|
|
40
50
|
}
|
|
41
51
|
});
|
|
42
52
|
return _loadConnection.apply(this, arguments);
|
|
@@ -46,18 +56,64 @@ export function ConnectionBootstrap(_ref) {
|
|
|
46
56
|
isCanceled = true;
|
|
47
57
|
};
|
|
48
58
|
}, [api, client]);
|
|
59
|
+
useEffect(function listenForDisconnect() {
|
|
60
|
+
if (connection == null || isShutdown) return;
|
|
61
|
+
|
|
62
|
+
// handles the disconnect event
|
|
63
|
+
function handleDisconnect(event) {
|
|
64
|
+
var {
|
|
65
|
+
detail
|
|
66
|
+
} = event;
|
|
67
|
+
log.info('Disconnect', "".concat(JSON.stringify(detail)));
|
|
68
|
+
setConnectionState('reconnecting');
|
|
69
|
+
}
|
|
70
|
+
var removerFn = connection.addEventListener(api.IdeConnection.EVENT_DISCONNECT, handleDisconnect);
|
|
71
|
+
return removerFn;
|
|
72
|
+
}, [api, connection, isShutdown]);
|
|
73
|
+
useEffect(function listenForReconnect() {
|
|
74
|
+
if (connection == null || isShutdown) return;
|
|
75
|
+
|
|
76
|
+
// handles the reconnect event
|
|
77
|
+
function handleReconnect(event) {
|
|
78
|
+
var {
|
|
79
|
+
detail
|
|
80
|
+
} = event;
|
|
81
|
+
log.info('Reconnect', "".concat(JSON.stringify(detail)));
|
|
82
|
+
setConnectionState('connected');
|
|
83
|
+
}
|
|
84
|
+
var removerFn = connection.addEventListener(api.CoreClient.EVENT_RECONNECT, handleReconnect);
|
|
85
|
+
return removerFn;
|
|
86
|
+
}, [api, connection, isShutdown]);
|
|
49
87
|
useEffect(function listenForShutdown() {
|
|
50
88
|
if (connection == null) return;
|
|
89
|
+
|
|
90
|
+
// handles the shutdown event
|
|
51
91
|
function handleShutdown(event) {
|
|
52
92
|
var {
|
|
53
93
|
detail
|
|
54
94
|
} = event;
|
|
55
95
|
log.info('Shutdown', "".concat(JSON.stringify(detail)));
|
|
56
96
|
setError("Server shutdown: ".concat(detail !== null && detail !== void 0 ? detail : 'Unknown reason'));
|
|
97
|
+
setConnectionState('shutdown');
|
|
57
98
|
}
|
|
58
99
|
var removerFn = connection.addEventListener(api.IdeConnection.EVENT_SHUTDOWN, handleShutdown);
|
|
59
100
|
return removerFn;
|
|
60
101
|
}, [api, connection]);
|
|
102
|
+
useEffect(function listenForAuthFailed() {
|
|
103
|
+
if (connection == null || isShutdown) return;
|
|
104
|
+
|
|
105
|
+
// handles the auth failed event
|
|
106
|
+
function handleAuthFailed(event) {
|
|
107
|
+
var {
|
|
108
|
+
detail
|
|
109
|
+
} = event;
|
|
110
|
+
log.warn('Reconnect authentication failed', "".concat(JSON.stringify(detail)));
|
|
111
|
+
setError("Reconnect authentication failed: ".concat(detail !== null && detail !== void 0 ? detail : 'Unknown reason'));
|
|
112
|
+
setConnectionState('failed');
|
|
113
|
+
}
|
|
114
|
+
var removerFn = connection.addEventListener(api.CoreClient.EVENT_RECONNECT_AUTH_FAILED, handleAuthFailed);
|
|
115
|
+
return removerFn;
|
|
116
|
+
}, [api, connection, isShutdown]);
|
|
61
117
|
var objectFetcher = useCallback( /*#__PURE__*/function () {
|
|
62
118
|
var _ref2 = _asyncToGenerator(function* (descriptor) {
|
|
63
119
|
assertNotNull(connection, 'No connection available to fetch object with');
|
|
@@ -67,18 +123,56 @@ export function ConnectionBootstrap(_ref) {
|
|
|
67
123
|
return _ref2.apply(this, arguments);
|
|
68
124
|
};
|
|
69
125
|
}(), [connection]);
|
|
70
|
-
|
|
126
|
+
|
|
127
|
+
/** We don't really need to do anything fancy in Core to manage an object, just fetch it */
|
|
128
|
+
var objectManager = useMemo(() => ({
|
|
129
|
+
subscribe: (descriptor, onUpdate) => {
|
|
130
|
+
// We send an update with the fetch right away
|
|
131
|
+
onUpdate({
|
|
132
|
+
fetch: () => objectFetcher(descriptor),
|
|
133
|
+
status: 'ready'
|
|
134
|
+
});
|
|
135
|
+
return () => {
|
|
136
|
+
// no-op
|
|
137
|
+
// For Core, if the server dies then we can't reconnect anyway, so no need to bother listening for subscription or cleaning up
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}), [objectFetcher]);
|
|
141
|
+
function handleRefresh() {
|
|
142
|
+
log.info('Refreshing application');
|
|
143
|
+
window.location.reload();
|
|
144
|
+
}
|
|
145
|
+
if (isShutdown || connectionState === 'connecting' || isNotConnecting) {
|
|
71
146
|
return /*#__PURE__*/_jsx(LoadingOverlay, {
|
|
72
147
|
"data-testid": "connection-bootstrap-loading",
|
|
73
|
-
isLoading:
|
|
148
|
+
isLoading: false,
|
|
74
149
|
errorMessage: error != null ? "".concat(error) : undefined
|
|
75
150
|
});
|
|
76
151
|
}
|
|
77
152
|
return /*#__PURE__*/_jsx(ConnectionContext.Provider, {
|
|
78
|
-
value: connection,
|
|
153
|
+
value: connection !== null && connection !== void 0 ? connection : null,
|
|
79
154
|
children: /*#__PURE__*/_jsx(ObjectFetcherContext.Provider, {
|
|
80
155
|
value: objectFetcher,
|
|
81
|
-
children:
|
|
156
|
+
children: /*#__PURE__*/_jsxs(ObjectFetchManagerContext.Provider, {
|
|
157
|
+
value: objectManager,
|
|
158
|
+
children: [children, /*#__PURE__*/_jsx(DebouncedModal, {
|
|
159
|
+
isOpen: isReconnecting,
|
|
160
|
+
debounceMs: 1000,
|
|
161
|
+
children: /*#__PURE__*/_jsx(InfoModal, {
|
|
162
|
+
icon: vsDebugDisconnect,
|
|
163
|
+
title: /*#__PURE__*/_jsxs(_Fragment, {
|
|
164
|
+
children: [/*#__PURE__*/_jsx(LoadingSpinner, {}), " Attempting to reconnect..."]
|
|
165
|
+
}),
|
|
166
|
+
subtitle: "Please check your network connection."
|
|
167
|
+
})
|
|
168
|
+
}), /*#__PURE__*/_jsx(BasicModal, {
|
|
169
|
+
confirmButtonText: "Refresh",
|
|
170
|
+
onConfirm: handleRefresh,
|
|
171
|
+
isOpen: isAuthFailed,
|
|
172
|
+
headerText: "Authentication failed",
|
|
173
|
+
bodyText: "Credentials are invalid. Please refresh your browser to try and reconnect."
|
|
174
|
+
})]
|
|
175
|
+
})
|
|
82
176
|
})
|
|
83
177
|
});
|
|
84
178
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionBootstrap.js","names":["React","useCallback","useEffect","useState","LoadingOverlay","ObjectFetcherContext","sanitizeVariableDescriptor","useApi","useClient","Log","assertNotNull","ConnectionContext","jsx","_jsx","log","module","ConnectionBootstrap","_ref","children","api","client","error","setError","connection","setConnection","initConnection","isCanceled","loadConnection","_loadConnection","apply","arguments","_asyncToGenerator","newConnection","getAsIdeConnection","e","listenForShutdown","handleShutdown","event","detail","info","concat","JSON","stringify","removerFn","addEventListener","IdeConnection","EVENT_SHUTDOWN","objectFetcher","_ref2","descriptor","getObject","_x","isLoading","errorMessage","undefined","Provider","value"],"sources":["../../src/components/ConnectionBootstrap.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useState } from 'react';\nimport { LoadingOverlay } from '@deephaven/components';\nimport {\n ObjectFetcherContext,\n sanitizeVariableDescriptor,\n useApi,\n useClient,\n} from '@deephaven/jsapi-bootstrap';\nimport type { dh } from '@deephaven/jsapi-types';\nimport Log from '@deephaven/log';\nimport { assertNotNull } from '@deephaven/utils';\nimport ConnectionContext from './ConnectionContext';\n\nconst log = Log.module('@deephaven/app-utils.ConnectionBootstrap');\n\nexport type ConnectionBootstrapProps = {\n /**\n * The children to render wrapped with the ConnectionContext.\n * Will not render children until the connection is created.\n */\n children: React.ReactNode;\n};\n\n/**\n * ConnectionBootstrap component. Handles initializing the connection.\n */\nexport function ConnectionBootstrap({\n children,\n}: ConnectionBootstrapProps): JSX.Element {\n const api = useApi();\n const client = useClient();\n const [error, setError] = useState<unknown>();\n const [connection, setConnection] = useState<dh.IdeConnection>();\n useEffect(\n function initConnection() {\n let isCanceled = false;\n async function loadConnection(): Promise<void> {\n try {\n const newConnection = await client.getAsIdeConnection();\n if (isCanceled) {\n return;\n }\n setConnection(newConnection);\n } catch (e) {\n if (isCanceled) {\n return;\n }\n setError(e);\n }\n }\n loadConnection();\n return () => {\n isCanceled = true;\n };\n },\n [api, client]\n );\n\n useEffect(\n function listenForShutdown() {\n if (connection == null) return;\n\n function handleShutdown(event: CustomEvent): void {\n const { detail } = event;\n log.info('Shutdown', `${JSON.stringify(detail)}`);\n setError(`Server shutdown: ${detail ?? 'Unknown reason'}`);\n }\n\n const removerFn = connection.addEventListener(\n api.IdeConnection.EVENT_SHUTDOWN,\n handleShutdown\n );\n return removerFn;\n },\n [api, connection]\n );\n\n const objectFetcher = useCallback(\n async (descriptor: dh.ide.VariableDescriptor) => {\n assertNotNull(connection, 'No connection available to fetch object with');\n return connection.getObject(sanitizeVariableDescriptor(descriptor));\n },\n [connection]\n );\n\n if (connection == null || error != null) {\n return (\n <LoadingOverlay\n data-testid=\"connection-bootstrap-loading\"\n isLoading={connection == null}\n errorMessage={error != null ? `${error}` : undefined}\n />\n );\n }\n\n return (\n <ConnectionContext.Provider value={connection}>\n <ObjectFetcherContext.Provider value={objectFetcher}>\n {children}\n </ObjectFetcherContext.Provider>\n </ConnectionContext.Provider>\n );\n}\n\nexport default ConnectionBootstrap;\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC/D,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SACEC,oBAAoB,EACpBC,0BAA0B,EAC1BC,MAAM,EACNC,SAAS,QACJ,4BAA4B;AAEnC,OAAOC,GAAG,MAAM,gBAAgB;AAChC,SAASC,aAAa,QAAQ,kBAAkB;AAAC,OAC1CC,iBAAiB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAExB,IAAMC,GAAG,GAAGL,GAAG,CAACM,MAAM,CAAC,0CAA0C,CAAC;AAUlE;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CAAAC,IAAA,EAEO;EAAA,IAFN;IAClCC;EACwB,CAAC,GAAAD,IAAA;EACzB,IAAME,GAAG,GAAGZ,MAAM,CAAC,CAAC;EACpB,IAAMa,MAAM,GAAGZ,SAAS,CAAC,CAAC;EAC1B,IAAM,CAACa,KAAK,EAAEC,QAAQ,CAAC,GAAGnB,QAAQ,CAAU,CAAC;EAC7C,IAAM,CAACoB,UAAU,EAAEC,aAAa,CAAC,GAAGrB,QAAQ,CAAmB,CAAC;EAChED,SAAS,CACP,SAASuB,cAAcA,CAAA,EAAG;IACxB,IAAIC,UAAU,GAAG,KAAK;I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AAqC,EAAK;MAC/CvC,aAAa,CAACa,UAAU,EAAE,8CAA8C,CAAC;MACzE,OAAOA,UAAU,CAAC2B,SAAS,CAAC5C,0BAA0B,CAAC2C,UAAU,CAAC,CAAC;IACrE,CAAC;IAAA,iBAAAE,EAAA;MAAA,OAAAH,KAAA,CAAAnB,KAAA,OAAAC,SAAA;IAAA;EAAA,KACD,CAACP,UAAU,CACb,CAAC;EAED,IAAIA,UAAU,IAAI,IAAI,IAAIF,KAAK,IAAI,IAAI,EAAE;IACvC,oBACER,IAAA,CAACT,cAAc;MACb,eAAY,8BAA8B;MAC1CgD,SAAS,EAAE7B,UAAU,IAAI,IAAK;MAC9B8B,YAAY,EAAEhC,KAAK,IAAI,IAAI,MAAAmB,MAAA,CAAMnB,KAAK,IAAKiC;IAAU,CACtD,CAAC;EAEN;EAEA,oBACEzC,IAAA,CAACF,iBAAiB,CAAC4C,QAAQ;IAACC,KAAK,EAAEjC,UAAW;IAAAL,QAAA,eAC5CL,IAAA,CAACR,oBAAoB,CAACkD,QAAQ;MAACC,KAAK,EAAET,aAAc;MAAA7B,QAAA,EACjDA;IAAQ,CACoB;EAAC,CACN,CAAC;AAEjC;AAEA,eAAeF,mBAAmB"}
|
|
1
|
+
{"version":3,"file":"ConnectionBootstrap.js","names":["React","useCallback","useEffect","useMemo","useState","BasicModal","DebouncedModal","InfoModal","LoadingOverlay","LoadingSpinner","ObjectFetcherContext","ObjectFetchManagerContext","sanitizeVariableDescriptor","useApi","useClient","Log","assertNotNull","vsDebugDisconnect","ConnectionContext","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","log","module","ConnectionBootstrap","_ref","children","api","client","error","setError","connection","setConnection","connectionState","setConnectionState","isAuthFailed","isShutdown","isReconnecting","isNotConnecting","initConnection","isCanceled","loadConnection","_loadConnection","apply","arguments","_asyncToGenerator","newConnection","getAsIdeConnection","e","listenForDisconnect","handleDisconnect","event","detail","info","concat","JSON","stringify","removerFn","addEventListener","IdeConnection","EVENT_DISCONNECT","listenForReconnect","handleReconnect","CoreClient","EVENT_RECONNECT","listenForShutdown","handleShutdown","EVENT_SHUTDOWN","listenForAuthFailed","handleAuthFailed","warn","EVENT_RECONNECT_AUTH_FAILED","objectFetcher","_ref2","descriptor","getObject","_x","objectManager","subscribe","onUpdate","fetch","status","handleRefresh","window","location","reload","isLoading","errorMessage","undefined","Provider","value","isOpen","debounceMs","icon","title","subtitle","confirmButtonText","onConfirm","headerText","bodyText"],"sources":["../../src/components/ConnectionBootstrap.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from 'react';\nimport {\n BasicModal,\n DebouncedModal,\n InfoModal,\n LoadingOverlay,\n LoadingSpinner,\n} from '@deephaven/components';\nimport {\n ObjectFetcherContext,\n ObjectFetchManager,\n ObjectFetchManagerContext,\n sanitizeVariableDescriptor,\n useApi,\n useClient,\n} from '@deephaven/jsapi-bootstrap';\nimport type { dh } from '@deephaven/jsapi-types';\nimport Log from '@deephaven/log';\nimport { assertNotNull } from '@deephaven/utils';\nimport { vsDebugDisconnect } from '@deephaven/icons';\nimport ConnectionContext from './ConnectionContext';\n\nconst log = Log.module('@deephaven/app-utils.ConnectionBootstrap');\n\nexport type ConnectionBootstrapProps = {\n /**\n * The children to render wrapped with the ConnectionContext.\n * Will not render children until the connection is created.\n */\n children: React.ReactNode;\n};\n\n/**\n * ConnectionBootstrap component. Handles initializing the connection.\n */\nexport function ConnectionBootstrap({\n children,\n}: ConnectionBootstrapProps): JSX.Element {\n const api = useApi();\n const client = useClient();\n const [error, setError] = useState<unknown>();\n const [connection, setConnection] = useState<dh.IdeConnection>();\n const [connectionState, setConnectionState] = useState<\n | 'not_connecting'\n | 'connecting'\n | 'connected'\n | 'reconnecting'\n | 'failed'\n | 'shutdown'\n >('connecting');\n const isAuthFailed = connectionState === 'failed';\n const isShutdown = connectionState === 'shutdown';\n const isReconnecting = connectionState === 'reconnecting';\n const isNotConnecting = connectionState === 'not_connecting';\n\n useEffect(\n function initConnection() {\n let isCanceled = false;\n async function loadConnection(): Promise<void> {\n try {\n const newConnection = await client.getAsIdeConnection();\n if (isCanceled) {\n return;\n }\n setConnection(newConnection);\n setConnectionState('connected');\n } catch (e) {\n if (isCanceled) {\n return;\n }\n setError(e);\n setConnectionState('not_connecting');\n }\n }\n loadConnection();\n return () => {\n isCanceled = true;\n };\n },\n [api, client]\n );\n\n useEffect(\n function listenForDisconnect() {\n if (connection == null || isShutdown) return;\n\n // handles the disconnect event\n function handleDisconnect(event: CustomEvent): void {\n const { detail } = event;\n log.info('Disconnect', `${JSON.stringify(detail)}`);\n setConnectionState('reconnecting');\n }\n const removerFn = connection.addEventListener(\n api.IdeConnection.EVENT_DISCONNECT,\n handleDisconnect\n );\n\n return removerFn;\n },\n [api, connection, isShutdown]\n );\n\n useEffect(\n function listenForReconnect() {\n if (connection == null || isShutdown) return;\n\n // handles the reconnect event\n function handleReconnect(event: CustomEvent): void {\n const { detail } = event;\n log.info('Reconnect', `${JSON.stringify(detail)}`);\n setConnectionState('connected');\n }\n const removerFn = connection.addEventListener(\n api.CoreClient.EVENT_RECONNECT,\n handleReconnect\n );\n\n return removerFn;\n },\n [api, connection, isShutdown]\n );\n\n useEffect(\n function listenForShutdown() {\n if (connection == null) return;\n\n // handles the shutdown event\n function handleShutdown(event: CustomEvent): void {\n const { detail } = event;\n log.info('Shutdown', `${JSON.stringify(detail)}`);\n setError(`Server shutdown: ${detail ?? 'Unknown reason'}`);\n setConnectionState('shutdown');\n }\n const removerFn = connection.addEventListener(\n api.IdeConnection.EVENT_SHUTDOWN,\n handleShutdown\n );\n\n return removerFn;\n },\n [api, connection]\n );\n\n useEffect(\n function listenForAuthFailed() {\n if (connection == null || isShutdown) return;\n\n // handles the auth failed event\n function handleAuthFailed(event: CustomEvent): void {\n const { detail } = event;\n log.warn(\n 'Reconnect authentication failed',\n `${JSON.stringify(detail)}`\n );\n setError(\n `Reconnect authentication failed: ${detail ?? 'Unknown reason'}`\n );\n setConnectionState('failed');\n }\n const removerFn = connection.addEventListener(\n api.CoreClient.EVENT_RECONNECT_AUTH_FAILED,\n handleAuthFailed\n );\n\n return removerFn;\n },\n [api, connection, isShutdown]\n );\n\n const objectFetcher = useCallback(\n async (descriptor: dh.ide.VariableDescriptor) => {\n assertNotNull(connection, 'No connection available to fetch object with');\n return connection.getObject(sanitizeVariableDescriptor(descriptor));\n },\n [connection]\n );\n\n /** We don't really need to do anything fancy in Core to manage an object, just fetch it */\n const objectManager: ObjectFetchManager = useMemo(\n () => ({\n subscribe: (descriptor, onUpdate) => {\n // We send an update with the fetch right away\n onUpdate({\n fetch: () => objectFetcher(descriptor),\n status: 'ready',\n });\n return () => {\n // no-op\n // For Core, if the server dies then we can't reconnect anyway, so no need to bother listening for subscription or cleaning up\n };\n },\n }),\n [objectFetcher]\n );\n\n function handleRefresh(): void {\n log.info('Refreshing application');\n window.location.reload();\n }\n\n if (isShutdown || connectionState === 'connecting' || isNotConnecting) {\n return (\n <LoadingOverlay\n data-testid=\"connection-bootstrap-loading\"\n isLoading={false}\n errorMessage={error != null ? `${error}` : undefined}\n />\n );\n }\n\n return (\n <ConnectionContext.Provider value={connection ?? null}>\n <ObjectFetcherContext.Provider value={objectFetcher}>\n <ObjectFetchManagerContext.Provider value={objectManager}>\n {children}\n <DebouncedModal isOpen={isReconnecting} debounceMs={1000}>\n <InfoModal\n icon={vsDebugDisconnect}\n title={\n <>\n <LoadingSpinner /> Attempting to reconnect...\n </>\n }\n subtitle=\"Please check your network connection.\"\n />\n </DebouncedModal>\n <BasicModal\n confirmButtonText=\"Refresh\"\n onConfirm={handleRefresh}\n isOpen={isAuthFailed}\n headerText=\"Authentication failed\"\n bodyText=\"Credentials are invalid. Please refresh your browser to try and reconnect.\"\n />\n </ObjectFetchManagerContext.Provider>\n </ObjectFetcherContext.Provider>\n </ConnectionContext.Provider>\n );\n}\n\nexport default ConnectionBootstrap;\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,OAAO,E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|
-
import 'fira';
|
|
2
|
+
import '@fontsource/fira-mono/400.css';
|
|
3
|
+
import '@fontsource/fira-mono/500.css';
|
|
4
|
+
import '@fontsource/fira-mono/700.css';
|
|
5
|
+
import '@fontsource/fira-sans/300.css';
|
|
6
|
+
import '@fontsource/fira-sans/300-italic.css';
|
|
7
|
+
import '@fontsource/fira-sans/400.css';
|
|
8
|
+
import '@fontsource/fira-sans/400-italic.css';
|
|
9
|
+
import '@fontsource/fira-sans/500.css';
|
|
10
|
+
import '@fontsource/fira-sans/600.css';
|
|
11
|
+
import '@fontsource/fira-sans/700.css';
|
|
12
|
+
import '@fontsource/fira-sans/700-italic.css';
|
|
3
13
|
export declare const FontsLoadedContext: React.Context<boolean>;
|
|
4
14
|
export type FontBootstrapProps = {
|
|
5
15
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FontBootstrap.d.ts","sourceRoot":"","sources":["../../src/components/FontBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAClE,OAAO,
|
|
1
|
+
{"version":3,"file":"FontBootstrap.d.ts","sourceRoot":"","sources":["../../src/components/FontBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAClE,OAAO,+BAA+B,CAAC;AACvC,OAAO,+BAA+B,CAAC;AACvC,OAAO,+BAA+B,CAAC;AACvC,OAAO,+BAA+B,CAAC;AACvC,OAAO,sCAAsC,CAAC;AAC9C,OAAO,+BAA+B,CAAC;AACvC,OAAO,sCAAsC,CAAC;AAC9C,OAAO,+BAA+B,CAAC;AACvC,OAAO,+BAA+B,CAAC;AACvC,OAAO,+BAA+B,CAAC;AACvC,OAAO,sCAAsC,CAAC;AAE9C,eAAO,MAAM,kBAAkB,wBAAgC,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B;;;OAGG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAC5B,cAAyE,EACzE,QAAQ,GACT,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAmClC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import React, { createContext, useEffect, useState } from 'react';
|
|
2
|
-
import 'fira';
|
|
2
|
+
import '@fontsource/fira-mono/400.css';
|
|
3
|
+
import '@fontsource/fira-mono/500.css';
|
|
4
|
+
import '@fontsource/fira-mono/700.css';
|
|
5
|
+
import '@fontsource/fira-sans/300.css';
|
|
6
|
+
import '@fontsource/fira-sans/300-italic.css';
|
|
7
|
+
import '@fontsource/fira-sans/400.css';
|
|
8
|
+
import '@fontsource/fira-sans/400-italic.css';
|
|
9
|
+
import '@fontsource/fira-sans/500.css';
|
|
10
|
+
import '@fontsource/fira-sans/600.css';
|
|
11
|
+
import '@fontsource/fira-sans/700.css';
|
|
12
|
+
import '@fontsource/fira-sans/700-italic.css';
|
|
3
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
14
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FontBootstrap.js","names":["React","createContext","useEffect","useState","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","FontsLoadedContext","FontBootstrap","_ref","fontClassNames","children","isLoaded","setIsLoaded","initFonts","document","fonts","ready","then","Provider","value","id","style","visibility","position","top","map","className"],"sources":["../../src/components/FontBootstrap.tsx"],"sourcesContent":["import React, { createContext, useEffect, useState } from 'react';\nimport 'fira';\n\nexport const FontsLoadedContext = createContext<boolean>(false);\n\nexport type FontBootstrapProps = {\n /**\n * Class names of the font elements to pre load\n */\n fontClassNames?: string[];\n\n /**\n * The children to render wrapped with the FontsLoadedContext.\n * Note that it renders the children even if the fonts aren't loaded yet.\n */\n children: React.ReactNode;\n};\n\n/**\n * FontBootstrap component. Handles preloading fonts.\n */\nexport function FontBootstrap({\n fontClassNames = ['fira-sans-regular', 'fira-sans-semibold', 'fira-mono'],\n children,\n}: FontBootstrapProps): JSX.Element {\n const [isLoaded, setIsLoaded] = useState(false);\n useEffect(function initFonts() {\n document.fonts.ready.then(() => {\n setIsLoaded(true);\n });\n }, []);\n\n return (\n <>\n <FontsLoadedContext.Provider value={isLoaded}>\n {children}\n </FontsLoadedContext.Provider>\n {/*\n Need to preload any monaco and Deephaven grid fonts.\n We hide text with all the fonts we need on the root app.jsx page\n Load the Fira Mono font so that Monaco calculates word wrapping properly.\n This element doesn't need to be visible, just load the font and stay hidden.\n https://github.com/microsoft/vscode/issues/88689\n Can be replaced with a rel=\"preload\" when firefox adds support\n https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content\n */}\n <div\n id=\"preload-fonts\"\n style={{ visibility: 'hidden', position: 'absolute', top: -10000 }}\n >\n {/* trigger loading of fonts needed by monaco and iris grid */}\n {fontClassNames.map(className => (\n <p key={className} className={className}>\n preload\n </p>\n ))}\n </div>\n </>\n );\n}\n\nexport default FontBootstrap;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACjE,OAAO,
|
|
1
|
+
{"version":3,"file":"FontBootstrap.js","names":["React","createContext","useEffect","useState","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","FontsLoadedContext","FontBootstrap","_ref","fontClassNames","children","isLoaded","setIsLoaded","initFonts","document","fonts","ready","then","Provider","value","id","style","visibility","position","top","map","className"],"sources":["../../src/components/FontBootstrap.tsx"],"sourcesContent":["import React, { createContext, useEffect, useState } from 'react';\nimport '@fontsource/fira-mono/400.css';\nimport '@fontsource/fira-mono/500.css';\nimport '@fontsource/fira-mono/700.css';\nimport '@fontsource/fira-sans/300.css';\nimport '@fontsource/fira-sans/300-italic.css';\nimport '@fontsource/fira-sans/400.css';\nimport '@fontsource/fira-sans/400-italic.css';\nimport '@fontsource/fira-sans/500.css';\nimport '@fontsource/fira-sans/600.css';\nimport '@fontsource/fira-sans/700.css';\nimport '@fontsource/fira-sans/700-italic.css';\n\nexport const FontsLoadedContext = createContext<boolean>(false);\n\nexport type FontBootstrapProps = {\n /**\n * Class names of the font elements to pre load\n */\n fontClassNames?: string[];\n\n /**\n * The children to render wrapped with the FontsLoadedContext.\n * Note that it renders the children even if the fonts aren't loaded yet.\n */\n children: React.ReactNode;\n};\n\n/**\n * FontBootstrap component. Handles preloading fonts.\n */\nexport function FontBootstrap({\n fontClassNames = ['fira-sans-regular', 'fira-sans-semibold', 'fira-mono'],\n children,\n}: FontBootstrapProps): JSX.Element {\n const [isLoaded, setIsLoaded] = useState(false);\n useEffect(function initFonts() {\n document.fonts.ready.then(() => {\n setIsLoaded(true);\n });\n }, []);\n\n return (\n <>\n <FontsLoadedContext.Provider value={isLoaded}>\n {children}\n </FontsLoadedContext.Provider>\n {/*\n Need to preload any monaco and Deephaven grid fonts.\n We hide text with all the fonts we need on the root app.jsx page\n Load the Fira Mono font so that Monaco calculates word wrapping properly.\n This element doesn't need to be visible, just load the font and stay hidden.\n https://github.com/microsoft/vscode/issues/88689\n Can be replaced with a rel=\"preload\" when firefox adds support\n https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content\n */}\n <div\n id=\"preload-fonts\"\n style={{ visibility: 'hidden', position: 'absolute', top: -10000 }}\n >\n {/* trigger loading of fonts needed by monaco and iris grid */}\n {fontClassNames.map(className => (\n <p key={className} className={className}>\n preload\n </p>\n ))}\n </div>\n </>\n );\n}\n\nexport default FontBootstrap;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACjE,OAAO,+BAA+B;AACtC,OAAO,+BAA+B;AACtC,OAAO,+BAA+B;AACtC,OAAO,+BAA+B;AACtC,OAAO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a"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/components/index.ts"],"sourcesContent":["export * from './AppBootstrap';\nexport * from './AuthBootstrap';\nexport * from './ConnectionBootstrap';\nexport * from './ConnectionContext';\nexport * from './FontBootstrap';\nexport * from './FontsLoaded';\nexport * from './PluginsBootstrap';\nexport * from './ThemeBootstrap';\nexport * from './useConnection';\nexport * from './useServerConfig';\nexport * from './useUser';\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/components/index.ts"],"sourcesContent":["export * from './AppBootstrap';\nexport * from './AppDashboards';\nexport * from './AuthBootstrap';\nexport * from './ConnectionBootstrap';\nexport * from './ConnectionContext';\nexport * from './FontBootstrap';\nexport * from './FontsLoaded';\nexport * from './PluginsBootstrap';\nexport * from './ThemeBootstrap';\nexport * from './useConnection';\nexport * from './useServerConfig';\nexport * from './useUser';\n"],"mappings":""}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["export * from './components';\nexport * from './plugins';\nexport * from './utils';\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["export * from './components';\nexport * from './plugins';\nexport * from './storage';\nexport * from './utils';\n"],"mappings":""}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1
6
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
2
7
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
3
8
|
import Log from '@deephaven/log';
|
|
@@ -93,14 +98,17 @@ function _loadModulePlugins() {
|
|
|
93
98
|
for (var _i = 0; _i < pluginModules.length; _i += 1) {
|
|
94
99
|
var module = pluginModules[_i];
|
|
95
100
|
var {
|
|
96
|
-
name: _name
|
|
101
|
+
name: _name,
|
|
102
|
+
version
|
|
97
103
|
} = manifest.plugins[_i];
|
|
98
104
|
if (module.status === 'fulfilled') {
|
|
99
105
|
var moduleValue = getPluginModuleValue(module.value);
|
|
100
106
|
if (moduleValue == null) {
|
|
101
107
|
log.error("Plugin '".concat(_name, "' is missing an exported value."));
|
|
102
108
|
} else {
|
|
103
|
-
pluginMap.set(_name, moduleValue)
|
|
109
|
+
pluginMap.set(_name, _objectSpread(_objectSpread({}, moduleValue), {}, {
|
|
110
|
+
version
|
|
111
|
+
}));
|
|
104
112
|
}
|
|
105
113
|
} else {
|
|
106
114
|
log.error("Unable to load plugin '".concat(_name, "'"), module.reason);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginUtils.js","names":["Log","isAuthPlugin","PluginType","isLegacyAuthPlugin","isLegacyPlugin","isPlugin","loadRemoteModule","log","module","loadModulePlugin","_x","_loadModulePlugin","apply","arguments","_asyncToGenerator","pluginUrl","myModule","loadJson","_x2","_loadJson","jsonUrl","res","fetch","ok","Error","statusText","json","_unused","hasDefaultExport","value","default","getPluginModuleValue","loadModulePlugins","_x3","_loadModulePlugins","modulePluginsUrl","debug","manifest","concat","Array","isArray","plugins","pluginPromises","i","length","name","main","pluginMainUrl","push","pluginModules","Promise","allSettled","pluginMap","Map","status","moduleValue","error","set","reason","info","e","getAuthHandlers","authConfigValues","_authConfigValues$get","_authConfigValues$get2","get","split","getAuthPluginComponent","corePlugins","undefined","authHandlers","authPlugins","entries","filter","_ref","plugin","map","_ref2","type","AUTH_PLUGIN","component","AuthPlugin","Component","isAvailable","availableAuthPlugins","_ref3","warn","_ref4","join"],"sources":["../../src/plugins/PluginUtils.tsx"],"sourcesContent":["import Log from '@deephaven/log';\nimport {\n type PluginModuleMap,\n type AuthPlugin,\n type AuthPluginComponent,\n isAuthPlugin,\n LegacyAuthPlugin,\n LegacyPlugin,\n Plugin,\n PluginType,\n isLegacyAuthPlugin,\n isLegacyPlugin,\n PluginModule,\n isPlugin,\n} from '@deephaven/plugin';\nimport loadRemoteModule from './loadRemoteModule';\n\nconst log = Log.module('@deephaven/app-utils.PluginUtils');\n\nexport type PluginManifestPluginInfo = {\n name: string;\n main: string;\n version: string;\n};\n\nexport type PluginManifest = { plugins: PluginManifestPluginInfo[] };\n\n/**\n * Imports a commonjs plugin module from the provided URL\n * @param pluginUrl The URL of the plugin to load\n * @returns The loaded module\n */\nexport async function loadModulePlugin(\n pluginUrl: string\n): Promise<LegacyPlugin | { default: Plugin }> {\n const myModule = await loadRemoteModule(pluginUrl);\n return myModule;\n}\n\n/**\n * Loads a JSON file and returns the JSON object\n * @param jsonUrl The URL of the JSON file to load\n * @returns The JSON object of the manifest file\n */\nexport async function loadJson(jsonUrl: string): Promise<PluginManifest> {\n const res = await fetch(jsonUrl);\n if (!res.ok) {\n throw new Error(res.statusText);\n }\n try {\n return await res.json();\n } catch {\n throw new Error('Could not be parsed as JSON');\n }\n}\n\nfunction hasDefaultExport(value: unknown): value is { default: Plugin } {\n return (\n typeof value === 'object' &&\n value != null &&\n typeof (value as { default?: unknown }).default === 'object'\n );\n}\n\nexport function getPluginModuleValue(\n value: LegacyPlugin | Plugin | { default: Plugin }\n): PluginModule | null {\n // TypeScript builds CJS default exports differently depending on\n // whether there are also named exports. If the default is the only\n // export, it will be the value. If there are also named exports,\n // it will be assigned to the `default` property on the value.\n if (isPlugin(value)) {\n return value;\n }\n if (hasDefaultExport(value) && isPlugin(value.default)) {\n return value.default;\n }\n if (isLegacyPlugin(value)) {\n return value;\n }\n return null;\n}\n\n/**\n * Load all plugin modules available based on the manifest file at the provided base URL\n * @param modulePluginsUrl The base URL of the module plugins to load\n * @returns A map from the name of the plugin to the plugin module that was loaded\n */\nexport async function loadModulePlugins(\n modulePluginsUrl: string\n): Promise<PluginModuleMap> {\n log.debug('Loading plugins...');\n try {\n const manifest = await loadJson(`${modulePluginsUrl}/manifest.json`);\n\n if (!Array.isArray(manifest.plugins)) {\n throw new Error('Plugin manifest JSON does not contain plugins array');\n }\n\n log.debug('Plugin manifest loaded:', manifest);\n const pluginPromises: Promise<LegacyPlugin | { default: Plugin }>[] = [];\n for (let i = 0; i < manifest.plugins.length; i += 1) {\n const { name, main } = manifest.plugins[i];\n const pluginMainUrl = `${modulePluginsUrl}/${name}/${main}`;\n pluginPromises.push(loadModulePlugin(pluginMainUrl));\n }\n\n const pluginModules = await Promise.allSettled(pluginPromises);\n\n const pluginMap: PluginModuleMap = new Map();\n for (let i = 0; i < pluginModules.length; i += 1) {\n const module = pluginModules[i];\n const { name } = manifest.plugins[i];\n if (module.status === 'fulfilled') {\n const moduleValue = getPluginModuleValue(module.value);\n if (moduleValue == null) {\n log.error(`Plugin '${name}' is missing an exported value.`);\n } else {\n pluginMap.set(name, moduleValue);\n }\n } else {\n log.error(`Unable to load plugin '${name}'`, module.reason);\n }\n }\n log.info('Plugins loaded:', pluginMap);\n\n return pluginMap;\n } catch (e) {\n log.error('Unable to load plugins:', e);\n return new Map();\n }\n}\n\nexport function getAuthHandlers(\n authConfigValues: Map<string, string>\n): string[] {\n return authConfigValues.get('AuthHandlers')?.split(',') ?? [];\n}\n\n/**\n * Get the auth plugin component from the plugin map and current configuration\n * Throws if no auth plugin is available\n *\n * @param pluginMap Map of plugins loaded from the server\n * @param authConfigValues Auth config values from the server\n * @param corePlugins Map of core auth plugins to include in the list. They are added after the loaded plugins\n * @returns The auth plugin component to render\n */\nexport function getAuthPluginComponent(\n pluginMap: PluginModuleMap,\n authConfigValues: Map<string, string>,\n corePlugins = new Map<string, AuthPlugin | LegacyAuthPlugin>()\n): AuthPluginComponent {\n const authHandlers = getAuthHandlers(authConfigValues);\n // User plugins take priority over core plugins\n const authPlugins = (\n [...pluginMap.entries(), ...corePlugins.entries()].filter(\n ([, plugin]) => isAuthPlugin(plugin) || isLegacyAuthPlugin(plugin)\n ) as [string, AuthPlugin | LegacyAuthPlugin][]\n ).map(([name, plugin]) => {\n if (isLegacyAuthPlugin(plugin)) {\n return {\n type: PluginType.AUTH_PLUGIN,\n name,\n component: plugin.AuthPlugin.Component,\n isAvailable: plugin.AuthPlugin.isAvailable,\n };\n }\n\n return plugin;\n });\n\n // Filter the available auth plugins\n const availableAuthPlugins = authPlugins.filter(({ isAvailable }) =>\n isAvailable(authHandlers, authConfigValues)\n );\n\n if (availableAuthPlugins.length === 0) {\n throw new Error(\n `No login plugins found, please register a login plugin for auth handlers: ${authHandlers}`\n );\n } else if (availableAuthPlugins.length > 1) {\n log.warn(\n 'More than one login plugin available, will use the first one: ',\n availableAuthPlugins.map(({ name }) => name).join(', ')\n );\n }\n\n const { name, component } = availableAuthPlugins[0];\n log.info('Using LoginPlugin', name);\n\n return component;\n}\n"],"mappings":";;AAAA,OAAOA,GAAG,MAAM,gBAAgB;AAChC,SAIEC,YAAY,EAIZC,UAAU,EACVC,kBAAkB,EAClBC,cAAc,EAEdC,QAAQ,QACH,mBAAmB;AAAC,OACpBC,gBAAgB;AAEvB,IAAMC,GAAG,GAAGP,GAAG,CAACQ,MAAM,CAAC,kCAAkC,CAAC;AAU1D;AACA;AACA;AACA;AACA;AACA,gBAAsBC,gBAAgBA,CAAAC,EAAA;EAAA,OAAAC,iBAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;;AAOtC;AACA;AACA;AACA;AACA;AAJA,SAAAF,kBAAA;EAAAA,iBAAA,GAAAG,iBAAA,CAPO,WACLC,SAAiB,EAC4B;IAC7C,IAAMC,QAAQ,SAASV,gBAAgB,CAACS,SAAS,CAAC;IAClD,OAAOC,QAAQ;EACjB,CAAC;EAAA,OAAAL,iBAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAOD,gBAAsBI,QAAQA,CAAAC,GAAA;EAAA,OAAAC,SAAA,CAAAP,KAAA,OAAAC,SAAA;AAAA;AAU7B,SAAAM,UAAA;EAAAA,SAAA,GAAAL,iBAAA,CAVM,WAAwBM,OAAe,EAA2B;IACvE,IAAMC,GAAG,SAASC,KAAK,CAACF,OAAO,CAAC;IAChC,IAAI,CAACC,GAAG,CAACE,EAAE,EAAE;MACX,MAAM,IAAIC,KAAK,CAACH,GAAG,CAACI,UAAU,CAAC;IACjC;IACA,IAAI;MACF,aAAaJ,GAAG,CAACK,IAAI,CAAC,CAAC;IACzB,CAAC,CAAC,OAAAC,OAAA,EAAM;MACN,MAAM,IAAIH,KAAK,CAAC,6BAA6B,CAA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AAS,EAAEL,MAAM,CAACM,UAAU,CAACC,SAAS;QACtCC,WAAW,EAAER,MAAM,CAACM,UAAU,CAACE;MACjC,CAAC;IACH;IAEA,OAAOR,MAAM;EACf,CAAC,CAAC;;EAEF;EACA,IAAMS,oBAAoB,GAAGb,WAAW,CAACE,MAAM,CAACY,KAAA;IAAA,IAAC;MAAEF;IAAY,CAAC,GAAAE,KAAA;IAAA,OAC9DF,WAAW,CAACb,YAAY,EAAER,gBAAgB,CAAC;EAAA,CAC7C,CAAC;EAED,IAAIsB,oBAAoB,CAACxC,MAAM,KAAK,CAAC,EAAE;IACrC,MAAM,IAAIpB,KAAK,8EAAAc,MAAA,CACgEgC,YAAY,CAC3F,CAAC;EACH,CAAC,MAAM,IAAIc,oBAAoB,CAACxC,MAAM,GAAG,CAAC,EAAE;IAC1CrC,GAAG,CAAC+E,IAAI,CACN,gEAAgE,EAChEF,oBAAoB,CAACR,GAAG,CAACW,KAAA;MAAA,IAAC;QAAE1C;MAAK,CAAC,GAAA0C,KAAA;MAAA,OAAK1C,IAAI;IAAA,EAAC,CAAC2C,IAAI,CAAC,IAAI,CACxD,CAAC;EACH;EAEA,IAAM;IAAE3C,IAAI;IAAEmC;EAAU,CAAC,GAAGI,oBAAoB,CAAC,CAAC,CAAC;EACnD7E,GAAG,CAACoD,IAAI,CAAC,mBAAmB,EAAEd,IAAI,CAAC;EAEnC,OAAOmC,SAAS;AAClB"}
|
|
1
|
+
{"version":3,"file":"PluginUtils.js","names":["Log","isAuthPlugin","PluginType","isLegacyAuthPlugin","isLegacyPlugin","isPlugin","loadRemoteModule","log","module","loadModulePlugin","_x","_loadModulePlugin","apply","arguments","_asyncToGenerator","pluginUrl","myModule","loadJson","_x2","_loadJson","jsonUrl","res","fetch","ok","Error","statusText","json","_unused","hasDefaultExport","value","default","getPluginModuleValue","loadModulePlugins","_x3","_loadModulePlugins","modulePluginsUrl","debug","manifest","concat","Array","isArray","plugins","pluginPromises","i","length","name","main","pluginMainUrl","push","pluginModules","Promise","allSettled","pluginMap","Map","version","status","moduleValue","error","set","_objectSpread","reason","info","e","getAuthHandlers","authConfigValues","_authConfigValues$get","_authConfigValues$get2","get","split","getAuthPluginComponent","corePlugins","undefined","authHandlers","authPlugins","entries","filter","_ref","plugin","map","_ref2","type","AUTH_PLUGIN","component","AuthPlugin","Component","isAvailable","availableAuthPlugins","_ref3","warn","_ref4","join"],"sources":["../../src/plugins/PluginUtils.tsx"],"sourcesContent":["import Log from '@deephaven/log';\nimport {\n type PluginModuleMap,\n type AuthPlugin,\n type AuthPluginComponent,\n isAuthPlugin,\n LegacyAuthPlugin,\n LegacyPlugin,\n Plugin,\n PluginType,\n isLegacyAuthPlugin,\n isLegacyPlugin,\n PluginModule,\n isPlugin,\n} from '@deephaven/plugin';\nimport loadRemoteModule from './loadRemoteModule';\n\nconst log = Log.module('@deephaven/app-utils.PluginUtils');\n\nexport type PluginManifestPluginInfo = {\n name: string;\n main: string;\n version: string;\n};\n\nexport type PluginManifest = { plugins: PluginManifestPluginInfo[] };\n\n/**\n * Imports a commonjs plugin module from the provided URL\n * @param pluginUrl The URL of the plugin to load\n * @returns The loaded module\n */\nexport async function loadModulePlugin(\n pluginUrl: string\n): Promise<LegacyPlugin | { default: Plugin }> {\n const myModule = await loadRemoteModule(pluginUrl);\n return myModule;\n}\n\n/**\n * Loads a JSON file and returns the JSON object\n * @param jsonUrl The URL of the JSON file to load\n * @returns The JSON object of the manifest file\n */\nexport async function loadJson(jsonUrl: string): Promise<PluginManifest> {\n const res = await fetch(jsonUrl);\n if (!res.ok) {\n throw new Error(res.statusText);\n }\n try {\n return await res.json();\n } catch {\n throw new Error('Could not be parsed as JSON');\n }\n}\n\nfunction hasDefaultExport(value: unknown): value is { default: Plugin } {\n return (\n typeof value === 'object' &&\n value != null &&\n typeof (value as { default?: unknown }).default === 'object'\n );\n}\n\nexport function getPluginModuleValue(\n value: LegacyPlugin | Plugin | { default: Plugin }\n): PluginModule | null {\n // TypeScript builds CJS default exports differently depending on\n // whether there are also named exports. If the default is the only\n // export, it will be the value. If there are also named exports,\n // it will be assigned to the `default` property on the value.\n if (isPlugin(value)) {\n return value;\n }\n if (hasDefaultExport(value) && isPlugin(value.default)) {\n return value.default;\n }\n if (isLegacyPlugin(value)) {\n return value;\n }\n return null;\n}\n\n/**\n * Load all plugin modules available based on the manifest file at the provided base URL\n * @param modulePluginsUrl The base URL of the module plugins to load\n * @returns A map from the name of the plugin to the plugin module that was loaded\n */\nexport async function loadModulePlugins(\n modulePluginsUrl: string\n): Promise<PluginModuleMap> {\n log.debug('Loading plugins...');\n try {\n const manifest = await loadJson(`${modulePluginsUrl}/manifest.json`);\n\n if (!Array.isArray(manifest.plugins)) {\n throw new Error('Plugin manifest JSON does not contain plugins array');\n }\n\n log.debug('Plugin manifest loaded:', manifest);\n const pluginPromises: Promise<LegacyPlugin | { default: Plugin }>[] = [];\n for (let i = 0; i < manifest.plugins.length; i += 1) {\n const { name, main } = manifest.plugins[i];\n const pluginMainUrl = `${modulePluginsUrl}/${name}/${main}`;\n pluginPromises.push(loadModulePlugin(pluginMainUrl));\n }\n\n const pluginModules = await Promise.allSettled(pluginPromises);\n\n const pluginMap: PluginModuleMap = new Map();\n for (let i = 0; i < pluginModules.length; i += 1) {\n const module = pluginModules[i];\n const { name, version } = manifest.plugins[i];\n if (module.status === 'fulfilled') {\n const moduleValue = getPluginModuleValue(module.value);\n if (moduleValue == null) {\n log.error(`Plugin '${name}' is missing an exported value.`);\n } else {\n pluginMap.set(name, { ...moduleValue, version });\n }\n } else {\n log.error(`Unable to load plugin '${name}'`, module.reason);\n }\n }\n log.info('Plugins loaded:', pluginMap);\n\n return pluginMap;\n } catch (e) {\n log.error('Unable to load plugins:', e);\n return new Map();\n }\n}\n\nexport function getAuthHandlers(\n authConfigValues: Map<string, string>\n): string[] {\n return authConfigValues.get('AuthHandlers')?.split(',') ?? [];\n}\n\n/**\n * Get the auth plugin component from the plugin map and current configuration\n * Throws if no auth plugin is available\n *\n * @param pluginMap Map of plugins loaded from the server\n * @param authConfigValues Auth config values from the server\n * @param corePlugins Map of core auth plugins to include in the list. They are added after the loaded plugins\n * @returns The auth plugin component to render\n */\nexport function getAuthPluginComponent(\n pluginMap: PluginModuleMap,\n authConfigValues: Map<string, string>,\n corePlugins = new Map<string, AuthPlugin | LegacyAuthPlugin>()\n): AuthPluginComponent {\n const authHandlers = getAuthHandlers(authConfigValues);\n // User plugins take priority over core plugins\n const authPlugins = (\n [...pluginMap.entries(), ...corePlugins.entries()].filter(\n ([, plugin]) => isAuthPlugin(plugin) || isLegacyAuthPlugin(plugin)\n ) as [string, AuthPlugin | LegacyAuthPlugin][]\n ).map(([name, plugin]) => {\n if (isLegacyAuthPlugin(plugin)) {\n return {\n type: PluginType.AUTH_PLUGIN,\n name,\n component: plugin.AuthPlugin.Component,\n isAvailable: plugin.AuthPlugin.isAvailable,\n };\n }\n\n return plugin;\n });\n\n // Filter the available auth plugins\n const availableAuthPlugins = authPlugins.filter(({ isAvailable }) =>\n isAvailable(authHandlers, authConfigValues)\n );\n\n if (availableAuthPlugins.length === 0) {\n throw new Error(\n `No login plugins found, please register a login plugin for auth handlers: ${authHandlers}`\n );\n } else if (availableAuthPlugins.length > 1) {\n log.warn(\n 'More than one login plugin available, will use the first one: ',\n availableAuthPlugins.map(({ name }) => name).join(', ')\n );\n }\n\n const { name, component } = availableAuthPlugins[0];\n log.info('Using LoginPlugin', name);\n\n return component;\n}\n"],"mappings":";;;;;;;AAAA,OAAOA,GAAG,MAAM,gBAAgB;AAChC,SAIEC,YAAY,EAIZC,UAAU,EACVC,kBAAkB,EAClBC,cAAc,EAEdC,QAAQ,QACH,mBAAmB;AAAC,OACpBC,gBAAgB;AAEvB,IAAMC,GAAG,GAAGP,GAAG,CAACQ,MAAM,CAAC,kCAAkC,CAAC;AAU1D;AACA;AACA;AACA;AACA;AACA,gBAAsBC,gBAAgBA,CAAAC,EAAA;EAAA,OAAAC,iBAAA,CAAAC,KAAA,OAAAC,SAAA;AAA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AC1C,MAAM,GAAG,CAAC,EAAE;IAC1CrC,GAAG,CAACiF,IAAI,CACN,gEAAgE,EAChEF,oBAAoB,CAACR,GAAG,CAACW,KAAA;MAAA,IAAC;QAAE5C;MAAK,CAAC,GAAA4C,KAAA;MAAA,OAAK5C,IAAI;IAAA,EAAC,CAAC6C,IAAI,CAAC,IAAI,CACxD,CAAC;EACH;EAEA,IAAM;IAAE7C,IAAI;IAAEqC;EAAU,CAAC,GAAGI,oBAAoB,CAAC,CAAC,CAAC;EACnD/E,GAAG,CAACsD,IAAI,CAAC,mBAAmB,EAAEhB,IAAI,CAAC;EAEnC,OAAOqC,SAAS;AAClB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ItemConfigType } from '@deephaven/golden-layout';
|
|
2
|
+
import { FilterSet, Link } from '@deephaven/dashboard-core-plugins';
|
|
3
|
+
import { PluginDataMap } from '@deephaven/redux';
|
|
4
|
+
/**
|
|
5
|
+
* Have a different version to support legacy layout exports
|
|
6
|
+
*/
|
|
7
|
+
export type ExportedLayoutV1 = ItemConfigType[];
|
|
8
|
+
export type ExportedLayoutV2 = {
|
|
9
|
+
filterSets: FilterSet[];
|
|
10
|
+
links: Link[];
|
|
11
|
+
layoutConfig: ItemConfigType[];
|
|
12
|
+
pluginDataMap?: PluginDataMap;
|
|
13
|
+
version: 2;
|
|
14
|
+
};
|
|
15
|
+
export type ExportedLayout = ExportedLayoutV1 | ExportedLayoutV2;
|
|
16
|
+
export declare function isLayoutV2(layout: ExportedLayout): layout is ExportedLayoutV2;
|
|
17
|
+
export declare function isLayoutV1(layout: ExportedLayout): layout is ExportedLayoutV1;
|
|
18
|
+
/**
|
|
19
|
+
* Interface for accessing layouts from wherever they are stored.
|
|
20
|
+
*/
|
|
21
|
+
export interface LayoutStorage {
|
|
22
|
+
/**
|
|
23
|
+
* Get the name of the layouts available
|
|
24
|
+
* @returns The string array of layout names
|
|
25
|
+
*/
|
|
26
|
+
getLayouts: () => Promise<string[]>;
|
|
27
|
+
/**
|
|
28
|
+
* Get the layout with the specified name
|
|
29
|
+
* @param name The name of the layout to fetch
|
|
30
|
+
* @returns GoldenLayout layout config
|
|
31
|
+
*/
|
|
32
|
+
getLayout: (name: string) => Promise<ExportedLayout>;
|
|
33
|
+
}
|
|
34
|
+
export default LayoutStorage;
|
|
35
|
+
//# sourceMappingURL=LayoutStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LayoutStorage.d.ts","sourceRoot":"","sources":["../../src/storage/LayoutStorage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,cAAc,EAAE,CAAC;AAEhD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,YAAY,EAAE,cAAc,EAAE,CAAC;IAC/B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,OAAO,EAAE,CAAC,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;AAEjE,wBAAgB,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,IAAI,gBAAgB,CAE7E;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,IAAI,gBAAgB,CAE7E;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,UAAU,EAAE,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAEpC;;;;OAIG;IACH,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;CACtD;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Have a different version to support legacy layout exports
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export function isLayoutV2(layout) {
|
|
6
|
+
return layout.version === 2;
|
|
7
|
+
}
|
|
8
|
+
export function isLayoutV1(layout) {
|
|
9
|
+
return Array.isArray(layout);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Interface for accessing layouts from wherever they are stored.
|
|
14
|
+
*/
|
|
15
|
+
//# sourceMappingURL=LayoutStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LayoutStorage.js","names":["isLayoutV2","layout","version","isLayoutV1","Array","isArray"],"sources":["../../src/storage/LayoutStorage.ts"],"sourcesContent":["import type { ItemConfigType } from '@deephaven/golden-layout';\nimport { FilterSet, Link } from '@deephaven/dashboard-core-plugins';\nimport { PluginDataMap } from '@deephaven/redux';\n\n/**\n * Have a different version to support legacy layout exports\n */\nexport type ExportedLayoutV1 = ItemConfigType[];\n\nexport type ExportedLayoutV2 = {\n filterSets: FilterSet[];\n links: Link[];\n layoutConfig: ItemConfigType[];\n pluginDataMap?: PluginDataMap;\n version: 2;\n};\n\nexport type ExportedLayout = ExportedLayoutV1 | ExportedLayoutV2;\n\nexport function isLayoutV2(layout: ExportedLayout): layout is ExportedLayoutV2 {\n return (layout as ExportedLayoutV2).version === 2;\n}\n\nexport function isLayoutV1(layout: ExportedLayout): layout is ExportedLayoutV1 {\n return Array.isArray(layout);\n}\n\n/**\n * Interface for accessing layouts from wherever they are stored.\n */\nexport interface LayoutStorage {\n /**\n * Get the name of the layouts available\n * @returns The string array of layout names\n */\n getLayouts: () => Promise<string[]>;\n\n /**\n * Get the layout with the specified name\n * @param name The name of the layout to fetch\n * @returns GoldenLayout layout config\n */\n getLayout: (name: string) => Promise<ExportedLayout>;\n}\n\nexport default LayoutStorage;\n"],"mappings":"AAIA;AACA;AACA;;AAaA,OAAO,SAASA,UAAUA,CAACC,MAAsB,EAA8B;EAC7E,OAAQA,MAAM,CAAsBC,OAAO,KAAK,CAAC;AACnD;AAEA,OAAO,SAASC,UAAUA,CAACF,MAAsB,EAA8B;EAC7E,OAAOG,KAAK,CAACC,OAAO,CAACJ,MAAM,CAAC;AAC9B;;AAEA;AACA;AACA"}
|