diff --git a/src/components/agents/AgentActionMenu.vue b/src/components/agents/AgentActionMenu.vue index e7a3ab9..523cd39 100644 --- a/src/components/agents/AgentActionMenu.vue +++ b/src/components/agents/AgentActionMenu.vue @@ -302,9 +302,9 @@ export default { async function getURLActions() { menuLoading.value = true; try { - urlActions.value = (await fetchURLActions()).filter( - (action) => action.action_type === "web", - ); + urlActions.value = (await fetchURLActions()) + .filter((action) => action.action_type === "web") + .sort((a, b) => a.name.localeCompare(b.name)); if (urlActions.value.length === 0) { notifyWarning( @@ -312,8 +312,11 @@ export default { ); return; } - } catch (e) {} - menuLoading.value = true; + } catch (e) { + console.error(e); + } finally { + menuLoading.value = false; + } } function showSendCommand(agent) { diff --git a/src/components/modals/coresettings/UserPreferences.vue b/src/components/modals/coresettings/UserPreferences.vue index 48bebdc..81e7d91 100644 --- a/src/components/modals/coresettings/UserPreferences.vue +++ b/src/components/modals/coresettings/UserPreferences.vue @@ -313,18 +313,19 @@ export default { }, getURLActions() { this.$axios.get("/core/urlaction/").then((r) => { - if (r.data.length === 0) { - this.notifyWarning( - "No URL Actions configured. Go to Settings > Global Settings > URL Actions", - ); - return; - } this.urlActions = r.data .filter((action) => action.action_type === "web") + .sort((a, b) => a.name.localeCompare(b.name)) .map((action) => ({ label: action.name, value: action.id, })); + + if (this.urlActions.length === 0) { + this.notifyWarning( + "No URL Actions configured. Go to Settings > Global Settings > URL Actions", + ); + } }); }, getUserPrefs() { diff --git a/src/views/DashboardView.vue b/src/views/DashboardView.vue index 3dc7321..6e2cda9 100644 --- a/src/views/DashboardView.vue +++ b/src/views/DashboardView.vue @@ -818,15 +818,14 @@ export default { }, getURLActions() { this.$axios.get("/core/urlaction/").then((r) => { - if (r.data.length === 0) { + this.urlActions = r.data + .filter((action) => action.action_type === "web") + .sort((a, b) => a.name.localeCompare(b.name)); + if (this.urlActions.length === 0) { this.notifyWarning( "No URL Actions configured. Go to Settings > Global Settings > URL Actions", ); - return; } - this.urlActions = r.data.filter( - (action) => action.action_type === "web", - ); }); }, runURLAction(id, action, model) {