Project

General

Profile

« Previous | Next » 

Revision 51675

removed save button from interface form in register

View differences:

modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-register/sr-data.component.html
81 81
                                     [data]="repoInterfaces"
82 82
                                     [otherData]="repo"
83 83
                                     [registerMode]="true"
84
                                     (emitDataArray)="getNewInterfaces($event)"
85
                                     (emitShowModal)="showDeleteInterfaceModal($event)">
84
                                     (emitDataArray)="getNewInterfaces($event)">
86 85
                        </form-repeat>
87 86
                      </form>
88 87
                    </div>
......
109 108
              </div>
110 109
            </div>
111 110
            <div class="wizardActions">
112
              <button *ngIf="!showRepositories" class="uk-button uk-button-grey-light" type="button" (click)="moveBackAStep()">
111
              <button *ngIf="!showRepositories && !showFinish" class="uk-button uk-button-grey-light" type="button" (click)="moveBackAStep()">
113 112
                <i class="fa fa-angle-double-left"></i>
114 113
                Back
115 114
              </button>
......
139 138

  
140 139
  </div>
141 140
</div>
142

  
143

  
144
<confirmation-dialog #confirmDelete [title]="'Delete Interface'" [isModalShown]="isModalShown"
145
                     [confirmActionButton]="'Yes, delete it'" (emitObject)="confirmedRemoval($event)">
146
  Are you sure you want to delete this interface?
147
</confirmation-dialog>
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-register/sr-journal.component.html
69 69
                                     [data]="repoInterfaces"
70 70
                                     [otherData]="repo"
71 71
                                     [registerMode]="true"
72
                                     (emitDataArray)="getNewInterfaces($event)"
73
                                     (emitShowModal)="showDeleteInterfaceModal($event)">
72
                                     (emitDataArray)="getNewInterfaces($event)">
74 73
                        </form-repeat>
75 74
                      </form>
76 75
                    </div>
......
97 96
              </div>
98 97
            </div>
99 98
            <div class="wizardActions">
100
              <button *ngIf="!showForm" class="uk-button uk-button-grey-light" type="button" (click)="moveBackAStep()">
99
              <button *ngIf="!showForm && !showFinish" class="uk-button uk-button-grey-light" type="button" (click)="moveBackAStep()">
101 100
                <i class="fa fa-angle-double-left"></i>
102 101
                Back
103 102
              </button>
......
127 126

  
128 127
  </div>
129 128
</div>
130

  
131
<confirmation-dialog #confirmDelete [title]="'Delete Interface'" [isModalShown]="isModalShown"
132
                     [confirmActionButton]="'Yes, delete it'" (emitObject)="confirmedRemoval($event)">
133
  Are you sure you want to delete this interface?
134
</confirmation-dialog>
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-register/sr-data.component.ts
62 62
  @ViewChild('interfaceFormArray')
63 63
  public interfaceFormArray: MyArray;
64 64

  
65
  @ViewChild('confirmDelete')
66
  public confirmDelete: ConfirmationDialogComponent;
67
  isModalShown: boolean = false;
68 65

  
69

  
70 66
  group: FormGroup;
71 67
  interfaceFormDesc: Description = interfaceFormDesc;
72 68
  updateDatasourceInterfaces: Type<any> = DatasourceInterfaceFormComponent;
......
158 154
    this.repo = repo;
159 155
    console.log(`repo was updated!`);
160 156
    this.group = this.fb.group({});
161
    this.getRepoInterfaces();
157
    if (this.repoInterfaces.length == 0) {
158
      this.getRepoInterfaces();
159
    } else {
160
      this.setQueryParam('interfaces');
161
      this.showForm = false;
162
      this.showInterfaces = true;
163
      this.step3 = 'active';
164
    }
162 165
  }
163 166

  
164 167
  getRepoInterfaces() {
......
185 188
    );
186 189
  }
187 190

  
188
  showDeleteInterfaceModal(event: any) {
189
    this.confirmDelete.showModal();
190
  }
