Showing
5 changed files
with
8 additions
and
11 deletions
... | ... | @@ -42,7 +42,7 @@ import { |
42 | 42 | WidgetActionDialogData |
43 | 43 | } from '@home/components/widget/action/widget-action-dialog.component'; |
44 | 44 | import { deepClone } from '@core/utils'; |
45 | -import { WidgetConfigComponentData } from '@home/models/widget-component.models'; | |
45 | +import { widgetType } from '@shared/models/widget.models'; | |
46 | 46 | |
47 | 47 | @Component({ |
48 | 48 | selector: 'tb-manage-widget-actions', |
... | ... | @@ -60,7 +60,7 @@ export class ManageWidgetActionsComponent extends PageComponent implements OnIni |
60 | 60 | |
61 | 61 | @Input() disabled: boolean; |
62 | 62 | |
63 | - @Input() modelValue: WidgetConfigComponentData; | |
63 | + @Input() widgetType: widgetType; | |
64 | 64 | |
65 | 65 | @Input() callbacks: WidgetActionCallbacks; |
66 | 66 | |
... | ... | @@ -184,7 +184,7 @@ export class ManageWidgetActionsComponent extends PageComponent implements OnIni |
184 | 184 | callbacks: this.callbacks, |
185 | 185 | actionsData, |
186 | 186 | action: deepClone(action), |
187 | - modelValue: this.modelValue | |
187 | + widgetType: this.widgetType | |
188 | 188 | } |
189 | 189 | }).afterClosed().subscribe( |
190 | 190 | (res) => { | ... | ... |
... | ... | @@ -120,7 +120,7 @@ |
120 | 120 | widgetActionFormGroup.get('type').value === widgetActionType.updateDashboardState || |
121 | 121 | widgetActionFormGroup.get('type').value === widgetActionType.openDashboard ? |
122 | 122 | widgetActionFormGroup.get('type').value : ''"> |
123 | - <mat-checkbox *ngIf="data.modelValue.widgetType !== widgetType.static" formControlName="setEntityId"> | |
123 | + <mat-checkbox *ngIf="data.widgetType !== widgetType.static" formControlName="setEntityId"> | |
124 | 124 | {{ 'widget-action.set-entity-from-widget' | translate }} |
125 | 125 | </mat-checkbox> |
126 | 126 | <mat-form-field *ngIf="actionTypeFormGroup.get('setEntityId').value" | ... | ... |
... | ... | @@ -28,9 +28,6 @@ import { |
28 | 28 | ValidatorFn, |
29 | 29 | Validators |
30 | 30 | } from '@angular/forms'; |
31 | -import { | |
32 | - WidgetConfigComponentData | |
33 | -} from '@home/models/widget-component.models'; | |
34 | 31 | import { Observable, of } from 'rxjs'; |
35 | 32 | import { Router } from '@angular/router'; |
36 | 33 | import { DialogComponent } from '@app/shared/components/dialog.component'; |
... | ... | @@ -56,7 +53,7 @@ export interface WidgetActionDialogData { |
56 | 53 | callbacks: WidgetActionCallbacks; |
57 | 54 | actionsData: WidgetActionsData; |
58 | 55 | action?: WidgetActionDescriptorInfo; |
59 | - modelValue: WidgetConfigComponentData; | |
56 | + widgetType: widgetType; | |
60 | 57 | } |
61 | 58 | |
62 | 59 | @Component({ |
... | ... | @@ -147,7 +144,7 @@ export class WidgetActionDialogComponent extends DialogComponent<WidgetActionDia |
147 | 144 | ); |
148 | 145 | this.actionTypeFormGroup.addControl( |
149 | 146 | 'setEntityId', |
150 | - this.fb.control(action ? action.setEntityId : this.data.modelValue.widgetType === widgetType.static ? false : true , []) | |
147 | + this.fb.control(this.data.widgetType === widgetType.static ? false : action ? action.setEntityId : true, []) | |
151 | 148 | ); |
152 | 149 | this.actionTypeFormGroup.addControl( |
153 | 150 | 'stateEntityParamName', | ... | ... |
... | ... | @@ -443,7 +443,7 @@ |
443 | 443 | <mat-tab label="{{ 'widget-config.actions' | translate }}" [formGroup]="actionsSettings"> |
444 | 444 | <tb-manage-widget-actions |
445 | 445 | [callbacks]="widgetConfigCallbacks" |
446 | - [modelValue] = "modelValue" | |
446 | + [widgetType] = "modelValue.widgetType" | |
447 | 447 | formControlName="actionsData"> |
448 | 448 | </tb-manage-widget-actions> |
449 | 449 | </mat-tab> | ... | ... |
... | ... | @@ -1015,7 +1015,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI |
1015 | 1015 | const type = descriptor.type; |
1016 | 1016 | const targetEntityParamName = descriptor.stateEntityParamName; |
1017 | 1017 | let targetEntityId: EntityId; |
1018 | - if (descriptor.setEntityId && validateEntityId(entityId)) { | |
1018 | + if (this.widgetInfo.type !== 'static' && descriptor.setEntityId && validateEntityId(entityId)) { | |
1019 | 1019 | targetEntityId = entityId; |
1020 | 1020 | } |
1021 | 1021 | switch (type) { | ... | ... |