@elevasis/ui 2.2.0 → 2.3.0
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/{chunk-J5TBNCMD.js → chunk-2XWEOJSX.js} +3 -3
- package/dist/{chunk-RB34YOIX.js → chunk-47YILFON.js} +98 -70
- package/dist/{chunk-MZPVNRPL.js → chunk-ISHNN42L.js} +134 -10
- package/dist/{chunk-PFONCU6C.js → chunk-IWFIKQR5.js} +1 -1
- package/dist/{chunk-QITPFGWC.js → chunk-JT7WDIZI.js} +2 -2
- package/dist/{chunk-7IE3KXKV.js → chunk-NKV5MEWQ.js} +3877 -1543
- package/dist/{chunk-MXVA7U2I.js → chunk-PEATQEEP.js} +3 -3
- package/dist/{chunk-JT3FN6TE.js → chunk-Q3FTQP2M.js} +2 -2
- package/dist/{chunk-BIZNOFO4.js → chunk-SWIAK47F.js} +3 -3
- package/dist/{chunk-35QO7M43.js → chunk-VNUOQQNY.js} +1 -1
- package/dist/{chunk-2JTCPVZX.js → chunk-ZY4MWZW2.js} +2 -2
- package/dist/components/index.css +7 -0
- package/dist/components/index.d.ts +16 -4
- package/dist/components/index.js +1214 -120
- package/dist/features/auth/index.css +7 -0
- package/dist/features/dashboard/index.css +7 -0
- package/dist/features/dashboard/index.d.ts +4 -0
- package/dist/features/dashboard/index.js +6 -6
- package/dist/features/monitoring/index.css +7 -0
- package/dist/features/monitoring/index.d.ts +4 -0
- package/dist/features/monitoring/index.js +7 -7
- package/dist/features/operations/index.css +7 -0
- package/dist/features/operations/index.d.ts +26 -14
- package/dist/features/operations/index.js +8 -8
- package/dist/features/settings/index.css +7 -0
- package/dist/features/settings/index.d.ts +4 -0
- package/dist/features/settings/index.js +7 -7
- package/dist/hooks/index.css +7 -0
- package/dist/hooks/index.d.ts +4 -1
- package/dist/hooks/index.js +5 -5
- package/dist/hooks/published.css +7 -0
- package/dist/hooks/published.d.ts +4 -1
- package/dist/hooks/published.js +4 -4
- package/dist/index.css +7 -0
- package/dist/index.d.ts +307 -249
- package/dist/index.js +6 -6
- package/dist/provider/index.css +7 -0
- package/dist/provider/index.d.ts +58 -2
- package/dist/provider/index.js +3 -3
- package/dist/provider/published.d.ts +58 -2
- package/dist/provider/published.js +1 -1
- package/dist/theme/index.js +2 -2
- package/package.json +9 -3
|
@@ -184,7 +184,15 @@ function useOptionalElevasisFeatures() {
|
|
|
184
184
|
return useContext(ElevasisFeaturesContext);
|
|
185
185
|
}
|
|
186
186
|
function getEnabledFeatures(features, hasFeature) {
|
|
187
|
-
return features.filter((feature) =>
|
|
187
|
+
return features.filter((feature) => {
|
|
188
|
+
const accessKeys = [feature.key, feature.navEntry?.featureKey].filter(
|
|
189
|
+
(key) => Boolean(key)
|
|
190
|
+
);
|
|
191
|
+
if (accessKeys.length === 0) {
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
return accessKeys.some((key) => hasFeature(key));
|
|
195
|
+
});
|
|
188
196
|
}
|
|
189
197
|
function normalizeRoutePath(path) {
|
|
190
198
|
const trimmedPath = path.trim();
|
|
@@ -198,6 +206,90 @@ function isRouteMatch(currentPath, route) {
|
|
|
198
206
|
const normalizedRoute = normalizeRoutePath(route);
|
|
199
207
|
return normalizedCurrentPath === normalizedRoute || normalizedCurrentPath.startsWith(`${normalizedRoute}/`);
|
|
200
208
|
}
|
|
209
|
+
function hasOrganizationModelFeatureKey(organizationModel, key) {
|
|
210
|
+
if (!organizationModel) {
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
return Object.prototype.hasOwnProperty.call(organizationModel.features.enabled, key);
|
|
214
|
+
}
|
|
215
|
+
function findSurfaceByPath(organizationModel, path) {
|
|
216
|
+
if (!organizationModel) {
|
|
217
|
+
return void 0;
|
|
218
|
+
}
|
|
219
|
+
const normalizedPath = normalizeRoutePath(path);
|
|
220
|
+
return organizationModel.navigation.surfaces.find(
|
|
221
|
+
(surface) => normalizeRoutePath(surface.path) === normalizedPath
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
function findSurfaceById(organizationModel, id) {
|
|
225
|
+
if (!organizationModel) {
|
|
226
|
+
return void 0;
|
|
227
|
+
}
|
|
228
|
+
return organizationModel.navigation.surfaces.find((surface) => surface.id === id);
|
|
229
|
+
}
|
|
230
|
+
function getOrganizationModelFeatureLabel(organizationModel, key) {
|
|
231
|
+
if (!organizationModel || !key) {
|
|
232
|
+
return void 0;
|
|
233
|
+
}
|
|
234
|
+
if (!hasOrganizationModelFeatureKey(organizationModel, key)) {
|
|
235
|
+
return void 0;
|
|
236
|
+
}
|
|
237
|
+
return organizationModel.features.labels[key];
|
|
238
|
+
}
|
|
239
|
+
function isOrganizationModelFeatureEnabled(organizationModel, key) {
|
|
240
|
+
if (!organizationModel) {
|
|
241
|
+
return void 0;
|
|
242
|
+
}
|
|
243
|
+
if (!hasOrganizationModelFeatureKey(organizationModel, key)) {
|
|
244
|
+
return void 0;
|
|
245
|
+
}
|
|
246
|
+
return organizationModel.features.enabled[key];
|
|
247
|
+
}
|
|
248
|
+
function resolveOrganizationGraphSurface(features, organizationModel) {
|
|
249
|
+
for (const feature of features) {
|
|
250
|
+
const graphBridge = feature.organizationGraph;
|
|
251
|
+
if (!graphBridge) {
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
const surface = findSurfaceById(organizationModel, graphBridge.surfaceId);
|
|
255
|
+
return {
|
|
256
|
+
available: Boolean(surface),
|
|
257
|
+
surfaceId: graphBridge.surfaceId,
|
|
258
|
+
surfacePath: surface?.path,
|
|
259
|
+
surfaceType: surface?.surfaceType,
|
|
260
|
+
featureKey: surface?.featureKey
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
return {
|
|
264
|
+
available: false
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
function resolveNavLink(link, organizationModel) {
|
|
268
|
+
const matchedSurface = findSurfaceByPath(organizationModel, link.link);
|
|
269
|
+
const featureLabel = getOrganizationModelFeatureLabel(organizationModel, link.featureKey);
|
|
270
|
+
return {
|
|
271
|
+
...link,
|
|
272
|
+
label: matchedSurface?.label ?? featureLabel ?? link.label,
|
|
273
|
+
link: matchedSurface?.path ?? link.link,
|
|
274
|
+
links: link.links?.map((nestedLink) => resolveNavLink(nestedLink, organizationModel))
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
function resolveFeatureModule(feature, organizationModel) {
|
|
278
|
+
if (!feature.navEntry) {
|
|
279
|
+
return feature;
|
|
280
|
+
}
|
|
281
|
+
const matchedSurface = feature.navEntry.link ? findSurfaceByPath(organizationModel, feature.navEntry.link) : void 0;
|
|
282
|
+
const featureLabel = getOrganizationModelFeatureLabel(organizationModel, feature.navEntry.featureKey);
|
|
283
|
+
return {
|
|
284
|
+
...feature,
|
|
285
|
+
navEntry: {
|
|
286
|
+
...feature.navEntry,
|
|
287
|
+
label: matchedSurface?.label ?? featureLabel ?? feature.navEntry.label,
|
|
288
|
+
link: matchedSurface?.path ?? feature.navEntry.link,
|
|
289
|
+
links: feature.navEntry.links?.map((link) => resolveNavLink(link, organizationModel))
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
}
|
|
201
293
|
function filterNavLinks(links, disabledSubsectionPaths, isFeatureEnabled) {
|
|
202
294
|
return links.flatMap((link) => {
|
|
203
295
|
if (link.featureKey && !isFeatureEnabled(link.featureKey)) {
|
|
@@ -282,6 +374,7 @@ function resolveNavRoute(features, currentPath, disabledSubsectionPaths, isFeatu
|
|
|
282
374
|
}
|
|
283
375
|
function ElevasisFeaturesProvider({
|
|
284
376
|
features,
|
|
377
|
+
organizationModel,
|
|
285
378
|
timeRange,
|
|
286
379
|
operationsApiUrl,
|
|
287
380
|
operationsSSEManager,
|
|
@@ -289,22 +382,49 @@ function ElevasisFeaturesProvider({
|
|
|
289
382
|
children
|
|
290
383
|
}) {
|
|
291
384
|
const { hasFeature } = useFeatureAccess();
|
|
385
|
+
const hasResolvedFeature = useCallback(
|
|
386
|
+
(key) => {
|
|
387
|
+
if (!hasFeature(key)) {
|
|
388
|
+
return false;
|
|
389
|
+
}
|
|
390
|
+
const organizationModelFeatureEnabled = isOrganizationModelFeatureEnabled(
|
|
391
|
+
organizationModel,
|
|
392
|
+
key
|
|
393
|
+
);
|
|
394
|
+
if (organizationModelFeatureEnabled === void 0) {
|
|
395
|
+
return true;
|
|
396
|
+
}
|
|
397
|
+
return organizationModelFeatureEnabled;
|
|
398
|
+
},
|
|
399
|
+
[hasFeature, organizationModel]
|
|
400
|
+
);
|
|
292
401
|
const normalizedDisabledSubsectionPaths = useMemo(
|
|
293
402
|
() => disabledSubsectionPaths.map((path) => normalizeRoutePath(path)),
|
|
294
403
|
[disabledSubsectionPaths]
|
|
295
404
|
);
|
|
296
|
-
const enabledFeatures = useMemo(
|
|
405
|
+
const enabledFeatures = useMemo(
|
|
406
|
+
() => getEnabledFeatures(features, hasResolvedFeature).map((feature) => resolveFeatureModule(feature, organizationModel)),
|
|
407
|
+
[features, hasResolvedFeature, organizationModel]
|
|
408
|
+
);
|
|
409
|
+
const allFeatures = useMemo(
|
|
410
|
+
() => features.map((feature) => resolveFeatureModule(feature, organizationModel)),
|
|
411
|
+
[features, organizationModel]
|
|
412
|
+
);
|
|
297
413
|
const navItems = useMemo(
|
|
298
|
-
() => getNavItems(enabledFeatures, normalizedDisabledSubsectionPaths,
|
|
299
|
-
[enabledFeatures, normalizedDisabledSubsectionPaths,
|
|
414
|
+
() => getNavItems(enabledFeatures, normalizedDisabledSubsectionPaths, hasResolvedFeature),
|
|
415
|
+
[enabledFeatures, normalizedDisabledSubsectionPaths, hasResolvedFeature]
|
|
416
|
+
);
|
|
417
|
+
const organizationGraph = useMemo(
|
|
418
|
+
() => resolveOrganizationGraphSurface(enabledFeatures, organizationModel),
|
|
419
|
+
[enabledFeatures, organizationModel]
|
|
300
420
|
);
|
|
301
421
|
const getFeature = useCallback(
|
|
302
|
-
(key) =>
|
|
303
|
-
[
|
|
422
|
+
(key) => allFeatures.find((feature) => feature.key === key),
|
|
423
|
+
[allFeatures]
|
|
304
424
|
);
|
|
305
425
|
const isFeatureEnabled = useCallback(
|
|
306
|
-
(key) =>
|
|
307
|
-
[
|
|
426
|
+
(key) => hasResolvedFeature(key),
|
|
427
|
+
[hasResolvedFeature]
|
|
308
428
|
);
|
|
309
429
|
const resolveNavRouteByPath = useCallback(
|
|
310
430
|
(path) => resolveNavRoute(enabledFeatures, path, normalizedDisabledSubsectionPaths, isFeatureEnabled),
|
|
@@ -314,7 +434,9 @@ function ElevasisFeaturesProvider({
|
|
|
314
434
|
() => ({
|
|
315
435
|
navItems,
|
|
316
436
|
enabledFeatures,
|
|
317
|
-
allFeatures
|
|
437
|
+
allFeatures,
|
|
438
|
+
organizationGraph,
|
|
439
|
+
organizationModel,
|
|
318
440
|
timeRange,
|
|
319
441
|
operationsApiUrl,
|
|
320
442
|
operationsSSEManager,
|
|
@@ -326,7 +448,9 @@ function ElevasisFeaturesProvider({
|
|
|
326
448
|
[
|
|
327
449
|
navItems,
|
|
328
450
|
enabledFeatures,
|
|
329
|
-
|
|
451
|
+
allFeatures,
|
|
452
|
+
organizationGraph,
|
|
453
|
+
organizationModel,
|
|
330
454
|
timeRange,
|
|
331
455
|
operationsApiUrl,
|
|
332
456
|
operationsSSEManager,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCyberColors, CyberLegendItem, CyberAreaChart } from './chunk-KFICYU6S.js';
|
|
2
|
-
import { useResourcesHealth } from './chunk-
|
|
2
|
+
import { useResourcesHealth } from './chunk-2XWEOJSX.js';
|
|
3
3
|
import { getTimeRangeDates, formatBucketTime } from './chunk-LXHZYSMQ.js';
|
|
4
4
|
import { CardHeader, EmptyState } from './chunk-Y3D3WFJG.js';
|
|
5
5
|
import { Paper, Center, Loader, Group } from '@mantine/core';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PRESETS, getPreset, generateShades, mantineThemeOverride, createCssVariablesResolver, PresetsProvider } from './chunk-
|
|
1
|
+
import { PRESETS, getPreset, generateShades, mantineThemeOverride, createCssVariablesResolver, PresetsProvider } from './chunk-47YILFON.js';
|
|
2
2
|
import { AppBackground } from './chunk-CYXZHBP4.js';
|
|
3
|
-
import { ElevasisCoreProvider } from './chunk-
|
|
3
|
+
import { ElevasisCoreProvider } from './chunk-ISHNN42L.js';
|
|
4
4
|
import { ElevasisLoader } from './chunk-Y3D3WFJG.js';
|
|
5
5
|
import { AppearanceProvider } from './chunk-QJ2KCHKX.js';
|
|
6
6
|
import { getErrorInfo, formatErrorMessage, getErrorTitle } from './chunk-IOKL7BKE.js';
|