error handling and axios changes

This commit is contained in:
sadnub
2021-04-30 18:35:52 -04:00
parent 1edc4f288a
commit baec3d6f19
80 changed files with 497 additions and 588 deletions

View File

@@ -1,5 +1,6 @@
import Vue from 'vue';
import axios from 'axios';
import { Notify } from "quasar"
export const getBaseUrl = () => {
if (process.env.NODE_ENV === "production") {
@@ -33,16 +34,51 @@ export default function ({ router, store }) {
axios.interceptors.response.use(
function (response) {
if (response.status === 400) {
return Promise.reject(response);
}
return response;
},
function (error) {
if (error.response.status === 401) {
let text
if (!error.response) {
text = error.message
}
// unauthorized
else if (error.response.status === 401) {
router.push({ path: "/expired" });
}
return Promise.reject(error);
else if (error.response.status === 400) {
if (error.response.data.non_field_errors) {
text = error.response.data.non_field_errors[0]
} else {
if (typeof error.response.data === "string") {
text = error.response.data
} else if (typeof error.response.data === "object") {
let [key, value] = Object.entries(error.response.data)[0]
text = key + ": " + value[0]
}
}
}
else if (error.response.status === 406) {
text = "Missing 64 bit meshagent.exe. Upload it from File > Upload Mesh Agent"
}
else if (error.response.status === 415) {
text = "Missing 32 bit meshagent-x86.exe. Upload it from File > Upload Mesh Agent"
}
if (text || error.response) {
Notify.create({
color: "negative",
message: text ? text : "",
caption: error.response ? error.response.status + ": " + error.response.statusText : "",
timeout: 2500
})
}
return Promise.reject({ ...error });
}
);
}

View File

@@ -137,7 +137,7 @@
</template>
<script>
import mixins, { notifySuccessConfig, notifyErrorConfig } from "@/mixins/mixins";
import mixins from "@/mixins/mixins";
import { mapState } from "vuex";
import UserForm from "@/components/modals/admin/UserForm";
import UserResetPasswordForm from "@/components/modals/admin/UserResetPasswordForm";
@@ -203,11 +203,9 @@ export default {
this.$store
.dispatch("admin/deleteUser", data.id)
.then(() => {
this.$q.notify(notifySuccessConfig(`User ${data.username} was deleted!`));
this.notifySuccess(`User ${data.username} was deleted!`);
})
.catch(e => {
this.$q.notify(notifyErrorConfig(e.response.data));
});
.catch(e => {});
});
},
showEditUserModal(data) {
@@ -238,11 +236,9 @@ export default {
this.$store
.dispatch("admin/editUser", data)
.then(response => {
this.$q.notify(notifySuccessConfig(text));
this.notifySuccess(text);
})
.catch(error => {
this.$q.notify(notifyErrorConfig("An Error occured while editing user"));
});
.catch(e => {});
},
ResetPassword(user) {
this.resetUserId = user.id;
@@ -266,14 +262,9 @@ export default {
ok: { label: "Reset", color: "positive" },
})
.onOk(() => {
this.$store
.dispatch("admin/resetUserTOTP", data)
.then(response => {
this.$q.notify(notifySuccessConfig(response.data, 4000));
})
.catch(e => {
this.$q.notify(notifyErrorConfig(e.response.data));
});
this.$store.dispatch("admin/resetUserTOTP", data).then(response => {
this.notifySuccess(response.data, 4000);
});
});
},
rowSelectedClass(id, selected) {

View File

@@ -400,7 +400,6 @@
</template>
<script>
import { notifySuccessConfig, notifyErrorConfig } from "@/mixins/mixins";
import mixins from "@/mixins/mixins";
import { mapGetters } from "vuex";
import { date } from "quasar";
@@ -523,7 +522,7 @@ export default {
this.$axios
.post("/agents/runscript/", data)
.then(r => this.notifySuccess(r.data))
.catch(e => this.notifyError(e.response.data));
.catch(e => {});
},
getFavoriteScripts() {
this.favoriteScripts = [];
@@ -536,7 +535,8 @@ export default {
.filter(k => k.favorite === true)
.map(script => ({ label: script.name, value: script.id, timeout: script.default_timeout, args: script.args }))
.sort((a, b) => a.label.localeCompare(b.label));
});
})
.catch(e => {});
},
runPatchStatusScan(pk, hostname) {
this.$axios
@@ -544,7 +544,7 @@ export default {
.then(r => {
this.notifySuccess(`Scan will be run shortly on ${hostname}`);
})
.catch(e => this.notifyError(e.response.data));
.catch(e => {});
},
installPatches(pk) {
this.$q.loading.show();
@@ -556,7 +556,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.response.data, 5000);
});
},
agentEdited() {
@@ -588,7 +587,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.response.data);
});
},
removeAgent(pk, name) {
@@ -615,7 +613,7 @@ export default {
location.reload();
}, 2000);
})
.catch(() => this.notifyError("Something went wrong"));
.catch(e => {});
});
},
pingAgent(pk) {
@@ -647,7 +645,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.response.data);
});
},
rebootNow(pk, hostname) {
@@ -668,7 +665,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.response.data);
});
});
},
@@ -702,7 +698,7 @@ export default {
message: `Overdue ${category} alerts ${action} on ${r.data}`,
});
})
.catch(() => this.notifyError("Something went wrong"));
.catch(e => {});
},
agentClass(status) {
if (status === "offline") {
@@ -733,15 +729,10 @@ export default {
};
const text = agent.maintenance_mode ? "Maintenance mode was disabled" : "Maintenance mode was enabled";
this.$store
.dispatch("toggleMaintenanceMode", data)
.then(response => {
this.$q.notify(notifySuccessConfig(text));
this.$emit("refreshEdit");
})
.catch(error => {
this.$q.notify(notifyErrorConfig("An Error occured. Please try again"));
});
this.$store.dispatch("toggleMaintenanceMode", data).then(response => {
this.notifySuccess(text);
this.$emit("refreshEdit");
});
},
menuMaintenanceText(mode) {
return mode ? "Disable Maintenance Mode" : "Enable Maintenance Mode";

View File

@@ -69,7 +69,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
//this.notifyError("Unable to get alerts");
});
},
showOverview() {
@@ -112,7 +111,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an issue snoozing alert");
});
});
},
@@ -133,7 +131,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an issue resolving alert");
});
},
alertIconColor(severity) {

View File

@@ -222,7 +222,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("Unable to pull Alert Templates.");
});
},
clearRow() {
@@ -250,7 +249,6 @@ export default {
})
.catch(error => {
this.$q.loading.hide();
this.notifyError(`An Error occured while deleting alert template: ${template.name}`);
});
});
},
@@ -307,9 +305,7 @@ export default {
.then(r => {
this.notifySuccess(text);
})
.catch(error => {
this.notifyError("An Error occured while editing the template");
});
.catch(error => {});
},
rowSelectedClass(id, selectedTemplate) {
if (selectedTemplate && selectedTemplate.id === id) return this.$q.dark.isActive ? "highlight-dark" : "highlight";

View File

@@ -274,9 +274,12 @@ export default {
},
methods: {
getClients() {
this.$axios.get("/clients/clients/").then(r => {
this.clientsOptions = Object.freeze(r.data.map(client => ({ label: client.name, value: client.id })));
});
this.$axios
.get("/clients/clients/")
.then(r => {
this.clientsOptions = Object.freeze(r.data.map(client => ({ label: client.name, value: client.id })));
})
.catch(e => {});
},
getUserOptions(val, update, abort) {
if (val.length < 2) {

View File

@@ -243,7 +243,6 @@
</template>
<script>
import axios from "axios";
import { mapState, mapGetters } from "vuex";
import mixins from "@/mixins/mixins";
import AddAutomatedTask from "@/components/modals/tasks/AddAutomatedTask";
@@ -312,13 +311,13 @@ export default {
return;
}
const data = { enableordisable: action };
axios
this.$axios
.patch(`/tasks/${pk}/automatedtasks/`, data)
.then(r => {
this.$store.dispatch("loadAutomatedTasks", this.automatedTasks.pk);
this.notifySuccess(r.data);
})
.catch(e => this.notifyError("Something went wrong"));
.catch(e => {});
},
taskAlert(pk, alert_type, action, managed_by_policy) {
if (managed_by_policy) {
@@ -339,7 +338,7 @@ export default {
}
const act = action ? "enabled" : "disabled";
axios
this.$axios
.put(`/tasks/${pk}/automatedtasks/`, data)
.then(r => {
this.$q.loading.hide();
@@ -347,7 +346,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an issue editing task");
});
},
refreshTasks(id) {
@@ -376,10 +374,10 @@ export default {
this.notifyError("Task cannot be run when it's disabled. Enable it first.");
return;
}
axios
this.$axios
.get(`/tasks/runwintask/${pk}/`)
.then(r => this.notifySuccess(r.data))
.catch(() => this.notifyError("Something went wrong"));
.catch(e => {});
},
deleteTask(name, pk) {
this.$q
@@ -390,14 +388,14 @@ export default {
persistent: true,
})
.onOk(() => {
axios
this.$axios
.delete(`/tasks/${pk}/automatedtasks/`)
.then(r => {
this.$store.dispatch("loadAutomatedTasks", this.automatedTasks.pk);
this.$store.dispatch("loadChecks", this.automatedTasks.pk);
this.notifySuccess(r.data);
})
.catch(e => this.notifyError("Something went wrong"));
.catch(e => {});
});
},
},

View File

@@ -308,7 +308,6 @@
</template>
<script>
import axios from "axios";
import { mapGetters } from "vuex";
import mixins from "@/mixins/mixins";
import DiskSpaceCheck from "@/components/modals/checks/DiskSpaceCheck";
@@ -430,13 +429,16 @@ export default {
data.check_alert = true;
const act = action ? "enabled" : "disabled";
const color = action ? "positive" : "warning";
axios.patch(`/checks/${id}/check/`, data).then(r => {
this.$q.notify({
color: color,
icon: "fas fa-check-circle",
message: `${alert_type} alerts ${act}`,
});
});
this.$axios
.patch(`/checks/${id}/check/`, data)
.then(r => {
this.$q.notify({
color: color,
icon: "fas fa-check-circle",
message: `${alert_type} alerts ${act}`,
});
})
.catch(e => {});
},
resetCheck(check) {
const data = {
@@ -444,16 +446,14 @@ export default {
status: "passing",
};
axios
this.$axios
.patch(`/checks/${check}/check/`, data)
.then(r => {
this.$emit("refreshEdit");
this.$store.dispatch("loadChecks", this.selectedAgentPk);
this.notifySuccess("The check was reset");
})
.catch(e => {
this.notifyError("There was an issue resetting the check");
});
.catch(e => {});
},
onRefresh(id) {
this.$emit("refreshEdit");
@@ -482,14 +482,14 @@ export default {
persistent: true,
})
.onOk(() => {
axios
this.$axios
.delete(`/checks/${pk}/check/`)
.then(r => {
this.$store.dispatch("loadChecks", this.selectedAgentPk);
this.$store.dispatch("loadAutomatedTasks", this.selectedAgentPk);
this.notifySuccess(r.data);
})
.catch(e => this.notifyError(e.response.data));
.catch(e => {});
});
},
showCheckGraphModal(check) {

View File

@@ -118,7 +118,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("Unable to get Clients.");
});
},
showClientDeleteModal(client) {

View File

@@ -98,9 +98,12 @@ export default {
},
methods: {
getDeployments() {
this.$axios.get("/clients/deployments/").then(r => {
this.deployments = r.data;
});
this.$axios
.get("/clients/deployments/")
.then(r => {
this.deployments = r.data;
})
.catch(e => {});
},
deleteDeployment(pk) {
this.$q
@@ -116,7 +119,7 @@ export default {
this.getDeployments();
this.notifySuccess("Deployment deleted");
})
.catch(() => this.notifyError("Something went wrong"));
.catch(e => {});
});
},
copyLink(props) {

View File

@@ -61,7 +61,6 @@
</template>
<script>
import axios from "axios";
import mixins from "@/mixins/mixins";
export default {
@@ -111,7 +110,7 @@ export default {
getEventLog() {
this.events = [];
this.$q.loading.show({ message: `Loading ${this.logType} event log...please wait` });
axios
this.$axios
.get(`/agents/${this.pk}/geteventlog/${this.logType}/${this.days}/`)
.then(r => {
this.events = Object.freeze(r.data);
@@ -119,7 +118,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.response.data);
});
},
},

View File

@@ -124,40 +124,37 @@ export default {
this.refreshNotes();
this.notifySuccess(r.data);
})
.catch(() => this.notifyError("Something went wrong"));
.catch(e => {});
});
},
editNote(pk) {
this.$axios
.get(`/agents/${pk}/note/`)
.then(r => {
this.note = r.data;
this.$q
.dialog({
title: "Edit Note",
prompt: {
model: this.note.note,
type: "textarea",
},
style: "width: 30vw; max-width: 50vw;",
ok: { label: "Save" },
cancel: true,
})
.onOk(data => {
this.note.note = data;
this.$axios
.patch(`/agents/${pk}/note/`, this.note)
.then(r => {
this.refreshNotes();
this.notifySuccess(r.data);
})
.catch(() => this.notifyError("Something went wrong"));
})
.onDismiss(() => {
this.note = {};
});
})
.catch(() => this.notifyError("Something went wrong"));
this.$axios.get(`/agents/${pk}/note/`).then(r => {
this.note = r.data;
this.$q
.dialog({
title: "Edit Note",
prompt: {
model: this.note.note,
type: "textarea",
},
style: "width: 30vw; max-width: 50vw;",
ok: { label: "Save" },
cancel: true,
})
.onOk(data => {
this.note.note = data;
this.$axios
.patch(`/agents/${pk}/note/`, this.note)
.then(r => {
this.refreshNotes();
this.notifySuccess(r.data);
})
.catch(e => {});
})
.onDismiss(() => {
this.note = {};
});
});
},
deleteNote(pk) {
this.$q
@@ -173,7 +170,7 @@ export default {
this.refreshNotes();
this.notifySuccess(r.data);
})
.catch(() => this.notifyError("Something went wrong"));
.catch(e => {});
});
},
refreshNotes() {

View File

@@ -144,15 +144,11 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.response.data, 4000);
});
},
refreshProcs() {
this.polling = setInterval(() => {
this.$axios
.get(`/agents/${this.pk}/getprocs/`)
.then(r => (this.procs = r.data))
.catch(() => console.log("Unable to contact the agent"));
this.$axios.get(`/agents/${this.pk}/getprocs/`).then(r => (this.procs = r.data));
}, this.pollInterval * 1000);
},
killProc(pid, name) {
@@ -165,7 +161,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.response.data);
});
},
stopPoll() {
@@ -192,7 +187,10 @@ export default {
this.refreshProcs();
},
getAgent() {
this.$axios.get(`/agents/${this.pk}/agentdetail/`).then(r => (this.mem = r.data.total_ram));
this.$axios
.get(`/agents/${this.pk}/agentdetail/`)
.then(r => (this.mem = r.data.total_ram))
.catch(e => {});
},
convert(percent) {
const mb = this.mem * 1024;

View File

@@ -401,9 +401,12 @@ export default {
methods: {
getScripts() {
this.clearRow();
this.$axios.get("/scripts/scripts/").then(r => {
this.scripts = r.data;
});
this.$axios
.get("/scripts/scripts/")
.then(r => {
this.scripts = r.data;
})
.catch(e => {});
},
setShowCommunityScripts(show) {
this.$store.dispatch("setShowCommunityScripts", show);
@@ -431,7 +434,6 @@ export default {
})
.catch(() => {
this.$q.loading.hide();
this.notifyError("Something went wrong");
});
},
deleteScript(scriptpk) {
@@ -448,7 +450,7 @@ export default {
this.getScripts();
this.notifySuccess(r.data);
})
.catch(() => this.notifySuccess("Something went wrong"));
.catch(e => {});
});
},
downloadScript(script) {
@@ -461,7 +463,7 @@ export default {
link.download = data.filename;
link.click();
})
.catch(() => this.notifyError("Something went wrong"));
.catch(e => {});
},
truncateText(txt) {
return txt.length >= 60 ? txt.substring(0, 60) + "..." : txt;

View File

@@ -247,7 +247,6 @@ export default {
})
.catch(e => {
this.serviceDetailVisible = false;
this.notifyError(e.response.data);
});
},
startupTypeChanged() {
@@ -273,7 +272,6 @@ export default {
.catch(e => {
this.serviceDetailVisible = false;
this.serviceDetailsModal = false;
this.notifyError(e.response.data, 3000);
});
},
serviceAction(name, action, fullname) {
@@ -309,7 +307,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.response.data, 3000);
});
},
getServices() {
@@ -322,7 +319,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.response.data);
});
},
},

