mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 17:30:23 +08:00
Fix admin pool sorting and OAuth refresh
This commit is contained in:
@@ -99,6 +99,49 @@ describe('poolManagementState', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('supports score sort in storage and query state', () => {
|
||||
writePoolManagementViewState(
|
||||
{
|
||||
providerId: 'provider-g',
|
||||
search: 'score search',
|
||||
status: 'cooldown',
|
||||
page: 3,
|
||||
pageSize: 25,
|
||||
sortBy: 'score',
|
||||
sortOrder: 'desc',
|
||||
statsMode: 'current_cycle',
|
||||
},
|
||||
storage,
|
||||
)
|
||||
|
||||
expect(readPoolManagementViewState({}, storage)).toMatchObject({
|
||||
providerId: 'provider-g',
|
||||
search: 'score search',
|
||||
status: 'cooldown',
|
||||
page: 3,
|
||||
pageSize: 25,
|
||||
sortBy: 'score',
|
||||
sortOrder: 'desc',
|
||||
statsMode: 'current_cycle',
|
||||
})
|
||||
|
||||
expect(
|
||||
buildPoolManagementQueryPatch({
|
||||
providerId: 'provider-g',
|
||||
search: 'score search',
|
||||
status: 'cooldown',
|
||||
page: 3,
|
||||
pageSize: 25,
|
||||
sortBy: 'score',
|
||||
sortOrder: 'desc',
|
||||
statsMode: 'current_cycle',
|
||||
}),
|
||||
).toMatchObject({
|
||||
sortBy: 'score',
|
||||
sortOrder: 'desc',
|
||||
})
|
||||
})
|
||||
|
||||
it('omits defaults when building query patch', () => {
|
||||
expect(
|
||||
buildPoolManagementQueryPatch({
|
||||
@@ -131,13 +174,13 @@ describe('poolManagementState', () => {
|
||||
status: 'all',
|
||||
page: 1,
|
||||
pageSize: 50,
|
||||
sortBy: 'last_used_at',
|
||||
sortOrder: 'asc',
|
||||
sortBy: 'score',
|
||||
sortOrder: 'desc',
|
||||
statsMode: 'account_total',
|
||||
}),
|
||||
).toMatchObject({
|
||||
sortBy: 'last_used_at',
|
||||
sortOrder: 'asc',
|
||||
sortBy: 'score',
|
||||
sortOrder: 'desc',
|
||||
statsMode: 'account_total',
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export type PoolManagementStatus = 'all' | 'active' | 'cooldown' | 'inactive'
|
||||
export type PoolManagementSortBy = 'imported_at' | 'last_used_at'
|
||||
export type PoolManagementSortBy = 'imported_at' | 'last_used_at' | 'score'
|
||||
export type PoolManagementSortOrder = 'asc' | 'desc'
|
||||
export type PoolManagementStatsMode = 'current_cycle' | 'account_total'
|
||||
|
||||
@@ -73,7 +73,7 @@ function normalizePositiveInteger(value: unknown, fallback: number): number {
|
||||
}
|
||||
|
||||
function normalizeSortBy(value: unknown): PoolManagementSortBy | null {
|
||||
if (value === 'imported_at' || value === 'last_used_at') {
|
||||
if (value === 'imported_at' || value === 'last_used_at' || value === 'score') {
|
||||
return value
|
||||
}
|
||||
return DEFAULT_POOL_MANAGEMENT_VIEW_STATE.sortBy
|
||||
|
||||
Reference in New Issue
Block a user