diff --git a/src/components/AgentTable.vue b/src/components/AgentTable.vue index 0190d50..465b0f7 100644 --- a/src/components/AgentTable.vue +++ b/src/components/AgentTable.vue @@ -780,7 +780,7 @@ export default { }, }, computed: { - ...mapGetters(["selectedAgentId", "agentTableHeight", "showCommunityScripts"]), + ...mapGetters(["agentTableHeight", "showCommunityScripts"]), agentDblClickAction() { return this.$store.state.agentDblClickAction; }, diff --git a/src/components/automation/modals/PolicyExclusions.vue b/src/components/automation/modals/PolicyExclusions.vue index db3e5a7..f97b950 100644 --- a/src/components/automation/modals/PolicyExclusions.vue +++ b/src/components/automation/modals/PolicyExclusions.vue @@ -105,7 +105,7 @@ export default { getOptions() { this.getClients(); this.getSites(); - this.getAgentOptions().then(options => (this.agentOptions = Object.freeze(options))); + this.getAgentOptions("id").then(options => (this.agentOptions = Object.freeze(options))); }, show() { this.$refs.dialog.show(); @@ -126,9 +126,9 @@ export default { // copy prop data locally this.localPolicy.id = this.policy.id; - this.localPolicy.excluded_clients = this.policy.excluded_clients.map(client => client.id); - this.localPolicy.excluded_sites = this.policy.excluded_sites.map(site => site.id); - this.localPolicy.excluded_agents = this.policy.excluded_agents.map(agent => agent.pk); + this.localPolicy.excluded_clients = this.policy.excluded_clients; + this.localPolicy.excluded_sites = this.policy.excluded_sites; + this.localPolicy.excluded_agents = this.policy.excluded_agents; }, }; \ No newline at end of file diff --git a/src/components/modals/alerts/AlertExclusions.vue b/src/components/modals/alerts/AlertExclusions.vue index 68eeac6..cfd3c4e 100644 --- a/src/components/modals/alerts/AlertExclusions.vue +++ b/src/components/modals/alerts/AlertExclusions.vue @@ -10,68 +10,37 @@ - - - - + mapOptions + /> - - - + mapOptions + /> @@ -90,8 +59,12 @@ \ No newline at end of file diff --git a/src/mixins/mixins.js b/src/mixins/mixins.js index ca55ae2..cadc045 100644 --- a/src/mixins/mixins.js +++ b/src/mixins/mixins.js @@ -195,11 +195,11 @@ export default { return options; }, - async getAgentOptions() { + async getAgentOptions(value_field = "agent_id") { const { data } = await axios.get("/agents/?detail=false") - return formatAgentOptions(data) + return formatAgentOptions(data, false, value_field) }, getNextAgentUpdateTime() { const d = new Date(); diff --git a/src/store/index.js b/src/store/index.js index 590a275..09b69f8 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -128,12 +128,6 @@ export default function () { }) .catch(e => { }); }, - loadClients(context) { - return axios.get("/clients/"); - }, - loadSites(context) { - return axios.get("/clients/sites/"); - }, loadTree({ commit, state }) { axios.get("/clients/").then(r => { diff --git a/src/utils/format.js b/src/utils/format.js index 7861f55..1b8ed54 100644 --- a/src/utils/format.js +++ b/src/utils/format.js @@ -57,17 +57,17 @@ export function formatScriptOptions(data, flat = false) { } } -export function formatAgentOptions(data, flat = false) { +export function formatAgentOptions(data, flat = false, value_field = "agent_id") { if (flat) { // returns just agent hostnames in array - return _formatOptions(data, { label: "hostname", value: "agent_id", flat: true, allowDuplicates: false }) + return _formatOptions(data, { label: "hostname", value: value_field, flat: true, allowDuplicates: false }) } else { // returns options with categories in object format let options = [] const agents = data.map(agent => ({ label: agent.hostname, - value: agent.agent_id, + value: agent[value_field], cat: `${agent.client} > ${agent.site}`, }));