merged with feature branch 19058

task/19600
Francesco Mangiacrapa 4 years ago
parent f762111333
commit cf6dedbf12

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/workspace-6.23.2/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/workspace-6.24.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/workspace-6.23.2/WEB-INF/classes" path="src/main/resources">
<classpathentry excluding="**" kind="src" output="target/workspace-6.24.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
@ -35,5 +35,5 @@
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/workspace-6.23.2/WEB-INF/classes"/>
<classpathentry kind="output" path="target/workspace-6.24.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

@ -1,4 +1,4 @@
eclipse.preferences.version=1
lastWarOutDir=/home/francesco/git/workspace/target/workspace-6.23.2
lastWarOutDir=/home/francesco/git/workspace/target/workspace-6.24.0-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="workspace-6.23.2">
<wb-module deploy-name="workspace-6.24.0-SNAPSHOT">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>

@ -1,5 +1,5 @@
# Changelog
# Changelog for workspace
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

@ -20,7 +20,7 @@
Every user of any Virtual Research Environment is provided with this area for the exchange of workspace objects (share) with other users.
Such an area is further organized in workspaces as to resemble a classic folder-based file system.
</description>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.7.0</gwtVersion>
@ -33,13 +33,13 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<scm>
<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</connection>
<developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</developerConnection>
<url>https://code-repo.d4science.org/gCubeSystem/${project.artifactId}</url>
</scm>
<dependencyManagement>
<dependencies>
@ -77,14 +77,14 @@
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<!-- PORTAL MANAGER -->
<dependency>
<groupId>org.gcube.common.portal</groupId>
<artifactId>portal-manager</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
@ -156,20 +156,10 @@
<scope>compile</scope>
</dependency>
<!-- WebSocket dep (does not work on Jetty)
<dependency>
<groupId>org.realityforge.gwt.websockets</groupId>
<artifactId>gwt-websockets</artifactId>
<version>1.1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
-->
<!-- WebSocket dep (does not work on Jetty) <dependency> <groupId>org.realityforge.gwt.websockets</groupId>
<artifactId>gwt-websockets</artifactId> <version>1.1.2</version> <scope>provided</scope>
</dependency> <dependency> <groupId>javax.websocket</groupId> <artifactId>javax.websocket-api</artifactId>
<version>1.1</version> <scope>provided</scope> </dependency> -->
<!-- FWS -->
<dependency>
<groupId>org.gcube.resources.discovery</groupId>
@ -261,6 +251,11 @@
<artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>junit</groupId>

