added cris functionality

This commit is contained in:
John Balasis 2022-04-14 17:34:29 +00:00
parent 378abf98c0
commit 8595752167
12 changed files with 83 additions and 76 deletions

View File

@ -65,7 +65,7 @@ export class AppComponent implements OnInit {
console.log(error);
},
() => {
console.log(this.reposOfUser);
// console.log(this.reposOfUser);
this.reposOfUser.forEach(repo => {
if (!repo.consentTermsOfUse || !repo.fullTextDownload) {
this.addTerm(repo.officialname, repo.id, repo.consentTermsOfUse);

View File

@ -26,7 +26,7 @@ export const interfaceFormDesc = {
/* Desription of the Datasource Info Forms Fields */
export const softwarePlatformDesc = {
desc: 'The typology used by your repository/journal.\nIf you use a typology not found in the drop-down list,\nyou can enter a custom name in the field below.',
label: 'Software Platform (*)',
label: 'Software Platform',
mandatory: true,
recommended: false
};
@ -40,14 +40,14 @@ export const platformNameDesc = {
export const officialNameDesc = {
desc: 'Your repository\'s/journal\'s official name.',
label: 'Official Name (*)',
label: 'Official Name',
mandatory: true,
recommended: false
};
export const issnDesc = {
desc: 'Input your journal\'s issn (www.issn.org)',
label: 'ISSN (*)',
label: 'ISSN',
mandatory: true,
recommended: false
};
@ -68,49 +68,49 @@ export const lissnDesc = {
export const repoDescriptionDesc = {
desc: 'A description of your repository/journal',
label: 'Description (*)',
label: 'Description',
mandatory: true,
recommended: false
};
export const countryDesc = {
desc: 'The country where your repository/journal is located',
label: 'Country (*)',
label: 'Country',
mandatory: true,
recommended: false
};
export const longtitudeDesc = {
desc: 'The (approximate) longtitude of your repository/journal\'s location',
label: 'Longtitude (*)',
label: 'Longtitude',
mandatory: true,
recommended: false
};
export const latitudeDesc = {
desc: 'The (approximate) latitude of your repository/journal\'s location',
label: 'Latitude (*)',
label: 'Latitude',
mandatory: true,
recommended: false
};
export const websiteUrlDesc = {
desc: 'The main page of your repository/journal\'s website',
label: 'Entry URL (*)',
label: 'Entry URL',
mandatory: true,
recommended: false
};
export const institutionNameDesc = {
desc: 'The institution that your repository belongs to',
label: 'Institution (*)',
label: 'Institution',
mandatory: true,
recommended: false
};
export const englishNameDesc = {
desc: 'Your repository/journal\'s name in english',
label: 'English Name (*)',
label: 'English Name',
mandatory: true,
recommended: false
};
@ -124,35 +124,35 @@ export const logoUrlDesc = {
export const timezoneDesc = {
desc: 'The timezone of the area where your repository/ journal is located',
label: 'Timezone (*)',
label: 'Timezone',
mandatory: true,
recommended: false
};
export const datasourceTypeDesc = {
desc: 'The type of your repository',
label: 'Repository Type (*)',
label: 'Repository Type',
mandatory: true,
recommended: false
};
export const journalTypeDesc = {
desc: 'The type of your journal',
label: 'Journal Type (*)',
label: 'Journal Type',
mandatory: true,
recommended: false
};
export const aggregatorTypeDesc = {
desc: 'The type of your aggregator',
label: 'Aggregator Type (*)',
label: 'Aggregator Type',
mandatory: true,
recommended: false
};
export const adminEmailDesc = {
desc: 'The email address of the repository/journal\'s administrator',
label: 'Admin Email (*)',
label: 'Admin Email',
mandatory: true,
recommended: false
};

View File

@ -57,8 +57,7 @@
<div *ngFor="let inter of dataForInterfaceComp" class="uk-width-1-2@m uk-margin-bottom">
<div>
<div class="md-card" style="height: 100%">
<app-repository-interface-form #interfacesArray
[data]="inter"
<app-repository-interface-form #interfacesArray [data]="inter"
(emitDeleteInterface)="removeInterfaceFromList($event)">
</app-repository-interface-form>
</div>

View File

@ -11,8 +11,8 @@
</a>
. <br>
<span *ngIf="latestUpdate && (latestUpdate !== 'null')">
<b>Last Updated: </b>{{ latestUpdate }}
</span>
<b>Last Updated: </b>{{ latestUpdate }}
</span>
</div>
<div class="uk-margin-medium-top">
<div class="md-input-wrapper md-input-filled">

View File

@ -51,39 +51,41 @@ export class RegisterDatasourceSelectExistingComponent implements OnInit {
} else if (this.mode === 're3data') {
this.sourceUrl = 'https://www.re3data.org/';
this.sourceTitle = 'Re3data';
} else if (this.mode === 'cris') {
this.sourceUrl = 'https://eurocris.org';
this.sourceTitle = 'euroCris';
}
this.getLatestUpdate();
}
getCountries() {
this.repoService.getCountries()
.subscribe(
countries => {
// TODO: check again getCountries null return values
/*/!* check for null values *!/
let nullVals = countries.filter(el => el.name === null);
/!* remove null values from array *!/
for (let nullVal of nullVals) {
let i = countries.findIndex(el => el === nullVal);
/!* remove null value from array *!/
if (i !== -1) { countries.splice(i, 1); }
}*/
this.repoService.getCountries().subscribe(
countries => {
// TODO: check again getCountries null return values
/*/!* check for null values *!/
let nullVals = countries.filter(el => el.name === null);
/!* remove null values from array *!/
for (let nullVal of nullVals) {
let i = countries.findIndex(el => el === nullVal);
/!* remove null value from array *!/
if (i !== -1) { countries.splice(i, 1); }
}*/
/* sort countries array */
this.countries = countries.sort( function(a, b) {
if (a.name < b.name) {
return -1;
} else if (a.name > b.name) {
return 1;
} else {
return 0;
}
} );
},
error => {
this.alertMessage = noServiceMessage;
console.log(error);
});
/* sort countries array */
this.countries = countries.sort( function(a, b) {
if (a.name < b.name) {
return -1;
} else if (a.name > b.name) {
return 1;
} else {
return 0;
}
} );
},
error => {
this.alertMessage = noServiceMessage;
console.log(error);
});
}
getReposInCountry(i: number) {

View File

@ -74,7 +74,8 @@
#datasourcesByCountry
[mode]="currentMode"
(emitRepoId)="getRepoId($event)"
(promptNext)="goToStep2($event)"></app-select-existing-datasource>
(promptNext)="goToStep2($event)">
</app-select-existing-datasource>
</section>
<!-- second section -->
@ -83,9 +84,9 @@
class="body step-1 {{ (currentStep == 1) ? 'current' : '' }}" data-step="1" aria-hidden="true">
<datasource-update-form *ngIf="(currentStep === 1) && (repo !== null) && !loadingMessage"
#registerDatasource
[selectedRepo]="repo"
(emittedInfo)="getUpdatedRepo($event)"></datasource-update-form>
#registerDatasource [selectedRepo]="repo" [mode]="currentMode"
(emittedInfo)="getUpdatedRepo($event)">
</datasource-update-form>
</section>
<!-- third section -->
@ -99,7 +100,7 @@
<div>
<div class="md-card" style="height: 100%">
<app-repository-interface-form #interfacesArray
[data]="inter"
[data]="inter" [mode]="currentMode"
(emitDeleteInterface)="removeInterfaceFromList($event)">
</app-repository-interface-form>
</div>

View File

@ -91,7 +91,7 @@
<div>
<div class="md-card" style="height: 100%">
<app-repository-interface-form #interfacesArray
[data]="inter"
[data]="inter" [mode]=""
(emitDeleteInterface)="removeInterfaceFromList($event)">
</app-repository-interface-form>
</div>

View File

@ -9,12 +9,13 @@ import { DatasourceNewInterfaceFormComponent } from '../../../shared/reusablecom
import { from, of } from 'rxjs';
import { concatMap } from 'rxjs/operators';
import { errorsInInterfaces, formErrorRegisterRepo, noInterfacesSaved } from '../../../domain/shared-messages';
import {DatasourceUpdateTermsFormComponent} from "../../../shared/reusablecomponents/sources-forms/datasource-update-terms-form.component";
import {DatasourceUpdateTermsFormComponent} from '../../../shared/reusablecomponents/sources-forms/datasource-update-terms-form.component';
@Component({
selector: 'app-register-new-datasource',
templateUrl: './register-new-datasource.component.html'
})
export class RegisterNewDatasourceComponent implements OnInit {
loadingMessage: string;
errorMessage: string;
@ -205,7 +206,7 @@ export class RegisterNewDatasourceComponent implements OnInit {
);
}
//recheck if needed
// recheck if needed
getTerms(repo: Repository) {
console.log('this.repo', this.repo.consentTermsOfUse, this.repo.fullTextDownload);
console.log('repo', repo.consentTermsOfUse, repo.fullTextDownload);

View File

@ -13,7 +13,7 @@ export class SrCrisComponent extends RegisterExistingDatasourceComponent impleme
ngOnInit() {
this.datasourceType = 'cris';
this.currentMode = 'opendoar';
this.currentMode = 'cris';
super.ngOnInit();
}

View File

@ -122,14 +122,14 @@ export class MyGroup implements OnInit, AfterContentInit {
<div class="">
<label class="" *ngIf="description?.label !== null && description?.label !== ''"
[ngClass]="{'required' : description.mandatory==true}" title="{{ description.desc }}">
{{ description.label }}
{{ description.label + (description.mandatory ? ' (*)' : '') }}
</label>
<ng-content></ng-content>
<span class="md-input-bar"></span>
</div>
`
})
export class InlineFormWrapper implements OnChanges {
@Input() public description: Description = null;

View File

@ -26,6 +26,7 @@ export class DatasourceNewInterfaceFormComponent implements OnInit {
invalidCustomBaseUrl = invalidCustomBaseUrl;
@Input() data: any[] = []; // expects an array containing at least 3 of the 4 below fields in this order
@Input() mode: string = null;
inRegister: boolean;
interfaceID: number; // holds the interface index in the interfaces array as displayed
currentRepo: RepoFields; // a fraction of the Repository class
@ -125,7 +126,11 @@ export class DatasourceNewInterfaceFormComponent implements OnInit {
}
getCompatibilityClasses() {
this.repoService.getCompatibilityClasses(this.currentRepo.datasourceType).subscribe(
// FIXME: Use eoscDatasourceType when we support the new model
if (this.mode === null) {
this.mode = this.currentRepo.datasourceType;
}
this.repoService.getCompatibilityClasses(this.mode).subscribe(
classes => {
this.compClasses = classes;
this.classCodes = Object.keys(this.compClasses);

View File

@ -8,7 +8,7 @@ import { Description, softwarePlatformDesc, platformNameDesc, officialNameDesc,
longtitudeDesc, latitudeDesc, websiteUrlDesc, institutionNameDesc, englishNameDesc, logoUrlDesc, timezoneDesc,
datasourceTypeDesc, adminEmailDesc, lissnDesc, eissnDesc, issnDesc } from '../../../domain/oa-description';
import { AuthenticationService } from '../../../services/authentication.service';
import {SharedService} from "../../../services/shared.service";
import {SharedService} from '../../../services/shared.service';
@Component ({
selector: 'datasource-update-form',
@ -32,6 +32,8 @@ export class DatasourceUpdateFormComponent implements OnInit {
@Input() selectedRepo: Repository;
@Input() mode: string;
@Input() showButton: boolean;
repoId: string;
@ -99,7 +101,7 @@ export class DatasourceUpdateFormComponent implements OnInit {
setupUpdateForm() {
if (this.selectedRepo) {
console.log(`my datasource type is: ${this.selectedRepo.datasourceType}`);
console.log(`mode is: ${this.mode}`);
this.updateGroup.setValue({
softwarePlatform: this.selectedRepo.typology,
@ -126,25 +128,22 @@ export class DatasourceUpdateFormComponent implements OnInit {
this.updateGroup.get('platformName').setValue(this.selectedRepo.typology);
}
if ((this.selectedRepo.datasourceType === 'opendoar') ||
(this.selectedRepo.datasourceType === 're3data') ||
(this.selectedRepo.datasourceType === 'cris')) {
// FIXME: Use eoscDatasourceType when we support the new model
if ((this.mode === 'opendoar') || (this.mode === 're3data')) {
// this.updateGroup.get('officialName').disable();
this.updateGroup.get('country').disable();
// this.updateGroup.get('longtitude').disable();
// this.updateGroup.get('latitude').disable();
// this.updateGroup.get('websiteUrl').disable();
// this.updateGroup.get('institutionName').disable();
}
if (this.selectedRepo.datasourceType === 'cris') {
this.updateGroup.get('longtitude').disable();
this.updateGroup.get('latitude').disable();
// FIXME: Use eoscDatasourceType when we support the new model
if (this.mode === 'cris') {
this.longtitudeDesc.mandatory = false;
this.latitudeDesc.mandatory = false;
this.datasourceTypeDesc.label = 'CRIS scope/type';
}
if (this.selectedRepo.datasourceType === 'journal') {
// FIXME: Use eoscDatasourceType when we support the new model
if (this.mode === 'journal') {
let ssnToShow = this.selectedRepo.issn.slice(0, 4) + '-' + this.selectedRepo.issn.toString().slice(4);
this.updateGroup.get('issn').setValue(ssnToShow);
@ -166,12 +165,12 @@ export class DatasourceUpdateFormComponent implements OnInit {
this.updateGroup.get('eissn').disable();
this.updateGroup.get('lissn').disable();*/
}
/*this.getDatasourceClasses();*/
}
}
getDatasourceClasses() {
this.repoService.getDatasourceClasses(this.selectedRepo.datasourceType).subscribe(
// FIXME: Use eoscDatasourceType when we support the new model
this.repoService.getDatasourceClasses(this.mode).subscribe(
classes => this.datasourceClasses = classes,
error => {
this.loadingMessage = '';