This commit is contained in:
wh1te909
2019-10-22 22:22:36 +00:00
commit 8853ec0bd3
52 changed files with 14443 additions and 0 deletions

View File

@@ -0,0 +1,147 @@
<template>
<q-card style="min-width: 450px">
<q-card-section class="row items-center">
<div class="text-h6">Edit {{ hostname }}</div>
<q-space />
<q-btn icon="close" flat round dense v-close-popup />
</q-card-section>
<q-form @submit.prevent="editAgent">
<q-card-section>
<q-select
@input="site = sites[0]"
dense
outlined
v-model="client"
:options="Object.keys(tree)"
label="Client"
/>
</q-card-section>
<q-card-section>
<q-select dense outlined v-model="site" :options="sites" label="Site" />
</q-card-section>
<q-card-section>
<q-select dense outlined v-model="monType" :options="monTypes" label="Monitoring mode" />
</q-card-section>
<q-card-section>
<q-input
outlined
dense
v-model="desc"
label="Description"
:rules="[val => !!val || '*Required']"
/>
</q-card-section>
<q-card-section>
<q-input
dense
outlined
v-model.number="pingInterval"
label="Interval for ping checks (seconds)"
:rules="[
val => !!val || '*Required',
val => val >= 60 || 'Minimum is 60 seconds',
val => val <= 3600 || 'Maximum is 3600 seconds'
]"
/>
</q-card-section>
<q-card-section>
<q-input
dense
outlined
v-model.number="overdueTime"
label="Send an overdue alert if the server has not reported in after (minutes)"
:rules="[
val => !!val || '*Required',
val => val >= 5 || 'Minimum is 5 minutes',
val => val < 9999999 || 'Maximum is 9999999 minutes'
]"
/>
</q-card-section>
<q-card-section>
<q-checkbox v-model="emailAlert" label="Get overdue email alerts" />
<q-space />
<q-checkbox v-model="textAlert" label="Get overdue text alerts" />
</q-card-section>
<q-card-actions align="right">
<q-btn label="Save" color="primary" type="submit" />
<q-btn label="Cancel" v-close-popup />
</q-card-actions>
</q-form>
</q-card>
</template>
<script>
import axios from "axios";
import { mapGetters } from "vuex";
import mixins from "@/mixins/mixins";
export default {
name: "EditAgent",
mixins: [mixins],
data() {
return {
pk: null,
hostname: "",
client: "",
site: "",
monType: "",
monTypes: ["server", "workstation"],
desc: "",
overdueTime: null,
pingInterval: null,
emailAlert: null,
textAlert: null,
tree: {}
};
},
methods: {
getAgentInfo() {
axios.get(`/agents/${this.selectedAgentPk}/agentdetail/`).then(r => {
this.pk = r.data.id;
this.hostname = r.data.hostname;
this.client = r.data.client;
this.site = r.data.site;
this.monType = r.data.monitoring_type;
this.desc = r.data.description;
this.overdueTime = r.data.overdue_time;
this.pingInterval = r.data.ping_check_interval;
this.emailAlert = r.data.overdue_email_alert;
this.textAlert = r.data.overdue_text_alert;
});
},
getClientsSites() {
axios.get("/clients/loadclients/").then(r => this.tree = r.data);
},
editAgent() {
const data = {
pk: this.pk,
client: this.client,
site: this.site,
montype: this.monType,
desc: this.desc,
overduetime: this.overdueTime,
pinginterval: this.pingInterval,
emailalert: this.emailAlert,
textalert: this.textAlert
};
axios
.patch("/agents/editagent/", data)
.then(r => {
this.$emit("close");
this.$emit("edited");
this.notifySuccess("Agent was edited!");
})
.catch(e => this.notifyError(e.response.data.error));
}
},
computed: {
...mapGetters(["selectedAgentPk"]),
sites() {
return this.tree[this.client];
}
},
created() {
this.getAgentInfo();
this.getClientsSites();
}
};
</script>

View File

