Browse Source

Merge pull request #3950 from vvlladd28/improvement/widget-action/open-dashboard

[3.2.1] UI: Added a new settings "Open in a new browser tab" in the widget action
pull/3990/head
Igor Kulikov 6 years ago
committed by GitHub
parent
commit
9cafa70721
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.html
  2. 4
      ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.ts
  3. 6
      ui-ngx/src/app/modules/home/components/widget/widget.component.ts
  4. 1
      ui-ngx/src/app/shared/models/widget.models.ts
  5. 3
      ui-ngx/src/assets/locale/locale.constant-en_US.json

6
ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.html

@ -112,6 +112,12 @@
{{ 'widget-action.open-right-layout' | translate }}
</mat-checkbox>
</ng-template>
<ng-template [ngSwitchCase]="widgetActionFormGroup.get('type').value === widgetActionType.openDashboard ?
widgetActionFormGroup.get('type').value : ''">
<mat-checkbox formControlName="openNewBrowserTab">
{{ 'widget-action.open-new-browser-tab' | translate }}
</mat-checkbox>
</ng-template>
<ng-template [ngSwitchCase]="widgetActionFormGroup.get('type').value === widgetActionType.openDashboardState ||
widgetActionFormGroup.get('type').value === widgetActionType.updateDashboardState ||
widgetActionFormGroup.get('type').value === widgetActionType.openDashboard ?

4
ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.ts

@ -144,6 +144,10 @@ export class WidgetActionDialogComponent extends DialogComponent<WidgetActionDia
this.fb.control(action ? action.stateEntityParamName : null, [])
);
if (type === WidgetActionType.openDashboard) {
this.actionTypeFormGroup.addControl(
'openNewBrowserTab',
this.fb.control(action ? action.openNewBrowserTab : false, [])
);
this.actionTypeFormGroup.addControl(
'targetDashboardId',
this.fb.control(action ? action.targetDashboardId : null,

6
ui-ngx/src/app/modules/home/components/widget/widget.component.ts

@ -1029,7 +1029,11 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
} else {
url = `/dashboards/${targetDashboardId}?state=${state}`;
}
this.router.navigateByUrl(url);
if (descriptor.openNewBrowserTab) {
window.open(url, '_blank');
} else {
this.router.navigateByUrl(url);
}
break;
case WidgetActionType.custom:
const customFunction = descriptor.customFunction;

1
ui-ngx/src/app/shared/models/widget.models.ts

@ -344,6 +344,7 @@ export interface WidgetActionDescriptor extends CustomActionDescriptor {
targetDashboardId?: string;
targetDashboardStateId?: string;
openRightLayout?: boolean;
openNewBrowserTab?: boolean;
setEntityId?: boolean;
stateEntityParamName?: string;
}

3
ui-ngx/src/assets/locale/locale.constant-en_US.json

@ -2257,7 +2257,8 @@
"target-dashboard-state-required": "Target dashboard state is required",
"set-entity-from-widget": "Set entity from widget",
"target-dashboard": "Target dashboard",
"open-right-layout": "Open right dashboard layout (mobile view)"
"open-right-layout": "Open right dashboard layout (mobile view)",
"open-new-browser-tab": "Open in a new browser tab"
},
"widgets-bundle": {
"current": "Current bundle",

Loading…
Cancel
Save