View File

@@ -45,7 +45,6 @@
</template>
<script>
import axios from "axios";
import mixins from "@/mixins/mixins";
import { mapGetters } from "vuex";
import { mapState } from "vuex";
@@ -112,7 +111,7 @@ export default {
refreshSoftware() {
const pk = this.selectedAgentPk;
this.loading = true;
axios
this.$axios
.get(`/software/refresh/${pk}`)
.then(r => {
this.$store.dispatch("loadInstalledSoftware", pk);
@@ -120,7 +119,6 @@ export default {
})
.catch(e => {
this.loading = false;
this.notifyError(e.response.data);
});
},
},

View File

@@ -135,7 +135,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.response.data);
});
},
},

View File

@@ -85,9 +85,7 @@
</template>
<script>
import axios from "axios";
import { mapState } from "vuex";
import { mapGetters } from "vuex";
import { mapGetters, mapState } from "vuex";
import mixins from "@/mixins/mixins";
export default {
@@ -160,10 +158,13 @@ export default {
},
editPolicy(pk, policy) {
const data = { pk: pk, policy: policy };
axios.patch(`/winupdate/editpolicy/`, data).then(r => {
this.refreshUpdates(this.updates.pk);
this.notifySuccess("Policy edited!");
});
this.$axios
.patch(`/winupdate/editpolicy/`, data)
.then(r => {
this.refreshUpdates(this.updates.pk);
this.notifySuccess("Policy edited!");
})
.catch(e => {});
},
refreshUpdates(pk) {
this.$store.dispatch("loadWinUpdates", pk);

View File

@@ -319,7 +319,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("Unable to get policies");
});
},
clearRow() {
@@ -348,7 +347,6 @@ export default {
})
.catch(error => {
this.$q.loading.hide();
this.notifyError("An Error occured while deleting policy");
});
});
},
@@ -450,7 +448,6 @@ export default {
})
.catch(error => {
this.$q.loading.hide();
this.notifyError("An Error occured while sending policy sync request");
});
},
toggleCheckbox(policy, type) {
@@ -480,7 +477,6 @@ export default {
})
.catch(error => {
this.$q.loading.hide();
this.notifyError("An Error occured while editing policy");
});
},
patchPolicyText(policy) {

View File

@@ -244,7 +244,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an issue getting tasks");
});
},
taskEnableorDisable(pk, action) {
@@ -259,7 +258,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an issue editing the task");
});
},
taskAlert(pk, alert_type, action, managed_by_policy) {
@@ -286,7 +284,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an issue editing task");
});
},
showEditTask(task) {
@@ -323,7 +320,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an issue running the task");
});
},
deleteTask(name, pk) {
@@ -345,7 +341,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an issue deleting the task");
});
});
},

