) => {
+ setReturnsMultiProps(e.currentTarget.checked);
+ variable.setState({ allowCustomValue: false });
+ variable.setState({ allValue: '' });
+ variable.setState({ regex: '' });
+ onStaticOptionsChange?.([]);
+ };
+
+ const optionsForSelect = variable.getOptionsForSelect(false);
+ const hasMultiProps = returnsMultiProps || optionsForSelect.every((o) => Boolean(o.properties));
+
return (
{selectedDatasource && VariableQueryEditor && (
-
+
+
+ {/* TODO: remove me after finished testing - each DS can/should implement their own UI */}
+
+ Check{' '}
+
+ our docs
+ {' '}
+ for more information.
+
+ }
+ noMargin
+ >
+
+
+
)}
-
-
- Optional, if you want to extract part of a series name or metric node segment.
-
-
-
- Named capture groups can be used to separate the display text and value (
-
- see examples
-
- ).
-
-
- }
- // eslint-disable-next-line @grafana/i18n/no-untranslated-strings
- placeholder="/.*-(?.*)-(?.*)-.*/"
- onBlur={onRegExChange}
- testId={selectors.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsRegExInputV2}
- width={52}
- />
+ {!returnsMultiProps && (
+
+
+ Optional, if you want to extract part of a series name or metric node segment.
+
+
+
+ Named capture groups can be used to separate the display text and value (
+
+ see examples
+
+ ).
+
+
+ }
+ // eslint-disable-next-line @grafana/i18n/no-untranslated-strings
+ placeholder="/.*-(?.*)-(?.*)-.*/"
+ onBlur={onRegExChange}
+ testId={selectors.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsRegExInputV2}
+ width={52}
+ />
+ )}
- {onStaticOptionsChange && onStaticOptionsOrderChange && (
+ {!returnsMultiProps && onStaticOptionsChange && onStaticOptionsOrderChange && (
)}
- {isHasVariableOptions && }
+ {isHasVariableOptions && }
);
}
diff --git a/public/app/features/dashboard-scene/settings/variables/useVariableSelectionOptionsCategory.tsx b/public/app/features/dashboard-scene/settings/variables/useVariableSelectionOptionsCategory.tsx
index 429c9221998..d8d0ecfdf28 100644
--- a/public/app/features/dashboard-scene/settings/variables/useVariableSelectionOptionsCategory.tsx
+++ b/public/app/features/dashboard-scene/settings/variables/useVariableSelectionOptionsCategory.tsx
@@ -45,7 +45,9 @@ export function useVariableSelectionOptionsCategory(variable: MultiValueVariable
'A wildcard regex or other value to represent All'
),
useShowIf: () => {
- return variable.useState().includeAll ?? false;
+ const state = variable.useState();
+ const hasJsonValuesFormat = 'valuesFormat' in state && state.valuesFormat === 'json';
+ return hasJsonValuesFormat ? false : (state.includeAll ?? false);
},
render: (descriptor) => ,
})
@@ -58,6 +60,11 @@ export function useVariableSelectionOptionsCategory(variable: MultiValueVariable
'dashboard.edit-pane.variable.selection-options.allow-custom-values-description',
'Enables users to enter values'
),
+ useShowIf: () => {
+ const state = variable.useState();
+ const hasJsonValuesFormat = 'valuesFormat' in state && state.valuesFormat === 'json';
+ return !hasJsonValuesFormat;
+ },
render: (descriptor) => ,
})
);