Fix applist sorting

This commit is contained in:
Johannes Zellner
2025-04-23 10:54:15 +02:00
parent 05f68d0b1a
commit 4a8e9fef99
3 changed files with 35 additions and 17 deletions

View File

@@ -50,9 +50,14 @@ const listColumns = {
},
label: {
label: 'Label',
sort: true
sort: (a, b, fullA, fullB) => {
if (!fullA || !fullA) return -1;
const checkA = fullA.label || fullA.subdomain || fullA.fqdn;
const checkB = fullB.label || fullB.subdomain || fullB.fqdn;
return checkA < checkB ? -1 : (checkA > checkB ? 1 : 0);
},
},
domain: {
fqdn: {
label: 'Location',
sort: true,
hideMobile: true,
@@ -60,21 +65,34 @@ const listColumns = {
status: {
label: 'Status',
hideMobile: true,
sort: (a, b) => {
// TODO we need pankow fix to pass full object a,b instead of just the property
if (!a || !b) return -1;
return a.installationState < b.installationState ? -1 : (a.installationState > b.installationState ? 1 : 0);
sort: (a, b, fullA, fullB) => {
if (!fullA || !fullA) return -1;
const checkA = fullA.installationState + '-' + fullA.runState + '-' + fullA.health;
const checkB = fullB.installationState + '-' + fullB.runState + '-' + fullB.health;
return checkA < checkB ? -1 : (checkA > checkB ? 1 : 0);
},
},
appTitle: {
label: 'App Title',
sort: true,
hideMobile: true,
sort: (a, b, fullA, fullB) => {
if (!fullA || !fullA) return -1;
const checkA = fullA.manifest.title;
const checkB = fullB.manifest.title;
return checkA < checkB ? -1 : (checkA > checkB ? 1 : 0);
},
},
sso: {
label: 'Login',
sort: true,
hideMobile: true,
sort: (a, b, fullA, fullB) => {
if (!fullA || !fullA) return -1;
const checkA = fullA.type === APP_TYPES.LINK ? 0 : (fullA.ssoAuth && fullA.manifest.addons.oidc ? 1 : (fullA.ssoAuth && (!fullA.manifest.addons.oidc && !fullA.manifest.addons.email) ? 2 : (!fullA.ssoAuth && !fullA.manifest.addons.email ? 3 : 4)));
const checkB = fullB.type === APP_TYPES.LINK ? 0 : (fullB.ssoAuth && fullB.manifest.addons.oidc ? 1 : (fullB.ssoAuth && (!fullB.manifest.addons.oidc && !fullB.manifest.addons.email) ? 2 : (!fullB.ssoAuth && !fullB.manifest.addons.email ? 3 : 4)));
return checkA - checkB;
},
},
actions: {}
};
@@ -253,7 +271,7 @@ onUnmounted(() => {
<template #appTitle="app">
{{ app.manifest.title }}
</template>
<template #domain="app">
<template #fqdn="app">
<a :href="'https://' + app.fqdn" target="_blank">
{{ app.fqdn }}
</a>