From 5a410d85ca82bf3c3ef7f91d089a60845cac0367 Mon Sep 17 00:00:00 2001 From: wh1te909 Date: Mon, 9 Dec 2019 04:39:26 +0000 Subject: [PATCH] start adding patch management policies --- package-lock.json | 2 +- package.json | 2 +- src/components/modals/agents/EditAgent.vue | 346 ++++++++++++++++----- src/mixins/data.js | 28 ++ 4 files changed, 305 insertions(+), 73 deletions(-) create mode 100644 src/mixins/data.js diff --git a/package-lock.json b/package-lock.json index 1c1c1e0..c42a40a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "web", - "version": "0.1.1", + "version": "0.1.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index be996f2..44c4e5a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "web", - "version": "0.1.1", + "version": "0.1.2", "private": true, "scripts": { "serve": "vue-cli-service serve", diff --git a/src/components/modals/agents/EditAgent.vue b/src/components/modals/agents/EditAgent.vue index 6876517..6544910 100644 --- a/src/components/modals/agents/EditAgent.vue +++ b/src/components/modals/agents/EditAgent.vue @@ -1,72 +1,230 @@ @@ -74,6 +232,7 @@ import axios from "axios"; import { mapGetters } from "vuex"; import mixins from "@/mixins/mixins"; +import { scheduledTimes } from "@/mixins/data"; export default { name: "EditAgent", mixins: [mixins], @@ -90,7 +249,27 @@ export default { pingInterval: null, emailAlert: null, textAlert: null, - tree: {} + tree: {}, + updatePolicy: [], + splitterModel: 15, + tab: "general", + severityOptions: [ + { label: "Manual", value: "manual" }, + { label: "Approve", value: "approve" }, + { label: "Ignore", value: "ignore" } + ], + timeOptions: scheduledTimes, + dayOptions: [], + scheduledTime: null, + rebootAfterInstall: null, + reprocessFailed: null, + reprocessFailedTimes: null, + emailIfFail: null, + critical: null, + important: null, + moderate: null, + low: null, + other: null }; }, methods: { @@ -106,10 +285,24 @@ export default { this.pingInterval = r.data.ping_check_interval; this.emailAlert = r.data.overdue_email_alert; this.textAlert = r.data.overdue_text_alert; + this.updatePolicy = r.data.winupdatepolicy; + this.critical = r.data.winupdatepolicy[0].critical; + this.important = r.data.winupdatepolicy[0].important; + this.moderate = r.data.winupdatepolicy[0].moderate; + this.low = r.data.winupdatepolicy[0].low; + this.other = r.data.winupdatepolicy[0].other; + this.scheduledTime = r.data.winupdatepolicy[0].run_time_hour; + this.dayOptions = r.data.winupdatepolicy[0].run_time_days; + this.rebootAfterInstall = + r.data.winupdatepolicy[0].reboot_after_install; + this.reprocessFailed = r.data.winupdatepolicy[0].reprocess_failed; + this.reprocessFailedTimes = + r.data.winupdatepolicy[0].reprocess_failed_times; + this.emailIfFail = r.data.winupdatepolicy[0].email_if_fail; }); }, getClientsSites() { - axios.get("/clients/loadclients/").then(r => this.tree = r.data); + axios.get("/clients/loadclients/").then(r => (this.tree = r.data)); }, editAgent() { const data = { @@ -121,7 +314,18 @@ export default { overduetime: this.overdueTime, pinginterval: this.pingInterval, emailalert: this.emailAlert, - textalert: this.textAlert + textalert: this.textAlert, + critical: this.critical, + important: this.important, + moderate: this.moderate, + low: this.low, + other: this.other, + scheduledtime: this.scheduledTime, + dayoptions: this.dayOptions, + rebootafterinstall: this.rebootAfterInstall, + reprocessfailed: this.reprocessFailed, + reprocessfailedtimes: this.reprocessFailedTimes, + emailiffail: this.emailIfFail }; axios .patch("/agents/editagent/", data) diff --git a/src/mixins/data.js b/src/mixins/data.js new file mode 100644 index 0000000..c828086 --- /dev/null +++ b/src/mixins/data.js @@ -0,0 +1,28 @@ +const scheduledTimes = [ + { label: "12 AM", value: 0 }, + { label: "1 AM", value: 1 }, + { label: "2 AM", value: 2 }, + { label: "3 AM", value: 3 }, + { label: "4 AM", value: 4 }, + { label: "5 AM", value: 5 }, + { label: "6 AM", value: 6 }, + { label: "7 AM", value: 7 }, + { label: "8 AM", value: 8 }, + { label: "9 AM", value: 9 }, + { label: "10 AM", value: 10 }, + { label: "11 AM", value: 11 }, + { label: "12 PM", value: 12 }, + { label: "1 PM", value: 13 }, + { label: "2 PM", value: 14 }, + { label: "3 PM", value: 15 }, + { label: "4 PM", value: 16 }, + { label: "5 PM", value: 17 }, + { label: "6 PM", value: 18 }, + { label: "7 PM", value: 19 }, + { label: "8 PM", value: 20 }, + { label: "9 PM", value: 21 }, + { label: "10 PM", value: 22 }, + { label: "11 PM", value: 23 } +]; + +export { scheduledTimes };