diff --git a/distro/changelog.xml b/distro/changelog.xml
index e154602..3979277 100644
--- a/distro/changelog.xml
+++ b/distro/changelog.xml
@@ -2,11 +2,13 @@
[Task #11127] Porting to new ws-thredds engine
+ [Feature #11325] Workspace: add New URL feature in the context menu of right pane
Issue #10831, Workspace download folder tomcat temp occupation
- issue
+ issue
+
diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java b/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java
index 70a4f07..f4fa445 100644
--- a/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java
+++ b/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java
@@ -1589,8 +1589,8 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
if(dgu.isValidForm()){
explorerPanel.getAsycTreePanel().mask(ConstantsExplorer.VALIDATINGOPERATION,ConstantsExplorer.LOADINGSTYLE);
-
- rpcWorkspaceService.createExternalUrl(parent, dgu.getName(), dgu.getDescription(), dgu.getUrl(), new AsyncCallback() {
+ GWT.log("parent: "+parent);
+ rpcWorkspaceService.createExternalUrl(parent.getIdentifier(), dgu.getName(), dgu.getDescription(), dgu.getUrl(), new AsyncCallback() {
@Override
public void onFailure(Throwable caught) {
@@ -1602,10 +1602,12 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override
public void onSuccess(FileModel child) {
-
- explorerPanel.getAsycTreePanel().addItem(parent.getIdentifier(), child, false);
explorerPanel.getAsycTreePanel().unmask();
- notifySubscriber(createUrlEvent);
+ eventBus.fireEvent(new CompletedFileUploadEvent(parent.getIdentifier(), child.getIdentifier(), WS_UPLOAD_TYPE.File, false));
+
+// explorerPanel.getAsycTreePanel().addItem(parent.getIdentifier(), child, false);
+// explorerPanel.getAsycTreePanel().unmask();
+// notifySubscriber(createUrlEvent);
}
});
}
diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/rpc/GWTWorkspaceService.java b/src/main/java/org/gcube/portlets/user/workspace/client/rpc/GWTWorkspaceService.java
index b74da3a..07fa397 100644
--- a/src/main/java/org/gcube/portlets/user/workspace/client/rpc/GWTWorkspaceService.java
+++ b/src/main/java/org/gcube/portlets/user/workspace/client/rpc/GWTWorkspaceService.java
@@ -197,17 +197,18 @@ public interface GWTWorkspaceService extends RemoteService{
*/
public GWTWorkspaceItem getUrlById(String identifier, boolean isInternalUrl, boolean fullDetails) throws Exception;
+
/**
* Creates the external url.
*
- * @param parentFileModel the parent file model
+ * @param parentId the parent id
* @param name the name
* @param description the description
* @param url the url
* @return the file model
* @throws Exception the exception
*/
- public FileModel createExternalUrl(FileModel parentFileModel, String name, String description, String url) throws Exception;
+ public FileModel createExternalUrl(String parentId, String name, String description, String url) throws Exception;
/**
* Sets the value in session.
diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/rpc/GWTWorkspaceServiceAsync.java b/src/main/java/org/gcube/portlets/user/workspace/client/rpc/GWTWorkspaceServiceAsync.java
index 60e1c63..27fb526 100644
--- a/src/main/java/org/gcube/portlets/user/workspace/client/rpc/GWTWorkspaceServiceAsync.java
+++ b/src/main/java/org/gcube/portlets/user/workspace/client/rpc/GWTWorkspaceServiceAsync.java
@@ -214,16 +214,9 @@ public interface GWTWorkspaceServiceAsync {
*/
void getUrlById(String identifier, boolean isInternalUrl, boolean fullDetails, AsyncCallback callback);
- /**
- * Creates the external url.
- *
- * @param parentFileModel the parent file model
- * @param name the name
- * @param description the description
- * @param url the url
- * @param callback the callback
- */
- void createExternalUrl(FileModel parentFileModel, String name, String description, String url, AsyncCallback callback);
+ void createExternalUrl(
+ String parentId, String name, String description, String url,
+ AsyncCallback callback);
/**
* Sets the value in session.
diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/AsyncTreePanel.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/AsyncTreePanel.java
index e14378a..abcb9cd 100644
--- a/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/AsyncTreePanel.java
+++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/AsyncTreePanel.java
@@ -1126,12 +1126,12 @@ public class AsyncTreePanel extends LayoutContainer {
*
* @param parentId the parent id
* @param child the child
- * @param bool the bool
+ * @param addChildren the add children
*/
- public void addItem(String parentId, FileModel child, boolean bool) {
+ public void addItem(String parentId, FileModel child, boolean addChildren) {
FileModel parent = getFileModelByIdentifier(parentId);
if(parent!=null)
- addItem(parent,child,bool);
+ addItem(parent,child,addChildren);
}
@@ -1140,10 +1140,10 @@ public class AsyncTreePanel extends LayoutContainer {
*
* @param parent the parent
* @param child the child
- * @param bool the bool
+ * @param addChildren the add children
*/
- private void addItem(FileModel parent, FileModel child, boolean bool) {
- store.add(parent, child, bool);
+ private void addItem(FileModel parent, FileModel child, boolean addChildren) {
+ store.add(parent, child, addChildren);
}
/**
diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/ContextMenuTree.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/ContextMenuTree.java
index 817a862..3087a76 100644
--- a/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/ContextMenuTree.java
+++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/ContextMenuTree.java
@@ -421,7 +421,13 @@ public class ContextMenuTree {
FileModel selected = listSelectedItems.get(0);
- FileModel parent = getDirectoryOrParent(selected);
+ FileModel parent = selected.getParentFileModel();
+ if(parent==null){
+ if(selected.isDirectory()){
+ parent = selected;
+ }
+ }
+ //FileModel parent = getDirectoryOrParent(selected);
if(parent!=null){
eventBus.fireEvent(new CreateUrlEvent(null, parent));
@@ -744,7 +750,7 @@ public class ContextMenuTree {
clearListSelectedItems();
listSelectedItems.add(0, targetFileModel);
- printSelected();
+ //printSelected();
if(targetFileModel!=null){
@@ -796,7 +802,7 @@ public class ContextMenuTree {
contextMenu.getItemByItemId(WorkspaceOperation.WEBDAV_URL.getId()).setVisible(false); //set invisible webdav url
contextMenu.getItemByItemId(WorkspaceOperation.UPLOAD_FILE.getId()).setVisible(false); //set invisible upload file
contextMenu.getItemByItemId(WorkspaceOperation.UPLOAD_ARCHIVE.getId()).setVisible(false); //set invisible upload archive
- contextMenu.getItemByItemId(WorkspaceOperation.ADD_URL.getId()).setVisible(false); //set invisible add url
+ //contextMenu.getItemByItemId(WorkspaceOperation.ADD_URL.getId()).setVisible(false); //set invisible add url
contextMenu.getItemByItemId(WorkspaceOperation.REFRESH_FOLDER.getId()).setVisible(false); //set invisible refresh
contextMenu.showAt(posX, posY);
}
@@ -808,7 +814,7 @@ public class ContextMenuTree {
private void printSelected(){
for (FileModel sel: listSelectedItems) {
- System.out.println("selected " +sel.getName() );
+ GWT.log("selected " +sel.getName() );
}
}
diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java
index 93374b3..65387cc 100644
--- a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java
+++ b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java
@@ -1528,10 +1528,11 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
/* (non-Javadoc)
* @see org.gcube.portlets.user.workspace.client.rpc.GWTWorkspaceService#createExternalUrl(org.gcube.portlets.user.workspace.client.model.FileModel, java.lang.String, java.lang.String, java.lang.String)
*/
+
/**
* Creates the external url.
*
- * @param parentFileModel the parent file model
+ * @param parentId the parent id
* @param name the name
* @param description the description
* @param url the url
@@ -1539,19 +1540,23 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
* @throws Exception the exception
*/
@Override
- public FileModel createExternalUrl(FileModel parentFileModel, String name, String description, String url) throws Exception {
+ public FileModel createExternalUrl(String parentId, String name, String description, String url) throws Exception {
try {
Workspace workspace = getWorkspace();
- if(parentFileModel==null)
- throw new Exception("Parent item is null");
+ if(parentId==null){
+ workspaceLogger.error("Error on creating url. Parent ID is null");
+ throw new Exception("Parent ID is null");
+ }
- workspaceLogger.trace("create url in parent id: "+parentFileModel.getIdentifier());
- ExternalUrl ext = workspace.createExternalUrl(name, description, url, parentFileModel.getIdentifier());
- WorkspaceItem parent = workspace.getItem(parentFileModel.getIdentifier()); //get item from workspace
+ workspaceLogger.trace("create url in parent id: "+parentId);
+ ExternalUrl ext = workspace.createExternalUrl(name, description, url, parentId);
+ WorkspaceItem parent = workspace.getItem(parentId); //get item from workspace
workspaceLogger.trace("parent name " + parent.getName());
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
+
+ FolderModel parentFileModel = builder.buildGXTFolderModelItem((WorkspaceFolder) parent, null);
return builder.buildGXTFileModelItem(ext, parentFileModel);
} catch (Exception e) {