From c34dc10b5bad3ceea8422a7a6045046593897edf Mon Sep 17 00:00:00 2001 From: Arley Triana Morin Date: Mon, 22 Jan 2024 10:23:15 +0100 Subject: [PATCH 01/11] feat(draft): SAP Fiori Elements Mass Edit --- node.js/fiori.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/node.js/fiori.md b/node.js/fiori.md index 5cefd44f0..6bb641f0c 100644 --- a/node.js/fiori.md +++ b/node.js/fiori.md @@ -86,6 +86,21 @@ To prevent inconsistency, the entities with draft are locked for modifications b cds.drafts.cancellationTimeout=1h ``` +### SAP Fiori Elements Mass Edit + +Mass editing allows users to change multiple objects with the same editable properties without +creating drafts for each row. Add this to your cds configuration to enable this feature and bypass draft restrictions: + +```json +{ + "cds": { + "fiori": { + "bypass_draft": true + } + } +} +``` + ### Differences to Previous Version - Draft-enabled entities have corresponding CSN entities for drafts: From d1edfb9d110af0c233335cf65295cb934f5df687 Mon Sep 17 00:00:00 2001 From: Arley Triana Morin Date: Mon, 22 Jan 2024 10:30:51 +0100 Subject: [PATCH 02/11] add warning disclaimer --- node.js/fiori.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/node.js/fiori.md b/node.js/fiori.md index 6bb641f0c..22b1e94a6 100644 --- a/node.js/fiori.md +++ b/node.js/fiori.md @@ -101,6 +101,11 @@ creating drafts for each row. Add this to your cds configuration to enable this } ``` +:::warning +Be aware that this feature creates an additional entry point to your application. Custom handlers might require +adaptations because the handlers are triggered with delta payloads instead of the complete business object. +::: + ### Differences to Previous Version - Draft-enabled entities have corresponding CSN entities for drafts: From ec311e3d74bc6f21b18665ebd839f293245bb089 Mon Sep 17 00:00:00 2001 From: Arley Triana Morin Date: Fri, 26 Jan 2024 12:58:17 +0100 Subject: [PATCH 03/11] more broader context --- node.js/fiori.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/node.js/fiori.md b/node.js/fiori.md index 22b1e94a6..498753416 100644 --- a/node.js/fiori.md +++ b/node.js/fiori.md @@ -86,10 +86,10 @@ To prevent inconsistency, the entities with draft are locked for modifications b cds.drafts.cancellationTimeout=1h ``` -### SAP Fiori Elements Mass Edit +### Bypassing Draft Restrictions -Mass editing allows users to change multiple objects with the same editable properties without -creating drafts for each row. Add this to your cds configuration to enable this feature and bypass draft restrictions: +It is possible to create or modify active instances directly, without creating a draft first. Add this to your cds +configuration to enable this feature and bypass draft restrictions: ```json { @@ -101,9 +101,13 @@ creating drafts for each row. Add this to your cds configuration to enable this } ``` +This feature is required to enable SAP Fiori Elements Mass Edit, allowing users to change multiple objects with the +same editable properties without creating drafts for each row. + :::warning -Be aware that this feature creates an additional entry point to your application. Custom handlers might require -adaptations because the handlers are triggered with delta payloads instead of the complete business object. +Note that this feature creates an additional entry point to your application. Custom handlers are triggered with delta +payloads rather than the complete business object. + ::: ### Differences to Previous Version From fcc5e2f3c55d7cf52e3acf9bb78e1e56e9f5a4de Mon Sep 17 00:00:00 2001 From: Arley Triana Morin Date: Fri, 26 Jan 2024 13:01:21 +0100 Subject: [PATCH 04/11] minor --- node.js/fiori.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/node.js/fiori.md b/node.js/fiori.md index 498753416..a30951358 100644 --- a/node.js/fiori.md +++ b/node.js/fiori.md @@ -88,7 +88,7 @@ cds.drafts.cancellationTimeout=1h ### Bypassing Draft Restrictions -It is possible to create or modify active instances directly, without creating a draft first. Add this to your cds +Creating or modifying active instances directly is possible without creating a draft first. Add this to your cds configuration to enable this feature and bypass draft restrictions: ```json @@ -107,7 +107,6 @@ same editable properties without creating drafts for each row. :::warning Note that this feature creates an additional entry point to your application. Custom handlers are triggered with delta payloads rather than the complete business object. - ::: ### Differences to Previous Version From 9607e59ee85f08873b30db5bc31590611ff76e9a Mon Sep 17 00:00:00 2001 From: Arley Triana Morin Date: Fri, 26 Jan 2024 16:52:36 +0100 Subject: [PATCH 05/11] Update node.js/fiori.md Co-authored-by: Johannes Vogel <31311694+johannes-vogel@users.noreply.github.com> --- node.js/fiori.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node.js/fiori.md b/node.js/fiori.md index a30951358..38b640f5e 100644 --- a/node.js/fiori.md +++ b/node.js/fiori.md @@ -105,7 +105,7 @@ This feature is required to enable SAP Fiori Elements Mass Edit, allowing users same editable properties without creating drafts for each row. :::warning -Note that this feature creates an additional entry point to your application. Custom handlers are triggered with delta +Note that this feature creates additional entry points to your application. Custom handlers are triggered with delta payloads rather than the complete business object. ::: From e64f078e1608e316d2acc162bfa3be2ca115ad04 Mon Sep 17 00:00:00 2001 From: Arley Triana Morin Date: Fri, 26 Jan 2024 16:58:04 +0100 Subject: [PATCH 06/11] add samples --- node.js/fiori.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/node.js/fiori.md b/node.js/fiori.md index 38b640f5e..803a1ee58 100644 --- a/node.js/fiori.md +++ b/node.js/fiori.md @@ -101,6 +101,27 @@ configuration to enable this feature and bypass draft restrictions: } ``` +You can then create active instances directly: + +```http +POST /Books + +{ + "ID": 123, + "IsActiveEntity": true +} +``` + +and modify them directly: + +```http +PATCH /Books(ID=123,IsActiveEntity=true) + +{ + "title": "How to be more active" +} +``` + This feature is required to enable SAP Fiori Elements Mass Edit, allowing users to change multiple objects with the same editable properties without creating drafts for each row. From 94c4c5e0d8f41491086857c5b9504491cf3850a2 Mon Sep 17 00:00:00 2001 From: Arley Triana Morin Date: Fri, 26 Jan 2024 17:00:43 +0100 Subject: [PATCH 07/11] add link to SAP Fiori Elements Mass Edit page --- node.js/fiori.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node.js/fiori.md b/node.js/fiori.md index 803a1ee58..2e48ec237 100644 --- a/node.js/fiori.md +++ b/node.js/fiori.md @@ -122,7 +122,7 @@ PATCH /Books(ID=123,IsActiveEntity=true) } ``` -This feature is required to enable SAP Fiori Elements Mass Edit, allowing users to change multiple objects with the +This feature is required to enable [SAP Fiori Elements Mass Edit](https://sapui5.hana.ondemand.com/sdk/#/topic/965ef5b2895641bc9b6cd44f1bd0eb4d.html), allowing users to change multiple objects with the same editable properties without creating drafts for each row. :::warning From 208d93b75d90a24f23b32f8d8c58df367245f63d Mon Sep 17 00:00:00 2001 From: Arley Triana Morin Date: Mon, 29 Jan 2024 12:00:13 +0100 Subject: [PATCH 08/11] Apply suggestions from code review Co-authored-by: Johannes Vogel <31311694+johannes-vogel@users.noreply.github.com> --- node.js/fiori.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/node.js/fiori.md b/node.js/fiori.md index 2e48ec237..531d706f2 100644 --- a/node.js/fiori.md +++ b/node.js/fiori.md @@ -86,10 +86,11 @@ To prevent inconsistency, the entities with draft are locked for modifications b cds.drafts.cancellationTimeout=1h ``` -### Bypassing Draft Restrictions +### Bypassing the SAP Fiori Draft Flow -Creating or modifying active instances directly is possible without creating a draft first. Add this to your cds -configuration to enable this feature and bypass draft restrictions: +Creating or modifying active instances directly is possible without creating drafts. This comes in handy when technical services without a UI interact with each other. + +To enable this feature, set this feature flag in your configuration: ```json { From 53b3012fd5488b2c57f5e776937461aa1aab374c Mon Sep 17 00:00:00 2001 From: Arley Triana Morin Date: Wed, 31 Jan 2024 12:16:59 +0100 Subject: [PATCH 09/11] Update node.js/fiori.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: René Jeglinsky --- node.js/fiori.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node.js/fiori.md b/node.js/fiori.md index f35b0751b..c782de469 100644 --- a/node.js/fiori.md +++ b/node.js/fiori.md @@ -113,7 +113,7 @@ POST /Books } ``` -and modify them directly: +You can modify them directly: ```http PATCH /Books(ID=123,IsActiveEntity=true) From 4126c6fd865f7698197fffc0fd175e6afcd4cf0c Mon Sep 17 00:00:00 2001 From: Arley Triana Morin Date: Wed, 31 Jan 2024 12:31:15 +0100 Subject: [PATCH 10/11] formatting --- node.js/fiori.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/node.js/fiori.md b/node.js/fiori.md index 73abf9b65..4f7aeec79 100644 --- a/node.js/fiori.md +++ b/node.js/fiori.md @@ -106,6 +106,7 @@ You can then create active instances directly: ```http POST /Books + { "ID": 123, "IsActiveEntity": true @@ -116,6 +117,7 @@ You can modify them directly: ```http PATCH /Books(ID=123,IsActiveEntity=true) + { "title": "How to be more active" } From ceb8c29cecf70d98ee62c576dd535fc758a2e1c3 Mon Sep 17 00:00:00 2001 From: Arley Triana Morin Date: Wed, 31 Jan 2024 12:33:01 +0100 Subject: [PATCH 11/11] fix merge conflict --- node.js/fiori.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/node.js/fiori.md b/node.js/fiori.md index 4f7aeec79..f93630e0b 100644 --- a/node.js/fiori.md +++ b/node.js/fiori.md @@ -133,6 +133,23 @@ payloads rather than the complete business object. ### Garbage Collection of Stale Drafts +Inactive drafts can be deleted automatically after a timeout. You can configure this timeout by the following configuration: + +```json +{ + "cds": { + "fiori": { + "draft_deletion_timeout": true + } + } +} +``` + +You can set the property to one of the following: +- `true` in order to obtain the default timeout of 30 days +- number of days like `'30d'` +- number of hours like `'72h'` +- number of milliseconds like `1000` ### Differences to Previous Version