@@ -0,0 +1,61 @@
<template>
<q-card style="min-width: 400px">
<q-card-section class="row items-center">
<div class="text-h6">Add CPU Load Check</div>
<q-space />
<q-btn icon="close" flat round dense v-close-popup />
</q-card-section>
<q-form @submit.prevent="addCheck">
<q-card-section>
<q-input
outlined
v-model.number="threshold"
label="Alert if average utilization > (%)"
:rules="[
val => !!val || '*Required',
val => val >= 1 || 'Minimum threshold is 1',
val => val < 100 || 'Maximum threshold is 99'
]"
/>
</q-card-section>
<q-card-actions align="right">
<q-btn label="Add" color="primary" type="submit" />
<q-btn label="Cancel" v-close-popup />
</q-card-actions>
</q-form>
</q-card>
</template>
<script>
import axios from "axios";
import { mapState } from 'vuex';
import mixins from "@/mixins/mixins";
export default {
name: "AddCpuLoadCheck",
props: ["agentpk"],
mixins: [mixins],
data() {
return {
threshold: 85
};
},
methods: {
addCheck() {
const data = {
pk: this.agentpk,
check_type: "cpuload",
threshold: this.threshold
};
axios
.post("/checks/addstandardcheck/", data)
.then(r => {
this.$emit("close");
this.$store.dispatch("loadChecks", this.agentpk);
this.notifySuccess("CPU load check was added!");
})
.catch(e => this.notifyError(e.response.data.error));
}
}
};
</script>

View File

@@ -0,0 +1,76 @@
<template>
<q-card style="min-width: 400px">
<q-card-section class="row items-center">
<div class="text-h6">Add Disk Space Check</div>
<q-space />
<q-btn icon="close" flat round dense v-close-popup />
</q-card-section>
<q-form @submit.prevent="addCheck">
<q-card-section>
<q-select outlined v-model="firstdisk" :options="disks" label="Disk" />
</q-card-section>
<q-card-section>
<q-input
outlined
v-model.number="threshold"
label="Threshold (%)"
:rules="[
val => !!val || '*Required',
val => val >= 1 || 'Minimum threshold is 1',
val => val < 100 || 'Maximum threshold is 99'
]"
/>
</q-card-section>
<q-card-actions align="right">
<q-btn label="Add" color="primary" type="submit" />
<q-btn label="Cancel" v-close-popup />
</q-card-actions>
</q-form>
</q-card>
</template>
<script>
import axios from "axios";
import { mapState } from 'vuex';
import mixins from "@/mixins/mixins";
export default {
name: "AddDiskSpaceCheck",
props: ["agentpk"],
mixins: [mixins],
data() {
return {
threshold: 25,
disks: [],
firstdisk: ""
};
},
methods: {
getDisks() {
axios.get(`/checks/getdisks/${this.agentpk}/`).then(r => {
this.disks = Object.keys(r.data);
this.firstdisk = Object.keys(r.data)[0];
})
},
addCheck() {
const data = {
pk: this.agentpk,
check_type: "diskspace",
disk: this.firstdisk,
threshold: this.threshold
};
axios
.post("/checks/addstandardcheck/", data)
.then(r => {
this.$emit("close");
this.$store.dispatch("loadChecks", this.agentpk);
this.notifySuccess(`Disk check for drive ${data.disk} was added!`);
})
.catch(e => this.notifyError(e.response.data.error));
}
},
mounted() {
this.getDisks()
}
};
</script>

View File

@@ -0,0 +1,61 @@
<template>
<q-card style="min-width: 400px">
<q-card-section class="row items-center">
<div class="text-h6">Add Memory Check</div>
<q-space />
<q-btn icon="close" flat round dense v-close-popup />
</q-card-section>
<q-form @submit.prevent="addCheck">
<q-card-section>
<q-input
outlined
v-model.number="threshold"
label="Alert if average memory usage > (%)"
:rules="[
val => !!val || '*Required',
val => val >= 1 || 'Minimum threshold is 1',
val => val < 100 || 'Maximum threshold is 99'
]"
/>
</q-card-section>
<q-card-actions align="right">
<q-btn label="Add" color="primary" type="submit" />
<q-btn label="Cancel" v-close-popup />
</q-card-actions>
</q-form>
</q-card>
</template>
<script>
import axios from "axios";
import { mapState } from 'vuex';
import mixins from "@/mixins/mixins";
export default {
name: "AddMemCheck",
props: ["agentpk"],
mixins: [mixins],
data() {
return {
threshold: 85
};
},
methods: {
addCheck() {
const data = {
pk: this.agentpk,
check_type: "mem",
threshold: this.threshold
};
axios
.post("/checks/addstandardcheck/", data)
.then(r => {
this.$emit("close");
this.$store.dispatch("loadChecks", this.agentpk);
this.notifySuccess("Memory check was added!");
})
.catch(e => this.notifyError(e.response.data.error));
}
}
};
</script>

