diff --git a/src/components/AgentTable.vue b/src/components/AgentTable.vue index 0b0d2e7..90d98a1 100644 --- a/src/components/AgentTable.vue +++ b/src/components/AgentTable.vue @@ -109,6 +109,30 @@ Take Control + + + + + Run URL Action + + + + + + + {{ action.name }} + + + + + @@ -438,6 +462,7 @@ export default { showPendingActions: false, pendingActionAgentPk: null, favoriteScripts: [], + urlActions: [], }; }, methods: { @@ -526,17 +551,24 @@ export default { }, getFavoriteScripts() { this.favoriteScripts = []; - this.$axios.get("/scripts/scripts/").then(r => { - if (r.data.filter(k => k.favorite === true).length === 0) { - this.notifyWarning("You don't have any scripts favorited!"); - return; - } - this.favoriteScripts = r.data - .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 => {}); + this.$axios + .get("/scripts/scripts/") + .then(r => { + if (r.data.filter(k => k.favorite === true).length === 0) { + this.notifyWarning("You don't have any scripts favorited!"); + return; + } + this.favoriteScripts = r.data + .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 @@ -740,6 +772,28 @@ export default { rowSelectedClass(id) { if (this.selectedRow === id) return this.$q.dark.isActive ? "highlight-dark" : "highlight"; }, + getURLActions() { + this.$axios + .get("/core/urlaction/") + .then(r => { + if (r.data.length === 0) { + this.notifyWarning("No URL Actions configured. Go to Settings > Global Settings > URL Actions"); + return; + } + this.urlActions = r.data; + }) + .catch(() => {}); + }, + runURLAction(agentid, action) { + const data = { + agent: agentid, + action: action.id, + }; + this.$axios + .patch("/core/urlaction/run", data) + .then(r => {}) + .catch(() => {}); + }, }, computed: { ...mapGetters(["selectedAgentPk", "agentTableHeight"]), diff --git a/src/components/modals/coresettings/EditCoreSettings.vue b/src/components/modals/coresettings/EditCoreSettings.vue index cab1f65..5cd1d4c 100644 --- a/src/components/modals/coresettings/EditCoreSettings.vue +++ b/src/components/modals/coresettings/EditCoreSettings.vue @@ -9,6 +9,7 @@ +