Merge pull request #15110 from Budibase/sort-table-names

sort table names alphabetically when selecting data source
This commit is contained in:
Andrew Thompson 2024-12-04 12:40:52 +00:00 committed by GitHub
commit 3d88d2ea6a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 3 deletions

View File

@ -52,9 +52,16 @@
let modal
$: text = value?.label ?? "Choose an option"
$: tables = $tablesStore.list.map(table =>
format.table(table, $datasources.list)
)
$: tables = $tablesStore.list
.map(table => format.table(table, $datasources.list))
.sort((a, b) => {
// sort tables alphabetically, grouped by datasource
const dsComparison = a.datasourceName.localeCompare(b.datasourceName)
if (dsComparison !== 0) {
return dsComparison
}
return a.label.localeCompare(b.label)
})
$: viewsV1 = $viewsStore.list.map(view => ({
...view,
label: view.name,