diff --git a/api/tacticalrmm/checks/tests.py b/api/tacticalrmm/checks/tests.py
index 7f1c10e5..3545d350 100644
--- a/api/tacticalrmm/checks/tests.py
+++ b/api/tacticalrmm/checks/tests.py
@@ -4,13 +4,15 @@ from .serializers import CheckSerializer # , PolicyChecksSerializer
class TestCheckViews(BaseTestCase):
def test_add_disk_check(self):
- url = "/checks/"
+ url = "/checks/checks/"
disk_data = {
"pk": self.agent.pk,
- "check_type": "diskspace",
- "disk": "C:",
- "threshold": 41,
- "failure": 4,
+ "check": {
+ "check_type": "diskspace",
+ "disk": "C:",
+ "threshold": 41,
+ "failure": 4
+ }
}
resp = self.client.post(url, disk_data, format="json")
self.assertEqual(resp.status_code, 200)
@@ -22,13 +24,15 @@ class TestCheckViews(BaseTestCase):
self.check_not_authenticated("post", url)
def test_add_policy_disk_check(self):
- url = "/checks/"
+ url = "/checks/checks/"
policy_disk_data = {
"policy": self.policy.pk,
- "check_type": "diskspace",
- "disk": "M:",
- "threshold": 87,
- "failure": 1,
+ "check": {
+ "check_type": "diskspace",
+ "disk": "M:",
+ "threshold": 87,
+ "failure": 1,
+ }
}
resp = self.client.post(url, policy_disk_data, format="json")
self.assertEqual(resp.status_code, 200)
diff --git a/web/src/components/automation/PolicyChecksTab.vue b/web/src/components/automation/PolicyChecksTab.vue
index 59c76a76..d22a744f 100644
--- a/web/src/components/automation/PolicyChecksTab.vue
+++ b/web/src/components/automation/PolicyChecksTab.vue
@@ -151,14 +151,14 @@
@@ -247,22 +247,23 @@ export default {
};
},
methods: {
- checkAlertAction(pk, category, alert_type, alert_action) {
- const action = alert_action ? "enabled" : "disabled";
- const data = {
- alertType: alert_type,
- checkid: pk,
- category: category,
- action: action
- };
- const alertColor = alert_action ? "positive" : "warning";
+ checkAlert(id, alert_type, action) {
+ const data = {};
+ if (alert_type === "Email") {
+ data.email_alert = action;
+ } else {
+ data.text_alert = action;
+ }
+
+ const act = action ? "enabled" : "disabled";
+ const color = action ? "positive" : "warning";
this.$store
- .dispatch("editCheckAlertAction", data)
+ .dispatch("editCheckAlert", id, data)
.then(r => {
this.$q.notify({
- color: alertColor,
+ color: color,
icon: "fas fa-check-circle",
- message: `${alert_type} alerts ${action}`
+ message: `${alert_type} alerts ${act}`
});
});
},
@@ -310,14 +311,13 @@ export default {
deleteCheck(check) {
this.$q
.dialog({
- title: `Delete ${check.check_type} check`,
+ title: `Delete ${check.check_type} check?`,
ok: { label: "Delete", color: "negative" },
cancel: true,
})
.onOk(() => {
- const data = { pk: check.id, checktype: check.check_type };
this.$store
- .dispatch("deleteCheck", data)
+ .dispatch("deleteCheck", check.id)
.then(r => {
this.$store.dispatch("automation/loadPolicyChecks", check.id);
this.$q.notify(notifySuccessConfig("Check Deleted!"));
diff --git a/web/src/store/store.js b/web/src/store/store.js
index 90b84bf9..a9b37443 100644
--- a/web/src/store/store.js
+++ b/web/src/store/store.js
@@ -159,11 +159,11 @@ export const store = new Vuex.Store({
loadAgentServices(context, agentpk) {
return axios.get(`/services/${agentpk}/services/`);
},
- editCheckAlertAction(context, data) {
- return axios.patch("/checks/checkalert/", data);
+ editCheckAlert(context, pk, data) {
+ return axios.patch(`/checks/${pk}/check/`, data);
},
- deleteCheck(context, data) {
- return axios.delete("checks/deletestandardcheck/", { data: data });
+ deleteCheck(context, pk) {
+ return axios.delete(`/checks/${pk}/check/`);
},
editAutoTask(context, data) {
return axios.patch(`/tasks/${data.id}/automatedtasks/`, data);