rework bulk action modal. start running bulk actions on next agent checkin

This commit is contained in:
sadnub
2021-07-30 12:48:47 -04:00
parent b5b5ddc047
commit a8df08cf4e
7 changed files with 310 additions and 282 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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,