@grafana/scenes 5.36.4 → 6.0.0--canary.979.12745482012.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/esm/components/SceneApp/SceneApp.js +6 -6
- package/dist/esm/components/SceneApp/SceneApp.js.map +1 -1
- package/dist/esm/components/SceneApp/SceneAppPage.js +30 -45
- package/dist/esm/components/SceneApp/SceneAppPage.js.map +1 -1
- package/dist/esm/components/SceneApp/SceneAppPageView.js +10 -5
- package/dist/esm/components/SceneApp/SceneAppPageView.js.map +1 -1
- package/dist/esm/components/SceneApp/utils.js +20 -5
- package/dist/esm/components/SceneApp/utils.js.map +1 -1
- package/dist/esm/utils/utils.js.map +1 -1
- package/dist/index.d.ts +125 -129
- package/dist/index.js +62 -54
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
import * as _grafana_data from '@grafana/data';
|
2
|
-
import { BusEventWithPayload, PanelData, BusEvent, BusEventType, BusEventHandler, TimeRange, DataQueryRequest, DataSourceGetTagKeysOptions, DataSourceGetTagValuesOptions, DataTransformContext, DataFrame, UrlQueryMap, PanelPlugin,
|
2
|
+
import { BusEventWithPayload, PanelData, BusEvent, BusEventType, BusEventHandler, TimeRange, DataQueryRequest, DataSourceGetTagKeysOptions, DataSourceGetTagValuesOptions, DataTransformContext, DataFrame, EventBus, IconName, PageLayoutType, UrlQueryMap, PanelPlugin, DataQuery as DataQuery$1, DataSourceApi, Registry, RegistryItem, ScopedVars, AdHocVariableFilter, SelectableValue, MetricFindValue, GetTagResponse, VariableRefresh as VariableRefresh$1, VariableSort, EventFilterOptions, AnnotationEvent, AnnotationQuery, DataTransformerConfig, PanelMenuItem, FieldConfigSource, PanelModel, AbsoluteTimeRange, InterpolateFunction, FieldConfig, FieldType, FieldValueMatcherConfig, ScopedVar, RawTimeRange } from '@grafana/data';
|
3
3
|
import * as React$1 from 'react';
|
4
|
-
import React__default, {
|
4
|
+
import React__default, { ComponentType, CSSProperties } from 'react';
|
5
5
|
import * as rxjs from 'rxjs';
|
6
6
|
import { Observable, Unsubscribable, MonoTypeOperatorFunction, Subscription, ReplaySubject } from 'rxjs';
|
7
7
|
import * as _grafana_schema from '@grafana/schema';
|
8
8
|
import { VariableType, VariableHide, TimeZone, DataTopic, DataQuery, DataSourceRef, VariableRefresh, LoadingState, DashboardCursorSync, MatcherConfig, TableFieldOptions } from '@grafana/schema';
|
9
9
|
import { LocationService, VariableInterpolation } from '@grafana/runtime';
|
10
10
|
import { Location } from 'history';
|
11
|
-
import { PanelContext, IconName } from '@grafana/ui';
|
11
|
+
import { PanelContext, IconName as IconName$1 } from '@grafana/ui';
|
12
12
|
import ReactGridLayout from 'react-grid-layout';
|
13
|
-
import { RouteComponentProps } from 'react-router-dom';
|
14
13
|
import { Options, FieldConfig as FieldConfig$1 } from '@grafana/schema/dist/esm/raw/composable/barchart/panelcfg/x/BarChartPanelCfg_types.gen';
|
15
14
|
import { Options as Options$1 } from '@grafana/schema/dist/esm/raw/composable/bargauge/panelcfg/x/BarGaugePanelCfg_types.gen';
|
16
15
|
import { Options as Options$2 } from '@grafana/schema/dist/esm/raw/composable/datagrid/panelcfg/x/DatagridPanelCfg_types.gen';
|
@@ -352,28 +351,6 @@ interface SceneUrlSyncOptions {
|
|
352
351
|
createBrowserHistorySteps?: boolean;
|
353
352
|
}
|
354
353
|
|
355
|
-
/**
|
356
|
-
*
|
357
|
-
* @param path Url to append query params to
|
358
|
-
* @param searchObject Query params of the URL
|
359
|
-
* @param preserveParams Query params to preserve
|
360
|
-
* @returns Url with query params
|
361
|
-
*/
|
362
|
-
declare function getUrlWithAppState(path: string, searchObject: UrlQueryMap, preserveParams?: string[]): string;
|
363
|
-
|
364
|
-
interface RuntimePanelPluginOptions {
|
365
|
-
/**
|
366
|
-
* Please specify a pluginId that is unlikely to collide with other plugins.
|
367
|
-
*/
|
368
|
-
pluginId: string;
|
369
|
-
plugin: PanelPlugin;
|
370
|
-
}
|
371
|
-
/**
|
372
|
-
* Provides a way to register runtime panel plugins.
|
373
|
-
* Please use a pluginId that is unlikely to collide with other plugins.
|
374
|
-
*/
|
375
|
-
declare function registerRuntimePanelPlugin({ pluginId, plugin }: RuntimePanelPluginOptions): void;
|
376
|
-
|
377
354
|
declare abstract class SceneObjectBase<TState extends SceneObjectState = SceneObjectState> implements SceneObject<TState> {
|
378
355
|
private _isActive;
|
379
356
|
private _state;
|
@@ -470,6 +447,124 @@ declare abstract class SceneObjectBase<TState extends SceneObjectState = SceneOb
|
|
470
447
|
*/
|
471
448
|
declare function useSceneObjectState<TState extends SceneObjectState>(model: SceneObject<TState>, options?: UseStateHookOptions): TState;
|
472
449
|
|
450
|
+
interface EmbeddedSceneState extends SceneObjectState {
|
451
|
+
/**
|
452
|
+
* The main content of the scene (usually a SceneFlexLayout)
|
453
|
+
*/
|
454
|
+
body: SceneObject;
|
455
|
+
/**
|
456
|
+
* Top row of variable selectors, filters, time pickers and custom actions.
|
457
|
+
*/
|
458
|
+
controls?: SceneObject[];
|
459
|
+
/**
|
460
|
+
* For interoperability (used from EmbeddedSceneWithContext)
|
461
|
+
*/
|
462
|
+
context?: SceneObject;
|
463
|
+
}
|
464
|
+
declare class EmbeddedScene extends SceneObjectBase<EmbeddedSceneState> {
|
465
|
+
static Component: typeof EmbeddedSceneRenderer;
|
466
|
+
constructor(state: EmbeddedSceneState);
|
467
|
+
}
|
468
|
+
declare function EmbeddedSceneRenderer({ model }: SceneComponentProps<EmbeddedScene>): React__default.JSX.Element;
|
469
|
+
|
470
|
+
interface SceneRouteMatch<Params extends {
|
471
|
+
[K in keyof Params]?: string;
|
472
|
+
} = {}> {
|
473
|
+
params: Params;
|
474
|
+
isExact: boolean;
|
475
|
+
path: string;
|
476
|
+
url: string;
|
477
|
+
}
|
478
|
+
interface SceneAppState extends SceneObjectState {
|
479
|
+
pages: SceneAppPageLike[];
|
480
|
+
name?: string;
|
481
|
+
urlSyncOptions?: SceneUrlSyncOptions;
|
482
|
+
}
|
483
|
+
interface SceneAppRoute {
|
484
|
+
path: string;
|
485
|
+
page?: SceneAppPageLike;
|
486
|
+
drilldown?: SceneAppDrilldownView;
|
487
|
+
}
|
488
|
+
interface SceneAppPageState extends SceneObjectState {
|
489
|
+
/** Page title or tab label */
|
490
|
+
title: string;
|
491
|
+
/** Page subTitle */
|
492
|
+
subTitle?: string | React.ReactNode;
|
493
|
+
/**
|
494
|
+
* Customize title rendering.
|
495
|
+
* Please return an unstyled h1 tag here + any additional elements you need.
|
496
|
+
**/
|
497
|
+
renderTitle?: (title: string) => React.ReactNode;
|
498
|
+
/** For an image before title */
|
499
|
+
titleImg?: string;
|
500
|
+
/** For an icon before title or tab label */
|
501
|
+
titleIcon?: IconName;
|
502
|
+
/** For a tab label suffix */
|
503
|
+
tabSuffix?: ComponentType<{
|
504
|
+
className?: string;
|
505
|
+
}>;
|
506
|
+
url: string;
|
507
|
+
routePath?: string;
|
508
|
+
/** Array of scene object to be rendered at the top right of the page, inline with the page title */
|
509
|
+
controls?: SceneObject[];
|
510
|
+
hideFromBreadcrumbs?: boolean;
|
511
|
+
tabs?: SceneAppPageLike[];
|
512
|
+
getScene?: (routeMatch: SceneRouteMatch) => EmbeddedScene;
|
513
|
+
drilldowns?: SceneAppDrilldownView[];
|
514
|
+
getParentPage?: () => SceneAppPageLike;
|
515
|
+
preserveUrlKeys?: string[];
|
516
|
+
/**
|
517
|
+
* The current initialized scene, this is set by the framework after scene url initialization
|
518
|
+
**/
|
519
|
+
initializedScene?: SceneObject;
|
520
|
+
/**
|
521
|
+
* Function that returns a fallback scene app page,
|
522
|
+
* to be rendered when url does not match current page exactly or any of tabs or drilldowns.
|
523
|
+
*/
|
524
|
+
getFallbackPage?: () => SceneAppPageLike;
|
525
|
+
layout?: PageLayoutType;
|
526
|
+
}
|
527
|
+
interface SceneAppPageLike extends SceneObject<SceneAppPageState>, DataRequestEnricher {
|
528
|
+
initializeScene(scene: SceneObject): void;
|
529
|
+
/**
|
530
|
+
* @internal. Please don't call this from plugin code.
|
531
|
+
* Will call the state.getScene function with the current routeMatch and will cache the resulting Scene using the routeMatch.url as key.
|
532
|
+
*/
|
533
|
+
getScene(routeMatch: SceneRouteMatch): EmbeddedScene;
|
534
|
+
/**
|
535
|
+
* @internal. Please don't call this from plugin code.
|
536
|
+
* Get drilldown scene. Will call the drilldown.getPage function with the current routeMatch and will cache the resulting page using the routeMatch.url as key.
|
537
|
+
*/
|
538
|
+
getDrilldownPage(drilldown: SceneAppDrilldownView, routeMatch: SceneRouteMatch): SceneAppPageLike;
|
539
|
+
}
|
540
|
+
interface SceneAppDrilldownView {
|
541
|
+
routePath: string;
|
542
|
+
defaultRoute?: boolean;
|
543
|
+
getPage: (routeMatch: SceneRouteMatch<any>, parent: SceneAppPageLike) => SceneAppPageLike;
|
544
|
+
}
|
545
|
+
|
546
|
+
/**
|
547
|
+
*
|
548
|
+
* @param path Url to append query params to
|
549
|
+
* @param searchObject Query params of the URL
|
550
|
+
* @param preserveParams Query params to preserve
|
551
|
+
* @returns Url with query params
|
552
|
+
*/
|
553
|
+
declare function getUrlWithAppState(path: string, searchObject: UrlQueryMap, preserveParams?: string[]): string;
|
554
|
+
|
555
|
+
interface RuntimePanelPluginOptions {
|
556
|
+
/**
|
557
|
+
* Please specify a pluginId that is unlikely to collide with other plugins.
|
558
|
+
*/
|
559
|
+
pluginId: string;
|
560
|
+
plugin: PanelPlugin;
|
561
|
+
}
|
562
|
+
/**
|
563
|
+
* Provides a way to register runtime panel plugins.
|
564
|
+
* Please use a pluginId that is unlikely to collide with other plugins.
|
565
|
+
*/
|
566
|
+
declare function registerRuntimePanelPlugin({ pluginId, plugin }: RuntimePanelPluginOptions): void;
|
567
|
+
|
473
568
|
declare function cloneSceneObjectState<TState extends SceneObjectState>(sceneState: TState, withState?: Partial<TState>): TState;
|
474
569
|
|
475
570
|
declare abstract class RuntimeDataSource<TQuery extends DataQuery$1 = DataQuery$1> extends DataSourceApi<TQuery> {
|
@@ -1732,26 +1827,6 @@ interface UrlSyncContextProviderProps extends SceneUrlSyncOptions {
|
|
1732
1827
|
*/
|
1733
1828
|
declare function UrlSyncContextProvider({ children, scene, updateUrlOnInit, createBrowserHistorySteps, }: UrlSyncContextProviderProps): React$1.ReactNode;
|
1734
1829
|
|
1735
|
-
interface EmbeddedSceneState extends SceneObjectState {
|
1736
|
-
/**
|
1737
|
-
* The main content of the scene (usually a SceneFlexLayout)
|
1738
|
-
*/
|
1739
|
-
body: SceneObject;
|
1740
|
-
/**
|
1741
|
-
* Top row of variable selectors, filters, time pickers and custom actions.
|
1742
|
-
*/
|
1743
|
-
controls?: SceneObject[];
|
1744
|
-
/**
|
1745
|
-
* For interoperability (used from EmbeddedSceneWithContext)
|
1746
|
-
*/
|
1747
|
-
context?: SceneObject;
|
1748
|
-
}
|
1749
|
-
declare class EmbeddedScene extends SceneObjectBase<EmbeddedSceneState> {
|
1750
|
-
static Component: typeof EmbeddedSceneRenderer;
|
1751
|
-
constructor(state: EmbeddedSceneState);
|
1752
|
-
}
|
1753
|
-
declare function EmbeddedSceneRenderer({ model }: SceneComponentProps<EmbeddedScene>): React__default.JSX.Element;
|
1754
|
-
|
1755
1830
|
declare function VizPanelRenderer({ model }: SceneComponentProps<VizPanel>): React__default.JSX.Element;
|
1756
1831
|
|
1757
1832
|
interface VizPanelMenuState extends SceneObjectState {
|
@@ -1921,7 +1996,7 @@ declare class SceneCanvasText extends SceneObjectBase<SceneCanvasTextState> {
|
|
1921
1996
|
}
|
1922
1997
|
|
1923
1998
|
interface ToolbarButtonState extends SceneObjectState {
|
1924
|
-
icon: IconName;
|
1999
|
+
icon: IconName$1;
|
1925
2000
|
onClick: () => void;
|
1926
2001
|
}
|
1927
2002
|
declare class SceneToolbarButton extends SceneObjectBase<ToolbarButtonState> {
|
@@ -2277,82 +2352,6 @@ declare class SplitLayout extends SceneObjectBase<SplitLayoutState> {
|
|
2277
2352
|
isDraggable(): boolean;
|
2278
2353
|
}
|
2279
2354
|
|
2280
|
-
interface SceneRouteMatch<Params extends {
|
2281
|
-
[K in keyof Params]?: string;
|
2282
|
-
} = {}> {
|
2283
|
-
params: Params;
|
2284
|
-
isExact: boolean;
|
2285
|
-
path: string;
|
2286
|
-
url: string;
|
2287
|
-
}
|
2288
|
-
interface SceneAppState extends SceneObjectState {
|
2289
|
-
pages: SceneAppPageLike[];
|
2290
|
-
name?: string;
|
2291
|
-
urlSyncOptions?: SceneUrlSyncOptions;
|
2292
|
-
}
|
2293
|
-
interface SceneAppRoute {
|
2294
|
-
path: string;
|
2295
|
-
page?: SceneAppPageLike;
|
2296
|
-
drilldown?: SceneAppDrilldownView;
|
2297
|
-
}
|
2298
|
-
interface SceneAppPageState extends SceneObjectState {
|
2299
|
-
/** Page title or tab label */
|
2300
|
-
title: string;
|
2301
|
-
/** Page subTitle */
|
2302
|
-
subTitle?: string | React.ReactNode;
|
2303
|
-
/**
|
2304
|
-
* Customize title rendering.
|
2305
|
-
* Please return an unstyled h1 tag here + any additional elements you need.
|
2306
|
-
**/
|
2307
|
-
renderTitle?: (title: string) => React.ReactNode;
|
2308
|
-
/** For an image before title */
|
2309
|
-
titleImg?: string;
|
2310
|
-
/** For an icon before title or tab label */
|
2311
|
-
titleIcon?: IconName$1;
|
2312
|
-
/** For a tab label suffix */
|
2313
|
-
tabSuffix?: ComponentType<{
|
2314
|
-
className?: string;
|
2315
|
-
}>;
|
2316
|
-
url: string;
|
2317
|
-
routePath?: string;
|
2318
|
-
/** Array of scene object to be rendered at the top right of the page, inline with the page title */
|
2319
|
-
controls?: SceneObject[];
|
2320
|
-
hideFromBreadcrumbs?: boolean;
|
2321
|
-
tabs?: SceneAppPageLike[];
|
2322
|
-
getScene?: (routeMatch: SceneRouteMatch) => EmbeddedScene;
|
2323
|
-
drilldowns?: SceneAppDrilldownView[];
|
2324
|
-
getParentPage?: () => SceneAppPageLike;
|
2325
|
-
preserveUrlKeys?: string[];
|
2326
|
-
/**
|
2327
|
-
* The current initialized scene, this is set by the framework after scene url initialization
|
2328
|
-
**/
|
2329
|
-
initializedScene?: SceneObject;
|
2330
|
-
/**
|
2331
|
-
* Function that returns a fallback scene app page,
|
2332
|
-
* to be rendered when url does not match current page exactly or any of tabs or drilldowns.
|
2333
|
-
*/
|
2334
|
-
getFallbackPage?: () => SceneAppPageLike;
|
2335
|
-
layout?: PageLayoutType;
|
2336
|
-
}
|
2337
|
-
interface SceneAppPageLike extends SceneObject<SceneAppPageState>, DataRequestEnricher {
|
2338
|
-
initializeScene(scene: SceneObject): void;
|
2339
|
-
/**
|
2340
|
-
* @internal. Please don't call this from plugin code.
|
2341
|
-
* Will call the state.getScene function with the current routeMatch and will cache the resulting Scene using the routeMatch.url as key.
|
2342
|
-
*/
|
2343
|
-
getScene(routeMatch: SceneRouteMatch): EmbeddedScene;
|
2344
|
-
/**
|
2345
|
-
* @internal. Please don't call this from plugin code.
|
2346
|
-
* Get drilldown scene. Will call the drilldown.getPage function with the current routeMatch and will cache the resulting page using the routeMatch.url as key.
|
2347
|
-
*/
|
2348
|
-
getDrilldownPage(drilldown: SceneAppDrilldownView, routeMatch: SceneRouteMatch): SceneAppPageLike;
|
2349
|
-
}
|
2350
|
-
interface SceneAppDrilldownView {
|
2351
|
-
routePath: string;
|
2352
|
-
defaultRoute?: boolean;
|
2353
|
-
getPage: (routeMatch: SceneRouteMatch<any>, parent: SceneAppPageLike) => SceneAppPageLike;
|
2354
|
-
}
|
2355
|
-
|
2356
2355
|
/**
|
2357
2356
|
* Responsible for top level pages routing
|
2358
2357
|
*/
|
@@ -2380,10 +2379,7 @@ declare class SceneAppPage extends SceneObjectBase<SceneAppPageState> implements
|
|
2380
2379
|
getDrilldownPage(drilldown: SceneAppDrilldownView, routeMatch: SceneRouteMatch<{}>): SceneAppPageLike;
|
2381
2380
|
enrichDataRequest(source: SceneObject): Partial<_grafana_data.DataQueryRequest<_grafana_data.DataQuery>> | null;
|
2382
2381
|
}
|
2383
|
-
|
2384
|
-
routeProps: RouteComponentProps;
|
2385
|
-
}
|
2386
|
-
declare function SceneAppPageRenderer({ model, routeProps }: SceneAppPageRendererProps): React__default.JSX.Element;
|
2382
|
+
declare function SceneAppPageRenderer({ model }: SceneComponentProps<SceneAppPage>): React__default.JSX.Element;
|
2387
2383
|
|
2388
2384
|
interface SceneReactObjectState<TProps = {}> extends SceneObjectState {
|
2389
2385
|
/**
|
@@ -2403,7 +2399,7 @@ interface SceneReactObjectState<TProps = {}> extends SceneObjectState {
|
|
2403
2399
|
* A utility object that can be used to render any React component or ReactNode
|
2404
2400
|
*/
|
2405
2401
|
declare class SceneReactObject<TProps = {}> extends SceneObjectBase<SceneReactObjectState<TProps>> {
|
2406
|
-
static Component: ({ model }: SceneComponentProps<SceneReactObject>) => string | number | true |
|
2402
|
+
static Component: ({ model }: SceneComponentProps<SceneReactObject>) => string | number | true | React__default.JSX.Element | Iterable<React__default.ReactNode> | null;
|
2407
2403
|
}
|
2408
2404
|
|
2409
2405
|
type StandardFieldConfigInterface<T, C, Prefix extends string> = {
|
@@ -2747,7 +2743,7 @@ interface ControlsLabelProps {
|
|
2747
2743
|
description?: string;
|
2748
2744
|
isLoading?: boolean;
|
2749
2745
|
error?: string;
|
2750
|
-
icon?: IconName
|
2746
|
+
icon?: IconName;
|
2751
2747
|
layout?: ControlsLayout;
|
2752
2748
|
onCancel?: () => void;
|
2753
2749
|
onRemove?: () => void;
|
package/dist/index.js
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var React = require('react');
|
6
5
|
var reactRouterDom = require('react-router-dom');
|
7
6
|
var data = require('@grafana/data');
|
8
7
|
var runtime = require('@grafana/runtime');
|
8
|
+
var React = require('react');
|
9
9
|
var rxjs = require('rxjs');
|
10
10
|
var uuid = require('uuid');
|
11
11
|
var lodash = require('lodash');
|
@@ -72,8 +72,24 @@ function getUrlWithAppState(path, searchObject, preserveParams) {
|
|
72
72
|
}
|
73
73
|
return data.urlUtil.renderUrl(data.locationUtil.assureBaseUrl(path), paramsCopy);
|
74
74
|
}
|
75
|
-
function
|
76
|
-
|
75
|
+
function useSceneRouteMatch(path) {
|
76
|
+
const params = reactRouterDom.useParams();
|
77
|
+
const location = reactRouterDom.useLocation();
|
78
|
+
const isExact = reactRouterDom.matchPath(
|
79
|
+
{
|
80
|
+
path,
|
81
|
+
caseSensitive: false,
|
82
|
+
end: true
|
83
|
+
},
|
84
|
+
location.pathname
|
85
|
+
);
|
86
|
+
const match = {
|
87
|
+
params,
|
88
|
+
isExact: isExact !== null,
|
89
|
+
path: location.pathname,
|
90
|
+
url: location.pathname
|
91
|
+
};
|
92
|
+
return match;
|
77
93
|
}
|
78
94
|
|
79
95
|
var __defProp$Q = Object.defineProperty;
|
@@ -12744,11 +12760,12 @@ SceneApp.Component = ({ model }) => {
|
|
12744
12760
|
const { pages } = model.useState();
|
12745
12761
|
return /* @__PURE__ */ React__default["default"].createElement(SceneAppContext.Provider, {
|
12746
12762
|
value: model
|
12747
|
-
}, /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.
|
12763
|
+
}, /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Routes, null, pages.map((page) => /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
12748
12764
|
key: page.state.url,
|
12749
|
-
|
12750
|
-
|
12751
|
-
|
12765
|
+
path: page.state.routePath,
|
12766
|
+
element: /* @__PURE__ */ React__default["default"].createElement(page.Component, {
|
12767
|
+
model: page
|
12768
|
+
})
|
12752
12769
|
}))));
|
12753
12770
|
};
|
12754
12771
|
const SceneAppContext = React.createContext(null);
|
@@ -13001,11 +13018,12 @@ function getStyles(theme) {
|
|
13001
13018
|
};
|
13002
13019
|
}
|
13003
13020
|
|
13004
|
-
function SceneAppPageView({ page
|
13021
|
+
function SceneAppPageView({ page }) {
|
13022
|
+
const routeMatch = useSceneRouteMatch(page.state.url);
|
13005
13023
|
const containerPage = getParentPageIfTab(page);
|
13006
13024
|
const containerState = containerPage.useState();
|
13007
13025
|
const params = useAppQueryParams();
|
13008
|
-
const scene = page.getScene(
|
13026
|
+
const scene = page.getScene(routeMatch);
|
13009
13027
|
const appContext = React.useContext(SceneAppContext);
|
13010
13028
|
const isInitialized = containerState.initializedScene === scene;
|
13011
13029
|
const { layout } = page.state;
|
@@ -13090,8 +13108,12 @@ function getParentBreadcrumbs(parent, params, searchObject) {
|
|
13090
13108
|
}
|
13091
13109
|
return void 0;
|
13092
13110
|
}
|
13093
|
-
function SceneAppDrilldownViewRender({ drilldown, parent
|
13094
|
-
|
13111
|
+
function SceneAppDrilldownViewRender({ drilldown, parent }) {
|
13112
|
+
const routeMatch = useSceneRouteMatch(drilldown.routePath);
|
13113
|
+
const page = parent.getDrilldownPage(drilldown, routeMatch);
|
13114
|
+
return /* @__PURE__ */ React__default["default"].createElement(page.Component, {
|
13115
|
+
model: page
|
13116
|
+
});
|
13095
13117
|
}
|
13096
13118
|
|
13097
13119
|
class SceneAppPage extends SceneObjectBase {
|
@@ -13139,42 +13161,40 @@ class SceneAppPage extends SceneObjectBase {
|
|
13139
13161
|
}
|
13140
13162
|
}
|
13141
13163
|
SceneAppPage.Component = SceneAppPageRenderer;
|
13142
|
-
function SceneAppPageRenderer({ model
|
13143
|
-
var _a, _b;
|
13164
|
+
function SceneAppPageRenderer({ model }) {
|
13144
13165
|
const { tabs, drilldowns } = model.useState();
|
13145
13166
|
const routes = [];
|
13167
|
+
routes.push(getFallbackRoute(model));
|
13146
13168
|
if (tabs && tabs.length > 0) {
|
13147
13169
|
for (let tabIndex = 0; tabIndex < tabs.length; tabIndex++) {
|
13148
13170
|
const tab = tabs[tabIndex];
|
13149
13171
|
if (tabIndex === 0) {
|
13150
|
-
routes.push(
|
13151
|
-
|
13152
|
-
|
13153
|
-
|
13154
|
-
|
13155
|
-
render: (props) => renderSceneComponentWithRouteProps(tab, props)
|
13172
|
+
routes.push(/* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
13173
|
+
key: model.state.routePath,
|
13174
|
+
path: "",
|
13175
|
+
element: /* @__PURE__ */ React__default["default"].createElement(tab.Component, {
|
13176
|
+
model: tab
|
13156
13177
|
})
|
13157
|
-
);
|
13178
|
+
}));
|
13158
13179
|
}
|
13159
13180
|
routes.push(
|
13160
13181
|
/* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
13161
|
-
exact: true,
|
13162
13182
|
key: tab.state.url,
|
13163
|
-
path:
|
13164
|
-
|
13183
|
+
path: tab.state.routePath,
|
13184
|
+
element: /* @__PURE__ */ React__default["default"].createElement(tab.Component, {
|
13185
|
+
model: tab
|
13186
|
+
})
|
13165
13187
|
})
|
13166
13188
|
);
|
13167
13189
|
if (tab.state.drilldowns) {
|
13168
13190
|
for (const drilldown of tab.state.drilldowns) {
|
13169
13191
|
routes.push(
|
13170
13192
|
/* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
13171
|
-
exact: false,
|
13172
13193
|
key: drilldown.routePath,
|
13173
13194
|
path: drilldown.routePath,
|
13174
|
-
|
13195
|
+
element: /* @__PURE__ */ React__default["default"].createElement(SceneAppDrilldownViewRender, {
|
13175
13196
|
drilldown,
|
13176
|
-
parent: tab
|
13177
|
-
routeProps: props
|
13197
|
+
parent: tab
|
13178
13198
|
})
|
13179
13199
|
})
|
13180
13200
|
);
|
@@ -13187,51 +13207,39 @@ function SceneAppPageRenderer({ model, routeProps }) {
|
|
13187
13207
|
routes.push(
|
13188
13208
|
/* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
13189
13209
|
key: drilldown.routePath,
|
13190
|
-
exact: false,
|
13191
13210
|
path: drilldown.routePath,
|
13192
|
-
|
13211
|
+
Component: () => /* @__PURE__ */ React__default["default"].createElement(SceneAppDrilldownViewRender, {
|
13193
13212
|
drilldown,
|
13194
|
-
parent: model
|
13195
|
-
routeProps: props
|
13213
|
+
parent: model
|
13196
13214
|
})
|
13197
13215
|
})
|
13198
13216
|
);
|
13199
13217
|
}
|
13200
13218
|
}
|
13201
|
-
if (!tabs
|
13202
|
-
|
13203
|
-
|
13204
|
-
|
13205
|
-
|
13219
|
+
if (!tabs) {
|
13220
|
+
routes.push(/* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
13221
|
+
key: "home route",
|
13222
|
+
path: "/",
|
13223
|
+
element: /* @__PURE__ */ React__default["default"].createElement(SceneAppPageView, {
|
13224
|
+
page: model
|
13225
|
+
})
|
13226
|
+
}));
|
13206
13227
|
}
|
13207
|
-
|
13208
|
-
return /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Switch, null, routes);
|
13228
|
+
return /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Routes, null, routes);
|
13209
13229
|
}
|
13210
|
-
function getFallbackRoute(page
|
13230
|
+
function getFallbackRoute(page) {
|
13211
13231
|
return /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
13212
13232
|
key: "fallback route",
|
13213
|
-
|
13233
|
+
path: "*",
|
13234
|
+
Component: () => {
|
13214
13235
|
var _a, _b, _c;
|
13215
13236
|
const fallbackPage = (_c = (_b = (_a = page.state).getFallbackPage) == null ? void 0 : _b.call(_a)) != null ? _c : getDefaultFallbackPage();
|
13216
13237
|
return /* @__PURE__ */ React__default["default"].createElement(SceneAppPageView, {
|
13217
|
-
page: fallbackPage
|
13218
|
-
routeProps
|
13238
|
+
page: fallbackPage
|
13219
13239
|
});
|
13220
13240
|
}
|
13221
13241
|
});
|
13222
13242
|
}
|
13223
|
-
function isCurrentPageRouteMatch(page, match) {
|
13224
|
-
if (!match.isExact) {
|
13225
|
-
return false;
|
13226
|
-
}
|
13227
|
-
if (match.url === page.state.url) {
|
13228
|
-
return true;
|
13229
|
-
}
|
13230
|
-
if (page.parent instanceof SceneAppPage && page.parent.state.tabs[0] === page && page.parent.state.url === match.url) {
|
13231
|
-
return true;
|
13232
|
-
}
|
13233
|
-
return false;
|
13234
|
-
}
|
13235
13243
|
function getDefaultFallbackPage() {
|
13236
13244
|
return new SceneAppPage({
|
13237
13245
|
url: "",
|