191 191

  
192
  confirmedRemoval(event: any) {
193
    this.interfaceFormArray.confirmedRemove(event);
194
  }
195

  
196 192
  downloadLogo() {
197 193
    window.open("../../../assets/imgs/3_0ValidatedLogo.png","_blank", "enabledstatus=0,toolbar=0,menubar=0,location=0");
198 194
  }
......
207 203
    this.bottomHelperContent.ngOnInit();
208 204
  }
209 205

  
210

  
211 206
  updateRepository() {
212 207
    this.loadingMessage = 'Saving changes';
213 208
    this.errorMessage = '';
......
274 269

  
275 270
  getNewInterfaces (interfaces: RepositoryInterface[]) {
276 271
    this.repoInterfaces = interfaces;
272
    console.log('new interfaces is ',this.repoInterfaces);
277 273
  }
278 274

  
279 275
}
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-register/sr-journal.component.ts
52 52
  @ViewChild('interfaceFormArray')
53 53
  public interfaceFormArray: MyArray;
54 54

  
55
  @ViewChild('confirmDelete')
56
  public confirmDelete: ConfirmationDialogComponent;
57
  isModalShown: boolean = false;
58

  
59 55
  group: FormGroup;
60 56
  interfaceFormDesc: Description = interfaceFormDesc;
61 57
  addDatasourceInterfaces: Type<any> = DatasourceInterfaceFormComponent;
......
109 105
    this.group = this.fb.group({});
110 106
  }
111 107

  
112
  showDeleteInterfaceModal(event: any) {
113
    this.confirmDelete.showModal();
114
  }
115

  
116
  confirmedRemoval(event: any) {
117
    this.interfaceFormArray.confirmedRemove(event);
118
  }
119

  
120 108
  downloadLogo() {
121 109
    window.open("../../../assets/imgs/3_0ValidatedLogo.png","_blank", "enabledstatus=0,toolbar=0,menubar=0,location=0");
122 110
  }
......
197 185

  
198 186
  getNewInterfaces (interfaces: RepositoryInterface[]) {
199 187
    this.repoInterfaces = interfaces;
188
    console.log('new interfaces is ',this.repoInterfaces);
200 189
  }
201 190

  
202 191

  
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-register/sr-literature.component.html
82 82
                                     [data]="repoInterfaces"
83 83
                                     [otherData]="repo"
84 84
                                     [registerMode]="true"
85
                                     (emitDataArray)="getNewInterfaces($event)"
86
                                     (emitShowModal)="showDeleteInterfaceModal($event)">
85
                                     (emitDataArray)="getNewInterfaces($event)">
87 86
                        </form-repeat>
88 87
                      </form>
89 88
                    </div>
......
110 109
              </div>
111 110
            </div>
112 111
            <div class="wizardActions">
113
              <button *ngIf="!showRepositories" class="uk-button uk-button-grey-light" type="button" (click)="moveBackAStep()">
112
              <button *ngIf="!showRepositories && !showFinish" class="uk-button uk-button-grey-light" type="button" (click)="moveBackAStep()">
114 113
                <i class="fa fa-angle-double-left"></i>
115 114
                Back
116 115
              </button>
......
141 140
  </div>
142 141
</div>
143 142

  
144
<confirmation-dialog #confirmDelete [title]="'Delete Interface'" [isModalShown]="isModalShown"
145
                     [confirmActionButton]="'Yes, delete it'" (emitObject)="confirmedRemoval($event)">
146
  Are you sure you want to delete this interface?
147
</confirmation-dialog>
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-register/sr-aggregator.component.html
69 69
                                     [data]="repoInterfaces"
70 70
                                     [otherData]="repo"
71 71
                                     [registerMode]="true"
72
                                     (emitDataArray)="getNewInterfaces($event)"
73
                                     (emitShowModal)="showDeleteInterfaceModal($event)">
72
                                     (emitDataArray)="getNewInterfaces($event)">
74 73
                        </form-repeat>
75 74
                      </form>
76 75
                    </div>
......
97 96
              </div>
98 97
            </div>
99 98
            <div class="wizardActions">
