Variables: Allow fetching disabled items for Item type variable (#2109)

This PR adds support for showing disabled items when using the `Item`
type template variable. Similar to how we support disabled items today
in our query editor:


<img width="435" height="254" alt="Screenshot 2025-10-21 at 9 00 11 AM"
src="https://github.com/user-attachments/assets/832537c8-84c3-45fe-a85d-b16c8e15f759"
/>

In this example, the host contains a disabled item `CPU iowait time`

<img width="1763" height="46" alt="Screenshot 2025-10-21 at 9 02 08 AM"
src="https://github.com/user-attachments/assets/85419e88-280d-4dce-baee-bf403e1de05d"
/>

Which we can now show and hide from the variable in Grafana:



https://github.com/user-attachments/assets/eca9327e-40a6-4852-92e9-71ff1ad9ea32

I also removed some deprecated types and packages :)!
Fixes: #2025

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Jocelyn Collado-Kuri
2025-10-28 19:57:55 -07:00
committed by GitHub
parent 045c708c69
commit 86b7328f39
5 changed files with 107 additions and 40 deletions

View File

@@ -1,4 +1,6 @@
import { BusEventWithPayload, DataSourceRef, SelectableValue } from '@grafana/data';
import { BusEventWithPayload } from '@grafana/data';
import { DataSourceRef } from '@grafana/schema';
import { ComboboxOption } from '@grafana/ui';
// The paths of these files have moved around in Grafana and they don't resolve properly
// either. Safer not to bother trying to import them just for type hinting.
@@ -60,7 +62,7 @@ export interface VariableQueryProps {
}
export interface VariableQueryData extends VariableQuery {
selectedQueryType: SelectableValue<VariableQueryTypes>;
selectedQueryType: ComboboxOption<VariableQueryTypes>;
legacyQuery?: string;
}
@@ -72,6 +74,7 @@ export interface VariableQuery {
itemTag?: string;
item?: string;
macro?: string;
showDisabledItems?: boolean;
}
export type LegacyVariableQuery = VariableQuery | string;