reworked policy add for client, site, and agent. removed vue unit tests, added alertign to auto tasks, added edit autotask capabilities for certain fields, moved policy generation logic to save method on Client, Site, Agent, Policy models

This commit is contained in:
sadnub
2021-01-29 13:25:58 -05:00
parent 99d3a8a749
commit 66d7172e09
35 changed files with 661 additions and 2054 deletions

View File

@@ -109,29 +109,47 @@ export default {
}
this.$q.loading.show();
let data = {
pk: this.object.id,
type: this.type,
};
let data = {};
let url = "";
if (this.type === "client" || this.type === "site") {
data.server_policy = this.selectedServerPolicy;
data.workstation_policy = this.selectedWorkstationPolicy;
} else if (this.type === "agent") {
data.policy = this.selectedAgentPolicy;
}
data = {
pk: this.object.id,
server_policy: this.selectedServerPolicy,
workstation_policy: this.selectedWorkstationPolicy,
};
this.$axios
.post(`/automation/related/`, data)
.then(r => {
this.$q.loading.hide();
this.onOk();
this.notifySuccess("Policies Updated Successfully!");
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an error updating policies");
});
if (this.type === "client") url = `/clients/${this.object.id}/client/`;
else if (this.type === "site") url = `/clients/${this.object.id}/site/`;
this.$axios
.put(url, data)
.then(r => {
this.$q.loading.hide();
this.onOk();
this.notifySuccess("Policies Updated Successfully!");
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an error updating policies");
});
} else if (this.type === "agent") {
data = {
id: this.object.id,
policy: this.selectedAgentPolicy,
};
this.$axios
.patch("/agents/editagent/", data)
.then(r => {
this.$q.loading.hide();
this.onOk();
this.notifySuccess("Policies Updated Successfully!");
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an error updating policies");
});
}
},
getPolicies() {
this.$q.loading.show();