Skip to content

Commit

Permalink
Merge pull request #37 from krumIO/feat/APPLAUNCHER-43__global_app_so…
Browse files Browse the repository at this point in the history
…rting

feat: for APPLAUNCHER-43 sorting global apps
  • Loading branch information
krumware authored May 8, 2024
2 parents 38912ad + e78e2e2 commit 439110f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion pkg/app-launcher/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,17 @@ export default {
}
return [];
},
sortedFavoritedApps() {
return this.favoritedApps.sort((a, b) => {
const nameA = a.metadata.name.toLowerCase();
const nameB = b.metadata.name.toLowerCase();
if (this.tableHeaders[0].sortOrder === 'asc') {
return nameA.localeCompare(nameB);
} else {
return nameB.localeCompare(nameA);
}
});
},
filteredApps() {
return (services, ingresses) => {
const sortedApps = [...(services || []), ...(ingresses || [])].sort((a, b) => {
Expand Down Expand Up @@ -293,7 +304,8 @@ export default {
<h2>{{ t('appLauncher.globalApps') }}</h2>
</div>
<div class="services-by-cluster-grid">
<AppLauncherCard v-for="favoritedApp in favoritedApps"
<AppLauncherCard
v-for="favoritedApp in sortedFavoritedApps"
:key="`${favoritedApp.clusterId}-${favoritedApp.id}-${favoritedApp.kind}-fav`"
:app="favoritedApp"
:isInGlobalView="true"
Expand Down

0 comments on commit 439110f

Please sign in to comment.