Merge pull request #25 from koloml/feature/consistent-sorting

Sort listing of profiles & tags in profile view alphabetically
This commit is contained in:
koloml authored and GitHub committed 2024-08-10 14:42:14 +04:00
commit 135ed48c01
3 files changed
+5 -3

No files matched your search

@@ -1,6 +1,8 @@
<script>
/** @type {import('$lib/extension/entities/MaintenanceProfile.js').default} */
export let profile;
const sortedTagsList = profile.settings.tags.sort((a, b) => a.localeCompare(b));
</script>
<div class="block">
@@ -10,7 +12,7 @@
<div class="block">
<strong>Tags:</strong>
<div class="tags-list">
{#each profile.settings.tags as tagName}
{#each sortedTagsList as tagName}
<span class="tag">{tagName}</span>
{/each}
</div>
+1 -1
View File
@@ -7,7 +7,7 @@
/** @type {import('$lib/extension/entities/MaintenanceProfile.js').default[]} */
let profiles = [];
$: profiles = $maintenanceProfilesStore.sort((a, b) => b.settings.name.localeCompare(a.settings.name));
$: profiles = $maintenanceProfilesStore.sort((a, b) => a.settings.name.localeCompare(b.settings.name));
function resetActiveProfile() {
$activeProfileStore = null;
@@ -28,7 +28,7 @@
if (maybeExistingProfile) {
targetProfile = maybeExistingProfile;
profileName = targetProfile.settings.name;
tagsList = [...targetProfile.settings.tags];
tagsList = [...targetProfile.settings.tags].sort((a, b) => a.localeCompare(b));
} else {
goto('/settings/maintenance');
}