From 26cfec7d807e05880a0cd1d52189a9cc3f7cadfa Mon Sep 17 00:00:00 2001 From: sadnub Date: Thu, 15 Apr 2021 16:52:42 -0400 Subject: [PATCH] add reset check status to check context menu. #388 --- api/tacticalrmm/checks/views.py | 5 ++++- web/src/components/ChecksTab.vue | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/api/tacticalrmm/checks/views.py b/api/tacticalrmm/checks/views.py index ad16ebd6..b6f3b8aa 100644 --- a/api/tacticalrmm/checks/views.py +++ b/api/tacticalrmm/checks/views.py @@ -86,7 +86,10 @@ class GetUpdateDeleteCheck(APIView): check = get_object_or_404(Check, pk=pk) # remove fields that should not be changed when editing a check from the frontend - if "check_alert" not in request.data.keys(): + if ( + "check_alert" not in request.data.keys() + and "check_reset" not in request.data.keys() + ): [request.data.pop(i) for i in check.non_editable_fields] # set event id to 0 if wildcard because it needs to be an integer field for db diff --git a/web/src/components/ChecksTab.vue b/web/src/components/ChecksTab.vue index f0240b16..957d19ec 100644 --- a/web/src/components/ChecksTab.vue +++ b/web/src/components/ChecksTab.vue @@ -124,6 +124,13 @@ Delete + + + + + Reset Check Status + + Close @@ -431,6 +438,22 @@ export default { }); }); }, + resetCheck(check) { + const data = { + check_reset: true, + status: "passing", + }; + + axios + .patch(`/checks/${check}/check/`, data) + .then(r => { + this.$store.dispatch("loadChecks", this.selectedAgentPk); + this.notifySuccess("The check was reset"); + }) + .catch(e => { + this.notifyError("There was an issue resetting the check"); + }); + }, onRefresh(id) { this.$store.dispatch("loadChecks", id); this.$store.dispatch("loadAutomatedTasks", id);