add warning color to agents table and clients tree. Also made it upadte colors when checks UI is refreshed
This commit is contained in:
parent
6b95fc6f1d
commit
b31c13fcae
|
@ -187,7 +187,7 @@ class Agent(BaseAuditModel):
|
|||
"failing": failing,
|
||||
"warning": warning,
|
||||
"info": info,
|
||||
"has_failing_checks": failing > 0,
|
||||
"has_failing_checks": failing > 0 or warning > 0,
|
||||
}
|
||||
return ret
|
||||
|
||||
|
|
|
@ -113,7 +113,8 @@ class GetUpdateDeleteCheck(APIView):
|
|||
|
||||
# resolve any alerts that are open
|
||||
if "check_reset" in request.data.keys():
|
||||
obj.alert.filter(resolved=False).get().resolve()
|
||||
if obj.alert.filter(resolved=False).exists():
|
||||
obj.alert.get(resolved=False).resolve()
|
||||
|
||||
return Response(f"{obj.readable_desc} was edited!")
|
||||
|
||||
|
|
|
@ -86,16 +86,24 @@ class Client(BaseAuditModel):
|
|||
.prefetch_related("agentchecks")
|
||||
)
|
||||
|
||||
failing = 0
|
||||
data = {"error": False, "warning": False}
|
||||
|
||||
for agent in agents:
|
||||
if agent.checks["has_failing_checks"]:
|
||||
failing += 1
|
||||
|
||||
if agent.checks["warning"]:
|
||||
data["warning"] = True
|
||||
|
||||
if agent.checks["failing"]:
|
||||
data["error"] = True
|
||||
break
|
||||
|
||||
if agent.overdue_email_alert or agent.overdue_text_alert:
|
||||
if agent.status == "overdue":
|
||||
failing += 1
|
||||
data["error"] = True
|
||||
break
|
||||
|
||||
return failing > 0
|
||||
return data
|
||||
|
||||
@staticmethod
|
||||
def serialize(client):
|
||||
|
@ -184,16 +192,24 @@ class Site(BaseAuditModel):
|
|||
.prefetch_related("agentchecks")
|
||||
)
|
||||
|
||||
failing = 0
|
||||
data = {"error": False, "warning": False}
|
||||
|
||||
for agent in agents:
|
||||
|
||||
if agent.checks["has_failing_checks"]:
|
||||
failing += 1
|
||||
if agent.checks["warning"]:
|
||||
data["warning"] = True
|
||||
|
||||
if agent.checks["failing"]:
|
||||
data["error"] = True
|
||||
break
|
||||
|
||||
if agent.overdue_email_alert or agent.overdue_text_alert:
|
||||
if agent.status == "overdue":
|
||||
failing += 1
|
||||
data["error"] = True
|
||||
break
|
||||
|
||||
return failing > 0
|
||||
return data
|
||||
|
||||
@staticmethod
|
||||
def serialize(site):
|
||||
|
|
|
@ -95,7 +95,6 @@ class SiteTreeSerializer(ModelSerializer):
|
|||
class Meta:
|
||||
model = Site
|
||||
fields = "__all__"
|
||||
ordering = ("failing_checks",)
|
||||
|
||||
|
||||
class ClientTreeSerializer(ModelSerializer):
|
||||
|
@ -106,7 +105,6 @@ class ClientTreeSerializer(ModelSerializer):
|
|||
class Meta:
|
||||
model = Client
|
||||
fields = "__all__"
|
||||
ordering = ("failing_checks",)
|
||||
|
||||
|
||||
class DeploymentSerializer(ModelSerializer):
|
||||
|
|
|
@ -306,14 +306,15 @@
|
|||
<q-icon v-if="props.row.maintenance_mode" name="construction" size="1.2em" color="green">
|
||||
<q-tooltip>Maintenance Mode Enabled</q-tooltip>
|
||||
</q-icon>
|
||||
<q-icon
|
||||
v-else-if="props.row.checks.has_failing_checks"
|
||||
name="fas fa-check-double"
|
||||
size="1.2em"
|
||||
color="negative"
|
||||
>
|
||||
<q-icon v-else-if="props.row.checks.failing > 0" name="fas fa-check-double" size="1.2em" color="negative">
|
||||
<q-tooltip>Checks failing</q-tooltip>
|
||||
</q-icon>
|
||||
<q-icon v-else-if="props.row.checks.warning > 0" name="fas fa-check-double" size="1.2em" color="warning">
|
||||
<q-tooltip>Checks warning</q-tooltip>
|
||||
</q-icon>
|
||||
<q-icon v-else-if="props.row.checks.info > 0" name="fas fa-check-double" size="1.2em" color="info">
|
||||
<q-tooltip>Checks info</q-tooltip>
|
||||
</q-icon>
|
||||
<q-icon v-else name="fas fa-check-double" size="1.2em" color="positive">
|
||||
<q-tooltip>Checks passing</q-tooltip>
|
||||
</q-icon>
|
||||
|
|
|
@ -447,6 +447,7 @@ export default {
|
|||
axios
|
||||
.patch(`/checks/${check}/check/`, data)
|
||||
.then(r => {
|
||||
this.$emit("refreshEdit");
|
||||
this.$store.dispatch("loadChecks", this.selectedAgentPk);
|
||||
this.notifySuccess("The check was reset");
|
||||
})
|
||||
|
@ -455,6 +456,7 @@ export default {
|
|||
});
|
||||
},
|
||||
onRefresh(id) {
|
||||
this.$emit("refreshEdit");
|
||||
this.$store.dispatch("loadChecks", id);
|
||||
this.$store.dispatch("loadAutomatedTasks", id);
|
||||
},
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<SummaryTab />
|
||||
</q-tab-panel>
|
||||
<q-tab-panel name="checks" class="q-pb-xs q-pt-none">
|
||||
<ChecksTab />
|
||||
<ChecksTab @refreshEdit="$emit('refreshEdit')" />
|
||||
</q-tab-panel>
|
||||
<q-tab-panel name="tasks" class="q-pb-xs q-pt-none">
|
||||
<AutomatedTasksTab />
|
||||
|
|
|
@ -257,7 +257,8 @@ export default function () {
|
|||
}
|
||||
|
||||
if (site.maintenance_mode) { siteNode["color"] = "green" }
|
||||
else if (site.failing_checks) { siteNode["color"] = "negative" }
|
||||
else if (site.failing_checks.error) { siteNode["color"] = "negative" }
|
||||
else if (site.failing_checks.warning) { siteNode["color"] = "warning" }
|
||||
|
||||
childSites.push(siteNode);
|
||||
}
|
||||
|
@ -275,7 +276,8 @@ export default function () {
|
|||
}
|
||||
|
||||
if (client.maintenance_mode) clientNode["color"] = "green"
|
||||
else if (client.failing_checks) clientNode["color"] = "negative"
|
||||
else if (client.failing_checks.error) { clientNode["color"] = "negative" }
|
||||
else if (client.failing_checks.warning) { clientNode["color"] = "warning" }
|
||||
|
||||
output.push(clientNode);
|
||||
}
|
||||
|
|
|
@ -343,7 +343,7 @@
|
|||
<q-avatar color="primary" text-color="white" size="30px" icon="drag_indicator" />
|
||||
</template>
|
||||
<template v-slot:after>
|
||||
<SubTableTabs />
|
||||
<SubTableTabs @refreshEdit="refreshEntireSite" />
|
||||
</template>
|
||||
</q-splitter>
|
||||
</template>
|
||||
|
@ -727,7 +727,7 @@ export default {
|
|||
let data = {
|
||||
id: node.id,
|
||||
type: node.raw.split("|")[0],
|
||||
action: node.color === "warning" ? false : true,
|
||||
action: node.color === "green" ? false : true,
|
||||
};
|
||||
|
||||
const text = node.color === "warning" ? "Maintenance mode was disabled" : "Maintenance mode was enabled";
|
||||
|
@ -742,7 +742,7 @@ export default {
|
|||
});
|
||||
},
|
||||
menuMaintenanceText(node) {
|
||||
return node.color === "warning" ? "Disable Maintenance Mode" : "Enable Maintenance Mode";
|
||||
return node.color === "green" ? "Disable Maintenance Mode" : "Enable Maintenance Mode";
|
||||
},
|
||||
clearFilter() {
|
||||
this.filterTextLength = 0;
|
||||
|
|
Loading…
Reference in New Issue