From f61d758eeb4177063cf452f1bec885a4669334b1 Mon Sep 17 00:00:00 2001 From: Christian Badura <93912698+cbadura@users.noreply.github.com> Date: Tue, 1 Oct 2024 10:48:08 +0200 Subject: [PATCH] Show current page report in paginator (#270) * feat: show page report in paginator * feat: mark svcs as readonly in constructors --------- Co-authored-by: Christian Badura --- src/app/onecx-theme-remote.module.ts | 2 +- .../image-container.component.ts | 2 +- src/app/shared/label.resolver.ts | 2 +- .../theme-designer.component.ts | 21 +++++++++---------- .../theme-detail/theme-detail.component.ts | 14 ++++++------- .../theme-import/theme-import.component.ts | 10 ++++----- .../theme-search/theme-search.component.html | 2 ++ .../theme-search/theme-search.component.ts | 10 ++++----- src/assets/i18n/de.json | 1 + src/assets/i18n/en.json | 1 + 10 files changed, 34 insertions(+), 31 deletions(-) diff --git a/src/app/onecx-theme-remote.module.ts b/src/app/onecx-theme-remote.module.ts index c262fe5..0f0fc26 100644 --- a/src/app/onecx-theme-remote.module.ts +++ b/src/app/onecx-theme-remote.module.ts @@ -63,7 +63,7 @@ const routes: Routes = [ schemas: [] }) export class OneCXThemeModule implements DoBootstrap { - constructor(private injector: Injector) { + constructor(private readonly injector: Injector) { console.info('OneCX Theme Module constructor') } diff --git a/src/app/shared/image-container/image-container.component.ts b/src/app/shared/image-container/image-container.component.ts index e17dfba..060819f 100644 --- a/src/app/shared/image-container/image-container.component.ts +++ b/src/app/shared/image-container/image-container.component.ts @@ -30,7 +30,7 @@ export class ImageContainerComponent implements OnChanges { prepareUrlPath = prepareUrlPath - constructor(private appState: AppStateService) { + constructor(private readonly appState: AppStateService) { appState.currentMfe$ .pipe( map((mfe) => { diff --git a/src/app/shared/label.resolver.ts b/src/app/shared/label.resolver.ts index dd7bffd..c094451 100644 --- a/src/app/shared/label.resolver.ts +++ b/src/app/shared/label.resolver.ts @@ -6,7 +6,7 @@ import { Observable, map } from 'rxjs' //dont use `providedIn root` - wont work when we are in shell @Injectable() export class LabelResolver implements Resolve { - constructor(private translate: TranslateService) {} + constructor(private readonly translate: TranslateService) {} resolve(route: ActivatedRouteSnapshot, _state: RouterStateSnapshot): string | Observable | Promise { return route.data['breadcrumb'] ? this.translate.get(route.data['breadcrumb']).pipe(map((t) => t.toString())) diff --git a/src/app/theme/theme-designer/theme-designer.component.ts b/src/app/theme/theme-designer/theme-designer.component.ts index b477aae..4f777aa 100644 --- a/src/app/theme/theme-designer/theme-designer.component.ts +++ b/src/app/theme/theme-designer/theme-designer.component.ts @@ -5,7 +5,7 @@ import { Observable, combineLatest, debounceTime, first, map, switchMap } from ' import { TranslateService } from '@ngx-translate/core' import { ConfirmationService, SelectItem } from 'primeng/api' -import { Action, AppStateService, PortalMessageService, ThemeService } from '@onecx/portal-integration-angular' +import { Action, PortalMessageService, ThemeService } from '@onecx/portal-integration-angular' import { bffImageUrl, dropDownSortItemsByLabel, dropDownGetLabelByValue } from 'src/app/shared/utils' import { GetThemeResponse, @@ -65,16 +65,15 @@ export class ThemeDesignerComponent implements OnInit { }[] constructor( - private fb: FormBuilder, - private route: ActivatedRoute, - private router: Router, - private appStateService: AppStateService, - private themeApi: ThemesAPIService, - private themeService: ThemeService, - private imageApi: ImagesInternalAPIService, - private translate: TranslateService, - private confirmation: ConfirmationService, - private msgService: PortalMessageService + private readonly fb: FormBuilder, + private readonly route: ActivatedRoute, + private readonly router: Router, + private readonly themeApi: ThemesAPIService, + private readonly themeService: ThemeService, + private readonly imageApi: ImagesInternalAPIService, + private readonly translate: TranslateService, + private readonly confirmation: ConfirmationService, + private readonly msgService: PortalMessageService ) { this.mode = route.snapshot.paramMap.has('name') ? 'EDIT' : 'NEW' this.themeName = route.snapshot.paramMap.get('name') diff --git a/src/app/theme/theme-detail/theme-detail.component.ts b/src/app/theme/theme-detail/theme-detail.component.ts index 7f0748e..3f109fe 100644 --- a/src/app/theme/theme-detail/theme-detail.component.ts +++ b/src/app/theme/theme-detail/theme-detail.component.ts @@ -34,13 +34,13 @@ export class ThemeDetailComponent implements OnInit { public headerImageUrl?: string constructor( - private user: UserService, - private router: Router, - private route: ActivatedRoute, - private themeApi: ThemesAPIService, - private msgService: PortalMessageService, - private translate: TranslateService, - private imageApi: ImagesInternalAPIService + private readonly user: UserService, + private readonly router: Router, + private readonly route: ActivatedRoute, + private readonly themeApi: ThemesAPIService, + private readonly msgService: PortalMessageService, + private readonly translate: TranslateService, + private readonly imageApi: ImagesInternalAPIService ) { this.themeName = this.route.snapshot.paramMap.get('name') || '' this.dateFormat = this.user.lang$.getValue() === 'de' ? 'dd.MM.yyyy HH:mm:ss' : 'medium' diff --git a/src/app/theme/theme-import/theme-import.component.ts b/src/app/theme/theme-import/theme-import.component.ts index 987b2e1..8791f37 100644 --- a/src/app/theme/theme-import/theme-import.component.ts +++ b/src/app/theme/theme-import/theme-import.component.ts @@ -29,11 +29,11 @@ export class ThemeImportComponent implements OnInit { public properties: any = null constructor( - private route: ActivatedRoute, - private router: Router, - private themeApi: ThemesAPIService, - public translate: TranslateService, - private msgService: PortalMessageService + private readonly route: ActivatedRoute, + private readonly router: Router, + private readonly themeApi: ThemesAPIService, + public readonly translate: TranslateService, + private readonly msgService: PortalMessageService ) {} ngOnInit(): void { diff --git a/src/app/theme/theme-search/theme-search.component.html b/src/app/theme/theme-search/theme-search.component.html index 0b9b4cc..2190fee 100644 --- a/src/app/theme/theme-search/theme-search.component.html +++ b/src/app/theme/theme-search/theme-search.component.html @@ -20,6 +20,8 @@ filterBy="displayName,name" [sortField]="sortField" [sortOrder]="sortOrder" + [showCurrentPageReport]="true" + currentPageReportTemplate="{first} - {last} {{ 'GENERAL.OF' | translate }} {totalRecords}" >