Browse Source

Merge pull request #15409 from mtsymbarov-del/fix/attributes-table-widget-mode

Added proper stateController determination to work correctly with "Home page widgets" bundle type
pull/15424/head
Vladyslav Prykhodko 2 months ago
committed by GitHub
parent
commit
933b27763d
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html
  2. 18
      ui-ngx/src/app/modules/home/components/widget/lib/cards/api-usage-widget.component.ts

1
ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html

@ -254,6 +254,7 @@
[widgets]="widgets"
[columns]="20"
[isEdit]="false"
[isPreview]="true"
[isMobileDisabled]="true"
[isEditActionEnabled]="false"
[isRemoveActionEnabled]="false">

18
ui-ngx/src/app/modules/home/components/widget/lib/cards/api-usage-widget.component.ts

@ -104,12 +104,16 @@ export class ApiUsageWidgetComponent implements OnInit, OnDestroy {
};
this.ctx.subscriptionApi.createSubscription(apiUsageSubscriptionOptions, true).subscribe();
this.currentState = this.ctx.stateController.getStateId();
this.ctx.stateController.stateId().subscribe((state) => {
this.ctx.updateParamsFromData(true);
this.currentState = state;
this.cd.markForCheck();
});
const simulated = this.ctx.utilsService.widgetEditMode || this.ctx.isPreview;
if (!simulated) {
this.currentState = this.ctx.stateController.getStateId();
this.ctx.stateController.stateId().subscribe((state) => {
this.ctx.updateParamsFromData(true);
this.currentState = state;
this.cd.markForCheck();
});
}
this.backgroundStyle$ = backgroundStyle(this.settings.background, this.imagePipe, this.sanitizer);
this.overlayStyle = overlayStyle(this.settings.background.overlay);
this.padding = this.settings.background.overlay.enabled ? undefined : this.settings.padding;
@ -121,7 +125,7 @@ export class ApiUsageWidgetComponent implements OnInit, OnDestroy {
updateState($event: MouseEvent, stateName: string) {
$event?.preventDefault();
if (stateName?.length) {
if (stateName?.length && this.ctx.stateController) {
this.ctx.stateController.updateState(stateName, this.ctx.stateController.getStateParams(), this.ctx.isMobile);
}
}

Loading…
Cancel
Save