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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
18 additions and
2 deletions
-
ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.html
-
ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.ts
-
ui-ngx/src/app/modules/home/components/widget/widget.component.ts
-
ui-ngx/src/app/shared/models/widget.models.ts
-
ui-ngx/src/assets/locale/locale.constant-en_US.json
|
|
|
@ -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 ? |
|
|
|
|
|
|
|
@ -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, |
|
|
|
|
|
|
|
@ -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; |
|
|
|
|
|
|
|
@ -344,6 +344,7 @@ export interface WidgetActionDescriptor extends CustomActionDescriptor { |
|
|
|
targetDashboardId?: string; |
|
|
|
targetDashboardStateId?: string; |
|
|
|
openRightLayout?: boolean; |
|
|
|
openNewBrowserTab?: boolean; |
|
|
|
setEntityId?: boolean; |
|
|
|
stateEntityParamName?: string; |
|
|
|
} |
|
|
|
|
|
|
|
@ -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", |
|
|
|
|