mirror of
https://github.com/jpros/tacticalrmm-web.git
synced 2026-01-20 03:50:21 +00:00
change favorited script run on agent to opent he Run Script modal with the script and defaults populated
This commit is contained in:
@@ -112,7 +112,7 @@
|
||||
|
||||
<q-item clickable v-ripple @click="getURLActions">
|
||||
<q-item-section side>
|
||||
<q-icon size="xs" name="mdi-open-in-new" />
|
||||
<q-icon size="xs" name="open_in_new" />
|
||||
</q-item-section>
|
||||
<q-item-section>Run URL Action</q-item-section>
|
||||
<q-item-section side>
|
||||
@@ -164,7 +164,7 @@
|
||||
dense
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="runFavScript(script.value, props.row.id)"
|
||||
@click="showRunScript(props.row, script.value)"
|
||||
>
|
||||
{{ script.label }}
|
||||
</q-item>
|
||||
@@ -531,24 +531,10 @@ export default {
|
||||
}
|
||||
}, 500);
|
||||
},
|
||||
runFavScript(scriptpk, agentpk) {
|
||||
const script = this.favoriteScripts.find(i => i.value === scriptpk);
|
||||
const data = {
|
||||
pk: agentpk,
|
||||
timeout: script.timeout,
|
||||
scriptPK: scriptpk,
|
||||
output: "forget",
|
||||
args: script.args,
|
||||
};
|
||||
this.$axios
|
||||
.post("/agents/runscript/", data)
|
||||
.then(r => this.notifySuccess(r.data))
|
||||
.catch(e => {});
|
||||
},
|
||||
getFavoriteScripts() {
|
||||
this.favoriteScripts = [];
|
||||
this.$axios
|
||||
.get("/scripts/scripts/")
|
||||
.get("/scripts/")
|
||||
.then(r => {
|
||||
if (r.data.filter(k => k.favorite === true).length === 0) {
|
||||
this.notifyWarning("You don't have any scripts favorited!");
|
||||
@@ -797,11 +783,12 @@ export default {
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
showRunScript(agent) {
|
||||
showRunScript(agent, script = undefined) {
|
||||
this.$q.dialog({
|
||||
component: RunScript,
|
||||
componentProps: {
|
||||
agent,
|
||||
script,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
@@ -122,6 +122,7 @@ export default {
|
||||
components: { TacticalDropdown },
|
||||
props: {
|
||||
agent: !Object,
|
||||
script: Number,
|
||||
},
|
||||
setup(props) {
|
||||
// setup vuex store
|
||||
@@ -132,7 +133,7 @@ export default {
|
||||
const { dialogRef, onDialogHide } = useDialogPluginComponent();
|
||||
|
||||
// setup dropdowns
|
||||
const { script, scriptOptions, defaultTimeout, defaultArgs, getScriptOptions } = useScriptDropdown();
|
||||
const { script, scriptOptions, defaultTimeout, defaultArgs, getScriptOptions } = useScriptDropdown(props.script);
|
||||
const { customFieldOptions, getCustomFieldOptions } = useCustomFieldDropdown();
|
||||
|
||||
// main run script functionaity
|
||||
|
||||
@@ -156,30 +156,6 @@
|
||||
<q-item-section>{{ menuMaintenanceText(props.node) }}</q-item-section>
|
||||
</q-item>
|
||||
|
||||
<q-item clickable v-ripple @click="getURLActions">
|
||||
<q-item-section side>
|
||||
<q-icon size="xs" name="mdi-open-in-new" />
|
||||
</q-item-section>
|
||||
<q-item-section>Run URL Action</q-item-section>
|
||||
<q-item-section side>
|
||||
<q-icon name="keyboard_arrow_right" />
|
||||
</q-item-section>
|
||||
<q-menu auto-close anchor="top end" self="top start">
|
||||
<q-list>
|
||||
<q-item
|
||||
v-for="action in urlActions"
|
||||
:key="action.id"
|
||||
dense
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="runURLAction(props.node.id, action.id, props.node.children ? 'client' : 'site')"
|
||||
>
|
||||
{{ action.name }}
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu>
|
||||
</q-item>
|
||||
|
||||
<q-item
|
||||
v-if="props.node.children === undefined"
|
||||
clickable
|
||||
@@ -206,6 +182,30 @@
|
||||
<q-item-section>Assign Alert Template</q-item-section>
|
||||
</q-item>
|
||||
|
||||
<q-item clickable v-ripple @click="getURLActions">
|
||||
<q-item-section side>
|
||||
<q-icon name="open_in_new" />
|
||||
</q-item-section>
|
||||
<q-item-section>Run URL Action</q-item-section>
|
||||
<q-item-section side>
|
||||
<q-icon name="keyboard_arrow_right" />
|
||||
</q-item-section>
|
||||
<q-menu auto-close anchor="top end" self="top start">
|
||||
<q-list>
|
||||
<q-item
|
||||
v-for="action in urlActions"
|
||||
:key="action.id"
|
||||
dense
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="runURLAction(props.node.id, action.id, props.node.children ? 'client' : 'site')"
|
||||
>
|
||||
{{ action.name }}
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu>
|
||||
</q-item>
|
||||
|
||||
<q-separator></q-separator>
|
||||
|
||||
<q-item clickable v-close-popup>
|
||||
|
||||
Reference in New Issue
Block a user