mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Canvas: Add PUT to Canvas Button (#76844)
* Add PUT to canvas button * Update cue file to include PUT * Re run make gen cue * fix gen-cue --------- Co-authored-by: nmarrs <nathanielmarrs@gmail.com>
This commit is contained in:
parent
88957c7f44
commit
4f2bbd490f
@ -28,7 +28,7 @@ title: CanvasPanelCfg kind
|
|||||||
| `ConnectionPath` | string | **Yes** | | Possible values are: `straight`. |
|
| `ConnectionPath` | string | **Yes** | | Possible values are: `straight`. |
|
||||||
| `Constraint` | [object](#constraint) | **Yes** | | |
|
| `Constraint` | [object](#constraint) | **Yes** | | |
|
||||||
| `HorizontalConstraint` | string | **Yes** | | Possible values are: `left`, `right`, `leftright`, `center`, `scale`. |
|
| `HorizontalConstraint` | string | **Yes** | | Possible values are: `left`, `right`, `leftright`, `center`, `scale`. |
|
||||||
| `HttpRequestMethod` | string | **Yes** | | Possible values are: `GET`, `POST`. |
|
| `HttpRequestMethod` | string | **Yes** | | Possible values are: `GET`, `POST`, `PUT`. |
|
||||||
| `LineConfig` | [object](#lineconfig) | **Yes** | | |
|
| `LineConfig` | [object](#lineconfig) | **Yes** | | |
|
||||||
| `Options` | [object](#options) | **Yes** | | |
|
| `Options` | [object](#options) | **Yes** | | |
|
||||||
| `Placement` | [object](#placement) | **Yes** | | |
|
| `Placement` | [object](#placement) | **Yes** | | |
|
||||||
|
@ -65,6 +65,7 @@ export interface LineConfig {
|
|||||||
export enum HttpRequestMethod {
|
export enum HttpRequestMethod {
|
||||||
GET = 'GET',
|
GET = 'GET',
|
||||||
POST = 'POST',
|
POST = 'POST',
|
||||||
|
PUT = 'PUT',
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ConnectionCoordinates {
|
export interface ConnectionCoordinates {
|
||||||
|
@ -33,6 +33,7 @@ type Props = StandardEditorProps<APIEditorConfig>;
|
|||||||
const httpMethodOptions = [
|
const httpMethodOptions = [
|
||||||
{ label: HttpRequestMethod.GET, value: HttpRequestMethod.GET },
|
{ label: HttpRequestMethod.GET, value: HttpRequestMethod.GET },
|
||||||
{ label: HttpRequestMethod.POST, value: HttpRequestMethod.POST },
|
{ label: HttpRequestMethod.POST, value: HttpRequestMethod.POST },
|
||||||
|
{ label: HttpRequestMethod.PUT, value: HttpRequestMethod.PUT },
|
||||||
];
|
];
|
||||||
|
|
||||||
const contentTypeOptions: SelectableValue[] = [
|
const contentTypeOptions: SelectableValue[] = [
|
||||||
@ -157,7 +158,7 @@ export function APIEditor({ value, context, onChange }: Props) {
|
|||||||
<RadioButtonGroup value={value?.method} options={httpMethodOptions} onChange={onMethodChange} fullWidth />
|
<RadioButtonGroup value={value?.method} options={httpMethodOptions} onChange={onMethodChange} fullWidth />
|
||||||
</InlineField>
|
</InlineField>
|
||||||
</InlineFieldRow>
|
</InlineFieldRow>
|
||||||
{value?.method === HttpRequestMethod.POST && (
|
{value?.method !== HttpRequestMethod.GET && (
|
||||||
<InlineFieldRow>
|
<InlineFieldRow>
|
||||||
<InlineField label="Content-Type" labelWidth={LABEL_WIDTH} grow={true}>
|
<InlineField label="Content-Type" labelWidth={LABEL_WIDTH} grow={true}>
|
||||||
<Select
|
<Select
|
||||||
@ -178,7 +179,7 @@ export function APIEditor({ value, context, onChange }: Props) {
|
|||||||
<Field label="Header parameters">
|
<Field label="Header parameters">
|
||||||
<ParamsEditor value={value?.headerParams ?? []} onChange={onHeaderParamsChange} />
|
<ParamsEditor value={value?.headerParams ?? []} onChange={onHeaderParamsChange} />
|
||||||
</Field>
|
</Field>
|
||||||
{value?.method === HttpRequestMethod.POST && value?.contentType && (
|
{value?.method !== HttpRequestMethod.GET && value?.contentType && (
|
||||||
<Field label="Payload">
|
<Field label="Payload">
|
||||||
<StringValueEditor
|
<StringValueEditor
|
||||||
context={context}
|
context={context}
|
||||||
@ -190,7 +191,7 @@ export function APIEditor({ value, context, onChange }: Props) {
|
|||||||
)}
|
)}
|
||||||
{renderTestAPIButton(value)}
|
{renderTestAPIButton(value)}
|
||||||
<br />
|
<br />
|
||||||
{value?.method === HttpRequestMethod.POST &&
|
{value?.method !== HttpRequestMethod.GET &&
|
||||||
value?.contentType === defaultApiConfig.contentType &&
|
value?.contentType === defaultApiConfig.contentType &&
|
||||||
renderJSON(value?.data ?? '{}')}
|
renderJSON(value?.data ?? '{}')}
|
||||||
</>
|
</>
|
||||||
|
@ -56,7 +56,7 @@ composableKinds: PanelCfg: {
|
|||||||
width?: float64
|
width?: float64
|
||||||
} @cuetsy(kind="interface")
|
} @cuetsy(kind="interface")
|
||||||
|
|
||||||
HttpRequestMethod: "GET" | "POST" @cuetsy(kind="enum", memberNames="GET|POST")
|
HttpRequestMethod: "GET" | "POST" | "PUT" @cuetsy(kind="enum", memberNames="GET|POST|PUT")
|
||||||
|
|
||||||
ConnectionCoordinates: {
|
ConnectionCoordinates: {
|
||||||
x: float64
|
x: float64
|
||||||
|
@ -62,6 +62,7 @@ export interface LineConfig {
|
|||||||
export enum HttpRequestMethod {
|
export enum HttpRequestMethod {
|
||||||
GET = 'GET',
|
GET = 'GET',
|
||||||
POST = 'POST',
|
POST = 'POST',
|
||||||
|
PUT = 'PUT',
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ConnectionCoordinates {
|
export interface ConnectionCoordinates {
|
||||||
|
Loading…
Reference in New Issue
Block a user