fix: sort apps list by id and not by name in order to avoid lowercase names being put at the end
This commit is contained in:
parent
072a868ab6
commit
8a63015be8
5 changed files with 6 additions and 6 deletions
|
@ -3,7 +3,7 @@ import { AppTableData } from './table.types';
|
|||
|
||||
type SortParams = {
|
||||
data: AppTableData;
|
||||
col: keyof Pick<AppInfo, 'name'>;
|
||||
col: keyof Pick<AppInfo, 'id'>;
|
||||
direction: 'asc' | 'desc';
|
||||
category?: AppCategory;
|
||||
search: string;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { AppInfo } from '../../../core/types';
|
||||
|
||||
export type SortableColumns = keyof Pick<AppInfo, 'name'>;
|
||||
export type SortableColumns = keyof Pick<AppInfo, 'id'>;
|
||||
export type SortDirection = 'asc' | 'desc';
|
||||
|
||||
export type AppTableData = Omit<AppInfo, 'description' | 'form_fields' | 'source' | 'status' | 'url_suffix' | 'version'>[];
|
||||
|
|
|
@ -18,7 +18,7 @@ export const useAppStoreState = create<Store>((set) => ({
|
|||
search: '',
|
||||
setSearch: (search) => set({ search }),
|
||||
setCategory: (category) => set({ category }),
|
||||
sort: 'name',
|
||||
sort: 'id',
|
||||
setSort: (sort) => set({ sort }),
|
||||
sortDirection: 'asc',
|
||||
setSortDirection: (sortDirection) => set({ sortDirection }),
|
||||
|
|
|
@ -502,10 +502,10 @@ describe('List apps', () => {
|
|||
fs.__createMockFiles(Object.assign(app1create.MockFiles, app2create.MockFiles));
|
||||
});
|
||||
|
||||
it('Should correctly list apps sorted by name', async () => {
|
||||
it('Should correctly list apps sorted by id', async () => {
|
||||
const { apps } = await AppServiceClass.listApps();
|
||||
|
||||
const sortedApps = [app1, app2].sort((a, b) => a.name.localeCompare(b.name));
|
||||
const sortedApps = [app1, app2].sort((a, b) => a.id.localeCompare(b.name));
|
||||
|
||||
expect(apps).toBeDefined();
|
||||
expect(apps.length).toBe(2);
|
||||
|
|
|
@ -10,7 +10,7 @@ import { Logger } from '../../core/Logger';
|
|||
import { createFolder } from '../../common/fs.helpers';
|
||||
import { notEmpty } from '../../common/typescript.helpers';
|
||||
|
||||
const sortApps = (a: AppInfo, b: AppInfo) => a.name.localeCompare(b.name);
|
||||
const sortApps = (a: AppInfo, b: AppInfo) => a.id.localeCompare(b.id);
|
||||
const filterApp = (app: AppInfo): boolean => {
|
||||
if (!app.supported_architectures) {
|
||||
return true;
|
||||
|
|
Loading…
Add table
Reference in a new issue