diff --git a/src/api/agents.js b/src/api/agents.js index cac64af..ed1762f 100644 --- a/src/api/agents.js +++ b/src/api/agents.js @@ -22,3 +22,10 @@ export async function runScript(payload) { return data } catch (e) { } } + +export async function runBulkAction(payload) { + + const { data } = await axios.post("/agents/bulk/", payload) + return data + +} \ No newline at end of file diff --git a/src/api/clients.js b/src/api/clients.js index ab6edba..a6a8ff2 100644 --- a/src/api/clients.js +++ b/src/api/clients.js @@ -7,4 +7,11 @@ export async function fetchClients() { const { data } = await axios.get(`${baseUrl}/clients/`) return data } catch (e) { } +} + +export async function fetchSites() { + try { + const { data } = await axios.get(`${baseUrl}/sites/`) + return data + } catch (e) { } } \ No newline at end of file diff --git a/src/components/FileBar.vue b/src/components/FileBar.vue index 5ef5dfd..642380c 100644 --- a/src/components/FileBar.vue +++ b/src/components/FileBar.vue @@ -105,15 +105,15 @@ - + Bulk Command - + Bulk Script - + Bulk Patch Management @@ -176,10 +176,6 @@ - - - - @@ -228,7 +224,6 @@ export default { InstallAgent, UploadMesh, AdminManager, - BulkAction, Deployment, ServerMaintenance, CodeSign, @@ -242,9 +237,7 @@ export default { showAdminManager: false, showInstallAgent: false, showUploadMesh: false, - showBulkAction: false, showPendingActions: false, - bulkMode: null, showDeployment: false, showCodeSign: false, }; @@ -333,6 +326,14 @@ export default { component: ScriptManager, }); }, + showBulkAction(mode) { + this.$q.dialog({ + component: BulkAction, + componentProps: { + mode: mode, + }, + }); + }, showDebugLog() { this.$q.dialog({ component: DialogWrapper, diff --git a/src/components/modals/agents/BulkAction.vue b/src/components/modals/agents/BulkAction.vue index 55f0e9f..ff49b99 100644 --- a/src/components/modals/agents/BulkAction.vue +++ b/src/components/modals/agents/BulkAction.vue @@ -1,290 +1,293 @@ \ No newline at end of file diff --git a/src/composables/agents.js b/src/composables/agents.js index 176d8b7..959d0b1 100644 --- a/src/composables/agents.js +++ b/src/composables/agents.js @@ -5,7 +5,8 @@ import { formatAgentOptions } from "@/utils/format" // agent dropdown export function useAgentDropdown() { - + const agent = ref(null) + const agents = ref([]) const agentOptions = ref([]) // specifing flat returns an array of hostnames versus {value:id, label: hostname} @@ -15,6 +16,8 @@ export function useAgentDropdown() { return { //data + agent, + agents, agentOptions, //methods diff --git a/src/composables/clients.js b/src/composables/clients.js index af373d9..eb44223 100644 --- a/src/composables/clients.js +++ b/src/composables/clients.js @@ -4,7 +4,8 @@ import { fetchClients } from "@/api/clients" import { formatClientOptions, formatSiteOptions } from "@/utils/format" export function useClientDropdown() { - + const client = ref(null) + const clients = ref([]) const clientOptions = ref([]) async function getClientOptions(flat = false) { @@ -13,6 +14,8 @@ export function useClientDropdown() { return { //data + client, + clients, clientOptions, //methods @@ -21,14 +24,18 @@ export function useClientDropdown() { } export function useSiteDropdown() { + const site = ref(null) + const sites = ref([]) const siteOptions = ref([]) async function getSiteOptions() { - siteOptions.value = formatSiteOptions(await fetchSites()) + siteOptions.value = formatSiteOptions(await fetchClients()) } return { //data + site, + sites, siteOptions, //methods diff --git a/src/composables/scripts.js b/src/composables/scripts.js index d0b90e3..b332f26 100644 --- a/src/composables/scripts.js +++ b/src/composables/scripts.js @@ -7,7 +7,7 @@ export function useScriptDropdown() { const scriptOptions = ref([]) const defaultTimeout = ref(30) const defaultArgs = ref([]) - const scriptPK = ref(null) + const script = ref(null) // specifing flat returns an array of script names versus {value:id, label: hostname} async function getScriptOptions(showCommunityScripts = false, flat = false) { @@ -15,17 +15,17 @@ export function useScriptDropdown() { } // watch scriptPk for changes and update the default timeout and args - watch(scriptPK, (newValue, oldValue) => { + watch(script, (newValue, oldValue) => { if (newValue) { - const script = scriptOptions.value.find(i => i.value === newValue); - defaultTimeout.value = script.timeout; - defaultArgs.value = script.args; + const tmpScript = scriptOptions.value.find(i => i.value === newValue); + defaultTimeout.value = tmpScript.timeout; + defaultArgs.value = tmpScript.args; } }) return { //data - scriptPK, + script, scriptOptions, defaultTimeout, defaultArgs,