Chore: Update Action interface (#93248)
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
co-authored by
Ryan McKinley
parent
026748a5ab
commit
d630e9bcb3
@@ -3,10 +3,18 @@ import { DataFrame, Field, ValueLinkConfig } from './dataFrame';
|
||||
import { InterpolateFunction } from './panel';
|
||||
import { SelectableValue } from './select';
|
||||
|
||||
export interface Action<T = ActionType.Fetch, TOptions = FetchOptions> {
|
||||
type: T;
|
||||
export enum ActionType {
|
||||
Fetch = 'fetch',
|
||||
}
|
||||
|
||||
export interface Action {
|
||||
type: ActionType;
|
||||
title: string;
|
||||
options: TOptions;
|
||||
|
||||
// Options for the selected type
|
||||
// Currently this is required because there is only one valid type (fetch)
|
||||
// once multiple types are valid, usage of this will need to be optional
|
||||
[ActionType.Fetch]: FetchOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -25,10 +33,6 @@ interface FetchOptions {
|
||||
headers?: Array<[string, string]>;
|
||||
}
|
||||
|
||||
export enum ActionType {
|
||||
Fetch = 'fetch',
|
||||
}
|
||||
|
||||
export enum HttpRequestMethod {
|
||||
POST = 'POST',
|
||||
PUT = 'PUT',
|
||||
@@ -51,7 +55,7 @@ export const contentTypeOptions: SelectableValue[] = [
|
||||
export const defaultActionConfig: Action = {
|
||||
type: ActionType.Fetch,
|
||||
title: '',
|
||||
options: {
|
||||
fetch: {
|
||||
url: '',
|
||||
method: HttpRequestMethod.POST,
|
||||
body: '{}',
|
||||
|
||||
Reference in New Issue
Block a user