Clear code and optimized js-sample

This commit is contained in:
Vladyslav_Prykhodko 2020-06-11 10:00:37 +03:00
parent accd98676f
commit a2aa854378
2 changed files with 30 additions and 38 deletions

View File

@ -62,14 +62,14 @@
<!-- <mat-form-field fxFlex class="mat-block">-->
<!-- <mat-label>Integer Value</mat-label>-->
<!-- <input type="number" step="1" matInput formControlName="number">-->
<!-- <mat-error *ngIf="editEntityFormGroup.get('attributes').get('number').hasError('pattern')">-->
<!-- <mat-error *ngIf="editEntityFormGroup.get('attributes.number').hasError('pattern')">-->
<!-- Invalid integer value.-->
<!-- </mat-error>-->
<!-- </mat-form-field>-->
<!-- <div class="boolean-value-input" fxLayout="column" fxLayoutAlign="center start" fxFlex>-->
<!-- <label class="checkbox-label">Boolean Value</label>-->
<!-- <mat-checkbox formControlName="booleanValue" style="margin-bottom: 40px;">-->
<!-- {{ (editEntityFormGroup.get('attributes').get('booleanValue').value ? "value.true" : "value.false") | translate }}-->
<!-- {{ (editEntityFormGroup.get('attributes.booleanValue').value ? "value.true" : "value.false") | translate }}-->
<!-- </mat-checkbox>-->
<!-- </div>-->
<!-- </div>-->
@ -184,7 +184,6 @@
<!-- Save-->
<!-- </button>-->
<!-- <button mat-button color="primary"-->
<!-- style="margin-right: 20px;"-->
<!-- type="button"-->
<!-- [disabled]="(isLoading$ | async)"-->
<!-- (click)="cancel()" cdkFocusInitial>-->
@ -270,14 +269,14 @@
<!-- <mat-form-field fxFlex class="mat-block">-->
<!-- <mat-label>Integer Value</mat-label>-->
<!-- <input type="number" step="1" matInput formControlName="number">-->
<!-- <mat-error *ngIf="addEntityFormGroup.get('attributes').get('number').hasError('pattern')">-->
<!-- <mat-error *ngIf="addEntityFormGroup.get('attributes.number').hasError('pattern')">-->
<!-- Invalid integer value.-->
<!-- </mat-error>-->
<!-- </mat-form-field>-->
<!-- <div class="boolean-value-input" fxLayout="column" fxLayoutAlign="center start" fxFlex>-->
<!-- <label class="checkbox-label">Boolean Value</label>-->
<!-- <mat-checkbox formControlName="booleanValue" style="margin-bottom: 40px;">-->
<!-- {{ (addEntityFormGroup.get('attributes').get('booleanValue').value ? "value.true" : "value.false") | translate }}-->
<!-- {{ (addEntityFormGroup.get('attributes.booleanValue').value ? "value.true" : "value.false") | translate }}-->
<!-- </mat-checkbox>-->
<!-- </div>-->
<!-- </div>-->
@ -345,7 +344,6 @@
<!-- Create-->
<!-- </button>-->
<!-- <button mat-button color="primary"-->
<!-- style="margin-right: 20px;"-->
<!-- type="button"-->
<!-- [disabled]="(isLoading$ | async)"-->
<!-- (click)="cancel()" cdkFocusInitial>-->

View File

@ -186,28 +186,27 @@
// }
//
// function getEntityInfo() {
// entityService.getEntity(entityId.entityType, entityId.id).subscribe(function (entity) {
// vm.entity = entity;
// widgetContext.rxjs.forkJoin([
// entityRelationService.findInfoByFrom(entityId),
// entityRelationService.findInfoByTo(entityId),
// attributeService.getEntityAttributes(entityId, 'SERVER_SCOPE')
// ]).subscribe(
// function (data) {
// getEntityRelations(data.slice(0,2));
// getEntityAttributes(data[2]);
// vm.editEntityFormGroup.patchValue({
// entityName: vm.entity.name,
// entityType: vm.entityType,
// entityLabel: vm.entity.label,
// type: vm.entity.type,
// attributes: vm.attributes,
// oldRelations: vm.oldRelationsData
// }, {emitEvent: false});
// }
// );
// });
// }
// widgetContext.rxjs.forkJoin([
// entityRelationService.findInfoByFrom(entityId),
// entityRelationService.findInfoByTo(entityId),
// attributeService.getEntityAttributes(entityId, 'SERVER_SCOPE'),
// entityService.getEntity(entityId.entityType, entityId.id)
// ]).subscribe(
// function (data) {
// getEntityRelations(data.slice(0,2));
// getEntityAttributes(data[2]);
// vm.entity = data[3];
// vm.editEntityFormGroup.patchValue({
// entityName: vm.entity.name,
// entityType: vm.entityType,
// entityLabel: vm.entity.label,
// type: vm.entity.type,
// attributes: vm.attributes,
// oldRelations: vm.oldRelationsData
// }, {emitEvent: false});
// }
// );
// }
//
// function saveEntity() {
// const formValues = vm.editEntityFormGroup.value;
@ -218,9 +217,8 @@
// } else if (formValues.entityType == 'DEVICE') {
// return deviceService.saveDevice(vm.entity);
// }
// } else {
// return widgetContext.rxjs.of([]);
// }
// return widgetContext.rxjs.of([]);
// }
//
// function saveAttributes(entityId) {
@ -233,9 +231,8 @@
// }
// if (attributesArray.length > 0) {
// return attributeService.saveEntityAttributes(entityId, "SERVER_SCOPE", attributesArray);
// } else {
// return widgetContext.rxjs.of([]);
// }
// return widgetContext.rxjs.of([]);
// }
//
// function saveRelations(entityId) {
@ -270,9 +267,8 @@
// }
// if (tasks.length > 0) {
// return widgetContext.rxjs.forkJoin(tasks);
// } else {
// return widgetContext.rxjs.of([]);
// }
// return widgetContext.rxjs.of([]);
// }
//}
//
@ -380,9 +376,8 @@
// }
// if (attributesArray.length > 0) {
// return attributeService.saveEntityAttributes(entityId, "SERVER_SCOPE", attributesArray);
// } else {
// return widgetContext.rxjs.of([]);
// }
// return widgetContext.rxjs.of([]);
// }
//
// function saveRelations(entityId) {
@ -404,8 +399,7 @@
// }
// if (tasks.length > 0) {
// return widgetContext.rxjs.forkJoin(tasks);
// } else {
// return widgetContext.rxjs.of([]);
// }
// return widgetContext.rxjs.of([]);
// }
//}