@trops/dash-core 0.1.451 → 0.1.452
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +137 -59
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +105 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -45820,7 +45820,9 @@ var getIconForServer = function getIconForServer(server) {
|
|
|
45820
45820
|
*/
|
|
45821
45821
|
var McpCatalogDetail = function McpCatalogDetail(_ref) {
|
|
45822
45822
|
var onSave = _ref.onSave,
|
|
45823
|
-
onCancel = _ref.onCancel
|
|
45823
|
+
onCancel = _ref.onCancel,
|
|
45824
|
+
_ref$initialSelectedI = _ref.initialSelectedId,
|
|
45825
|
+
initialSelectedId = _ref$initialSelectedI === void 0 ? null : _ref$initialSelectedI;
|
|
45824
45826
|
var appContext = React.useContext(AppContext);
|
|
45825
45827
|
var dashApi = appContext === null || appContext === void 0 ? void 0 : appContext.dashApi;
|
|
45826
45828
|
var _useState = React.useState([]),
|
|
@@ -45957,6 +45959,22 @@ var McpCatalogDetail = function McpCatalogDetail(_ref) {
|
|
|
45957
45959
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45958
45960
|
}, [dashApi]);
|
|
45959
45961
|
|
|
45962
|
+
// Pre-select a catalog entry when initialSelectedId is provided
|
|
45963
|
+
// (used by the cross-modal "Add new <type>" CTA from the Widget
|
|
45964
|
+
// Builder). Fires once the catalog finishes loading; if no entry
|
|
45965
|
+
// matches the id (e.g. type isn't in the catalog), silently no-ops
|
|
45966
|
+
// and the user lands on the catalog grid to pick manually.
|
|
45967
|
+
React.useEffect(function () {
|
|
45968
|
+
if (!initialSelectedId || selectedServer || catalog.length === 0) return;
|
|
45969
|
+
var match = catalog.find(function (s) {
|
|
45970
|
+
return s && s.id === initialSelectedId;
|
|
45971
|
+
});
|
|
45972
|
+
if (match) {
|
|
45973
|
+
setSelectedServer(match);
|
|
45974
|
+
}
|
|
45975
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45976
|
+
}, [catalog, initialSelectedId]);
|
|
45977
|
+
|
|
45960
45978
|
// Filter catalog by search, then sort alphabetically by display name.
|
|
45961
45979
|
// Built-in and known-external entries are interleaved alphabetically —
|
|
45962
45980
|
// the per-card "external" badge keeps the source obvious without
|
|
@@ -47030,7 +47048,11 @@ var ProvidersSection = function ProvidersSection(_ref) {
|
|
|
47030
47048
|
_ref$createRequested = _ref.createRequested,
|
|
47031
47049
|
createRequested = _ref$createRequested === void 0 ? false : _ref$createRequested,
|
|
47032
47050
|
_ref$onCreateAcknowle = _ref.onCreateAcknowledged,
|
|
47033
|
-
onCreateAcknowledged = _ref$onCreateAcknowle === void 0 ? null : _ref$onCreateAcknowle
|
|
47051
|
+
onCreateAcknowledged = _ref$onCreateAcknowle === void 0 ? null : _ref$onCreateAcknowle,
|
|
47052
|
+
_ref$initialProviderT = _ref.initialProviderType,
|
|
47053
|
+
initialProviderType = _ref$initialProviderT === void 0 ? null : _ref$initialProviderT,
|
|
47054
|
+
_ref$initialProviderC = _ref.initialProviderClass,
|
|
47055
|
+
initialProviderClass = _ref$initialProviderC === void 0 ? null : _ref$initialProviderC;
|
|
47034
47056
|
var appContext = React.useContext(AppContext);
|
|
47035
47057
|
var providers = (appContext === null || appContext === void 0 ? void 0 : appContext.providers) || {};
|
|
47036
47058
|
var refreshProviders = appContext === null || appContext === void 0 ? void 0 : appContext.refreshProviders;
|
|
@@ -47366,14 +47388,29 @@ var ProvidersSection = function ProvidersSection(_ref) {
|
|
|
47366
47388
|
});
|
|
47367
47389
|
}
|
|
47368
47390
|
|
|
47369
|
-
// Respond to external create trigger from header
|
|
47391
|
+
// Respond to external create trigger from header (or from the
|
|
47392
|
+
// cross-modal "Add new <type>" event dispatched by the Widget
|
|
47393
|
+
// Builder, with optional initialProviderType/initialProviderClass
|
|
47394
|
+
// for type pre-fill / catalog pre-select).
|
|
47370
47395
|
var prevCreateRequested = React.useRef(false);
|
|
47371
47396
|
React.useEffect(function () {
|
|
47372
47397
|
if (createRequested && !prevCreateRequested.current) {
|
|
47373
47398
|
resetForm();
|
|
47374
47399
|
setSelectedName(null);
|
|
47375
|
-
|
|
47376
|
-
|
|
47400
|
+
if (initialProviderClass === "mcp") {
|
|
47401
|
+
// MCP class: open the catalog detail. Pre-select happens in
|
|
47402
|
+
// McpCatalogDetail via the initialSelectedId prop passed below.
|
|
47403
|
+
setIsCreating(false);
|
|
47404
|
+
setIsAddingMcp(true);
|
|
47405
|
+
} else {
|
|
47406
|
+
// Credential class (default): open the credential create form
|
|
47407
|
+
// and pre-fill the type field if provided.
|
|
47408
|
+
setIsAddingMcp(false);
|
|
47409
|
+
setIsCreating(true);
|
|
47410
|
+
if (initialProviderType) {
|
|
47411
|
+
setFormType(initialProviderType);
|
|
47412
|
+
}
|
|
47413
|
+
}
|
|
47377
47414
|
}
|
|
47378
47415
|
prevCreateRequested.current = createRequested;
|
|
47379
47416
|
if (createRequested && onCreateAcknowledged) {
|
|
@@ -47509,7 +47546,8 @@ var ProvidersSection = function ProvidersSection(_ref) {
|
|
|
47509
47546
|
onSave: handleMcpSave,
|
|
47510
47547
|
onCancel: function onCancel() {
|
|
47511
47548
|
return setIsAddingMcp(false);
|
|
47512
|
-
}
|
|
47549
|
+
},
|
|
47550
|
+
initialSelectedId: initialProviderType
|
|
47513
47551
|
});
|
|
47514
47552
|
} else if (isCreating) {
|
|
47515
47553
|
detailContent = /*#__PURE__*/jsxRuntime.jsx(ProviderDetail, {
|
|
@@ -53291,6 +53329,10 @@ var AppSettingsModal = function AppSettingsModal(_ref) {
|
|
|
53291
53329
|
initialProviderName = _ref$initialProviderN === void 0 ? null : _ref$initialProviderN,
|
|
53292
53330
|
_ref$initialCreatePro = _ref.initialCreateProvider,
|
|
53293
53331
|
initialCreateProvider = _ref$initialCreatePro === void 0 ? false : _ref$initialCreatePro,
|
|
53332
|
+
_ref$initialProviderT = _ref.initialProviderType,
|
|
53333
|
+
initialProviderType = _ref$initialProviderT === void 0 ? null : _ref$initialProviderT,
|
|
53334
|
+
_ref$initialProviderC = _ref.initialProviderClass,
|
|
53335
|
+
initialProviderClass = _ref$initialProviderC === void 0 ? null : _ref$initialProviderC,
|
|
53294
53336
|
_ref$workspaces = _ref.workspaces,
|
|
53295
53337
|
workspaces = _ref$workspaces === void 0 ? [] : _ref$workspaces,
|
|
53296
53338
|
_ref$menuItems = _ref.menuItems,
|
|
@@ -53426,7 +53468,9 @@ var AppSettingsModal = function AppSettingsModal(_ref) {
|
|
|
53426
53468
|
return setCreateRequested(false);
|
|
53427
53469
|
},
|
|
53428
53470
|
initialProviderName: initialProviderName,
|
|
53429
|
-
initialCreateRequested: initialCreateProvider
|
|
53471
|
+
initialCreateRequested: initialCreateProvider,
|
|
53472
|
+
initialProviderType: initialProviderType,
|
|
53473
|
+
initialProviderClass: initialProviderClass
|
|
53430
53474
|
}), activeSection === "themes" && /*#__PURE__*/jsxRuntime.jsx(ThemesSection, {
|
|
53431
53475
|
onOpenThemeEditor: onOpenThemeEditor,
|
|
53432
53476
|
dashApi: dashApi,
|
|
@@ -58278,13 +58322,31 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
58278
58322
|
_useState52 = _slicedToArray(_useState51, 2),
|
|
58279
58323
|
appSettingsCreateProvider = _useState52[0],
|
|
58280
58324
|
setAppSettingsCreateProvider = _useState52[1];
|
|
58325
|
+
// Optional pre-fills used by the cross-modal "Add new <type>"
|
|
58326
|
+
// flow dispatched from dash-electron's WidgetBuilderModal.
|
|
58327
|
+
// initialProviderType is the type id (e.g. "filesystem", "slack").
|
|
58328
|
+
// initialProviderClass routes the create flow: "mcp" opens the
|
|
58329
|
+
// catalog detail with that type pre-selected; otherwise opens
|
|
58330
|
+
// the credential create form with formType pre-filled.
|
|
58331
|
+
var _useState53 = React.useState(null),
|
|
58332
|
+
_useState54 = _slicedToArray(_useState53, 2),
|
|
58333
|
+
appSettingsInitialProviderType = _useState54[0],
|
|
58334
|
+
setAppSettingsInitialProviderType = _useState54[1];
|
|
58335
|
+
var _useState55 = React.useState(null),
|
|
58336
|
+
_useState56 = _slicedToArray(_useState55, 2),
|
|
58337
|
+
appSettingsInitialProviderClass = _useState56[0],
|
|
58338
|
+
setAppSettingsInitialProviderClass = _useState56[1];
|
|
58281
58339
|
function openAppSettings() {
|
|
58282
58340
|
var section = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "general";
|
|
58283
58341
|
var providerName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
58284
58342
|
var createProvider = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
58343
|
+
var providerType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
58344
|
+
var providerClass = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
58285
58345
|
setAppSettingsInitialSection(section);
|
|
58286
58346
|
setAppSettingsInitialProvider(providerName);
|
|
58287
58347
|
setAppSettingsCreateProvider(createProvider);
|
|
58348
|
+
setAppSettingsInitialProviderType(providerType);
|
|
58349
|
+
setAppSettingsInitialProviderClass(providerClass);
|
|
58288
58350
|
setIsAppSettingsOpen(true);
|
|
58289
58351
|
}
|
|
58290
58352
|
function handleProfileUpdated() {
|
|
@@ -58376,6 +58438,27 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
58376
58438
|
};
|
|
58377
58439
|
}, [changeCurrentTheme]);
|
|
58378
58440
|
|
|
58441
|
+
// ─── Listen for "open Settings to create a provider of type X" ──
|
|
58442
|
+
// Dispatched by dash-electron's Widget Builder PreviewProviderPicker
|
|
58443
|
+
// when the user clicks "Add new <type>" because no instances of the
|
|
58444
|
+
// chosen type exist yet. Detail: { type, providerClass }. The
|
|
58445
|
+
// Widget Builder's own listener (in dash-electron/Dash.js) handles
|
|
58446
|
+
// closing the builder modal — this listener only opens Settings.
|
|
58447
|
+
React.useEffect(function () {
|
|
58448
|
+
var handler = function handler(e) {
|
|
58449
|
+
var _ref4 = (e === null || e === void 0 ? void 0 : e.detail) || {},
|
|
58450
|
+
type = _ref4.type,
|
|
58451
|
+
providerClass = _ref4.providerClass;
|
|
58452
|
+
if (!type) return;
|
|
58453
|
+
openAppSettings("providers", null, true, type, providerClass || null);
|
|
58454
|
+
};
|
|
58455
|
+
window.addEventListener("dash:open-settings-create-provider", handler);
|
|
58456
|
+
return function () {
|
|
58457
|
+
return window.removeEventListener("dash:open-settings-create-provider", handler);
|
|
58458
|
+
};
|
|
58459
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
58460
|
+
}, []);
|
|
58461
|
+
|
|
58379
58462
|
// ─── Listen for external "open workspace" requests ──────────────
|
|
58380
58463
|
// Fired by: Dash.js notification click, MCP state-changed for
|
|
58381
58464
|
// create_dashboard, etc. Any code that wants to switch the active
|
|
@@ -58385,10 +58468,10 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
58385
58468
|
// We record the requested ID and open it once it appears in
|
|
58386
58469
|
// workspaceConfig — handles the case where the workspace was just
|
|
58387
58470
|
// created and the config reload is still in flight.
|
|
58388
|
-
var
|
|
58389
|
-
|
|
58390
|
-
pendingOpenWorkspaceId =
|
|
58391
|
-
setPendingOpenWorkspaceId =
|
|
58471
|
+
var _useState57 = React.useState(null),
|
|
58472
|
+
_useState58 = _slicedToArray(_useState57, 2),
|
|
58473
|
+
pendingOpenWorkspaceId = _useState58[0],
|
|
58474
|
+
setPendingOpenWorkspaceId = _useState58[1];
|
|
58392
58475
|
React.useEffect(function () {
|
|
58393
58476
|
var handler = function handler(e) {
|
|
58394
58477
|
var _e$detail2;
|
|
@@ -59010,10 +59093,10 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
59010
59093
|
}
|
|
59011
59094
|
|
|
59012
59095
|
// ─── Page State ──────────────────────────────────────────────────
|
|
59013
|
-
var
|
|
59014
|
-
|
|
59015
|
-
activePageId =
|
|
59016
|
-
setActivePageId =
|
|
59096
|
+
var _useState59 = React.useState(null),
|
|
59097
|
+
_useState60 = _slicedToArray(_useState59, 2),
|
|
59098
|
+
activePageId = _useState60[0],
|
|
59099
|
+
setActivePageId = _useState60[1];
|
|
59017
59100
|
|
|
59018
59101
|
// Page history stack for goBack() — pushes the previous page id
|
|
59019
59102
|
// whenever a navigation happens through navigateToPage().
|
|
@@ -59047,9 +59130,9 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
59047
59130
|
// Listen for programmatic page switches via DashboardActionsApi
|
|
59048
59131
|
React.useEffect(function () {
|
|
59049
59132
|
function onSwitchPage(e) {
|
|
59050
|
-
var
|
|
59051
|
-
pageId =
|
|
59052
|
-
pageName =
|
|
59133
|
+
var _ref5 = e.detail || {},
|
|
59134
|
+
pageId = _ref5.pageId,
|
|
59135
|
+
pageName = _ref5.pageName;
|
|
59053
59136
|
if (pageId) {
|
|
59054
59137
|
navigateToPage(pageId);
|
|
59055
59138
|
} else if (pageName) {
|
|
@@ -59904,11 +59987,15 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
59904
59987
|
if (!open) {
|
|
59905
59988
|
setAppSettingsInitialProvider(null);
|
|
59906
59989
|
setAppSettingsCreateProvider(false);
|
|
59990
|
+
setAppSettingsInitialProviderType(null);
|
|
59991
|
+
setAppSettingsInitialProviderClass(null);
|
|
59907
59992
|
}
|
|
59908
59993
|
},
|
|
59909
59994
|
initialSection: appSettingsInitialSection,
|
|
59910
59995
|
initialProviderName: appSettingsInitialProvider,
|
|
59911
59996
|
initialCreateProvider: appSettingsCreateProvider,
|
|
59997
|
+
initialProviderType: appSettingsInitialProviderType,
|
|
59998
|
+
initialProviderClass: appSettingsInitialProviderClass,
|
|
59912
59999
|
workspaces: workspaceConfig,
|
|
59913
60000
|
menuItems: menuItems,
|
|
59914
60001
|
dashApi: dashApi,
|