@grafana/scenes 6.51.0 → 6.52.1--canary.1323.20573204293.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/CHANGELOG.md +13 -0
- package/dist/esm/packages/scenes/src/locales/en-US/grafana-scenes.json.js +4 -0
- package/dist/esm/packages/scenes/src/locales/en-US/grafana-scenes.json.js.map +1 -1
- package/dist/esm/packages/scenes/src/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersAlwaysWipCombobox.js +2 -2
- package/dist/esm/packages/scenes/src/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersAlwaysWipCombobox.js.map +1 -1
- package/dist/esm/packages/scenes/src/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.js +3 -1
- package/dist/esm/packages/scenes/src/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.js.map +1 -1
- package/dist/esm/packages/scenes/src/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersComboboxRenderer.js +115 -23
- package/dist/esm/packages/scenes/src/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersComboboxRenderer.js.map +1 -1
- package/dist/esm/packages/scenes/src/variables/adhoc/AdHocFiltersCombobox/utils.js +3 -0
- package/dist/esm/packages/scenes/src/variables/adhoc/AdHocFiltersCombobox/utils.js.map +1 -1
- package/dist/esm/packages/scenes/src/variables/adhoc/AdHocFiltersVariable.js +12 -0
- package/dist/esm/packages/scenes/src/variables/adhoc/AdHocFiltersVariable.js.map +1 -1
- package/dist/esm/packages/scenes/src/variables/adhoc/controller/AdHocFiltersVariableController.js +4 -0
- package/dist/esm/packages/scenes/src/variables/adhoc/controller/AdHocFiltersVariableController.js.map +1 -1
- package/dist/esm/packages/scenes/src/variables/groupby/GroupByVariable.js +30 -6
- package/dist/esm/packages/scenes/src/variables/groupby/GroupByVariable.js.map +1 -1
- package/dist/esm/packages/scenes/src/variables/interpolation/formatRegistry.js +2 -2
- package/dist/esm/packages/scenes/src/variables/interpolation/formatRegistry.js.map +1 -1
- package/dist/esm/packages/scenes/src/variables/variants/LocalValueVariable.js +7 -1
- package/dist/esm/packages/scenes/src/variables/variants/LocalValueVariable.js.map +1 -1
- package/dist/esm/packages/scenes/src/variables/variants/MultiValueVariable.js +22 -1
- package/dist/esm/packages/scenes/src/variables/variants/MultiValueVariable.js.map +1 -1
- package/dist/{grafana-scenes-C9F_2hih.js → grafana-scenes-DrGXYYn6.js} +5 -1
- package/dist/{grafana-scenes-C9F_2hih.js.map → grafana-scenes-DrGXYYn6.js.map} +1 -1
- package/dist/index.d.ts +25 -2
- package/dist/index.js +198 -36
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1128,6 +1128,11 @@ interface AdHocFiltersVariableState extends SceneVariableState {
|
|
|
1128
1128
|
* state for checking whether drilldown applicability is enabled
|
|
1129
1129
|
*/
|
|
1130
1130
|
applicabilityEnabled?: boolean;
|
|
1131
|
+
/**
|
|
1132
|
+
* When true, enables a collapse button that appears when filters wrap to multiple lines.
|
|
1133
|
+
* Allows users to collapse the filter UI to save vertical space.
|
|
1134
|
+
*/
|
|
1135
|
+
collapsible?: boolean;
|
|
1131
1136
|
/**
|
|
1132
1137
|
* enables drilldown recommendations
|
|
1133
1138
|
*/
|
|
@@ -1181,6 +1186,10 @@ declare class AdHocFiltersVariable extends SceneObjectBase<AdHocFiltersVariableS
|
|
|
1181
1186
|
forcePublish?: boolean;
|
|
1182
1187
|
}): void;
|
|
1183
1188
|
restoreOriginalFilter(filter: AdHocFilterWithLabels): void;
|
|
1189
|
+
/**
|
|
1190
|
+
* Clear all user-added filters and restore origin filters to their original values.
|
|
1191
|
+
*/
|
|
1192
|
+
clearAll(): void;
|
|
1184
1193
|
getValue(fieldPath?: string): VariableValue | undefined;
|
|
1185
1194
|
_updateFilter(filter: AdHocFilterWithLabels, update: Partial<AdHocFilterWithLabels>): void;
|
|
1186
1195
|
updateToMatchAll(filter: AdHocFilterWithLabels): void;
|
|
@@ -1265,7 +1274,7 @@ declare abstract class MultiValueVariable<TState extends MultiValueVariableState
|
|
|
1265
1274
|
protected interceptStateUpdateAfterValidation(stateUpdate: Partial<MultiValueVariableState>): void;
|
|
1266
1275
|
getValue(fieldPath?: string): VariableValue;
|
|
1267
1276
|
private getFieldAccessor;
|
|
1268
|
-
getValueText(): string;
|
|
1277
|
+
getValueText(fieldPath?: string): string;
|
|
1269
1278
|
hasAllValue(): boolean;
|
|
1270
1279
|
getDefaultMultiState(options: VariableValueOption[]): {
|
|
1271
1280
|
value: string[];
|
|
@@ -1462,6 +1471,11 @@ interface GroupByVariableState extends MultiValueVariableState {
|
|
|
1462
1471
|
* state for checking whether drilldown applicability is enabled
|
|
1463
1472
|
*/
|
|
1464
1473
|
applicabilityEnabled?: boolean;
|
|
1474
|
+
/**
|
|
1475
|
+
* Whether the input should be wide. For example, this is needed when dashboardAdHocAndGroupByWrapper feature toggle is enabled so that
|
|
1476
|
+
* the input fills the remaining space in the row.
|
|
1477
|
+
*/
|
|
1478
|
+
wideInput?: boolean;
|
|
1465
1479
|
/**
|
|
1466
1480
|
* enables drilldown recommendations
|
|
1467
1481
|
*/
|
|
@@ -2537,7 +2551,7 @@ declare class LocalValueVariable extends SceneObjectBase<LocalValueVariableState
|
|
|
2537
2551
|
constructor(initialState: Partial<LocalValueVariableState>);
|
|
2538
2552
|
getValue(fieldPath?: string): VariableValue;
|
|
2539
2553
|
private getFieldAccessor;
|
|
2540
|
-
getValueText(): string;
|
|
2554
|
+
getValueText(fieldPath?: string): string;
|
|
2541
2555
|
/**
|
|
2542
2556
|
* Checks the ancestor of our parent SceneVariableSet for loading state of a variable with the same name
|
|
2543
2557
|
* This function is unit tested from SceneVariableSet tests.
|
|
@@ -2557,6 +2571,10 @@ interface AdHocFiltersControllerState {
|
|
|
2557
2571
|
onAddCustomValue?: OnAddCustomValueFn;
|
|
2558
2572
|
wip?: AdHocFilterWithLabels;
|
|
2559
2573
|
inputPlaceholder?: string;
|
|
2574
|
+
/**
|
|
2575
|
+
* When true, enables a collapse button that appears when filters wrap to multiple lines.
|
|
2576
|
+
*/
|
|
2577
|
+
collapsible?: boolean;
|
|
2560
2578
|
valueRecommendations?: AdHocFiltersRecommendations;
|
|
2561
2579
|
drilldownRecommendationsEnabled?: boolean;
|
|
2562
2580
|
}
|
|
@@ -2627,6 +2645,10 @@ interface AdHocFiltersController {
|
|
|
2627
2645
|
* @param filter - The filter to restore
|
|
2628
2646
|
*/
|
|
2629
2647
|
restoreOriginalFilter(filter: AdHocFilterWithLabels): void;
|
|
2648
|
+
/**
|
|
2649
|
+
* Clear all user-added filters and restore origin filters to original values.
|
|
2650
|
+
*/
|
|
2651
|
+
clearAll?(): void;
|
|
2630
2652
|
/**
|
|
2631
2653
|
* Optional: Start profiling an interaction (for performance tracking).
|
|
2632
2654
|
* @param name - The interaction name
|
|
@@ -2665,6 +2687,7 @@ declare class AdHocFiltersVariableController implements AdHocFiltersController {
|
|
|
2665
2687
|
handleComboboxBackspace(filter: AdHocFilterWithLabels): void;
|
|
2666
2688
|
addWip(): void;
|
|
2667
2689
|
restoreOriginalFilter(filter: AdHocFilterWithLabels): void;
|
|
2690
|
+
clearAll(): void;
|
|
2668
2691
|
startProfile(name: string): void;
|
|
2669
2692
|
startInteraction(name: string): void;
|
|
2670
2693
|
stopInteraction(): void;
|
package/dist/index.js
CHANGED
|
@@ -15,11 +15,11 @@ var ui = require('@grafana/ui');
|
|
|
15
15
|
var e2eSelectors = require('@grafana/e2e-selectors');
|
|
16
16
|
var css = require('@emotion/css');
|
|
17
17
|
var uFuzzy = require('@leeoniya/ufuzzy');
|
|
18
|
+
var reactUse = require('react-use');
|
|
18
19
|
var react$1 = require('@floating-ui/react');
|
|
19
20
|
var reactVirtual = require('@tanstack/react-virtual');
|
|
20
21
|
var react = require('@emotion/react');
|
|
21
22
|
require('react-dom');
|
|
22
|
-
var reactUse = require('react-use');
|
|
23
23
|
var operators = require('rxjs/operators');
|
|
24
24
|
var ReactGridLayout = require('react-grid-layout');
|
|
25
25
|
var BarChartPanelCfg_types_gen = require('@grafana/schema/dist/esm/raw/composable/barchart/panelcfg/x/BarChartPanelCfg_types.gen');
|
|
@@ -1581,9 +1581,9 @@ const formatRegistry = new data.Registry(() => {
|
|
|
1581
1581
|
id: schema.VariableFormatID.Text,
|
|
1582
1582
|
name: "Text",
|
|
1583
1583
|
description: "Format variables in their text representation. Example in multi-variable scenario A + B + C.",
|
|
1584
|
-
formatter: (value, _args, variable) => {
|
|
1584
|
+
formatter: (value, _args, variable, fieldPath) => {
|
|
1585
1585
|
if (variable.getValueText) {
|
|
1586
|
-
return variable.getValueText();
|
|
1586
|
+
return variable.getValueText(fieldPath);
|
|
1587
1587
|
}
|
|
1588
1588
|
return String(value);
|
|
1589
1589
|
}
|
|
@@ -1918,10 +1918,31 @@ const _MultiValueVariable = class _MultiValueVariable extends SceneObjectBase {
|
|
|
1918
1918
|
}
|
|
1919
1919
|
return _MultiValueVariable.fieldAccessorCache[fieldPath] = lodash.property(fieldPath);
|
|
1920
1920
|
}
|
|
1921
|
-
getValueText() {
|
|
1921
|
+
getValueText(fieldPath) {
|
|
1922
1922
|
if (this.hasAllValue()) {
|
|
1923
1923
|
return ALL_VARIABLE_TEXT;
|
|
1924
1924
|
}
|
|
1925
|
+
if (fieldPath != null) {
|
|
1926
|
+
const accessor = this.getFieldAccessor(fieldPath);
|
|
1927
|
+
if (Array.isArray(this.state.value)) {
|
|
1928
|
+
const index = parseInt(fieldPath, 10);
|
|
1929
|
+
if (!isNaN(index) && index >= 0 && index < this.state.value.length) {
|
|
1930
|
+
const option = this.state.options[index];
|
|
1931
|
+
if (option) {
|
|
1932
|
+
return String(option.label);
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
return this.state.value.map((v) => {
|
|
1936
|
+
const option = this.state.options.find((o) => o.value === v);
|
|
1937
|
+
return option ? accessor(option.properties) : v;
|
|
1938
|
+
}).join(" + ");
|
|
1939
|
+
} else {
|
|
1940
|
+
const option = this.state.options.find((o) => o.value === this.state.value);
|
|
1941
|
+
if (option) {
|
|
1942
|
+
return String(accessor(option.properties));
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1925
1946
|
if (Array.isArray(this.state.text)) {
|
|
1926
1947
|
return this.state.text.join(" + ");
|
|
1927
1948
|
}
|
|
@@ -4614,6 +4635,9 @@ const generatePlaceholder = (filter, filterInputType, isMultiValueEdit, isAlways
|
|
|
4614
4635
|
}
|
|
4615
4636
|
return ((_a = filter.valueLabels) == null ? void 0 : _a[0]) || "";
|
|
4616
4637
|
}
|
|
4638
|
+
if (isAlwaysWip && filterInputType === "operator") {
|
|
4639
|
+
return "";
|
|
4640
|
+
}
|
|
4617
4641
|
return filter[filterInputType] && !isAlwaysWip ? `${filter[filterInputType]}` : inputPlaceholder || INPUT_PLACEHOLDER_DEFAULT;
|
|
4618
4642
|
};
|
|
4619
4643
|
const populateInputValueOnInputTypeSwitch = ({
|
|
@@ -4802,7 +4826,8 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({
|
|
|
4802
4826
|
isAlwaysWip,
|
|
4803
4827
|
handleChangeViewMode,
|
|
4804
4828
|
focusOnWipInputRef,
|
|
4805
|
-
populateInputOnEdit
|
|
4829
|
+
populateInputOnEdit,
|
|
4830
|
+
onInputClick
|
|
4806
4831
|
}, parentRef) {
|
|
4807
4832
|
var _a, _b, _c;
|
|
4808
4833
|
const [open, setOpen] = React.useState(false);
|
|
@@ -5285,6 +5310,7 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({
|
|
|
5285
5310
|
className: css.cx(styles.inputStyle, { [styles.loadingInputPadding]: !optionsLoading }),
|
|
5286
5311
|
onClick: (event) => {
|
|
5287
5312
|
event.stopPropagation();
|
|
5313
|
+
onInputClick == null ? void 0 : onInputClick();
|
|
5288
5314
|
setOpen(true);
|
|
5289
5315
|
},
|
|
5290
5316
|
onFocus: () => {
|
|
@@ -5746,53 +5772,100 @@ const getStyles$d = (theme) => ({
|
|
|
5746
5772
|
...getNonApplicablePillStyles(theme)
|
|
5747
5773
|
});
|
|
5748
5774
|
|
|
5749
|
-
const AdHocFiltersAlwaysWipCombobox = React.forwardRef(function AdHocFiltersAlwaysWipCombobox2({ controller }, parentRef) {
|
|
5775
|
+
const AdHocFiltersAlwaysWipCombobox = React.forwardRef(function AdHocFiltersAlwaysWipCombobox2({ controller, onInputClick }, parentRef) {
|
|
5750
5776
|
const { wip } = controller.useState();
|
|
5751
5777
|
React.useLayoutEffect(() => {
|
|
5752
5778
|
if (!wip) {
|
|
5753
5779
|
controller.addWip();
|
|
5754
5780
|
}
|
|
5755
5781
|
}, [wip]);
|
|
5756
|
-
return /* @__PURE__ */ React__default.default.createElement(AdHocCombobox, { controller, filter: wip, isAlwaysWip: true, ref: parentRef });
|
|
5782
|
+
return /* @__PURE__ */ React__default.default.createElement(AdHocCombobox, { controller, filter: wip, isAlwaysWip: true, ref: parentRef, onInputClick });
|
|
5757
5783
|
});
|
|
5758
5784
|
|
|
5785
|
+
const MAX_VISIBLE_FILTERS = 5;
|
|
5759
5786
|
const AdHocFiltersComboboxRenderer = React.memo(function AdHocFiltersComboboxRenderer2({ controller }) {
|
|
5760
|
-
|
|
5787
|
+
var _a;
|
|
5788
|
+
const { originFilters, filters, readOnly, collapsible, valueRecommendations } = controller.useState();
|
|
5761
5789
|
const styles = ui.useStyles2(getStyles$c);
|
|
5790
|
+
const theme = ui.useTheme2();
|
|
5791
|
+
const [collapsed, setCollapsed] = React.useState(true);
|
|
5792
|
+
const [wrapperRef, { height: wrapperHeight }] = reactUse.useMeasure();
|
|
5793
|
+
const clearAll = () => {
|
|
5794
|
+
var _a2;
|
|
5795
|
+
(_a2 = controller.clearAll) == null ? void 0 : _a2.call(controller);
|
|
5796
|
+
};
|
|
5762
5797
|
const focusOnWipInputRef = React.useRef();
|
|
5798
|
+
const singleLineThreshold = theme.spacing.gridSize * 5;
|
|
5799
|
+
const isMultiLine = collapsible && wrapperHeight > singleLineThreshold;
|
|
5800
|
+
const handleCollapseToggle = (event) => {
|
|
5801
|
+
event.stopPropagation();
|
|
5802
|
+
if (collapsible) {
|
|
5803
|
+
setCollapsed(true);
|
|
5804
|
+
}
|
|
5805
|
+
};
|
|
5806
|
+
const handleExpand = () => {
|
|
5807
|
+
var _a2, _b;
|
|
5808
|
+
if (!collapsible) {
|
|
5809
|
+
(_a2 = focusOnWipInputRef.current) == null ? void 0 : _a2.call(focusOnWipInputRef);
|
|
5810
|
+
return;
|
|
5811
|
+
}
|
|
5812
|
+
if (collapsed) {
|
|
5813
|
+
setCollapsed(false);
|
|
5814
|
+
} else {
|
|
5815
|
+
(_b = focusOnWipInputRef.current) == null ? void 0 : _b.call(focusOnWipInputRef);
|
|
5816
|
+
}
|
|
5817
|
+
};
|
|
5818
|
+
const visibleOriginFilters = (_a = originFilters == null ? void 0 : originFilters.filter((f) => f.origin)) != null ? _a : [];
|
|
5819
|
+
const visibleFilters = filters.filter((f) => !f.hidden);
|
|
5820
|
+
const allFilters = [...visibleOriginFilters, ...visibleFilters];
|
|
5821
|
+
const totalFiltersCount = allFilters.length;
|
|
5822
|
+
const shouldCollapse = collapsible && collapsed && totalFiltersCount > 0;
|
|
5823
|
+
const filtersToRender = shouldCollapse ? allFilters.slice(0, MAX_VISIBLE_FILTERS) : allFilters;
|
|
5824
|
+
React.useEffect(() => {
|
|
5825
|
+
if (collapsible && totalFiltersCount === 0 && collapsed) {
|
|
5826
|
+
setCollapsed(false);
|
|
5827
|
+
}
|
|
5828
|
+
}, [collapsible, totalFiltersCount, collapsed]);
|
|
5829
|
+
const showCollapseButton = collapsible && isMultiLine && !collapsed;
|
|
5763
5830
|
return /* @__PURE__ */ React__default.default.createElement(
|
|
5764
5831
|
"div",
|
|
5765
5832
|
{
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5833
|
+
ref: wrapperRef,
|
|
5834
|
+
className: css.cx(styles.comboboxWrapper, {
|
|
5835
|
+
[styles.comboboxFocusOutline]: !readOnly,
|
|
5836
|
+
[styles.collapsed]: shouldCollapse,
|
|
5837
|
+
[styles.clickableCollapsed]: shouldCollapse
|
|
5838
|
+
}),
|
|
5839
|
+
onClick: handleExpand
|
|
5771
5840
|
},
|
|
5772
5841
|
/* @__PURE__ */ React__default.default.createElement(ui.Icon, { name: "filter", className: styles.filterIcon, size: "lg" }),
|
|
5773
5842
|
valueRecommendations && /* @__PURE__ */ React__default.default.createElement(valueRecommendations.Component, { model: valueRecommendations }),
|
|
5774
|
-
|
|
5775
|
-
(filter, index) => filter.origin ? /* @__PURE__ */ React__default.default.createElement(
|
|
5776
|
-
AdHocFilterPill,
|
|
5777
|
-
{
|
|
5778
|
-
key: `${index}-${filter.key}`,
|
|
5779
|
-
filter,
|
|
5780
|
-
controller,
|
|
5781
|
-
focusOnWipInputRef: focusOnWipInputRef.current
|
|
5782
|
-
}
|
|
5783
|
-
) : null
|
|
5784
|
-
),
|
|
5785
|
-
filters.filter((filter) => !filter.hidden).map((filter, index) => /* @__PURE__ */ React__default.default.createElement(
|
|
5843
|
+
filtersToRender.map((filter, index) => /* @__PURE__ */ React__default.default.createElement(
|
|
5786
5844
|
AdHocFilterPill,
|
|
5787
5845
|
{
|
|
5788
|
-
key: `${index}-${filter.key}`,
|
|
5846
|
+
key: `${filter.origin ? "origin-" : ""}${index}-${filter.key}`,
|
|
5789
5847
|
filter,
|
|
5790
5848
|
controller,
|
|
5791
5849
|
readOnly: readOnly || filter.readOnly,
|
|
5792
5850
|
focusOnWipInputRef: focusOnWipInputRef.current
|
|
5793
5851
|
}
|
|
5794
5852
|
)),
|
|
5795
|
-
!readOnly ? /* @__PURE__ */ React__default.default.createElement(AdHocFiltersAlwaysWipCombobox, { controller, ref: focusOnWipInputRef }) : null
|
|
5853
|
+
!readOnly && !shouldCollapse ? /* @__PURE__ */ React__default.default.createElement(AdHocFiltersAlwaysWipCombobox, { controller, ref: focusOnWipInputRef }) : null,
|
|
5854
|
+
/* @__PURE__ */ React__default.default.createElement("div", { className: styles.rightControls }, showCollapseButton && /* @__PURE__ */ React__default.default.createElement(
|
|
5855
|
+
ui.Button,
|
|
5856
|
+
{
|
|
5857
|
+
className: styles.collapseButton,
|
|
5858
|
+
fill: "text",
|
|
5859
|
+
onClick: handleCollapseToggle,
|
|
5860
|
+
"aria-label": i18n.t(
|
|
5861
|
+
"grafana-scenes.variables.adhoc-filters-combobox-renderer.collapse-filters",
|
|
5862
|
+
"Collapse filters"
|
|
5863
|
+
),
|
|
5864
|
+
"aria-expanded": !collapsed
|
|
5865
|
+
},
|
|
5866
|
+
i18n.t("grafana-scenes.variables.adhoc-filters-combobox-renderer.collapse", "Collapse"),
|
|
5867
|
+
/* @__PURE__ */ React__default.default.createElement(ui.Icon, { name: "angle-up", size: "md" })
|
|
5868
|
+
), /* @__PURE__ */ React__default.default.createElement("div", { className: styles.clearAllButton }, /* @__PURE__ */ React__default.default.createElement(ui.Icon, { name: "times", size: "md", onClick: clearAll })), shouldCollapse && /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, totalFiltersCount > MAX_VISIBLE_FILTERS && /* @__PURE__ */ React__default.default.createElement("span", { className: styles.moreIndicator }, "(+", totalFiltersCount - MAX_VISIBLE_FILTERS, ")"), /* @__PURE__ */ React__default.default.createElement(ui.Icon, { name: "angle-down", className: styles.dropdownIndicator })))
|
|
5796
5869
|
);
|
|
5797
5870
|
});
|
|
5798
5871
|
const getStyles$c = (theme) => ({
|
|
@@ -5808,7 +5881,8 @@ const getStyles$c = (theme) => ({
|
|
|
5808
5881
|
borderRadius: theme.shape.radius.default,
|
|
5809
5882
|
paddingInline: theme.spacing(1),
|
|
5810
5883
|
paddingBlock: theme.spacing(0.5),
|
|
5811
|
-
flexGrow: 1
|
|
5884
|
+
flexGrow: 1,
|
|
5885
|
+
width: "100%"
|
|
5812
5886
|
}),
|
|
5813
5887
|
comboboxFocusOutline: css.css({
|
|
5814
5888
|
"&:focus-within": {
|
|
@@ -5824,6 +5898,48 @@ const getStyles$c = (theme) => ({
|
|
|
5824
5898
|
filterIcon: css.css({
|
|
5825
5899
|
color: theme.colors.text.secondary,
|
|
5826
5900
|
alignSelf: "center"
|
|
5901
|
+
}),
|
|
5902
|
+
collapsed: css.css({
|
|
5903
|
+
flexWrap: "nowrap",
|
|
5904
|
+
overflow: "hidden"
|
|
5905
|
+
}),
|
|
5906
|
+
clickableCollapsed: css.css({
|
|
5907
|
+
cursor: "pointer",
|
|
5908
|
+
"&:hover": {
|
|
5909
|
+
borderColor: theme.colors.border.medium
|
|
5910
|
+
}
|
|
5911
|
+
}),
|
|
5912
|
+
rightControls: css.css({
|
|
5913
|
+
display: "flex",
|
|
5914
|
+
alignItems: "center",
|
|
5915
|
+
marginLeft: "auto",
|
|
5916
|
+
flexShrink: 0
|
|
5917
|
+
}),
|
|
5918
|
+
moreIndicator: css.css({
|
|
5919
|
+
color: theme.colors.text.secondary,
|
|
5920
|
+
whiteSpace: "nowrap"
|
|
5921
|
+
}),
|
|
5922
|
+
dropdownIndicator: css.css({
|
|
5923
|
+
color: theme.colors.text.secondary,
|
|
5924
|
+
flexShrink: 0
|
|
5925
|
+
}),
|
|
5926
|
+
collapseButton: css.css({
|
|
5927
|
+
color: theme.colors.text.secondary,
|
|
5928
|
+
padding: 0,
|
|
5929
|
+
fontSize: theme.typography.bodySmall.fontSize,
|
|
5930
|
+
border: "none",
|
|
5931
|
+
"&:hover": {
|
|
5932
|
+
background: "transparent",
|
|
5933
|
+
color: theme.colors.text.primary
|
|
5934
|
+
}
|
|
5935
|
+
}),
|
|
5936
|
+
clearAllButton: css.css({
|
|
5937
|
+
fontSize: theme.typography.bodySmall.fontSize,
|
|
5938
|
+
cursor: "pointer",
|
|
5939
|
+
color: theme.colors.text.secondary,
|
|
5940
|
+
"&:hover": {
|
|
5941
|
+
color: theme.colors.text.primary
|
|
5942
|
+
}
|
|
5827
5943
|
})
|
|
5828
5944
|
});
|
|
5829
5945
|
|
|
@@ -5928,6 +6044,7 @@ class AdHocFiltersVariableController {
|
|
|
5928
6044
|
supportsMultiValueOperators: state.supportsMultiValueOperators,
|
|
5929
6045
|
onAddCustomValue: state.onAddCustomValue,
|
|
5930
6046
|
wip: state._wip,
|
|
6047
|
+
collapsible: state.collapsible,
|
|
5931
6048
|
valueRecommendations: this.model.getRecommendations(),
|
|
5932
6049
|
drilldownRecommendationsEnabled: state.drilldownRecommendationsEnabled
|
|
5933
6050
|
};
|
|
@@ -5965,6 +6082,9 @@ class AdHocFiltersVariableController {
|
|
|
5965
6082
|
restoreOriginalFilter(filter) {
|
|
5966
6083
|
this.model.restoreOriginalFilter(filter);
|
|
5967
6084
|
}
|
|
6085
|
+
clearAll() {
|
|
6086
|
+
this.model.clearAll();
|
|
6087
|
+
}
|
|
5968
6088
|
startProfile(name) {
|
|
5969
6089
|
const queryController = getQueryController(this.model);
|
|
5970
6090
|
queryController == null ? void 0 : queryController.startProfile(name);
|
|
@@ -6196,6 +6316,18 @@ class AdHocFiltersVariable extends SceneObjectBase {
|
|
|
6196
6316
|
this._updateFilter(filter, original);
|
|
6197
6317
|
}
|
|
6198
6318
|
}
|
|
6319
|
+
/**
|
|
6320
|
+
* Clear all user-added filters and restore origin filters to their original values.
|
|
6321
|
+
*/
|
|
6322
|
+
clearAll() {
|
|
6323
|
+
var _a;
|
|
6324
|
+
(_a = this.state.originFilters) == null ? void 0 : _a.forEach((filter) => {
|
|
6325
|
+
if (filter.restorable) {
|
|
6326
|
+
this.restoreOriginalFilter(filter);
|
|
6327
|
+
}
|
|
6328
|
+
});
|
|
6329
|
+
this.setState({ filters: [] });
|
|
6330
|
+
}
|
|
6199
6331
|
getValue(fieldPath) {
|
|
6200
6332
|
if (fieldPath === ORIGIN_FILTERS_KEY) {
|
|
6201
6333
|
const originFilters = this.state.originFilters;
|
|
@@ -7064,6 +7196,7 @@ class GroupByVariable extends MultiValueVariable {
|
|
|
7064
7196
|
}
|
|
7065
7197
|
GroupByVariable.Component = GroupByVariableRenderer;
|
|
7066
7198
|
function GroupByVariableRenderer({ model }) {
|
|
7199
|
+
var _a, _b;
|
|
7067
7200
|
const {
|
|
7068
7201
|
value,
|
|
7069
7202
|
text,
|
|
@@ -7084,10 +7217,10 @@ function GroupByVariableRenderer({ model }) {
|
|
|
7084
7217
|
const arrayValue = lodash.isArray(value) ? value : [value];
|
|
7085
7218
|
const arrayText = lodash.isArray(text) ? text : [text];
|
|
7086
7219
|
return arrayValue.map((value2, idx) => {
|
|
7087
|
-
var
|
|
7220
|
+
var _a2;
|
|
7088
7221
|
return {
|
|
7089
7222
|
value: value2,
|
|
7090
|
-
label: String((
|
|
7223
|
+
label: String((_a2 = arrayText[idx]) != null ? _a2 : value2)
|
|
7091
7224
|
};
|
|
7092
7225
|
});
|
|
7093
7226
|
}, [value, text]);
|
|
@@ -7118,7 +7251,8 @@ function GroupByVariableRenderer({ model }) {
|
|
|
7118
7251
|
() => handleOptionGroups(optionSearcher(inputValue).map(toSelectableValue)),
|
|
7119
7252
|
[optionSearcher, inputValue]
|
|
7120
7253
|
);
|
|
7121
|
-
const
|
|
7254
|
+
const WideInputWrapper = (children) => /* @__PURE__ */ React__default.default.createElement("div", { className: styles.selectWrapper }, children);
|
|
7255
|
+
const select = isMulti ? /* @__PURE__ */ React__default.default.createElement(ConditionalWrapper, { condition: (_a = model.state.wideInput) != null ? _a : false, wrapper: WideInputWrapper }, /* @__PURE__ */ React__default.default.createElement(
|
|
7122
7256
|
ui.MultiSelect,
|
|
7123
7257
|
{
|
|
7124
7258
|
"aria-label": i18n.t(
|
|
@@ -7188,7 +7322,7 @@ function GroupByVariableRenderer({ model }) {
|
|
|
7188
7322
|
setIsOptionsOpen(false);
|
|
7189
7323
|
}
|
|
7190
7324
|
}
|
|
7191
|
-
) : /* @__PURE__ */ React__default.default.createElement(
|
|
7325
|
+
)) : /* @__PURE__ */ React__default.default.createElement(ConditionalWrapper, { condition: (_b = model.state.wideInput) != null ? _b : false, wrapper: WideInputWrapper }, /* @__PURE__ */ React__default.default.createElement(
|
|
7192
7326
|
ui.Select,
|
|
7193
7327
|
{
|
|
7194
7328
|
"aria-label": i18n.t(
|
|
@@ -7202,7 +7336,6 @@ function GroupByVariableRenderer({ model }) {
|
|
|
7202
7336
|
"Group by label"
|
|
7203
7337
|
),
|
|
7204
7338
|
width: "auto",
|
|
7205
|
-
className: css.cx(drilldownRecommendationsEnabled && styles.selectStylesInWrapper),
|
|
7206
7339
|
inputValue,
|
|
7207
7340
|
value: uncommittedValue && uncommittedValue.length > 0 ? uncommittedValue : null,
|
|
7208
7341
|
allowCustomValue,
|
|
@@ -7246,12 +7379,19 @@ function GroupByVariableRenderer({ model }) {
|
|
|
7246
7379
|
setIsOptionsOpen(false);
|
|
7247
7380
|
}
|
|
7248
7381
|
}
|
|
7249
|
-
);
|
|
7382
|
+
));
|
|
7250
7383
|
if (!recommendations) {
|
|
7251
7384
|
return select;
|
|
7252
7385
|
}
|
|
7253
7386
|
return /* @__PURE__ */ React__default.default.createElement("div", { className: styles.wrapper }, /* @__PURE__ */ React__default.default.createElement("div", { className: styles.recommendations }, /* @__PURE__ */ React__default.default.createElement(recommendations.Component, { model: recommendations })), select);
|
|
7254
7387
|
}
|
|
7388
|
+
const ConditionalWrapper = ({
|
|
7389
|
+
condition,
|
|
7390
|
+
wrapper,
|
|
7391
|
+
children
|
|
7392
|
+
}) => {
|
|
7393
|
+
return condition ? wrapper(children) : /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, children);
|
|
7394
|
+
};
|
|
7255
7395
|
const filterNoOp = () => true;
|
|
7256
7396
|
function WideMenu(props) {
|
|
7257
7397
|
return /* @__PURE__ */ React__default.default.createElement(components.Menu, { ...props }, /* @__PURE__ */ React__default.default.createElement("div", { style: { minWidth: "220px" } }, props.children));
|
|
@@ -7268,6 +7408,22 @@ function toSelectableValue(input) {
|
|
|
7268
7408
|
return result;
|
|
7269
7409
|
}
|
|
7270
7410
|
const getStyles$a = (theme) => ({
|
|
7411
|
+
selectWrapper: css.css({
|
|
7412
|
+
display: "flex",
|
|
7413
|
+
minWidth: 0,
|
|
7414
|
+
width: "100%"
|
|
7415
|
+
}),
|
|
7416
|
+
// Fix for noMultiValueWrap grid layout - prevent pills from stretching
|
|
7417
|
+
// when the select is full width. The grid layout uses gridAutoFlow: column
|
|
7418
|
+
// which stretches items by default.
|
|
7419
|
+
fullWidthMultiSelect: css.css({
|
|
7420
|
+
width: "100%",
|
|
7421
|
+
// Target the value container (has data-testid) which uses grid layout
|
|
7422
|
+
"& [data-testid]": {
|
|
7423
|
+
gridAutoColumns: "max-content",
|
|
7424
|
+
justifyItems: "start"
|
|
7425
|
+
}
|
|
7426
|
+
}),
|
|
7271
7427
|
wrapper: css.css({
|
|
7272
7428
|
display: "flex"
|
|
7273
7429
|
}),
|
|
@@ -10687,7 +10843,13 @@ const _LocalValueVariable = class _LocalValueVariable extends SceneObjectBase {
|
|
|
10687
10843
|
}
|
|
10688
10844
|
return _LocalValueVariable.fieldAccessorCache[fieldPath] = lodash.property(fieldPath);
|
|
10689
10845
|
}
|
|
10690
|
-
getValueText() {
|
|
10846
|
+
getValueText(fieldPath) {
|
|
10847
|
+
if (fieldPath && this.state.properties) {
|
|
10848
|
+
const value = this.getFieldAccessor(fieldPath)(this.state.properties);
|
|
10849
|
+
if (value != null) {
|
|
10850
|
+
return String(value);
|
|
10851
|
+
}
|
|
10852
|
+
}
|
|
10691
10853
|
return this.state.text.toString();
|
|
10692
10854
|
}
|
|
10693
10855
|
/**
|
|
@@ -16807,7 +16969,7 @@ function __variableDynamicImportRuntime0__(path) {
|
|
|
16807
16969
|
switch (path) {
|
|
16808
16970
|
case '../locales/cs-CZ/grafana-scenes.json': return Promise.resolve().then(function () { return require('./grafana-scenes-DPdlSPjz.js'); });
|
|
16809
16971
|
case '../locales/de-DE/grafana-scenes.json': return Promise.resolve().then(function () { return require('./grafana-scenes-BHIE4ld0.js'); });
|
|
16810
|
-
case '../locales/en-US/grafana-scenes.json': return Promise.resolve().then(function () { return require('./grafana-scenes-
|
|
16972
|
+
case '../locales/en-US/grafana-scenes.json': return Promise.resolve().then(function () { return require('./grafana-scenes-DrGXYYn6.js'); });
|
|
16811
16973
|
case '../locales/es-ES/grafana-scenes.json': return Promise.resolve().then(function () { return require('./grafana-scenes-D4tq59Dc.js'); });
|
|
16812
16974
|
case '../locales/fr-FR/grafana-scenes.json': return Promise.resolve().then(function () { return require('./grafana-scenes-Ce77KCbO.js'); });
|
|
16813
16975
|
case '../locales/hu-HU/grafana-scenes.json': return Promise.resolve().then(function () { return require('./grafana-scenes-DMYCnFop.js'); });
|