From fefb74815b38b46fb0be430eb99f46fde642dcce Mon Sep 17 00:00:00 2001 From: Josh Krawczyk Date: Thu, 16 Apr 2020 10:56:52 -0400 Subject: [PATCH] Policy Overview Add/Edit --- src/components/AutomationManager.vue | 52 ++- src/components/PolicyChecksTab.vue | 429 ++++++++++++++++++ src/components/PolicySubTableTabs.vue | 40 ++ .../modals/automation/AddPolicy.vue | 149 +++++- .../modals/automation/EditPolicy.vue | 161 ++++++- .../modals/automation/PolicyOverview.vue | 161 ++++++- .../modals/checks/AddCpuLoadCheck.vue | 14 +- src/components/modals/checks/AddPingCheck.vue | 23 +- src/store/store.js | 15 +- 9 files changed, 999 insertions(+), 45 deletions(-) create mode 100644 src/components/PolicyChecksTab.vue create mode 100644 src/components/PolicySubTableTabs.vue diff --git a/src/components/AutomationManager.vue b/src/components/AutomationManager.vue index c106a84..f9ebed5 100644 --- a/src/components/AutomationManager.vue +++ b/src/components/AutomationManager.vue @@ -75,15 +75,18 @@ > {{ props.row.name }} {{ props.row.desc }} - {{ props.row.applied_to }} - {{ props.row.actions }} + {{ props.row.active }} + {{ props.row.clients.length }} + {{ props.row.sites.length }} + {{ props.row.agents.length }} - - + + + @@ -105,14 +108,14 @@ import { mapState } from "vuex"; import AddPolicy from "@/components/modals/automation/AddPolicy"; import EditPolicy from "@/components/modals/automation/EditPolicy"; import PolicyOverview from "@/components/modals/automation/PolicyOverview"; +import PolicySubTableTabs from "@/components/PolicySubTableTabs" export default { name: "AutomationManager", - components: { AddPolicy, EditPolicy, PolicyOverview }, + components: { AddPolicy, EditPolicy, PolicyOverview, PolicySubTableTabs }, mixins: [mixins], data() { return { - selectedRow: null, showAddPolicyModal: false, showEditPolicyModal: false, showPolicyOverviewModal: false, @@ -145,14 +148,28 @@ export default { sortable: true }, { - name: "applied_to", - label: "Applied To", - field: "applied_to", + name: "clients", + label: "Clients", + field: "clients", + align: "left", + sortable: false + }, + { + name: "sites", + label: "Sites", + field: "sites", + align: "left", + sortable: false + }, + { + name: "agents", + label: "Agents", + field: "agents", align: "left", sortable: false } ], - visibleColumns: ["name", "desc", "active", "applied_to"] + visibleColumns: ["name", "desc", "active", "clients", "sites", "agents"] }; }, methods: { @@ -164,10 +181,12 @@ export default { this.$store.commit("TOGGLE_AUTOMATION_MANAGER", false); }, policyRowSelected(pk) { - this.selectedRow = pk; + this.$store.commit("setSelectedPolicy", pk); + this.$store.dispatch("loadPolicyChecks", pk); }, clearRow() { - this.selectedRow = null; + this.$store.commit("setSelectedPolicy", null); + this.$store.commit("setPolicyChecks", {}); }, deletePolicy() { this.$q @@ -179,16 +198,17 @@ export default { .onOk(() => { axios.delete(`/automation/policies/${this.selectedRow}`).then(r => { this.getPolicies(); - this.notifySuccess(`Policy ${r.data} was deleted!`); + this.notifySuccess(`Policy was deleted!`); }); }); - } + }, }, computed: { ...mapState({ toggleAutomationManager: state => state.toggleAutomationManager, - policies: state => state.policies - }) + policies: state => state.policies, + selectedRow: state => state.selectedPolicy + }), }, mounted() { this.getPolicies(); diff --git a/src/components/PolicyChecksTab.vue b/src/components/PolicyChecksTab.vue new file mode 100644 index 0000000..ee43593 --- /dev/null +++ b/src/components/PolicyChecksTab.vue @@ -0,0 +1,429 @@ + + + + + + diff --git a/src/components/PolicySubTableTabs.vue b/src/components/PolicySubTableTabs.vue new file mode 100644 index 0000000..18d4161 --- /dev/null +++ b/src/components/PolicySubTableTabs.vue @@ -0,0 +1,40 @@ + + + + diff --git a/src/components/modals/automation/AddPolicy.vue b/src/components/modals/automation/AddPolicy.vue index a444b37..1bd9fde 100644 --- a/src/components/modals/automation/AddPolicy.vue +++ b/src/components/modals/automation/AddPolicy.vue @@ -1,5 +1,5 @@