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:
Drew Slobodnjak 2023-10-23 09:24:34 -07:00 committed by GitHub
parent 88957c7f44
commit 4f2bbd490f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 5 deletions

View File

@ -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** | | |

View File

@ -65,6 +65,7 @@ export interface LineConfig {
export enum HttpRequestMethod {
GET = 'GET',
POST = 'POST',
PUT = 'PUT',
}
export interface ConnectionCoordinates {

View File

@ -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 ?? '{}')}
</>

View File

@ -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

View File

@ -62,6 +62,7 @@ export interface LineConfig {
export enum HttpRequestMethod {
GET = 'GET',
POST = 'POST',
PUT = 'PUT',
}
export interface ConnectionCoordinates {