View File

@@ -250,7 +250,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("Unable to get checks");
});
},
checkAlert(id, alert_type, action) {
@@ -280,7 +279,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("Unable to edit check alert");
});
},
showAddDialog(component) {
@@ -340,7 +338,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("An Error Occurred while deleting");
});
});
},

View File

@@ -87,7 +87,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("Error getting policy tree data");
});
},
processTreeDataFromApi(data) {

View File

@@ -158,7 +158,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an error updating policies");
});
},
getPolicies() {
@@ -175,7 +174,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("Add error occured while loading policies");
});
},
show() {

View File

@@ -101,27 +101,35 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an issue adding policy exclusions");
});
},
getClients() {
this.$axios.get("/clients/clients/").then(r => {
this.clientOptions = r.data.map(client => ({ label: client.name, value: client.id }));
});
this.$axios
.get("/clients/clients/")
.then(r => {
this.clientOptions = r.data.map(client => ({ label: client.name, value: client.id }));
})
.catch(e => {});
},
getSites() {
this.$axios.get("/clients/clients/").then(r => {
r.data.forEach(client => {
this.siteOptions.push({ category: client.name });
client.sites.forEach(site => this.siteOptions.push({ label: site.name, value: site.id }));
});
});
this.$axios
.get("/clients/clients/")
.then(r => {
r.data.forEach(client => {
this.siteOptions.push({ category: client.name });
client.sites.forEach(site => this.siteOptions.push({ label: site.name, value: site.id }));
});
})
.catch(e => {});
},
getAgents() {
this.$axios.get("/agents/listagentsnodetail/").then(r => {
const ret = r.data.map(agent => ({ label: agent.hostname, value: agent.pk }));
this.agentOptions = Object.freeze(ret.sort((a, b) => a.label.localeCompare(b.label)));
});
this.$axios
.get("/agents/listagentsnodetail/")
.then(r => {
const ret = r.data.map(agent => ({ label: agent.hostname, value: agent.pk }));
this.agentOptions = Object.freeze(ret.sort((a, b) => a.label.localeCompare(b.label)));
})
.catch(e => {});
},
getOptions() {
this.getClients();

View File

@@ -91,7 +91,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an error editing the policy");
});
} else {
if (this.copyPolicy) {
@@ -107,7 +106,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an error adding the policy");
});
}
},

View File

@@ -189,7 +189,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("Unable to load check status");
});
},
getTaskData() {
@@ -202,7 +201,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("Unable to load task status");
});
},
closeEventLogOutput() {

View File

@@ -9,13 +9,7 @@
<q-card-section class="row">
<div class="col-2">Username:</div>
<div class="col-10">
<q-input
outlined
dense
v-model="username"
:rules="[ val => !!val || '*Required']"
class="q-pa-none"
/>
<q-input outlined dense v-model="username" :rules="[val => !!val || '*Required']" class="q-pa-none" />
</div>
</q-card-section>
<q-card-section class="row" v-if="!this.pk">
@@ -26,15 +20,11 @@
dense
v-model="password"
:type="isPwd ? 'password' : 'text'"
:rules="[ val => !!val || '*Required']"
:rules="[val => !!val || '*Required']"
class="q-pa-none"
>
<template v-slot:append>
<q-icon
:name="isPwd ? 'visibility_off' : 'visibility'"
class="cursor-pointer"
@click="isPwd = !isPwd"
/>
<q-icon :name="isPwd ? 'visibility_off' : 'visibility'" class="cursor-pointer" @click="isPwd = !isPwd" />
</template>
</q-input>
</div>
@@ -78,7 +68,7 @@
<script>
import { mapState } from "vuex";
import mixins, { notifySuccessConfig, notifyErrorConfig } from "@/mixins/mixins";
import mixins from "@/mixins/mixins";
export default {
name: "UserForm",
@@ -139,11 +129,10 @@ export default {
.then(r => {
this.$q.loading.hide();
this.$emit("close");
this.$q.notify(notifySuccessConfig("User edited!"));
this.notifySuccess("User edited!");
})
.catch(e => {
this.$q.loading.hide();
this.$q.notify(notifyErrorConfig(e.response.data));
});
} else {
formData.password = this.password;
@@ -153,11 +142,10 @@ export default {
.then(r => {
this.$q.loading.hide();
this.$emit("close");
this.$q.notify(notifySuccessConfig(`User ${r.data} was added!`));
this.notifySuccess(`User ${r.data} was added!`);
})
.catch(e => {
this.$q.loading.hide();
this.$q.notify(notifyErrorConfig(e.response.data));
});
}
},

View File

@@ -14,14 +14,10 @@
dense
v-model="password"
:type="isPwd ? 'password' : 'text'"
:rules="[ val => !!val || '*Required']"
:rules="[val => !!val || '*Required']"
>
<template v-slot:append>
<q-icon
:name="isPwd ? 'visibility_off' : 'visibility'"
class="cursor-pointer"
@click="isPwd = !isPwd"
/>
<q-icon :name="isPwd ? 'visibility_off' : 'visibility'" class="cursor-pointer" @click="isPwd = !isPwd" />
</template>
</q-input>
</div>
@@ -34,7 +30,7 @@
</template>
<script>
import mixins, { notifySuccessConfig, notifyErrorConfig } from "@/mixins/mixins";
import mixins from "@/mixins/mixins";
export default {
name: "UserResetForm",
@@ -59,11 +55,10 @@ export default {
.then(r => {
this.$q.loading.hide();
this.$emit("close");
this.$q.notify(notifySuccessConfig("User Password Reset!"));
this.notifySuccess("User Password Reset!");
})
.catch(e => {
this.$q.loading.hide();
this.$q.notify(notifyErrorConfig(e.response.data));
});
},
},

View File

@@ -86,7 +86,7 @@ export default {
link.download = fileName;
link.click();
})
.catch(e => this.notifyError(e.response.data));
.catch(e => {});
},
},
};

