1
|
import { Component, OnInit, Type } from '@angular/core';
|
2
|
import { FormBuilder, FormGroup } from '@angular/forms';
|
3
|
import { DatasourceInterfaceFormComponent } from './sources-forms/datasource-interface-form.component';
|
4
|
import { RepositoryInterface } from '../../domain/typeScriptClasses';
|
5
|
import { RepositoryService } from '../../services/repository.service';
|
6
|
import { ActivatedRoute } from '@angular/router';
|
7
|
import {
|
8
|
Description,
|
9
|
interfaceFormDesc,
|
10
|
} from '../../domain/oa-description';
|
11
|
|
12
|
|
13
|
|
14
|
@Component ({
|
15
|
selector: 'sources-update-repo',
|
16
|
templateUrl: 'sources-update-repo.component.html'
|
17
|
})
|
18
|
|
19
|
export class SourcesUpdateRepoComponent implements OnInit {
|
20
|
|
21
|
repoId = '';
|
22
|
repoInterfaces: RepositoryInterface[] = [];
|
23
|
|
24
|
group: FormGroup;
|
25
|
interfaceFormDesc: Description = interfaceFormDesc;
|
26
|
updateDatasourceInterfaces : Type<any> = DatasourceInterfaceFormComponent;
|
27
|
|
28
|
constructor (
|
29
|
private fb: FormBuilder,
|
30
|
private repoService: RepositoryService,
|
31
|
private route: ActivatedRoute )
|
32
|
{}
|
33
|
|
34
|
|
35
|
ngOnInit() {
|
36
|
this.readRepoId();
|
37
|
this.loadInterfacesTab();
|
38
|
|
39
|
}
|
40
|
|
41
|
readRepoId() {
|
42
|
this.repoId = this.route.snapshot.paramMap.get('id');
|
43
|
}
|
44
|
|
45
|
|
46
|
getRepoInterfaces() {
|
47
|
this.repoService.getRepositoryInterface(this.repoId).subscribe(
|
48
|
interfaces => { this.repoInterfaces = interfaces; console.log(this.repoInterfaces.length)},
|
49
|
error => console.log(error)
|
50
|
);
|
51
|
}
|
52
|
|
53
|
loadInterfacesTab() {
|
54
|
this.getRepoInterfaces();
|
55
|
this.group = this.fb.group({});
|
56
|
/*
|
57
|
setTimeout(() => {
|
58
|
console.log("PATCHING");
|
59
|
this.repoInterfaces.forEach(item => {
|
60
|
this.group.patchValue({
|
61
|
baseUrl : item.baseUrl,
|
62
|
selectValidationSet : item.accessSet,
|
63
|
compatibilityLevel : item.desiredCompatibilityLevel
|
64
|
});
|
65
|
});
|
66
|
},1000);
|
67
|
*/
|
68
|
}
|
69
|
|
70
|
|
71
|
}
|