add server maintenance to tools menu

This commit is contained in:
Josh
2020-12-01 03:44:58 +00:00
parent f40fcd7142
commit 6529bcd821
2 changed files with 107 additions and 2 deletions

View File

@@ -130,6 +130,10 @@
<q-item clickable v-close-popup @click="showBulkActionModal('scan')">
<q-item-section>Bulk Patch Management</q-item-section>
</q-item>
<!-- server maintenance -->
<q-item clickable v-close-popup @click="showServerMaintenance = true">
<q-item-section>Server Maintenance</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
@@ -196,16 +200,18 @@
<q-dialog v-model="showUploadMesh">
<UploadMesh @close="showUploadMesh = false" />
</q-dialog>
<!-- Bulk action modal -->
<q-dialog v-model="showBulkAction" @hide="closeBulkActionModal" position="top">
<BulkAction :mode="bulkMode" @close="closeBulkActionModal" />
</q-dialog>
<!-- Agent Deployment -->
<q-dialog v-model="showDeployment">
<Deployment @close="showDeployment = false" />
</q-dialog>
<!-- Server Maintenance -->
<q-dialog v-model="showServerMaintenance">
<ServerMaintenance @close="showMaintenance = false" />
</q-dialog>
</q-bar>
</div>
</template>
@@ -225,6 +231,7 @@ import UploadMesh from "@/components/modals/core/UploadMesh";
import AuditManager from "@/components/AuditManager";
import BulkAction from "@/components/modals/agents/BulkAction";
import Deployment from "@/components/Deployment";
import ServerMaintenance from "@/components/modals/core/ServerMaintenance";
export default {
name: "FileBar",
@@ -243,10 +250,12 @@ export default {
AuditManager,
BulkAction,
Deployment,
ServerMaintenance,
},
props: ["clients"],
data() {
return {
showServerMaintenance: false,
showClientFormModal: false,
showSiteFormModal: false,
clientOp: null,

View File

@@ -0,0 +1,96 @@
<template>
<q-card style="min-width: 400px">
<q-card-section class="row">
<q-card-actions align="left">
<div class="text-h6">Server Maintenance</div>
</q-card-actions>
<q-space />
<q-card-actions align="right">
<q-btn v-close-popup flat round dense icon="close" />
</q-card-actions>
</q-card-section>
<q-card-section>
<q-form @submit.prevent="submit">
<q-card-section>
<q-select
:rules="[val => !!val || '*Required']"
outlined
options-dense
label="Actions"
v-model="action"
:options="actions"
emit-value
map-options
@input="clear"
/>
</q-card-section>
<q-card-section v-if="action === 'prune_db'">
<q-checkbox v-model="prune_tables" val="agent_outages" label="Agent outage">
<q-tooltip>Removes resolved agent outage records</q-tooltip>
</q-checkbox>
<q-checkbox v-model="prune_tables" val="audit_logs" label="Audit Log">
<q-tooltip>Removes agent check results</q-tooltip>
</q-checkbox>
<q-checkbox v-model="prune_tables" val="pending_actions" label="Pending Actions">
<q-tooltip>Removes completed pending actions</q-tooltip>
</q-checkbox>
</q-card-section>
<q-card-actions align="left">
<q-btn label="Submit" color="primary" type="submit" class="full-width" />
</q-card-actions>
</q-form>
</q-card-section>
</q-card>
</template>
<script>
import axios from "axios";
import mixins from "@/mixins/mixins";
export default {
name: "ServerMaintenance",
mixins: [mixins],
data() {
return {
action: null,
prune_tables: [],
actions: [
{
label: "Reload Nats Configuration",
value: "reload_nats",
},
{
label: "Prune DB Tables",
value: "prune_db",
},
],
};
},
methods: {
clear() {
this.prune_tables = [];
},
submit() {
this.$q.loading.show();
let data = {
action: this.action,
prune_tables: this.prune_tables,
};
this.$axios
.post("core/servermaintenance/", data)
.then(r => {
this.$q.loading.hide();
this.notifySuccess(r.data);
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.data);
});
},
},
};
</script>