mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Tempo: Reset metrics summary tag when scope changes (#74028)
Reset tag when scope changes
This commit is contained in:
parent
2cf4f641f2
commit
dc26cdf6c9
@ -63,6 +63,7 @@ describe('GroupByField', () => {
|
|||||||
const groupByFilter = query.groupBy?.find((f) => f.id === 'group-by-id');
|
const groupByFilter = query.groupBy?.find((f) => f.id === 'group-by-id');
|
||||||
expect(groupByFilter).not.toBeNull();
|
expect(groupByFilter).not.toBeNull();
|
||||||
expect(groupByFilter?.scope).toBe('resource');
|
expect(groupByFilter?.scope).toBe('resource');
|
||||||
|
expect(groupByFilter?.tag).toBe('');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -78,44 +78,45 @@ export const GroupByField = (props: Props) => {
|
|||||||
<div key={f.id}>
|
<div key={f.id}>
|
||||||
<HorizontalGroup spacing={'none'} width={'auto'}>
|
<HorizontalGroup spacing={'none'} width={'auto'}>
|
||||||
<Select
|
<Select
|
||||||
options={scopeOptions}
|
|
||||||
value={f.scope}
|
|
||||||
onChange={(v) => {
|
|
||||||
updateFilter({ ...f, scope: v?.value });
|
|
||||||
}}
|
|
||||||
placeholder="Select scope"
|
|
||||||
aria-label={`Select scope for filter ${i + 1}`}
|
aria-label={`Select scope for filter ${i + 1}`}
|
||||||
|
onChange={(v) => {
|
||||||
|
updateFilter({ ...f, scope: v?.value, tag: '' });
|
||||||
|
}}
|
||||||
|
options={scopeOptions}
|
||||||
|
placeholder="Select scope"
|
||||||
|
value={f.scope}
|
||||||
/>
|
/>
|
||||||
<Select
|
<Select
|
||||||
|
aria-label={`Select tag for filter ${i + 1}`}
|
||||||
|
isClearable
|
||||||
|
isLoading={isTagsLoading}
|
||||||
|
key={f.tag}
|
||||||
|
onChange={(v) => {
|
||||||
|
updateFilter({ ...f, tag: v?.value });
|
||||||
|
}}
|
||||||
options={getTags(f)?.map((t) => ({
|
options={getTags(f)?.map((t) => ({
|
||||||
label: t,
|
label: t,
|
||||||
value: t,
|
value: t,
|
||||||
}))}
|
}))}
|
||||||
value={f.tag || ''}
|
|
||||||
onChange={(v) => {
|
|
||||||
updateFilter({ ...f, tag: v?.value });
|
|
||||||
}}
|
|
||||||
placeholder="Select tag"
|
placeholder="Select tag"
|
||||||
aria-label={`Select tag for filter ${i + 1}`}
|
value={f.tag || ''}
|
||||||
isLoading={isTagsLoading}
|
|
||||||
isClearable
|
|
||||||
/>
|
/>
|
||||||
<AccessoryButton
|
<AccessoryButton
|
||||||
variant="secondary"
|
aria-label={`Remove tag for filter ${i + 1}`}
|
||||||
icon="times"
|
icon="times"
|
||||||
onClick={() => removeFilter(f)}
|
onClick={() => removeFilter(f)}
|
||||||
tooltip="Remove tag"
|
tooltip="Remove tag"
|
||||||
aria-label={`Remove tag for filter ${i + 1}`}
|
variant="secondary"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{i === (query.groupBy?.length ?? 0) - 1 && (
|
{i === (query.groupBy?.length ?? 0) - 1 && (
|
||||||
<span className={styles.addFilter}>
|
<span className={styles.addFilter}>
|
||||||
<AccessoryButton
|
<AccessoryButton
|
||||||
variant="secondary"
|
aria-label="Add tag"
|
||||||
icon="plus"
|
icon="plus"
|
||||||
onClick={() => addFilter()}
|
onClick={() => addFilter()}
|
||||||
tooltip="Add tag"
|
tooltip="Add tag"
|
||||||
aria-label="Add tag"
|
variant="secondary"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
Loading…
Reference in New Issue
Block a user