Fixed Check History graph and reworked task sync_status

This commit is contained in:
sadnub
2022-03-27 00:16:44 -04:00
parent 26cf26f283
commit e04ca7c400
5 changed files with 40 additions and 20 deletions

View File

@@ -187,12 +187,13 @@
</q-icon>
</q-td>
<!-- status icon -->
<q-td v-if="props.row.status === 'passing'">
<q-td v-if="Object.keys(props.row.task_result).length === 0"></q-td>
<q-td v-if="props.row.task_result.status === 'passing'">
<q-icon style="font-size: 1.3rem" color="positive" name="check_circle">
<q-tooltip>Passing</q-tooltip>
</q-icon>
</q-td>
<q-td v-else-if="props.row.status === 'failing'">
<q-td v-else-if="props.row.task_result.status === 'failing'">
<q-icon v-if="props.row.alert_severity === 'info'" style="font-size: 1.3rem" color="info" name="info">
<q-tooltip>Informational</q-tooltip>
</q-icon>
@@ -212,12 +213,15 @@
<!-- name -->
<q-td>{{ props.row.name }}</q-td>
<!-- sync status -->
<q-td v-if="props.row.sync_status === 'notsynced'">Will sync on next agent checkin</q-td>
<q-td v-else-if="props.row.sync_status === 'synced'">Synced with agent</q-td>
<q-td v-else-if="props.row.sync_status === 'pendingdeletion'">Pending deletion on agent</q-td>
<q-td v-else-if="props.row.sync_status === 'initial'">Waiting for task creation on agent</q-td>
<q-td v-else></q-td>
<q-td v-if="props.row.retcode !== null || props.row.stdout || props.row.stderr">
<q-td v-if="props.row.task_result.sync_status === 'notsynced'">Will sync on next agent checkin</q-td>
<q-td v-else-if="props.row.task_result.sync_status === 'synced'">Synced with agent</q-td>
<q-td v-else-if="props.row.task_result.sync_status === 'pendingdeletion'">Pending deletion on agent</q-td>
<q-td v-else>Waiting for task creation on agent</q-td>
<q-td
v-if="
props.row.task_result.retcode !== null || props.row.task_result.stdout || props.row.task_result.stderr
"
>
<span
style="cursor: pointer; text-decoration: underline"
class="text-primary"
@@ -226,7 +230,7 @@
>
</q-td>
<q-td v-else>Awaiting output</q-td>
<q-td v-if="props.row.last_run">{{ formatDate(props.row.last_run) }}</q-td>
<q-td v-if="props.row.last_run">{{ formatDate(props.row.task_result.last_run) }}</q-td>
<q-td v-else>Has not run yet</q-td>
<q-td>{{ props.row.schedule }}</q-td>
<q-td>
@@ -411,7 +415,7 @@ export default {
$q.dialog({
component: ScriptOutput,
componentProps: {
scriptInfo: script,
scriptInfo: script.task_result,
},
});
}

View File

@@ -257,7 +257,7 @@
v-else-if="props.row.check_type === 'script'"
style="cursor: pointer; text-decoration: underline"
class="text-primary"
@click="showScriptOutput(props.row)"
@click="showScriptOutput(props.row.check_result)"
>Last Output</span
>
<span
@@ -289,7 +289,7 @@ import { useQuasar } from "quasar";
import { updateCheck, removeCheck, resetCheck } from "@/api/checks";
import { fetchAgentChecks } from "@/api/agents";
import { truncateText } from "@/utils/format";
import { notifySuccess } from "@/utils/notify";
import { notifySuccess, notifyWarning } from "@/utils/notify";
// ui imports
import DiskSpaceCheck from "@/components/checks/DiskSpaceCheck";
@@ -403,9 +403,16 @@ export default {
}
async function resetCheckStatus(check) {
// make sure there is a check result before sending
if (!check.check_result.status) {
notifyWarning("Check hasn't run yet");
} else if (check.check_result.status === "passing") {
notifyWarning("Check is already passing");
}
loading.value = true;
try {
const result = await resetCheck(check.id);
const result = await resetCheck(check.check_result.id);
await getChecks();
notifySuccess(result);
refreshDashboard(false /* clearTreeSelected */, false /* clearSubTable */);
@@ -446,7 +453,7 @@ export default {
$q.dialog({
title: check.readable_desc,
style: "width: 50vw; max-width: 60vw",
message: `<pre>${check.more_info}</pre>`,
message: `<pre>${check.check_result.more_info}</pre>`,
html: true,
});
}
@@ -477,7 +484,6 @@ export default {
watch(selectedAgent, (newValue, oldValue) => {
if (newValue) {
getChecks();
console.log(checks.value);
}
});

View File

@@ -8,14 +8,14 @@
<q-tooltip class="bg-white text-primary">Close</q-tooltip>
</q-btn>
</q-bar>
<div v-if="evtLogData.extra_details !== null">
<div v-if="evtLogData.check_result.extra_details !== null">
<q-table
dense
style="height: 65vh"
:table-class="{ 'table-bgcolor': !$q.dark.isActive, 'table-bgcolor-dark': $q.dark.isActive }"
class="tabs-tbl-sticky"
:filter="filter"
:rows="evtLogData.extra_details.log"
:rows="evtLogData.check_result.extra_details.log"
:columns="columns"
v-model:pagination="pagination"
row-key="uid"
@@ -31,7 +31,7 @@
<q-icon name="search" color="primary" />
</template>
</q-input>
<export-table-btn :data="evtLogData.extra_details.log" :columns="columns" />
<export-table-btn :data="evtLogData.check_result.extra_details.log" :columns="columns" />
</template>
</q-table>
</div>

View File

@@ -11,7 +11,7 @@
<q-card-section style="height: 70vh" class="scroll">
<div>
Last Run:
<code>{{ scriptInfo.last_run }}</code>
<code>{{ formatDate(scriptInfo.last_run) }}</code>
<br />Run Time:
<code>{{ scriptInfo.execution_time }} seconds</code>
<br />Return Code:
@@ -39,6 +39,8 @@
<script>
// composition imports
import { computed } from "vue";
import { useStore } from "vuex";
import { useDialogPluginComponent } from "quasar";
export default {
@@ -46,10 +48,18 @@ export default {
emits: [...useDialogPluginComponent.emits],
props: { scriptInfo: !Object },
setup(props) {
// setup vuex
const store = useStore();
const formatDate = computed(() => store.getters.formatDate);
// quasar dialog setup
const { dialogRef, onDialogHide } = useDialogPluginComponent();
return {
// methods
formatDate,
// quasar dialog
dialogRef,
onDialogHide,
};

View File

@@ -124,7 +124,7 @@ export default {
this.$q.loading.show();
this.$axios
.patch(`/checks/${this.check.id}/history/`, { timeFilter: this.timeFilter })
.patch(`/checks/${this.check.check_result.id}/history/`, { timeFilter: this.timeFilter })
.then(r => {
this.history = Object.freeze(r.data);