View File

@@ -94,7 +94,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.response.data, 5000);
});
},
},

View File

@@ -239,22 +239,27 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.response.data);
});
},
getClients() {
this.$axios.get("/clients/clients/").then(r => {
this.client_options = this.formatClientOptions(r.data);
this.$axios
.get("/clients/clients/")
.then(r => {
this.client_options = this.formatClientOptions(r.data);
this.client = this.client_options[0];
this.site = this.sites[0];
});
this.client = this.client_options[0];
this.site = this.sites[0];
})
.catch(e => {});
},
getAgents() {
this.$axios.get("/agents/listagentsnodetail/").then(r => {
const ret = r.data.map(agent => ({ label: agent.hostname, value: agent.pk }));
this.agents = Object.freeze(ret.sort((a, b) => a.label.localeCompare(b.label)));
});
this.$axios
.get("/agents/listagentsnodetail/")
.then(r => {
const ret = r.data.map(agent => ({ label: agent.hostname, value: agent.pk }));
this.agents = Object.freeze(ret.sort((a, b) => a.label.localeCompare(b.label)));
})
.catch(e => {});
},
setTitles() {
switch (this.mode) {

View File

@@ -174,47 +174,53 @@ export default {
},
methods: {
getAgentInfo() {
this.$axios.get(`/agents/${this.selectedAgentPk}/agenteditdetails/`).then(r => {
this.agent = r.data;
this.allTimezones = Object.freeze(r.data.all_timezones);
this.$axios
.get(`/agents/${this.selectedAgentPk}/agenteditdetails/`)
.then(r => {
this.agent = r.data;
this.allTimezones = Object.freeze(r.data.all_timezones);
// r.data.time_zone is the actual db column from the agent
// r.data.timezone is a computed property based on the db time_zone field
// which whill return null if the time_zone field is not set
// and is therefore inheriting from the default global setting
if (r.data.time_zone === null) {
this.timezone = r.data.timezone;
this.original_tz = r.data.timezone;
} else {
this.tz_inherited = false;
this.timezone = r.data.time_zone;
this.original_tz = r.data.time_zone;
}
this.agent.client = { label: r.data.client.name, id: r.data.client.id, sites: r.data.client.sites };
this.agentLoaded = true;
for (let field of this.customFields) {
const value = r.data.custom_fields.find(value => value.field === field.id);
if (field.type === "multiple") {
if (value) this.$set(this.custom_fields, field.name, value.value);
else this.$set(this.custom_fields, field.name, []);
} else if (field.type === "checkbox") {
if (value) this.$set(this.custom_fields, field.name, value.value);
else this.$set(this.custom_fields, field.name, false);
// r.data.time_zone is the actual db column from the agent
// r.data.timezone is a computed property based on the db time_zone field
// which whill return null if the time_zone field is not set
// and is therefore inheriting from the default global setting
if (r.data.time_zone === null) {
this.timezone = r.data.timezone;
this.original_tz = r.data.timezone;
} else {
if (value) this.$set(this.custom_fields, field.name, value.value);
else this.$set(this.custom_fields, field.name, "");
this.tz_inherited = false;
this.timezone = r.data.time_zone;
this.original_tz = r.data.time_zone;
}
}
});
this.agent.client = { label: r.data.client.name, id: r.data.client.id, sites: r.data.client.sites };
this.agentLoaded = true;
for (let field of this.customFields) {
const value = r.data.custom_fields.find(value => value.field === field.id);
if (field.type === "multiple") {
if (value) this.$set(this.custom_fields, field.name, value.value);
else this.$set(this.custom_fields, field.name, []);
} else if (field.type === "checkbox") {
if (value) this.$set(this.custom_fields, field.name, value.value);
else this.$set(this.custom_fields, field.name, false);
} else {
if (value) this.$set(this.custom_fields, field.name, value.value);
else this.$set(this.custom_fields, field.name, "");
}
}
})
.catch(e => {});
},
getClientsSites() {
this.$axios.get("/clients/clients/").then(r => {
this.client_options = this.formatClientOptions(r.data);
this.clientsLoaded = true;
});
this.$axios
.get("/clients/clients/")
.then(r => {
this.client_options = this.formatClientOptions(r.data);
this.clientsLoaded = true;
})
.catch(e => {});
},
editAgent() {
delete this.agent.all_timezones;
@@ -244,9 +250,7 @@ export default {
this.$emit("edited");
this.notifySuccess("Agent was edited!");
})
.catch(e => {
this.notifyError("Something went wrong");
});
.catch(e => {});
},
},
computed: {

View File

@@ -48,9 +48,7 @@
<div class="q-gutter-sm">
<q-checkbox v-model="rdp" dense label="Enable RDP" />
<q-checkbox v-model="ping" dense label="Enable Ping">
<q-tooltip>
Enable ICMP echo requests in the local firewall
</q-tooltip>
<q-tooltip> Enable ICMP echo requests in the local firewall </q-tooltip>
</q-checkbox>
<q-checkbox v-model="power" dense v-show="agenttype === 'workstation'" label="Disable sleep/hibernate" />
</div>
@@ -82,7 +80,6 @@
</template>
<script>
import axios from "axios";
import mixins from "@/mixins/mixins";
import AgentDownload from "@/components/modals/agents/AgentDownload";
import { getBaseUrl } from "@/boot/axios";
@@ -113,7 +110,7 @@ export default {
methods: {
getClients() {
this.$q.loading.show();
axios
this.$axios
.get("/clients/clients/")
.then(r => {
this.client_options = this.formatClientOptions(r.data);
@@ -133,7 +130,6 @@ export default {
this.$q.loading.hide();
})
.catch(() => {
this.notifyError("Something went wrong");
this.$q.loading.hide();
});
},
@@ -178,20 +174,7 @@ export default {
};
this.showAgentDownload = true;
})
.catch(e => {
let err;
switch (e.response.status) {
case 406:
err = "Missing 64 bit meshagent.exe. Upload it from File > Upload Mesh Agent";
break;
case 415:
err = "Missing 32 bit meshagent-x86.exe. Upload it from File > Upload Mesh Agent";
break;
default:
err = "Something went wrong";
}
this.notifyError(err, 4000);
});
.catch(e => {});
} else if (this.installMethod === "exe") {
this.$q.loading.show({ message: "Generating executable..." });
@@ -236,20 +219,7 @@ export default {
link.click();
this.showDLMessage();
})
.catch(e => {
let err;
switch (e.response.status) {
case 406:
err = "Missing 64 bit meshagent.exe. Upload it from File > Upload Mesh Agent";
break;
case 415:
err = "Missing 32 bit meshagent-x86.exe. Upload it from File > Upload Mesh Agent";
break;
default:
err = "Something went wrong";
}
this.notifyError(err, 4000);
});
.catch(e => {});
}
},
showDLMessage() {

View File

@@ -247,7 +247,6 @@ export default {
})
.catch(error => {
this.$q.loading.hide();
this.notifyError("An Error occured while editing patch policy");
});
} else {
// adding patch policy
@@ -260,7 +259,6 @@ export default {
})
.catch(error => {
this.$q.loading.hide();
this.notifyError("An Error occured while adding patch policy");
});
}
}
@@ -283,7 +281,6 @@ export default {
})
.catch(error => {
this.$q.loading.hide();
this.notifyError("An Error occured while clearing the patch policy");
});
});
},

View File

@@ -59,7 +59,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.response.data, 5000);
});
},
getCurrentDate() {

View File

@@ -163,7 +163,6 @@ export default {
})
.catch(e => {
this.loading = false;
this.notifyError(e.response.data);
});
},
},

View File

@@ -95,7 +95,6 @@ export default {
})
.catch(e => {
this.loading = false;
this.notifyError(e.response.data);
});
},
},

View File

