Skip to content
Snippets Groups Projects
Commit a0e31ad2 authored by Erwan Rouchet's avatar Erwan Rouchet Committed by Bastien Abadie
Browse files

Remove nested form tag in WorkerConfiguration modal

parent 3c936721
No related branches found
No related tags found
1 merge request!1468Remove nested form tag in WorkerConfiguration modal
<template>
<form>
<div class="field">
<label class="label">Name</label>
<input
class="input"
type="text"
v-model="newConfiguration.name"
v-on:update="$emit('update:modelValue', newConfiguration)"
<div class="field">
<label class="label">Name</label>
<input
class="input"
type="text"
v-model="newConfiguration.name"
v-on:update="$emit('update:modelValue', newConfiguration)"
:disabled="loading || null"
/>
</div>
<span v-if="schema">
<input
id="JSONStringSwitch"
type="checkbox"
class="switch is-rtl is-rounded is-info"
:checked="JSONStringToggled"
v-on:change="toggleJSONStringMode"
/>
<label class="is-pulled-right" for="JSONStringSwitch">JSON</label>
</span>
<div class="field" v-if="JSONStringMode">
<label class="label">JSON payload</label>
<div class="control">
<textarea
class="textarea is-family-monospace"
:class="{ 'is-danger': Boolean(JSONConfigError) }"
v-model="stringConfiguration"
:disabled="loading || null"
/>
placeholder="{}"
></textarea>
<p class="help is-danger" v-if="JSONConfigError">{{ JSONConfigError }}</p>
<p class="help" v-else>You can define here any JSON object that will be made available to the worker when it runs.</p>
</div>
<span v-if="schema">
<input
id="JSONStringSwitch"
type="checkbox"
class="switch is-rtl is-rounded is-info"
:checked="JSONStringToggled"
v-on:change="toggleJSONStringMode"
/>
<label class="is-pulled-right" for="JSONStringSwitch">JSON</label>
</span>
<div class="field" v-if="JSONStringMode">
<label class="label">JSON payload</label>
<div class="control">
<textarea
class="textarea is-family-monospace"
:class="{ 'is-danger': Boolean(JSONConfigError) }"
v-model="stringConfiguration"
:disabled="loading || null"
placeholder="{}"
></textarea>
<p class="help is-danger" v-if="JSONConfigError">{{ JSONConfigError }}</p>
<p class="help" v-else>You can define here any JSON object that will be made available to the worker when it runs.</p>
</div>
<div class="mb-3" v-else-if="Object.keys(newConfiguration.configuration).length">
<label class="label">Configuration</label>
<div
class="field"
v-for="(field, key) in schema"
:key="key"
:field="field"
>
<label class="field-label is-normal">{{ field.title }}</label>
<div class="field-body">
<component
v-if="FIELDS[field.type]"
:is="FIELDS[field.type].component"
:field="field"
:field-id="key"
:class="{ 'is-danger': Boolean(configurationErrors[key]) }"
v-model="newConfiguration.configuration[key]"
/>
</div>
<p class="help is-danger" v-if="configurationErrors[key]">{{ configurationErrors[key] }}</p>
</div>
<form class="mb-3" v-else-if="Object.keys(newConfiguration.configuration).length">
<label class="label">Configuration</label>
<div
class="field"
v-for="(field, key) in schema"
:key="key"
:field="field"
>
<label class="field-label is-normal">{{ field.title }}</label>
<div class="field-body">
<component
v-if="FIELDS[field.type]"
:is="FIELDS[field.type].component"
:field="field"
:field-id="key"
:class="{ 'is-danger': Boolean(configurationErrors[key]) }"
v-model="newConfiguration.configuration[key]"
/>
</div>
<p class="help is-danger" v-if="configurationErrors[key]">{{ configurationErrors[key] }}</p>
</div>
</form>
</form>
</div>
</template>
<script>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment