Skip to content

Commit

Permalink
sort urlactions by name closes amidaware/tacticalrmm#1795
Browse files Browse the repository at this point in the history
  • Loading branch information
wh1te909 committed Jul 26, 2024
1 parent 45e2690 commit 1f5af9b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
13 changes: 8 additions & 5 deletions src/components/agents/AgentActionMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -302,18 +302,21 @@ 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(
"No URL Actions configured. Go to Settings > Global Settings > URL Actions",
);
return;
}
} catch (e) {}
menuLoading.value = true;
} catch (e) {
console.error(e);
} finally {
menuLoading.value = false;
}
}
function showSendCommand(agent) {
Expand Down
13 changes: 7 additions & 6 deletions src/components/modals/coresettings/UserPreferences.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
9 changes: 4 additions & 5 deletions src/views/DashboardView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 1f5af9b

Please sign in to comment.