View File

@@ -0,0 +1,78 @@
<template>
<q-card style="min-width: 400px">
<q-card-section class="row items-center">
<div class="text-h6">Add Ping Check</div>
<q-space />
<q-btn icon="close" flat round dense v-close-popup />
</q-card-section>
<q-form @submit.prevent="addCheck">
<q-card-section>
<q-input
outlined
v-model="pingname"
label="Descriptive Name"
:rules="[val => !!val || '*Required']"
/>
</q-card-section>
<q-card-section>
<q-input
outlined
v-model="pingip"
label="Hostname or IP"
:rules="[val => !!val || '*Required']"
/>
</q-card-section>
<q-card-section>
<q-select
outlined
v-model="failure"
:options="failures"
label="Number of consecutive failures before alert"
/>
</q-card-section>
<q-card-actions align="right">
<q-btn label="Add" color="primary" type="submit" />
<q-btn label="Cancel" v-close-popup />
</q-card-actions>
</q-form>
</q-card>
</template>
<script>
import axios from "axios";
import { mapState } from "vuex";
import mixins from "@/mixins/mixins";
export default {
name: "AddPingCheck",
props: ["agentpk"],
mixins: [mixins],
data() {
return {
failure: 5,
failures: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
pingname: "",
pingip: ""
};
},
methods: {
addCheck() {
const data = {
pk: this.agentpk,
check_type: "ping",
failures: this.failure,
name: this.pingname,
ip: this.pingip,
};
axios
.post("/checks/addstandardcheck/", data)
.then(r => {
this.$emit("close");
this.$store.dispatch("loadChecks", this.agentpk);
this.notifySuccess("Ping check was added!");
})
.catch(e => this.notifyError(e.response.data.error));
}
}
};
</script>

View File

@@ -0,0 +1,97 @@
<template>
<q-card style="min-width: 400px">
<q-card-section class="row items-center">
<div class="text-h6">Add Windows Service Check</div>
<q-space />
<q-btn icon="close" flat round dense v-close-popup />
</q-card-section>
<q-form @submit.prevent="addCheck">
<q-card-section>
<q-select :rules="[val => !!val || '*Required']" dense outlined v-model="displayName" :options="svcDisplayNames" label="Service" @input="getRawName" />
</q-card-section>
<q-card-section>
<q-checkbox v-model="passIfStartPending" label="PASS if service is in 'Start Pending' mode" />
<q-checkbox v-model="restartIfStopped" label="RESTART service if it's stopped" />
</q-card-section>
<q-card-section>
<q-select
outlined
dense
v-model="failure"
:options="failures"
label="Number of consecutive failures before alert"
/>
</q-card-section>
<q-card-actions align="right">
<q-btn label="Add" color="primary" type="submit" />
<q-btn label="Cancel" v-close-popup />
</q-card-actions>
</q-form>
</q-card>
</template>
<script>
import axios from "axios";
import { mapState } from "vuex";
import mixins from "@/mixins/mixins";
export default {
name: "AddWinSvcCheck",
props: ["agentpk"],
mixins: [mixins],
data() {
return {
servicesData: [],
displayName: "",
rawName: [],
passIfStartPending: false,
restartIfStopped: false,
failure: 1,
failures: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
};
},
computed: {
svcDisplayNames() {
return this.servicesData.map(k => k.display_name).sort()
}
},
methods: {
async getServices() {
try {
let r = await axios.get(`/services/${this.agentpk}/services/`);
this.servicesData = Object.freeze([r.data][0].services);
} catch (e) {
console.log(`ERROR!: ${e}`);
}
},
getRawName() {
let svc = this.servicesData.find(k => k.display_name === this.displayName);
this.rawName = [svc].map(j => j.name);
},
addCheck() {
const data = {
pk: this.agentpk,
check_type: "winsvc",
displayname: this.displayName,
rawname: this.rawName[0],
passifstartpending: this.passIfStartPending,
restartifstopped: this.restartIfStopped,
failures: this.failure
};
axios
.post("/checks/addstandardcheck/", data)
.then(r => {
this.$emit("close");
this.$store.dispatch("loadChecks", this.agentpk);
this.notifySuccess(`${data.displayname} service check added!`);
})
.catch(e => this.notifyError(e.response.data.error));
}
},
mounted() {
this.getServices();
},
};
</script>

