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

View File

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