UI changes for AddAutomated Task and ScriptCheck models

This commit is contained in:
sadnub 2021-02-23 23:45:37 -05:00
parent 8d084ab90a
commit 2497675259
2 changed files with 13 additions and 6 deletions

View File

@ -50,7 +50,7 @@
<q-card-section>
<q-select
dense
label="Informational return codes (press Enter after typing each argument)"
label="Informational return codes (press Enter after typing each code)"
filled
v-model="scriptcheck.info_return_codes"
use-input
@ -65,7 +65,7 @@
<q-card-section>
<q-select
dense
label="Warning return codes (press Enter after typing each argument)"
label="Warning return codes (press Enter after typing each code)"
filled
v-model="scriptcheck.warning_return_codes"
use-input

View File

@ -150,7 +150,7 @@
@click="addTask"
label="Add Task"
/>
<q-btn v-else @click="$refs.stepper.next()" color="primary" label="Next" />
<q-btn v-else @click="step2" color="primary" label="Next" />
<q-btn v-if="step > 1" flat color="primary" @click="$refs.stepper.previous()" label="Back" class="q-ml-sm" />
</q-stepper-navigation>
</template>
@ -254,6 +254,15 @@ export default {
this.notifyError("Unable to get policy checks");
});
},
step2() {
if (this.step1Done) {
this.$refs.stepper.next();
} else {
if (!this.autotask.script) this.notifyError("Script field is required");
else if (!this.autotask.name) this.notifyError("Name field is required");
else if (!this.autotask.timeout) this.notifyError("Timeout field is required");
}
},
},
computed: {
...mapGetters(["selectedAgentPk"]),
@ -270,9 +279,7 @@ export default {
return r.sort((a, b) => a.label.localeCompare(b.label));
},
step1Done() {
return this.step > 1 && this.autotask.script !== null && this.autotask.name && this.autotask.timeout
? true
: false;
return !!this.autotask.script && !!this.autotask.name && !!this.autotask.timeout ? true : false;
},
step2Done() {
if (this.autotask.task_type === "scheduled") {