View File

@@ -0,0 +1,69 @@
<template>
<q-card style="min-width: 400px">
<q-card-section class="row items-center">
<div class="text-h6">Edit CPU Load Check</div>
<q-space />
<q-btn icon="close" flat round dense v-close-popup />
</q-card-section>
<q-form @submit.prevent="editCheck">
<q-card-section>
<q-input
outlined
v-model.number="threshold"
label="Alert if average utilization > (%)"
:rules="[
val => !!val || '*Required',
val => val >= 1 || 'Minimum threshold is 1',
val => val < 100 || 'Maximum threshold is 99'
]"
/>
</q-card-section>
<q-card-actions align="right">
<q-btn label="Edit" color="primary" type="submit" />
<q-btn label="Cancel" v-close-popup />
</q-card-actions>
</q-form>
</q-card>
</template>
<script>
import axios from "axios";
import { mapState } from 'vuex';
import mixins from "@/mixins/mixins";
export default {
name: "EditCpuLoadCheck",
props: ["agentpk", "editCheckPK"],
mixins: [mixins],
data() {
return {
threshold: null
};
},
methods: {
getCheck() {
axios
.get(`/checks/getstandardcheck/cpuload/${this.editCheckPK}/`)
.then(r => this.threshold = r.data.cpuload);
},
editCheck() {
const data = {
pk: this.editCheckPK,
check_type: "cpuload",
threshold: this.threshold
};
axios
.patch("/checks/editstandardcheck/", data)
.then(r => {
this.$emit("close");
this.$store.dispatch("loadChecks", this.agentpk);
this.notifySuccess("CPU load check was edited!");
})
.catch(e => this.notifyError(e.response.data.error));
}
},
mounted() {
this.getCheck();
}
};
</script>

View File

@@ -0,0 +1,74 @@
<template>
<q-card style="min-width: 400px">
<q-card-section class="row items-center">
<div class="text-h6">Edit Disk Space Check</div>
<q-space />
<q-btn icon="close" flat round dense v-close-popup />
</q-card-section>
<q-form @submit.prevent="editCheck">
<q-card-section>
<q-select outlined disable v-model="diskToEdit" :options="disks" label="Disk" />
</q-card-section>
<q-card-section>
<q-input
outlined
v-model.number="threshold"
label="Threshold (%)"
:rules="[
val => !!val || '*Required',
val => val >= 1 || 'Minimum threshold is 1',
val => val < 100 || 'Maximum threshold is 99'
]"
/>
</q-card-section>
<q-card-actions align="right">
<q-btn label="Edit" color="primary" type="submit" />
<q-btn label="Cancel" v-close-popup />
</q-card-actions>
</q-form>
</q-card>
</template>
<script>
import axios from "axios";
import mixins from "@/mixins/mixins";
export default {
name: "EditDiskSpaceCheck",
props: ["editCheckPK", "agentpk"],
mixins: [mixins],
data() {
return {
threshold: null,
disks: [],
diskToEdit: ""
};
},
methods: {
getCheck() {
axios.get(`/checks/getstandardcheck/diskspace/${this.editCheckPK}/`).then(r => {
this.disks = [r.data.disk];
this.diskToEdit = r.data.disk;
this.threshold = r.data.threshold;
})
},
editCheck() {
const data = {
check_type: "diskspace",
pk: this.editCheckPK,
threshold: this.threshold
}
axios.patch("/checks/editstandardcheck/", data)
.then(r => {
this.$emit("close");
this.$store.dispatch("loadChecks", this.agentpk);
this.notifySuccess("Disk space check was edited!")
})
.catch(e => this.notifyError(e.response.data.error));
}
},
mounted() {
this.getCheck()
}
};
</script>

View File

