@grafana/scenes 6.12.0--canary.1122.15063334499.0 → 6.12.0--canary.1121.15070832166.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 +2 -2
- package/dist/esm/components/SceneApp/SceneApp.js.map +1 -1
- package/dist/esm/components/SceneApp/SceneAppPage.js +2 -18
- package/dist/esm/components/SceneApp/SceneAppPage.js.map +1 -1
- package/dist/esm/core/sceneGraph/index.js +2 -2
- package/dist/esm/core/sceneGraph/index.js.map +1 -1
- package/dist/esm/core/sceneGraph/sceneGraph.js +9 -5
- package/dist/esm/core/sceneGraph/sceneGraph.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/querying/SceneQueryRunner.js +10 -33
- package/dist/esm/querying/SceneQueryRunner.js.map +1 -1
- package/dist/esm/variables/VariableDependencyConfig.js +4 -1
- package/dist/esm/variables/VariableDependencyConfig.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js +19 -18
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js.map +1 -1
- package/dist/esm/variables/components/VariableValueSelectors.js +3 -0
- package/dist/esm/variables/components/VariableValueSelectors.js.map +1 -1
- package/dist/esm/variables/constants.js +2 -1
- package/dist/esm/variables/constants.js.map +1 -1
- package/dist/esm/variables/groupby/GroupByVariable.js +7 -40
- package/dist/esm/variables/groupby/GroupByVariable.js.map +1 -1
- package/dist/esm/variables/groupby/GroupByVariableUrlSyncHandler.js +7 -31
- package/dist/esm/variables/groupby/GroupByVariableUrlSyncHandler.js.map +1 -1
- package/dist/esm/variables/sets/SceneVariableSet.js +10 -7
- package/dist/esm/variables/sets/SceneVariableSet.js.map +1 -1
- package/dist/esm/variables/types.js.map +1 -1
- package/dist/esm/variables/variants/ScopesVariable.js +87 -0
- package/dist/esm/variables/variants/ScopesVariable.js.map +1 -0
- package/dist/index.d.ts +51 -56
- package/dist/index.js +128 -310
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/esm/core/SceneScopesBridge.js +0 -93
- package/dist/esm/core/SceneScopesBridge.js.map +0 -1
- package/dist/esm/variables/groupby/DefaultGroupByCustomIndicatorContainer.js +0 -102
- package/dist/esm/variables/groupby/DefaultGroupByCustomIndicatorContainer.js.map +0 -1
@@ -0,0 +1,87 @@
|
|
1
|
+
import { SceneObjectBase } from '../../core/SceneObjectBase.js';
|
2
|
+
import { SceneVariableValueChangedEvent } from '../types.js';
|
3
|
+
import { ScopesContext } from '@grafana/runtime';
|
4
|
+
import { useContext, useEffect } from 'react';
|
5
|
+
import { VariableHide, VariableFormatID } from '@grafana/schema';
|
6
|
+
import { SCOPES_VARIABLE_NAME } from '../constants.js';
|
7
|
+
|
8
|
+
class ScopesVariable extends SceneObjectBase {
|
9
|
+
constructor(state) {
|
10
|
+
super({
|
11
|
+
skipUrlSync: true,
|
12
|
+
loading: true,
|
13
|
+
scopes: [],
|
14
|
+
...state,
|
15
|
+
type: "system",
|
16
|
+
name: SCOPES_VARIABLE_NAME,
|
17
|
+
hide: VariableHide.hideVariable
|
18
|
+
});
|
19
|
+
this._renderBeforeActivation = true;
|
20
|
+
// Special options that enables variables to be hidden but still render to access react contexts
|
21
|
+
this.UNSAFE_renderAsHidden = true;
|
22
|
+
}
|
23
|
+
/**
|
24
|
+
* Temporary simple implementation to stringify the scopes.
|
25
|
+
*/
|
26
|
+
getValue() {
|
27
|
+
var _a;
|
28
|
+
const scopes = (_a = this.state.scopes) != null ? _a : [];
|
29
|
+
return new ScopesVariableFormatter(scopes.map((scope) => scope.metadata.name));
|
30
|
+
}
|
31
|
+
getScopes() {
|
32
|
+
return this.state.scopes;
|
33
|
+
}
|
34
|
+
/**
|
35
|
+
* This method is used to keep the context up to date with the scopes context received from React
|
36
|
+
* 1) Subscribes to ScopesContext state changes and synchronizes it with the variable state
|
37
|
+
* 2) Handles enable / disabling of scopes based on variable enable option.
|
38
|
+
*/
|
39
|
+
setContext(context) {
|
40
|
+
if (!context) {
|
41
|
+
return;
|
42
|
+
}
|
43
|
+
this._context = context;
|
44
|
+
const oldState = context.state;
|
45
|
+
if (this.state.enable != null) {
|
46
|
+
context.setEnabled(this.state.enable);
|
47
|
+
}
|
48
|
+
const sub = context.stateObservable.subscribe((state) => {
|
49
|
+
this.updateStateFromContext(state);
|
50
|
+
});
|
51
|
+
return () => {
|
52
|
+
sub.unsubscribe();
|
53
|
+
if (this.state.enable != null) {
|
54
|
+
context.setEnabled(oldState.enabled);
|
55
|
+
}
|
56
|
+
};
|
57
|
+
}
|
58
|
+
updateStateFromContext(state) {
|
59
|
+
const loading = state.value.length === 0 ? false : state.loading;
|
60
|
+
this.setState({ scopes: state.value, loading });
|
61
|
+
if (!loading) {
|
62
|
+
this.publishEvent(new SceneVariableValueChangedEvent(this), true);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
ScopesVariable.Component = ScopesVariableRenderer;
|
67
|
+
function ScopesVariableRenderer({ model }) {
|
68
|
+
const context = useContext(ScopesContext);
|
69
|
+
useEffect(() => {
|
70
|
+
return model.setContext(context);
|
71
|
+
}, [context, model]);
|
72
|
+
return null;
|
73
|
+
}
|
74
|
+
class ScopesVariableFormatter {
|
75
|
+
constructor(_value) {
|
76
|
+
this._value = _value;
|
77
|
+
}
|
78
|
+
formatter(formatNameOrFn) {
|
79
|
+
if (formatNameOrFn === VariableFormatID.QueryParam) {
|
80
|
+
return this._value.map((scope) => `scope=${encodeURIComponent(scope)}`).join("&");
|
81
|
+
}
|
82
|
+
return this._value.join(", ");
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
export { ScopesVariable, ScopesVariableFormatter };
|
87
|
+
//# sourceMappingURL=ScopesVariable.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ScopesVariable.js","sources":["../../../../src/variables/variants/ScopesVariable.tsx"],"sourcesContent":["import { SceneObjectBase } from '../../core/SceneObjectBase';\nimport {\n CustomVariableValue,\n SceneVariable,\n SceneVariableState,\n SceneVariableValueChangedEvent,\n VariableValue,\n} from '../types';\nimport { Scope } from '@grafana/data';\nimport { SceneComponentProps } from '../../core/types';\nimport { ScopesContext, ScopesContextValue } from '@grafana/runtime';\nimport { useContext, useEffect } from 'react';\nimport { VariableFormatID, VariableHide } from '@grafana/schema';\nimport { SCOPES_VARIABLE_NAME } from '../constants';\n\nexport interface ScopesVariableState extends SceneVariableState {\n /**\n * Last captured state from ScopesContext\n */\n scopes: Scope[];\n /**\n * Set to true if you want to the variable to enable / disable scopes when activated / deactivated\n */\n enable?: boolean;\n}\n\nexport class ScopesVariable extends SceneObjectBase<ScopesVariableState> implements SceneVariable<ScopesVariableState> {\n protected _renderBeforeActivation = true;\n protected _context: ScopesContextValue | undefined;\n\n // Special options that enables variables to be hidden but still render to access react contexts\n public UNSAFE_renderAsHidden = true;\n public static Component = ScopesVariableRenderer;\n\n public constructor(state: Partial<ScopesVariableState>) {\n super({\n skipUrlSync: true,\n loading: true,\n scopes: [],\n ...state,\n type: 'system',\n name: SCOPES_VARIABLE_NAME,\n hide: VariableHide.hideVariable,\n });\n }\n\n /**\n * Temporary simple implementation to stringify the scopes.\n */\n public getValue(): VariableValue {\n const scopes = this.state.scopes ?? [];\n return new ScopesVariableFormatter(scopes.map((scope) => scope.metadata.name));\n }\n\n public getScopes(): Scope[] | undefined {\n return this.state.scopes;\n }\n\n /**\n * This method is used to keep the context up to date with the scopes context received from React\n * 1) Subscribes to ScopesContext state changes and synchronizes it with the variable state\n * 2) Handles enable / disabling of scopes based on variable enable option.\n */\n public setContext(context: ScopesContextValue | undefined) {\n if (!context) {\n return;\n }\n\n this._context = context;\n\n const oldState = context.state;\n\n // Update scopes enable state if state.enable is defined\n if (this.state.enable != null) {\n context.setEnabled(this.state.enable);\n }\n\n // Subscribe to context state changes\n const sub = context.stateObservable.subscribe((state) => {\n this.updateStateFromContext(state);\n });\n\n return () => {\n sub.unsubscribe();\n\n if (this.state.enable != null) {\n context.setEnabled(oldState.enabled);\n }\n };\n }\n\n public updateStateFromContext(state: { loading: boolean; value: Scope[] }) {\n // There was logic in SceneQueryRunner that said if there are no scopes then loading state should not block query execution\n const loading = state.value.length === 0 ? false : state.loading;\n this.setState({ scopes: state.value, loading });\n\n if (!loading) {\n this.publishEvent(new SceneVariableValueChangedEvent(this), true);\n }\n }\n}\n\nfunction ScopesVariableRenderer({ model }: SceneComponentProps<ScopesVariable>) {\n const context = useContext(ScopesContext);\n\n useEffect(() => {\n return model.setContext(context);\n }, [context, model]);\n\n return null;\n}\n\nexport class ScopesVariableFormatter implements CustomVariableValue {\n public constructor(private _value: string[]) {}\n\n public formatter(formatNameOrFn?: string): string {\n if (formatNameOrFn === VariableFormatID.QueryParam) {\n return this._value.map((scope) => `scope=${encodeURIComponent(scope)}`).join('&');\n }\n\n return this._value.join(', ');\n }\n}\n"],"names":[],"mappings":"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"}
|
package/dist/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as _grafana_data from '@grafana/data';
|
2
|
-
import { BusEventWithPayload, EventBus, BusEvent, BusEventType, BusEventHandler, PanelMenuItem, FieldConfigSource, PanelPlugin, AbsoluteTimeRange, PanelData, InterpolateFunction, PanelModel, TimeRange, DataTransformContext, DataFrame, DataQueryRequest, DataSourceGetTagKeysOptions, DataSourceGetTagValuesOptions,
|
2
|
+
import { BusEventWithPayload, EventBus, BusEvent, BusEventType, BusEventHandler, PanelMenuItem, FieldConfigSource, PanelPlugin, AbsoluteTimeRange, PanelData, InterpolateFunction, PanelModel, TimeRange, DataTransformContext, DataFrame, DataQueryRequest, DataSourceGetTagKeysOptions, DataSourceGetTagValuesOptions, IconName, PageLayoutType, UrlQueryMap, DataQuery as DataQuery$1, DataSourceApi, Registry, RegistryItem, ScopedVars, AdHocVariableFilter, GetTagResponse, MetricFindValue, SelectableValue, VariableRefresh as VariableRefresh$1, VariableSort, Scope, EventFilterOptions, AnnotationEvent, AnnotationQuery, DataTransformerConfig, TimeOption, FieldConfig, FieldType, FieldValueMatcherConfig, ScopedVar, RawTimeRange } from '@grafana/data';
|
3
3
|
import * as React$1 from 'react';
|
4
4
|
import React__default, { ComponentType, CSSProperties, PointerEvent, ForwardRefExoticComponent } from 'react';
|
5
5
|
import * as rxjs from 'rxjs';
|
@@ -7,7 +7,7 @@ import { Observable, Subscription, Unsubscribable, MonoTypeOperatorFunction, Rep
|
|
7
7
|
import * as _grafana_schema from '@grafana/schema';
|
8
8
|
import { VariableType, VariableHide, TimeZone, DataQuery, DataTopic, DataSourceRef, VariableRefresh, LoadingState, DashboardCursorSync, MatcherConfig, TableFieldOptions } from '@grafana/schema';
|
9
9
|
import { PanelContext, WeekStart, IconName as IconName$1 } from '@grafana/ui';
|
10
|
-
import {
|
10
|
+
import { LocationService, VariableInterpolation, ScopesContextValue } from '@grafana/runtime';
|
11
11
|
import { Location } from 'history';
|
12
12
|
import ReactGridLayout from 'react-grid-layout';
|
13
13
|
import { Options, FieldConfig as FieldConfig$1 } from '@grafana/schema/dist/esm/raw/composable/barchart/panelcfg/x/BarChartPanelCfg_types.gen';
|
@@ -63,6 +63,10 @@ interface SceneVariable<TState extends SceneVariableState = SceneVariableState>
|
|
63
63
|
* Allows cancelling variable execution.
|
64
64
|
*/
|
65
65
|
onCancel?(): void;
|
66
|
+
/**
|
67
|
+
* Edge case for variables that are hidden but wants to be render to access react contexts (ScopesVariable)
|
68
|
+
*/
|
69
|
+
UNSAFE_renderAsHidden?: boolean;
|
66
70
|
/**
|
67
71
|
* @experimental
|
68
72
|
* Indicates that a variable loads values lazily when user interacts with the variable dropdown.
|
@@ -275,6 +279,10 @@ interface VariableDependencyConfigOptions<TState extends SceneObjectState> {
|
|
275
279
|
* Handle time macros.
|
276
280
|
*/
|
277
281
|
handleTimeMacros?: boolean;
|
282
|
+
/**
|
283
|
+
* Will add ScopesVariable as a dependency which will cause updates when the scopes change.
|
284
|
+
*/
|
285
|
+
dependsOnScopes?: boolean;
|
278
286
|
}
|
279
287
|
declare class VariableDependencyConfig<TState extends SceneObjectState> implements SceneVariableDependencyConfigLike {
|
280
288
|
private _sceneObject;
|
@@ -651,36 +659,6 @@ declare class EmbeddedScene extends SceneObjectBase<EmbeddedSceneState> {
|
|
651
659
|
}
|
652
660
|
declare function EmbeddedSceneRenderer({ model }: SceneComponentProps<EmbeddedScene>): React__default.JSX.Element;
|
653
661
|
|
654
|
-
declare class SceneScopesBridge extends SceneObjectBase {
|
655
|
-
static Component: typeof SceneScopesBridgeRenderer;
|
656
|
-
protected _renderBeforeActivation: boolean;
|
657
|
-
private _contextSubject;
|
658
|
-
getValue(): Scope[];
|
659
|
-
/**
|
660
|
-
* Emits values of the selected scopes array. It emits the current value and the previous value if there is a change.
|
661
|
-
* @param cb
|
662
|
-
*/
|
663
|
-
subscribeToValue(cb: (newScopes: Scope[], prevScopes: Scope[]) => void): Unsubscribable;
|
664
|
-
isLoading(): boolean;
|
665
|
-
subscribeToLoading(cb: (loading: boolean) => void): Unsubscribable;
|
666
|
-
setEnabled(enabled: boolean): void;
|
667
|
-
setReadOnly(readOnly: boolean): void;
|
668
|
-
/**
|
669
|
-
* This method is used to keep the context up to date with the scopes context received from React
|
670
|
-
*
|
671
|
-
* Its rationale is:
|
672
|
-
* - When a new context is available, check if we have pending scopes passed from the URL
|
673
|
-
* - If we have pending scopes, ask the new context to load them
|
674
|
-
* - The loading should happen in a setTimeout to allow the existing context to pass its values to the URL sync handler
|
675
|
-
* - If a new context is received, propagate it as a new value in the behavior subject
|
676
|
-
* - If a new value is received, force a re-render to trigger the URL sync handler
|
677
|
-
*/
|
678
|
-
updateContext(newContext: ScopesContextValue | undefined): void;
|
679
|
-
private get context();
|
680
|
-
private get contextObservable();
|
681
|
-
}
|
682
|
-
declare function SceneScopesBridgeRenderer({ model }: SceneComponentProps<SceneScopesBridge>): null;
|
683
|
-
|
684
662
|
interface SceneRouteMatch<Params extends {
|
685
663
|
[K in keyof Params]?: string;
|
686
664
|
} = {}> {
|
@@ -693,7 +671,6 @@ interface SceneAppState extends SceneObjectState {
|
|
693
671
|
pages: SceneAppPageLike[];
|
694
672
|
name?: string;
|
695
673
|
urlSyncOptions?: SceneUrlSyncOptions;
|
696
|
-
scopesBridge?: SceneScopesBridge;
|
697
674
|
}
|
698
675
|
interface SceneAppRoute {
|
699
676
|
path: string;
|
@@ -738,7 +715,6 @@ interface SceneAppPageState extends SceneObjectState {
|
|
738
715
|
*/
|
739
716
|
getFallbackPage?: () => SceneAppPageLike;
|
740
717
|
layout?: PageLayoutType;
|
741
|
-
useScopes?: boolean;
|
742
718
|
}
|
743
719
|
interface SceneAppPageLike extends SceneObject<SceneAppPageState>, DataRequestEnricher {
|
744
720
|
initializeScene(scene: SceneObject): void;
|
@@ -966,8 +942,9 @@ declare class AdHocFiltersVariable extends SceneObjectBase<AdHocFiltersVariableS
|
|
966
942
|
static Component: typeof AdHocFiltersVariableRenderer;
|
967
943
|
private _scopedVars;
|
968
944
|
private _dataSourceSrv;
|
969
|
-
private _scopesBridge;
|
970
945
|
private _originalValues;
|
946
|
+
/** Needed for scopes dependency */
|
947
|
+
protected _variableDependency: VariableDependencyConfig<AdHocFiltersVariableState>;
|
971
948
|
protected _urlSync: AdHocFiltersVariableUrlSyncHandler;
|
972
949
|
constructor(state: Partial<AdHocFiltersVariableState>);
|
973
950
|
private _activationHandler;
|
@@ -1188,10 +1165,6 @@ interface GroupByVariableState extends MultiValueVariableState {
|
|
1188
1165
|
baseFilters?: AdHocVariableFilter[];
|
1189
1166
|
/** Datasource to use for getTagKeys and also controls which scene queries the group by should apply to */
|
1190
1167
|
datasource: DataSourceRef | null;
|
1191
|
-
defaultValues?: {
|
1192
|
-
text: VariableValue;
|
1193
|
-
value: VariableValue;
|
1194
|
-
};
|
1195
1168
|
/** Controls if the group by can be changed */
|
1196
1169
|
readOnly?: boolean;
|
1197
1170
|
/**
|
@@ -1224,14 +1197,10 @@ declare class GroupByVariable extends MultiValueVariable<GroupByVariableState> {
|
|
1224
1197
|
static Component: typeof GroupByVariableRenderer;
|
1225
1198
|
isLazy: boolean;
|
1226
1199
|
protected _urlSync: SceneObjectUrlSyncHandler;
|
1227
|
-
private _scopesBridge;
|
1228
1200
|
validateAndUpdate(): Observable<ValidateAndUpdateResult>;
|
1229
1201
|
private _updateValueGivenNewOptions;
|
1230
1202
|
getValueOptions(args: VariableGetOptionsArgs): Observable<VariableValueOption[]>;
|
1231
1203
|
constructor(initialState: Partial<GroupByVariableState>);
|
1232
|
-
private _activationHandler;
|
1233
|
-
checkIfRestorable(values: VariableValue): boolean;
|
1234
|
-
restoreDefaultValues(): void;
|
1235
1204
|
/**
|
1236
1205
|
* Get possible keys given current filters. Do not call from plugins directly
|
1237
1206
|
*/
|
@@ -1424,9 +1393,9 @@ declare function getAncestor<ParentType>(sceneObject: SceneObject, ancestorType:
|
|
1424
1393
|
*/
|
1425
1394
|
declare function findDescendents<T extends SceneObject>(scene: SceneObject, descendentType: SceneType<T>): T[];
|
1426
1395
|
/**
|
1427
|
-
* Will
|
1396
|
+
* Will return the scopes from the scopes variable if available.
|
1428
1397
|
*/
|
1429
|
-
declare function
|
1398
|
+
declare function getScopes(sceneObject: SceneObject): Scope[] | undefined;
|
1430
1399
|
|
1431
1400
|
declare const sceneGraph: {
|
1432
1401
|
getVariables: typeof getVariables;
|
@@ -1444,7 +1413,7 @@ declare const sceneGraph: {
|
|
1444
1413
|
getAncestor: typeof getAncestor;
|
1445
1414
|
getQueryController: typeof getQueryController;
|
1446
1415
|
findDescendents: typeof findDescendents;
|
1447
|
-
|
1416
|
+
getScopes: typeof getScopes;
|
1448
1417
|
};
|
1449
1418
|
|
1450
1419
|
interface ActWhenVariableChangedState extends SceneObjectState {
|
@@ -1711,8 +1680,6 @@ declare class SceneQueryRunner extends SceneObjectBase<QueryRunnerState> impleme
|
|
1711
1680
|
private _dataLayersMerger;
|
1712
1681
|
private _timeSub?;
|
1713
1682
|
private _timeSubRange?;
|
1714
|
-
private _scopesSub?;
|
1715
|
-
private _scopesSubBridge?;
|
1716
1683
|
private _containerWidth?;
|
1717
1684
|
private _variableValueRecorder;
|
1718
1685
|
private _results;
|
@@ -1751,12 +1718,11 @@ declare class SceneQueryRunner extends SceneObjectBase<QueryRunnerState> impleme
|
|
1751
1718
|
private _onDeactivate;
|
1752
1719
|
setContainerWidth(width: number): void;
|
1753
1720
|
isDataReadyToDisplay(): boolean;
|
1754
|
-
private subscribeToScopesChanges;
|
1755
1721
|
private subscribeToTimeRangeChanges;
|
1756
1722
|
runQueries(): void;
|
1757
1723
|
private getMaxDataPoints;
|
1758
1724
|
cancelQuery(): void;
|
1759
|
-
private
|
1725
|
+
private runWithTimeRange;
|
1760
1726
|
clone(withState?: Partial<QueryRunnerState>): this;
|
1761
1727
|
private prepareRequests;
|
1762
1728
|
private onDataReceived;
|
@@ -1906,8 +1872,6 @@ declare class VariableValueControl extends SceneObjectBase<VariableValueControlS
|
|
1906
1872
|
declare function VariableValueControlRenderer({ model }: SceneComponentProps<VariableValueControl>): React__default.JSX.Element | null;
|
1907
1873
|
|
1908
1874
|
declare class SceneVariableSet extends SceneObjectBase<SceneVariableSetState> implements SceneVariables {
|
1909
|
-
/** Variables that have changed in since the activation or since the first manual value change */
|
1910
|
-
private _variablesThatHaveChanged;
|
1911
1875
|
/** Variables that are scheduled to be validated and updated */
|
1912
1876
|
private _variablesToUpdate;
|
1913
1877
|
/** Variables currently updating */
|
@@ -2010,6 +1974,40 @@ declare class TestVariable extends MultiValueVariable<TestVariableState> {
|
|
2010
1974
|
static Component: ({ model }: SceneComponentProps<MultiValueVariable>) => React__default.JSX.Element;
|
2011
1975
|
}
|
2012
1976
|
|
1977
|
+
interface ScopesVariableState extends SceneVariableState {
|
1978
|
+
/**
|
1979
|
+
* Last captured state from ScopesContext
|
1980
|
+
*/
|
1981
|
+
scopes: Scope[];
|
1982
|
+
/**
|
1983
|
+
* Set to true if you want to the variable to enable / disable scopes when activated / deactivated
|
1984
|
+
*/
|
1985
|
+
enable?: boolean;
|
1986
|
+
}
|
1987
|
+
declare class ScopesVariable extends SceneObjectBase<ScopesVariableState> implements SceneVariable<ScopesVariableState> {
|
1988
|
+
protected _renderBeforeActivation: boolean;
|
1989
|
+
protected _context: ScopesContextValue | undefined;
|
1990
|
+
UNSAFE_renderAsHidden: boolean;
|
1991
|
+
static Component: typeof ScopesVariableRenderer;
|
1992
|
+
constructor(state: Partial<ScopesVariableState>);
|
1993
|
+
/**
|
1994
|
+
* Temporary simple implementation to stringify the scopes.
|
1995
|
+
*/
|
1996
|
+
getValue(): VariableValue;
|
1997
|
+
getScopes(): Scope[] | undefined;
|
1998
|
+
/**
|
1999
|
+
* This method is used to keep the context up to date with the scopes context received from React
|
2000
|
+
* 1) Subscribes to ScopesContext state changes and synchronizes it with the variable state
|
2001
|
+
* 2) Handles enable / disabling of scopes based on variable enable option.
|
2002
|
+
*/
|
2003
|
+
setContext(context: ScopesContextValue | undefined): (() => void) | undefined;
|
2004
|
+
updateStateFromContext(state: {
|
2005
|
+
loading: boolean;
|
2006
|
+
value: Scope[];
|
2007
|
+
}): void;
|
2008
|
+
}
|
2009
|
+
declare function ScopesVariableRenderer({ model }: SceneComponentProps<ScopesVariable>): null;
|
2010
|
+
|
2013
2011
|
interface LocalValueVariableState extends SceneVariableState {
|
2014
2012
|
value: VariableValue;
|
2015
2013
|
text: VariableValue;
|
@@ -2499,9 +2497,6 @@ declare class SceneAppPage extends SceneObjectBase<SceneAppPageState> implements
|
|
2499
2497
|
static Component: typeof SceneAppPageRenderer;
|
2500
2498
|
private _sceneCache;
|
2501
2499
|
private _drilldownCache;
|
2502
|
-
private _scopesBridge;
|
2503
|
-
constructor(state: SceneAppPageState);
|
2504
|
-
private _activationHandler;
|
2505
2500
|
initializeScene(scene: EmbeddedScene): void;
|
2506
2501
|
getScene(routeMatch: SceneRouteMatch): EmbeddedScene;
|
2507
2502
|
getDrilldownPage(drilldown: SceneAppDrilldownView, routeMatch: SceneRouteMatch<{}>): SceneAppPageLike;
|
@@ -3036,5 +3031,5 @@ declare const sceneUtils: {
|
|
3036
3031
|
isGroupByVariable: typeof isGroupByVariable;
|
3037
3032
|
};
|
3038
3033
|
|
3039
|
-
export { AdHocFiltersVariable, ConstantVariable, ControlsLabel, CustomVariable, DataProviderProxy, DataSourceVariable, EmbeddedScene, FieldConfigBuilder, FieldConfigBuilders, FieldConfigOverridesBuilder, GroupByVariable, IntervalVariable, LazyLoader, LocalValueVariable, MultiOrSingleValueSelect, MultiValueVariable, NestedScene, NewSceneObjectAddedEvent, PanelBuilders, PanelOptionsBuilders, QueryVariable, RuntimeDataSource, SafeSerializableSceneObject, SceneApp, SceneAppPage, SceneByFrameRepeater, SceneByVariableRepeater, SceneCSSGridItem, SceneCSSGridLayout, SceneCanvasText, SceneControlsSpacer, SceneDataLayerBase, SceneDataLayerControls, SceneDataLayerSet, SceneDataLayerSetBase, SceneDataNode, SceneDataTransformer, SceneDebugger, SceneFlexItem, SceneFlexLayout, SceneGridItem, SceneGridLayout, SceneGridLayoutDragStartEvent, SceneGridRow, SceneObjectBase, SceneObjectRef, SceneObjectStateChangedEvent, SceneObjectUrlSyncConfig, SceneQueryRunner, SceneReactObject, SceneRefreshPicker,
|
3034
|
+
export { AdHocFiltersVariable, ConstantVariable, ControlsLabel, CustomVariable, DataProviderProxy, DataSourceVariable, EmbeddedScene, FieldConfigBuilder, FieldConfigBuilders, FieldConfigOverridesBuilder, GroupByVariable, IntervalVariable, LazyLoader, LocalValueVariable, MultiOrSingleValueSelect, MultiValueVariable, NestedScene, NewSceneObjectAddedEvent, PanelBuilders, PanelOptionsBuilders, QueryVariable, RuntimeDataSource, SafeSerializableSceneObject, SceneApp, SceneAppPage, SceneByFrameRepeater, SceneByVariableRepeater, SceneCSSGridItem, SceneCSSGridLayout, SceneCanvasText, SceneControlsSpacer, SceneDataLayerBase, SceneDataLayerControls, SceneDataLayerSet, SceneDataLayerSetBase, SceneDataNode, SceneDataTransformer, SceneDebugger, SceneFlexItem, SceneFlexLayout, SceneGridItem, SceneGridLayout, SceneGridLayoutDragStartEvent, SceneGridRow, SceneObjectBase, SceneObjectRef, SceneObjectStateChangedEvent, SceneObjectUrlSyncConfig, SceneQueryRunner, SceneReactObject, SceneRefreshPicker, SceneTimePicker, SceneTimeRange, SceneTimeRangeCompare, SceneTimeRangeTransformerBase, SceneTimeZoneOverride, SceneToolbarButton, SceneToolbarInput, SceneVariableSet, SceneVariableValueChangedEvent, ScopesVariable, SplitLayout, TestVariable, TextBoxVariable, UrlSyncContextProvider, UrlSyncManager, UserActionEvent, VariableDependencyConfig, VariableValueControl, VariableValueSelectWrapper, VariableValueSelectors, VizConfigBuilder, VizConfigBuilders, VizPanel, VizPanelBuilder, VizPanelExploreButton, VizPanelMenu, index$1 as behaviors, index as dataLayers, formatRegistry, getExploreURL, isCustomVariableValue, isDataLayer, isDataRequestEnricher, isFiltersRequestEnricher, isSceneObject, registerQueryWithController, registerRuntimeDataSource, sceneGraph, sceneUtils, useSceneApp, useSceneObjectState, useUrlSync };
|
3040
3035
|
export type { AdHocFilterWithLabels, CancelActivationHandler, ControlsLayout, CustomFormatterVariable, CustomTransformOperator, CustomTransformerDefinition, CustomVariableValue, DataLayerFilter, DataRequestEnricher, DeepPartial, EmbeddedSceneState, ExtraQueryDataProcessor, ExtraQueryDescriptor, ExtraQueryProvider, FiltersRequestEnricher, FormatVariable, InterpolationFormatParameter, MacroVariableConstructor, MultiValueVariableState, QueryRunnerState, SceneActivationHandler, SceneAppDrilldownView, SceneAppPageLike, SceneAppPageState, SceneAppRoute, SceneComponent, SceneComponentProps, SceneDataLayerProvider, SceneDataLayerProviderState, SceneDataProvider, SceneDataProviderResult, SceneDataQuery, SceneDataState, SceneDataTransformerState, SceneDeactivationHandler, SceneFlexItemLike, SceneFlexItemState, SceneGridItemLike, SceneGridItemStateLike, SceneInteractionProfileEvent, SceneLayout, SceneLayoutChildOptions, SceneLayoutState, SceneObject, SceneObjectState, SceneObjectStateChangedPayload, SceneObjectUrlSyncHandler, SceneObjectUrlValue, SceneObjectUrlValues, SceneObjectWithUrlSync, SceneQueryControllerEntry, SceneQueryControllerEntryType, SceneQueryControllerLike, SceneRefreshPickerState, SceneRouteMatch, SceneStateChangedHandler, SceneStatelessBehavior, SceneTimeRangeLike, SceneTimeRangeState, SceneUrlSyncOptions, SceneVariable, SceneVariableDependencyConfigLike, SceneVariableSetState, SceneVariableState, SceneVariables, UrlSyncManagerLike, UseStateHookOptions, ValidateAndUpdateResult, VariableCustomFormatterFn, VariableGetOptionsArgs, VariableValue, VariableValueOption, VariableValueSingle, VizConfig, VizPanelState };
|