sort urlactions by name closes amidaware/tacticalrmm#1795

This commit is contained in:
wh1te909
2024-07-26 18:53:21 +00:00
parent 45e2690a81
commit 1f5af9ba2d
3 changed files with 19 additions and 16 deletions

View File

@@ -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) {

View File

@@ -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() {

View File

@@ -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) {