Hide application filter for queries that do not support it, fixes #1643
This commit is contained in:
@@ -154,6 +154,8 @@ export const ProblemsQueryEditor = ({ query, datasource, onChange }: Props) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const supportsApplications = datasource.zabbix.supportsApplications();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<QueryEditorRow>
|
<QueryEditorRow>
|
||||||
@@ -186,15 +188,17 @@ export const ProblemsQueryEditor = ({ query, datasource, onChange }: Props) => {
|
|||||||
</InlineField>
|
</InlineField>
|
||||||
</QueryEditorRow>
|
</QueryEditorRow>
|
||||||
<QueryEditorRow>
|
<QueryEditorRow>
|
||||||
<InlineField label="Application" labelWidth={12}>
|
{supportsApplications && (
|
||||||
<MetricPicker
|
<InlineField label="Application" labelWidth={12}>
|
||||||
width={24}
|
<MetricPicker
|
||||||
value={query.application?.filter}
|
width={24}
|
||||||
options={appOptions}
|
value={query.application?.filter}
|
||||||
isLoading={appsLoading}
|
options={appOptions}
|
||||||
onChange={onFilterChange('application')}
|
isLoading={appsLoading}
|
||||||
/>
|
onChange={onFilterChange('application')}
|
||||||
</InlineField>
|
/>
|
||||||
|
</InlineField>
|
||||||
|
)}
|
||||||
<InlineField label="Problem" labelWidth={12}>
|
<InlineField label="Problem" labelWidth={12}>
|
||||||
<Input
|
<Input
|
||||||
width={24}
|
width={24}
|
||||||
@@ -205,7 +209,7 @@ export const ProblemsQueryEditor = ({ query, datasource, onChange }: Props) => {
|
|||||||
</InlineField>
|
</InlineField>
|
||||||
<InlineField label="Tags" labelWidth={12}>
|
<InlineField label="Tags" labelWidth={12}>
|
||||||
<Input
|
<Input
|
||||||
width={24}
|
width={36}
|
||||||
defaultValue={query.tags?.filter}
|
defaultValue={query.tags?.filter}
|
||||||
placeholder="tag1:value1, tag2:value2"
|
placeholder="tag1:value1, tag2:value2"
|
||||||
onBlur={onTextFilterChange('tags')}
|
onBlur={onTextFilterChange('tags')}
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ export const TriggersQueryEditor = ({ query, datasource, onChange }: Props) => {
|
|||||||
)}
|
)}
|
||||||
</QueryEditorRow>
|
</QueryEditorRow>
|
||||||
<QueryEditorRow>
|
<QueryEditorRow>
|
||||||
{(supportsApplications || query.countTriggersBy !== 'items') && (
|
{supportsApplications && (
|
||||||
<InlineField label="Application" labelWidth={12}>
|
<InlineField label="Application" labelWidth={12}>
|
||||||
<MetricPicker
|
<MetricPicker
|
||||||
width={24}
|
width={24}
|
||||||
@@ -292,14 +292,6 @@ export const TriggersQueryEditor = ({ query, datasource, onChange }: Props) => {
|
|||||||
onBlur={onTextFilterChange('trigger')}
|
onBlur={onTextFilterChange('trigger')}
|
||||||
/>
|
/>
|
||||||
</InlineField>
|
</InlineField>
|
||||||
<InlineField label="Tags" labelWidth={12}>
|
|
||||||
<Input
|
|
||||||
width={24}
|
|
||||||
defaultValue={query.tags?.filter}
|
|
||||||
placeholder="tag1:value1, tag2:value2"
|
|
||||||
onBlur={onTextFilterChange('tags')}
|
|
||||||
/>
|
|
||||||
</InlineField>
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{query.countTriggersBy === 'items' && (
|
{query.countTriggersBy === 'items' && (
|
||||||
@@ -313,6 +305,16 @@ export const TriggersQueryEditor = ({ query, datasource, onChange }: Props) => {
|
|||||||
/>
|
/>
|
||||||
</InlineField>
|
</InlineField>
|
||||||
)}
|
)}
|
||||||
|
{!supportsApplications && (
|
||||||
|
<InlineField label="Tags" labelWidth={12}>
|
||||||
|
<Input
|
||||||
|
width={24}
|
||||||
|
defaultValue={query.tags?.filter}
|
||||||
|
placeholder="tag1:value1, tag2:value2"
|
||||||
|
onBlur={onTextFilterChange('tags')}
|
||||||
|
/>
|
||||||
|
</InlineField>
|
||||||
|
)}
|
||||||
</QueryEditorRow>
|
</QueryEditorRow>
|
||||||
<QueryEditorRow>
|
<QueryEditorRow>
|
||||||
<InlineField label="Min severity" labelWidth={12}>
|
<InlineField label="Min severity" labelWidth={12}>
|
||||||
|
|||||||
Reference in New Issue
Block a user