Browse Source

UI: Fixed owner for cf geofencing

pull/14303/head
ArtemDzhereleiko 11 months ago
parent
commit
a1a8bd9c33
  1. 1
      ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.html
  2. 12
      ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-panel.component.ts
  3. 2
      ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-table.component.ts
  4. 1
      ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/geofencing-configuration.component.html
  5. 3
      ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/geofencing-configuration.component.ts
  6. 2
      ui-ngx/src/app/modules/home/pages/asset/asset-tabs.component.html
  7. 4
      ui-ngx/src/app/modules/home/pages/device/device-tabs.component.html

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

@ -70,6 +70,7 @@
<tb-geofencing-configuration formControlName="configuration"
[entityId]="data.entityId"
[entityName]="data.entityName"
[ownerId]="data.ownerId"
[tenantId]="data.tenantId"
></tb-geofencing-configuration>
}

12
ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-panel.component.ts

@ -66,6 +66,7 @@ export class CalculatedFieldGeofencingZoneGroupsPanelComponent implements OnInit
@Input() entityId: EntityId;
@Input() tenantId: string;
@Input() entityName: string;
@Input() ownerId: EntityId;
@Input() usedNames: string[];
@ViewChild('entityAutocomplete') entityAutocomplete: EntityAutocompleteComponent;
@ -195,6 +196,11 @@ export class CalculatedFieldGeofencingZoneGroupsPanelComponent implements OnInit
case ArgumentEntityType.Current:
delete value.refEntityId;
break;
case ArgumentEntityType.Owner:
delete value.refEntityId;
value.refDynamicSourceConfiguration ||= { type: ArgumentEntityType.Owner };
value.refDynamicSourceConfiguration.type = ArgumentEntityType.Owner;
break;
case ArgumentEntityType.RelationQuery:
delete value.refEntityId;
value.refDynamicSourceConfiguration.type = ArgumentEntityType.RelationQuery;
@ -219,6 +225,12 @@ export class CalculatedFieldGeofencingZoneGroupsPanelComponent implements OnInit
case ArgumentEntityType.RelationQuery:
entityFilter = this.currentEntityFilter;
break;
case ArgumentEntityType.Owner:
entityFilter = {
type: AliasFilterType.singleEntity,
singleEntity: this.ownerId
};
break;
case ArgumentEntityType.Tenant:
entityFilter = {
type: AliasFilterType.singleEntity,

2
ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-table.component.ts

@ -81,6 +81,7 @@ export class CalculatedFieldGeofencingZoneGroupsTableComponent implements Contro
@Input({required: true}) entityId: EntityId;
@Input({required: true}) tenantId: string;
@Input({required: true}) entityName: string;
@Input({required: true}) ownerId: EntityId;
@ViewChild(MatSort, { static: true }) sort: MatSort;
@ -159,6 +160,7 @@ export class CalculatedFieldGeofencingZoneGroupsTableComponent implements Contro
buttonTitle: isExists ? 'action.apply' : 'action.add',
tenantId: this.tenantId,
entityName: this.entityName,
ownerId: this.ownerId,
usedNames: this.zoneGroupsFormArray.value.map(({ name }) => name).filter(name => name !== zone.name),
};
this.popoverComponent = this.popoverService.displayPopover({

1
ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/geofencing-configuration.component.html

@ -43,6 +43,7 @@
<tb-calculated-field-geofencing-zone-groups-table formControlName="zoneGroups"
[entityId]="entityId"
[tenantId]="tenantId"
[ownerId]="ownerId"
[entityName]="entityName"/>
<div class="tb-form-row space-between flex-1 columns-xs" [class.!hidden]="!isRelatedEntity">
<mat-slide-toggle class="mat-slide" formControlName="scheduledUpdateEnabled">

3
ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/geofencing-configuration.component.ts

@ -69,6 +69,9 @@ export class GeofencingConfigurationComponent implements ControlValueAccessor, V
@Input({required: true})
entityName: string;
@Input({required: true})
ownerId: EntityId;
readonly minAllowedScheduledUpdateIntervalInSecForCF = getCurrentAuthState(this.store).minAllowedScheduledUpdateIntervalInSecForCF;
readonly DataKeyType = DataKeyType;

2
ui-ngx/src/app/modules/home/pages/asset/asset-tabs.component.html

@ -37,7 +37,7 @@
</mat-tab>
<mat-tab #alarmRules="matTab"
label="{{'alarm-rule.alarm-rules' | translate }}">
<tb-alarm-rules-table [active]="alarmRules.isActive" [entityId]="entity.id" [entityName]="entity.name"></tb-alarm-rules-table>
<tb-alarm-rules-table [active]="alarmRules.isActive" [entityId]="entity.id" [entityName]="entity.name" [ownerId]="entity.tenantId"></tb-alarm-rules-table>
</mat-tab>
}
<mat-tab label="{{ 'alarm.alarms' | translate }}" #alarmsTab="matTab">

4
ui-ngx/src/app/modules/home/pages/device/device-tabs.component.html

@ -33,10 +33,10 @@
</mat-tab>
@if (authUser.authority === authorities.TENANT_ADMIN) {
<mat-tab label="{{ 'entity.type-calculated-fields' | translate }}" #calculatedFieldsTab="matTab">
<tb-calculated-fields-table [active]="calculatedFieldsTab.isActive" [entityId]="entity.id"/>
<tb-calculated-fields-table [active]="calculatedFieldsTab.isActive" [entityId]="entity.id" [ownerId]="entity.tenantId"/>
</mat-tab>
<mat-tab #calculatedFieldsAlarmRules="matTab" label="{{'alarm-rule.alarm-rules-tab' | translate }}">
<tb-alarm-rules-table [active]="calculatedFieldsAlarmRules.isActive" [entityId]="entity.id" [entityName]="entity.name"></tb-alarm-rules-table>
<tb-alarm-rules-table [active]="calculatedFieldsAlarmRules.isActive" [entityId]="entity.id" [entityName]="entity.name" [ownerId]="entity.tenantId"></tb-alarm-rules-table>
</mat-tab>
}
<mat-tab label="{{ 'alarm.alarms' | translate }}" #alarmsTab="matTab">

Loading…
Cancel
Save