Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Add push notification action to button

Robin Dekkers131c50800d6b
diff --git a/ui/component/or-rules/src/json-viewer/forms/or-rule-form-push-notification.ts b/ui/component/or-rules/src/json-viewer/forms/or-rule-form-push-notification.ts
index 45ce79b5a..6108d49b4 100644
--- a/ui/component/or-rules/src/json-viewer/forms/or-rule-form-push-notification.ts
+++ b/ui/component/or-rules/src/json-viewer/forms/or-rule-form-push-notification.ts
@@ -58,8 +58,8 @@ export class OrRuleFormPushNotification extends translate(i18next)(LitElement) {
required
placeholder=" "></or-input>
- <or-input value="${buttons && buttons[0] && buttons[0].action && buttons[0].action.openInBrowser ? buttons[0].action.openInBrowser : true}"
- @or-input-changed="${(e: OrInputChangedEvent) => this.setActionNotificationName(e.detail.value, "buttons.0.action.openInBrowser")}"
+ <or-input .value="${action && action.openInBrowser}"
+ @or-input-changed="${(e: OrInputChangedEvent) => this.setActionNotificationName(e.detail.value, "action.openInBrowser")}"
.label="${i18next.t("openInBrowser")}"
type="${InputType.SWITCH}"
required
@@ -87,6 +87,9 @@ export class OrRuleFormPushNotification extends translate(i18next)(LitElement) {
if(key && this.action.notification && this.action.notification.message){
let message:any = this.action.notification.message;
message = set(message, key, value);
+ if(key.includes('action')) {
+ message = set(message, "buttons.0."+key, value);
+ }
this.action.notification.message = {...message};
}