Project

General

Profile

« Previous | Next » 

Revision 51581

fixed checking if at least one interface was saved

View differences:

sr-data.component.ts
10 10
import { Description, interfaceFormDesc } from '../../../domain/oa-description';
11 11
import { FormBuilder, FormGroup } from '@angular/forms';
12 12
import { RepositoryService } from '../../../services/repository.service';
13
import { formInfoLoading, loadingRepoError } from '../../../domain/shared-messages';
13
import {formInfoLoading, loadingRepoError, noInterfacesSaved} from '../../../domain/shared-messages';
14 14
import {ActivatedRoute, Params, Router} from "@angular/router";
15
import {MyArray} from "../../../shared/reusablecomponents/forms/my-array.interface";
15 16

  
16 17
@Component ({
17 18
  selector: 'app-sr-data',
......
46 47
  @ViewChild('updateDatasource')
47 48
  public updateDatasource: DatasourceUpdateFormComponent;
48 49

  
50
  @ViewChild('interfaceFormArray')
51
  public interfaceFormArray: MyArray;
52

  
49 53
  group: FormGroup;
50 54
  interfaceFormDesc: Description = interfaceFormDesc;
51 55
  updateDatasourceInterfaces: Type<any> = DatasourceInterfaceFormComponent;
......
74 78
    } else if(this.showForm) {
75 79
        this.updateDatasource.updateRepo();
76 80
    } else if(this.showInterfaces) {
81
      if (this.interfaceFormArray.checkIfOneElementExists()) {
77 82
        this.setQueryParam('finish');
78 83
        this.showInterfaces = false;
79 84
        this.showFinish = true;
80 85
        this.step4 = 'active';
86
      } else {
87
        this.errorMessage = noInterfacesSaved;
88
      }
81 89
    }
82 90
  }
83 91

  
......
140 148
  getRepoInterfaces() {
141 149
    this.repoService.getRepositoryInterface(this.datasourceId).subscribe(
142 150
      interfaces => {
143
        this.repoInterfaces = interfaces;
144
        console.log(this.repoInterfaces.length);
151
        this.repoInterfaces = interfaces.sort( function(a, b) {
152
          if (a.id<b.id) {
153
            return -1;
154
          } else if (a.id>b.id) {
155
            return 1;
156
          } else {
157
            return 0;
158
          }
159
        });
160
        console.log(`the number of interfaces is ${this.repoInterfaces.length}`);
145 161
      },
146 162
      error => console.log(error),
147 163
      () => {

Also available in: Unified diff