@@ -0,0 +1,69 @@
<template>
<q-card style="min-width: 400px">
<q-card-section class="row items-center">
<div class="text-h6">Edit Memory Check</div>
<q-space />
<q-btn icon="close" flat round dense v-close-popup />
</q-card-section>
<q-form @submit.prevent="editCheck">
<q-card-section>
<q-input
outlined
v-model.number="threshold"
label="Alert if average memory usage > (%)"
:rules="[
val => !!val || '*Required',
val => val >= 1 || 'Minimum threshold is 1',
val => val < 100 || 'Maximum threshold is 99'
]"
/>
</q-card-section>
<q-card-actions align="right">
<q-btn label="Edit" color="primary" type="submit" />
<q-btn label="Cancel" v-close-popup />
</q-card-actions>
</q-form>
</q-card>
</template>
<script>
import axios from "axios";
import { mapState } from 'vuex';
import mixins from "@/mixins/mixins";
export default {
name: "EditMemCheck",
props: ["agentpk", "editCheckPK"],
mixins: [mixins],
data() {
return {
threshold: null
};
},
methods: {
getCheck() {
axios
.get(`/checks/getstandardcheck/mem/${this.editCheckPK}/`)
.then(r => this.threshold = r.data.threshold);
},
editCheck() {
const data = {
pk: this.editCheckPK,
check_type: "mem",
threshold: this.threshold
};
axios
.patch("/checks/editstandardcheck/", data)
.then(r => {
this.$emit("close");
this.$store.dispatch("loadChecks", this.agentpk);
this.notifySuccess("Memory check was edited!");
})
.catch(e => this.notifyError(e.response.data.error));
}
},
mounted() {
this.getCheck();
}
};
</script>

View File

@@ -0,0 +1,90 @@
<template>
<q-card style="min-width: 400px">
<q-card-section class="row items-center">
<div class="text-h6">Edit Ping Check</div>
<q-space />
<q-btn icon="close" flat round dense v-close-popup />
</q-card-section>
<q-form @submit.prevent="editCheck">
<q-card-section>
<q-input
outlined
v-model="pingname"
label="Descriptive Name"
:rules="[val => !!val || '*Required']"
/>
</q-card-section>
<q-card-section>
<q-input
outlined
v-model="pingip"
label="Hostname or IP"
:rules="[val => !!val || '*Required']"
/>
</q-card-section>
<q-card-section>
<q-select
outlined
v-model="failure"
:options="failures"
label="Number of consecutive failures before alert"
/>
</q-card-section>
<q-card-actions align="right">
<q-btn label="Edit" color="primary" type="submit" />
<q-btn label="Cancel" v-close-popup />
</q-card-actions>
</q-form>
</q-card>
</template>
<script>
import axios from "axios";
import { mapState } from "vuex";
import mixins from "@/mixins/mixins";
export default {
name: "EditPingCheck",
props: ["agentpk", "editCheckPK"],
mixins: [mixins],
data() {
return {
failure: null,
failures: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
pingname: "",
pingip: ""
};
},
methods: {
getCheck() {
axios
.get(`/checks/getstandardcheck/ping/${this.editCheckPK}/`)
.then(r => {
this.failure = r.data.failures;
this.pingname = r.data.name;
this.pingip = r.data.ip;
});
},
editCheck() {
const data = {
pk: this.editCheckPK,
check_type: "ping",
failures: this.failure,
name: this.pingname,
ip: this.pingip
};
axios
.patch("/checks/editstandardcheck/", data)
.then(r => {
this.$emit("close");
this.$store.dispatch("loadChecks", this.agentpk);
this.notifySuccess("Ping check was edited!");
})
.catch(e => this.notifyError(e.response.data.error));
}
},
mounted() {
this.getCheck();
}
};
</script>

View File

