Revision 50432
Added by Myrto Koukouli about 6 years ago
datasource-interface-form.component.ts | ||
---|---|---|
1 |
import { Component } from '@angular/core'; |
|
1 |
import { Component, Injector } from '@angular/core';
|
|
2 | 2 |
import { MyGroup } from '../../../shared/reusablecomponents/forms/my-group.interface'; |
3 | 3 |
import { Validators } from '@angular/forms'; |
4 |
import { formErrorRequiredFields, formSuccessAddedInterface } from '../../../domain/shared-messages'; |
|
4 |
import { |
|
5 |
formErrorRequiredFields, formSuccessAddedInterface, |
|
6 |
invalidCustomBaseUrl |
|
7 |
} from '../../../domain/shared-messages'; |
|
8 |
import { ValidatorService } from '../../../services/validator.service'; |
|
5 | 9 |
|
6 | 10 |
@Component ({ |
7 | 11 |
selector: 'datasource-interface-form', |
... | ... | |
21 | 25 |
compatibilityLevel: ['', Validators.required], |
22 | 26 |
}; |
23 | 27 |
|
28 |
constructor(injector: Injector, private valService: ValidatorService){ |
|
29 |
super(injector); |
|
30 |
} |
|
24 | 31 |
|
25 | 32 |
ngOnInit(){ |
26 | 33 |
|
... | ... | |
62 | 69 |
|
63 | 70 |
saveInterface() { |
64 | 71 |
if(this.group.valid) { |
65 |
this.successMessage = formSuccessAddedInterface; |
|
66 |
this.errorMessage = ''; |
|
72 |
let response: boolean; |
|
73 |
this.valService.identifyRepository(this.group.get('baseUrl').value).subscribe( |
|
74 |
res => response = res, |
|
75 |
error => console.log(error) |
|
76 |
); |
|
77 |
if ( response ) { |
|
78 |
this.successMessage = formSuccessAddedInterface; |
|
79 |
this.errorMessage = ''; |
|
80 |
} else { |
|
81 |
this.errorMessage = invalidCustomBaseUrl; |
|
82 |
this.successMessage = ''; |
|
83 |
} |
|
67 | 84 |
} else { |
68 | 85 |
this.errorMessage = formErrorRequiredFields; |
69 | 86 |
this.successMessage = ''; |
Also available in: Unified diff
reorganized services