100
              <button *ngIf="!showForm" class="uk-button uk-button-grey-light" type="button" (click)="moveBackAStep()">
99
              <button *ngIf="!showForm && !showFinish" class="uk-button uk-button-grey-light" type="button" (click)="moveBackAStep()">
101 100
                <i class="fa fa-angle-double-left"></i>
102 101
                Back
103 102
              </button>
......
127 126

  
128 127
  </div>
129 128
</div>
130

  
131
<confirmation-dialog #confirmDelete [title]="'Delete Interface'" [isModalShown]="isModalShown"
132
                     [confirmActionButton]="'Yes, delete it'" (emitObject)="confirmedRemoval($event)">
133
  Are you sure you want to delete this interface?
134
</confirmation-dialog>
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-register/sr-literature.component.ts
67 67
  @ViewChild('interfaceFormArray')
68 68
  public interfaceFormArray: MyArray;
69 69

  
70
  @ViewChild('confirmDelete')
71
  public confirmDelete: ConfirmationDialogComponent;
72
  isModalShown: boolean = false;
73 70

  
74

  
75 71
  group: FormGroup;
76 72
  interfaceFormDesc: Description = interfaceFormDesc;
77 73
  updateDatasourceInterfaces: Type<any> = DatasourceInterfaceFormComponent;
......
163 159
    this.repo = repo;
164 160
    console.log(`repo was updated!`);
165 161
    this.group = this.fb.group({});
166
    this.getRepoInterfaces();
162
    if (this.repoInterfaces.length == 0) {
163
      this.getRepoInterfaces();
164
    } else {
165
      this.setQueryParam('interfaces');
166
      this.showForm = false;
167
      this.showInterfaces = true;
168
      this.step3 = 'active';
169
    }
167 170
  }
168 171

  
169 172
  getRepoInterfaces() {
......
190 193
    );
191 194
  }
192 195

  
193
  showDeleteInterfaceModal(event: any) {
194
    this.confirmDelete.showModal();
195
  }
196 196

  
197
  confirmedRemoval(event: any) {
198
    this.interfaceFormArray.confirmedRemove(event);
199
  }
200

  
201 197
  downloadLogo() {
202 198
    window.open("../../../assets/imgs/3_0ValidatedLogo.png","_blank", "enabledstatus=0,toolbar=0,menubar=0,location=0");
203 199
  }
