added agent status page and added #332

This commit is contained in:
sadnub
2021-12-23 13:57:37 -05:00
parent 77264034c8
commit dab72e51fe
21 changed files with 1480 additions and 1184 deletions

View File

@@ -1,7 +1,19 @@
import axios from "axios"
import { openURL } from "quasar";
import { router } from "@/router"
const baseUrl = "/agents"
export function runTakeControl(agent_id) {
const url = router.resolve(`/takecontrol/${agent_id}`).href;
openURL(url, null, { popup: true, scrollbars: false, location: false, status: false, toolbar: false, menubar: false, width: 1600, height: 900 });
}
export function runRemoteBackground(agent_id) {
const url = router.resolve(`/remotebackground/${agent_id}`).href;
openURL(url, null, { popup: true, scrollbars: false, location: false, status: false, toolbar: false, menubar: false, width: 1280, height: 900 });
}
export async function fetchAgents(params = {}) {
try {
const { data } = await axios.get(`${baseUrl}/`, { params: params })
@@ -18,6 +30,16 @@ export async function fetchAgent(agent_id, params = {}) {
} catch (e) { console.error(e) }
}
export async function editAgent(agent_id, payload) {
const { data } = await axios.put(`${baseUrl}/${agent_id}/`, payload)
return data
}
export async function removeAgent(agent_id) {
const { data } = await axios.delete(`${baseUrl}/${agent_id}/`)
return data
}
export async function fetchAgentHistory(agent_id, params = {}) {
try {
const { data } = await axios.get(`${baseUrl}/${agent_id}/history/`, { params: params })
@@ -101,11 +123,21 @@ export async function scheduleAgentReboot(agent_id, payload) {
return data
}
export async function agentRebootNow(agent_id) {
const { data } = await axios.post(`${baseUrl}/${agent_id}/reboot/`, payload)
return data
}
export async function sendAgentRecoverMesh(agent_id, params = {}) {
const { data } = await axios.post(`${baseUrl}/${agent_id}/meshcentral/recover/`, { params: params })
return data
}
export async function sendAgentPing(agent_id, params = {}) {
const { data } = await axios.get(`${baseUrl}/${agent_id}/ping/`, { params: params })
return data
}
// agent notes
export async function fetchAgentNotes(agent_id, params = {}) {
try {

View File

@@ -29,4 +29,9 @@ export async function removeCheck(id) {
export async function resetCheck(id) {
const { data } = await axios.post(`${baseUrl}/${id}/reset/`)
return data
}
export async function runAgentChecks(agent_id) {
const { data } = await axios.post(`${baseUrl}/${agent_id}/run/`)
return data
}

View File

@@ -1,4 +1,5 @@
import axios from "axios"
import { openURL } from "quasar";
const baseUrl = "/core"
@@ -17,4 +18,18 @@ export async function uploadMeshAgent(payload) {
export async function fetchDashboardInfo(params = {}) {
const { data } = await axios.get(`${baseUrl}/dashinfo/`, { params: params })
return data
}
export async function fetchURLActions(params = {}) {
try {
const { data } = await axios.get(`${baseUrl}/urlaction/`, { params: params })
return data
} catch (e) { console.error(e) }
}
export async function runURLAction(payload) {
try {
const { data } = await axios.patch(`${baseUrl}/urlaction/run/`, payload)
openURL(data)
} catch (e) { console.error(e) }
}