Revision 59151
Added by Andreas Mantas almost 4 years ago
datasource-new-interface-form.component.ts | ||
---|---|---|
1 | 1 |
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; |
2 | 2 |
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; |
3 |
import { baseUrlDesc, compatibilityLevelDesc, customValSetDesc, Description, existingValSetDesc } from '../../../domain/oa-description'; |
|
3 |
import { baseUrlDesc, compatibilityLevelDesc, customValSetDesc, Description, existingValSetDesc, commentsDesc } from '../../../domain/oa-description';
|
|
4 | 4 |
import { InterfaceInformation, RepositoryInterface } from '../../../domain/typeScriptClasses'; |
5 | 5 |
import { ValidatorService } from '../../../services/validator.service'; |
6 | 6 |
import { RepositoryService } from '../../../services/repository.service'; |
... | ... | |
22 | 22 |
loadingMessage: string; |
23 | 23 |
successMessage: string; |
24 | 24 |
errorMessage: string; |
25 |
invalidCustomBaseUrl = invalidCustomBaseUrl; |
|
25 | 26 |
|
26 | 27 |
@Input() data: any[] = []; // expects an array containing at least 3 of the 4 below fields in this order |
27 | 28 |
inRegister: boolean; |
... | ... | |
37 | 38 |
baseUrl: ['', Validators.required], |
38 | 39 |
selectValidationSet: [''], |
39 | 40 |
customValidationSet: [''], |
40 |
compatibilityLevel: [''] |
|
41 |
compatibilityLevel: [''], |
|
42 |
comments: [''] |
|
41 | 43 |
}; |
42 | 44 |
baseUrlDesc: Description = baseUrlDesc; |
43 | 45 |
existingValSetDesc: Description = existingValSetDesc; |
44 | 46 |
customValSetDesc: Description = customValSetDesc; |
45 | 47 |
compatibilityLevelDesc: Description = compatibilityLevelDesc; |
48 |
commentsDesc: Description = commentsDesc; |
|
46 | 49 |
|
47 | 50 |
identifiedBaseUrl: boolean; |
51 |
showIdentifiedBaseUrl: boolean; |
|
48 | 52 |
valsetList: string[] = []; |
49 | 53 |
existingCompLevel: string; |
50 | 54 |
classCodes: string[] = []; |
... | ... | |
67 | 71 |
this.currentInterface = this.data[3]; |
68 | 72 |
this.repoInterfaceForm.get('baseUrl').setValue(this.currentInterface.baseUrl); |
69 | 73 |
this.repoInterfaceForm.get('compatibilityLevel').setValue(this.currentInterface.desiredCompatibilityLevel); |
74 |
this.repoInterfaceForm.get('comments').setValue(this.currentInterface.comments); |
|
70 | 75 |
} |
71 | 76 |
this.getInterfaceInfo(); |
72 | 77 |
this.getCompatibilityClasses(); |
... | ... | |
86 | 91 |
this.interfaceInfo = info; |
87 | 92 |
if (this.interfaceInfo.identified) { |
88 | 93 |
this.identifiedBaseUrl = true; |
94 |
this.showIdentifiedBaseUrl = true; |
|
89 | 95 |
} else { |
90 | 96 |
this.errorMessage = invalidCustomBaseUrl; |
97 |
this.identifiedBaseUrl = true; // pass interface without baseUrl identification |
|
98 |
this.showIdentifiedBaseUrl = false; |
|
91 | 99 |
} |
92 | 100 |
if (this.interfaceInfo.sets) { |
93 | 101 |
this.valsetList = this.interfaceInfo.sets; |
... | ... | |
97 | 105 |
error => { |
98 | 106 |
console.log(error); |
99 | 107 |
this.loadingMessage = ''; |
100 |
this.identifiedBaseUrl = false; |
|
108 |
// this.identifiedBaseUrl = false;
|
|
101 | 109 |
this.errorMessage = noServiceMessage; |
102 | 110 |
}, |
103 | 111 |
() => { |
... | ... | |
200 | 208 |
} else { |
201 | 209 |
compLvl = this.existingCompLevel; |
202 | 210 |
} |
211 |
let comment = ''; |
|
212 |
if (this.repoInterfaceForm.get('comments').value) { |
|
213 |
comment = this.repoInterfaceForm.get('comments').value; |
|
214 |
} |
|
203 | 215 |
|
204 | 216 |
if (this.currentInterface) { |
205 |
this.updateCurrent(baseUrl, valset, compLvl); |
|
217 |
this.updateCurrent(baseUrl, valset, compLvl, comment);
|
|
206 | 218 |
} else { |
207 |
this.addCurrent(baseUrl, valset, compLvl); |
|
219 |
this.addCurrent(baseUrl, valset, compLvl, comment);
|
|
208 | 220 |
} |
209 | 221 |
} else { |
210 | 222 |
this.interfaceToExport = null; |
... | ... | |
237 | 249 |
return intrf; |
238 | 250 |
} |
239 | 251 |
|
240 |
addCurrent (baseUrl: string, valset: string, compLvl: string) { |
|
252 |
addCurrent (baseUrl: string, valset: string, compLvl: string, comment: string) {
|
|
241 | 253 |
const currentInterface = new RepositoryInterface(); |
242 | 254 |
currentInterface.baseUrl = baseUrl; |
243 | 255 |
currentInterface.accessSet = valset; |
... | ... | |
245 | 257 |
currentInterface.desiredCompatibilityLevel = compLvl; |
246 | 258 |
currentInterface.compliance = compLvl; |
247 | 259 |
currentInterface.typology = this.currentRepo.datasourceClass; |
260 |
currentInterface.comments = comment; |
|
261 |
|
|
248 | 262 |
if (!this.inRegister) { |
249 | 263 |
this.addInterface(currentInterface); |
250 | 264 |
} else { |
... | ... | |
284 | 298 |
} |
285 | 299 |
|
286 | 300 |
|
287 |
updateCurrent (baseUrl: string, valset: string, compLvl: string) { |
|
301 |
updateCurrent (baseUrl: string, valset: string, compLvl: string, comment: string) {
|
|
288 | 302 |
this.currentInterface.baseUrl = baseUrl; |
289 | 303 |
this.currentInterface.accessSet = valset; |
290 | 304 |
this.currentInterface.accessParams['set'] = valset; |
291 | 305 |
this.currentInterface.desiredCompatibilityLevel = compLvl; |
292 | 306 |
this.currentInterface.compliance = compLvl; |
293 | 307 |
this.currentInterface.typology = this.currentRepo.datasourceClass; |
308 |
this.currentInterface.comments = comment; |
|
294 | 309 |
|
295 | 310 |
if (!this.inRegister) { |
296 | 311 |
this.updateInterface(); |
Also available in: Unified diff
changed interface-form error to warning, skipped baseUrl identification and added comment field