Browse Source

Merge pull request #26 from ArtemDzhereleiko/AD/bug/cf-page

Fixed bug with cf page
pull/14691/head
Vladyslav Prykhodko 9 months ago
committed by GitHub
parent
commit
6b33e9111f
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 7
      ui-ngx/src/app/modules/home/components/calculated-fields/calculated-field.component.html
  2. 2
      ui-ngx/src/app/modules/home/components/calculated-fields/calculated-field.component.ts
  3. 2
      ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts
  4. 2
      ui-ngx/src/app/modules/home/components/calculated-fields/components/output/calculated-field-output.component.ts
  5. 2
      ui-ngx/src/app/modules/home/components/calculated-fields/components/simple-configuration/simple-configuration.component.ts
  6. 2
      ui-ngx/src/app/shared/components/entity/entity-select.component.html
  7. 13
      ui-ngx/src/app/shared/components/entity/entity-select.component.ts

7
ui-ngx/src/app/modules/home/components/calculated-fields/calculated-field.component.html

@ -125,7 +125,12 @@
[additionalActionConfig]="entitiesTableConfig.additionalDebugActionConfig" [additionalActionConfig]="entitiesTableConfig.additionalDebugActionConfig"
/> />
</div> </div>
<tb-entity-select formControlName="entityId" appearance="outline" [allowedEntityTypes]="calculatedFieldsEntityTypeList"></tb-entity-select> <tb-entity-select formControlName="entityId"
appearance="outline"
[filterAllowedEntityTypes]="false"
[allowedEntityTypes]="calculatedFieldsEntityTypeList"
(entityChanged)="changeEntity($event)">
</tb-entity-select>
<mat-form-field appearance="outline" subscriptSizing="dynamic"> <mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>{{ 'common.type' | translate }}</mat-label> <mat-label>{{ 'common.type' | translate }}</mat-label>
<mat-select formControlName="type"> <mat-select formControlName="type">

2
ui-ngx/src/app/modules/home/components/calculated-fields/calculated-field.component.ts

@ -60,7 +60,7 @@ export class CalculatedFieldComponent extends EntityComponent<CalculatedFieldsTa
disabledConfiguration = false; disabledConfiguration = false;
readonly tenantId = getCurrentAuthUser(this.store).tenantId; readonly tenantId = getCurrentAuthUser(this.store).tenantId;
readonly ownerId = getCurrentAuthUser(this.store).tenantId; readonly ownerId: EntityId = {entityType: EntityType.TENANT, id: getCurrentAuthUser(this.store).tenantId};
readonly EntityType = EntityType; readonly EntityType = EntityType;
readonly calculatedFieldsEntityTypeList = calculatedFieldsEntityTypeList; readonly calculatedFieldsEntityTypeList = calculatedFieldsEntityTypeList;
readonly CalculatedFieldType = CalculatedFieldType; readonly CalculatedFieldType = CalculatedFieldType;

2
ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts

@ -242,7 +242,7 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig<CalculatedFie
entityId, entityId,
entityName, entityName,
tenantId: this.tenantId, tenantId: this.tenantId,
ownerId: this.ownerId, ownerId: this.ownerId ?? {entityType: EntityType.TENANT, id: this.tenantId},
additionalDebugActionConfig: this.additionalDebugActionConfig, additionalDebugActionConfig: this.additionalDebugActionConfig,
getTestScriptDialogFn: this.getTestScriptDialog.bind(this), getTestScriptDialogFn: this.getTestScriptDialog.bind(this),
isDirty, isDirty,

2
ui-ngx/src/app/modules/home/components/calculated-fields/components/output/calculated-field-output.component.ts

