From 85c1670b5bc64a5154b1936fcd84c81ead7ea146 Mon Sep 17 00:00:00 2001 From: luisa-beerboom <101706784+luisa-beerboom@users.noreply.github.com> Date: Mon, 28 Aug 2023 09:10:21 +0200 Subject: [PATCH] Save sort order only on change (#2517) Always base list sorting on id to ensure sorting stability --- .../base-sort-list.service.ts | 167 ++++++++++++++---- .../services/assignment-sort-list.service.ts | 23 ++- .../mediafile-list-sort.service.ts | 19 +- .../motion-block-sort.service.ts | 14 +- .../amendment-list-sort.service.ts | 19 +- .../motion-list-sort.service.ts | 43 ++--- .../participant-list-sort.service.ts | 24 +-- .../account-sort.service.ts | 13 +- .../committee-sort.service.ts | 14 +- .../meeting-list-sort.service.ts | 14 +- .../sort-filter-bar.component.html | 39 +++- .../sort-filter-bar.component.ts | 37 +++- .../modules/list/definitions/sort-service.ts | 2 + 13 files changed, 277 insertions(+), 151 deletions(-) diff --git a/client/src/app/site/base/base-sort.service/base-sort-list.service.ts b/client/src/app/site/base/base-sort.service/base-sort-list.service.ts index 705a0fcafa..2d60a8a7bb 100644 --- a/client/src/app/site/base/base-sort.service/base-sort-list.service.ts +++ b/client/src/app/site/base/base-sort.service/base-sort-list.service.ts @@ -1,6 +1,14 @@ import { Directive } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; -import { BehaviorSubject, Observable, Subscription } from 'rxjs'; +import { + BehaviorSubject, + distinctUntilChanged, + filter, + firstValueFrom, + isObservable, + Observable, + Subscription +} from 'rxjs'; import { SortListService } from 'src/app/ui/modules/list/definitions/sort-service'; import { StorageService } from '../../../gateways/storage.service'; @@ -66,6 +74,15 @@ export abstract class BaseSortListService return this.sortDefinition!.sortAscending; } + public get hasSortOptionSelected(): boolean { + const defaultDef = this._defaultDefinitionSubject.value; + const current = this.sortDefinition; + if (!defaultDef || !current) { + return false; + } + return defaultDef.sortAscending !== current.sortAscending || defaultDef.sortProperty !== current.sortProperty; + } + /** * set the property of the viewModel the sorting will be based on. * If the property stays the same, only the sort direction will be toggled, @@ -87,7 +104,7 @@ export abstract class BaseSortListService * @returns the current sorting property */ public get sortProperty(): OsSortProperty { - return this.sortDefinition!.sortProperty; + return this.sortDefinition?.sortProperty; } /** @@ -105,8 +122,46 @@ export abstract class BaseSortListService return []; } - public constructor(translate: TranslateService, private store: StorageService) { + public get defaultOption(): OsSortingOption | undefined { + return this.getSortOptions().find( + option => + this._defaultDefinitionSubject.value && + this.isSameProperty(option.property, this._defaultDefinitionSubject.value.sortProperty) + ); + } + + public isSameProperty(a: OsSortProperty, b: OsSortProperty): boolean { + a = Array.isArray(a) ? a : [a]; + b = Array.isArray(b) ? b : [b]; + return a.equals(b); + } + + private _defaultDefinitionSubject = new BehaviorSubject>(null); + + private _isDefaultSorting = false; + + public constructor( + translate: TranslateService, + private store: StorageService, + defaultDefinition: OsSortingDefinition | Observable> + ) { super(translate); + + this._defaultDefinitionSubject + .pipe(distinctUntilChanged((prev, curr) => prev?.sortProperty === curr?.sortProperty)) + .subscribe(defaultDef => { + if (this._isDefaultSorting && defaultDef) { + this.setSorting(defaultDef.sortProperty, defaultDef.sortAscending); + } else if (defaultDef && this.sortDefinition?.sortProperty === defaultDef?.sortProperty) { + this.updateSortDefinitions(); + } + }); + + if (isObservable(defaultDefinition)) { + defaultDefinition.subscribe(this._defaultDefinitionSubject); + } else { + this._defaultDefinitionSubject.next(defaultDefinition); + } } /** @@ -136,10 +191,12 @@ export abstract class BaseSortListService return shouldHide; } - /** - * Enforce children to implement a method that returns the fault sorting - */ - protected abstract getDefaultDefinition(): OsSortingDefinition | Promise>; + protected async getDefaultDefinition(): Promise> { + if (this._defaultDefinitionSubject.value) { + return this._defaultDefinitionSubject.value; + } + return await firstValueFrom(this._defaultDefinitionSubject.pipe(filter(value => !!value))); + } /** * Defines the sorting properties, and returns an observable with sorted data @@ -151,16 +208,45 @@ export abstract class BaseSortListService this.exitSortService(); if (!this.sortDefinition) { - const storedDefinition = await this.store.get>(`sorting_` + this.storageKey); + let [storedDefinition, sortProperty, sortAscending]: [OsSortingDefinition, OsSortProperty, boolean] = + await Promise.all([ + // TODO: Remove the sorting definition loading part and everything caused by 'transformDeprecated' at a later date, it is only here for backwards compatibility + this.store.get>(`sorting_` + this.storageKey), + this.store.get>(`sorting_property_` + this.storageKey), + this.store.get(`sorting_ascending_` + this.storageKey) + ]); + + let transformDeprecated = !!storedDefinition; + if (transformDeprecated) { + this.store.remove(`sorting_` + this.storageKey); + } + + if ((sortAscending ?? sortProperty) != null) { + storedDefinition = { + sortAscending, + sortProperty + }; + } if (storedDefinition) { this.sortDefinition = storedDefinition; } if (this.sortDefinition && this.sortDefinition.sortProperty) { - this.updateSortedData(); + if (transformDeprecated) { + this.updateSortDefinitions(); + } else { + this.calculateDefaultStatus(); + this.updateSortedData(); + } } else { - this.sortDefinition = await this.getDefaultDefinition(); + let defaultDef = await this.getDefaultDefinition(); + sortAscending = sortAscending ?? defaultDef.sortAscending; + sortProperty = sortProperty ?? defaultDef.sortProperty; + this.sortDefinition = { + sortAscending, + sortProperty + }; this.updateSortDefinitions(); } } @@ -184,10 +270,14 @@ export abstract class BaseSortListService * @param property a sorting property of a view model * @param ascending ascending or descending */ - public setSorting(property: keyof V, ascending: boolean): void { - this.sortDefinition!.sortProperty = property; - this.sortDefinition!.sortAscending = ascending; - this.updateSortDefinitions(); + public setSorting(property: OsSortProperty, ascending: boolean): void { + if (!this.sortDefinition) { + this.sortDefinition = { sortProperty: property, sortAscending: ascending }; + } else { + this.sortDefinition!.sortProperty = property; + this.sortDefinition!.sortAscending = ascending; + this.updateSortDefinitions(); + } } /** @@ -229,14 +319,6 @@ export abstract class BaseSortListService return itemProperty.charAt(0).toUpperCase() + itemProperty.slice(1); } - /** - * Saves the current sorting definitions to the local store - */ - private updateSortDefinitions(): void { - this.updateSortedData(); - this.store.set(`sorting_` + this.storageKey, this.sortDefinition); - } - /** * Recreates the sorting function. Is supposed to be called on init and * every time the sorting (property, ascending/descending) or the language changes @@ -244,17 +326,40 @@ export abstract class BaseSortListService protected async updateSortedData(): Promise { const alternativeProperty = (await this.getDefaultDefinition()).sortProperty; if (this.inputData) { - this.inputData.sort((itemA, itemB) => - this.sortItems( - itemA, - itemB, - this.shouldHideOption({ property: this.sortProperty }, false) - ? alternativeProperty - : this.sortProperty, - this.ascending + this.outputSubject.next( + [...this.inputData].sort( + (itemA, itemB) => + this.sortItems( + itemA, + itemB, + this.shouldHideOption({ property: this.sortProperty }, false) + ? alternativeProperty + : this.sortProperty, + this.ascending + ) || itemA.id - itemB.id ) ); - this.outputSubject.next(this.inputData); } } + + /** + * Saves the current sorting definitions to the local store + */ + private updateSortDefinitions(): void { + this.calculateDefaultStatus(); + this.updateSortedData(); + if (this._isDefaultSorting) { + this.store.remove(`sorting_property_` + this.storageKey); + } else { + this.store.set(`sorting_property_` + this.storageKey, this.sortDefinition?.sortProperty); + } + this.store.set(`sorting_ascending_` + this.storageKey, this.sortDefinition?.sortAscending); + } + + private calculateDefaultStatus(): void { + this._isDefaultSorting = this.isSameProperty( + this.sortDefinition.sortProperty, + this._defaultDefinitionSubject.value?.sortProperty + ); + } } diff --git a/client/src/app/site/pages/meetings/pages/assignments/pages/assignment-list/services/assignment-sort-list.service.ts b/client/src/app/site/pages/meetings/pages/assignments/pages/assignment-list/services/assignment-sort-list.service.ts index eff3c8c138..8a4375f830 100644 --- a/client/src/app/site/pages/meetings/pages/assignments/pages/assignment-list/services/assignment-sort-list.service.ts +++ b/client/src/app/site/pages/meetings/pages/assignments/pages/assignment-list/services/assignment-sort-list.service.ts @@ -1,5 +1,7 @@ import { Injectable } from '@angular/core'; -import { BaseSortListService, OsSortingDefinition, OsSortingOption } from 'src/app/site/base/base-sort.service'; +import { TranslateService } from '@ngx-translate/core'; +import { StorageService } from 'src/app/gateways/storage.service'; +import { BaseSortListService, OsSortingOption } from 'src/app/site/base/base-sort.service'; import { ViewAssignment } from 'src/app/site/pages/meetings/pages/assignments'; import { AssignmentListServiceModule } from './assignment-list-service.module'; @@ -26,22 +28,17 @@ export class AssignmentSortListService extends BaseSortListService[] { return this.assignmentSortOptions; } - - /** - * Required by parent - * - * @returns the default sorting strategy - */ - public async getDefaultDefinition(): Promise> { - return { - sortProperty: `title`, - sortAscending: true - }; - } } diff --git a/client/src/app/site/pages/meetings/pages/mediafiles/modules/mediafile-list/services/mediafile-list-sort.service/mediafile-list-sort.service.ts b/client/src/app/site/pages/meetings/pages/mediafiles/modules/mediafile-list/services/mediafile-list-sort.service/mediafile-list-sort.service.ts index 4f252c2b56..c58606be18 100644 --- a/client/src/app/site/pages/meetings/pages/mediafiles/modules/mediafile-list/services/mediafile-list-sort.service/mediafile-list-sort.service.ts +++ b/client/src/app/site/pages/meetings/pages/mediafiles/modules/mediafile-list/services/mediafile-list-sort.service/mediafile-list-sort.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; import { StorageService } from 'src/app/gateways/storage.service'; -import { BaseSortListService, OsSortingDefinition, OsSortingOption } from 'src/app/site/base/base-sort.service'; +import { BaseSortListService, OsSortingOption } from 'src/app/site/base/base-sort.service'; import { ViewMediafile } from '../../../../view-models'; import { MediafileListServiceModule } from '../mediafile-list-service.module'; @@ -26,7 +26,10 @@ export class MediafileListSortService extends BaseSortListService ]; public constructor(translate: TranslateService, store: StorageService) { - super(translate, store); + super(translate, store, { + sortProperty: `title`, + sortAscending: true + }); } /** @@ -35,16 +38,4 @@ export class MediafileListSortService extends BaseSortListService protected getSortOptions(): OsSortingOption[] { return this.mediafilesSortOptions; } - - /** - * Required by parent - * - * @returns the default sorting strategy - */ - public async getDefaultDefinition(): Promise> { - return { - sortProperty: `title`, - sortAscending: true - }; - } } diff --git a/client/src/app/site/pages/meetings/pages/motions/pages/motion-blocks/services/motion-block-sort.service/motion-block-sort.service.ts b/client/src/app/site/pages/meetings/pages/motions/pages/motion-blocks/services/motion-block-sort.service/motion-block-sort.service.ts index 8e0df3dc57..65eae69adf 100644 --- a/client/src/app/site/pages/meetings/pages/motions/pages/motion-blocks/services/motion-block-sort.service/motion-block-sort.service.ts +++ b/client/src/app/site/pages/meetings/pages/motions/pages/motion-blocks/services/motion-block-sort.service/motion-block-sort.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; import { StorageService } from 'src/app/gateways/storage.service'; -import { BaseSortListService, OsSortingDefinition, OsSortingOption } from 'src/app/site/base/base-sort.service'; +import { BaseSortListService, OsSortingOption } from 'src/app/site/base/base-sort.service'; import { ViewMotionBlock } from 'src/app/site/pages/meetings/pages/motions'; import { MotionBlockServiceModule } from '../motion-block-service.module'; @@ -28,7 +28,10 @@ export class MotionBlockSortService extends BaseSortListService ]; public constructor(translate: TranslateService, store: StorageService) { - super(translate, store); + super(translate, store, { + sortProperty: `title`, + sortAscending: true + }); } /** @@ -37,11 +40,4 @@ export class MotionBlockSortService extends BaseSortListService protected getSortOptions(): OsSortingOption[] { return this.MotionBlockSortOptions; } - - protected async getDefaultDefinition(): Promise> { - return { - sortProperty: `title`, - sortAscending: true - }; - } } diff --git a/client/src/app/site/pages/meetings/pages/motions/services/list/amendment-list-sort.service/amendment-list-sort.service.ts b/client/src/app/site/pages/meetings/pages/motions/services/list/amendment-list-sort.service/amendment-list-sort.service.ts index 0e220a8ead..440e945efa 100644 --- a/client/src/app/site/pages/meetings/pages/motions/services/list/amendment-list-sort.service/amendment-list-sort.service.ts +++ b/client/src/app/site/pages/meetings/pages/motions/services/list/amendment-list-sort.service/amendment-list-sort.service.ts @@ -1,6 +1,9 @@ import { Injectable } from '@angular/core'; -import { OsSortingDefinition, OsSortingOption } from 'src/app/site/base/base-sort.service'; +import { TranslateService } from '@ngx-translate/core'; +import { StorageService } from 'src/app/gateways/storage.service'; +import { OsSortingOption } from 'src/app/site/base/base-sort.service'; import { ViewMotion } from 'src/app/site/pages/meetings/pages/motions'; +import { MeetingSettingsService } from 'src/app/site/pages/meetings/services/meeting-settings.service'; import { MotionListSortService } from '../motion-list-sort.service'; import { MotionsListServiceModule } from '../motions-list-service.module'; @@ -21,14 +24,14 @@ export class AmendmentListSortService extends MotionListSortService { } ]; - protected override getSortOptions(): OsSortingOption[] { - return this.amendmentSortOptions.concat(super.getSortOptions()); + constructor(translate: TranslateService, store: StorageService, meetingSettingsService: MeetingSettingsService) { + super(translate, store, meetingSettingsService, { + sortProperty: `title`, + sortAscending: true + }); } - protected override async getDefaultDefinition(): Promise> { - return { - sortProperty: `parentAndLineNumber`, - sortAscending: true - }; + protected override getSortOptions(): OsSortingOption[] { + return this.amendmentSortOptions.concat(super.getSortOptions()); } } diff --git a/client/src/app/site/pages/meetings/pages/motions/services/list/motion-list-sort.service/motion-list-sort.service.ts b/client/src/app/site/pages/meetings/pages/motions/services/list/motion-list-sort.service/motion-list-sort.service.ts index 5d4b448565..f3176639f7 100644 --- a/client/src/app/site/pages/meetings/pages/motions/services/list/motion-list-sort.service/motion-list-sort.service.ts +++ b/client/src/app/site/pages/meetings/pages/motions/services/list/motion-list-sort.service/motion-list-sort.service.ts @@ -1,8 +1,8 @@ -import { Injectable } from '@angular/core'; +import { Inject, Injectable, Optional } from '@angular/core'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { TranslateService } from '@ngx-translate/core'; +import { BehaviorSubject, Observable } from 'rxjs'; import { StorageService } from 'src/app/gateways/storage.service'; -import { Deferred } from 'src/app/infrastructure/utils/promises'; import { BaseSortListService, OsSortingDefinition, @@ -28,11 +28,6 @@ export class MotionListSortService extends BaseSortListService { */ private defaultMotionSorting: string; - /** - * To wait until the default motion was loaded once - */ - private readonly defaultSortingLoaded: Deferred = new Deferred(); - /** * Define the sort options */ @@ -49,6 +44,8 @@ export class MotionListSortService extends BaseSortListService { { property: `last_modified`, label: _(`Last modified`) } ]; + private defaultDefinitionSubject: BehaviorSubject>; + /** * Constructor. * @@ -59,17 +56,28 @@ export class MotionListSortService extends BaseSortListService { public constructor( protected override translate: TranslateService, store: StorageService, - private meetingSettingsService: MeetingSettingsService + private meetingSettingsService: MeetingSettingsService, + @Optional() + @Inject(undefined) + defaultDefinition?: OsSortingDefinition | Observable> ) { - super(translate, store); + const defaultDefinitions = new BehaviorSubject>(null); + super(translate, store, defaultDefinition ?? defaultDefinitions); + this.defaultDefinitionSubject = defaultDefinitions; this.defaultMotionSorting = `number`; - this.defaultSortingLoaded.resolve(); + this.defaultDefinitionSubject.next({ + sortProperty: this.getDefaultSortProperty(), + sortAscending: true + }); this.meetingSettingsService.get(`motions_default_sorting`).subscribe(defSortProp => { if (defSortProp) { this.defaultMotionSorting = defSortProp; - this.defaultSortingLoaded.resolve(); + this.defaultDefinitionSubject.next({ + sortProperty: this.getDefaultSortProperty(), + sortAscending: true + }); } }); } @@ -78,19 +86,6 @@ export class MotionListSortService extends BaseSortListService { return this.motionSortOptions; } - /** - * Required by parent - * - * @returns the default sorting strategy - */ - protected async getDefaultDefinition(): Promise> { - await this.defaultSortingLoaded; - return { - sortProperty: this.getDefaultSortProperty(), - sortAscending: true - }; - } - private getDefaultSortProperty(): OsSortProperty { if (this.defaultMotionSorting === `weight`) { return `tree_weight`; diff --git a/client/src/app/site/pages/meetings/pages/participants/pages/participant-list/services/participant-list-sort.service/participant-list-sort.service.ts b/client/src/app/site/pages/meetings/pages/participants/pages/participant-list/services/participant-list-sort.service/participant-list-sort.service.ts index bb7f218428..14af10ccd6 100644 --- a/client/src/app/site/pages/meetings/pages/participants/pages/participant-list/services/participant-list-sort.service/participant-list-sort.service.ts +++ b/client/src/app/site/pages/meetings/pages/participants/pages/participant-list/services/participant-list-sort.service/participant-list-sort.service.ts @@ -2,12 +2,7 @@ import { Injectable } from '@angular/core'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { TranslateService } from '@ngx-translate/core'; import { StorageService } from 'src/app/gateways/storage.service'; -import { - BaseSortListService, - OsHideSortingOptionSetting, - OsSortingDefinition, - OsSortingOption -} from 'src/app/site/base/base-sort.service'; +import { BaseSortListService, OsHideSortingOptionSetting, OsSortingOption } from 'src/app/site/base/base-sort.service'; import { MeetingSettingsService } from 'src/app/site/pages/meetings/services/meeting-settings.service'; import { ViewUser } from 'src/app/site/pages/meetings/view-models/view-user'; @@ -47,7 +42,10 @@ export class ParticipantListSortService extends BaseSortListService { store: StorageService, private meetingSettings: MeetingSettingsService ) { - super(translate, store); + super(translate, store, { + sortProperty: [`first_name`, `last_name`], + sortAscending: true + }); this.meetingSettings.get(`users_enable_vote_weight`).subscribe(value => (this._voteWeightEnabled = value)); } @@ -58,18 +56,6 @@ export class ParticipantListSortService extends BaseSortListService { return this.userSortOptions; } - /** - * Required by parent - * - * @returns the default sorting strategy - */ - public async getDefaultDefinition(): Promise> { - return { - sortProperty: [`first_name`, `last_name`], - sortAscending: true - }; - } - protected override getHideSortingOptionSettings(): OsHideSortingOptionSetting[] { return [ { diff --git a/client/src/app/site/pages/organization/pages/accounts/pages/account-list/services/account-list-sort.service/account-sort.service.ts b/client/src/app/site/pages/organization/pages/accounts/pages/account-list/services/account-list-sort.service/account-sort.service.ts index c51f211ac3..05615818bf 100644 --- a/client/src/app/site/pages/organization/pages/accounts/pages/account-list/services/account-list-sort.service/account-sort.service.ts +++ b/client/src/app/site/pages/organization/pages/accounts/pages/account-list/services/account-list-sort.service/account-sort.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { TranslateService } from '@ngx-translate/core'; import { StorageService } from 'src/app/gateways/storage.service'; -import { BaseSortListService, OsSortingDefinition, OsSortingOption } from 'src/app/site/base/base-sort.service'; +import { BaseSortListService, OsSortingOption } from 'src/app/site/base/base-sort.service'; import { ViewUser } from 'src/app/site/pages/meetings/view-models/view-user'; import { AccountListServiceModule } from '../account-list-service.module'; @@ -29,16 +29,13 @@ export class AccountSortService extends BaseSortListService { ]; public constructor(translate: TranslateService, store: StorageService) { - super(translate, store); + super(translate, store, { + sortProperty: [`first_name`, `last_name`], + sortAscending: true + }); } protected getSortOptions(): OsSortingOption[] { return this.staticSortOptions; } - protected async getDefaultDefinition(): Promise> { - return { - sortProperty: [`first_name`, `last_name`], - sortAscending: true - }; - } } diff --git a/client/src/app/site/pages/organization/pages/committees/pages/committee-list/services/committee-list-sort.service/committee-sort.service.ts b/client/src/app/site/pages/organization/pages/committees/pages/committee-list/services/committee-list-sort.service/committee-sort.service.ts index 55f91999ec..3d92665c65 100644 --- a/client/src/app/site/pages/organization/pages/committees/pages/committee-list/services/committee-list-sort.service/committee-sort.service.ts +++ b/client/src/app/site/pages/organization/pages/committees/pages/committee-list/services/committee-list-sort.service/committee-sort.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { TranslateService } from '@ngx-translate/core'; import { StorageService } from 'src/app/gateways/storage.service'; -import { BaseSortListService, OsSortingDefinition, OsSortingOption } from 'src/app/site/base/base-sort.service'; +import { BaseSortListService, OsSortingOption } from 'src/app/site/base/base-sort.service'; import { ViewCommittee } from '../../../../view-models'; import { CommitteeListServiceModule } from '../committee-list-service.module'; @@ -20,17 +20,13 @@ export class CommitteeSortService extends BaseSortListService { ]; public constructor(translate: TranslateService, store: StorageService) { - super(translate, store); + super(translate, store, { + sortProperty: `name`, + sortAscending: true + }); } protected getSortOptions(): OsSortingOption[] { return this.staticSortOptions; } - - protected getDefaultDefinition(): OsSortingDefinition { - return { - sortProperty: `name`, - sortAscending: true - }; - } } diff --git a/client/src/app/site/pages/organization/pages/orga-meetings/pages/meeting-list/services/meeting-list-sort/meeting-list-sort.service.ts b/client/src/app/site/pages/organization/pages/orga-meetings/pages/meeting-list/services/meeting-list-sort/meeting-list-sort.service.ts index 11c7a370bf..c96711d1dd 100644 --- a/client/src/app/site/pages/organization/pages/orga-meetings/pages/meeting-list/services/meeting-list-sort/meeting-list-sort.service.ts +++ b/client/src/app/site/pages/organization/pages/orga-meetings/pages/meeting-list/services/meeting-list-sort/meeting-list-sort.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { TranslateService } from '@ngx-translate/core'; import { StorageService } from 'src/app/gateways/storage.service'; -import { BaseSortListService, OsSortingDefinition, OsSortingOption } from 'src/app/site/base/base-sort.service'; +import { BaseSortListService, OsSortingOption } from 'src/app/site/base/base-sort.service'; import { ViewMeeting } from 'src/app/site/pages/meetings/view-models/view-meeting'; import { MeetingListServiceModule } from '../meeting-list-service.module'; @@ -24,17 +24,13 @@ export class MeetingListSortService extends BaseSortListService { ]; public constructor(translate: TranslateService, store: StorageService) { - super(translate, store); + super(translate, store, { + sortProperty: `name`, + sortAscending: true + }); } protected getSortOptions(): OsSortingOption[] { return this.staticSortOptions; } - - protected getDefaultDefinition(): OsSortingDefinition { - return { - sortProperty: `name`, - sortAscending: true - }; - } } diff --git a/client/src/app/ui/modules/list/components/sort-filter-bar/sort-filter-bar.component.html b/client/src/app/ui/modules/list/components/sort-filter-bar/sort-filter-bar.component.html index 2cad601181..ca7ddb4578 100644 --- a/client/src/app/ui/modules/list/components/sort-filter-bar/sort-filter-bar.component.html +++ b/client/src/app/ui/modules/list/components/sort-filter-bar/sort-filter-bar.component.html @@ -38,10 +38,33 @@ - @@ -79,7 +102,15 @@
- + + + + +