From 26f43569918bc8ac89d8f69cfdedbfa76d0f03ef Mon Sep 17 00:00:00 2001 From: yashmeet29 <160218676+yashmeet29@users.noreply.github.com> Date: Tue, 29 Jul 2025 15:13:23 +0530 Subject: [PATCH 1/7] Update attachment-extension.cds --- cap-notebook/demoapp/srv/attachment-extension.cds | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cap-notebook/demoapp/srv/attachment-extension.cds b/cap-notebook/demoapp/srv/attachment-extension.cds index 1b5eb74f..b0ad504e 100644 --- a/cap-notebook/demoapp/srv/attachment-extension.cds +++ b/cap-notebook/demoapp/srv/attachment-extension.cds @@ -4,7 +4,7 @@ using {sap,managed,sap.common.CodeList} from '@sap/cds/common'; extend entity Books with { attachments : Composition of many Attachments @SDM.Attachments:{maxCount: 4, maxCountError:'Only 4 attachments allowed.'}; - references : Composition of many Attachments @SDM.Attachments:{maxCount: 2, maxCountError:'Only 2 attachments allowed.'}; + references : Composition of many Attachments @SDM.Attachments:{maxCount: 5, maxCountError:'Only 5 attachments allowed.'}; footnotes : Composition of many Attachments; } extend entity Notebooks with { From d86e784297adbc3985988b8bc794a875ba494cb0 Mon Sep 17 00:00:00 2001 From: vibhutikumar <160819926+vibhutikumar07@users.noreply.github.com> Date: Wed, 13 Aug 2025 10:59:46 +0530 Subject: [PATCH 2/7] Update pom.xml --- cap-notebook/demoapp/srv/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cap-notebook/demoapp/srv/pom.xml b/cap-notebook/demoapp/srv/pom.xml index 704fc693..af82f4eb 100644 --- a/cap-notebook/demoapp/srv/pom.xml +++ b/cap-notebook/demoapp/srv/pom.xml @@ -18,7 +18,7 @@ com.sap.cds sdm - 1.4.2-SNAPSHOT + 1.5.1-SNAPSHOT From 934e531df71f1bb2550809e168822972bb5b0837 Mon Sep 17 00:00:00 2001 From: vibhutikumar <160819926+vibhutikumar07@users.noreply.github.com> Date: Wed, 13 Aug 2025 11:00:02 +0530 Subject: [PATCH 3/7] Update pom.xml --- cap-notebook/demoapp/db/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cap-notebook/demoapp/db/pom.xml b/cap-notebook/demoapp/db/pom.xml index 5a63dc7e..190a05f6 100644 --- a/cap-notebook/demoapp/db/pom.xml +++ b/cap-notebook/demoapp/db/pom.xml @@ -16,7 +16,7 @@ com.sap.cds sdm - 1.4.2-SNAPSHOT + 1.5.1-SNAPSHOT From fd5f4cb60aca424e475b4fe4913e8a543b4c07af Mon Sep 17 00:00:00 2001 From: "Yashmeet ." Date: Mon, 18 Aug 2025 11:50:55 +0530 Subject: [PATCH 4/7] Changes in application for support of Link --- .../webapp/controller/custom.controller.js | 34 ++++++ .../app/admin-books/webapp/manifest.json | 32 ++++++ cap-notebook/demoapp/app/common.cds | 105 +++++++++++++----- cap-notebook/demoapp/app/index.html | 2 +- cap-notebook/demoapp/srv/admin-service.cds | 40 ++++++- 5 files changed, 183 insertions(+), 30 deletions(-) create mode 100644 cap-notebook/demoapp/app/admin-books/webapp/controller/custom.controller.js diff --git a/cap-notebook/demoapp/app/admin-books/webapp/controller/custom.controller.js b/cap-notebook/demoapp/app/admin-books/webapp/controller/custom.controller.js new file mode 100644 index 00000000..b45975be --- /dev/null +++ b/cap-notebook/demoapp/app/admin-books/webapp/controller/custom.controller.js @@ -0,0 +1,34 @@ +sap.ui.define( + [ + "sap/ui/core/mvc/ControllerExtension", + "sap/m/library" + ], + function (ControllerExtension,library) { + "use strict"; + + return ControllerExtension.extend("books.controller.custom", { + onRowPress: function(oContext) { + console.log(oContext); + this.base.editFlow + .invokeAction("AdminService.openAttachment", { + contexts: oContext.getParameter("bindingContext") + }) + .then(function (res) { + let odataurl = ""; + if(res.getObject().value == "None") { + const lastSlashIndex = res.oModel.getServiceUrl().lastIndexOf('/'); + let str = res.oModel.getServiceUrl(); + if (lastSlashIndex !== -1) { + str = str.substring(0, lastSlashIndex) + str.substring(lastSlashIndex + 1); + } + odataurl = str+res.oBinding.oContext.sPath+"/content"; + } else { + odataurl = res.getObject().value; + } + library.URLHelper.redirect(odataurl, true); + + }); + } + }); + } +); \ No newline at end of file diff --git a/cap-notebook/demoapp/app/admin-books/webapp/manifest.json b/cap-notebook/demoapp/app/admin-books/webapp/manifest.json index fadc830a..3d92bc9b 100644 --- a/cap-notebook/demoapp/app/admin-books/webapp/manifest.json +++ b/cap-notebook/demoapp/app/admin-books/webapp/manifest.json @@ -117,6 +117,29 @@ "route": "AuthorsDetails" } } + }, + "controlConfiguration": { + "attachments/@com.sap.vocabularies.UI.v1.LineItem": { + "tableSettings": { + "type": "ResponsiveTable", + "selectionMode": "Auto", + "rowPress": ".extension.books.controller.custom.onRowPress" + } + }, + "references/@com.sap.vocabularies.UI.v1.LineItem": { + "tableSettings": { + "type": "ResponsiveTable", + "selectionMode": "Auto", + "rowPress": ".extension.books.controller.custom.onRowPress" + } + }, + "footnotes/@com.sap.vocabularies.UI.v1.LineItem": { + "tableSettings": { + "type": "ResponsiveTable", + "selectionMode": "Auto", + "rowPress": ".extension.books.controller.custom.onRowPress" + } + } } } } @@ -133,6 +156,15 @@ } } }, + "extends": { + "extensions": { + "sap.ui.controllerExtensions": { + "sap.fe.templates.ObjectPage.ObjectPageController#books::BooksDetailsList": { + "controllerName": "books.controller.custom" + } + } + } + }, "contentDensities": { "compact": true, "cozy": true diff --git a/cap-notebook/demoapp/app/common.cds b/cap-notebook/demoapp/app/common.cds index c9120dfe..2031f349 100644 --- a/cap-notebook/demoapp/app/common.cds +++ b/cap-notebook/demoapp/app/common.cds @@ -59,22 +59,41 @@ annotate my.Books with @(UI : {HeaderInfo : { annotate my.Books.attachments with @UI: { HeaderInfo: { - $Type : 'UI.HeaderInfoType', - TypeName : '{i18n>Attachment}', - TypeNamePlural: '{i18n>Attachments}', + $Type : 'UI.HeaderInfoType', + TypeName : '{i18n>Attachment}', + TypeNamePlural: '{i18n>Attachments}', }, LineItem : [ - {Value: fileName, @HTML5.CssDefaults: {width: '20%'}}, - {Value: content, @HTML5.CssDefaults: {width: '20%'}}, + {Value: type, @HTML5.CssDefaults: {width: '10%'}}, + {Value: fileName, @HTML5.CssDefaults: {width: '25%'}}, + {Value: content, @HTML5.CssDefaults: {width: '0%'}}, {Value: createdAt, @HTML5.CssDefaults: {width: '20%'}}, {Value: createdBy, @HTML5.CssDefaults: {width: '20%'}}, - {Value: note, @HTML5.CssDefaults: {width: '20%'}}, + {Value: note, @HTML5.CssDefaults: {width: '25%'}}, { $Type : 'UI.DataFieldForAction', Label : 'Copy Attachments', Action: 'AdminService.copyAttachments', + }, + { + $Type : 'UI.DataFieldForActionGroup', + ID : 'TableActionGroup', + Label : 'Create', + ![@UI.Hidden]: {$edmJson: {$Eq: [ {$Path: 'IsActiveEntity'}, true ]}}, + Actions: [ + { + $Type : 'UI.DataFieldForAction', + Label : 'Link', + Action: 'AdminService.createLink', + } + ] + }, + { + $Type : 'UI.DataFieldForAction', + Label : 'Edit Link', + Action: 'AdminService.editLink', } - ] + ], } { note @(title: '{i18n>Note}'); @@ -102,18 +121,36 @@ annotate my.Books.references with @UI: { TypeNamePlural: '{i18n>Attachments}', }, LineItem : [ - {Value: fileName, @HTML5.CssDefaults: {width: '20%'}}, - {Value: content, @HTML5.CssDefaults: {width: '20%'}}, - {Value: createdAt, @HTML5.CssDefaults: {width: '20%'}}, - {Value: createdBy, @HTML5.CssDefaults: {width: '20%'}}, - {Value: note, @HTML5.CssDefaults: {width: '20%'}}, - + {Value: type, @HTML5.CssDefaults: {width: '10%'}}, + {Value: fileName, @HTML5.CssDefaults: {width: '25%'}}, + {Value: content, @HTML5.CssDefaults: {width: '0%'}}, + {Value: createdAt, @HTML5.CssDefaults: {width: '20%'}}, + {Value: createdBy, @HTML5.CssDefaults: {width: '20%'}}, + {Value: note, @HTML5.CssDefaults: {width: '25%'}}, + { + $Type : 'UI.DataFieldForAction', + Label : 'Copy Attachments', + Action: 'AdminService.copyAttachments', + }, + { + $Type : 'UI.DataFieldForActionGroup', + ID : 'TableActionGroup', + Label : 'Create', + ![@UI.Hidden]: {$edmJson: {$Eq: [ {$Path: 'IsActiveEntity'}, true ]}}, + Actions: [ { $Type : 'UI.DataFieldForAction', - Label : 'Copy Attachments', - Action: 'AdminService.copyAttachments', + Label : 'Link', + Action: 'AdminService.createLink', } - ] + ] + }, + { + $Type : 'UI.DataFieldForAction', + Label : 'Edit Link', + Action: 'AdminService.editLink', + } + ], } { note @(title: '{i18n>Note}'); fileName @(title: '{i18n>Filename}'); @@ -135,18 +172,36 @@ annotate my.Books.footnotes with @UI: { TypeNamePlural: '{i18n>Attachments}', }, LineItem : [ - {Value: fileName, @HTML5.CssDefaults: {width: '20%'}}, - {Value: content, @HTML5.CssDefaults: {width: '20%'}}, - {Value: createdAt, @HTML5.CssDefaults: {width: '20%'}}, - {Value: createdBy, @HTML5.CssDefaults: {width: '20%'}}, - {Value: note, @HTML5.CssDefaults: {width: '20%'}}, - + {Value: type, @HTML5.CssDefaults: {width: '10%'}}, + {Value: fileName, @HTML5.CssDefaults: {width: '25%'}}, + {Value: content, @HTML5.CssDefaults: {width: '0%'}}, + {Value: createdAt, @HTML5.CssDefaults: {width: '20%'}}, + {Value: createdBy, @HTML5.CssDefaults: {width: '20%'}}, + {Value: note, @HTML5.CssDefaults: {width: '25%'}}, + { + $Type : 'UI.DataFieldForAction', + Label : 'Copy Attachments', + Action: 'AdminService.copyAttachments', + }, + { + $Type : 'UI.DataFieldForActionGroup', + ID : 'TableActionGroup', + Label : 'Create', + ![@UI.Hidden]: {$edmJson: {$Eq: [ {$Path: 'IsActiveEntity'}, true ]}}, + Actions: [ { $Type : 'UI.DataFieldForAction', - Label : 'Copy Attachments', - Action: 'AdminService.copyAttachments', + Label : 'Link', + Action: 'AdminService.createLink', } - ] + ] + }, + { + $Type : 'UI.DataFieldForAction', + Label : 'Edit Link', + Action: 'AdminService.editLink', + } + ], } { note @(title: '{i18n>Note}'); fileName @(title: '{i18n>Filename}'); diff --git a/cap-notebook/demoapp/app/index.html b/cap-notebook/demoapp/app/index.html index f4721ad9..ab8ffe43 100644 --- a/cap-notebook/demoapp/app/index.html +++ b/cap-notebook/demoapp/app/index.html @@ -15,7 +15,7 @@ -