Commit 149a1dc9909c03ab2f491427367ba6e9c458c57e

Authored by Vladyslav_Prykhodko
1 parent 03457a35

UI: Added a new settings "Open in a new browser tab" in the widget action "Navig…

…ate to other dashboard"
... ... @@ -112,6 +112,12 @@
112 112 {{ 'widget-action.open-right-layout' | translate }}
113 113 </mat-checkbox>
114 114 </ng-template>
  115 + <ng-template [ngSwitchCase]="widgetActionFormGroup.get('type').value === widgetActionType.openDashboard ?
  116 + widgetActionFormGroup.get('type').value : ''">
  117 + <mat-checkbox formControlName="openNewBrowserTab">
  118 + {{ 'widget-action.open-new-browser-tab' | translate }}
  119 + </mat-checkbox>
  120 + </ng-template>
115 121 <ng-template [ngSwitchCase]="widgetActionFormGroup.get('type').value === widgetActionType.openDashboardState ||
116 122 widgetActionFormGroup.get('type').value === widgetActionType.updateDashboardState ||
117 123 widgetActionFormGroup.get('type').value === widgetActionType.openDashboard ?
... ...
... ... @@ -145,6 +145,10 @@ export class WidgetActionDialogComponent extends DialogComponent<WidgetActionDia
145 145 );
146 146 if (type === WidgetActionType.openDashboard) {
147 147 this.actionTypeFormGroup.addControl(
  148 + 'openNewBrowserTab',
  149 + this.fb.control(action ? action.openNewBrowserTab : false, [])
  150 + );
  151 + this.actionTypeFormGroup.addControl(
148 152 'targetDashboardId',
149 153 this.fb.control(action ? action.targetDashboardId : null,
150 154 [Validators.required])
... ...
... ... @@ -1029,7 +1029,11 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
1029 1029 } else {
1030 1030 url = `/dashboards/${targetDashboardId}?state=${state}`;
1031 1031 }
1032   - this.router.navigateByUrl(url);
  1032 + if (descriptor.openNewBrowserTab) {
  1033 + window.open(url, '_blank');
  1034 + } else {
  1035 + this.router.navigateByUrl(url);
  1036 + }
1033 1037 break;
1034 1038 case WidgetActionType.custom:
1035 1039 const customFunction = descriptor.customFunction;
... ...
... ... @@ -344,6 +344,7 @@ export interface WidgetActionDescriptor extends CustomActionDescriptor {
344 344 targetDashboardId?: string;
345 345 targetDashboardStateId?: string;
346 346 openRightLayout?: boolean;
  347 + openNewBrowserTab?: boolean;
347 348 setEntityId?: boolean;
348 349 stateEntityParamName?: string;
349 350 }
... ...
... ... @@ -2257,7 +2257,8 @@
2257 2257 "target-dashboard-state-required": "Target dashboard state is required",
2258 2258 "set-entity-from-widget": "Set entity from widget",
2259 2259 "target-dashboard": "Target dashboard",
2260   - "open-right-layout": "Open right dashboard layout (mobile view)"
  2260 + "open-right-layout": "Open right dashboard layout (mobile view)",
  2261 + "open-new-browser-tab": "Open in a new browser tab"
2261 2262 },
2262 2263 "widgets-bundle": {
2263 2264 "current": "Current bundle",
... ...