......
240 236
        if (intrf.id) {
241 237
          this.repoService.updateInterface(this.repo.id, intrf).subscribe(
242 238
            response => {
243
              console.log(`updateRepository responded ${JSON.stringify(response)}`);
239
              console.log(`updateInterface responded ${JSON.stringify(response)}`);
244 240
              intrf = response;
245 241
            },
246 242
            error => {
......
278 274

  
279 275
  getNewInterfaces (interfaces: RepositoryInterface[]) {
280 276
    this.repoInterfaces = interfaces;
277
    console.log('new interfaces is ',this.repoInterfaces);
281 278
  }
282 279

  
283 280
}
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-register/sr-aggregator.component.ts
52 52
  @ViewChild('interfaceFormArray')
53 53
  public interfaceFormArray: MyArray;
54 54

  
55
  @ViewChild('confirmDelete')
56
  public confirmDelete: ConfirmationDialogComponent;
57
  isModalShown: boolean = false;
58

  
59 55
  group: FormGroup;
60 56
  interfaceFormDesc: Description = interfaceFormDesc;
61 57
  addDatasourceInterfaces: Type<any> = DatasourceInterfaceFormComponent;
......
109 105
    this.group = this.fb.group({});
110 106
  }
111 107

  
112
  showDeleteInterfaceModal(event: any) {
113
    this.confirmDelete.showModal();
114
  }
115

  
116
  confirmedRemoval(event: any) {
117
    this.interfaceFormArray.confirmedRemove(event);
118
  }
119

  
120 108
  downloadLogo() {
121 109
    window.open("../../../assets/imgs/3_0ValidatedLogo.png","_blank", "enabledstatus=0,toolbar=0,menubar=0,location=0");
122 110
  }
......
197 185

  
198 186
  getNewInterfaces (interfaces: RepositoryInterface[]) {
199 187
    this.repoInterfaces = interfaces;
188
    console.log('new interfaces is ',this.repoInterfaces);
200 189
  }
201 190

  
202 191

  
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-forms/datasource-interface-form.component.ts
35 35
  currentInterface: RepositoryInterface;
36 36
  valsetList: string[] = [];
37 37

  
38
  existingCompLevel: string;
38 39
  compClasses: Map<string,string> = new Map<string,string>();
39 40
  classCodes: string[] = [];
40 41

  
......
61 62
    console.log(`other data is: ${JSON.stringify(this.otherData,null,2)}`);
62 63
    if (this.data && this.data.length) {
63 64
      this.currentInterface = this.data[0];
64
      this.exportedData = this.currentInterface;
65 65
      this.patchData.next({
66
          baseUrl: this.currentInterface.baseUrl,
67
          selectValidationSet: '',
68
          customValidationSet: '',
69
          compatibilityLevel:this.data[0].desiredCompatibilityLevel
66
        baseUrl: this.data[0].baseUrl,
67
        selectValidationSet: '',
68
        customValidationSet: '',
69
        compatibilityLevel:this.data[0].desiredCompatibilityLevel
70 70
      });
71 71
      this.getInterfaceInfo(this.data[0].baseUrl);
72 72
      this.data.splice(0,1);
......
83 83

  
84 84
    if (this.currentInterface) {
85 85
      console.log(`accessParams is ${JSON.stringify(this.currentInterface.accessParams)}`);
86
      if ( !this.getMyControl('compatibilityLevel').value || !this.classCodes.filter( x => x == this.currentInterface.desiredCompatibilityLevel).length ) {
87
        this.getMyControl('compatibilityLevel').setValue("");
88
        this.existingCompLevel = this.currentInterface.desiredCompatibilityLevel;
89
      } else {
90
        this.getMyControl('compatibilityLevel').setValue(this.compClasses[this.currentInterface.desiredCompatibilityLevel]);
91
      }
92
      if (this.group.valid ) {
93
        if (this.group.valid && ( this.getMyControl('selectValidationSet').value || this.getMyControl('customValidationSet').value ) ) {
94
          this.exportedData = this.currentInterface;
95
        }
96
      }
86 97
    }
87 98

  
88 99
    /*  NOT ANYMORE
......
95 106
  }
96 107

  
97 108
  chooseValSet(existingValSet: boolean) {
98
     if(existingValSet) {
99
       this.existingValSet = true;
100
       this.getMyControl('selectValidationSet').enable();
101
       this.getMyControl('customValidationSet').disable();
102
     }  else {
103
       this.existingValSet = false;
104
       this.getMyControl('selectValidationSet').disable();
105
       this.getMyControl('customValidationSet').enable();
106
     }
109
    if(existingValSet) {
110
      this.existingValSet = true;
111
      this.getMyControl('selectValidationSet').enable();
112
      this.getMyControl('customValidationSet').disable();
113
    }  else {
114
      this.existingValSet = false;
115
      this.getMyControl('selectValidationSet').disable();
116
      this.getMyControl('customValidationSet').enable();
117
    }
107 118
  }
108 119

  
109 120
  getInterfaceInfo(baseUrl: string) {
......
191 202
    }
192 203
  }
193 204

  
205
  checkIfValid() {
206
    if (this.inRegister) {
207
      if (this.group.valid && ( this.getMyControl('selectValidationSet').value || this.getMyControl('customValidationSet').value ) ) {
208
        if (this.identifiedBaseUrl) {
209
          let baseUrl = this.getMyControl('baseUrl').value;
210
          let valset: string = '';
211
          if (this.getMyControl('selectValidationSet').enabled) {
212
            valset = this.getMyControl('selectValidationSet').value;
213
          } else {
214
            valset = this.getMyControl('customValidationSet').value;
215
          }
216
          let compLvl = this.getMyControl('compatibilityLevel').value;
217

  
218
          if (this.currentInterface) {
219
            this.updateCurrent(baseUrl,valset,compLvl);
220
          } else {
221
            this.addCurrent(baseUrl,valset,compLvl);
222
          }
223
        }
224
      }
225
    }
226
  }
227

  
194 228
  updateCurrent (baseUrl: string, valset: string, compLvl: string) {
195 229
    this.successMessage = '';
196 230
    this.errorMessage = '';
197
    this.loadingMessage = formSubmitting;
198 231
    this.currentInterface.baseUrl = baseUrl;
199 232
    this.currentInterface.accessSet = valset;
200 233
    this.currentInterface.accessParams['set'] = valset;
......
203 236
    this.currentInterface.typology = this.currentRepository.datasourceClass;
204 237
    this.exportedData = this.currentInterface;
205 238
    if (!this.inRegister) {
239
      this.loadingMessage = formSubmitting;
206 240
      this.updateInterface();
207 241
    } else {
208 242
      this.loadingMessage = '';
......
214 248
  addCurrent (baseUrl: string, valset: string, compLvl: string) {
215 249
    this.errorMessage = '';
216 250
    this.successMessage = '';
217
    this.loadingMessage = formSubmitting;
218 251
    this.currentInterface = new RepositoryInterface();
219 252
    this.currentInterface.baseUrl = baseUrl;
220 253
    this.currentInterface.accessSet = valset;
......
224 257
    this.currentInterface.typology = this.currentRepository.datasourceClass;
225 258
    this.exportedData = this.currentInterface;
226 259
    if (!this.inRegister) {
260
      this.loadingMessage = formSubmitting;
227 261
      this.addInterface();
228 262
    } else {
229 263
      this.loadingMessage = '';
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-forms/datasource-update-form.component.ts
155 155
        datasourceType: this.selectedRepo.datasourceClass,
156 156
        adminEmail: this.selectedRepo.contactEmail
157 157
      });
158
      if ( !this.updateGroup.get('softwarePlatform').value ) {
158
      if ( !this.updateGroup.get('softwarePlatform').value || !this.typologies.filter(x=> x.value == this.selectedRepo.typology).length ) {
159 159
        this.updateGroup.get('softwarePlatform').setValue('');
160 160
        this.updateGroup.get('platformName').setValue(this.selectedRepo.typology);
161 161
      }
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-forms/datasource-interface-form.component.html
1 1
<div>
2 2
  <div class="interfaceActionsPanel">
3
    <a (click)="saveInterface()"><i class="fa fa-save fa-lg"></i></a>
3
    <a *ngIf="!inRegister" (click)="saveInterface()"><i class="fa fa-save fa-lg"></i></a>
4 4
  </div>
5 5
<!--  <div>
6 6
    <h5 *ngIf="currentInterface && oldInterface && currentRepository">{{ currentRepository.datasourceType }} Interface</h5>
......
22 22
      <span *ngIf="identifiedBaseUrl" class="help-block inline" style="margin-top: 0px; margin-bottom: 0px; padding-left: 10px;">
23 23
        Identified
24 24
      </span>
25
      <input id="baseUrl" type="text" class="form-control" formControlName="baseUrl" (blur)="getInterfaceInfo(group.get('baseUrl').value)" required>
25
      <input id="baseUrl" type="text" class="form-control" formControlName="baseUrl" (blur)="getInterfaceInfo(group.get('baseUrl').value)" required (change)="checkIfValid()">
26 26
    </div>
27 27
    <div class="form-group">
28 28
      <label class="control-label">Validation Set (*)</label>
......
32 32
          <span>Choose existing</span>
33 33
        </label>
34 34
      </div>
35
      <select id="selectValidationSet{{index}}" formControlName="selectValidationSet" class="form-control" >
35
      <select id="selectValidationSet{{index}}" formControlName="selectValidationSet" class="form-control" (change)="checkIfValid()">
36 36
        <option value="" selected>-- none selected --</option>
37 37
        <option *ngFor="let set of valsetList" value="{{set}}">{{set}}</option>
38 38
      </select>
......
42 42
          <span>or a custom one</span>
43 43
        </label>
44 44
      </div>
45
      <input id="customValidationSet{{index}}" formControlName="customValidationSet" class="form-control" type="text">
45
      <input id="customValidationSet{{index}}" formControlName="customValidationSet" class="form-control" type="text" (blur)="checkIfValid()">
46 46
    </div>
47 47
    <div class="form-group">
48 48
      <label class="control-label" for="compLvl" title="{{ compatibilityLevelDesc.desc }}">Desired Compatibility Level (*)</label>
49
      <select class="form-control" #compLvl id="compLvl" formControlName="compatibilityLevel" required>
49
      <select class="form-control" #compLvl id="compLvl" formControlName="compatibilityLevel" required (change)="checkIfValid()">
50 50
        <option value="">-- none selected --</option>
51 51
        <option *ngFor="let key of classCodes" value="{{key}}">{{compClasses[key]}}</option>
52 52
      </select>
53 53
    </div>
54 54
    <div>
55 55
      <label class="uk-form-controls-text control-label">Current Compatibility Level</label>
56
      <div *ngIf="compLvl == ''">not available</div>
57
      <div *ngIf="currentInterface && currentInterface.desiredCompatibilityLevel">{{ compClasses[currentInterface.desiredCompatibilityLevel] }}</div>
56
      <div *ngIf="!existingCompLevel">not available</div>
57
      <div *ngIf="existingCompLevel">{{ existingCompLevel }}</div>
58 58
    </div>
59 59
  </div>
60 60
</div>
modules/uoa-repository-dashboard-gui/trunk/app/shared/reusablecomponents/forms/my-array.interface.ts
71 71
    let wrapperFactory = this._cfr.resolveComponentFactory(this.wrapper);
72 72
    let wrapperView = wrapperFactory.create(this.viewContainerRef.injector);
73 73
    let componentView = componentFactory.create(this.viewContainerRef.injector);
74
    this.components.push(componentView.instance);
75 74
    (<MyGroup>componentView.instance).index = this.viewContainerRef.length;
76 75
    (<MyGroup>componentView.instance).required = this.required;
77 76
    (<MyGroup>componentView.instance).data = this.data;
......
79 78
    if (this.registerMode) {
80 79
      (<MyGroup>componentView.instance).inRegister = true;
81 80
    }
81
    this.components.push(<MyGroup>componentView.instance);
82 82
    this.arrayData_.push((<MyGroup>componentView.instance).patchData);
83 83
    (<MyGroup>componentView.instance).description = this.description;
84 84
    let arrayGroup = (<MyGroup>componentView.instance).generate();
......
88 88
    (<MyWrapper>wrapperView.instance).description = this.description;
89 89

  
90 90
    (<MyWrapper>wrapperView.instance).first = this.viewContainerRef.length == 0;
91

  
91 92
    (<MyWrapper>wrapperView.instance).deleteNotifier.subscribe($event => {
92 93
      let index = this.viewContainerRef.indexOf($event);
93 94
      console.log(index);
......
96 97
        ((this.parentGroup as FormArray).controls[this.name].at(0).corpus((<MyGroup>componentView.instance).generate().value));
97 98
      } else {
98 99
        if (index>0){
99
          if (!<MyGroup>componentView.instance.exportedData) {
100
          if (this.registerMode || !<MyGroup>componentView.instance.exportedData) {
100 101
            this.remove(index);
101 102
            (this.parentGroup as FormArray).controls[this.name].removeAt(index-1);
102 103
            this.components.splice(index,1);
......
146 147
    this.components.forEach(element => {
147 148
      if (element.exportedData) {
148 149
        array_to_emit.push(element.exportedData);
150
        console.log(element.exportedData);
149 151
      }
150 152
    });
151 153
    this.emitDataArray.emit(array_to_emit);
154
    console.log(`emitted ${array_to_emit.length} interfaces`);
152 155
  }
153 156

  
154 157
  isModalShown: boolean = false;

Also available in: Unified diff