@ -116,7 +116,13 @@ import org.gcube.portlets.widgets.workspacesharingwidget.client.rpc.WorkspaceSha
import org.gcube.portlets.widgets.workspacesharingwidget.shared.ExtendedWorkspaceACL;
import org.gcube.portlets.widgets.workspaceuploader.client.WorkspaceUploadNotification.WorskpaceUploadNotificationListener;
import org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload;
import org.gcube.portlets.widgets.wsexplorer.client.WorkspaceExplorerConstants;
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
import org.gcube.portlets.widgets.wsexplorer.client.select.WorkspaceExplorerSelectDialog;
import org.gcube.portlets.widgets.wsexplorer.client.view.grid.ItemsTable.DISPLAY_FIELD;
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
import com.extjs.gxt.ui.client.core.XDOM;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
@ -2072,86 +2078,143 @@ public class AppController implements SubscriberInterface {
if(operation==null)
return;
switch (operation) {
case SHOW:
WindowTrash.getInstance().show();
break;
case DELETE_PERMANENTLY:
case RESTORE:{
if(trashItemIds==null || trashItemIds.isEmpty())
return;
WindowTrash.getInstance().maskContainer("Updating Trash");
List<String> trashIds = new ArrayList<String>(trashItemIds.size());
GWT.log("Trash items are: "+trashItemIds);
List<String> trashIds = null;
if(trashItemIds!=null) {
//creating list of trash ids
trashIds = new ArrayList<String>(trashItemIds.size());
for (FileModel fileModel : trashItemIds) {
trashIds.add(fileModel.getIdentifier());
}
AppControllerExplorer.rpcWorkspaceService.executeOperationOnTrash(trashIds, operation, new AsyncCallback<TrashOperationContent>() {
@Override
public void onFailure(Throwable arg0) {
WindowTrash.getInstance().unmaskContainer();
}
@Override
public void onSuccess(TrashOperationContent operationResult) {
WindowTrash.getInstance().executeOperationOnTrashContainer(operationResult.getListTrashIds(), operationResult.getOperation());
wsPortlet.getGxtCardLayoutResultPanel().getToolBarItemDetails().updateTrashIcon(WindowTrash.getInstance().getTrashedFiles().size()>0);
//SHOW POSSIBLY ERRORS
WindowTrash.getInstance().showTrashErrors(operation, operationResult.getListErrors());
if(operation.equals(WorkspaceTrashOperation.RESTORE)){
appContrExplorer.refreshRoot(true);
}
WindowTrash.getInstance().unmaskContainer();
}
});
break;
}
switch (operation) {
default:{
WindowTrash.getInstance().maskContainer("Updating Trash");
AppControllerExplorer.rpcWorkspaceService.updateTrashContent(operation, new AsyncCallback<TrashContent>() {
@Override
public void onFailure(Throwable arg0) {
WindowTrash.getInstance().unmaskContainer();
}
@Override
public void onSuccess(TrashContent operationResult) {
WindowTrash.getInstance().updateTrashContainer(operationResult.getTrashContent());
wsPortlet.getGxtCardLayoutResultPanel().getToolBarItemDetails().updateTrashIcon(operationResult.getTrashContent().size()>0);
//SHOW POSSIBLY ERRORS
WindowTrash.getInstance().showTrashErrors(operation, operationResult.getListErrors());
if(operation.equals(WorkspaceTrashOperation.RESTORE_ALL)){
appContrExplorer.refreshRoot(true);
case SHOW:
WindowTrash.getInstance().show();
break;
case DELETE_PERMANENTLY:
if(trashIds==null || trashIds.isEmpty())
return;
WindowTrash.getInstance().maskContainer("Updating Trash");
AppControllerExplorer.rpcWorkspaceService.executeOperationOnTrash(trashIds, null, operation, new AsyncCallback<TrashOperationContent>() {
@Override
public void onFailure(Throwable arg0) {
WindowTrash.getInstance().unmaskContainer();
}
@Override
public void onSuccess(TrashOperationContent operationResult) {
WindowTrash.getInstance().executeOperationOnTrashContainer(operationResult.getListTrashIds(), operationResult.getOperation());
wsPortlet.getGxtCardLayoutResultPanel().getToolBarItemDetails().updateTrashIcon(WindowTrash.getInstance().getTrashedFiles().size()>0);
//SHOW THE ERRORS IF OCCURRED
WindowTrash.getInstance().showTrashErrors(operation, operationResult.getListErrors());
WindowTrash.getInstance().unmaskContainer();
}
});
break;
case RESTORE:
if(trashIds==null || trashIds.isEmpty())
return;
final List<String> toTrashIds = trashIds;
WindowTrash.getInstance().maskContainer("Updating Trash");
WorkspaceExplorerConstants.SELECT = "Restore";
DISPLAY_FIELD[] displayFields = new DISPLAY_FIELD[] { DISPLAY_FIELD.ICON, DISPLAY_FIELD.NAME,
DISPLAY_FIELD.OWNER };
final WorkspaceExplorerSelectDialog navigator = new WorkspaceExplorerSelectDialog("Restore to...", true, rootIdentifier, "", displayFields);
int topZIndex = XDOM.getTopZIndex();
WorskpaceExplorerSelectNotificationListener listener = new WorskpaceExplorerSelectNotificationListener() {
@Override
public void onSelectedItem(Item item) {
AppControllerExplorer.rpcWorkspaceService.executeOperationOnTrash(toTrashIds, item.getId(), operation, new AsyncCallback<TrashOperationContent>() {
@Override
public void onFailure(Throwable arg0) {
WindowTrash.getInstance().unmaskContainer();
}
@Override
public void onSuccess(TrashOperationContent operationResult) {
WindowTrash.getInstance().executeOperationOnTrashContainer(operationResult.getListTrashIds(), operationResult.getOperation());
wsPortlet.getGxtCardLayoutResultPanel().getToolBarItemDetails().updateTrashIcon(WindowTrash.getInstance().getTrashedFiles().size()>0);
//SHOW THE ERRORS IF OCCURRED
WindowTrash.getInstance().showTrashErrors(operation, operationResult.getListErrors());
appContrExplorer.refreshRoot(true);
WindowTrash.getInstance().unmaskContainer();
}
});
}
@Override
public void onAborted() {
WindowTrash.getInstance().unmaskContainer();
}
@Override
public void onFailed(Throwable throwable) {
Window.alert("Error: "+throwable.getMessage());
WindowTrash.getInstance().unmaskContainer();
}
@Override
public void onNotValidSelection() {
}
};
navigator.addWorkspaceExplorerSelectNotificationListener(listener);
navigator.setZIndex(topZIndex+10);
navigator.show();
break;
WindowTrash.getInstance().unmaskContainer();
}
});
break;
}
default:{
WindowTrash.getInstance().maskContainer("Updating Trash");
GWT.log("Performing trash operation: "+operation);
AppControllerExplorer.rpcWorkspaceService.updateTrashContent(operation, new AsyncCallback<TrashContent>() {
@Override
public void onFailure(Throwable arg0) {
WindowTrash.getInstance().unmaskContainer();
}
@Override
public void onSuccess(TrashContent operationResult) {
GWT.log("Returned from operation: "+operation + " with result: "+operationResult);
WindowTrash.getInstance().updateTrashContainer(operationResult.getTrashContent());
wsPortlet.getGxtCardLayoutResultPanel().getToolBarItemDetails().updateTrashIcon(operationResult.getTrashContent().size()>0);
//SHOW POSSIBLY ERRORS
WindowTrash.getInstance().showTrashErrors(operation, operationResult.getListErrors());
if(operation.equals(WorkspaceTrashOperation.RESTORE_ALL)){
appContrExplorer.refreshRoot(true);
}
WindowTrash.getInstance().unmaskContainer();
}
});
}
}
}

@ -1,6 +1,5 @@
package org.gcube.portlets.user.workspace.client.view.trash;
import java.util.ArrayList;
import java.util.List;
import org.gcube.portlets.user.workspace.client.AppController;
@ -8,6 +7,7 @@ import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
import org.gcube.portlets.user.workspace.client.event.UpdateWorkspaceSizeEvent;
import org.gcube.portlets.user.workspace.client.model.FileTrashedModel;
import org.gcube.portlets.user.workspace.client.resources.Resources;
import org.gcube.portlets.user.workspace.shared.TrashOperationError;
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
@ -209,29 +209,25 @@ public class WindowTrash extends Window {
setIcon(Resources.getTrashEmpty());
}
public void showTrashErrors(WorkspaceTrashOperation operation, List<FileTrashedModel> errors){
public void showTrashErrors(WorkspaceTrashOperation operation, List<TrashOperationError> errors){
if(errors!=null && errors.size()>0){
List<String> fileNames = new ArrayList<String>(errors.size());
//BUILDING NAMES
for (FileTrashedModel fileTrashedModel : errors) {
FileTrashedModel trashFile = trashContainers.getFileModelByIdentifier(fileTrashedModel.getIdentifier());
fileNames.add(trashFile.getName());
}
String htmlError = "<div style=\"padding:10px 10px 10px 10px\"><b style=\"font-size:12px\">Sorry an error occured on removing the ";
htmlError+=fileNames.size()>1?"items":"item";
String htmlError = "<div style=\"padding:10px 10px 10px 10px\"><b style=\"font-size:12px\">"+operation.getLabel() +" error";
htmlError+=": </b><br/>";
for (String fileName : fileNames) {
htmlError+="<br/> - "+fileName;
//BUILDING the ERROR MSG TO SHOW
for (TrashOperationError trashOperationError : errors) {
if(trashOperationError.getErroMsg()!=null)
htmlError+="<br/> - "+trashOperationError.getErroMsg();
else {
FileTrashedModel trashFile = trashContainers.getFileModelByIdentifier(trashOperationError.getTrashedFile().getIdentifier());
htmlError+="<br/> - "+trashFile.getName();
}
}
htmlError+="<br/><br/><b>"+"Try again later</b></div>";
Dialog dialog = new Dialog();
dialog.setStyleAttribute("background-color", "#FAFAFA");
dialog.setSize(380, 180);

Loading…
Cancel
Save