@@ -67,7 +67,6 @@ export default {
})
.catch(() => {
this.$q.loading.hide();
this.notifyError("Something went wrong");
});
},
update() {
@@ -79,7 +78,7 @@ export default {
this.$emit("edited");
this.notifySuccess("Agents will now be updated");
})
.catch(() => this.notifyError("Something went wrong"));
.catch(e => {});
},
},
computed: {

View File

@@ -108,27 +108,35 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an issue adding alert exclusions");
});
},
getClients() {
this.$axios.get("/clients/clients/").then(r => {
this.clientOptions = r.data.map(client => ({ label: client.name, value: client.id }));
});
this.$axios
.get("/clients/clients/")
.then(r => {
this.clientOptions = r.data.map(client => ({ label: client.name, value: client.id }));
})
.catch(e => {});
},
getSites() {
this.$axios.get("/clients/clients/").then(r => {
r.data.forEach(client => {
this.siteOptions.push({ category: client.name });
client.sites.forEach(site => this.siteOptions.push({ label: site.name, value: site.id }));
});
});
this.$axios
.get("/clients/clients/")
.then(r => {
r.data.forEach(client => {
this.siteOptions.push({ category: client.name });
client.sites.forEach(site => this.siteOptions.push({ label: site.name, value: site.id }));
});
})
.catch(e => {});
},
getAgents() {
this.$axios.get("/agents/listagentsnodetail/").then(r => {
const ret = r.data.map(agent => ({ label: agent.hostname, value: agent.pk }));
this.agentOptions = Object.freeze(ret.sort((a, b) => a.label.localeCompare(b.label)));
});
this.$axios
.get("/agents/listagentsnodetail/")
.then(r => {
const ret = r.data.map(agent => ({ label: agent.hostname, value: agent.pk }));
this.agentOptions = Object.freeze(ret.sort((a, b) => a.label.localeCompare(b.label)));
})
.catch(e => {});
},
getOptions() {
this.getClients();

View File

@@ -92,7 +92,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("Something went wrong!");
});
},
getAlertTemplates() {
@@ -108,7 +107,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("Add error occured while loading alert templates");
});
},
show() {

View File

@@ -676,7 +676,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.response.data);
});
} else {
this.$axios
@@ -688,7 +687,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e);
});
}
},

View File

@@ -105,7 +105,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an error getting related templates");
});
},
};

View File

@@ -251,9 +251,12 @@ export default {
},
methods: {
getClients() {
this.$axios.get("/clients/clients/").then(r => {
this.clientsOptions = Object.freeze(r.data.map(client => ({ label: client.name, value: client.id })));
});
this.$axios
.get("/clients/clients/")
.then(r => {
this.clientsOptions = Object.freeze(r.data.map(client => ({ label: client.name, value: client.id })));
})
.catch(e => {});
},
search() {
this.$q.loading.show();
@@ -277,7 +280,6 @@ export default {
this.alerts = Object.freeze(r.data);
})
.catch(e => {
this.notifyError("There was an issue getting alerts");
this.$q.loading.hide();
});
},
@@ -311,7 +313,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an issue snoozing alert");
});
});
},
@@ -332,7 +333,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an issue unsnoozing the alert");
});
},
resolveAlert(alert) {
@@ -352,7 +352,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an issue resolving alert");
});
},
resolveAlertBulk(alerts) {
@@ -372,7 +371,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an error resolving alerts");
});
},
snoozeAlertBulk(alerts) {
@@ -405,7 +403,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an error resolving alerts");
});
});
},

View File

