Project

General

Profile

« Previous | Next » 

Revision 51581

fixed checking if at least one interface was saved

View differences:

sr-journal.component.ts
5 5
import { Repository } from '../../../domain/typeScriptClasses';
6 6
import { DatasourceCreateFormComponent } from '../sources-forms/datasource-create-form.component';
7 7
import {ActivatedRoute, Params, Router} from "@angular/router";
8
import {MyArray} from "../../../shared/reusablecomponents/forms/my-array.interface";
9
import {noInterfacesSaved} from "../../../domain/shared-messages";
8 10

  
9 11
@Component ({
10 12
  selector: 'app-sr-journal',
......
12 14
})
13 15

  
14 16
export class SrJournalComponent implements OnInit {
17
  errorMessage: string;
18

  
15 19
  showForm: boolean;
16 20
  showInterfaces: boolean;
17 21
  showFinish: boolean;
......
21 25
  @ViewChild ('registerJournal')
22 26
  registerJournal: DatasourceCreateFormComponent;
23 27

  
28
  @ViewChild('interfaceFormArray')
29
  public interfaceFormArray: MyArray;
30

  
24 31
  group: FormGroup;
25 32
  interfaceFormDesc: Description = interfaceFormDesc;
26 33
  addDatasourceInterfaces: Type<any> = DatasourceInterfaceFormComponent;
......
47 54
    if (this.showForm) {
48 55
      this.registerJournal.registerDatasource();
49 56
    } else if (this.showInterfaces) {
50
      this.setQueryParam('finish');
51
      this.showInterfaces = false;
52
      this.showFinish = true;
53
      this.step3 = 'active';
57
      if (this.interfaceFormArray.checkIfOneElementExists()) {
58
        this.setQueryParam('finish');
59
        this.showInterfaces = false;
60
        this.showFinish = true;
61
        this.step3 = 'active';
62
      } else {
63
        this.errorMessage = noInterfacesSaved;
64
      }
54 65
    }
55 66
  }
56 67

  
57 68
  moveBackAStep(){
69
    this.errorMessage = '';
58 70
    if (this.showInterfaces) {
59 71
      this.setQueryParam('basicInformation');
60 72
      this.showForm = true;

Also available in: Unified diff