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 {
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 {

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -373,7 +373,7 @@
<div *ngIf="!brokerSummary || !brokerSummary.userSubs">No notifications were found</div>
<div *ngIf="brokerSummary && brokerSummary.userSubs">
<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">
<span>{{ sub.count | number }}</span>
<!--<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() {
const temp = this.repository.officialName.split('|');
const temp = this.repository.officialname.split('|');
let correctName = temp[0];
let repoName = temp[0];
for (let i = 1; i < temp.length; i++) {

View File

@ -74,7 +74,7 @@ export class ContentEventsOfRepoEventslistComponent implements OnInit {
if(this.sharedService.getRepository()) {
this.repoName = this.sharedService.getRepository().officialName;
this.repoName = this.sharedService.getRepository().officialname;
this.initQuery();
this.initForm();
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(
r => {
if (r) {
this.repoName = r.officialName;
this.repoName = r.officialname;
this.initQuery();
this.initForm();
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() {
if(this.sharedService.getRepository()) {
this.repoName = this.sharedService.getRepository().officialName;
this.repoName = this.sharedService.getRepository().officialname;
this.getCorrectName();
this.getTopics();
}
@ -42,7 +42,7 @@ export class ContentEventsOfRepositoryComponent implements OnInit {
this.sharedService.repository$.subscribe(
r => {
if (r) {
this.repoName = r.officialName;
this.repoName = r.officialname;
this.getCorrectName();
this.getTopics();
}

View File

@ -1,6 +1,6 @@
<div id="page_content_inner">
<!--<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 -->
<help-content #topHelperContent [position]="'top'"

View File

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

View File

@ -68,7 +68,7 @@ export class MetricsUsagestatsReportComponent implements OnInit {
if (this.repo.issn && this.repo.issn !== 'null') {
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() {

View File

@ -89,7 +89,7 @@
</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="">
<a [routerLink]="['JR1']" class="el-link uk-position-cover uk-margin-remove-adjacent"></a>
<div class="uk-card-media-top">

View File

@ -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;
}
);

View File

@ -15,9 +15,9 @@
<div class="uk-margin-medium-left uk-margin-medium-right">
<div class="uk-padding-small">
<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="{{ repository.logoUrl }}" style="margin-right: 15px; margin-top:-8px" width="60">
{{ repository.officialName }}
<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">
{{ repository.officialname }}
</h3>
</div>

View File

@ -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();

View File

@ -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(

View File

@ -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(

View File

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

View File

@ -57,7 +57,7 @@
<form-inline [description]="issnDesc" [valid]="group.get('issn').valid">
<span *ngIf="group.get('issn').invalid && group.get('issn').touched && group.get('issn').dirty"
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"
(focus)="group.get('issn').markAsUntouched()" (blur)="group.get('issn').updateValueAndValidity()">
</form-inline>
@ -71,7 +71,7 @@
<form-inline [description]="eissnDesc" [valid]="group.get('eissn').valid">
<span *ngIf="group.get('eissn').invalid && group.get('eissn').touched && group.get('eissn').dirty"
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"
(focus)="group.get('eissn').markAsUntouched()" (blur)="group.get('eissn').updateValueAndValidity()">
</form-inline>
@ -85,7 +85,7 @@
<form-inline [description]="lissnDesc" [valid]="group.get('lissn').valid">
<span *ngIf="group.get('lissn').invalid && group.get('lissn').touched && group.get('lissn').dirty"
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"
(focus)="group.get('lissn').markAsUntouched()" (blur)="group.get('lissn').updateValueAndValidity()">
</form-inline>
@ -277,7 +277,7 @@
<form-inline [description]="datasourceTypeDesc" [valid]="group.get('datasourceType').valid">
<select formControlName="datasourceType" class="md-input">
<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>
</form-inline>
</div>

View File

@ -41,6 +41,7 @@ export class DatasourceCreateFormComponent implements OnInit {
countries: Country[] = [];
datasourceClasses: Map<string, string> = new Map<string, string>();
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());

View File

@ -12,20 +12,20 @@
Basic information
</h4>
</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>
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>.
</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>
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>.
</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>
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 data-dynamic-fields="d_field_wizard" class="uk-grid" data-uk-grid-margin="" dynamic-fields-counter="0">
@ -64,14 +64,14 @@
</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 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">
<span *ngIf="updateGroup.get('issn').invalid && updateGroup.get('issn').touched && updateGroup.get('issn').dirty"
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"
(focus)="updateGroup.get('issn').markAsUntouched()" (blur)="updateGroup.get('issn').updateValueAndValidity()">
</form-inline>
@ -85,7 +85,7 @@
<form-inline [description]="eissnDesc" [valid]="updateGroup.get('eissn').valid">
<span *ngIf="updateGroup.get('eissn').invalid && updateGroup.get('eissn').touched && updateGroup.get('eissn').dirty"
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"
(focus)="updateGroup.get('eissn').markAsUntouched()" (blur)="updateGroup.get('eissn').updateValueAndValidity()">
</form-inline>
@ -99,7 +99,7 @@
<form-inline [description]="lissnDesc" [valid]="updateGroup.get('lissn').valid">
<span *ngIf="updateGroup.get('lissn').invalid && updateGroup.get('lissn').touched && updateGroup.get('lissn').dirty"
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"
(focus)="updateGroup.get('lissn').markAsUntouched()" (blur)="updateGroup.get('lissn').updateValueAndValidity()">
</form-inline>
@ -222,7 +222,7 @@
<form-inline [description]="datasourceTypeDesc" [valid]="updateGroup.get('datasourceType').valid">
<select formControlName="datasourceType" class="md-input">
<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>
</form-inline>
</div>
@ -249,4 +249,4 @@
<button class="uk-button uk-button-primary updateRepoInfoButton" type="button" (click)="updateRepo()">Update Information</button>
</div>
</form>
<pre>{{updateGroup.value|json}}</pre>

View File

@ -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;

View File

@ -113,8 +113,8 @@
</a>
<ul [ngClass]="{'uk-display-block': visibleAdminRepo}">
<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}}</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>
</li>
</ul>
</li>