Skip to content

Commit

Permalink
Show page report in paginator, mark svcs as readonly in constructors (#…
Browse files Browse the repository at this point in the history
…259)

* feat: show page report in paginator, mark svcs as readonly in constructors

* feat: adjust translations

---------

Co-authored-by: Christian Badura <[email protected]>
  • Loading branch information
cbadura and Christian Badura authored Oct 1, 2024
1 parent 5a2bf12 commit 6ec730c
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ export class AnnouncementDetailComponent implements OnChanges {
public priorityOptions$: Observable<SelectItem[]> = of([])

constructor(
private user: UserService,
private announcementApi: AnnouncementInternalAPIService,
private fb: FormBuilder,
private translate: TranslateService,
private msgService: PortalMessageService
private readonly user: UserService,
private readonly announcementApi: AnnouncementInternalAPIService,
private readonly fb: FormBuilder,
private readonly translate: TranslateService,
private readonly msgService: PortalMessageService
) {
this.dateFormat = this.user.lang$.getValue() === 'de' ? 'dd.mm.yy' : 'mm/dd/yy'
this.timeFormat = this.user.lang$.getValue() === 'de' ? '24' : '12'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export class AnnouncementCriteriaComponent implements OnInit {
public priorityType$: Observable<SelectItem[]> = of([])

constructor(
private user: UserService,
public translate: TranslateService
private readonly user: UserService,
public readonly translate: TranslateService
) {
this.dateFormatForRange = this.user.lang$.getValue() === 'de' ? 'dd.mm.yy' : 'm/d/yy'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
paginatorPosition="bottom"
[rows]="10"
[rowsPerPageOptions]="[10, 20, 100]"
[showCurrentPageReport]="true"
currentPageReportTemplate="{first} - {last} {{ 'ACTIONS.SEARCH.OF' | translate }} {totalRecords}"
>
<ng-template pTemplate="caption">
<ocx-data-view-controls
Expand All @@ -39,9 +41,6 @@
[filterColumns]="['ANNOUNCEMENT.TITLE' | translate, 'ANNOUNCEMENT.WORKSPACE' | translate]"
></ocx-data-view-controls>
</ng-template>
<ng-template pTemplate="paginatorleft" let-state>
<ocx-paging-info [resultsCount]="announcements ? announcements.length : -1" [state]="state"></ocx-paging-info>
</ng-template>

<ng-template pTemplate="emptymessage">
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ export class AnnouncementSearchComponent implements OnInit {
]

constructor(
private user: UserService,
private announcementApi: AnnouncementInternalAPIService,
private msgService: PortalMessageService,
private translate: TranslateService,
private cdr: ChangeDetectorRef
private readonly user: UserService,
private readonly announcementApi: AnnouncementInternalAPIService,
private readonly msgService: PortalMessageService,
private readonly translate: TranslateService,
private readonly cdr: ChangeDetectorRef
) {
this.dateFormat = this.user.lang$.getValue() === 'de' ? 'dd.MM.yyyy HH:mm' : 'M/d/yy, h:mm a'
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/onecx-announcement-remote.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const routes: Routes = [
schemas: []
})
export class OneCXAnnouncementModule implements DoBootstrap {
constructor(private injector: Injector) {
constructor(private readonly injector: Injector) {
console.info('OneCX Announcement Module constructor')
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ export class OneCXAnnouncementBannerComponent implements ocxRemoteComponent, ocx
public announcements$: Observable<AnnouncementAbstract[] | undefined> = this.announcementsSubject.asObservable()

constructor(
@Inject(BASE_URL) private baseUrl: ReplaySubject<string>,
private translateService: TranslateService,
private apiV1: AnnouncementInternalAPIService,
private appStateService: AppStateService,
private userService: UserService,
private appConfigService: AppConfigService
@Inject(BASE_URL) private readonly baseUrl: ReplaySubject<string>,
private readonly translateService: TranslateService,
private readonly apiV1: AnnouncementInternalAPIService,
private readonly appStateService: AppStateService,
private readonly userService: UserService,
private readonly appConfigService: AppConfigService
) {
this.userService.lang$.subscribe((lang) => this.translateService.use(lang))
combineLatest([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ export class OneCXAnnouncementListActiveComponent implements ocxRemoteComponent,
copyToClipboard = copyToClipboard

constructor(
@Inject(BASE_URL) private baseUrl: ReplaySubject<string>,
private announcementApi: AnnouncementInternalAPIService,
private translateService: TranslateService,
private appStateService: AppStateService,
private userService: UserService,
private appConfigService: AppConfigService
@Inject(BASE_URL) private readonly baseUrl: ReplaySubject<string>,
private readonly announcementApi: AnnouncementInternalAPIService,
private readonly translateService: TranslateService,
private readonly appStateService: AppStateService,
private readonly userService: UserService,
private readonly appConfigService: AppConfigService
) {
this.userService.lang$.subscribe((lang) => this.translateService.use(lang))
combineLatest([this.baseUrl.asObservable(), this.appStateService.currentWorkspace$.asObservable()])
Expand Down
3 changes: 2 additions & 1 deletion src/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
"NO_DATA": "Keine Ergebnisse",
"NO_RESULTS": "Die Suche ergab keine Ergebnisse",
"SEARCH_FAILED": "Die Suche ist fehlgeschlagen",
"NOT_FOUND": "Keine Daten gefunden"
"NOT_FOUND": "Keine Daten gefunden",
"OF": "von"
},
"CANCEL": "Abbrechen",
"CHOOSE": "Auswählen",
Expand Down
3 changes: 2 additions & 1 deletion src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
"NO_DATA": "No data",
"NO_RESULTS": "Search returned no results",
"SEARCH_FAILED": "Search failed",
"NOT_FOUND": "No data found"
"NOT_FOUND": "No data found",
"OF": "of"
},
"CANCEL": "Cancel",
"CHOOSE": "Choose",
Expand Down

0 comments on commit 6ec730c

Please sign in to comment.