diff --git a/src/app/domain/typeScriptClasses.ts b/src/app/domain/typeScriptClasses.ts index e0e7013ce..265943d4c 100755 --- a/src/app/domain/typeScriptClasses.ts +++ b/src/app/domain/typeScriptClasses.ts @@ -118,21 +118,13 @@ export class DatasourceDetails { export class Repository extends DatasourceDetails implements IsSerializable { timezone: number; - datasourceType: string; interfaces: RepositoryInterface[]; piwikInfo: PiwikInfo; environments: string[]; namespacePrefix: string; - officialName: string; - registeredBy: string; - englishName: string; - collectedFrom: string; dateOfValidation: Date; dateOfCollection: Date; dataCollectionTypes: DataCollectionType[]; - websiteUrl: string; - logoUrl: string; - contactEmail: string; } export class RepositorySnippet { diff --git a/src/app/pages/repository/aggregationhistory/compatibility-monitor-fullHistory-repo.component.ts b/src/app/pages/repository/aggregationhistory/compatibility-monitor-fullHistory-repo.component.ts index ae27ce586..b9937b8a6 100755 --- a/src/app/pages/repository/aggregationhistory/compatibility-monitor-fullHistory-repo.component.ts +++ b/src/app/pages/repository/aggregationhistory/compatibility-monitor-fullHistory-repo.component.ts @@ -30,7 +30,7 @@ export class CompatibilityMonitorFullHistoryRepoComponent implements OnInit { if(this.sharedService.getRepository()) { this.repo = this.sharedService.getRepository(); - this.repoName = this.repo.officialName; + this.repoName = this.repo.officialname; this.getAllAggregationHistory(); } @@ -38,7 +38,7 @@ export class CompatibilityMonitorFullHistoryRepoComponent implements OnInit { r => { this.repo = r; if (this.repo) { - this.repoName = this.repo.officialName; + this.repoName = this.repo.officialname; this.getAllAggregationHistory(); } } diff --git a/src/app/pages/repository/aggregationhistory/compatibility-monitor-repo.component.ts b/src/app/pages/repository/aggregationhistory/compatibility-monitor-repo.component.ts index 5b4cd7de5..c0109a1ed 100755 --- a/src/app/pages/repository/aggregationhistory/compatibility-monitor-repo.component.ts +++ b/src/app/pages/repository/aggregationhistory/compatibility-monitor-repo.component.ts @@ -29,7 +29,7 @@ export class CompatibilityMonitorRepoComponent implements OnInit { if(this.sharedService.getRepository()) { this.repo = this.sharedService.getRepository(); - this.repoName = this.repo.officialName; + this.repoName = this.repo.officialname; this.getLatestAggregationHistory(); } @@ -37,7 +37,7 @@ export class CompatibilityMonitorRepoComponent implements OnInit { r => { this.repo = r; if (this.repo) { - this.repoName = this.repo.officialName; + this.repoName = this.repo.officialname; this.getLatestAggregationHistory(); } } diff --git a/src/app/pages/repository/dashboard/dashboard.component.html b/src/app/pages/repository/dashboard/dashboard.component.html index 02da9165a..30abbcab6 100755 --- a/src/app/pages/repository/dashboard/dashboard.component.html +++ b/src/app/pages/repository/dashboard/dashboard.component.html @@ -373,7 +373,7 @@
No notifications were found
-
+
diff --git a/src/app/pages/repository/metrics/metrics-usagestats.component.ts b/src/app/pages/repository/metrics/metrics-usagestats.component.ts index 9ae1d8595..c9bc243e7 100755 --- a/src/app/pages/repository/metrics/metrics-usagestats.component.ts +++ b/src/app/pages/repository/metrics/metrics-usagestats.component.ts @@ -27,13 +27,13 @@ export class MetricsUsagestatsComponent implements OnInit { if(this.sharedService.getRepository()) { this.repo = this.sharedService.getRepository(); - this.title = this.title + ' for ' + this.repo.officialName; + this.title = this.title + ' for ' + this.repo.officialname; } this.sharedService.repository$.subscribe( r => { this.repo = r; - this.title = this.title + ' for ' + this.repo.officialName; + this.title = this.title + ' for ' + this.repo.officialname; } ); diff --git a/src/app/pages/repository/repository.component.html b/src/app/pages/repository/repository.component.html index 20cd8d17b..97b8ab5e4 100644 --- a/src/app/pages/repository/repository.component.html +++ b/src/app/pages/repository/repository.component.html @@ -15,9 +15,9 @@

- - - {{ repository.officialName }} + + + {{ repository.officialname }}

diff --git a/src/app/pages/repository/update/sources-update-repo.component.ts b/src/app/pages/repository/update/sources-update-repo.component.ts index c1d09ff90..0a01af3df 100755 --- a/src/app/pages/repository/update/sources-update-repo.component.ts +++ b/src/app/pages/repository/update/sources-update-repo.component.ts @@ -61,7 +61,7 @@ export class SourcesUpdateRepoComponent implements OnInit { } else if (this.repo.id.includes('aggregator')) { this.mode = 'aggregator'; } - this.logoURL = this.repo.logoUrl; + this.logoURL = this.repo.logourl; this.getRepoInterfaces(); } @@ -69,7 +69,7 @@ export class SourcesUpdateRepoComponent implements OnInit { r => { this.repo = r; if (this.repo) { - this.logoURL = this.repo.logoUrl; + this.logoURL = this.repo.logourl; this.getRepoInterfaces(); } } @@ -145,9 +145,9 @@ export class SourcesUpdateRepoComponent implements OnInit { false, i, { id: this.repo.id, - datasourceType: this.repo.datasourceType, + datasourceType: this.repo.eoscDatasourceType, datasourceClass: this.repo.eoscDatasourceType, - registeredBy: this.repo.registeredBy + registeredBy: this.repo.registeredby }, this.repoInterfaces[i] ]); @@ -157,9 +157,9 @@ export class SourcesUpdateRepoComponent implements OnInit { false, 0, { id: this.repo.id, - datasourceType: this.repo.datasourceType, + datasourceType: this.repo.eoscDatasourceType, datasourceClass: this.repo.eoscDatasourceType, - registeredBy: this.repo.registeredBy + registeredBy: this.repo.registeredby } ]); } @@ -168,8 +168,8 @@ export class SourcesUpdateRepoComponent implements OnInit { addInterfaceToList(intrf?: RepositoryInterface) { const curIndex = this.dataForInterfaceComp.length; const curRepoInfo = { - id: this.repo.id, datasourceType: this.repo.datasourceType, - datasourceClass: this.repo.eoscDatasourceType, registeredBy: this.repo.registeredBy + id: this.repo.id, datasourceType: this.repo.eoscDatasourceType, + datasourceClass: this.repo.eoscDatasourceType, registeredBy: this.repo.registeredby }; if (intrf) { this.dataForInterfaceComp.push([false, curIndex, curRepoInfo, intrf]); @@ -204,7 +204,7 @@ export class SourcesUpdateRepoComponent implements OnInit { } updatedLogoUrl(event: any) { - this.repo.logoUrl = this.logoURL; + this.repo.logourl = this.logoURL; this.datasourceUpdateForm.updateGroup.get('logoUrl').setValue(this.logoURL); this.datasourceUpdateForm.updateRepo(); diff --git a/src/app/pages/sources/sources-register/register-existing-datasource.component.ts b/src/app/pages/sources/sources-register/register-existing-datasource.component.ts index 88bd22c9d..34811c8bd 100644 --- a/src/app/pages/sources/sources-register/register-existing-datasource.component.ts +++ b/src/app/pages/sources/sources-register/register-existing-datasource.component.ts @@ -165,8 +165,8 @@ export class RegisterExistingDatasourceComponent implements OnInit { addInterfaceToList(intrf?: RepositoryInterface) { const curIndex = this.dataForInterfaceComp.length; - const curRepoInfo = { id: this.repo.id, datasourceType: this.repo.datasourceType, - datasourceClass: this.repo.eoscDatasourceType, registeredBy: this.repo.registeredBy }; + const curRepoInfo = { id: this.repo.id, datasourceType: this.repo.eoscDatasourceType, + datasourceClass: this.repo.eoscDatasourceType, registeredBy: this.repo.registeredby }; if (intrf) { this.dataForInterfaceComp.push([true, curIndex, curRepoInfo, intrf]); } else { @@ -221,9 +221,9 @@ export class RegisterExistingDatasourceComponent implements OnInit { this.dataForInterfaceComp.push([ true, i, { id: this.repo.id, - datasourceType: this.repo.datasourceType, + datasourceType: this.repo.eoscDatasourceType, datasourceClass: this.repo.eoscDatasourceType, - registeredBy: this.repo.registeredBy + registeredBy: this.repo.registeredby }, this.repoInterfaces[i] ]); @@ -232,9 +232,9 @@ export class RegisterExistingDatasourceComponent implements OnInit { this.dataForInterfaceComp.push([ true, 0, { id: this.repo.id, - datasourceType: this.repo.datasourceType, + datasourceType: this.repo.eoscDatasourceType, datasourceClass: this.repo.eoscDatasourceType, - registeredBy: this.repo.registeredBy + registeredBy: this.repo.registeredby } ]); } @@ -328,9 +328,9 @@ export class RegisterExistingDatasourceComponent implements OnInit { this.loadingMessage = 'Saving changes'; this.errorMessage = ''; console.log('reg this.repo', this.repo); - this.repoService.addRepository( this.repo.datasourceType, this.repo).subscribe( //this.repo.collectedFrom + this.repoService.addRepository( this.repo.eoscDatasourceType, this.repo).subscribe( //this.repo.collectedfrom response => { - console.log(`addRepository responded: ${response.id}, ${response.registeredBy}`); + console.log(`addRepository responded: ${response.id}, ${response.registeredby}`); this.repo = response; }, error => { @@ -353,15 +353,15 @@ export class RegisterExistingDatasourceComponent implements OnInit { if (intrf.id) { let req; if (this.interfacesToDelete.some(id => id === intrf.id)) { - req = this.repoService.deleteInterface(intrf.id, this.repo.registeredBy); + req = this.repoService.deleteInterface(intrf.id, this.repo.registeredby); } else { // console.log('comments', intrf.comments); - req = this.repoService.updateInterface(this.repo.id, this.repo.registeredBy, intrf.comments, intrf); + req = this.repoService.updateInterface(this.repo.id, this.repo.registeredby, intrf.comments, intrf); } return req; } else { // console.log('comments', intrf.comments); - return this.repoService.addInterface(this.repo.datasourceType, this.repo.id, this.repo.registeredBy, intrf.comments, intrf); + return this.repoService.addInterface(this.repo.eoscDatasourceType, this.repo.id, this.repo.registeredby, intrf.comments, intrf); } }) ).subscribe( diff --git a/src/app/pages/sources/sources-register/register-new-datasource.component.ts b/src/app/pages/sources/sources-register/register-new-datasource.component.ts index 163cc55b9..c96f8fd15 100644 --- a/src/app/pages/sources/sources-register/register-new-datasource.component.ts +++ b/src/app/pages/sources/sources-register/register-new-datasource.component.ts @@ -137,8 +137,8 @@ export class RegisterNewDatasourceComponent implements OnInit { addInterfaceToList(intrf?: RepositoryInterface) { const curIndex = this.dataForInterfaceComp.length; - const curRepoInfo = { id: this.repo.id, datasourceType: this.repo.datasourceType, - datasourceClass: this.repo.eoscDatasourceType, registeredBy: this.repo.registeredBy }; + const curRepoInfo = { id: this.repo.id, datasourceType: this.repo.eoscDatasourceType, + datasourceClass: this.repo.eoscDatasourceType, registeredBy: this.repo.registeredby }; if (intrf) { this.dataForInterfaceComp.push([true, curIndex, curRepoInfo, intrf]); } else { @@ -180,9 +180,9 @@ export class RegisterNewDatasourceComponent implements OnInit { this.dataForInterfaceComp.push([ true, i, { id: this.repo.id, - datasourceType: this.repo.datasourceType, + datasourceType: this.repo.eoscDatasourceType, datasourceClass: this.repo.eoscDatasourceType, - registeredBy: this.repo.registeredBy + registeredBy: this.repo.registeredby }, this.repoInterfaces[i] ]); @@ -191,9 +191,9 @@ export class RegisterNewDatasourceComponent implements OnInit { this.dataForInterfaceComp.push([ true, 0, { id: this.repo.id, - datasourceType: this.repo.datasourceType, + datasourceType: this.repo.eoscDatasourceType, datasourceClass: this.repo.eoscDatasourceType, - registeredBy: this.repo.registeredBy + registeredBy: this.repo.registeredby } ]); } @@ -223,9 +223,9 @@ export class RegisterNewDatasourceComponent implements OnInit { this.loadingMessage = 'Saving changes'; this.errorMessage = ''; console.log('add this.repo', this.repo); - this.repoService.addRepository(this.repo.datasourceType, this.repo).subscribe( + this.repoService.addRepository(this.repo.eoscDatasourceType, this.repo).subscribe( response => { - console.log(`addRepository responded: ${response.id}, ${response.registeredBy}`); + console.log(`addRepository responded: ${response.id}, ${response.registeredby}`); this.repo = response; }, error => { @@ -246,10 +246,10 @@ export class RegisterNewDatasourceComponent implements OnInit { concatMap(intrf => { if (intrf.id) { // console.log('comments', intrf.comments); - return this.repoService.updateInterface(this.repo.id, this.repo.registeredBy, intrf.comments, intrf); + return this.repoService.updateInterface(this.repo.id, this.repo.registeredby, intrf.comments, intrf); } else { // console.log('comments', intrf.comments); - return this.repoService.addInterface(this.repo.datasourceType, this.repo.id, this.repo.registeredBy, intrf.comments, intrf); + return this.repoService.addInterface(this.repo.eoscDatasourceType, this.repo.id, this.repo.registeredby, intrf.comments, intrf); } }) ).subscribe( diff --git a/src/app/services/repository.service.ts b/src/app/services/repository.service.ts index d3a52c4e8..99b1a031b 100755 --- a/src/app/services/repository.service.ts +++ b/src/app/services/repository.service.ts @@ -47,6 +47,7 @@ export class RepositoryService { updateInterface(repoId: string, registeredBy: string, comment: string, interfaceInfo: RepositoryInterface): Observable { let url; + console.log(comment); if (comment == null || comment === '') { url = `${this.apiUrl}updateRepositoryInterface?repoId=${repoId}®isteredBy=${registeredBy}`; } else { @@ -161,7 +162,7 @@ export class RepositoryService { return this.httpClient.get>(url, headerOptions); } - getDatasourceClasses(mode: string): Observable> { + getDatasourceClasses(mode: string): Observable { const url = `${this.apiUrl}getDatasourceClasses/${mode}`; console.log(`knocking on: ${url}`); return this.httpClient.get>(url, headerOptions); diff --git a/src/app/shared/reusablecomponents/sources-forms/datasource-create-form.component.html b/src/app/shared/reusablecomponents/sources-forms/datasource-create-form.component.html index 58a349e78..c7aa08463 100755 --- a/src/app/shared/reusablecomponents/sources-forms/datasource-create-form.component.html +++ b/src/app/shared/reusablecomponents/sources-forms/datasource-create-form.component.html @@ -57,7 +57,7 @@ Issn needs to be of the form: "1111-1111" or "1111-111X" + style="margin-top: 0px; margin-bottom: 0px; padding-left: 10px;">Issn needs to be of the form: "1111-1111" or "1111-111X" or "11111111" or "1111111X" @@ -71,7 +71,7 @@ Eissn needs to be of the form: "1111-1111" or "1111-111X" + style="margin-top: 0px; margin-bottom: 0px; padding-left: 10px;">Eissn needs to be of the form: "1111-1111" or "1111-111X" or "11111111" or "1111111X" @@ -85,7 +85,7 @@ Lissn needs to be of the form: "1111-1111" or "1111-111X" + style="margin-top: 0px; margin-bottom: 0px; padding-left: 10px;">Lissn needs to be of the form: "1111-1111" or "1111-111X" or "11111111" or "1111111X" @@ -277,7 +277,7 @@ diff --git a/src/app/shared/reusablecomponents/sources-forms/datasource-create-form.component.ts b/src/app/shared/reusablecomponents/sources-forms/datasource-create-form.component.ts index ceaae32f5..c8e212411 100755 --- a/src/app/shared/reusablecomponents/sources-forms/datasource-create-form.component.ts +++ b/src/app/shared/reusablecomponents/sources-forms/datasource-create-form.component.ts @@ -41,6 +41,7 @@ export class DatasourceCreateFormComponent implements OnInit { countries: Country[] = []; datasourceClasses: Map = new Map(); classCodes: string[] = []; + // classCodes: string[] = []; @Input() mode: string; @@ -57,9 +58,9 @@ export class DatasourceCreateFormComponent implements OnInit { softwarePlatform : ['', Validators.required], platformName : '', officialName : ['', Validators.required], - issn : ['', [Validators.pattern('^\\d{4}-\\d{3}[\\dxX]$')] ], - eissn : ['', Validators.pattern('^\\d{4}-\\d{3}[\\dxX]$') ], - lissn : ['', Validators.pattern('^\\d{4}-\\d{3}[\\dxX]$') ], + issn : ['', [Validators.pattern('^(\\d{4}-\\d{3}[\\dxX])|([0-9]{7}[\\dxX]$)')] ], + eissn : ['', Validators.pattern('^(\\d{4}-\\d{3}[\\dxX])|([0-9]{7}[\\dxX]$)') ], + lissn : ['', Validators.pattern('^(\\d{4}-\\d{3}[\\dxX])|([0-9]{7}[\\dxX]$)') ], repoDescription : ['', Validators.required], country : ['', Validators.required], longtitude : ['', [Validators.required, Validators.min(-180), Validators.max(180)] ], @@ -110,7 +111,7 @@ export class DatasourceCreateFormComponent implements OnInit { this.group = this.fb.group(this.groupDefinition); if (this.mode === 'journal') { this.group.get('issn').clearValidators(); - this.group.get('issn').setValidators([Validators.required, Validators.pattern('^\\d{4}-\\d{3}[\\dxX]$')]); + this.group.get('issn').setValidators([Validators.required, Validators.pattern('^(\\d{4}-\\d{3}[\\dxX])|([0-9]{7}[\\dxX]$)')]); } this.getTypologies(); this.getTimezones(); @@ -124,12 +125,12 @@ export class DatasourceCreateFormComponent implements OnInit { setupForm() { if (this.selectedRepo) { - console.log(`my datasource type is: ${this.selectedRepo.datasourceType}`); + console.log(`my datasource type is: ${this?.selectedRepo?.eoscDatasourceType}`); this.group.setValue({ - softwarePlatform: this.selectedRepo.typology, + softwarePlatform: this.selectedRepo.platform, platformName: '', - officialName: this.selectedRepo.officialName, + officialName: this.selectedRepo.officialname, issn: '', eissn: '', lissn: '', @@ -137,16 +138,16 @@ export class DatasourceCreateFormComponent implements OnInit { country: this.selectedRepo.organizations[0].country, // countryCode longtitude: this.selectedRepo.longitude, latitude: this.selectedRepo.latitude, - websiteUrl: this.selectedRepo.websiteUrl, + websiteUrl: this.selectedRepo.websiteurl, institutionName: this.selectedRepo.organizations[0].legalname, - englishName: this.selectedRepo.englishName, - logoUrl: this.selectedRepo.logoUrl, + englishName: this.selectedRepo.englishname, + logoUrl: this.selectedRepo.logourl, timezone: this.selectedRepo.timezone, - datasourceType: this.selectedRepo.eoscDatasourceType, - adminEmail: this.selectedRepo.contactEmail + datasourceType: this.selectedRepo.eoscDatasourceType, // TODO: still needed? + adminEmail: this.selectedRepo.contactemail }); - if (this.selectedRepo.datasourceType === 'journal') { + if (this.selectedRepo.eoscDatasourceType === 'Journal archive') { let ssnToShow = this.selectedRepo.issn.slice(0, 4) + '-' + this.selectedRepo.issn.toString().slice(4); this.group.get('issn').setValue(ssnToShow); @@ -185,15 +186,17 @@ export class DatasourceCreateFormComponent implements OnInit { getDatasourceClasses() { this.repoService.getDatasourceClasses(this.mode).subscribe( - classes => this.datasourceClasses = classes, + classes => { + for (const [key, value] of Object.entries(classes)) { + this.datasourceClasses.set(key, value); + } + }, error => { this.errorMessage = noServiceMessage; console.log(error); }, () => { - for (const key of Object.keys(this.datasourceClasses)) { - this.classCodes.push(key); - } + this.classCodes = Array.from(this.datasourceClasses.keys()); } ); } @@ -228,11 +231,11 @@ export class DatasourceCreateFormComponent implements OnInit { createNewRepository(): Repository { const newRepo = new Repository(); - newRepo.officialName = this.group.get('officialName').value.toString(); - newRepo.englishName = this.group.get('englishName').value.toString(); - newRepo.websiteUrl = this.group.get('websiteUrl').value; - newRepo.logoUrl = this.group.get('logoUrl').value; - newRepo.contactEmail = this.group.get('adminEmail').value; + newRepo.officialname = this.group.get('officialName').value.toString(); + newRepo.englishname = this.group.get('englishName').value.toString(); + newRepo.websiteurl = this.group.get('websiteUrl').value; + newRepo.logourl = this.group.get('logoUrl').value; + newRepo.contactemail = this.group.get('adminEmail').value; newRepo.organizations.push({ legalshortname: null, legalname: this.group.get('institutionName').value.toString(), @@ -243,13 +246,16 @@ export class DatasourceCreateFormComponent implements OnInit { newRepo.latitude = this.group.get('latitude').value; newRepo.longitude = this.group.get('longtitude').value; newRepo.timezone = this.group.get('timezone').value; - newRepo.eoscDatasourceType = this.group.get('datasourceType').value; - if (this.group.get('softwarePlatform').value ) { - newRepo.typology = this.group.get('softwarePlatform').value; + if (this.group.get('softwarePlatform').value !== '') { + console.log('1//', this.group.get('softwarePlatform').value); + newRepo.platform = this.group.get('softwarePlatform').value; } else if (this.group.get('platformName').value) { - newRepo.typology = this.group.get('platformName').value; + newRepo.platform = this.group.get('platformName').value; + console.log('2//', this.group.get('platformName').value); } - // newRepo.typology = this.group.get('softwarePlatform').value; + newRepo.typology = this.group.get('datasourceType').value; + // newRepo.eoscDatasourceType = this.datasourceClasses.get(this.group.get('datasourceType').value); + // console.warn(newRepo.eoscDatasourceType); newRepo.description = this.group.get('repoDescription').value.toString(); newRepo.issn = ''; newRepo.eissn = ''; @@ -271,10 +277,11 @@ export class DatasourceCreateFormComponent implements OnInit { } } - newRepo.registeredBy = this.authService.getUserEmail(); + newRepo.registeredby = this.authService.getUserEmail(); /* THE BELOW FIELDS ARE NOT SET IN GWT CODE*/ - newRepo.datasourceType = this.mode; + newRepo.eoscDatasourceType = this.mode; // TODO: delete this? + console.warn(newRepo.eoscDatasourceType); newRepo.managed = true; const now = new Date(Date.now()); diff --git a/src/app/shared/reusablecomponents/sources-forms/datasource-update-form.component.html b/src/app/shared/reusablecomponents/sources-forms/datasource-update-form.component.html index 6df77071f..4d77e3867 100755 --- a/src/app/shared/reusablecomponents/sources-forms/datasource-update-form.component.html +++ b/src/app/shared/reusablecomponents/sources-forms/datasource-update-form.component.html @@ -12,20 +12,20 @@ Basic information -
+
The following fields are completed by OpenDOAR.
If you want to edit them, you can do it by using this OpenDOAR link.
-
+
The following fields are completed by Re3data.
If you want to edit them, you can do it by using this Re3data link.
-
+
The following fields are completed by FAIRsharing.
If you want to edit them, you can do it by using this - FAIRsharing link. + FAIRsharing link.
@@ -64,14 +64,14 @@
-
+
-
+
Issn needs to be of the form: "1111-1111" or "1111-111X" + style="margin-top: 0px; margin-bottom: 0px; padding-left: 10px;">Issn needs to be of the form: "1111-1111" or "1111-111X" or "11111111" or "1111111X" @@ -85,7 +85,7 @@ Eissn needs to be of the form: "1111-1111" or "1111-111X" + style="margin-top: 0px; margin-bottom: 0px; padding-left: 10px;">Eissn needs to be of the form: "1111-1111" or "1111-111X" or "11111111" or "1111111X" @@ -99,7 +99,7 @@ Lissn needs to be of the form: "1111-1111" or "1111-111X" + style="margin-top: 0px; margin-bottom: 0px; padding-left: 10px;">Lissn needs to be of the form: "1111-1111" or "1111-111X" or "11111111" or "1111111X" @@ -222,7 +222,7 @@
@@ -249,4 +249,4 @@
- +
{{updateGroup.value|json}}
diff --git a/src/app/shared/reusablecomponents/sources-forms/datasource-update-form.component.ts b/src/app/shared/reusablecomponents/sources-forms/datasource-update-form.component.ts index c9b76eae0..dc7f997a2 100755 --- a/src/app/shared/reusablecomponents/sources-forms/datasource-update-form.component.ts +++ b/src/app/shared/reusablecomponents/sources-forms/datasource-update-form.component.ts @@ -43,9 +43,9 @@ export class DatasourceUpdateFormComponent implements OnInit { softwarePlatform : '', platformName : '', officialName : ['', Validators.required], - issn : ['', [Validators.pattern('^\\d{4}-\\d{3}[\\dxX]$')] ], - eissn : ['', Validators.pattern('^\\d{4}-\\d{3}[\\dxX]$') ], - lissn : ['', Validators.pattern('^\\d{4}-\\d{3}[\\dxX]$') ], + issn : ['', [Validators.pattern('^(\\d{4}-\\d{3}[\\dxX])|([0-9]{7}[\\dxX]$)')] ], + eissn : ['', Validators.pattern('^(\\d{4}-\\d{3}[\\dxX])|([0-9]{7}[\\dxX]$)') ], + lissn : ['', Validators.pattern('^(\\d{4}-\\d{3}[\\dxX])|([0-9]{7}[\\dxX]$)') ], repoDescription : ['', Validators.required], country : '', longtitude : '', @@ -101,11 +101,11 @@ export class DatasourceUpdateFormComponent implements OnInit { setupUpdateForm() { if (this.selectedRepo) { - +console.log(this.mode); this.updateGroup.setValue({ - softwarePlatform: this.selectedRepo.typology, + softwarePlatform: this.selectedRepo.platform, platformName: '', - officialName: this.selectedRepo.officialName, + officialName: this.selectedRepo.officialname, issn: '', eissn: '', lissn: '', @@ -113,18 +113,25 @@ export class DatasourceUpdateFormComponent implements OnInit { country: this.selectedRepo.organizations[0].country, // countryCode longtitude: this.selectedRepo.longitude, latitude: this.selectedRepo.latitude, - websiteUrl: this.selectedRepo.websiteUrl, + websiteUrl: this.selectedRepo.websiteurl, institutionName: this.selectedRepo.organizations[0].legalname, - englishName: this.selectedRepo.englishName, - logoUrl: this.selectedRepo.logoUrl, + englishName: this.selectedRepo.englishname, + logoUrl: this.selectedRepo.logourl, timezone: this.selectedRepo.timezone, - datasourceType: this.selectedRepo.eoscDatasourceType, - adminEmail: this.selectedRepo.contactEmail + datasourceType: this.selectedRepo.typology, // TODO: rename to typology? + adminEmail: this.selectedRepo.contactemail }); - if ( this.selectedRepo.typology === '' || !this.typologies.some(x => x.value === this.selectedRepo.typology) ) { + if ( this.selectedRepo.platform === '' || !this.typologies.some(x => x.value === this.selectedRepo.platform) ) { this.updateGroup.get('softwarePlatform').setValue(''); - this.updateGroup.get('platformName').setValue(this.selectedRepo.typology); + this.updateGroup.get('platformName').setValue(this.selectedRepo.platform); + } + + if (this.selectedRepo.eoscDatasourceType === 'Journal archive') { + console.log('inside journal'); + this.updateGroup.get('issn').setValue(this.selectedRepo.issn); + this.updateGroup.get('eissn').setValue(this.selectedRepo.eissn); + this.updateGroup.get('lissn').setValue(this.selectedRepo.lissn); } // FIXME: Use eoscDatasourceType when we support the new model @@ -150,7 +157,7 @@ export class DatasourceUpdateFormComponent implements OnInit { let ssnToShow = this.selectedRepo.issn.slice(0, 4) + '-' + this.selectedRepo.issn.toString().slice(4); this.updateGroup.get('issn').setValue(ssnToShow); this.updateGroup.get('issn').clearValidators(); - this.updateGroup.get('issn').setValidators([Validators.required, Validators.pattern('^\\d{4}-\\d{3}[\\dxX]$')]); + this.updateGroup.get('issn').setValidators([Validators.required, Validators.pattern('^(\\d{4}-\\d{3}[\\dxX])|([0-9]{7}[\\dxX]$)')]); if (this.selectedRepo.eissn.trim().length) { ssnToShow = this.selectedRepo.eissn.slice(0, 4) + '-' + this.selectedRepo.eissn.toString().slice(4); @@ -172,25 +179,32 @@ export class DatasourceUpdateFormComponent implements OnInit { getDatasourceClasses() { // FIXME: Use eoscDatasourceType when we support the new model - this.repoService.getDatasourceClasses(this.selectedRepo.collectedFrom.split('::')[1]).subscribe( - classes => this.datasourceClasses = classes, + console.log('mode b4 getdatasourceclasses ', this.mode); + + let param = this.selectedRepo.collectedfrom.split('::')[1]; + if (this.selectedRepo.eoscDatasourceType === 'Journal archive') { param = 'journal'; } + if (this.selectedRepo.eoscDatasourceType === 'Aggregator') { param = 'aggregator'; } + + this.repoService.getDatasourceClasses(param).subscribe( + classes => { + for (const [key, value] of Object.entries(classes)) { + this.datasourceClasses.set(key, value); + }}, error => { this.loadingMessage = ''; this.errorMessage = noServiceMessage; console.log(error); }, () => { - for (const key of Object.keys(this.datasourceClasses)) { - this.classCodes.push(key); - } + console.log('gotDatasourceClasses'); + this.classCodes = Array.from(this.datasourceClasses.keys()); this.getCountries(); } ); } getCountries() { - this.repoService.getCountries() - .subscribe( + this.repoService.getCountries().subscribe( countries => this.countries = countries.sort( function(a, b) { if (a.name < b.name) { return -1; @@ -205,6 +219,7 @@ export class DatasourceUpdateFormComponent implements OnInit { this.errorMessage = noServiceMessage; console.log(error); }, () => { + console.log('gotCountries'); this.getTypologies(); }); } @@ -217,6 +232,7 @@ export class DatasourceUpdateFormComponent implements OnInit { console.log(error); }, () => { + console.log('gotTypologies'); this.getTimezones(); } ); @@ -230,6 +246,7 @@ export class DatasourceUpdateFormComponent implements OnInit { console.log(error); }, () => { + console.log('gotTimezones'); this.loadingMessage = ''; this.setupUpdateForm(); } @@ -243,7 +260,7 @@ export class DatasourceUpdateFormComponent implements OnInit { window.scroll(1, 1); if (this.updateGroup.valid) { - if ( this.selectedRepo.datasourceType !== 'journal' || this.updateGroup.get('issn').value ) { + if ( this.selectedRepo.eoscDatasourceType !== 'journal' || this.updateGroup.get('issn').value ) { this.refreshSelectedRepo(); /* @@ -288,23 +305,28 @@ export class DatasourceUpdateFormComponent implements OnInit { refreshSelectedRepo() { if (this.updateGroup.get('softwarePlatform').value ) { - this.selectedRepo.typology = this.updateGroup.get('softwarePlatform').value; + this.selectedRepo.platform = this.updateGroup.get('softwarePlatform').value; } else if (this.updateGroup.get('platformName').value) { - this.selectedRepo.typology = this.updateGroup.get('platformName').value; + this.selectedRepo.platform = this.updateGroup.get('platformName').value; } - this.selectedRepo.officialName = this.updateGroup.get('officialName').value.toString(); + this.selectedRepo.typology = this.updateGroup.get('datasourceType').value; + console.log('typology ', this.selectedRepo.typology); + console.log(this.datasourceClasses); + console.log(this.updateGroup.get('datasourceType').value); + // this.selectedRepo.eoscDatasourceType = this.datasourceClasses.get(this.updateGroup.get('datasourceType').value); + // console.warn(this.selectedRepo.eoscDatasourceType); + this.selectedRepo.officialname = this.updateGroup.get('officialName').value.toString(); this.selectedRepo.description = this.updateGroup.get('repoDescription').value.toString(); this.selectedRepo.organizations[0].country = this.updateGroup.get('country').value; // countryCode this.selectedRepo.longitude = this.updateGroup.get('longtitude').value; this.selectedRepo.latitude = this.updateGroup.get('latitude').value; - this.selectedRepo.websiteUrl = this.updateGroup.get('websiteUrl').value; + this.selectedRepo.websiteurl = this.updateGroup.get('websiteUrl').value; this.selectedRepo.organizations[0].legalname = this.updateGroup.get('institutionName').value.toString(); - this.selectedRepo.englishName = this.updateGroup.get('englishName').value.toString(); - this.selectedRepo.logoUrl = this.updateGroup.get('logoUrl').value; + this.selectedRepo.englishname = this.updateGroup.get('englishName').value.toString(); + this.selectedRepo.logourl = this.updateGroup.get('logoUrl').value; this.selectedRepo.timezone = this.updateGroup.get('timezone').value; - this.selectedRepo.eoscDatasourceType = this.updateGroup.get('datasourceType').value; - this.selectedRepo.contactEmail = this.updateGroup.get('adminEmail').value; - if (this.selectedRepo.datasourceType === 'journal') { + this.selectedRepo.contactemail = this.updateGroup.get('adminEmail').value; + if (this.selectedRepo.eoscDatasourceType === 'journal') { let ssnParts = this.updateGroup.get('issn').value.split('-'); let correctSSN = ssnParts[0] + ssnParts[1]; this.selectedRepo.issn = correctSSN; @@ -320,7 +342,7 @@ export class DatasourceUpdateFormComponent implements OnInit { } } if (!this.showButton) { // on register - this.selectedRepo.registeredBy = this.authService.getUserEmail(); + this.selectedRepo.registeredby = this.authService.getUserEmail(); this.selectedRepo.managed = true; const now = new Date(Date.now()); this.selectedRepo.consentTermsOfUseDate = now; diff --git a/src/app/shared/sidemenu/sidemenu.component.html b/src/app/shared/sidemenu/sidemenu.component.html index 8a1baffa2..3a7f59420 100644 --- a/src/app/shared/sidemenu/sidemenu.component.html +++ b/src/app/shared/sidemenu/sidemenu.component.html @@ -113,8 +113,8 @@