add more targeting options to bulk actions

This commit is contained in:
wh1te909 2020-12-15 08:30:55 +00:00
parent 52985e5ddc
commit 7fb46cdfc4
3 changed files with 23 additions and 0 deletions

View File

@ -550,6 +550,7 @@ class TestAgentViews(TacticalTestCase):
payload = {
"mode": "command",
"monType": "all",
"target": "agents",
"client": None,
"site": None,
@ -567,6 +568,7 @@ class TestAgentViews(TacticalTestCase):
payload = {
"mode": "command",
"monType": "servers",
"target": "agents",
"client": None,
"site": None,
@ -581,6 +583,7 @@ class TestAgentViews(TacticalTestCase):
payload = {
"mode": "command",
"monType": "workstations",
"target": "client",
"client": self.agent.client.id,
"site": None,
@ -598,6 +601,7 @@ class TestAgentViews(TacticalTestCase):
payload = {
"mode": "command",
"monType": "all",
"target": "client",
"client": self.agent.client.id,
"site": self.agent.site.id,
@ -615,6 +619,7 @@ class TestAgentViews(TacticalTestCase):
payload = {
"mode": "scan",
"monType": "all",
"target": "agents",
"client": None,
"site": None,
@ -628,6 +633,7 @@ class TestAgentViews(TacticalTestCase):
payload = {
"mode": "install",
"monType": "all",
"target": "client",
"client": self.agent.client.id,
"site": None,

View File

@ -825,6 +825,11 @@ def bulk(request):
else:
return notify_error("Something went wrong")
if request.data["monType"] == "servers":
q = q.filter(monitoring_type="server")
elif request.data["monType"] == "workstations":
q = q.filter(monitoring_type="workstation")
minions = [agent.salt_id for agent in q]
agents = [agent.pk for agent in q]

View File

@ -10,6 +10,16 @@
<br />
</q-card-section>
<q-form @submit.prevent="send">
<q-card-section>
<div class="q-pa-none">
<p>Agent Type</p>
<div class="q-gutter-sm">
<q-radio dense v-model="monType" val="all" label="All" />
<q-radio dense v-model="monType" val="servers" label="Servers" />
<q-radio dense v-model="monType" val="workstations" label="Workstations" />
</div>
</div>
</q-card-section>
<q-card-section>
<div class="q-pa-none">
<p>Choose Target</p>
@ -166,6 +176,7 @@ export default {
data() {
return {
target: "client",
monType: "all",
selected_mode: null,
scriptOptions: [],
scriptPK: null,
@ -206,6 +217,7 @@ export default {
this.$q.loading.show();
const data = {
mode: this.selected_mode,
monType: this.monType,
target: this.target,
site: this.site.value,
client: this.client.value,