diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action.component.ts
index c93a05fafd..6c2cd3fb8f 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action.component.ts
@@ -279,6 +279,16 @@ export class WidgetActionComponent implements ControlValueAccessor, OnInit, Vali
this.fb.control(action ? action.mobileAction : null, [Validators.required])
);
break;
+ case WidgetActionType.openURL:
+ this.actionTypeFormGroup.addControl(
+ 'openNewBrowserTab',
+ this.fb.control(action ? action.openNewBrowserTab : false, [])
+ );
+ this.actionTypeFormGroup.addControl(
+ 'url',
+ this.fb.control(action ? action.url : null, [Validators.required])
+ );
+ break;
}
}
this.actionTypeFormGroupSubscriptions.push(
diff --git a/ui-ngx/src/app/modules/home/components/widget/widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/widget.component.ts
index 15e982c060..a79fa89242 100644
--- a/ui-ngx/src/app/modules/home/components/widget/widget.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/widget.component.ts
@@ -1089,6 +1089,9 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
this.router.navigateByUrl(url);
}
break;
+ case WidgetActionType.openURL:
+ window.open(descriptor.url, descriptor.openNewBrowserTab ? '_blank' : '_self');
+ break;
case WidgetActionType.custom:
const customFunction = descriptor.customFunction;
if (customFunction && customFunction.length > 0) {
diff --git a/ui-ngx/src/app/shared/models/widget.models.ts b/ui-ngx/src/app/shared/models/widget.models.ts
index 625d957cff..5f4ca8f7be 100644
--- a/ui-ngx/src/app/shared/models/widget.models.ts
+++ b/ui-ngx/src/app/shared/models/widget.models.ts
@@ -538,7 +538,8 @@ export enum WidgetActionType {
openDashboard = 'openDashboard',
custom = 'custom',
customPretty = 'customPretty',
- mobileAction = 'mobileAction'
+ mobileAction = 'mobileAction',
+ openURL = 'openURL'
}
export enum WidgetMobileActionType {
@@ -559,7 +560,8 @@ export const widgetActionTypeTranslationMap = new Map(
[ WidgetActionType.openDashboard, 'widget-action.open-dashboard' ],
[ WidgetActionType.custom, 'widget-action.custom' ],
[ WidgetActionType.customPretty, 'widget-action.custom-pretty' ],
- [ WidgetActionType.mobileAction, 'widget-action.mobile-action' ]
+ [ WidgetActionType.mobileAction, 'widget-action.mobile-action' ],
+ [ WidgetActionType.openURL, 'widget-action.open-URL' ]
]
);
@@ -671,6 +673,7 @@ export interface WidgetAction extends CustomActionDescriptor {
setEntityId?: boolean;
stateEntityParamName?: string;
mobileAction?: WidgetMobileActionDescriptor;
+ url?: string;
}
export interface WidgetActionDescriptor extends WidgetAction {
diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json
index 0721aba093..c57158b2ba 100644
--- a/ui-ngx/src/assets/locale/locale.constant-en_US.json
+++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json
@@ -5036,6 +5036,9 @@
"popover-height": "Popover height",
"popover-style": "Popover style",
"open-new-browser-tab": "Open in a new browser tab",
+ "open-URL": "Open URL",
+ "URL": "URL",
+ "url-required": "URL is required.",
"mobile": {
"action-type": "Mobile action type",
"select-action-type": "Select mobile action type",