This commit is contained in:
andreas.mantas 2022-08-05 09:06:29 +00:00
parent b9d7fb8732
commit 2580dc6cf8
3 changed files with 9 additions and 14 deletions

View File

@ -58,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])|([0-9]{7}[\\dxX]$)')] ], issn : ['', [Validators.pattern('^(\\d{4}-?\\d{3}[\\dxX])$')] ],
eissn : ['', Validators.pattern('^(\\d{4}-\\d{3}[\\dxX])|([0-9]{7}[\\dxX]$)') ], eissn : ['', Validators.pattern('^(\\d{4}-?\\d{3}[\\dxX])$') ],
lissn : ['', Validators.pattern('^(\\d{4}-\\d{3}[\\dxX])|([0-9]{7}[\\dxX]$)') ], lissn : ['', Validators.pattern('^(\\d{4}-?\\d{3}[\\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)] ],
@ -111,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])|([0-9]{7}[\\dxX]$)')]); this.group.get('issn').setValidators([Validators.required, Validators.pattern('^(\\d{4}-?\\d{3}[\\dxX])$')]);
} }
this.getTypologies(); this.getTypologies();
this.getTimezones(); this.getTimezones();

View File

@ -249,4 +249,3 @@
<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])|([0-9]{7}[\\dxX]$)')] ], issn : ['', [Validators.pattern('^(\\d{4}-?\\d{3}[\\dxX])$')] ],
eissn : ['', Validators.pattern('^(\\d{4}-\\d{3}[\\dxX])|([0-9]{7}[\\dxX]$)') ], eissn : ['', Validators.pattern('^(\\d{4}-?\\d{3}[\\dxX])$') ],
lissn : ['', Validators.pattern('^(\\d{4}-\\d{3}[\\dxX])|([0-9]{7}[\\dxX]$)') ], lissn : ['', Validators.pattern('^(\\d{4}-?\\d{3}[\\dxX])$') ],
repoDescription : ['', Validators.required], repoDescription : ['', Validators.required],
country : '', country : '',
longtitude : '', longtitude : '',
@ -101,7 +101,7 @@ 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.platform, softwarePlatform: this.selectedRepo.platform,
platformName: '', platformName: '',
@ -157,7 +157,7 @@ console.log(this.mode);
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])|([0-9]{7}[\\dxX]$)')]); this.updateGroup.get('issn').setValidators([Validators.required, Validators.pattern('^(\\d{4}-?\\d{3}[\\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);
@ -179,7 +179,6 @@ console.log(this.mode);
getDatasourceClasses() { getDatasourceClasses() {
// FIXME: Use eoscDatasourceType when we support the new model // FIXME: Use eoscDatasourceType when we support the new model
console.log('mode b4 getdatasourceclasses ', this.mode);
let param = this.selectedRepo.collectedfrom.split('::')[1]; let param = this.selectedRepo.collectedfrom.split('::')[1];
if (this.selectedRepo.eoscDatasourceType === 'Journal archive') { param = 'journal'; } if (this.selectedRepo.eoscDatasourceType === 'Journal archive') { param = 'journal'; }
@ -219,7 +218,6 @@ console.log(this.mode);
this.errorMessage = noServiceMessage; this.errorMessage = noServiceMessage;
console.log(error); console.log(error);
}, () => { }, () => {
console.log('gotCountries');
this.getTypologies(); this.getTypologies();
}); });
} }
@ -232,7 +230,6 @@ console.log(this.mode);
console.log(error); console.log(error);
}, },
() => { () => {
console.log('gotTypologies');
this.getTimezones(); this.getTimezones();
} }
); );
@ -246,7 +243,6 @@ console.log(this.mode);
console.log(error); console.log(error);
}, },
() => { () => {
console.log('gotTimezones');
this.loadingMessage = ''; this.loadingMessage = '';
this.setupUpdateForm(); this.setupUpdateForm();
} }