Commit 9cafa7072107c55a01e0f99c6a57631c41c19ad9
Committed by
GitHub
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
Showing
5 changed files
with
18 additions
and
2 deletions
... | ... | @@ -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", | ... | ... |