@grafana/scenes 6.47.0 → 6.47.1--canary.1303.19372012709.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/VizPanel/VizPanelRenderer.js +1 -1
- package/dist/esm/components/VizPanel/VizPanelRenderer.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js +6 -0
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js.map +1 -1
- package/dist/esm/variables/groupby/GroupByVariable.js +6 -0
- package/dist/esm/variables/groupby/GroupByVariable.js.map +1 -1
- package/dist/index.d.ts +10 -2
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1003,6 +1003,10 @@ declare class AdHocFiltersVariableUrlSyncHandler implements SceneObjectUrlSyncHa
|
|
|
1003
1003
|
updateFromUrl(values: SceneObjectUrlValues): void;
|
|
1004
1004
|
}
|
|
1005
1005
|
|
|
1006
|
+
interface DrilldownApplicabilitySupport {
|
|
1007
|
+
isApplicabilityEnabled: () => boolean;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1006
1010
|
interface AdHocFilterWithLabels<M extends Record<string, any> = {}> extends AdHocVariableFilter {
|
|
1007
1011
|
keyLabel?: string;
|
|
1008
1012
|
valueLabels?: string[];
|
|
@@ -1116,12 +1120,13 @@ type OperatorDefinition = {
|
|
|
1116
1120
|
isMulti?: Boolean;
|
|
1117
1121
|
isRegex?: Boolean;
|
|
1118
1122
|
};
|
|
1119
|
-
declare class AdHocFiltersVariable extends SceneObjectBase<AdHocFiltersVariableState> implements SceneVariable<AdHocFiltersVariableState
|
|
1123
|
+
declare class AdHocFiltersVariable extends SceneObjectBase<AdHocFiltersVariableState> implements SceneVariable<AdHocFiltersVariableState>, DrilldownApplicabilitySupport {
|
|
1120
1124
|
static Component: typeof AdHocFiltersVariableRenderer;
|
|
1121
1125
|
private _scopedVars;
|
|
1122
1126
|
private _dataSourceSrv;
|
|
1123
1127
|
private _originalValues;
|
|
1124
1128
|
private _prevScopes;
|
|
1129
|
+
private _applicabilityEnabled;
|
|
1125
1130
|
/** Needed for scopes dependency */
|
|
1126
1131
|
protected _variableDependency: VariableDependencyConfig<AdHocFiltersVariableState>;
|
|
1127
1132
|
protected _urlSync: AdHocFiltersVariableUrlSyncHandler;
|
|
@@ -1146,6 +1151,7 @@ declare class AdHocFiltersVariable extends SceneObjectBase<AdHocFiltersVariableS
|
|
|
1146
1151
|
_removeFilter(filter: AdHocFilterWithLabels): void;
|
|
1147
1152
|
_removeLastFilter(): void;
|
|
1148
1153
|
_handleComboboxBackspace(filter: AdHocFilterWithLabels): void;
|
|
1154
|
+
isApplicabilityEnabled(): boolean;
|
|
1149
1155
|
getFiltersApplicabilityForQueries(filters: AdHocFilterWithLabels[], queries: SceneDataQuery[]): Promise<DrilldownsApplicability[] | undefined>;
|
|
1150
1156
|
_verifyApplicability(): Promise<void>;
|
|
1151
1157
|
/**
|
|
@@ -1390,16 +1396,18 @@ type getTagKeysProvider = (set: GroupByVariable, currentKey: string | null) => P
|
|
|
1390
1396
|
replace?: boolean;
|
|
1391
1397
|
values: MetricFindValue[] | GetTagResponse;
|
|
1392
1398
|
}>;
|
|
1393
|
-
declare class GroupByVariable extends MultiValueVariable<GroupByVariableState> {
|
|
1399
|
+
declare class GroupByVariable extends MultiValueVariable<GroupByVariableState> implements DrilldownApplicabilitySupport {
|
|
1394
1400
|
static Component: typeof GroupByVariableRenderer;
|
|
1395
1401
|
isLazy: boolean;
|
|
1396
1402
|
protected _urlSync: SceneObjectUrlSyncHandler;
|
|
1403
|
+
private _applicabilityEnabled;
|
|
1397
1404
|
validateAndUpdate(): Observable<ValidateAndUpdateResult>;
|
|
1398
1405
|
private _updateValueGivenNewOptions;
|
|
1399
1406
|
getValueOptions(args: VariableGetOptionsArgs): Observable<VariableValueOption[]>;
|
|
1400
1407
|
constructor(initialState: Partial<GroupByVariableState>);
|
|
1401
1408
|
private _activationHandler;
|
|
1402
1409
|
getApplicableKeys(): VariableValue;
|
|
1410
|
+
isApplicabilityEnabled(): boolean;
|
|
1403
1411
|
getGroupByApplicabilityForQueries(value: VariableValue, queries: SceneDataQuery[]): Promise<DrilldownsApplicability[] | undefined>;
|
|
1404
1412
|
_verifyApplicability(): Promise<void>;
|
|
1405
1413
|
checkIfRestorable(values: VariableValue): boolean;
|
package/dist/index.js
CHANGED
|
@@ -3457,6 +3457,7 @@ class GroupByVariable extends MultiValueVariable {
|
|
|
3457
3457
|
});
|
|
3458
3458
|
this.isLazy = true;
|
|
3459
3459
|
this._urlSync = new GroupByVariableUrlSyncHandler(this);
|
|
3460
|
+
this._applicabilityEnabled = false;
|
|
3460
3461
|
this._activationHandler = () => {
|
|
3461
3462
|
this._verifyApplicability();
|
|
3462
3463
|
if (this.state.defaultValue) {
|
|
@@ -3588,6 +3589,9 @@ class GroupByVariable extends MultiValueVariable {
|
|
|
3588
3589
|
});
|
|
3589
3590
|
return applicableValues;
|
|
3590
3591
|
}
|
|
3592
|
+
isApplicabilityEnabled() {
|
|
3593
|
+
return this._applicabilityEnabled;
|
|
3594
|
+
}
|
|
3591
3595
|
async getGroupByApplicabilityForQueries(value, queries) {
|
|
3592
3596
|
const ds = await getDataSource(this.state.datasource, {
|
|
3593
3597
|
__sceneObject: wrapInSafeSerializableSceneObject(this)
|
|
@@ -3609,8 +3613,10 @@ class GroupByVariable extends MultiValueVariable {
|
|
|
3609
3613
|
const value = this.state.value;
|
|
3610
3614
|
const response = await this.getGroupByApplicabilityForQueries(value, queries);
|
|
3611
3615
|
if (!response) {
|
|
3616
|
+
this._applicabilityEnabled = false;
|
|
3612
3617
|
return;
|
|
3613
3618
|
}
|
|
3619
|
+
this._applicabilityEnabled = true;
|
|
3614
3620
|
if (!lodash.isEqual(response, this.state.keysApplicability)) {
|
|
3615
3621
|
this.setState({ keysApplicability: response != null ? response : void 0 });
|
|
3616
3622
|
this.publishEvent(new SceneVariableValueChangedEvent(this), true);
|
|
@@ -4032,7 +4038,7 @@ function VizPanelRenderer({ model }) {
|
|
|
4032
4038
|
})
|
|
4033
4039
|
);
|
|
4034
4040
|
} else if (isSceneObject(subHeader)) {
|
|
4035
|
-
subHeaderElement.push(/* @__PURE__ */ React__default.default.createElement(subHeader.Component, { model: subHeader }));
|
|
4041
|
+
subHeaderElement.push(/* @__PURE__ */ React__default.default.createElement(subHeader.Component, { model: subHeader, key: `${subHeader.state.key}` }));
|
|
4036
4042
|
} else {
|
|
4037
4043
|
subHeaderElement.push(subHeader);
|
|
4038
4044
|
}
|
|
@@ -7899,6 +7905,7 @@ class AdHocFiltersVariable extends SceneObjectBase {
|
|
|
7899
7905
|
// to its original value if edited at some point
|
|
7900
7906
|
this._originalValues = /* @__PURE__ */ new Map();
|
|
7901
7907
|
this._prevScopes = [];
|
|
7908
|
+
this._applicabilityEnabled = false;
|
|
7902
7909
|
/** Needed for scopes dependency */
|
|
7903
7910
|
this._variableDependency = new VariableDependencyConfig(this, {
|
|
7904
7911
|
dependsOnScopes: true,
|
|
@@ -8154,6 +8161,9 @@ class AdHocFiltersVariable extends SceneObjectBase {
|
|
|
8154
8161
|
});
|
|
8155
8162
|
}
|
|
8156
8163
|
}
|
|
8164
|
+
isApplicabilityEnabled() {
|
|
8165
|
+
return this._applicabilityEnabled;
|
|
8166
|
+
}
|
|
8157
8167
|
async getFiltersApplicabilityForQueries(filters, queries) {
|
|
8158
8168
|
const ds = await this._dataSourceSrv.get(this.state.datasource, this._scopedVars);
|
|
8159
8169
|
if (!ds || !ds.getDrilldownsApplicability) {
|
|
@@ -8174,8 +8184,10 @@ class AdHocFiltersVariable extends SceneObjectBase {
|
|
|
8174
8184
|
const queries = this.state.useQueriesAsFilterForOptions ? getQueriesForVariables(this) : void 0;
|
|
8175
8185
|
const response = await this.getFiltersApplicabilityForQueries(filters, queries != null ? queries : []);
|
|
8176
8186
|
if (!response) {
|
|
8187
|
+
this._applicabilityEnabled = false;
|
|
8177
8188
|
return;
|
|
8178
8189
|
}
|
|
8190
|
+
this._applicabilityEnabled = true;
|
|
8179
8191
|
const responseMap = /* @__PURE__ */ new Map();
|
|
8180
8192
|
response.forEach((filter) => {
|
|
8181
8193
|
responseMap.set(`${filter.key}${filter.origin ? `-${filter.origin}` : ""}`, filter);
|