refactor. fix getDatasourceClasses and corresponding dropdown. fix issn fields

This commit is contained in:
andreas.mantas 2022-08-04 14:15:48 +00:00
parent 00079f9dde
commit 2a7836578d
22 changed files with 159 additions and 137 deletions

View File

@ -118,21 +118,13 @@ export class DatasourceDetails {
export class Repository extends DatasourceDetails implements IsSerializable { export class Repository extends DatasourceDetails implements IsSerializable {
timezone: number; timezone: number;
datasourceType: string;
interfaces: RepositoryInterface[]; interfaces: RepositoryInterface[];
piwikInfo: PiwikInfo; piwikInfo: PiwikInfo;
environments: string[]; environments: string[];
namespacePrefix: string; namespacePrefix: string;
officialName: string;
registeredBy: string;
englishName: string;
collectedFrom: string;
dateOfValidation: Date; dateOfValidation: Date;
dateOfCollection: Date; dateOfCollection: Date;
dataCollectionTypes: DataCollectionType[]; dataCollectionTypes: DataCollectionType[];
websiteUrl: string;
logoUrl: string;
contactEmail: string;
} }
export class RepositorySnippet { export class RepositorySnippet {

View File

@ -30,7 +30,7 @@ export class CompatibilityMonitorFullHistoryRepoComponent implements OnInit {
if(this.sharedService.getRepository()) { if(this.sharedService.getRepository()) {
this.repo = this.sharedService.getRepository(); this.repo = this.sharedService.getRepository();
this.repoName = this.repo.officialName; this.repoName = this.repo.officialname;
this.getAllAggregationHistory(); this.getAllAggregationHistory();
} }
@ -38,7 +38,7 @@ export class CompatibilityMonitorFullHistoryRepoComponent implements OnInit {
r => { r => {
this.repo = r; this.repo = r;
if (this.repo) { if (this.repo) {
this.repoName = this.repo.officialName; this.repoName = this.repo.officialname;
this.getAllAggregationHistory(); this.getAllAggregationHistory();
} }
} }

View File

@ -29,7 +29,7 @@ export class CompatibilityMonitorRepoComponent implements OnInit {
if(this.sharedService.getRepository()) { if(this.sharedService.getRepository()) {
this.repo = this.sharedService.getRepository(); this.repo = this.sharedService.getRepository();
this.repoName = this.repo.officialName; this.repoName = this.repo.officialname;
this.getLatestAggregationHistory(); this.getLatestAggregationHistory();
} }
@ -37,7 +37,7 @@ export class CompatibilityMonitorRepoComponent implements OnInit {
r => { r => {
this.repo = r; this.repo = r;
if (this.repo) { if (this.repo) {
this.repoName = this.repo.officialName; this.repoName = this.repo.officialname;
this.getLatestAggregationHistory(); this.getLatestAggregationHistory();
} }
} }

View File

@ -373,7 +373,7 @@
<div *ngIf="!brokerSummary || !brokerSummary.userSubs">No notifications were found</div> <div *ngIf="!brokerSummary || !brokerSummary.userSubs">No notifications were found</div>
<div *ngIf="brokerSummary && brokerSummary.userSubs"> <div *ngIf="brokerSummary && brokerSummary.userSubs">
<ul class="md-list md-list-addon gmap_list"> <ul class="md-list md-list-addon gmap_list">
<li *ngFor="let sub of brokerSummary.userSubs[repository.officialName]"> <li *ngFor="let sub of brokerSummary.userSubs[repository.officialname]">
<div class="md-list-addon-element"> <div class="md-list-addon-element">
<span>{{ sub.count | number }}</span> <span>{{ sub.count | number }}</span>
<!--<img class="md-user-image md-list-addon-avatar" src="assets/img/avatars/avatar_01_tn.png" alt="">--> <!--<img class="md-user-image md-list-addon-avatar" src="assets/img/avatars/avatar_01_tn.png" alt="">-->

View File

@ -283,7 +283,7 @@ export class DashboardComponent implements OnInit {
} }
getCorrectName() { getCorrectName() {
const temp = this.repository.officialName.split('|'); const temp = this.repository.officialname.split('|');
let correctName = temp[0]; let correctName = temp[0];
let repoName = temp[0]; let repoName = temp[0];
for (let i = 1; i < temp.length; i++) { for (let i = 1; i < temp.length; i++) {

View File

@ -74,7 +74,7 @@ export class ContentEventsOfRepoEventslistComponent implements OnInit {
if(this.sharedService.getRepository()) { if(this.sharedService.getRepository()) {
this.repoName = this.sharedService.getRepository().officialName; this.repoName = this.sharedService.getRepository().officialname;
this.initQuery(); this.initQuery();
this.initForm(); this.initForm();
this.currentPage = 0; /* DELETE WHEN ADVANCED SHOW EVENTS IS FIXED AND SENDS CORRECT VALUE FOR CURRENT PAGE */ this.currentPage = 0; /* DELETE WHEN ADVANCED SHOW EVENTS IS FIXED AND SENDS CORRECT VALUE FOR CURRENT PAGE */
@ -84,7 +84,7 @@ export class ContentEventsOfRepoEventslistComponent implements OnInit {
this.sharedService.repository$.subscribe( this.sharedService.repository$.subscribe(
r => { r => {
if (r) { if (r) {
this.repoName = r.officialName; this.repoName = r.officialname;
this.initQuery(); this.initQuery();
this.initForm(); this.initForm();
this.currentPage = 0; /* DELETE WHEN ADVANCED SHOW EVENTS IS FIXED AND SENDS CORRECT VALUE FOR CURRENT PAGE */ this.currentPage = 0; /* DELETE WHEN ADVANCED SHOW EVENTS IS FIXED AND SENDS CORRECT VALUE FOR CURRENT PAGE */

View File

@ -34,7 +34,7 @@ export class ContentEventsOfRepositoryComponent implements OnInit {
ngOnInit() { ngOnInit() {
if(this.sharedService.getRepository()) { if(this.sharedService.getRepository()) {
this.repoName = this.sharedService.getRepository().officialName; this.repoName = this.sharedService.getRepository().officialname;
this.getCorrectName(); this.getCorrectName();
this.getTopics(); this.getTopics();
} }
@ -42,7 +42,7 @@ export class ContentEventsOfRepositoryComponent implements OnInit {
this.sharedService.repository$.subscribe( this.sharedService.repository$.subscribe(
r => { r => {
if (r) { if (r) {
this.repoName = r.officialName; this.repoName = r.officialname;
this.getCorrectName(); this.getCorrectName();
this.getTopics(); this.getTopics();
} }

View File

@ -1,6 +1,6 @@
<div id="page_content_inner"> <div id="page_content_inner">
<!--<h2 class="heading_b uk-margin-bottom">Metrics for repository....</h2>--> <!--<h2 class="heading_b uk-margin-bottom">Metrics for repository....</h2>-->
<h2 *ngIf="repo" class="heading_b uk-margin-bottom">Metrics for {{repo.officialName}}</h2> <h2 *ngIf="repo" class="heading_b uk-margin-bottom">Metrics for {{repo.officialname}}</h2>
<!-- TOP HELP CONTENT --> <!-- TOP HELP CONTENT -->
<help-content #topHelperContent [position]="'top'" <help-content #topHelperContent [position]="'top'"

View File

@ -115,7 +115,7 @@ export class MetricsEnableComponent implements OnInit {
const piwik: PiwikInfo = { const piwik: PiwikInfo = {
repositoryId: this.repo.id, repositoryId: this.repo.id,
openaireId: this.oaId, openaireId: this.oaId,
repositoryName: this.repo.officialName, repositoryName: this.repo.officialname,
country: this.getCountryName(this.repo.organizations[0].country), country: this.getCountryName(this.repo.organizations[0].country),
siteId: '', siteId: '',
authenticationToken: this.authenticationToken, authenticationToken: this.authenticationToken,
@ -127,7 +127,7 @@ export class MetricsEnableComponent implements OnInit {
comment: '' comment: ''
}; };
this.piwikService.enableMetricsForRepository(this.repo.officialName, this.repo.websiteUrl, piwik).subscribe( this.piwikService.enableMetricsForRepository(this.repo.officialname, this.repo.websiteurl, piwik).subscribe(
response => { response => {
console.log(`enableMetrics answered: ${response}`); console.log(`enableMetrics answered: ${response}`);
this.successMessage = enabledMetricsSuccess; this.successMessage = enabledMetricsSuccess;

View File

@ -68,7 +68,7 @@ export class MetricsUsagestatsReportComponent implements OnInit {
if (this.repo.issn && this.repo.issn !== 'null') { if (this.repo.issn && this.repo.issn !== 'null') {
this.shownRepoId = this.repo.issn.slice(0, 4) + '-' + this.repo.issn.toString().slice(4); this.shownRepoId = this.repo.issn.slice(0, 4) + '-' + this.repo.issn.toString().slice(4);
} }
this.title = `${this.chosen_report} report for ${this.repo.officialName}`; this.title = `${this.chosen_report} report for ${this.repo.officialname}`;
} }
getParams() { getParams() {

View File

@ -89,7 +89,7 @@
</div> </div>
</div> </div>
</div> </div>
<div *ngIf="repo.datasourceType === 'journal'" class="uk-width-1-3@m"> <div *ngIf="repo.eoscDatasourceType === 'journal'" class="uk-width-1-3@m">
<div class="uk-margin uk-text-center md-card md-card-default md-card-hover uk-scrollspy-inview uk-animation-slide-top-medium" uk-scrollspy-class="" data-id="" style=""> <div class="uk-margin uk-text-center md-card md-card-default md-card-hover uk-scrollspy-inview uk-animation-slide-top-medium" uk-scrollspy-class="" data-id="" style="">
<a [routerLink]="['JR1']" class="el-link uk-position-cover uk-margin-remove-adjacent"></a> <a [routerLink]="['JR1']" class="el-link uk-position-cover uk-margin-remove-adjacent"></a>
<div class="uk-card-media-top"> <div class="uk-card-media-top">

View File

@ -27,13 +27,13 @@ export class MetricsUsagestatsComponent implements OnInit {
if(this.sharedService.getRepository()) { if(this.sharedService.getRepository()) {
this.repo = 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( this.sharedService.repository$.subscribe(
r => { r => {
this.repo = r; this.repo = r;
this.title = this.title + ' for ' + this.repo.officialName; this.title = this.title + ' for ' + this.repo.officialname;
} }
); );

View File

@ -15,9 +15,9 @@
<div class="uk-margin-medium-left uk-margin-medium-right"> <div class="uk-margin-medium-left uk-margin-medium-right">
<div class="uk-padding-small"> <div class="uk-padding-small">
<h3 *ngIf="repository" class="heading_b"> <h3 *ngIf="repository" class="heading_b">
<img *ngIf="!repository.logoUrl" src="../../../assets/imgs/yourLogoHere.jpg" style="margin-right: 15px; margin-top:-8px" width="60"> <img *ngIf="!repository.logourl" src="../../../assets/imgs/yourLogoHere.jpg" style="margin-right: 15px; margin-top:-8px" width="60">
<img *ngIf="repository.logoUrl" src="{{ repository.logoUrl }}" style="margin-right: 15px; margin-top:-8px" width="60"> <img *ngIf="repository.logourl" src="{{ repository.logourl }}" style="margin-right: 15px; margin-top:-8px" width="60">
{{ repository.officialName }} {{ repository.officialname }}
</h3> </h3>
</div> </div>

View File

@ -61,7 +61,7 @@ export class SourcesUpdateRepoComponent implements OnInit {
} else if (this.repo.id.includes('aggregator')) { } else if (this.repo.id.includes('aggregator')) {
this.mode = 'aggregator'; this.mode = 'aggregator';
} }
this.logoURL = this.repo.logoUrl; this.logoURL = this.repo.logourl;
this.getRepoInterfaces(); this.getRepoInterfaces();
} }
@ -69,7 +69,7 @@ export class SourcesUpdateRepoComponent implements OnInit {
r => { r => {
this.repo = r; this.repo = r;
if (this.repo) { if (this.repo) {
this.logoURL = this.repo.logoUrl; this.logoURL = this.repo.logourl;
this.getRepoInterfaces(); this.getRepoInterfaces();
} }
} }
@ -145,9 +145,9 @@ export class SourcesUpdateRepoComponent implements OnInit {
false, i, false, i,
{ {
id: this.repo.id, id: this.repo.id,
datasourceType: this.repo.datasourceType, datasourceType: this.repo.eoscDatasourceType,
datasourceClass: this.repo.eoscDatasourceType, datasourceClass: this.repo.eoscDatasourceType,
registeredBy: this.repo.registeredBy registeredBy: this.repo.registeredby
}, },
this.repoInterfaces[i] this.repoInterfaces[i]
]); ]);
@ -157,9 +157,9 @@ export class SourcesUpdateRepoComponent implements OnInit {
false, 0, false, 0,
{ {
id: this.repo.id, id: this.repo.id,
datasourceType: this.repo.datasourceType, datasourceType: this.repo.eoscDatasourceType,
datasourceClass: 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) { addInterfaceToList(intrf?: RepositoryInterface) {
const curIndex = this.dataForInterfaceComp.length; const curIndex = this.dataForInterfaceComp.length;
const curRepoInfo = { const curRepoInfo = {
id: this.repo.id, datasourceType: this.repo.datasourceType, id: this.repo.id, datasourceType: this.repo.eoscDatasourceType,
datasourceClass: this.repo.eoscDatasourceType, registeredBy: this.repo.registeredBy datasourceClass: this.repo.eoscDatasourceType, registeredBy: this.repo.registeredby
}; };
if (intrf) { if (intrf) {
this.dataForInterfaceComp.push([false, curIndex, curRepoInfo, intrf]); this.dataForInterfaceComp.push([false, curIndex, curRepoInfo, intrf]);
@ -204,7 +204,7 @@ export class SourcesUpdateRepoComponent implements OnInit {
} }
updatedLogoUrl(event: any) { updatedLogoUrl(event: any) {
this.repo.logoUrl = this.logoURL; this.repo.logourl = this.logoURL;
this.datasourceUpdateForm.updateGroup.get('logoUrl').setValue(this.logoURL); this.datasourceUpdateForm.updateGroup.get('logoUrl').setValue(this.logoURL);
this.datasourceUpdateForm.updateRepo(); this.datasourceUpdateForm.updateRepo();

View File

@ -165,8 +165,8 @@ export class RegisterExistingDatasourceComponent implements OnInit {
addInterfaceToList(intrf?: RepositoryInterface) { addInterfaceToList(intrf?: RepositoryInterface) {
const curIndex = this.dataForInterfaceComp.length; const curIndex = this.dataForInterfaceComp.length;
const curRepoInfo = { id: this.repo.id, datasourceType: this.repo.datasourceType, const curRepoInfo = { id: this.repo.id, datasourceType: this.repo.eoscDatasourceType,
datasourceClass: this.repo.eoscDatasourceType, registeredBy: this.repo.registeredBy }; datasourceClass: this.repo.eoscDatasourceType, registeredBy: this.repo.registeredby };
if (intrf) { if (intrf) {
this.dataForInterfaceComp.push([true, curIndex, curRepoInfo, intrf]); this.dataForInterfaceComp.push([true, curIndex, curRepoInfo, intrf]);
} else { } else {
@ -221,9 +221,9 @@ export class RegisterExistingDatasourceComponent implements OnInit {
this.dataForInterfaceComp.push([ this.dataForInterfaceComp.push([
true, i, true, i,
{ id: this.repo.id, { id: this.repo.id,
datasourceType: this.repo.datasourceType, datasourceType: this.repo.eoscDatasourceType,
datasourceClass: this.repo.eoscDatasourceType, datasourceClass: this.repo.eoscDatasourceType,
registeredBy: this.repo.registeredBy registeredBy: this.repo.registeredby
}, },
this.repoInterfaces[i] this.repoInterfaces[i]
]); ]);
@ -232,9 +232,9 @@ export class RegisterExistingDatasourceComponent implements OnInit {
this.dataForInterfaceComp.push([ this.dataForInterfaceComp.push([
true, 0, true, 0,
{ id: this.repo.id, { id: this.repo.id,
datasourceType: this.repo.datasourceType, datasourceType: this.repo.eoscDatasourceType,
datasourceClass: 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.loadingMessage = 'Saving changes';
this.errorMessage = ''; this.errorMessage = '';
console.log('reg this.repo', this.repo); 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 => { response => {
console.log(`addRepository responded: ${response.id}, ${response.registeredBy}`); console.log(`addRepository responded: ${response.id}, ${response.registeredby}`);
this.repo = response; this.repo = response;
}, },
error => { error => {
@ -353,15 +353,15 @@ export class RegisterExistingDatasourceComponent implements OnInit {
if (intrf.id) { if (intrf.id) {
let req; let req;
if (this.interfacesToDelete.some(id => id === intrf.id)) { 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 { } else {
// console.log('comments', intrf.comments); // 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; return req;
} else { } else {
// console.log('comments', intrf.comments); // 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( ).subscribe(

View File

@ -137,8 +137,8 @@ export class RegisterNewDatasourceComponent implements OnInit {
addInterfaceToList(intrf?: RepositoryInterface) { addInterfaceToList(intrf?: RepositoryInterface) {
const curIndex = this.dataForInterfaceComp.length; const curIndex = this.dataForInterfaceComp.length;
const curRepoInfo = { id: this.repo.id, datasourceType: this.repo.datasourceType, const curRepoInfo = { id: this.repo.id, datasourceType: this.repo.eoscDatasourceType,
datasourceClass: this.repo.eoscDatasourceType, registeredBy: this.repo.registeredBy }; datasourceClass: this.repo.eoscDatasourceType, registeredBy: this.repo.registeredby };
if (intrf) { if (intrf) {
this.dataForInterfaceComp.push([true, curIndex, curRepoInfo, intrf]); this.dataForInterfaceComp.push([true, curIndex, curRepoInfo, intrf]);
} else { } else {
@ -180,9 +180,9 @@ export class RegisterNewDatasourceComponent implements OnInit {
this.dataForInterfaceComp.push([ this.dataForInterfaceComp.push([
true, i, true, i,
{ id: this.repo.id, { id: this.repo.id,
datasourceType: this.repo.datasourceType, datasourceType: this.repo.eoscDatasourceType,
datasourceClass: this.repo.eoscDatasourceType, datasourceClass: this.repo.eoscDatasourceType,
registeredBy: this.repo.registeredBy registeredBy: this.repo.registeredby
}, },
this.repoInterfaces[i] this.repoInterfaces[i]
]); ]);
@ -191,9 +191,9 @@ export class RegisterNewDatasourceComponent implements OnInit {
this.dataForInterfaceComp.push([ this.dataForInterfaceComp.push([
true, 0, true, 0,
{ id: this.repo.id, { id: this.repo.id,
datasourceType: this.repo.datasourceType, datasourceType: this.repo.eoscDatasourceType,
datasourceClass: 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.loadingMessage = 'Saving changes';
this.errorMessage = ''; this.errorMessage = '';
console.log('add this.repo', this.repo); 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 => { response => {
console.log(`addRepository responded: ${response.id}, ${response.registeredBy}`); console.log(`addRepository responded: ${response.id}, ${response.registeredby}`);
this.repo = response; this.repo = response;
}, },
error => { error => {
@ -246,10 +246,10 @@ export class RegisterNewDatasourceComponent implements OnInit {
concatMap(intrf => { concatMap(intrf => {
if (intrf.id) { if (intrf.id) {
// console.log('comments', intrf.comments); // 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 { } else {
// console.log('comments', intrf.comments); // 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( ).subscribe(

View File

@ -47,6 +47,7 @@ export class RepositoryService {
updateInterface(repoId: string, registeredBy: string, comment: string, interfaceInfo: RepositoryInterface): Observable<RepositoryInterface> { updateInterface(repoId: string, registeredBy: string, comment: string, interfaceInfo: RepositoryInterface): Observable<RepositoryInterface> {
let url; let url;
console.log(comment);
if (comment == null || comment === '') { if (comment == null || comment === '') {
url = `${this.apiUrl}updateRepositoryInterface?repoId=${repoId}&registeredBy=${registeredBy}`; url = `${this.apiUrl}updateRepositoryInterface?repoId=${repoId}&registeredBy=${registeredBy}`;
} else { } else {
@ -161,7 +162,7 @@ export class RepositoryService {
return this.httpClient.get<Map<string, string>>(url, headerOptions); return this.httpClient.get<Map<string, string>>(url, headerOptions);
} }
getDatasourceClasses(mode: string): Observable<Map<string, string>> { getDatasourceClasses(mode: string): Observable<Object> {
const url = `${this.apiUrl}getDatasourceClasses/${mode}`; const url = `${this.apiUrl}getDatasourceClasses/${mode}`;
console.log(`knocking on: ${url}`); console.log(`knocking on: ${url}`);
return this.httpClient.get<Map<string, string>>(url, headerOptions); return this.httpClient.get<Map<string, string>>(url, headerOptions);

View File

@ -57,7 +57,7 @@
<form-inline [description]="issnDesc" [valid]="group.get('issn').valid"> <form-inline [description]="issnDesc" [valid]="group.get('issn').valid">
<span *ngIf="group.get('issn').invalid && group.get('issn').touched && group.get('issn').dirty" <span *ngIf="group.get('issn').invalid && group.get('issn').touched && group.get('issn').dirty"
class="help-block inline uk-text-danger" class="help-block inline uk-text-danger"
style="margin-top: 0px; margin-bottom: 0px; padding-left: 10px;">Issn needs to be of the form: "1111-1111" or "1111-111X"</span> 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"</span>
<input formControlName="issn" class="md-input" type="text" <input formControlName="issn" class="md-input" type="text"
(focus)="group.get('issn').markAsUntouched()" (blur)="group.get('issn').updateValueAndValidity()"> (focus)="group.get('issn').markAsUntouched()" (blur)="group.get('issn').updateValueAndValidity()">
</form-inline> </form-inline>
@ -71,7 +71,7 @@
<form-inline [description]="eissnDesc" [valid]="group.get('eissn').valid"> <form-inline [description]="eissnDesc" [valid]="group.get('eissn').valid">
<span *ngIf="group.get('eissn').invalid && group.get('eissn').touched && group.get('eissn').dirty" <span *ngIf="group.get('eissn').invalid && group.get('eissn').touched && group.get('eissn').dirty"
class="help-block inline uk-text-danger" class="help-block inline uk-text-danger"
style="margin-top: 0px; margin-bottom: 0px; padding-left: 10px;">Eissn needs to be of the form: "1111-1111" or "1111-111X"</span> 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"</span>
<input formControlName="eissn" class="md-input" type="text" <input formControlName="eissn" class="md-input" type="text"
(focus)="group.get('eissn').markAsUntouched()" (blur)="group.get('eissn').updateValueAndValidity()"> (focus)="group.get('eissn').markAsUntouched()" (blur)="group.get('eissn').updateValueAndValidity()">
</form-inline> </form-inline>
@ -85,7 +85,7 @@
<form-inline [description]="lissnDesc" [valid]="group.get('lissn').valid"> <form-inline [description]="lissnDesc" [valid]="group.get('lissn').valid">
<span *ngIf="group.get('lissn').invalid && group.get('lissn').touched && group.get('lissn').dirty" <span *ngIf="group.get('lissn').invalid && group.get('lissn').touched && group.get('lissn').dirty"
class="help-block inline uk-text-danger" class="help-block inline uk-text-danger"
style="margin-top: 0px; margin-bottom: 0px; padding-left: 10px;">Lissn needs to be of the form: "1111-1111" or "1111-111X"</span> 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"</span>
<input formControlName="lissn" class="md-input" type="text" <input formControlName="lissn" class="md-input" type="text"
(focus)="group.get('lissn').markAsUntouched()" (blur)="group.get('lissn').updateValueAndValidity()"> (focus)="group.get('lissn').markAsUntouched()" (blur)="group.get('lissn').updateValueAndValidity()">
</form-inline> </form-inline>
@ -277,7 +277,7 @@
<form-inline [description]="datasourceTypeDesc" [valid]="group.get('datasourceType').valid"> <form-inline [description]="datasourceTypeDesc" [valid]="group.get('datasourceType').valid">
<select formControlName="datasourceType" class="md-input"> <select formControlName="datasourceType" class="md-input">
<option value="">-- none selected --</option> <option value="">-- none selected --</option>
<option *ngFor="let key of classCodes" value="{{key}}">{{ datasourceClasses[key] }}</option> <option *ngFor="let key of classCodes" value="{{key}}">{{ datasourceClasses.get(key) }}</option>
</select> </select>
</form-inline> </form-inline>
</div> </div>

View File

@ -41,6 +41,7 @@ export class DatasourceCreateFormComponent implements OnInit {
countries: Country[] = []; countries: Country[] = [];
datasourceClasses: Map<string, string> = new Map<string, string>(); datasourceClasses: Map<string, string> = new Map<string, string>();
classCodes: string[] = []; classCodes: string[] = [];
// classCodes: string[] = [];
@Input() mode: string; @Input() mode: string;
@ -57,9 +58,9 @@ export class DatasourceCreateFormComponent implements OnInit {
softwarePlatform : ['', Validators.required], softwarePlatform : ['', Validators.required],
platformName : '', platformName : '',
officialName : ['', Validators.required], officialName : ['', Validators.required],
issn : ['', [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]$') ], eissn : ['', Validators.pattern('^(\\d{4}-\\d{3}[\\dxX])|([0-9]{7}[\\dxX]$)') ],
lissn : ['', Validators.pattern('^\\d{4}-\\d{3}[\\dxX]$') ], lissn : ['', Validators.pattern('^(\\d{4}-\\d{3}[\\dxX])|([0-9]{7}[\\dxX]$)') ],
repoDescription : ['', Validators.required], repoDescription : ['', Validators.required],
country : ['', Validators.required], country : ['', Validators.required],
longtitude : ['', [Validators.required, Validators.min(-180), Validators.max(180)] ], 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); this.group = this.fb.group(this.groupDefinition);
if (this.mode === 'journal') { if (this.mode === 'journal') {
this.group.get('issn').clearValidators(); 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.getTypologies();
this.getTimezones(); this.getTimezones();
@ -124,12 +125,12 @@ export class DatasourceCreateFormComponent implements OnInit {
setupForm() { setupForm() {
if (this.selectedRepo) { if (this.selectedRepo) {
console.log(`my datasource type is: ${this.selectedRepo.datasourceType}`); console.log(`my datasource type is: ${this?.selectedRepo?.eoscDatasourceType}`);
this.group.setValue({ this.group.setValue({
softwarePlatform: this.selectedRepo.typology, softwarePlatform: this.selectedRepo.platform,
platformName: '', platformName: '',
officialName: this.selectedRepo.officialName, officialName: this.selectedRepo.officialname,
issn: '', issn: '',
eissn: '', eissn: '',
lissn: '', lissn: '',
@ -137,16 +138,16 @@ export class DatasourceCreateFormComponent implements OnInit {
country: this.selectedRepo.organizations[0].country, // countryCode country: this.selectedRepo.organizations[0].country, // countryCode
longtitude: this.selectedRepo.longitude, longtitude: this.selectedRepo.longitude,
latitude: this.selectedRepo.latitude, latitude: this.selectedRepo.latitude,
websiteUrl: this.selectedRepo.websiteUrl, websiteUrl: this.selectedRepo.websiteurl,
institutionName: this.selectedRepo.organizations[0].legalname, institutionName: this.selectedRepo.organizations[0].legalname,
englishName: this.selectedRepo.englishName, englishName: this.selectedRepo.englishname,
logoUrl: this.selectedRepo.logoUrl, logoUrl: this.selectedRepo.logourl,
timezone: this.selectedRepo.timezone, timezone: this.selectedRepo.timezone,
datasourceType: this.selectedRepo.eoscDatasourceType, datasourceType: this.selectedRepo.eoscDatasourceType, // TODO: still needed?
adminEmail: this.selectedRepo.contactEmail 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); let ssnToShow = this.selectedRepo.issn.slice(0, 4) + '-' + this.selectedRepo.issn.toString().slice(4);
this.group.get('issn').setValue(ssnToShow); this.group.get('issn').setValue(ssnToShow);
@ -185,15 +186,17 @@ export class DatasourceCreateFormComponent implements OnInit {
getDatasourceClasses() { getDatasourceClasses() {
this.repoService.getDatasourceClasses(this.mode).subscribe( 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 => { error => {
this.errorMessage = noServiceMessage; this.errorMessage = noServiceMessage;
console.log(error); console.log(error);
}, },
() => { () => {
for (const key of Object.keys(this.datasourceClasses)) { this.classCodes = Array.from(this.datasourceClasses.keys());
this.classCodes.push(key);
}
} }
); );
} }
@ -228,11 +231,11 @@ export class DatasourceCreateFormComponent implements OnInit {
createNewRepository(): Repository { createNewRepository(): Repository {
const newRepo = new Repository(); const newRepo = new Repository();
newRepo.officialName = this.group.get('officialName').value.toString(); newRepo.officialname = this.group.get('officialName').value.toString();
newRepo.englishName = this.group.get('englishName').value.toString(); newRepo.englishname = this.group.get('englishName').value.toString();
newRepo.websiteUrl = this.group.get('websiteUrl').value; newRepo.websiteurl = this.group.get('websiteUrl').value;
newRepo.logoUrl = this.group.get('logoUrl').value; newRepo.logourl = this.group.get('logoUrl').value;
newRepo.contactEmail = this.group.get('adminEmail').value; newRepo.contactemail = this.group.get('adminEmail').value;
newRepo.organizations.push({ newRepo.organizations.push({
legalshortname: null, legalshortname: null,
legalname: this.group.get('institutionName').value.toString(), legalname: this.group.get('institutionName').value.toString(),
@ -243,13 +246,16 @@ export class DatasourceCreateFormComponent implements OnInit {
newRepo.latitude = this.group.get('latitude').value; newRepo.latitude = this.group.get('latitude').value;
newRepo.longitude = this.group.get('longtitude').value; newRepo.longitude = this.group.get('longtitude').value;
newRepo.timezone = this.group.get('timezone').value; newRepo.timezone = this.group.get('timezone').value;
newRepo.eoscDatasourceType = this.group.get('datasourceType').value; if (this.group.get('softwarePlatform').value !== '') {
if (this.group.get('softwarePlatform').value ) { console.log('1//', this.group.get('softwarePlatform').value);
newRepo.typology = this.group.get('softwarePlatform').value; newRepo.platform = this.group.get('softwarePlatform').value;
} else if (this.group.get('platformName').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.description = this.group.get('repoDescription').value.toString();
newRepo.issn = ''; newRepo.issn = '';
newRepo.eissn = ''; 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*/ /* 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; newRepo.managed = true;
const now = new Date(Date.now()); const now = new Date(Date.now());

View File

@ -12,20 +12,20 @@
Basic information Basic information
</h4> </h4>
</div> </div>
<div *ngIf="selectedRepo.collectedFrom.split('openaire____::')[1] === 'opendoar'" class="uk-alert uk-alert-info"> <div *ngIf="selectedRepo.collectedfrom.split('openaire____::')[1] === 'opendoar'" class="uk-alert uk-alert-info">
The following fields are completed by OpenDOAR.<br> The following fields are completed by OpenDOAR.<br>
If you want to edit them, you can do it by using this If you want to edit them, you can do it by using this
<a target="_blank" href="{{ 'http://v2.sherpa.ac.uk/id/repository/' + repoId }}">OpenDOAR link</a>. <a target="_blank" href="{{ 'http://v2.sherpa.ac.uk/id/repository/' + repoId }}">OpenDOAR link</a>.
</div> </div>
<div *ngIf="selectedRepo.collectedFrom.split('openaire____::')[1] === 're3data'" class="uk-alert uk-alert-info"> <div *ngIf="selectedRepo.collectedfrom.split('openaire____::')[1] === 're3data'" class="uk-alert uk-alert-info">
The following fields are completed by Re3data.<br> The following fields are completed by Re3data.<br>
If you want to edit them, you can do it by using this If you want to edit them, you can do it by using this
<a target="_blank" href="{{ 'http://service.re3data.org/repository/' + repoId }}">Re3data link</a>. <a target="_blank" href="{{ 'http://service.re3data.org/repository/' + repoId }}">Re3data link</a>.
</div> </div>
<div *ngIf="selectedRepo.collectedFrom.split('openaire____::')[1] === 'fairsharing'" class="uk-alert uk-alert-info"> <div *ngIf="selectedRepo.collectedfrom.split('openaire____::')[1] === 'fairsharing'" class="uk-alert uk-alert-info">
The following fields are completed by FAIRsharing.<br> The following fields are completed by FAIRsharing.<br>
If you want to edit them, you can do it by using this If you want to edit them, you can do it by using this
<a target="_blank" href="{{ 'https://fairsharing.org/search?q=' + selectedRepo.officialName }}">FAIRsharing link</a>. <a target="_blank" href="{{ 'https://fairsharing.org/search?q=' + selectedRepo.officialname }}">FAIRsharing link</a>.
</div> </div>
<div data-dynamic-fields="d_field_wizard" class="uk-grid" data-uk-grid-margin="" dynamic-fields-counter="0"> <div data-dynamic-fields="d_field_wizard" class="uk-grid" data-uk-grid-margin="" dynamic-fields-counter="0">
@ -64,14 +64,14 @@
</div> </div>
</div> </div>
<div *ngIf="selectedRepo.datasourceType == 'journal'"> <div *ngIf="selectedRepo.eoscDatasourceType == 'Journal archive'">
<div data-dynamic-fields="d_field_wizard" class="uk-grid" data-uk-grid-margin="" dynamic-fields-counter="0"> <div data-dynamic-fields="d_field_wizard" class="uk-grid" data-uk-grid-margin="" dynamic-fields-counter="0">
<div class="uk-width-medium-1-1 parsley-row form_section uk-row-first"> <div class="uk-width-medium-1-1 parsley-row form_section uk-row-first">
<div class="md-input-wrapper {{ (updateGroup.get('issn') != null) ? 'md-input-filled' : '' }}"> <div class="md-input-wrapper {{ (updateGroup.get('issn') != null) ? 'md-input-filled' : '1234-5678' }}">
<form-inline [description]="issnDesc" [valid]="updateGroup.get('issn').valid"> <form-inline [description]="issnDesc" [valid]="updateGroup.get('issn').valid">
<span *ngIf="updateGroup.get('issn').invalid && updateGroup.get('issn').touched && updateGroup.get('issn').dirty" <span *ngIf="updateGroup.get('issn').invalid && updateGroup.get('issn').touched && updateGroup.get('issn').dirty"
class="help-block inline uk-text-danger" class="help-block inline uk-text-danger"
style="margin-top: 0px; margin-bottom: 0px; padding-left: 10px;">Issn needs to be of the form: "1111-1111" or "1111-111X"</span> 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"</span>
<input formControlName="issn" class="md-input" type="text" <input formControlName="issn" class="md-input" type="text"
(focus)="updateGroup.get('issn').markAsUntouched()" (blur)="updateGroup.get('issn').updateValueAndValidity()"> (focus)="updateGroup.get('issn').markAsUntouched()" (blur)="updateGroup.get('issn').updateValueAndValidity()">
</form-inline> </form-inline>
@ -85,7 +85,7 @@
<form-inline [description]="eissnDesc" [valid]="updateGroup.get('eissn').valid"> <form-inline [description]="eissnDesc" [valid]="updateGroup.get('eissn').valid">
<span *ngIf="updateGroup.get('eissn').invalid && updateGroup.get('eissn').touched && updateGroup.get('eissn').dirty" <span *ngIf="updateGroup.get('eissn').invalid && updateGroup.get('eissn').touched && updateGroup.get('eissn').dirty"
class="help-block inline uk-text-danger" class="help-block inline uk-text-danger"
style="margin-top: 0px; margin-bottom: 0px; padding-left: 10px;">Eissn needs to be of the form: "1111-1111" or "1111-111X"</span> 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"</span>
<input formControlName="eissn" class="md-input" type="text" <input formControlName="eissn" class="md-input" type="text"
(focus)="updateGroup.get('eissn').markAsUntouched()" (blur)="updateGroup.get('eissn').updateValueAndValidity()"> (focus)="updateGroup.get('eissn').markAsUntouched()" (blur)="updateGroup.get('eissn').updateValueAndValidity()">
</form-inline> </form-inline>
@ -99,7 +99,7 @@
<form-inline [description]="lissnDesc" [valid]="updateGroup.get('lissn').valid"> <form-inline [description]="lissnDesc" [valid]="updateGroup.get('lissn').valid">
<span *ngIf="updateGroup.get('lissn').invalid && updateGroup.get('lissn').touched && updateGroup.get('lissn').dirty" <span *ngIf="updateGroup.get('lissn').invalid && updateGroup.get('lissn').touched && updateGroup.get('lissn').dirty"
class="help-block inline uk-text-danger" class="help-block inline uk-text-danger"
style="margin-top: 0px; margin-bottom: 0px; padding-left: 10px;">Lissn needs to be of the form: "1111-1111" or "1111-111X"</span> 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"</span>
<input formControlName="lissn" class="md-input" type="text" <input formControlName="lissn" class="md-input" type="text"
(focus)="updateGroup.get('lissn').markAsUntouched()" (blur)="updateGroup.get('lissn').updateValueAndValidity()"> (focus)="updateGroup.get('lissn').markAsUntouched()" (blur)="updateGroup.get('lissn').updateValueAndValidity()">
</form-inline> </form-inline>
@ -222,7 +222,7 @@
<form-inline [description]="datasourceTypeDesc" [valid]="updateGroup.get('datasourceType').valid"> <form-inline [description]="datasourceTypeDesc" [valid]="updateGroup.get('datasourceType').valid">
<select formControlName="datasourceType" class="md-input"> <select formControlName="datasourceType" class="md-input">
<option value="">-- none selected --</option> <option value="">-- none selected --</option>
<option *ngFor="let key of classCodes" value="{{key}}">{{ datasourceClasses[key] }}</option> <option *ngFor="let key of classCodes" value="{{key}}">{{ datasourceClasses.get(key) }}</option>
</select> </select>
</form-inline> </form-inline>
</div> </div>
@ -249,4 +249,4 @@
<button class="uk-button uk-button-primary updateRepoInfoButton" type="button" (click)="updateRepo()">Update Information</button> <button class="uk-button uk-button-primary updateRepoInfoButton" type="button" (click)="updateRepo()">Update Information</button>
</div> </div>
</form> </form>
<pre>{{updateGroup.value|json}}</pre>

View File

@ -43,9 +43,9 @@ export class DatasourceUpdateFormComponent implements OnInit {
softwarePlatform : '', softwarePlatform : '',
platformName : '', platformName : '',
officialName : ['', Validators.required], officialName : ['', Validators.required],
issn : ['', [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]$') ], eissn : ['', Validators.pattern('^(\\d{4}-\\d{3}[\\dxX])|([0-9]{7}[\\dxX]$)') ],
lissn : ['', Validators.pattern('^\\d{4}-\\d{3}[\\dxX]$') ], lissn : ['', Validators.pattern('^(\\d{4}-\\d{3}[\\dxX])|([0-9]{7}[\\dxX]$)') ],
repoDescription : ['', Validators.required], repoDescription : ['', Validators.required],
country : '', country : '',
longtitude : '', longtitude : '',
@ -101,11 +101,11 @@ export class DatasourceUpdateFormComponent implements OnInit {
setupUpdateForm() { setupUpdateForm() {
if (this.selectedRepo) { if (this.selectedRepo) {
console.log(this.mode);
this.updateGroup.setValue({ this.updateGroup.setValue({
softwarePlatform: this.selectedRepo.typology, softwarePlatform: this.selectedRepo.platform,
platformName: '', platformName: '',
officialName: this.selectedRepo.officialName, officialName: this.selectedRepo.officialname,
issn: '', issn: '',
eissn: '', eissn: '',
lissn: '', lissn: '',
@ -113,18 +113,25 @@ export class DatasourceUpdateFormComponent implements OnInit {
country: this.selectedRepo.organizations[0].country, // countryCode country: this.selectedRepo.organizations[0].country, // countryCode
longtitude: this.selectedRepo.longitude, longtitude: this.selectedRepo.longitude,
latitude: this.selectedRepo.latitude, latitude: this.selectedRepo.latitude,
websiteUrl: this.selectedRepo.websiteUrl, websiteUrl: this.selectedRepo.websiteurl,
institutionName: this.selectedRepo.organizations[0].legalname, institutionName: this.selectedRepo.organizations[0].legalname,
englishName: this.selectedRepo.englishName, englishName: this.selectedRepo.englishname,
logoUrl: this.selectedRepo.logoUrl, logoUrl: this.selectedRepo.logourl,
timezone: this.selectedRepo.timezone, timezone: this.selectedRepo.timezone,
datasourceType: this.selectedRepo.eoscDatasourceType, datasourceType: this.selectedRepo.typology, // TODO: rename to typology?
adminEmail: this.selectedRepo.contactEmail 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('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 // 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); let ssnToShow = this.selectedRepo.issn.slice(0, 4) + '-' + this.selectedRepo.issn.toString().slice(4);
this.updateGroup.get('issn').setValue(ssnToShow); this.updateGroup.get('issn').setValue(ssnToShow);
this.updateGroup.get('issn').clearValidators(); 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) { if (this.selectedRepo.eissn.trim().length) {
ssnToShow = this.selectedRepo.eissn.slice(0, 4) + '-' + this.selectedRepo.eissn.toString().slice(4); ssnToShow = this.selectedRepo.eissn.slice(0, 4) + '-' + this.selectedRepo.eissn.toString().slice(4);
@ -172,25 +179,32 @@ export class DatasourceUpdateFormComponent implements OnInit {
getDatasourceClasses() { getDatasourceClasses() {
// FIXME: Use eoscDatasourceType when we support the new model // FIXME: Use eoscDatasourceType when we support the new model
this.repoService.getDatasourceClasses(this.selectedRepo.collectedFrom.split('::')[1]).subscribe( console.log('mode b4 getdatasourceclasses ', this.mode);
classes => this.datasourceClasses = classes,
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 => { error => {
this.loadingMessage = ''; this.loadingMessage = '';
this.errorMessage = noServiceMessage; this.errorMessage = noServiceMessage;
console.log(error); console.log(error);
}, },
() => { () => {
for (const key of Object.keys(this.datasourceClasses)) { console.log('gotDatasourceClasses');
this.classCodes.push(key); this.classCodes = Array.from(this.datasourceClasses.keys());
}
this.getCountries(); this.getCountries();
} }
); );
} }
getCountries() { getCountries() {
this.repoService.getCountries() this.repoService.getCountries().subscribe(
.subscribe(
countries => this.countries = countries.sort( function(a, b) { countries => this.countries = countries.sort( function(a, b) {
if (a.name < b.name) { if (a.name < b.name) {
return -1; return -1;
@ -205,6 +219,7 @@ export class DatasourceUpdateFormComponent implements OnInit {
this.errorMessage = noServiceMessage; this.errorMessage = noServiceMessage;
console.log(error); console.log(error);
}, () => { }, () => {
console.log('gotCountries');
this.getTypologies(); this.getTypologies();
}); });
} }
@ -217,6 +232,7 @@ export class DatasourceUpdateFormComponent implements OnInit {
console.log(error); console.log(error);
}, },
() => { () => {
console.log('gotTypologies');
this.getTimezones(); this.getTimezones();
} }
); );
@ -230,6 +246,7 @@ export class DatasourceUpdateFormComponent implements OnInit {
console.log(error); console.log(error);
}, },
() => { () => {
console.log('gotTimezones');
this.loadingMessage = ''; this.loadingMessage = '';
this.setupUpdateForm(); this.setupUpdateForm();
} }
@ -243,7 +260,7 @@ export class DatasourceUpdateFormComponent implements OnInit {
window.scroll(1, 1); window.scroll(1, 1);
if (this.updateGroup.valid) { 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(); this.refreshSelectedRepo();
/* /*
@ -288,23 +305,28 @@ export class DatasourceUpdateFormComponent implements OnInit {
refreshSelectedRepo() { refreshSelectedRepo() {
if (this.updateGroup.get('softwarePlatform').value ) { 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) { } 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.description = this.updateGroup.get('repoDescription').value.toString();
this.selectedRepo.organizations[0].country = this.updateGroup.get('country').value; // countryCode this.selectedRepo.organizations[0].country = this.updateGroup.get('country').value; // countryCode
this.selectedRepo.longitude = this.updateGroup.get('longtitude').value; this.selectedRepo.longitude = this.updateGroup.get('longtitude').value;
this.selectedRepo.latitude = this.updateGroup.get('latitude').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.organizations[0].legalname = this.updateGroup.get('institutionName').value.toString();
this.selectedRepo.englishName = this.updateGroup.get('englishName').value.toString(); this.selectedRepo.englishname = this.updateGroup.get('englishName').value.toString();
this.selectedRepo.logoUrl = this.updateGroup.get('logoUrl').value; this.selectedRepo.logourl = this.updateGroup.get('logoUrl').value;
this.selectedRepo.timezone = this.updateGroup.get('timezone').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;
this.selectedRepo.contactEmail = this.updateGroup.get('adminEmail').value; if (this.selectedRepo.eoscDatasourceType === 'journal') {
if (this.selectedRepo.datasourceType === 'journal') {
let ssnParts = this.updateGroup.get('issn').value.split('-'); let ssnParts = this.updateGroup.get('issn').value.split('-');
let correctSSN = ssnParts[0] + ssnParts[1]; let correctSSN = ssnParts[0] + ssnParts[1];
this.selectedRepo.issn = correctSSN; this.selectedRepo.issn = correctSSN;
@ -320,7 +342,7 @@ export class DatasourceUpdateFormComponent implements OnInit {
} }
} }
if (!this.showButton) { // on register if (!this.showButton) { // on register
this.selectedRepo.registeredBy = this.authService.getUserEmail(); this.selectedRepo.registeredby = this.authService.getUserEmail();
this.selectedRepo.managed = true; this.selectedRepo.managed = true;
const now = new Date(Date.now()); const now = new Date(Date.now());
this.selectedRepo.consentTermsOfUseDate = now; this.selectedRepo.consentTermsOfUseDate = now;

View File

@ -113,8 +113,8 @@
</a> </a>
<ul [ngClass]="{'uk-display-block': visibleAdminRepo}"> <ul [ngClass]="{'uk-display-block': visibleAdminRepo}">
<li class="act_item"> <li class="act_item">
<a *ngIf="adminRepository?.officialName && adminRepository.officialName.length>30" [routerLink]="['/repositoryAdmin/' + adminRepository.id]">{{adminRepository.officialName.substr(0,30)}}...</a> <a *ngIf="adminRepository?.officialname && adminRepository.officialname.length>30" [routerLink]="['/repositoryAdmin/' + adminRepository.id]">{{adminRepository.officialname.substr(0,30)}}...</a>
<a *ngIf="adminRepository?.officialName && adminRepository.officialName.length<=30" [routerLink]="['/repositoryAdmin/' + adminRepository.id]">{{adminRepository.officialName}}</a> <a *ngIf="adminRepository?.officialname && adminRepository.officialname.length<=30" [routerLink]="['/repositoryAdmin/' + adminRepository.id]">{{adminRepository.officialname}}</a>
</li> </li>
</ul> </ul>
</li> </li>