1
|
import { Component, OnInit, Type, ViewChild } from '@angular/core';
|
2
|
import { JournalInfoFormComponent } from '../sources-forms/journal-info-form.component';
|
3
|
import { FormBuilder, FormGroup } from '@angular/forms';
|
4
|
import { Description, interfaceFormDesc } from '../../../domain/oa-description';
|
5
|
import { DatasourceInterfaceFormComponent } from '../sources-forms/datasource-interface-form.component';
|
6
|
import { RepositoryService } from '../../../services/repository.service';
|
7
|
import { Repository } from '../../../domain/typeScriptClasses';
|
8
|
|
9
|
@Component ({
|
10
|
selector: 'app-sr-journal',
|
11
|
templateUrl: 'sr-journal.component.html'
|
12
|
})
|
13
|
|
14
|
export class SrJournalComponent implements OnInit {
|
15
|
showForm: boolean;
|
16
|
showInterfaces: boolean;
|
17
|
showFinish: boolean;
|
18
|
step2: string = '';
|
19
|
step3: string = '';
|
20
|
|
21
|
@ViewChild ('registerJournal')
|
22
|
registerJournal: JournalInfoFormComponent;
|
23
|
|
24
|
group: FormGroup;
|
25
|
interfaceFormDesc: Description = interfaceFormDesc;
|
26
|
addDatasourceInterfaces: Type<any> = DatasourceInterfaceFormComponent;
|
27
|
|
28
|
repo: Repository;
|
29
|
|
30
|
constructor(
|
31
|
private fb: FormBuilder) {}
|
32
|
|
33
|
ngOnInit() {
|
34
|
this.showForm = true;
|
35
|
}
|
36
|
|
37
|
moveAStep(){
|
38
|
if (this.showForm) {
|
39
|
if (this.registerJournal.registerDatasource()){
|
40
|
this.showForm = false;
|
41
|
this.showInterfaces = true;
|
42
|
this.step2 = 'active';
|
43
|
this.group = this.fb.group({});
|
44
|
}
|
45
|
} else if (this.showInterfaces) {
|
46
|
this.showInterfaces = false;
|
47
|
this.showFinish = true;
|
48
|
this.step3 = 'active';
|
49
|
}
|
50
|
}
|
51
|
|
52
|
moveBackAStep(){
|
53
|
if (this.showInterfaces) {
|
54
|
this.showForm = true;
|
55
|
this.showInterfaces = false;
|
56
|
this.step2 = '';
|
57
|
} else if (this.showFinish) {
|
58
|
this.showInterfaces = true;
|
59
|
this.showFinish = false;
|
60
|
this.step3 = '';
|
61
|
}
|
62
|
}
|
63
|
|
64
|
getCurrentRepo(repo: Repository) {
|
65
|
this.repo = repo;
|
66
|
}
|
67
|
|
68
|
}
|