@@ -56,7 +56,6 @@
</template>
<script>
import axios from "axios";
import mixins from "@/mixins/mixins";
export default {
name: "CpuLoadCheck",
@@ -81,7 +80,10 @@ export default {
},
methods: {
getCheck() {
axios.get(`/checks/${this.checkpk}/check/`).then(r => (this.cpuloadcheck = r.data));
this.$axios
.get(`/checks/${this.checkpk}/check/`)
.then(r => (this.cpuloadcheck = r.data))
.catch(e => {});
},
addCheck() {
if (!this.isValidThreshold(this.cpuloadcheck.warning_threshold, this.cpuloadcheck.error_threshold)) {
@@ -93,28 +95,28 @@ export default {
...pk,
check: this.cpuloadcheck,
};
axios
this.$axios
.post("/checks/checks/", data)
.then(r => {
this.$emit("close");
this.reloadChecks();
this.notifySuccess(r.data);
})
.catch(e => this.notifyError(e.response.data.non_field_errors));
.catch(e => {});
},
editCheck() {
if (!this.isValidThreshold(this.cpuloadcheck.warning_threshold, this.cpuloadcheck.error_threshold)) {
return;
}
axios
this.$axios
.patch(`/checks/${this.checkpk}/check/`, this.cpuloadcheck)
.then(r => {
this.$emit("close");
this.reloadChecks();
this.notifySuccess(r.data);
})
.catch(e => this.notifyError(e.response.data.non_field_errors));
.catch(e => {});
},
reloadChecks() {
if (this.agentpk) {

View File

@@ -65,7 +65,6 @@
</template>
<script>
import axios from "axios";
import { mapGetters } from "vuex";
import mixins from "@/mixins/mixins";
export default {
@@ -94,17 +93,23 @@ export default {
methods: {
setDiskOptions() {
if (this.policypk) {
axios.get("/checks/getalldisks/").then(r => {
this.diskOptions = r.data;
this.diskcheck.disk = "C:";
});
this.$axios
.get("/checks/getalldisks/")
.then(r => {
this.diskOptions = r.data;
this.diskcheck.disk = "C:";
})
.catch(e => {});
} else {
this.diskOptions = this.agentDisks.map(i => i.device);
this.diskcheck.disk = this.diskOptions[0];
}
},
getCheck() {
axios.get(`/checks/${this.checkpk}/check/`).then(r => (this.diskcheck = r.data));
this.$axios
.get(`/checks/${this.checkpk}/check/`)
.then(r => (this.diskcheck = r.data))
.catch(e => {});
},
addCheck() {
if (!this.isValidThreshold(this.diskcheck.warning_threshold, this.diskcheck.error_threshold, true)) {
@@ -116,28 +121,28 @@ export default {
...pk,
check: this.diskcheck,
};
axios
this.$axios
.post("/checks/checks/", data)
.then(r => {
this.$emit("close");
this.reloadChecks();
this.notifySuccess(r.data);
})
.catch(e => this.notifyError(e.response.data.non_field_errors));
.catch(e => {});
},
editCheck() {
if (!this.isValidThreshold(this.diskcheck.warning_threshold, this.diskcheck.error_threshold, true)) {
return;
}
axios
this.$axios
.patch(`/checks/${this.checkpk}/check/`, this.diskcheck)
.then(r => {
this.$emit("close");
this.reloadChecks();
this.notifySuccess(r.data);
})
.catch(e => this.notifyError(e.response.data.non_field_errors));
.catch(e => {});
},
reloadChecks() {
if (this.agentpk) {

View File

@@ -192,7 +192,7 @@ export default {
this.eventMessage = true;
}
})
.catch(() => this.notifyError("Something went wrong"));
.catch(e => {});
},
addCheck() {
const pk = this.policypk ? { policy: this.policypk } : { pk: this.agentpk };
@@ -217,7 +217,7 @@ export default {
this.reloadChecks();
this.notifySuccess(r.data);
})
.catch(e => this.notifyError(e.response.data.non_field_errors));
.catch(e => {});
},
editCheck() {
this.eventlogcheck.event_id_is_wildcard = this.eventlogcheck.event_id === "*" ? true : false;
@@ -237,7 +237,7 @@ export default {
this.reloadChecks();
this.notifySuccess(r.data);
})
.catch(e => this.notifyError(e.response.data.non_field_errors));
.catch(e => {});
},
reloadChecks() {
if (this.agentpk) {

View File

@@ -56,7 +56,6 @@
</template>
<script>
import axios from "axios";
import mixins from "@/mixins/mixins";
export default {
name: "MemCheck",
@@ -81,7 +80,10 @@ export default {
},
methods: {
getCheck() {
axios.get(`/checks/${this.checkpk}/check/`).then(r => (this.memcheck = r.data));
this.$axios
.get(`/checks/${this.checkpk}/check/`)
.then(r => (this.memcheck = r.data))
.catch(e => {});
},
addCheck() {
if (!this.isValidThreshold(this.memcheck.warning_threshold, this.memcheck.error_threshold)) {
@@ -93,28 +95,28 @@ export default {
...pk,
check: this.memcheck,
};
axios
this.$axios
.post("/checks/checks/", data)
.then(r => {
this.$emit("close");
this.reloadChecks();
this.notifySuccess(r.data);
})
.catch(e => this.notifyError(e.response.data.non_field_errors));
.catch(e => {});
},
editCheck() {
if (!this.isValidThreshold(this.memcheck.warning_threshold, this.memcheck.error_threshold)) {
return;
}
axios
this.$axios
.patch(`/checks/${this.checkpk}/check/`, this.memcheck)
.then(r => {
this.$emit("close");
this.reloadChecks();
this.notifySuccess(r.data);
})
.catch(e => this.notifyError(e.response.data.non_field_errors));
.catch(e => {});
},
reloadChecks() {
if (this.agentpk) {

View File

@@ -58,7 +58,6 @@
</template>
<script>
import axios from "axios";
import mixins from "@/mixins/mixins";
export default {
name: "PingCheck",
@@ -89,7 +88,10 @@ export default {
},
methods: {
getCheck() {
axios.get(`/checks/${this.checkpk}/check/`).then(r => (this.pingcheck = r.data));
this.$axios
.get(`/checks/${this.checkpk}/check/`)
.then(r => (this.pingcheck = r.data))
.catch(e => {});
},
addCheck() {
const pk = this.policypk ? { policy: this.policypk } : { pk: this.agentpk };
@@ -97,24 +99,24 @@ export default {
...pk,
check: this.pingcheck,
};
axios
this.$axios
.post("/checks/checks/", data)
.then(r => {
this.$emit("close");
this.reloadChecks();
this.notifySuccess(r.data);
})
.catch(e => this.notifyError(e.response.data.non_field_errors));
.catch(e => {});
},
editCheck() {
axios
this.$axios
.patch(`/checks/${this.checkpk}/check/`, this.pingcheck)
.then(r => {
this.$emit("close");
this.reloadChecks();
this.notifySuccess(r.data);
})
.catch(e => this.notifyError(e.response.data.non_field_errors));
.catch(e => {});
},
reloadChecks() {
if (this.agentpk) {

View File

@@ -155,10 +155,13 @@ export default {
},
methods: {
getCheck() {
this.$axios.get(`/checks/${this.checkpk}/check/`).then(r => {
this.scriptcheck = r.data;
this.scriptcheck.script = r.data.script.id;
});
this.$axios
.get(`/checks/${this.checkpk}/check/`)
.then(r => {
this.scriptcheck = r.data;
this.scriptcheck.script = r.data.script.id;
})
.catch(e => {});
},
addCheck() {
const pk = this.policypk ? { policy: this.policypk } : { pk: this.agentpk };
@@ -173,7 +176,7 @@ export default {
this.reloadChecks();
this.notifySuccess(r.data);
})
.catch(e => this.notifyError(e.response.data.non_field_errors));
.catch(e => {});
},
editCheck() {
this.$axios
@@ -183,7 +186,7 @@ export default {
this.reloadChecks();
this.notifySuccess(r.data);
})
.catch(e => this.notifyError(e.response.data.non_field_errors));
.catch(e => {});
},
setScriptDefaults() {
const script = this.scriptOptions.find(i => i.value === this.scriptcheck.script);

View File

@@ -132,7 +132,6 @@
</template>
<script>
import axios from "axios";
import mixins from "@/mixins/mixins";
import { mapGetters } from "vuex";
export default {
@@ -186,10 +185,13 @@ export default {
},
setServices() {
if (this.policypk) {
axios.get("/services/defaultservices/").then(r => {
this.svcData = Object.freeze(r.data);
this.winsvccheck.svc_policy_mode = "default";
});
this.$axios
.get("/services/defaultservices/")
.then(r => {
this.svcData = Object.freeze(r.data);
this.winsvccheck.svc_policy_mode = "default";
})
.catch(e => {});
} else {
this.svcData = Object.freeze(this.agentServices);
}
@@ -198,7 +200,10 @@ export default {
this.winsvccheck.svc_display_name = this.serviceOptions.find(i => i.value === this.winsvccheck.svc_name).label;
},
getCheck() {
axios.get(`/checks/${this.checkpk}/check/`).then(r => (this.winsvccheck = r.data));
this.$axios
.get(`/checks/${this.checkpk}/check/`)
.then(r => (this.winsvccheck = r.data))
.catch(e => {});
},
addCheck() {
const pk = this.policypk ? { policy: this.policypk } : { pk: this.agentpk };
@@ -206,24 +211,24 @@ export default {
...pk,
check: this.winsvccheck,
};
axios
this.$axios
.post("/checks/checks/", data)
.then(r => {
this.$emit("close");
this.reloadChecks();
this.notifySuccess(r.data);
})
.catch(e => this.notifyError(e.response.data.non_field_errors));
.catch(e => {});
},
editCheck() {
axios
this.$axios
.patch(`/checks/${this.checkpk}/check/`, this.winsvccheck)
.then(r => {
this.$emit("close");
this.reloadChecks();
this.notifySuccess(r.data);
})
.catch(e => this.notifyError(e.response.data.non_field_errors));
.catch(e => {});
},
reloadChecks() {
if (this.agentpk) {

View File

@@ -97,11 +97,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
if (e.response.data.name) {
this.notifyError(e.response.data.name);
} else {
this.notifyError(e.response.data);
}
});
},
editClient() {
@@ -121,11 +116,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
if (e.response.data.name) {
this.notifyError(e.response.data.name);
} else {
this.notifyError(e.response.data);
}
});
},
getClient() {

View File

@@ -83,7 +83,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.response.data, 6000);
});
});
},
@@ -107,36 +106,38 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.response.data, 6000);
});
});
},
getSites() {
this.$axios.get("/clients/clients/").then(r => {
this.agentCount = this.getAgentCount(r.data, this.type, this.object.id);
r.data.forEach(client => {
// remove client that is being deleted from options
if (this.type === "client") {
if (client.id !== this.object.id) {
this.$axios
.get("/clients/clients/")
.then(r => {
this.agentCount = this.getAgentCount(r.data, this.type, this.object.id);
r.data.forEach(client => {
// remove client that is being deleted from options
if (this.type === "client") {
if (client.id !== this.object.id) {
this.siteOptions.push({ category: client.name });
client.sites.forEach(site => {
this.siteOptions.push({ label: site.name, value: site.id });
});
}
} else {
this.siteOptions.push({ category: client.name });
client.sites.forEach(site => {
this.siteOptions.push({ label: site.name, value: site.id });
if (site.id !== this.object.id) {
this.siteOptions.push({ label: site.name, value: site.id });
} else if (client.sites.length === 1) {
this.siteOptions.pop();
}
});
}
} else {
this.siteOptions.push({ category: client.name });
client.sites.forEach(site => {
if (site.id !== this.object.id) {
this.siteOptions.push({ label: site.name, value: site.id });
} else if (client.sites.length === 1) {
this.siteOptions.pop();
}
});
}
});
});
});
})
.catch(e => {});
},
refreshDashboardTree() {
this.$store.dispatch("loadTree");

View File

@@ -114,7 +114,7 @@ export default {
this.$emit("added");
this.notifySuccess("Deployment added");
})
.catch(() => this.notifyError("Something went wrong"));
.catch(e => {});
},
getCurrentDate() {
let d = new Date();
@@ -132,7 +132,6 @@ export default {
this.$q.loading.hide();
})
.catch(() => {
this.notifyError("Something went wrong");
this.$q.loading.hide();
});
},

View File

@@ -101,11 +101,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
if (e.response.data.name) {
this.notifyError(e.response.data.name);
} else {
this.notifyError(e.response.data.non_field_errors);
}
});
},
editSite() {
@@ -124,11 +119,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
if (e.response.data.name) {
this.notifyError(e.response.data.name);
} else {
this.notifyError(e.response.data.non_field_errors);
}
});
},
getSite() {
@@ -175,11 +165,14 @@ export default {
this.$store.dispatch("getUpdatedSites");
},
getClients() {
this.$axios.get("/clients/clients/").then(r => {
r.data.forEach(client => {
this.clientOptions.push({ label: client.name, value: client.id });
});
});
this.$axios
.get("/clients/clients/")
.then(r => {
r.data.forEach(client => {
this.clientOptions.push({ label: client.name, value: client.id });
});
})
.catch(e => {});
},
show() {
this.$refs.dialog.show();

View File

@@ -97,7 +97,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("Unable to get Sites.");
});
},
showSiteDeleteModal(site) {

View File

@@ -91,7 +91,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.data);
});
},
},

