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"
/>
</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-label>{{ 'common.type' | translate }}</mat-label>
<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;
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 calculatedFieldsEntityTypeList = calculatedFieldsEntityTypeList;
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,
entityName,
tenantId: this.tenantId,
ownerId: this.ownerId,
ownerId: this.ownerId ?? {entityType: EntityType.TENANT, id: this.tenantId},
additionalDebugActionConfig: this.additionalDebugActionConfig,
getTestScriptDialogFn: this.getTestScriptDialog.bind(this),
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) {
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 {

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 = () => { };
constructor(private fb: FormBuilder) {
this.updatedFormWithScript();
this.simpleConfiguration.get('output').valueChanges.pipe(
takeUntilDestroyed(),
).subscribe(() => {
@ -151,7 +152,6 @@ export class SimpleConfigurationComponent implements ControlValueAccessor, Valid
formValue.expressionSIMPLE = formValue.expression;
}
this.simpleConfiguration.patchValue(formValue, {emitEvent: false});
this.updatedFormWithScript();
setTimeout(() => {
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"
[allowedEntityTypes]="allowedEntityTypes"
[additionEntityTypes]="additionEntityTypes"
[filterAllowedEntityTypes]="filterAllowedEntityTypes"
formControlName="entityType">
</tb-entity-type-select>
<tb-entity-autocomplete
@ -34,6 +35,7 @@
[required]="required"
[entityType]="modelValue.entityType"
[useEntityDisplayName]="useEntityDisplayName"
(entityChanged)="changeEntity($event)"
formControlName="entityId">
</tb-entity-autocomplete>
</div>

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

@ -14,7 +14,7 @@
/// 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 { Store } from '@ngrx/store';
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 { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { MatFormFieldAppearance } from '@angular/material/form-field';
import { BaseData } from '@shared/models/base-data';
@Component({
selector: 'tb-entity-select',
@ -66,6 +67,12 @@ export class EntitySelectComponent implements ControlValueAccessor, OnInit, Afte
@coerceBoolean()
useEntityDisplayName = false;
@Input()
filterAllowedEntityTypes: boolean;
@Output()
entityChanged = new EventEmitter<BaseData<EntityId>>();
displayEntityTypeSelect: boolean;
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