@grafana/scenes 6.2.0--canary.1070.13674378560.0 → 6.2.1--canary.990.13570008543.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/esm/components/SceneApp/SceneApp.js +9 -3
- package/dist/esm/components/SceneApp/SceneApp.js.map +1 -1
- package/dist/esm/components/SceneApp/SceneAppPage.js +16 -0
- package/dist/esm/components/SceneApp/SceneAppPage.js.map +1 -1
- package/dist/esm/core/SceneObjectBase.js +0 -7
- package/dist/esm/core/SceneObjectBase.js.map +1 -1
- package/dist/esm/core/SceneScopesBridge.js +111 -0
- package/dist/esm/core/SceneScopesBridge.js.map +1 -0
- package/dist/esm/core/sceneGraph/index.js +3 -2
- package/dist/esm/core/sceneGraph/index.js.map +1 -1
- package/dist/esm/core/sceneGraph/sceneGraph.js +6 -1
- package/dist/esm/core/sceneGraph/sceneGraph.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/querying/SceneQueryRunner.js +33 -8
- package/dist/esm/querying/SceneQueryRunner.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js +10 -4
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js.map +1 -1
- package/dist/esm/variables/groupby/GroupByVariable.js +3 -2
- package/dist/esm/variables/groupby/GroupByVariable.js.map +1 -1
- package/dist/index.d.ts +66 -25
- package/dist/index.js +179 -25
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -468,13 +468,6 @@ class SceneObjectBase {
|
|
|
468
468
|
}
|
|
469
469
|
return this._ref;
|
|
470
470
|
}
|
|
471
|
-
toJSON() {
|
|
472
|
-
return {
|
|
473
|
-
type: Object.getPrototypeOf(this).constructor.name,
|
|
474
|
-
isActive: this.isActive,
|
|
475
|
-
state: this.state
|
|
476
|
-
};
|
|
477
|
-
}
|
|
478
471
|
}
|
|
479
472
|
function useSceneObjectState(model, options) {
|
|
480
473
|
var _a;
|
|
@@ -3240,7 +3233,7 @@ class GroupByVariable extends MultiValueVariable {
|
|
|
3240
3233
|
this.isLazy = true;
|
|
3241
3234
|
this._urlSync = new GroupByVariableUrlSyncHandler(this);
|
|
3242
3235
|
this._getKeys = async (ds) => {
|
|
3243
|
-
var _a, _b, _c;
|
|
3236
|
+
var _a, _b, _c, _d;
|
|
3244
3237
|
const override = await ((_b = (_a = this.state).getTagKeysProvider) == null ? void 0 : _b.call(_a, this, null));
|
|
3245
3238
|
if (override && override.replace) {
|
|
3246
3239
|
return override.values;
|
|
@@ -3257,7 +3250,8 @@ class GroupByVariable extends MultiValueVariable {
|
|
|
3257
3250
|
const response = await ds.getTagKeys(__spreadValues$F({
|
|
3258
3251
|
filters: otherFilters,
|
|
3259
3252
|
queries,
|
|
3260
|
-
timeRange
|
|
3253
|
+
timeRange,
|
|
3254
|
+
scopes: (_d = this._scopesBridge) == null ? void 0 : _d.getValue()
|
|
3261
3255
|
}, getEnrichedFiltersRequest(this)));
|
|
3262
3256
|
if (responseHasError(response)) {
|
|
3263
3257
|
this.setState({ error: response.error.message });
|
|
@@ -5413,9 +5407,13 @@ class AdHocFiltersVariable extends SceneObjectBase {
|
|
|
5413
5407
|
this._scopedVars = { __sceneObject: wrapInSafeSerializableSceneObject(this) };
|
|
5414
5408
|
this._dataSourceSrv = runtime.getDataSourceSrv();
|
|
5415
5409
|
this._urlSync = new AdHocFiltersVariableUrlSyncHandler(this);
|
|
5410
|
+
this._activationHandler = () => {
|
|
5411
|
+
this._scopesBridge = sceneGraph.getScopesBridge(this);
|
|
5412
|
+
};
|
|
5416
5413
|
if (this.state.applyMode === "auto") {
|
|
5417
5414
|
patchGetAdhocFilters(this);
|
|
5418
5415
|
}
|
|
5416
|
+
this.addActivationHandler(this._activationHandler);
|
|
5419
5417
|
}
|
|
5420
5418
|
setState(update) {
|
|
5421
5419
|
let filterExpressionChanged = false;
|
|
@@ -5499,7 +5497,7 @@ class AdHocFiltersVariable extends SceneObjectBase {
|
|
|
5499
5497
|
}
|
|
5500
5498
|
}
|
|
5501
5499
|
async _getKeys(currentKey) {
|
|
5502
|
-
var _a, _b, _c;
|
|
5500
|
+
var _a, _b, _c, _d;
|
|
5503
5501
|
const override = await ((_b = (_a = this.state).getTagKeysProvider) == null ? void 0 : _b.call(_a, this, currentKey));
|
|
5504
5502
|
if (override && override.replace) {
|
|
5505
5503
|
return dataFromResponse(override.values).map(toSelectableValue);
|
|
@@ -5517,7 +5515,8 @@ class AdHocFiltersVariable extends SceneObjectBase {
|
|
|
5517
5515
|
const response = await ds.getTagKeys(__spreadValues$z({
|
|
5518
5516
|
filters: otherFilters,
|
|
5519
5517
|
queries,
|
|
5520
|
-
timeRange
|
|
5518
|
+
timeRange,
|
|
5519
|
+
scopes: (_d = this._scopesBridge) == null ? void 0 : _d.getValue()
|
|
5521
5520
|
}, getEnrichedFiltersRequest(this)));
|
|
5522
5521
|
if (responseHasError(response)) {
|
|
5523
5522
|
this.setState({ error: response.error.message });
|
|
@@ -5533,7 +5532,7 @@ class AdHocFiltersVariable extends SceneObjectBase {
|
|
|
5533
5532
|
return keys.map(toSelectableValue);
|
|
5534
5533
|
}
|
|
5535
5534
|
async _getValuesFor(filter) {
|
|
5536
|
-
var _a, _b, _c;
|
|
5535
|
+
var _a, _b, _c, _d;
|
|
5537
5536
|
const override = await ((_b = (_a = this.state).getTagValuesProvider) == null ? void 0 : _b.call(_a, this, filter));
|
|
5538
5537
|
if (override && override.replace) {
|
|
5539
5538
|
return dataFromResponse(override.values).map(toSelectableValue);
|
|
@@ -5549,7 +5548,8 @@ class AdHocFiltersVariable extends SceneObjectBase {
|
|
|
5549
5548
|
key: filter.key,
|
|
5550
5549
|
filters: otherFilters,
|
|
5551
5550
|
timeRange,
|
|
5552
|
-
queries
|
|
5551
|
+
queries,
|
|
5552
|
+
scopes: (_d = this._scopesBridge) == null ? void 0 : _d.getValue()
|
|
5553
5553
|
}, getEnrichedFiltersRequest(this)));
|
|
5554
5554
|
if (responseHasError(response)) {
|
|
5555
5555
|
this.setState({ error: response.error.message });
|
|
@@ -5737,6 +5737,7 @@ class SceneQueryRunner extends SceneObjectBase {
|
|
|
5737
5737
|
_onActivate() {
|
|
5738
5738
|
if (this.isQueryModeAuto()) {
|
|
5739
5739
|
const timeRange = sceneGraph.getTimeRange(this);
|
|
5740
|
+
const scopesBridge = sceneGraph.getScopesBridge(this);
|
|
5740
5741
|
const providers = this.getClosestExtraQueryProviders();
|
|
5741
5742
|
for (const provider of providers) {
|
|
5742
5743
|
this._subs.add(
|
|
@@ -5747,6 +5748,7 @@ class SceneQueryRunner extends SceneObjectBase {
|
|
|
5747
5748
|
})
|
|
5748
5749
|
);
|
|
5749
5750
|
}
|
|
5751
|
+
this.subscribeToScopesChanges(scopesBridge);
|
|
5750
5752
|
this.subscribeToTimeRangeChanges(timeRange);
|
|
5751
5753
|
if (this.shouldRunQueriesOnActivate()) {
|
|
5752
5754
|
this.runQueries();
|
|
@@ -5892,6 +5894,21 @@ class SceneQueryRunner extends SceneObjectBase {
|
|
|
5892
5894
|
isDataReadyToDisplay() {
|
|
5893
5895
|
return Boolean(this.state._hasFetchedData);
|
|
5894
5896
|
}
|
|
5897
|
+
subscribeToScopesChanges(scopesBridge) {
|
|
5898
|
+
if (!scopesBridge) {
|
|
5899
|
+
return;
|
|
5900
|
+
}
|
|
5901
|
+
if (this._scopesSubBridge === scopesBridge) {
|
|
5902
|
+
return;
|
|
5903
|
+
}
|
|
5904
|
+
if (this._scopesSub) {
|
|
5905
|
+
this._scopesSub.unsubscribe();
|
|
5906
|
+
}
|
|
5907
|
+
this._scopesSubBridge = scopesBridge;
|
|
5908
|
+
this._scopesSub = scopesBridge.subscribeToValue(() => {
|
|
5909
|
+
this.runWithTimeRangeAndScopes(sceneGraph.getTimeRange(this), scopesBridge);
|
|
5910
|
+
});
|
|
5911
|
+
}
|
|
5895
5912
|
subscribeToTimeRangeChanges(timeRange) {
|
|
5896
5913
|
if (this._timeSubRange === timeRange) {
|
|
5897
5914
|
return;
|
|
@@ -5901,15 +5918,17 @@ class SceneQueryRunner extends SceneObjectBase {
|
|
|
5901
5918
|
}
|
|
5902
5919
|
this._timeSubRange = timeRange;
|
|
5903
5920
|
this._timeSub = timeRange.subscribeToState(() => {
|
|
5904
|
-
this.
|
|
5921
|
+
this.runWithTimeRangeAndScopes(timeRange, sceneGraph.getScopesBridge(this));
|
|
5905
5922
|
});
|
|
5906
5923
|
}
|
|
5907
5924
|
runQueries() {
|
|
5908
5925
|
const timeRange = sceneGraph.getTimeRange(this);
|
|
5926
|
+
const scopesBridge = sceneGraph.getScopesBridge(this);
|
|
5909
5927
|
if (this.isQueryModeAuto()) {
|
|
5910
5928
|
this.subscribeToTimeRangeChanges(timeRange);
|
|
5929
|
+
this.subscribeToScopesChanges(scopesBridge);
|
|
5911
5930
|
}
|
|
5912
|
-
this.
|
|
5931
|
+
this.runWithTimeRangeAndScopes(timeRange, scopesBridge);
|
|
5913
5932
|
}
|
|
5914
5933
|
getMaxDataPoints() {
|
|
5915
5934
|
var _a;
|
|
@@ -5929,8 +5948,8 @@ class SceneQueryRunner extends SceneObjectBase {
|
|
|
5929
5948
|
data: __spreadProps$m(__spreadValues$y({}, this.state.data), { state: schema.LoadingState.Done })
|
|
5930
5949
|
});
|
|
5931
5950
|
}
|
|
5932
|
-
async
|
|
5933
|
-
var _a, _b, _c;
|
|
5951
|
+
async runWithTimeRangeAndScopes(timeRange, scopesBridge) {
|
|
5952
|
+
var _a, _b, _c, _d;
|
|
5934
5953
|
if (!this.state.maxDataPoints && this.state.maxDataPointsFromWidth && !this._containerWidth) {
|
|
5935
5954
|
return;
|
|
5936
5955
|
}
|
|
@@ -5943,17 +5962,22 @@ class SceneQueryRunner extends SceneObjectBase {
|
|
|
5943
5962
|
this.setState({ data: __spreadProps$m(__spreadValues$y({}, (_b = this.state.data) != null ? _b : emptyPanelData), { state: schema.LoadingState.Loading }) });
|
|
5944
5963
|
return;
|
|
5945
5964
|
}
|
|
5965
|
+
if (scopesBridge == null ? void 0 : scopesBridge.isLoading()) {
|
|
5966
|
+
writeSceneLog("SceneQueryRunner", "Scopes are in loading state, skipping query execution");
|
|
5967
|
+
this.setState({ data: __spreadProps$m(__spreadValues$y({}, (_c = this.state.data) != null ? _c : emptyPanelData), { state: schema.LoadingState.Loading }) });
|
|
5968
|
+
return;
|
|
5969
|
+
}
|
|
5946
5970
|
const { queries } = this.state;
|
|
5947
5971
|
if (!(queries == null ? void 0 : queries.length)) {
|
|
5948
5972
|
this._setNoDataState();
|
|
5949
5973
|
return;
|
|
5950
5974
|
}
|
|
5951
5975
|
try {
|
|
5952
|
-
const datasource = (
|
|
5976
|
+
const datasource = (_d = this.state.datasource) != null ? _d : findFirstDatasource(queries);
|
|
5953
5977
|
const ds = await getDataSource(datasource, this._scopedVars);
|
|
5954
5978
|
this.findAndSubscribeToAdHocFilters(ds.uid);
|
|
5955
5979
|
const runRequest = runtime.getRunRequest();
|
|
5956
|
-
const { primary, secondaries, processors } = this.prepareRequests(timeRange, ds);
|
|
5980
|
+
const { primary, secondaries, processors } = this.prepareRequests(timeRange, ds, scopesBridge);
|
|
5957
5981
|
writeSceneLog("SceneQueryRunner", "Starting runRequest", this.state.key);
|
|
5958
5982
|
let stream = runRequest(ds, primary);
|
|
5959
5983
|
if (secondaries.length > 0) {
|
|
@@ -5992,7 +6016,7 @@ class SceneQueryRunner extends SceneObjectBase {
|
|
|
5992
6016
|
clone["_results"].next({ origin: this, data: (_a = this.state.data) != null ? _a : emptyPanelData });
|
|
5993
6017
|
return clone;
|
|
5994
6018
|
}
|
|
5995
|
-
prepareRequests(timeRange, ds) {
|
|
6019
|
+
prepareRequests(timeRange, ds, scopesBridge) {
|
|
5996
6020
|
var _a, _b;
|
|
5997
6021
|
const { minInterval, queries } = this.state;
|
|
5998
6022
|
let request = __spreadValues$y({
|
|
@@ -6012,7 +6036,8 @@ class SceneQueryRunner extends SceneObjectBase {
|
|
|
6012
6036
|
to: timeRange.state.to
|
|
6013
6037
|
},
|
|
6014
6038
|
cacheTimeout: this.state.cacheTimeout,
|
|
6015
|
-
queryCachingTTL: this.state.queryCachingTTL
|
|
6039
|
+
queryCachingTTL: this.state.queryCachingTTL,
|
|
6040
|
+
scopes: scopesBridge == null ? void 0 : scopesBridge.getValue()
|
|
6016
6041
|
}, getEnrichedDataRequest(this));
|
|
6017
6042
|
if (this._adhocFiltersVar) {
|
|
6018
6043
|
request.filters = [];
|
|
@@ -6985,6 +7010,108 @@ function containsSearchFilter(query) {
|
|
|
6985
7010
|
return str.indexOf(SEARCH_FILTER_VARIABLE) > -1;
|
|
6986
7011
|
}
|
|
6987
7012
|
|
|
7013
|
+
class SceneScopesBridge extends SceneObjectBase {
|
|
7014
|
+
constructor() {
|
|
7015
|
+
super(...arguments);
|
|
7016
|
+
this._urlSync = new SceneObjectUrlSyncConfig(this, { keys: ["scopes"] });
|
|
7017
|
+
this._renderBeforeActivation = true;
|
|
7018
|
+
this._contextSubject = new rxjs.BehaviorSubject(void 0);
|
|
7019
|
+
this._pendingScopes = null;
|
|
7020
|
+
}
|
|
7021
|
+
getUrlState() {
|
|
7022
|
+
var _a, _b, _c;
|
|
7023
|
+
return {
|
|
7024
|
+
scopes: (_c = this._pendingScopes) != null ? _c : ((_b = (_a = this.context) == null ? void 0 : _a.state.value) != null ? _b : []).map((scope) => scope.metadata.name)
|
|
7025
|
+
};
|
|
7026
|
+
}
|
|
7027
|
+
updateFromUrl(values) {
|
|
7028
|
+
var _a, _b;
|
|
7029
|
+
let scopes = (_a = values["scopes"]) != null ? _a : [];
|
|
7030
|
+
scopes = (Array.isArray(scopes) ? scopes : [scopes]).map(String);
|
|
7031
|
+
if (!this.context) {
|
|
7032
|
+
this._pendingScopes = scopes;
|
|
7033
|
+
return;
|
|
7034
|
+
}
|
|
7035
|
+
(_b = this.context) == null ? void 0 : _b.changeScopes(scopes);
|
|
7036
|
+
}
|
|
7037
|
+
getValue() {
|
|
7038
|
+
var _a, _b;
|
|
7039
|
+
return (_b = (_a = this.context) == null ? void 0 : _a.state.value) != null ? _b : [];
|
|
7040
|
+
}
|
|
7041
|
+
subscribeToValue(cb) {
|
|
7042
|
+
return this.contextObservable.pipe(
|
|
7043
|
+
rxjs.filter((context) => !!context && !context.state.loading),
|
|
7044
|
+
rxjs.pairwise(),
|
|
7045
|
+
rxjs.map(
|
|
7046
|
+
([prevContext, newContext]) => {
|
|
7047
|
+
var _a, _b;
|
|
7048
|
+
return [(_a = prevContext == null ? void 0 : prevContext.state.value) != null ? _a : [], (_b = newContext == null ? void 0 : newContext.state.value) != null ? _b : []];
|
|
7049
|
+
}
|
|
7050
|
+
),
|
|
7051
|
+
rxjs.filter(([prevScopes, newScopes]) => !lodash.isEqual(prevScopes, newScopes))
|
|
7052
|
+
).subscribe(([prevScopes, newScopes]) => {
|
|
7053
|
+
cb(newScopes, prevScopes);
|
|
7054
|
+
});
|
|
7055
|
+
}
|
|
7056
|
+
isLoading() {
|
|
7057
|
+
var _a, _b;
|
|
7058
|
+
return (_b = (_a = this.context) == null ? void 0 : _a.state.loading) != null ? _b : false;
|
|
7059
|
+
}
|
|
7060
|
+
subscribeToLoading(cb) {
|
|
7061
|
+
return this.contextObservable.pipe(
|
|
7062
|
+
rxjs.filter((context) => !!context),
|
|
7063
|
+
rxjs.pairwise(),
|
|
7064
|
+
rxjs.map(
|
|
7065
|
+
([prevContext, newContext]) => {
|
|
7066
|
+
var _a, _b;
|
|
7067
|
+
return [(_a = prevContext == null ? void 0 : prevContext.state.loading) != null ? _a : false, (_b = newContext == null ? void 0 : newContext.state.loading) != null ? _b : false];
|
|
7068
|
+
}
|
|
7069
|
+
),
|
|
7070
|
+
rxjs.filter(([prevLoading, newLoading]) => prevLoading !== newLoading)
|
|
7071
|
+
).subscribe(([_prevLoading, newLoading]) => {
|
|
7072
|
+
cb(newLoading);
|
|
7073
|
+
});
|
|
7074
|
+
}
|
|
7075
|
+
setEnabled(enabled) {
|
|
7076
|
+
var _a;
|
|
7077
|
+
(_a = this.context) == null ? void 0 : _a.setEnabled(enabled);
|
|
7078
|
+
}
|
|
7079
|
+
setReadOnly(readOnly) {
|
|
7080
|
+
var _a;
|
|
7081
|
+
(_a = this.context) == null ? void 0 : _a.setReadOnly(readOnly);
|
|
7082
|
+
}
|
|
7083
|
+
updateContext(newContext) {
|
|
7084
|
+
var _a, _b;
|
|
7085
|
+
if (this._pendingScopes && newContext) {
|
|
7086
|
+
setTimeout(() => {
|
|
7087
|
+
newContext == null ? void 0 : newContext.changeScopes(this._pendingScopes);
|
|
7088
|
+
this._pendingScopes = null;
|
|
7089
|
+
});
|
|
7090
|
+
}
|
|
7091
|
+
if (this.context !== newContext || ((_a = this.context) == null ? void 0 : _a.state) !== (newContext == null ? void 0 : newContext.state)) {
|
|
7092
|
+
const shouldUpdate = ((_b = this.context) == null ? void 0 : _b.state.value) !== (newContext == null ? void 0 : newContext.state.value);
|
|
7093
|
+
this._contextSubject.next(newContext);
|
|
7094
|
+
if (shouldUpdate) {
|
|
7095
|
+
this.forceRender();
|
|
7096
|
+
}
|
|
7097
|
+
}
|
|
7098
|
+
}
|
|
7099
|
+
get context() {
|
|
7100
|
+
return this._contextSubject.getValue();
|
|
7101
|
+
}
|
|
7102
|
+
get contextObservable() {
|
|
7103
|
+
return this._contextSubject.asObservable();
|
|
7104
|
+
}
|
|
7105
|
+
}
|
|
7106
|
+
SceneScopesBridge.Component = SceneScopesBridgeRenderer;
|
|
7107
|
+
function SceneScopesBridgeRenderer({ model }) {
|
|
7108
|
+
const context = runtime.useScopes();
|
|
7109
|
+
React.useEffect(() => {
|
|
7110
|
+
model.updateContext(context);
|
|
7111
|
+
}, [context, model]);
|
|
7112
|
+
return null;
|
|
7113
|
+
}
|
|
7114
|
+
|
|
6988
7115
|
function getVariables(sceneObject) {
|
|
6989
7116
|
var _a;
|
|
6990
7117
|
return (_a = getClosest(sceneObject, (s) => s.state.$variables)) != null ? _a : EmptyVariableSet;
|
|
@@ -7128,6 +7255,10 @@ function findDescendents(scene, descendentType) {
|
|
|
7128
7255
|
const targetScenes = findAllObjects(scene, isDescendentType);
|
|
7129
7256
|
return targetScenes.filter(isDescendentType);
|
|
7130
7257
|
}
|
|
7258
|
+
function getScopesBridge(sceneObject) {
|
|
7259
|
+
var _a;
|
|
7260
|
+
return (_a = findObject(sceneObject, (s) => s instanceof SceneScopesBridge)) != null ? _a : void 0;
|
|
7261
|
+
}
|
|
7131
7262
|
|
|
7132
7263
|
const sceneGraph = {
|
|
7133
7264
|
getVariables,
|
|
@@ -7144,7 +7275,8 @@ const sceneGraph = {
|
|
|
7144
7275
|
findAllObjects,
|
|
7145
7276
|
getAncestor,
|
|
7146
7277
|
getQueryController,
|
|
7147
|
-
findDescendents
|
|
7278
|
+
findDescendents,
|
|
7279
|
+
getScopesBridge
|
|
7148
7280
|
};
|
|
7149
7281
|
|
|
7150
7282
|
class UniqueUrlKeyMapper {
|
|
@@ -12898,6 +13030,10 @@ class SplitLayout extends SceneObjectBase {
|
|
|
12898
13030
|
SplitLayout.Component = SplitLayoutRenderer;
|
|
12899
13031
|
|
|
12900
13032
|
class SceneApp extends SceneObjectBase {
|
|
13033
|
+
constructor() {
|
|
13034
|
+
super(...arguments);
|
|
13035
|
+
this._renderBeforeActivation = true;
|
|
13036
|
+
}
|
|
12901
13037
|
enrichDataRequest() {
|
|
12902
13038
|
return {
|
|
12903
13039
|
app: this.state.name || "app"
|
|
@@ -12905,8 +13041,10 @@ class SceneApp extends SceneObjectBase {
|
|
|
12905
13041
|
}
|
|
12906
13042
|
}
|
|
12907
13043
|
SceneApp.Component = ({ model }) => {
|
|
12908
|
-
const { pages } = model.useState();
|
|
12909
|
-
return /* @__PURE__ */ React__default["default"].createElement(
|
|
13044
|
+
const { pages, scopesBridge } = model.useState();
|
|
13045
|
+
return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, scopesBridge && /* @__PURE__ */ React__default["default"].createElement(scopesBridge.Component, {
|
|
13046
|
+
model: scopesBridge
|
|
13047
|
+
}), /* @__PURE__ */ React__default["default"].createElement(SceneAppContext.Provider, {
|
|
12910
13048
|
value: model
|
|
12911
13049
|
}, /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Routes, null, pages.map((page) => /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
12912
13050
|
key: page.state.url,
|
|
@@ -12914,7 +13052,7 @@ SceneApp.Component = ({ model }) => {
|
|
|
12914
13052
|
element: /* @__PURE__ */ React__default["default"].createElement(page.Component, {
|
|
12915
13053
|
model: page
|
|
12916
13054
|
})
|
|
12917
|
-
}))));
|
|
13055
|
+
})))));
|
|
12918
13056
|
};
|
|
12919
13057
|
const SceneAppContext = React.createContext(null);
|
|
12920
13058
|
const sceneAppCache = /* @__PURE__ */ new Map();
|
|
@@ -13269,6 +13407,21 @@ class SceneAppPage extends SceneObjectBase {
|
|
|
13269
13407
|
super(state);
|
|
13270
13408
|
this._sceneCache = /* @__PURE__ */ new Map();
|
|
13271
13409
|
this._drilldownCache = /* @__PURE__ */ new Map();
|
|
13410
|
+
this._activationHandler = () => {
|
|
13411
|
+
if (!this.state.useScopes) {
|
|
13412
|
+
return;
|
|
13413
|
+
}
|
|
13414
|
+
this._scopesBridge = sceneGraph.getScopesBridge(this);
|
|
13415
|
+
if (!this._scopesBridge) {
|
|
13416
|
+
throw new Error("Use of scopes is enabled but no scopes bridge found");
|
|
13417
|
+
}
|
|
13418
|
+
this._scopesBridge.setEnabled(true);
|
|
13419
|
+
return () => {
|
|
13420
|
+
var _a;
|
|
13421
|
+
(_a = this._scopesBridge) == null ? void 0 : _a.setEnabled(false);
|
|
13422
|
+
};
|
|
13423
|
+
};
|
|
13424
|
+
this.addActivationHandler(this._activationHandler);
|
|
13272
13425
|
}
|
|
13273
13426
|
initializeScene(scene) {
|
|
13274
13427
|
this.setState({ initializedScene: scene });
|
|
@@ -14268,6 +14421,7 @@ exports.SceneObjectUrlSyncConfig = SceneObjectUrlSyncConfig;
|
|
|
14268
14421
|
exports.SceneQueryRunner = SceneQueryRunner;
|
|
14269
14422
|
exports.SceneReactObject = SceneReactObject;
|
|
14270
14423
|
exports.SceneRefreshPicker = SceneRefreshPicker;
|
|
14424
|
+
exports.SceneScopesBridge = SceneScopesBridge;
|
|
14271
14425
|
exports.SceneTimePicker = SceneTimePicker;
|
|
14272
14426
|
exports.SceneTimeRange = SceneTimeRange;
|
|
14273
14427
|
exports.SceneTimeRangeCompare = SceneTimeRangeCompare;
|