From df09227cf12d4dfdbaea86a401e12a89a85b8034 Mon Sep 17 00:00:00 2001 From: NikoAnderson Date: Wed, 4 Dec 2024 11:01:44 -0500 Subject: [PATCH] aa --- src/app/core/config/config.model.ts | 13 +++++++++++++ .../substance-form-codes-card.component.html | 8 ++++---- .../substance-form-codes-card.component.ts | 17 ++++++++++++++++- .../substance-form-names-card.component.ts | 13 +++++++++++++ ...bstance-form-references-card.component.html | 8 ++++---- ...substance-form-references-card.component.ts | 16 +++++++++++++++- ...ance-form-relationships-card.component.html | 8 ++++---- ...stance-form-relationships-card.component.ts | 18 +++++++++++++++++- 8 files changed, 86 insertions(+), 15 deletions(-) diff --git a/src/app/core/config/config.model.ts b/src/app/core/config/config.model.ts index 9952701b6..a17a1f095 100644 --- a/src/app/core/config/config.model.ts +++ b/src/app/core/config/config.model.ts @@ -85,6 +85,7 @@ export interface Config { enableStructureFeatures?: boolean; StructureFeaturePriority?: Array; structureEditSearch?: boolean; + editPagingOptionSettings?: PagingOptionSettings; } export interface StagingAreaSettings { @@ -159,3 +160,15 @@ export interface ExternalSiteWarning { dialogTitle: string; dialogMessage: string; } + +export interface PagingOptionSettings { + names?: PagingOptions; + codes?: PagingOptions; + relationships?: PagingOptions; + references?: PagingOptions; +} + +export interface PagingOptions { + pageSizeOptions?: Array; + pageSizeDefault?: number; +} \ No newline at end of file diff --git a/src/app/core/substance-form/codes/substance-form-codes-card.component.html b/src/app/core/substance-form/codes/substance-form-codes-card.component.html index a39b278dd..b94874a2a 100644 --- a/src/app/core/substance-form/codes/substance-form-codes-card.component.html +++ b/src/app/core/substance-form/codes/substance-form-codes-card.component.html @@ -9,16 +9,16 @@ Add code --> - +
- +
diff --git a/src/app/core/substance-form/codes/substance-form-codes-card.component.ts b/src/app/core/substance-form/codes/substance-form-codes-card.component.ts index 5cf6f6a6f..f70066ffd 100644 --- a/src/app/core/substance-form/codes/substance-form-codes-card.component.ts +++ b/src/app/core/substance-form/codes/substance-form-codes-card.component.ts @@ -6,6 +6,7 @@ import { ScrollToService } from '../../scroll-to/scroll-to.service'; import { GoogleAnalyticsService } from '../../google-analytics/google-analytics.service'; import { Subscription } from 'rxjs'; import { SubstanceFormCodesService } from './substance-form-codes.service'; +import { ConfigService } from '@gsrs-core/config'; @Component({ selector: 'app-substance-form-codes-card', @@ -20,12 +21,16 @@ export class SubstanceFormCodesCardComponent extends SubstanceCardBaseFilteredLi pageSize = 10; expanded = true; validate = false; + pageSizeOptions = [5, 10, 25, 100]; + constructor( private substanceFormCodesService: SubstanceFormCodesService, private substanceFormService: SubstanceFormService, private scrollToService: ScrollToService, - public gaService: GoogleAnalyticsService + public gaService: GoogleAnalyticsService, + private configService: ConfigService, + ) { super(gaService); this.analyticsEventCategory = 'substance form codes'; @@ -33,6 +38,16 @@ export class SubstanceFormCodesCardComponent extends SubstanceCardBaseFilteredLi ngOnInit() { this.menuLabelUpdate.emit('Codes'); + + if (this.configService && this.configService.configData && this.configService.configData.editPagingOptionSettings && this.configService.configData.editPagingOptionSettings.codes ){ + let pagingSettings = this.configService.configData.editPagingOptionSettings.codes; + if(pagingSettings.pageSizeDefault) { + this.pageSize = pagingSettings.pageSizeDefault + } + if(pagingSettings.pageSizeOptions) { + this.pageSizeOptions = pagingSettings.pageSizeOptions; + } + } } collapse() { diff --git a/src/app/core/substance-form/names/substance-form-names-card.component.ts b/src/app/core/substance-form/names/substance-form-names-card.component.ts index 68e405f00..30092538d 100644 --- a/src/app/core/substance-form/names/substance-form-names-card.component.ts +++ b/src/app/core/substance-form/names/substance-form-names-card.component.ts @@ -42,12 +42,25 @@ export class SubstanceFormNamesCardComponent this.menuLabelUpdate.emit('Names'); this.appId = this.configService.environment.appId; this.standardizeButton = this.configService.configData.showNameStandardizeButton || false; + //temp while switching to newer config system if (this.configService && this.configService.configData && this.configService.configData.nameFormPageSizeOptions) { this.pageSizeOptions = this.configService.configData.nameFormPageSizeOptions; } if (this.configService && this.configService.configData && this.configService.configData.nameFormPageSizeDefault) { this.pageSize = this.configService.configData.nameFormPageSizeDefault; } + + + if (this.configService && this.configService.configData && this.configService.configData.editPagingOptionSettings && this.configService.configData.editPagingOptionSettings.names ){ + let pagingSettings = this.configService.configData.editPagingOptionSettings.names; + if(pagingSettings.pageSizeDefault) { + this.pageSize = pagingSettings.pageSizeDefault + } + if(pagingSettings.pageSizeOptions) { + this.pageSizeOptions = pagingSettings.pageSizeOptions; + } + } + const definitionSubscription = this.substanceFormService.definition.subscribe( level => { if (level.definitionType && level.definitionType === 'ALTERNATIVE') { // this.canAddItemUpdate.emit(false); diff --git a/src/app/core/substance-form/references/substance-form-references-card.component.html b/src/app/core/substance-form/references/substance-form-references-card.component.html index 4bc7ca7bd..89b53ced3 100644 --- a/src/app/core/substance-form/references/substance-form-references-card.component.html +++ b/src/app/core/substance-form/references/substance-form-references-card.component.html @@ -7,15 +7,15 @@ Add reference -->
- +
- +
diff --git a/src/app/core/substance-form/references/substance-form-references-card.component.ts b/src/app/core/substance-form/references/substance-form-references-card.component.ts index a89fe9cb4..2c7207174 100644 --- a/src/app/core/substance-form/references/substance-form-references-card.component.ts +++ b/src/app/core/substance-form/references/substance-form-references-card.component.ts @@ -9,6 +9,7 @@ import { GoogleAnalyticsService } from '../../google-analytics/google-analytics. import { Subscription } from 'rxjs'; import { OverlayContainer } from '@angular/cdk/overlay'; import { SubstanceFormReferencesService } from './substance-form-references.service'; +import { ConfigService } from '@gsrs-core/config'; @Component({ selector: 'app-substance-form-references-card', @@ -20,13 +21,17 @@ export class SubstanceFormReferencesCardComponent extends SubstanceCardBaseFilte references: Array; private subscriptions: Array = []; private overlayContainer: HTMLElement; + pageSizeOptions = [5, 10, 25, 100]; + pageSize = 10; + constructor( private substanceFormReferencesService: SubstanceFormReferencesService, private dialog: MatDialog, private scrollToService: ScrollToService, public gaService: GoogleAnalyticsService, - private overlayContainerService: OverlayContainer + private overlayContainerService: OverlayContainer, + private configService: ConfigService, ) { super(gaService); this.analyticsEventCategory = 'substance form references'; @@ -36,6 +41,15 @@ export class SubstanceFormReferencesCardComponent extends SubstanceCardBaseFilte this.canAddItemUpdate.emit(true); this.menuLabelUpdate.emit('References'); this.overlayContainer = this.overlayContainerService.getContainerElement(); + if (this.configService && this.configService.configData && this.configService.configData.editPagingOptionSettings && this.configService.configData.editPagingOptionSettings.references ){ + let pagingSettings = this.configService.configData.editPagingOptionSettings.references; + if(pagingSettings.pageSizeDefault) { + this.pageSize = pagingSettings.pageSizeDefault + } + if(pagingSettings.pageSizeOptions) { + this.pageSizeOptions = pagingSettings.pageSizeOptions; + } +} } ngAfterViewInit() { diff --git a/src/app/core/substance-form/relationships/substance-form-relationships-card.component.html b/src/app/core/substance-form/relationships/substance-form-relationships-card.component.html index b2f46dbee..b32b2cde1 100644 --- a/src/app/core/substance-form/relationships/substance-form-relationships-card.component.html +++ b/src/app/core/substance-form/relationships/substance-form-relationships-card.component.html @@ -9,8 +9,8 @@ Add relationship -->
- +
@@ -18,8 +18,8 @@
- + diff --git a/src/app/core/substance-form/relationships/substance-form-relationships-card.component.ts b/src/app/core/substance-form/relationships/substance-form-relationships-card.component.ts index 12210b2df..05bbc814b 100644 --- a/src/app/core/substance-form/relationships/substance-form-relationships-card.component.ts +++ b/src/app/core/substance-form/relationships/substance-form-relationships-card.component.ts @@ -5,6 +5,7 @@ import { ScrollToService } from '../../scroll-to/scroll-to.service'; import { GoogleAnalyticsService } from '../../google-analytics/google-analytics.service'; import { Subscription } from 'rxjs'; import { SubstanceFormRelationshipsService } from './substance-form-relationships.service'; +import { ConfigService } from '@gsrs-core/config'; @Component({ selector: 'app-substance-form-relationships-card', @@ -16,11 +17,16 @@ export class SubstanceFormRelationshipsCardComponent extends SubstanceCardBaseFi relationships: Array; private subscriptions: Array = []; expanded = true; + pageSize = 10; + pageSizeOptions = [5, 10, 25, 100]; + constructor( private substanceFormRelationshipsService: SubstanceFormRelationshipsService, private scrollToService: ScrollToService, - public gaService: GoogleAnalyticsService + public gaService: GoogleAnalyticsService, + private configService: ConfigService, + ) { super(gaService); } @@ -29,6 +35,16 @@ export class SubstanceFormRelationshipsCardComponent extends SubstanceCardBaseFi this.canAddItemUpdate.emit(true); this.menuLabelUpdate.emit('Relationships'); this.analyticsEventCategory = 'substance form relationships'; + + if (this.configService && this.configService.configData && this.configService.configData.editPagingOptionSettings && this.configService.configData.editPagingOptionSettings.relationships ){ + let pagingSettings = this.configService.configData.editPagingOptionSettings.relationships; + if(pagingSettings.pageSizeDefault) { + this.pageSize = pagingSettings.pageSizeDefault + } + if(pagingSettings.pageSizeOptions) { + this.pageSizeOptions = pagingSettings.pageSizeOptions; + } + } } ngAfterViewInit() {