* refactor: convert module to typescript * refactor: covert utils to typescript * variable query editor WIP * variable editor: fix type error after grafana/ui update * variable editor: use FormLabel from grafana/ui * variable editor: refactor * variable editor: input validation and highlights * variable editor: fix tests * variable query: fix backward compatibility with empty queries * fix linter errors * variable editor: fix variable replacement in queries
31 lines
691 B
TypeScript
31 lines
691 B
TypeScript
import { SelectableValue } from "@grafana/data";
|
|
|
|
export interface VariableQueryProps {
|
|
query: LegacyVariableQuery;
|
|
onChange: (query: VariableQuery, definition: string) => void;
|
|
datasource: any;
|
|
templateSrv: any;
|
|
}
|
|
|
|
export interface VariableQueryData extends VariableQuery {
|
|
selectedQueryType: SelectableValue<VariableQueryTypes>;
|
|
legacyQuery?: string;
|
|
}
|
|
|
|
export interface VariableQuery {
|
|
queryType: VariableQueryTypes;
|
|
group?: string;
|
|
host?: string;
|
|
application?: string;
|
|
item?: string;
|
|
}
|
|
|
|
export type LegacyVariableQuery = VariableQuery | string;
|
|
|
|
export enum VariableQueryTypes {
|
|
Group = 'group',
|
|
Host = 'host',
|
|
Application = 'application',
|
|
Item = 'item',
|
|
}
|