diff --git a/src/api/automation.js b/src/api/automation.js
index d72946a..296d091 100644
--- a/src/api/automation.js
+++ b/src/api/automation.js
@@ -5,4 +5,11 @@ const baseUrl = "/automation"
export async function sendPatchPolicyReset(payload) {
const { data } = await axios.post(`${baseUrl}/patchpolicy/reset/`, payload)
return data
+}
+
+export async function fetchPolicyChecks(id) {
+ try {
+ const { data } = await axios.get(`${baseUrl}/policies/${id}/checks/`)
+ return data
+ } catch (e) { console.error(e) }
}
\ No newline at end of file
diff --git a/src/components/automation/PolicyAutomatedTasksTab.vue b/src/components/automation/PolicyAutomatedTasksTab.vue
index b24bca9..332b0ba 100644
--- a/src/components/automation/PolicyAutomatedTasksTab.vue
+++ b/src/components/automation/PolicyAutomatedTasksTab.vue
@@ -8,7 +8,7 @@
icon="fas fa-plus"
label="Add Task"
text-color="black"
- @click="showAddTask = true"
+ @click="showAddTask"
/>
-
+
@@ -110,7 +110,7 @@
@@ -118,7 +118,7 @@
@@ -126,7 +126,7 @@
@@ -134,7 +134,7 @@
@@ -160,16 +160,6 @@
-
-
-
-
@@ -182,14 +172,12 @@ import PolicyStatus from "@/components/automation/modals/PolicyStatus";
export default {
name: "PolicyAutomatedTasksTab",
mixins: [mixins],
- components: { AddAutomatedTask },
props: {
selectedPolicy: !Number,
},
data() {
return {
tasks: [],
- showAddTask: false,
columns: [
{ name: "enabled", align: "left", field: "enabled" },
{ name: "smsalert", field: "text_alert", align: "left" },
@@ -235,7 +223,7 @@ export default {
getTasks() {
this.$q.loading.show();
this.$axios
- .get(`/automation/${this.selectedPolicy}/policyautomatedtasks/`)
+ .get(`/automation/policies/${this.selectedPolicy}/tasks/`)
.then(r => {
this.tasks = r.data;
this.$q.loading.hide();
@@ -244,45 +232,27 @@ export default {
this.$q.loading.hide();
});
},
- taskEnableorDisable(pk, action) {
- this.$q.loading.show();
- const data = { id: pk, enableordisable: !action };
+ editTask(task, data) {
this.$axios
- .patch(`/tasks/${pk}/automatedtasks/`, data)
+ .put(`/tasks/${task.pk}/`, data)
.then(r => {
- this.getTasks();
this.$q.loading.hide();
- this.notifySuccess("Task has edited successfully");
+ this.notifySuccess(r.data);
+ this.getTasks();
})
.catch(e => {
this.$q.loading.hide();
});
},
- taskAlert(pk, alert_type, action) {
- this.$q.loading.show();
-
- const data = {
- id: pk,
- };
-
- if (alert_type === "Email") {
- data.email_alert = !action;
- } else if (alert_type === "Text") {
- data.text_alert = !action;
- } else {
- data.dashboard_alert = !action;
- }
-
- const act = !action ? "enabled" : "disabled";
- this.$axios
- .put(`/tasks/${pk}/automatedtasks/`, data)
- .then(r => {
- this.$q.loading.hide();
- this.notifySuccess(`${alert_type} alerts ${act}`);
+ showAddTask() {
+ this.$q
+ .dialog({
+ component: AddAutomatedTask,
+ componentProps: {
+ parent: { policy: this.selectedPolicy },
+ },
})
- .catch(e => {
- this.$q.loading.hide();
- });
+ .onOk(this.getTasks);
},
showEditTask(task) {
this.$q
@@ -292,9 +262,7 @@ export default {
task: task,
},
})
- .onOk(() => {
- this.getTasks();
- });
+ .onOk(this.getTasks);
},
showStatus(task) {
this.$q.dialog({
@@ -313,7 +281,7 @@ export default {
this.$q.loading.show();
this.$axios
- .put(`/automation/runwintask/${pk}/`)
+ .post(`/automation/tasks/${pk}/run/`)
.then(r => {
this.$q.loading.hide();
this.notifySuccess("The task was initated on all affected agents");
@@ -333,7 +301,7 @@ export default {
.onOk(() => {
this.$q.loading.show();
this.$axios
- .delete(`/tasks/${pk}/automatedtasks/`)
+ .delete(`/tasks/${pk}/`)
.then(r => {
this.getTasks();
this.$q.loading.hide();
diff --git a/src/components/automation/PolicyChecksTab.vue b/src/components/automation/PolicyChecksTab.vue
index ee52e40..774384d 100644
--- a/src/components/automation/PolicyChecksTab.vue
+++ b/src/components/automation/PolicyChecksTab.vue
@@ -4,43 +4,43 @@
-
+
Disk Space Check
-
+
Ping Check
-
+
CPU Load Check
-
+
Memory Check
-
+
Windows Service Check
-
+
Script Check
-
+
@@ -97,11 +97,11 @@
-
+
-
+
@@ -161,27 +161,15 @@
>See Status
- {{
+ {{
props.row.assignedtask[0].name
}}
- {{ props.row.assignedtask.length }} Tasks
+ {{ props.row.assignedtask.length }} Tasks
-
-
-
-
-
@@ -198,15 +186,6 @@ import EventLogCheck from "@/components/checks/EventLogCheck";
export default {
name: "PolicyChecksTab",
- components: {
- DiskSpaceCheck,
- PingCheck,
- CpuLoadCheck,
- MemCheck,
- WinSvcCheck,
- ScriptCheck,
- EventLogCheck,
- },
mixins: [mixins],
props: {
selectedPolicy: !Number,
@@ -214,9 +193,6 @@ export default {
data() {
return {
checks: [],
- dialogComponent: null,
- showDialog: false,
- editCheck: null,
columns: [
{ name: "smsalert", field: "text_alert", align: "left" },
{ name: "emailalert", field: "email_alert", align: "left" },
@@ -241,7 +217,7 @@ export default {
getChecks() {
this.$q.loading.show();
this.$axios
- .get(`/automation/${this.selectedPolicy}/policychecks/`)
+ .get(`/automation/policies/${this.selectedPolicy}/checks/`)
.then(r => {
this.checks = r.data;
this.$q.loading.hide();
@@ -266,7 +242,7 @@ export default {
const act = !action ? "enabled" : "disabled";
const color = !action ? "positive" : "warning";
this.$axios
- .patch(`/checks/${id}/check/`, data)
+ .put(`/checks/${id}/`, data)
.then(r => {
this.$q.loading.hide();
this.$q.notify({
@@ -279,45 +255,6 @@ export default {
this.$q.loading.hide();
});
},
- showAddDialog(component) {
- this.dialogComponent = component;
- this.showDialog = true;
- },
- showEditDialog(check) {
- switch (check.check_type) {
- case "diskspace":
- this.dialogComponent = "DiskSpaceCheck";
- break;
- case "ping":
- this.dialogComponent = "PingCheck";
- break;
- case "cpuload":
- this.dialogComponent = "CpuLoadCheck";
- break;
- case "memory":
- this.dialogComponent = "MemCheck";
- break;
- case "winsvc":
- this.dialogComponent = "WinSvcCheck";
- break;
- case "script":
- this.dialogComponent = "ScriptCheck";
- break;
- case "eventlog":
- this.dialogComponent = "EventLogCheck";
- break;
- default:
- return null;
- }
- this.editCheck = check;
- this.showDialog = true;
- },
- hideDialog() {
- this.getChecks();
- this.showDialog = false;
- this.dialogComponent = null;
- this.editCheckPK = null;
- },
deleteCheck(check) {
this.$q
.dialog({
@@ -328,7 +265,7 @@ export default {
.onOk(() => {
this.$q.loading.show();
this.$axios
- .delete(`/checks/${check.id}/check/`)
+ .delete(`/checks/${check.id}/`)
.then(r => {
this.getChecks();
this.$q.loading.hide();
@@ -348,6 +285,28 @@ export default {
},
});
},
+ showCheckModal(type, check) {
+ let component;
+
+ if (type === "diskspace") component = DiskSpaceCheck;
+ else if (type === "memory") component = MemCheck;
+ else if (type === "cpuload") component = CpuLoadCheck;
+ else if (type === "ping") component = PingCheck;
+ else if (type === "winsvc") component = WinSvcCheck;
+ else if (type === "eventlog") component = EventLogCheck;
+ else if (type === "script") component = ScriptCheck;
+ else return;
+
+ this.$q
+ .dialog({
+ component: component,
+ componentProps: {
+ check: check,
+ parent: !check ? { policy: this.selectedPolicy } : undefined,
+ },
+ })
+ .onOk(this.getChecks);
+ },
},
created() {
this.getChecks();
diff --git a/src/components/automation/modals/PolicyStatus.vue b/src/components/automation/modals/PolicyStatus.vue
index 462e745..229f129 100644
--- a/src/components/automation/modals/PolicyStatus.vue
+++ b/src/components/automation/modals/PolicyStatus.vue
@@ -33,6 +33,7 @@
+
{{ props.row.hostname }}
@@ -88,7 +89,7 @@
output
@@ -104,10 +105,6 @@
-
-
-
-
@@ -119,9 +116,6 @@ import EventLogCheckOutput from "@/components/checks/EventLogCheckOutput";
export default {
name: "PolicyStatus",
emits: ["hide", "ok", "cancel"],
- components: {
- EventLogCheckOutput,
- },
props: {
item: {
required: true,
@@ -138,8 +132,6 @@ export default {
},
data() {
return {
- showEventLogOutput: false,
- evtLogData: {},
data: [],
columns: [
{ name: "agent", label: "Hostname", field: "agent", align: "left", sortable: true },
@@ -183,7 +175,7 @@ export default {
getCheckData() {
this.$q.loading.show();
this.$axios
- .patch(`/automation/policycheckstatus/${this.item.id}/check/`)
+ .get(`/automation/checks/${this.item.id}/status/`)
.then(r => {
this.$q.loading.hide();
this.data = r.data;
@@ -195,7 +187,7 @@ export default {
getTaskData() {
this.$q.loading.show();
this.$axios
- .patch(`/automation/policyautomatedtaskstatus/${this.item.id}/task/`)
+ .get(`/automation/tasks/${this.item.id}/status/`)
.then(r => {
this.$q.loading.hide();
this.data = r.data;
@@ -204,14 +196,6 @@ export default {
this.$q.loading.hide();
});
},
- closeEventLogOutput() {
- this.showEventLogOutput = false;
- this.evtLogdata = {};
- },
- closeScriptOutput() {
- this.showScriptOutput = false;
- this.scriptInfo = {};
- },
pingInfo(check) {
this.$q.dialog({
title: check.readable_desc,
@@ -220,9 +204,13 @@ export default {
html: true,
});
},
- eventLogMoreInfo(check) {
- this.evtLogData = check;
- this.showEventLogOutput = true;
+ showEventInfo(data) {
+ this.$q.dialog({
+ component: EventLogCheckOutput,
+ componentProps: {
+ evtLogData: data,
+ },
+ });
},
showScriptOutput(script) {
this.$q.dialog({
diff --git a/src/components/checks/WinSvcCheck.vue b/src/components/checks/WinSvcCheck.vue
index 28047d4..3fff133 100644
--- a/src/components/checks/WinSvcCheck.vue
+++ b/src/components/checks/WinSvcCheck.vue
@@ -2,7 +2,7 @@
- {{ check ? `Edit Memory Check` : "Add Memory Check" }}
+ {{ check ? `Edit Service Check` : "Add Service Check" }}
Close
diff --git a/src/components/modals/agents/PatchPolicyForm.vue b/src/components/modals/agents/PatchPolicyForm.vue
index f245089..b41db19 100644
--- a/src/components/modals/agents/PatchPolicyForm.vue
+++ b/src/components/modals/agents/PatchPolicyForm.vue
@@ -240,7 +240,7 @@ export default {
// editing patch policy
if (this.editing) {
this.$axios
- .put(`/automation/winupdatepolicy/${this.winupdatepolicy.id}/`, this.winupdatepolicy)
+ .put(`/automation/patchpolicy/${this.winupdatepolicy.id}/`, this.winupdatepolicy)
.then(response => {
this.$q.loading.hide();
this.$emit("close");
@@ -252,7 +252,7 @@ export default {
} else {
// adding patch policy
this.$axios
- .post("/automation/winupdatepolicy/", this.winupdatepolicy)
+ .post("/automation/patchpolicy/", this.winupdatepolicy)
.then(response => {
this.$q.loading.hide();
this.$emit("close");
@@ -274,7 +274,7 @@ export default {
.onOk(() => {
this.$q.loading.show();
this.$axios
- .delete(`/automation/winupdatepolicy/${policy.id}/`)
+ .delete(`/automation/patchpolicy/${policy.id}/`)
.then(r => {
this.$q.loading.hide();
this.$emit("close");
diff --git a/src/components/tasks/AddAutomatedTask.vue b/src/components/tasks/AddAutomatedTask.vue
index ea88db1..c3d39e4 100644
--- a/src/components/tasks/AddAutomatedTask.vue
+++ b/src/components/tasks/AddAutomatedTask.vue
@@ -184,7 +184,6 @@