4242 <q-item-section >VNC</q-item-section >
4343 </q-item >
4444
45- <q-item clickable v-ripple @click = " getURLActions " >
45+ <q-item clickable v-ripple :disable = " urlActions.length === 0 " >
4646 <q-item-section side >
4747 <q-icon size =" xs" name =" open_in_new" />
4848 </q-item-section >
6262 runURLAction({ agent_id: agent.agent_id, action: action.id })
6363 "
6464 >
65- {{ action.name }}
65+ < q-item-section > {{ action.name }}</ q-item-section >
6666 </q-item >
6767 </q-list >
6868 </q-menu >
8282 <q-item-section >Run Script</q-item-section >
8383 </q-item >
8484
85- <q-item clickable v-ripple @click = " getFavoriteScripts " >
85+ <q-item clickable v-ripple :disable = " favoriteScripts.length === 0 " >
8686 <q-item-section side >
8787 <q-icon size =" xs" name =" star" />
8888 </q-item-section >
100100 v-close-popup
101101 @click =" showRunScript(agent, script.value)"
102102 >
103- {{ script.label }}
103+ < q-item-section > {{ script.label }}</ q-item-section >
104104 </q-item >
105105 </q-list >
106106 </q-menu >
245245
246246<script >
247247// composition imports
248- import { ref , inject } from " vue" ;
248+ import { ref , inject , onMounted } from " vue" ;
249249import { useStore } from " vuex" ;
250250import { useQuasar } from " quasar" ;
251251import { fetchURLActions , runURLAction } from " @/api/core" ;
@@ -263,7 +263,7 @@ import {
263263import { runAgentUpdateScan , runAgentUpdateInstall } from " @/api/winupdates" ;
264264import { runAgentChecks } from " @/api/checks" ;
265265import { fetchScripts } from " @/api/scripts" ;
266- import { notifySuccess , notifyWarning , notifyError } from " @/utils/notify" ;
266+ import { notifySuccess , notifyError } from " @/utils/notify" ;
267267
268268// ui imports
269269import PendingActions from " @/components/logs/PendingActions.vue" ;
@@ -296,7 +296,6 @@ export default {
296296
297297 const urlActions = ref ([]);
298298 const favoriteScripts = ref ([]);
299- const menuLoading = ref (false );
300299
301300 function showEditAgent (agent_id ) {
302301 $q .dialog ({
@@ -317,22 +316,12 @@ export default {
317316 }
318317
319318 async function getURLActions () {
320- menuLoading .value = true ;
321319 try {
322320 urlActions .value = (await fetchURLActions ())
323321 .filter ((action ) => action .action_type === " web" )
324322 .sort ((a , b ) => a .name .localeCompare (b .name ));
325-
326- if (urlActions .value .length === 0 ) {
327- notifyWarning (
328- " No URL Actions configured. Go to Settings > Global Settings > URL Actions" ,
329- );
330- return ;
331- }
332323 } catch (e) {
333324 console .error (e);
334- } finally {
335- menuLoading .value = false ;
336325 }
337326 }
338327
@@ -358,19 +347,13 @@ export default {
358347 async function getFavoriteScripts () {
359348 favoriteScripts .value = [];
360349
361- menuLoading .value = true ;
362350 try {
363351 const data = await fetchScripts ({
364352 showCommunityScripts: store .state .showCommunityScripts ,
365353 });
366354
367355 const scripts = data .filter ((script ) => !! script .favorite );
368356
369- if (scripts .length === 0 ) {
370- notifyWarning (" You don't have any scripts favorited!" );
371- return ;
372- }
373-
374357 favoriteScripts .value = scripts
375358 .map ((script ) => ({
376359 label: script .name ,
@@ -490,7 +473,7 @@ export default {
490473 prompt: {
491474 model: " " ,
492475 type: " text" ,
493- isValid : (val ) => val === " yes" ,
476+ isValid : (val ) => val . toLowerCase () === " yes" ,
494477 },
495478 cancel: true ,
496479 ok: { label: " Shutdown" , color: " negative" },
@@ -565,7 +548,7 @@ export default {
565548 prompt: {
566549 model: " " ,
567550 type: " text" ,
568- isValid : (val ) => val === " yes" ,
551+ isValid : (val ) => val . toLowerCase () === " yes" ,
569552 },
570553 cancel: true ,
571554 ok: { label: " Uninstall" , color: " negative" },
@@ -585,6 +568,11 @@ export default {
585568 });
586569 }
587570
571+ onMounted (async () => {
572+ await getURLActions ();
573+ await getFavoriteScripts ();
574+ });
575+
588576 return {
589577 // reactive data
590578 urlActions,
0 commit comments