@ -167,7 +167,7 @@ export class CalculatedFieldOutputComponent implements ControlValueAccessor, Val
if (value.type === OutputType.Timeseries && value.strategy?.type === OutputStrategyType.IMMEDIATE && value.strategy?.ttl) { if (value.type === OutputType.Timeseries && value.strategy?.type === OutputStrategyType.IMMEDIATE && value.strategy?.ttl) {
this.outputForm.get('strategy.useCustomTtl').setValue(true, {emitEvent: false}); this.outputForm.get('strategy.useCustomTtl').setValue(true, {emitEvent: false});
} }
this.outputForm.get('type').updateValueAndValidity({onlySelf: true}); this.outputForm.get('type').updateValueAndValidity({onlySelf: true, emitEvent: false});
} }
registerOnChange(fn: (config: CalculatedFieldOutput | CalculatedFieldSimpleOutput) => void): void { registerOnChange(fn: (config: CalculatedFieldOutput | CalculatedFieldSimpleOutput) => void): void {

2
ui-ngx/src/app/modules/home/components/calculated-fields/components/simple-configuration/simple-configuration.component.ts

@ -109,6 +109,7 @@ export class SimpleConfigurationComponent implements ControlValueAccessor, Valid
private propagateChange: (config: SimpeConfiguration) => void = () => { }; private propagateChange: (config: SimpeConfiguration) => void = () => { };
constructor(private fb: FormBuilder) { constructor(private fb: FormBuilder) {
this.updatedFormWithScript();
this.simpleConfiguration.get('output').valueChanges.pipe( this.simpleConfiguration.get('output').valueChanges.pipe(
takeUntilDestroyed(), takeUntilDestroyed(),
).subscribe(() => { ).subscribe(() => {
@ -151,7 +152,6 @@ export class SimpleConfigurationComponent implements ControlValueAccessor, Valid
formValue.expressionSIMPLE = formValue.expression; formValue.expressionSIMPLE = formValue.expression;
} }
this.simpleConfiguration.patchValue(formValue, {emitEvent: false}); this.simpleConfiguration.patchValue(formValue, {emitEvent: false});
this.updatedFormWithScript();
setTimeout(() => { setTimeout(() => {
this.simpleConfiguration.get('arguments').updateValueAndValidity({onlySelf: true}); this.simpleConfiguration.get('arguments').updateValueAndValidity({onlySelf: true});
}); });

2
ui-ngx/src/app/shared/components/entity/entity-select.component.html

@ -25,6 +25,7 @@
[useAliasEntityTypes]="useAliasEntityTypes" [useAliasEntityTypes]="useAliasEntityTypes"
[allowedEntityTypes]="allowedEntityTypes" [allowedEntityTypes]="allowedEntityTypes"
[additionEntityTypes]="additionEntityTypes" [additionEntityTypes]="additionEntityTypes"
[filterAllowedEntityTypes]="filterAllowedEntityTypes"
formControlName="entityType"> formControlName="entityType">
</tb-entity-type-select> </tb-entity-type-select>
<tb-entity-autocomplete <tb-entity-autocomplete
@ -34,6 +35,7 @@
[required]="required" [required]="required"
[entityType]="modelValue.entityType" [entityType]="modelValue.entityType"
[useEntityDisplayName]="useEntityDisplayName" [useEntityDisplayName]="useEntityDisplayName"
(entityChanged)="changeEntity($event)"
formControlName="entityId"> formControlName="entityId">
</tb-entity-autocomplete> </tb-entity-autocomplete>
</div> </div>

13
ui-ngx/src/app/shared/components/entity/entity-select.component.ts

@ -14,7 +14,7 @@
/// limitations under the License. /// limitations under the License.
/// ///
import { AfterViewInit, Component, DestroyRef, forwardRef, Input, OnInit } from '@angular/core'; import { AfterViewInit, Component, DestroyRef, EventEmitter, forwardRef, Input, OnInit, Output } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms'; import { ControlValueAccessor, NG_VALUE_ACCESSOR, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state'; import { AppState } from '@core/core.state';
@ -26,6 +26,7 @@ import { NULL_UUID } from '@shared/models/id/has-uuid';
import { coerceBoolean } from '@shared/decorators/coercion'; import { coerceBoolean } from '@shared/decorators/coercion';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { MatFormFieldAppearance } from '@angular/material/form-field'; import { MatFormFieldAppearance } from '@angular/material/form-field';
import { BaseData } from '@shared/models/base-data';
@Component({ @Component({
selector: 'tb-entity-select', selector: 'tb-entity-select',
@ -66,6 +67,12 @@ export class EntitySelectComponent implements ControlValueAccessor, OnInit, Afte
@coerceBoolean() @coerceBoolean()
useEntityDisplayName = false; useEntityDisplayName = false;
@Input()
filterAllowedEntityTypes: boolean;
@Output()
entityChanged = new EventEmitter<BaseData<EntityId>>();
displayEntityTypeSelect: boolean; displayEntityTypeSelect: boolean;
AliasEntityType = AliasEntityType; AliasEntityType = AliasEntityType;
@ -176,4 +183,8 @@ export class EntitySelectComponent implements ControlValueAccessor, OnInit, Afte
} }
} }
} }
changeEntity(entity: BaseData<EntityId>): void {
this.entityChanged.emit(entity);
}
} }

Loading…
Cancel
Save