From e89c48ce6a7b8e063f3a8aca0a4a1967bc8ee10f Mon Sep 17 00:00:00 2001 From: wh1te909 Date: Thu, 6 Feb 2020 06:32:30 +0000 Subject: [PATCH] finish script checks --- src/components/ChecksTab.vue | 68 ++++++++--- src/components/modals/agents/EditAgent.vue | 10 +- .../modals/checks/AddScriptCheck.vue | 113 ++++++++++++++++++ .../modals/checks/EditScriptCheck.vue | 89 ++++++++++++++ src/store/store.js | 14 ++- 5 files changed, 270 insertions(+), 24 deletions(-) create mode 100644 src/components/modals/checks/AddScriptCheck.vue create mode 100644 src/components/modals/checks/EditScriptCheck.vue diff --git a/src/components/ChecksTab.vue b/src/components/ChecksTab.vue index 8b89a52..471fa65 100644 --- a/src/components/ChecksTab.vue +++ b/src/components/ChecksTab.vue @@ -20,6 +20,9 @@ Windows Service Check + + Script Check + @@ -38,9 +41,8 @@ More Info Date / Time - + - - + + + Edit - + + + Delete @@ -87,11 +93,14 @@ v-if="check.check_type === 'diskspace'" >Disk Space Drive {{ check.disk }} > {{check.threshold }}% Avg CPU Load > {{ check.cpuload }}% + Script check: {{ check.script.name }} Ping {{ check.name }} ({{ check.ip }}) Avg memory usage > {{ check.threshold }}% - Service Check - {{ check.svc_display_name }} + Service Check - {{ check.svc_display_name }} Awaiting First Synchronization Passing @@ -100,19 +109,21 @@ Failing - - output - + @click="moreInfo('Ping', check.more_info)" + >output + + + output {{ check.more_info }} {{ check.last_run }} - - @@ -169,6 +180,17 @@ :agentpk="checks.pk" /> + + + + + + + @@ -186,6 +208,8 @@ import AddMemCheck from "@/components/modals/checks/AddMemCheck"; import EditMemCheck from "@/components/modals/checks/EditMemCheck"; import AddWinSvcCheck from "@/components/modals/checks/AddWinSvcCheck"; import EditWinSvcCheck from "@/components/modals/checks/EditWinSvcCheck"; +import AddScriptCheck from "@/components/modals/checks/AddScriptCheck"; +import EditScriptCheck from "@/components/modals/checks/EditScriptCheck"; export default { name: "ChecksTab", @@ -199,7 +223,9 @@ export default { AddMemCheck, EditMemCheck, AddWinSvcCheck, - EditWinSvcCheck + EditWinSvcCheck, + AddScriptCheck, + EditScriptCheck }, mixins: [mixins], data() { @@ -214,6 +240,8 @@ export default { showEditMemCheck: false, showAddWinSvcCheck: false, showEditWinSvcCheck: false, + showAddScriptCheck: false, + showEditScriptCheck: false, editCheckPK: null }; }, @@ -238,10 +266,10 @@ export default { onRefresh(id) { this.$store.dispatch("loadChecks", id); }, - pingMoreInfo(output) { + moreInfo(name, output) { this.$q.dialog({ - title: "Ping output", - style: "width: 600px; max-width: 90vw", + title: `${name} output`, + style: "width: 80vw; max-width: 90vw", message: `
${output}
`, html: true, dark: true @@ -264,6 +292,9 @@ export default { case "winsvc": this.showEditWinSvcCheck = true; break; + case "script": + this.showEditScriptCheck = true; + break; default: return false; } @@ -294,11 +325,12 @@ export default { }), allChecks() { return [ - ...this.checks.pingchecks, ...this.checks.diskchecks, ...this.checks.cpuloadchecks, ...this.checks.memchecks, - ...this.checks.winservicechecks + ...this.checks.scriptchecks, + ...this.checks.winservicechecks, + ...this.checks.pingchecks ]; } } diff --git a/src/components/modals/agents/EditAgent.vue b/src/components/modals/agents/EditAgent.vue index 6544910..c90334c 100644 --- a/src/components/modals/agents/EditAgent.vue +++ b/src/components/modals/agents/EditAgent.vue @@ -52,8 +52,8 @@ + + +
Add Script Check
+ + +
+ +

You need to upload a script first

+

Settings -> Script Manager

+
+
+ + +
Add Script Check
+ + +
+ + + + + + + + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/src/components/modals/checks/EditScriptCheck.vue b/src/components/modals/checks/EditScriptCheck.vue new file mode 100644 index 0000000..5bfc4ee --- /dev/null +++ b/src/components/modals/checks/EditScriptCheck.vue @@ -0,0 +1,89 @@ + + + \ No newline at end of file diff --git a/src/store/store.js b/src/store/store.js index bf9d833..a4ce2ec 100644 --- a/src/store/store.js +++ b/src/store/store.js @@ -23,7 +23,8 @@ export const store = new Vuex.Store({ agentChecks: {}, agentTableLoading: false, treeLoading: false, - installedSoftware: [] + installedSoftware: [], + scripts: [], }, getters: { loggedIn(state) { @@ -50,6 +51,9 @@ export const store = new Vuex.Store({ }, agentHostname(state) { return state.agentSummary.hostname; + }, + scripts(state) { + return state.scripts; } }, mutations: { @@ -92,9 +96,17 @@ export const store = new Vuex.Store({ (state.winUpdates = {}); (state.installedSoftware = []); state.selectedRow = ""; + }, + SET_SCRIPTS(state, scripts) { + state.scripts = scripts; } }, actions: { + getScripts(context) { + axios.get("/checks/getscripts/").then(r => { + context.commit("SET_SCRIPTS", r.data); + }) + }, loadInstalledSoftware(context, pk) { axios.get(`/software/installed/${pk}`).then(r => { context.commit("SET_INSTALLED_SOFTWARE", r.data.software);