Commit a2aa8543784386a544fb846bc1f1454ff978e08c
1 parent
accd9867
Clear code and optimized js-sample
Showing
2 changed files
with
30 additions
and
38 deletions
... | ... | @@ -62,14 +62,14 @@ |
62 | 62 | <!-- <mat-form-field fxFlex class="mat-block">--> |
63 | 63 | <!-- <mat-label>Integer Value</mat-label>--> |
64 | 64 | <!-- <input type="number" step="1" matInput formControlName="number">--> |
65 | -<!-- <mat-error *ngIf="editEntityFormGroup.get('attributes').get('number').hasError('pattern')">--> | |
65 | +<!-- <mat-error *ngIf="editEntityFormGroup.get('attributes.number').hasError('pattern')">--> | |
66 | 66 | <!-- Invalid integer value.--> |
67 | 67 | <!-- </mat-error>--> |
68 | 68 | <!-- </mat-form-field>--> |
69 | 69 | <!-- <div class="boolean-value-input" fxLayout="column" fxLayoutAlign="center start" fxFlex>--> |
70 | 70 | <!-- <label class="checkbox-label">Boolean Value</label>--> |
71 | 71 | <!-- <mat-checkbox formControlName="booleanValue" style="margin-bottom: 40px;">--> |
72 | -<!-- {{ (editEntityFormGroup.get('attributes').get('booleanValue').value ? "value.true" : "value.false") | translate }}--> | |
72 | +<!-- {{ (editEntityFormGroup.get('attributes.booleanValue').value ? "value.true" : "value.false") | translate }}--> | |
73 | 73 | <!-- </mat-checkbox>--> |
74 | 74 | <!-- </div>--> |
75 | 75 | <!-- </div>--> |
... | ... | @@ -184,7 +184,6 @@ |
184 | 184 | <!-- Save--> |
185 | 185 | <!-- </button>--> |
186 | 186 | <!-- <button mat-button color="primary"--> |
187 | -<!-- style="margin-right: 20px;"--> | |
188 | 187 | <!-- type="button"--> |
189 | 188 | <!-- [disabled]="(isLoading$ | async)"--> |
190 | 189 | <!-- (click)="cancel()" cdkFocusInitial>--> |
... | ... | @@ -270,14 +269,14 @@ |
270 | 269 | <!-- <mat-form-field fxFlex class="mat-block">--> |
271 | 270 | <!-- <mat-label>Integer Value</mat-label>--> |
272 | 271 | <!-- <input type="number" step="1" matInput formControlName="number">--> |
273 | -<!-- <mat-error *ngIf="addEntityFormGroup.get('attributes').get('number').hasError('pattern')">--> | |
272 | +<!-- <mat-error *ngIf="addEntityFormGroup.get('attributes.number').hasError('pattern')">--> | |
274 | 273 | <!-- Invalid integer value.--> |
275 | 274 | <!-- </mat-error>--> |
276 | 275 | <!-- </mat-form-field>--> |
277 | 276 | <!-- <div class="boolean-value-input" fxLayout="column" fxLayoutAlign="center start" fxFlex>--> |
278 | 277 | <!-- <label class="checkbox-label">Boolean Value</label>--> |
279 | 278 | <!-- <mat-checkbox formControlName="booleanValue" style="margin-bottom: 40px;">--> |
280 | -<!-- {{ (addEntityFormGroup.get('attributes').get('booleanValue').value ? "value.true" : "value.false") | translate }}--> | |
279 | +<!-- {{ (addEntityFormGroup.get('attributes.booleanValue').value ? "value.true" : "value.false") | translate }}--> | |
281 | 280 | <!-- </mat-checkbox>--> |
282 | 281 | <!-- </div>--> |
283 | 282 | <!-- </div>--> |
... | ... | @@ -345,7 +344,6 @@ |
345 | 344 | <!-- Create--> |
346 | 345 | <!-- </button>--> |
347 | 346 | <!-- <button mat-button color="primary"--> |
348 | -<!-- style="margin-right: 20px;"--> | |
349 | 347 | <!-- type="button"--> |
350 | 348 | <!-- [disabled]="(isLoading$ | async)"--> |
351 | 349 | <!-- (click)="cancel()" cdkFocusInitial>--> | ... | ... |
... | ... | @@ -186,28 +186,27 @@ |
186 | 186 | // } |
187 | 187 | // |
188 | 188 | // function getEntityInfo() { |
189 | -// entityService.getEntity(entityId.entityType, entityId.id).subscribe(function (entity) { | |
190 | -// vm.entity = entity; | |
191 | -// widgetContext.rxjs.forkJoin([ | |
192 | -// entityRelationService.findInfoByFrom(entityId), | |
193 | -// entityRelationService.findInfoByTo(entityId), | |
194 | -// attributeService.getEntityAttributes(entityId, 'SERVER_SCOPE') | |
195 | -// ]).subscribe( | |
196 | -// function (data) { | |
197 | -// getEntityRelations(data.slice(0,2)); | |
198 | -// getEntityAttributes(data[2]); | |
199 | -// vm.editEntityFormGroup.patchValue({ | |
200 | -// entityName: vm.entity.name, | |
201 | -// entityType: vm.entityType, | |
202 | -// entityLabel: vm.entity.label, | |
203 | -// type: vm.entity.type, | |
204 | -// attributes: vm.attributes, | |
205 | -// oldRelations: vm.oldRelationsData | |
206 | -// }, {emitEvent: false}); | |
207 | -// } | |
208 | -// ); | |
209 | -// }); | |
210 | -// } | |
189 | +// widgetContext.rxjs.forkJoin([ | |
190 | +// entityRelationService.findInfoByFrom(entityId), | |
191 | +// entityRelationService.findInfoByTo(entityId), | |
192 | +// attributeService.getEntityAttributes(entityId, 'SERVER_SCOPE'), | |
193 | +// entityService.getEntity(entityId.entityType, entityId.id) | |
194 | +// ]).subscribe( | |
195 | +// function (data) { | |
196 | +// getEntityRelations(data.slice(0,2)); | |
197 | +// getEntityAttributes(data[2]); | |
198 | +// vm.entity = data[3]; | |
199 | +// vm.editEntityFormGroup.patchValue({ | |
200 | +// entityName: vm.entity.name, | |
201 | +// entityType: vm.entityType, | |
202 | +// entityLabel: vm.entity.label, | |
203 | +// type: vm.entity.type, | |
204 | +// attributes: vm.attributes, | |
205 | +// oldRelations: vm.oldRelationsData | |
206 | +// }, {emitEvent: false}); | |
207 | +// } | |
208 | +// ); | |
209 | +// } | |
211 | 210 | // |
212 | 211 | // function saveEntity() { |
213 | 212 | // const formValues = vm.editEntityFormGroup.value; |
... | ... | @@ -218,9 +217,8 @@ |
218 | 217 | // } else if (formValues.entityType == 'DEVICE') { |
219 | 218 | // return deviceService.saveDevice(vm.entity); |
220 | 219 | // } |
221 | -// } else { | |
222 | -// return widgetContext.rxjs.of([]); | |
223 | 220 | // } |
221 | +// return widgetContext.rxjs.of([]); | |
224 | 222 | // } |
225 | 223 | // |
226 | 224 | // function saveAttributes(entityId) { |
... | ... | @@ -233,9 +231,8 @@ |
233 | 231 | // } |
234 | 232 | // if (attributesArray.length > 0) { |
235 | 233 | // return attributeService.saveEntityAttributes(entityId, "SERVER_SCOPE", attributesArray); |
236 | -// } else { | |
237 | -// return widgetContext.rxjs.of([]); | |
238 | 234 | // } |
235 | +// return widgetContext.rxjs.of([]); | |
239 | 236 | // } |
240 | 237 | // |
241 | 238 | // function saveRelations(entityId) { |
... | ... | @@ -270,9 +267,8 @@ |
270 | 267 | // } |
271 | 268 | // if (tasks.length > 0) { |
272 | 269 | // return widgetContext.rxjs.forkJoin(tasks); |
273 | -// } else { | |
274 | -// return widgetContext.rxjs.of([]); | |
275 | 270 | // } |
271 | +// return widgetContext.rxjs.of([]); | |
276 | 272 | // } |
277 | 273 | //} |
278 | 274 | // |
... | ... | @@ -380,9 +376,8 @@ |
380 | 376 | // } |
381 | 377 | // if (attributesArray.length > 0) { |
382 | 378 | // return attributeService.saveEntityAttributes(entityId, "SERVER_SCOPE", attributesArray); |
383 | -// } else { | |
384 | -// return widgetContext.rxjs.of([]); | |
385 | 379 | // } |
380 | +// return widgetContext.rxjs.of([]); | |
386 | 381 | // } |
387 | 382 | // |
388 | 383 | // function saveRelations(entityId) { |
... | ... | @@ -404,8 +399,7 @@ |
404 | 399 | // } |
405 | 400 | // if (tasks.length > 0) { |
406 | 401 | // return widgetContext.rxjs.forkJoin(tasks); |
407 | -// } else { | |
408 | -// return widgetContext.rxjs.of([]); | |
409 | 402 | // } |
403 | +// return widgetContext.rxjs.of([]); | |
410 | 404 | // } |
411 | 405 | //} | ... | ... |