Skip to content

armgit / core

Public Imported from GitHub
0

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

Fix push action, Add isCopy to SaveEvent

Robin Dekkers59ea7f6e6f91
diff --git a/ui/app/or-app/src/pages/page-assets.ts b/ui/app/or-app/src/pages/page-assets.ts
index 1a44b5821..fe57ed5cd 100644
--- a/ui/app/or-app/src/pages/page-assets.ts
+++ b/ui/app/or-app/src/pages/page-assets.ts
@@ -214,6 +214,8 @@ class PageAssets<S extends AppStateKeyed> extends Page<S> {
} else {
// Auto save and load
const result = await saveAsset(ev.detail.asset);
+ result.isCopy = true;
+ this.dispatchEvent(new OrAssetViewerSaveEvent(result));
this._onAssetSave(result);
}
}
diff --git a/ui/component/or-asset-viewer/src/index.ts b/ui/component/or-asset-viewer/src/index.ts
index 08bc74f45..1237c1f88 100644
--- a/ui/component/or-asset-viewer/src/index.ts
+++ b/ui/component/or-asset-viewer/src/index.ts
@@ -179,7 +179,8 @@ export class OrAssetViewerComputeGridEvent extends CustomEvent<void> {
export type SaveResult = {
success: boolean,
assetId: string,
- isNew?: boolean
+ isNew?: boolean,
+ isCopy?: boolean
};
export class OrAssetViewerRequestSaveEvent extends CustomEvent<Util.RequestEventDetail<Asset>> {
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 158adfd23..1c0258491 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
@@ -83,9 +83,9 @@ export class OrRuleFormPushNotification extends translate(i18next)(LitElement) {
protected setActionNotificationName(value: string | undefined, key?: string) {
if(key && this.action.notification && this.action.notification.message){
let message:any = this.action.notification.message;
- message = set(message, key, value);
+ set(message, key, value);
if(key.includes('action')) {
- message = set(message, "buttons.0."+key, value);
+ set(message, "buttons.0."+key, value);
}
this.action.notification.message = {...message};
}