Skip to content

Commit

Permalink
Update source sorting
Browse files Browse the repository at this point in the history
Signed-off-by: Olga Bulat <[email protected]>
  • Loading branch information
obulat committed Aug 7, 2024
1 parent 61c010a commit 65bf7d3
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions frontend/src/components/VSourcesTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,15 @@ export default defineComponent({
const providerStore = useProviderStore()
const searchStore = useSearchStore()
const providers = ref<MediaProvider[]>(providerStore.providers[props.media])
const sorting = reactive({
direction: "asc",
field: "display_name" as keyof Omit<MediaProvider, "logo_url">,
})
// The providers in store are sorted by `source_name`, here we sort them by `display_name`.
const providers = ref<MediaProvider[]>(
providerStore.providers[props.media].sort(compareProviders)
)
function sortTable(field: keyof Omit<MediaProvider, "logo_url">) {
let direction = field === "media_count" ? "desc" : "asc"
Expand All @@ -132,10 +140,6 @@ export default defineComponent({
providers.value =
direction === "asc" ? sortedProviders : sortedProviders.reverse()
}
const sorting = reactive({
direction: "asc",
field: "display_name" as keyof Omit<MediaProvider, "logo_url">,
})
function cleanSourceUrlForPresentation(url: string) {
const stripProtocol = (s: string) => s.replace(/https?:\/\//, "")
Expand Down

0 comments on commit 65bf7d3

Please sign in to comment.