From af2b4e342ac08f9ff2d6a8eeb8940e9cefd16a07 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Mon, 22 Mar 2021 12:12:07 +0100 Subject: [PATCH] Improved style-sheets. Improved mapping ws bean to resource bean --- .../client/ui/form/CreateDatasetForm.ui.xml | 157 +++++++++++------- .../SelectResourceByWEMainPanel.ui.xml | 14 +- .../server/utils/WorkspaceUtils.java | 26 ++- 3 files changed, 121 insertions(+), 76 deletions(-) diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/CreateDatasetForm.ui.xml b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/CreateDatasetForm.ui.xml index eb22060..c74c815 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/CreateDatasetForm.ui.xml +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/CreateDatasetForm.ui.xml @@ -1,6 +1,7 @@ .form-main-style { @@ -45,7 +46,7 @@ font-weight: bold; } - .the-margin-left{ + .the-margin-left { margin-left: 5px; } @@ -64,8 +65,9 @@ - + @@ -73,13 +75,15 @@ Title : - + - + @@ -87,18 +91,21 @@ - + Description: - - + @@ -118,7 +125,8 @@ - + @@ -126,7 +134,8 @@ - Selected + Selected License Url: @@ -138,7 +147,8 @@ - Visibility: + Visibility: @@ -149,7 +159,8 @@ - + @@ -162,7 +173,8 @@ to publish the item">Publish in: + width="91%" title="Publish in this organization" + ui:field="organizationsListbox"> @@ -173,8 +185,9 @@ Version: - + @@ -185,13 +198,14 @@ + placeholder="Joe Bloggs" enabled="false" b:id="author" + title="Item author" ui:field="authorTextbox" /> - + @@ -199,7 +213,8 @@ - + * Author Email: @@ -211,7 +226,8 @@ - + @@ -219,18 +235,20 @@ - + Maintainer: - + - + @@ -238,18 +256,21 @@ - + Maintainer Email: - - + - + @@ -257,7 +278,8 @@ - Types: + Types: - + @@ -277,10 +300,11 @@ - Item Groups: + Item Groups: - @@ -288,7 +312,8 @@ - + @@ -302,12 +327,12 @@ - + - Continue + Continue Reset @@ -318,18 +343,20 @@ ui:field="formSecondStep" visible="false"> - Manage Resources + Select Item Resources - - - - - - - - + + + + + + + + - + - + @@ -380,18 +409,22 @@ - + - + Go to the Item - + Add Resources + block="true" type="PRIMARY" visible="false" + ui:field="addResourcesButton">Add Resources Create diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/SelectResourceByWEMainPanel.ui.xml b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/SelectResourceByWEMainPanel.ui.xml index c9a42e0..0f6a912 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/SelectResourceByWEMainPanel.ui.xml +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/SelectResourceByWEMainPanel.ui.xml @@ -8,11 +8,9 @@ } .custom-header { - margin-top: 0px !important; - } - - .custom-header h1 { + margin: 0; font-size: 18px !important; + color: #222; } .max-height-250 { @@ -24,14 +22,14 @@ margin-top: 10px; } - .margin-top-20 { - margin-top: 20px; + .margin-top-30 { + margin-top: 30px; } - Select Item Resources + Selected Items @@ -40,7 +38,7 @@ + addStyleNames="{style.margin-top-30}"> diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/WorkspaceUtils.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/WorkspaceUtils.java index 62f3c08..82ec1b6 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/WorkspaceUtils.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/WorkspaceUtils.java @@ -111,7 +111,6 @@ public class WorkspaceUtils { public static void toWorkspaceResource(String wsItemId, String userName, DatasetBean bean, Workspace workspace) throws Exception { - WorkspaceItem originalFolderOrFile = workspace.getItem(wsItemId); logger.debug("Item retrieved is " + originalFolderOrFile); @@ -149,14 +148,29 @@ public class WorkspaceUtils { bean.setCustomFields(tempItems); } - String pathSeparator = "/"; - String fullPathBase = originalFolderOrFile.getPath(); - fullPathBase = fullPathBase.endsWith(pathSeparator) ? fullPathBase : fullPathBase + pathSeparator; - resourceEB.setFullPath(originalFolderOrFile.getPath().replace(fullPathBase, "")); resourceEB.setChildrenSize(workspace.getChildren(originalFolderOrFile.getId()).size()); - //WorkspaceUtils.extractEditableNameFromPath(resourceEB, pathSeparator); + }else { + //it is a file, removing extension + int indexOfDot = title.lastIndexOf("."); + String suffix = title.substring(indexOfDot, title.length()); + if(suffix.length()>=1 && suffix.length()<=4) { + //I'm considering last .suffix as an file extension so removing it. + title = title.substring(0,indexOfDot); + bean.setTitle(title); + } } + //Replacing /Home/user.name with "" + String fullPathBase = originalFolderOrFile.getPath(); + logger.debug("Path is: "+fullPathBase); + String prefixNodeWorkspace = String.format("/%s/%s", "Home",userName); + logger.debug("Searching: "+prefixNodeWorkspace); + if(fullPathBase.startsWith(prefixNodeWorkspace)){ + logger.info("Removing from path the prefix: "+prefixNodeWorkspace); + fullPathBase = fullPathBase.replaceFirst(prefixNodeWorkspace, ""); + } + resourceEB.setFullPath(fullPathBase); + //setting parent id ResourceElementBean theParent = new ResourceElementBean();