View File

@@ -14,7 +14,7 @@
<div class="row">
<q-file
v-model="meshagent"
:rules="[ val => !!val || '*Required' ]"
:rules="[val => !!val || '*Required']"
label="Upload MeshAgent"
stack-label
filled
@@ -35,7 +35,6 @@
</template>
<script>
import axios from "axios";
import mixins from "@/mixins/mixins";
export default {
@@ -53,7 +52,7 @@ export default {
let formData = new FormData();
formData.append("arch", this.arch);
formData.append("meshagent", this.meshagent);
axios
this.$axios
.put("/core/uploadmesh/", formData)
.then(() => {
this.$q.loading.hide();
@@ -62,7 +61,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("Unable to upload");
});
},
},

View File

@@ -43,7 +43,7 @@ export default {
.then(r => {
this.settings = r.data;
})
.catch(e => this.notifyError(e.response.data));
.catch(e => {});
},
editToken() {
this.$q.loading.show();
@@ -56,7 +56,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.response.data, 4000);
});
},
},

View File

@@ -224,7 +224,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an error editing the custom field");
});
} else {
this.$axios
@@ -236,7 +235,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an error adding the custom field");
});
}
},

View File

@@ -136,7 +136,6 @@ export default {
})
.catch(error => {
this.$q.loading.hide();
this.notifyError(`An Error occured while deleting custom field: ${field.name}`);
});
});
},

View File

@@ -355,11 +355,14 @@ export default {
},
methods: {
getCoreSettings() {
this.$axios.get("/core/getcoresettings/").then(r => {
this.settings = r.data;
this.allTimezones = Object.freeze(r.data.all_timezones);
this.ready = true;
});
this.$axios
.get("/core/getcoresettings/")
.then(r => {
this.settings = r.data;
this.allTimezones = Object.freeze(r.data.all_timezones);
this.ready = true;
})
.catch(e => {});
},
getPolicies() {
this.$q.loading.show();
@@ -371,13 +374,15 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("Unable to get policies");
});
},
getAlertTemplates() {
this.$axios.get("alerts/alerttemplates").then(r => {
this.alertTemplateOptions = r.data.map(template => ({ label: template.name, value: template.id }));
});
this.$axios
.get("alerts/alerttemplates")
.then(r => {
this.alertTemplateOptions = r.data.map(template => ({ label: template.name, value: template.id }));
})
.catch(e => {});
},
showResetPatchPolicy() {
this.$q.dialog({
@@ -457,7 +462,6 @@ export default {
})
.catch(() => {
this.$q.loading.hide();
this.notifyError("You have some invalid input. Please check all fields");
});
},
},

View File

@@ -69,7 +69,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an error editing the key");
});
} else {
this.$axios
@@ -81,7 +80,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an error adding the key");
});
}
},

View File

@@ -144,7 +144,6 @@ export default {
})
.catch(error => {
this.$q.loading.hide();
this.notifyError(`An Error occured while deleting key: ${key.name}`);
});
});
},

View File

@@ -83,18 +83,12 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an error reseting policies");
});
},
getClients() {
this.$store
.dispatch("loadClients")
.then(r => {
this.client_options = this.formatClientOptions(r.data);
})
.catch(e => {
this.notifyError("There was an error loading the clients!");
});
this.$store.dispatch("loadClients").then(r => {
this.client_options = this.formatClientOptions(r.data);
});
},
clearClient() {
this.client = null;

View File

@@ -142,12 +142,15 @@ export default {
},
methods: {
getUserPrefs() {
this.$axios.get("/core/dashinfo/").then(r => {
this.agentDblClickAction = r.data.dbl_click_action;
this.defaultAgentTblTab = r.data.default_agent_tbl_tab;
this.clientTreeSort = r.data.client_tree_sort;
this.loading_bar_color = r.data.loading_bar_color;
});
this.$axios
.get("/core/dashinfo/")
.then(r => {
this.agentDblClickAction = r.data.dbl_click_action;
this.defaultAgentTblTab = r.data.default_agent_tbl_tab;
this.clientTreeSort = r.data.client_tree_sort;
this.loading_bar_color = r.data.loading_bar_color;
})
.catch(e => {});
},
editUserPrefs() {
const data = {
@@ -156,12 +159,15 @@ export default {
client_tree_sort: this.clientTreeSort,
loading_bar_color: this.loading_bar_color,
};
this.$axios.patch("/accounts/users/ui/", data).then(r => {
this.notifySuccess("Preferences were saved!");
this.$emit("edited");
this.$store.dispatch("loadTree");
this.$emit("close");
});
this.$axios
.patch("/accounts/users/ui/", data)
.then(r => {
this.notifySuccess("Preferences were saved!");
this.$emit("edited");
this.$store.dispatch("loadTree");
this.$emit("close");
})
.catch(e => {});
},
},
created() {

View File

@@ -40,8 +40,6 @@
</template>
<script>
import axios from "axios";
import { mapState } from "vuex";
export default {
name: "LogModal",
data() {
@@ -56,7 +54,7 @@ export default {
},
methods: {
downloadLog() {
axios
this.$axios
.get("/logs/downloadlog/", { responseType: "blob" })
.then(({ data }) => {
const blob = new Blob([data], { type: "text/plain" });
@@ -65,14 +63,17 @@ export default {
link.download = "debug.log";
link.click();
})
.catch(error => console.error(error));
.catch(e => {});
},
getLog() {
axios.get(`/logs/debuglog/${this.loglevel}/${this.agent}/${this.order}/`).then(r => {
this.logContent = r.data.log;
this.agents = r.data.agents.map(k => k.hostname).sort();
this.agents.unshift("all");
});
this.$axios
.get(`/logs/debuglog/${this.loglevel}/${this.agent}/${this.order}/`)
.then(r => {
this.logContent = r.data.log;
this.agents = r.data.agents.map(k => k.hostname).sort();
this.agents.unshift("all");
})
.catch(e => {});
},
},
created() {

View File

@@ -191,7 +191,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.response.data);
});
});
},

View File

@@ -170,7 +170,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.response.data.non_field_errors, 4000);
});
} else {
this.$axios
@@ -182,7 +181,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.response.data.non_field_errors, 4000);
});
}
},
@@ -196,7 +194,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.response.data.non_field_errors, 4000);
});
},
highlighter(code) {

View File

@@ -163,7 +163,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.response.data.non_field_errors, 4000);
});
},
filterFn(val, update) {

View File

@@ -97,7 +97,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError(e.response.data);
});
});
},

View File

@@ -283,7 +283,7 @@ export default {
}
this.notifySuccess(r.data);
})
.catch(e => this.notifyError(e.response.data));
.catch(e => {});
}
},
getPolicyChecks() {
@@ -295,7 +295,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("Unable to get policy checks");
});
},
step2() {

View File

@@ -164,7 +164,6 @@ export default {
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an issue editing the task");
});
},
show() {

View File

@@ -1,38 +1,6 @@
import { Notify, date } from "quasar";
import axios from 'axios'
export function notifySuccessConfig(msg, timeout = 2000) {
return {
type: "positive",
message: msg,
timeout: timeout
}
};
export function notifyErrorConfig(msg, timeout = 2000) {
return {
type: "negative",
message: msg,
timeout: timeout
}
};
export function notifyWarningConfig(msg, timeout = 2000) {
return {
type: "warning",
message: msg,
timeout: timeout
}
};
export function notifyInfoConfig(msg, timeout = 2000) {
return {
type: "info",
message: msg,
timeout: timeout
}
};
function getTimeLapse(unixtime) {
var previous = unixtime * 1000;
var current = new Date();
@@ -74,16 +42,32 @@ export default {
},
notifySuccess(msg, timeout = 2000) {
Notify.create(notifySuccessConfig(msg, timeout));
Notify.create({
type: "positive",
message: msg,
timeout: timeout
});
},
notifyError(msg, timeout = 2000) {
Notify.create(notifyErrorConfig(msg, timeout));
Notify.create({
type: "negative",
message: msg,
timeout: timeout
});
},
notifyWarning(msg, timeout = 2000) {
Notify.create(notifyWarningConfig(msg, timeout));
Notify.create({
type: "warning",
message: msg,
timeout: timeout
});
},
notifyInfo(msg, timeout = 2000) {
Notify.create(notifyInfoConfig(msg, timeout));
Notify.create({
type: "info",
message: msg,
timeout: timeout
});
},
isValidThreshold(warning, error, diskcheck = false) {
@@ -143,9 +127,6 @@ export default {
},
getCustomFields(model) {
return axios.patch("/core/customfields/", { model: model })
.catch(e => {
this.notifyError("There was an issue getting Custom Fields");
});
},
getAgentCount(data, type, id) {
if (type === "client") {
@@ -210,7 +191,8 @@ export default {
const sorted = tmp.sort((a, b) => a.label.localeCompare(b.label));
options.push(...sorted);
});
});
})
.catch(e => { });
return options;
}

