mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-27 20:01:10 +01:00
Some fixes
This commit is contained in:
@@ -15,6 +15,8 @@ export function applyFormInputDefaults(
|
|||||||
for (const input of inputs) {
|
for (const input of inputs) {
|
||||||
if ('defaultValue' in input && values[input.name] === undefined) {
|
if ('defaultValue' in input && values[input.name] === undefined) {
|
||||||
newValues[input.name] = input.defaultValue;
|
newValues[input.name] = input.defaultValue;
|
||||||
|
} else if (input.type === 'checkbox' && values[input.name] === undefined) {
|
||||||
|
newValues[input.name] = false;
|
||||||
}
|
}
|
||||||
// Recurse down to all child inputs
|
// Recurse down to all child inputs
|
||||||
if ('inputs' in input) {
|
if ('inputs' in input) {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export const plugin: PluginDefinition = {
|
|||||||
description: 'Prompt the user for input when sending a request',
|
description: 'Prompt the user for input when sending a request',
|
||||||
previewType: 'click',
|
previewType: 'click',
|
||||||
args: [
|
args: [
|
||||||
{ type: 'text', name: 'label', label: 'Label' },
|
{ type: 'text', name: 'label', label: 'Label', optional: true },
|
||||||
{
|
{
|
||||||
type: 'select',
|
type: 'select',
|
||||||
name: 'store',
|
name: 'store',
|
||||||
@@ -138,6 +138,9 @@ export const plugin: PluginDefinition = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function buildKey(args: CallTemplateFunctionArgs) {
|
function buildKey(args: CallTemplateFunctionArgs) {
|
||||||
|
if (!args.values.key && !args.values.label) {
|
||||||
|
throw new Error('Key or Label is required when storing values');
|
||||||
|
}
|
||||||
return [args.values.namespace, args.values.key || args.values.label]
|
return [args.values.namespace, args.values.key || args.values.label]
|
||||||
.filter((v) => !!v)
|
.filter((v) => !!v)
|
||||||
.map((v) => slugify(String(v), { lower: true, trim: true }))
|
.map((v) => slugify(String(v), { lower: true, trim: true }))
|
||||||
|
|||||||
Reference in New Issue
Block a user