diff --git a/src/components/AgentTable.vue b/src/components/AgentTable.vue index 9be63c9..9f05047 100644 --- a/src/components/AgentTable.vue +++ b/src/components/AgentTable.vue @@ -665,12 +665,16 @@ export default { } }, showPolicyAdd(agent) { - this.$q.dialog({ - component: PolicyAdd, - parent: this, - type: "agent", - object: agent, - }); + this.$q + .dialog({ + component: PolicyAdd, + parent: this, + type: "agent", + object: agent, + }) + .onOk(() => { + this.$emit("refreshEdit"); + }); }, toggleMaintenance(agent) { let data = { diff --git a/src/components/AutomatedTasksTab.vue b/src/components/AutomatedTasksTab.vue index c4ec484..65ee65d 100644 --- a/src/components/AutomatedTasksTab.vue +++ b/src/components/AutomatedTasksTab.vue @@ -33,6 +33,21 @@ Enabled + + + @@ -48,13 +63,7 @@ Run task now - + @@ -86,6 +95,24 @@ :disable="props.row.managed_by_policy" /> + + + + + + + + @@ -139,6 +166,7 @@ import { mapState } from "vuex"; import { mapGetters } from "vuex"; import mixins from "@/mixins/mixins"; import AddAutomatedTask from "@/components/modals/tasks/AddAutomatedTask"; +import EditAutomatedTask from "@/components/modals/tasks/EditAutomatedTask"; import ScriptOutput from "@/components/modals/checks/ScriptOutput"; export default { @@ -155,6 +183,8 @@ export default { scriptInfo: {}, columns: [ { name: "enabled", align: "left", field: "enabled" }, + { name: "smsalert", field: "text_alert", align: "left" }, + { name: "emailalert", field: "email_alert", align: "left" }, { name: "policystatus", align: "left" }, { name: "name", label: "Name", field: "name", align: "left" }, { name: "sync_status", label: "Sync Status", field: "sync_status", align: "left" }, @@ -202,6 +232,34 @@ export default { }) .catch(e => this.notifyError("Something went wrong")); }, + taskAlert(pk, alert_type, action, managed_by_policy) { + if (managed_by_policy) { + return; + } + this.$q.loading.show(); + + const data = { + id: pk, + }; + + if (alert_type === "Email") { + data.email_alert = action; + } else { + data.text_alert = action; + } + + const act = action ? "enabled" : "disabled"; + axios + .put(`/tasks/${pk}/automatedtasks/`, data) + .then(r => { + this.$q.loading.hide(); + this.notifySuccess(`${alert_type} alerts ${act}`); + }) + .catch(e => { + this.$q.loading.hide(); + this.notifyError("There was an issue editing task"); + }); + }, refreshTasks(id) { this.$store.dispatch("loadAutomatedTasks", id); }, @@ -209,6 +267,17 @@ export default { this.scriptInfo = props; this.showScriptOutput = true; }, + showEditTask(task) { + this.$q + .dialog({ + component: EditAutomatedTask, + parent: this, + task: task, + }) + .onOk(() => { + this.refreshTasks(this.automatedTasks.pk); + }); + }, runTask(pk, enabled) { if (!enabled) { this.notifyError("Task cannot be run when it's disabled. Enable it first."); diff --git a/src/components/automation/PolicyAutomatedTasksTab.vue b/src/components/automation/PolicyAutomatedTasksTab.vue index adfe2c3..2d2324d 100644 --- a/src/components/automation/PolicyAutomatedTasksTab.vue +++ b/src/components/automation/PolicyAutomatedTasksTab.vue @@ -39,6 +39,22 @@ Enabled + + + +