fix autotask modals and allow editing the custom field for a collector task
This commit is contained in:
@@ -85,7 +85,7 @@
|
|||||||
map-options
|
map-options
|
||||||
emit-value
|
emit-value
|
||||||
options-dense
|
options-dense
|
||||||
hint="The return value of script will be saved to custom field selected"
|
hint="The last line of script output will be saved to custom field selected"
|
||||||
/>
|
/>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
|
|||||||
@@ -15,11 +15,12 @@
|
|||||||
dense
|
dense
|
||||||
options-dense
|
options-dense
|
||||||
outlined
|
outlined
|
||||||
v-model="localTask.script"
|
v-model="autotask.script"
|
||||||
:options="scriptOptions"
|
:options="scriptOptions"
|
||||||
label="Select script"
|
label="Select script"
|
||||||
map-options
|
map-options
|
||||||
emit-value
|
emit-value
|
||||||
|
@input="setScriptDefaults"
|
||||||
>
|
>
|
||||||
<template v-slot:option="scope">
|
<template v-slot:option="scope">
|
||||||
<q-item v-if="!scope.opt.category" v-bind="scope.itemProps" v-on="scope.itemEvents" class="q-pl-lg">
|
<q-item v-if="!scope.opt.category" v-bind="scope.itemProps" v-on="scope.itemEvents" class="q-pl-lg">
|
||||||
@@ -38,14 +39,13 @@
|
|||||||
dense
|
dense
|
||||||
label="Script Arguments (press Enter after typing each argument)"
|
label="Script Arguments (press Enter after typing each argument)"
|
||||||
filled
|
filled
|
||||||
v-model="localTask.script_args"
|
v-model="autotask.script_args"
|
||||||
use-input
|
use-input
|
||||||
use-chips
|
use-chips
|
||||||
multiple
|
multiple
|
||||||
hide-dropdown-icon
|
hide-dropdown-icon
|
||||||
input-debounce="0"
|
input-debounce="0"
|
||||||
new-value-mode="add"
|
new-value-mode="add"
|
||||||
@input="setScriptDefaults"
|
|
||||||
/>
|
/>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
@@ -53,14 +53,14 @@
|
|||||||
:rules="[val => !!val || '*Required']"
|
:rules="[val => !!val || '*Required']"
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
v-model="localTask.name"
|
v-model="autotask.name"
|
||||||
label="Descriptive name of task"
|
label="Descriptive name of task"
|
||||||
class="q-pb-none"
|
class="q-pb-none"
|
||||||
/>
|
/>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<q-select
|
<q-select
|
||||||
v-model="localTask.alert_severity"
|
v-model="autotask.alert_severity"
|
||||||
:options="severityOptions"
|
:options="severityOptions"
|
||||||
dense
|
dense
|
||||||
label="Alert Severity"
|
label="Alert Severity"
|
||||||
@@ -70,12 +70,33 @@
|
|||||||
options-dense
|
options-dense
|
||||||
/>
|
/>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
|
<q-card-section>
|
||||||
|
<q-checkbox
|
||||||
|
dense
|
||||||
|
label="Collector Task"
|
||||||
|
v-model="collector"
|
||||||
|
class="q-pb-sm"
|
||||||
|
@input="autotask.custom_field = null"
|
||||||
|
/>
|
||||||
|
<q-select
|
||||||
|
v-if="collector"
|
||||||
|
v-model="autotask.custom_field"
|
||||||
|
:options="customFieldOptions"
|
||||||
|
dense
|
||||||
|
label="Custom Field to update"
|
||||||
|
outlined
|
||||||
|
map-options
|
||||||
|
emit-value
|
||||||
|
options-dense
|
||||||
|
hint="The return value of script will be saved to custom field selected"
|
||||||
|
/>
|
||||||
|
</q-card-section>
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<q-input
|
<q-input
|
||||||
:rules="[val => !!val || '*Required']"
|
:rules="[val => !!val || '*Required']"
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
v-model.number="localTask.timeout"
|
v-model.number="autotask.timeout"
|
||||||
type="number"
|
type="number"
|
||||||
label="Maximum permitted execution time (seconds)"
|
label="Maximum permitted execution time (seconds)"
|
||||||
class="q-pb-none"
|
class="q-pb-none"
|
||||||
@@ -102,14 +123,17 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
localTask: {
|
autotask: {
|
||||||
id: null,
|
id: null,
|
||||||
name: "",
|
name: "",
|
||||||
script: null,
|
script: null,
|
||||||
script_args: [],
|
script_args: [],
|
||||||
alert_severity: null,
|
alert_severity: null,
|
||||||
timeout: 120,
|
timeout: 120,
|
||||||
|
custom_field: null,
|
||||||
},
|
},
|
||||||
|
collector: false,
|
||||||
|
customFieldOptions: [],
|
||||||
scriptOptions: [],
|
scriptOptions: [],
|
||||||
severityOptions: [
|
severityOptions: [
|
||||||
{ label: "Informational", value: "info" },
|
{ label: "Informational", value: "info" },
|
||||||
@@ -132,7 +156,7 @@ export default {
|
|||||||
this.$q.loading.show();
|
this.$q.loading.show();
|
||||||
|
|
||||||
this.$axios
|
this.$axios
|
||||||
.put(`/tasks/${this.localTask.id}/automatedtasks/`, this.localTask)
|
.put(`/tasks/${this.autotask.id}/automatedtasks/`, this.autotask)
|
||||||
.then(r => {
|
.then(r => {
|
||||||
this.$q.loading.hide();
|
this.$q.loading.hide();
|
||||||
this.onOk();
|
this.onOk();
|
||||||
@@ -160,13 +184,20 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
this.scriptOptions = this.getScriptOptions(this.showCommunityScripts);
|
this.scriptOptions = this.getScriptOptions(this.showCommunityScripts);
|
||||||
|
|
||||||
|
this.getCustomFields("agent").then(r => {
|
||||||
|
this.customFieldOptions = r.data.map(field => ({ label: field.name, value: field.id }));
|
||||||
|
});
|
||||||
|
|
||||||
|
this.collector = !!this.task.custom_field;
|
||||||
|
|
||||||
// copy only certain task props locally
|
// copy only certain task props locally
|
||||||
this.localTask.id = this.task.id;
|
this.autotask.id = this.task.id;
|
||||||
this.localTask.name = this.task.name;
|
this.autotask.name = this.task.name;
|
||||||
this.localTask.script = this.task.script;
|
this.autotask.script = this.task.script;
|
||||||
this.localTask.script_args = this.task.script_args;
|
this.autotask.script_args = this.task.script_args;
|
||||||
this.localTask.alert_severity = this.task.alert_severity;
|
this.autotask.alert_severity = this.task.alert_severity;
|
||||||
this.localTask.timeout = this.task.timeout;
|
this.autotask.timeout = this.task.timeout;
|
||||||
|
this.autotask.custom_field = this.task.custom_field;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
Reference in New Issue
Block a user