@@ -0,0 +1,89 @@
<template>
<q-card style="min-width: 400px">
<q-card-section class="row items-center">
<div class="text-h6">Edit Windows Service Check</div>
<q-space />
<q-btn icon="close" flat round dense v-close-popup />
</q-card-section>
<q-form @submit.prevent="editCheck">
<q-card-section>
<q-select disable dense outlined v-model="displayName" :options="svcDisplayNames" label="Service" />
</q-card-section>
<q-card-section>
<q-checkbox v-model="passIfStartPending" label="PASS if service is in 'Start Pending' mode" />
<q-checkbox v-model="restartIfStopped" label="RESTART service if it's stopped" />
</q-card-section>
<q-card-section>
<q-select
outlined
dense
v-model="failure"
:options="failures"
label="Number of consecutive failures before alert"
/>
</q-card-section>
<q-card-actions align="right">
<q-btn label="Edit" color="primary" type="submit" />
<q-btn label="Cancel" v-close-popup />
</q-card-actions>
</q-form>
</q-card>
</template>
<script>
import axios from "axios";
import { mapState } from "vuex";
import mixins from "@/mixins/mixins";
export default {
name: "EditWinSvcCheck",
props: ["agentpk", "editCheckPK"],
mixins: [mixins],
data() {
return {
displayName: "",
svcDisplayNames: [],
passIfStartPending: null,
restartIfStopped: null,
failure: null,
failures: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
};
},
methods: {
async getService() {
try {
let r = await axios.get(`/checks/getstandardcheck/winsvc/${this.editCheckPK}/`);
this.svcDisplayNames = [r.data.svc_display_name];
this.displayName = r.data.svc_display_name;
this.passIfStartPending = r.data.pass_if_start_pending;
this.restartIfStopped = r.data.restart_if_stopped;
this.failure = r.data.failures;
} catch (e) {
console.log(`ERROR!: ${e}`);
}
},
editCheck() {
const data = {
pk: this.editCheckPK,
check_type: "winsvc",
failures: this.failure,
passifstartpending: this.passIfStartPending,
restartifstopped: this.restartIfStopped
};
axios
.patch("/checks/editstandardcheck/", data)
.then(r => {
this.$emit("close");
this.$store.dispatch("loadChecks", this.agentpk);
this.notifySuccess("Windows service check was edited!");
})
.catch(e => this.notifyError(e.response.data.error));
}
},
mounted() {
this.getService();
},
};
</script>

View File

@@ -0,0 +1,139 @@
<template>
<div class="q-pa-md q-gutter-sm">
<q-dialog
:value="toggleLogModal"
@hide="hideLogModal"
@show="getLog"
maximized
transition-show="slide-up"
transition-hide="slide-down"
>
<q-card class="bg-grey-10 text-white">
<q-bar>
<q-btn @click="getLog" class="q-mr-sm" dense flat push icon="refresh" label="Refresh" />
Debug Log
<q-space />
<q-btn color="primary" text-color="white" label="Download log" @click="downloadLog" />
<q-space />
<q-btn dense flat icon="close" v-close-popup>
<q-tooltip content-class="bg-white text-primary">Close</q-tooltip>
</q-btn>
</q-bar>
<div class="q-pa-md row">
<div class="col-2">
<q-select
dark
dense
outlined
v-model="agent"
:options="agents"
label="Filter Agent"
@input="getLog"
/>
</div>
<div class="col-1">
<q-select
dark
dense
outlined
v-model="order"
:options="orders"
label="Order"
@input="getLog"
/>
</div>
</div>
<q-card-section>
<q-radio
dark
v-model="loglevel"
color="cyan"
val="info"
label="Info"
@input="getLog"
/>
<q-radio
dark
v-model="loglevel"
color="red"
val="critical"
label="Critical"
@input="getLog"
/>
<q-radio
dark
v-model="loglevel"
color="red"
val="error"
label="Error"
@input="getLog"
/>
<q-radio
dark
v-model="loglevel"
color="yellow"
val="warning"
label="Warning"
@input="getLog"
/>
</q-card-section>
<q-separator />
<q-card-section>
<q-scroll-area
:thumb-style="{ right: '4px', borderRadius: '5px', background: 'red', width: '10px', opacity: 1 }"
style="height: 60vh;"
>
<pre>{{ logContent }}</pre>
</q-scroll-area>
</q-card-section>
</q-card>
</q-dialog>
</div>
</template>
<script>
import axios from "axios";
import { mapState } from 'vuex';
export default {
name: "LogModal",
data() {
return {
logContent: "",
loglevel: "info",
agent: "all",
agents: [],
order: "latest",
orders: ["latest", "oldest"]
};
},
methods: {
downloadLog() {
axios.get("/api/v1/downloadrmmlog/", { responseType: 'blob' })
.then(({ data }) => {
const blob = new Blob([data], { type: 'text/plain' })
let link = document.createElement('a')
link.href = window.URL.createObjectURL(blob)
link.download = 'debug.log'
link.click()
})
.catch(error => console.error(error))
},
getLog() {
axios.get(`/api/v1/getrmmlog/${this.loglevel}/${this.agent}/${this.order}/`).then(r => {
this.logContent = r.data.log;
this.agents = r.data.agents.map(k => k.hostname);
this.agents.unshift("all");
});
},
hideLogModal() {
this.$store.commit("logs/TOGGLE_LOG_MODAL", false);
}
},
computed: {
...mapState({
toggleLogModal: state => state.logs.toggleLogModal
})
}
};
</script>