diff --git a/src/components/AgentTable.vue b/src/components/AgentTable.vue index ec8a9b9..183c96e 100644 --- a/src/components/AgentTable.vue +++ b/src/components/AgentTable.vue @@ -115,11 +115,41 @@ Send Command - + Run Script + + + + + + + Select Script + + + Favorites + + + + + + + {{ script.label }} + + + + + + @@ -386,6 +416,7 @@ export default { policyAddPk: null, showPendingActions: false, pendingActionAgentPk: null, + favoriteScripts: [], }; }, methods: { @@ -451,6 +482,31 @@ export default { this.showEditAgentModal = true; }, 500); }, + runFavScript(scriptpk, agentpk) { + const data = { + pk: agentpk, + timeout: 900, + scriptPK: scriptpk, + output: "forget", + args: [], + }; + this.$axios + .post("/agents/runscript/", data) + .then(r => this.notifySuccess(r.data)) + .catch(e => this.notifyError(e.response.data)); + }, + getFavoriteScripts() { + 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 })) + .sort((a, b) => a.label.localeCompare(b.label)); + }); + }, runPatchStatusScan(pk, hostname) { axios.get(`/winupdate/${pk}/runupdatescan/`).then(r => { this.notifySuccess(`Scan will be run shortly on ${hostname}`); diff --git a/src/components/ScriptManager.vue b/src/components/ScriptManager.vue index 46d5e26..6484d8d 100644 --- a/src/components/ScriptManager.vue +++ b/src/components/ScriptManager.vue @@ -103,6 +103,7 @@ flat class="q-ml-sm" :label="showCommunityScripts ? 'Hide Community Scripts' : 'Show Community Scripts'" + :icon="showCommunityScripts ? 'visibility_off' : 'visibility'" @click="setShowCommunityScripts(!showCommunityScripts)" /> diff --git a/src/components/modals/agents/BulkAction.vue b/src/components/modals/agents/BulkAction.vue index bf339a7..204d2a3 100644 --- a/src/components/modals/agents/BulkAction.vue +++ b/src/components/modals/agents/BulkAction.vue @@ -154,6 +154,7 @@ \ No newline at end of file