mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-23 17:18:32 +02:00
Fix dynamic form defaults
This commit is contained in:
@@ -593,7 +593,6 @@ var plugin = {
|
|||||||
const headerPrefix = optionalString(values, "headerPrefix") ?? "";
|
const headerPrefix = optionalString(values, "headerPrefix") ?? "";
|
||||||
const grantType = requiredString(values, "grantType");
|
const grantType = requiredString(values, "grantType");
|
||||||
const credentialsInBody = values.credentials === "body";
|
const credentialsInBody = values.credentials === "body";
|
||||||
console.log("Performing OAuth", values);
|
|
||||||
let token;
|
let token;
|
||||||
if (grantType === "authorization_code") {
|
if (grantType === "authorization_code") {
|
||||||
const authorizationUrl = requiredString(values, "authorizationUrl");
|
const authorizationUrl = requiredString(values, "authorizationUrl");
|
||||||
|
|||||||
@@ -219,18 +219,11 @@ function TextArg({
|
|||||||
autocompleteVariables: boolean;
|
autocompleteVariables: boolean;
|
||||||
stateKey: string;
|
stateKey: string;
|
||||||
}) {
|
}) {
|
||||||
const handleChange = useCallback(
|
|
||||||
(value: string) => {
|
|
||||||
onChange(value === '' ? DYNAMIC_FORM_NULL_ARG : value);
|
|
||||||
},
|
|
||||||
[onChange],
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Input
|
<Input
|
||||||
name={arg.name}
|
name={arg.name}
|
||||||
multiLine={arg.multiLine}
|
multiLine={arg.multiLine}
|
||||||
onChange={handleChange}
|
onChange={onChange}
|
||||||
defaultValue={value === DYNAMIC_FORM_NULL_ARG ? arg.defaultValue : value}
|
defaultValue={value === DYNAMIC_FORM_NULL_ARG ? arg.defaultValue : value}
|
||||||
required={!arg.optional}
|
required={!arg.optional}
|
||||||
disabled={arg.disabled}
|
disabled={arg.disabled}
|
||||||
@@ -238,7 +231,7 @@ function TextArg({
|
|||||||
label={arg.label ?? arg.name}
|
label={arg.label ?? arg.name}
|
||||||
size={INPUT_SIZE}
|
size={INPUT_SIZE}
|
||||||
hideLabel={arg.label == null}
|
hideLabel={arg.label == null}
|
||||||
placeholder={arg.placeholder ?? arg.defaultValue ?? ''}
|
placeholder={arg.placeholder ?? undefined}
|
||||||
autocomplete={arg.completionOptions ? { options: arg.completionOptions } : undefined}
|
autocomplete={arg.completionOptions ? { options: arg.completionOptions } : undefined}
|
||||||
useTemplating={useTemplating}
|
useTemplating={useTemplating}
|
||||||
autocompleteVariables={autocompleteVariables}
|
autocompleteVariables={autocompleteVariables}
|
||||||
@@ -263,13 +256,6 @@ function EditorArg({
|
|||||||
autocompleteVariables: boolean;
|
autocompleteVariables: boolean;
|
||||||
stateKey: string;
|
stateKey: string;
|
||||||
}) {
|
}) {
|
||||||
const handleChange = useCallback(
|
|
||||||
(value: string) => {
|
|
||||||
onChange(value === '' ? DYNAMIC_FORM_NULL_ARG : value);
|
|
||||||
},
|
|
||||||
[onChange],
|
|
||||||
);
|
|
||||||
|
|
||||||
const id = `input-${arg.name}`;
|
const id = `input-${arg.name}`;
|
||||||
|
|
||||||
// Read-only editor force refresh for every defaultValue change
|
// Read-only editor force refresh for every defaultValue change
|
||||||
@@ -296,10 +282,10 @@ function EditorArg({
|
|||||||
autocomplete={arg.completionOptions ? { options: arg.completionOptions } : undefined}
|
autocomplete={arg.completionOptions ? { options: arg.completionOptions } : undefined}
|
||||||
disabled={arg.disabled}
|
disabled={arg.disabled}
|
||||||
language={arg.language}
|
language={arg.language}
|
||||||
onChange={handleChange}
|
onChange={onChange}
|
||||||
heightMode="auto"
|
heightMode="auto"
|
||||||
defaultValue={value === DYNAMIC_FORM_NULL_ARG ? arg.defaultValue : value}
|
defaultValue={value === DYNAMIC_FORM_NULL_ARG ? arg.defaultValue : value}
|
||||||
placeholder={arg.placeholder ?? arg.defaultValue ?? ''}
|
placeholder={arg.placeholder ?? undefined}
|
||||||
useTemplating={useTemplating}
|
useTemplating={useTemplating}
|
||||||
autocompleteVariables={autocompleteVariables}
|
autocompleteVariables={autocompleteVariables}
|
||||||
stateKey={stateKey}
|
stateKey={stateKey}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ export function HttpAuthenticationEditor({ request }: Props) {
|
|||||||
|
|
||||||
const handleChange = useCallback(
|
const handleChange = useCallback(
|
||||||
(authentication: Record<string, boolean>) => {
|
(authentication: Record<string, boolean>) => {
|
||||||
console.log('UPDATE', authentication);
|
|
||||||
if (request.model === 'http_request') {
|
if (request.model === 'http_request') {
|
||||||
updateHttpRequest.mutate({
|
updateHttpRequest.mutate({
|
||||||
id: request.id,
|
id: request.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user