View File

@@ -164,11 +164,13 @@ export default function () {
axios.patch("/accounts/users/ui/", { client_tree_splitter: Math.trunc(val) }).then(r => {
context.commit("SET_CLIENT_SPLITTER", val)
})
.catch(e => { })
},
setShowCommunityScripts(context, data) {
axios.patch("/accounts/users/ui/", { show_community_scripts: data }).then(r => {
context.commit("setShowCommunityScripts", data)
})
.catch(e => { })
},
toggleMaintenanceMode(context, data) {
return axios.post("/agents/maintenance/", data)
@@ -180,31 +182,37 @@ export default function () {
axios.get(`/tasks/${pk}/automatedtasks/`).then(r => {
context.commit("SET_AUTOMATED_TASKS", r.data);
})
.catch(e => { })
},
loadInstalledSoftware(context, pk) {
axios.get(`/software/installed/${pk}`).then(r => {
context.commit("SET_INSTALLED_SOFTWARE", r.data.software);
});
})
.catch(e => { });
},
loadWinUpdates(context, pk) {
axios.get(`/winupdate/${pk}/getwinupdates/`).then(r => {
context.commit("SET_WIN_UPDATE", r.data);
});
})
.catch(e => { });
},
loadSummary(context, pk) {
axios.get(`/agents/${pk}/agentdetail/`).then(r => {
context.commit("setSummary", r.data);
});
})
.catch(e => { });
},
loadChecks(context, pk) {
axios.get(`/checks/${pk}/loadchecks/`).then(r => {
context.commit("setChecks", r.data);
});
})
.catch(e => { });
},
loadNotes(context, pk) {
axios.get(`/agents/${pk}/notes/`).then(r => {
context.commit("SET_NOTES", r.data.notes);
});
})
.catch(e => { });
},
loadDefaultServices(context) {
return axios.get("/services/getdefaultservices/");
@@ -227,7 +235,8 @@ export default function () {
getUpdatedSites(context) {
axios.get("/clients/clients/").then(r => {
context.commit("getUpdatedSites", r.data);
});
})
.catch(e => { });
},
loadClients(context) {
return axios.get("/clients/clients/");
@@ -299,7 +308,8 @@ export default function () {
commit("loadTree", output);
}
});
})
.catch(e => { });
},
checkVer(context) {
axios.get("/core/version/").then(r => {
@@ -317,6 +327,7 @@ export default function () {
return;
}
})
.catch(e => { })
},
reload() {
localStorage.removeItem("rmmver");
@@ -334,14 +345,7 @@ export default function () {
context.commit("retrieveToken", { token, username });
resolve(response);
})
.catch(error => {
Notify.create({
type: "negative",
timeout: 1000,
message: "Bad token"
});
reject(error);
});
.catch(e => { })
});
},
destroyToken(context) {

View File

@@ -574,7 +574,7 @@ export default {
},
toggleDark(val) {
this.$q.dark.set(val);
this.$axios.patch("/accounts/users/ui/", { dark_mode: val });
this.$axios.patch("/accounts/users/ui/", { dark_mode: val }).catch(e => {});
},
refreshEntireSite() {
this.$store.dispatch("loadTree");
@@ -617,10 +617,13 @@ export default {
if (execute) {
this.$store.commit("AGENT_TABLE_LOADING", true);
this.$axios.patch("/agents/listagents/", data).then(r => {
this.frame = r.data;
this.$store.commit("AGENT_TABLE_LOADING", false);
});
this.$axios
.patch("/agents/listagents/", data)
.then(r => {
this.frame = r.data;
this.$store.commit("AGENT_TABLE_LOADING", false);
})
.catch(e => {});
}
}
},
@@ -638,10 +641,13 @@ export default {
},
loadAllClients() {
this.$store.commit("AGENT_TABLE_LOADING", true);
this.$axios.patch("/agents/listagents/").then(r => {
this.frame = r.data;
this.$store.commit("AGENT_TABLE_LOADING", false);
});
this.$axios
.patch("/agents/listagents/")
.then(r => {
this.frame = r.data;
this.$store.commit("AGENT_TABLE_LOADING", false);
})
.catch(e => {});
},
showPolicyAdd(node) {
this.$q
@@ -741,15 +747,10 @@ export default {
};
const text = node.color === "green" ? "Maintenance mode was disabled" : "Maintenance mode was enabled";
this.$store
.dispatch("toggleMaintenanceMode", data)
.then(response => {
this.notifySuccess(text);
this.getTree();
})
.catch(error => {
this.notifyError("An Error occured. Please try again");
});
this.$store.dispatch("toggleMaintenanceMode", data).then(response => {
this.notifySuccess(text);
this.getTree();
});
},
menuMaintenanceText(node) {
return node.color === "green" ? "Disable Maintenance Mode" : "Enable Maintenance Mode";

View File

@@ -97,25 +97,18 @@ export default {
this.$q.loading.hide();
this.$router.push({ name: "Dashboard" });
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("error uploading");
});
.catch(e => this.$q.loading.hide());
})
.catch(e => {
this.$q.loading.hide();
if (e.response.data.name) {
this.notifyError(e.response.data.name);
} else {
this.notifyError(e.response.data.non_field_errors);
}
});
.catch(e => this.$q.loading.hide());
},
getSettings() {
this.$axios.get("/core/getcoresettings/").then(r => {
this.allTimezones = Object.freeze(r.data.all_timezones);
this.timezone = r.data.default_time_zone;
});
this.$axios
.get("/core/getcoresettings/")
.then(r => {
this.allTimezones = Object.freeze(r.data.all_timezones);
this.timezone = r.data.default_time_zone;
})
.catch(e => {});
},
},
created() {

View File

@@ -61,7 +61,6 @@
</template>
<script>
import axios from "axios";
import mixins from "@/mixins/mixins";
export default {
@@ -76,7 +75,7 @@ export default {
methods: {
checkCreds() {
axios
this.$axios
.post("/checkcreds/", this.credentials)
.then(r => {
if (r.data.totp === "totp not set") {
@@ -91,9 +90,7 @@ export default {
this.prompt = true;
}
})
.catch(e => {
this.notifyError("Bad credentials");
});
.catch(e => {});
},
onSubmit() {
this.$store

View File

@@ -66,11 +66,14 @@ export default {
},
methods: {
genURLS() {
this.$axios.get(`/agents/${this.pk}/meshcentral/`).then(r => {
this.terminal = r.data.terminal;
this.file = r.data.file;
this.title = `${r.data.hostname} - ${r.data.client} - ${r.data.site} | Remote Background`;
});
this.$axios
.get(`/agents/${this.pk}/meshcentral/`)
.then(r => {
this.terminal = r.data.terminal;
this.file = r.data.file;
this.title = `${r.data.hostname} - ${r.data.client} - ${r.data.site} | Remote Background`;
})
.catch(e => {});
},
getUI() {
this.$store.dispatch("getDashInfo").then(r => {

View File

@@ -61,9 +61,7 @@ export default {
this.qr_url = r.data.qr_url;
}
})
.catch(e => {
this.$q.loading.hide();
});
.catch(e => this.$q.loading.hide());
},
logout() {
this.$q.loading.show();

View File

@@ -75,7 +75,6 @@ export default {
.catch(e => {
this.visible = true;
this.$q.loading.hide();
this.notifyError("Something went wrong");
});
},
restart() {
@@ -99,7 +98,6 @@ export default {
.catch(e => {
this.visible = true;
this.$q.loading.hide();
this.notifyError(e.response.data);
});
},
repair() {
@@ -118,7 +116,6 @@ export default {
.catch(e => {
this.visible = true;
this.$q.loading.hide();
this.notifyError(e.response.data);
});
},
},