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`. |
|
||||
| `Constraint` | [object](#constraint) | **Yes** | | |
|
||||
| `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** | | |
|
||||
| `Options` | [object](#options) | **Yes** | | |
|
||||
| `Placement` | [object](#placement) | **Yes** | | |
|
||||
|
@ -65,6 +65,7 @@ export interface LineConfig {
|
||||
export enum HttpRequestMethod {
|
||||
GET = 'GET',
|
||||
POST = 'POST',
|
||||
PUT = 'PUT',
|
||||
}
|
||||
|
||||
export interface ConnectionCoordinates {
|
||||
|
@ -33,6 +33,7 @@ type Props = StandardEditorProps<APIEditorConfig>;
|
||||
const httpMethodOptions = [
|
||||
{ label: HttpRequestMethod.GET, value: HttpRequestMethod.GET },
|
||||
{ label: HttpRequestMethod.POST, value: HttpRequestMethod.POST },
|
||||
{ label: HttpRequestMethod.PUT, value: HttpRequestMethod.PUT },
|
||||
];
|
||||
|
||||
const contentTypeOptions: SelectableValue[] = [
|
||||
@ -157,7 +158,7 @@ export function APIEditor({ value, context, onChange }: Props) {
|
||||
<RadioButtonGroup value={value?.method} options={httpMethodOptions} onChange={onMethodChange} fullWidth />
|
||||
</InlineField>
|
||||
</InlineFieldRow>
|
||||
{value?.method === HttpRequestMethod.POST && (
|
||||
{value?.method !== HttpRequestMethod.GET && (
|
||||
<InlineFieldRow>
|
||||
<InlineField label="Content-Type" labelWidth={LABEL_WIDTH} grow={true}>
|
||||
<Select
|
||||
@ -178,7 +179,7 @@ export function APIEditor({ value, context, onChange }: Props) {
|
||||
<Field label="Header parameters">
|
||||
<ParamsEditor value={value?.headerParams ?? []} onChange={onHeaderParamsChange} />
|
||||
</Field>
|
||||
{value?.method === HttpRequestMethod.POST && value?.contentType && (
|
||||
{value?.method !== HttpRequestMethod.GET && value?.contentType && (
|
||||
<Field label="Payload">
|
||||
<StringValueEditor
|
||||
context={context}
|
||||
@ -190,7 +191,7 @@ export function APIEditor({ value, context, onChange }: Props) {
|
||||
)}
|
||||
{renderTestAPIButton(value)}
|
||||
<br />
|
||||
{value?.method === HttpRequestMethod.POST &&
|
||||
{value?.method !== HttpRequestMethod.GET &&
|
||||
value?.contentType === defaultApiConfig.contentType &&
|
||||
renderJSON(value?.data ?? '{}')}
|
||||
</>
|
||||
|
@ -56,7 +56,7 @@ composableKinds: PanelCfg: {
|
||||
width?: float64
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
HttpRequestMethod: "GET" | "POST" @cuetsy(kind="enum", memberNames="GET|POST")
|
||||
HttpRequestMethod: "GET" | "POST" | "PUT" @cuetsy(kind="enum", memberNames="GET|POST|PUT")
|
||||
|
||||
ConnectionCoordinates: {
|
||||
x: float64
|
||||
|
@ -62,6 +62,7 @@ export interface LineConfig {
|
||||
export enum HttpRequestMethod {
|
||||
GET = 'GET',
|
||||
POST = 'POST',
|
||||
PUT = 'PUT',
|
||||
}
|
||||
|
||||
export interface ConnectionCoordinates {
|
||||
|
Loading…
Reference in New Issue
Block a user