added update workspace size after upload and remove operations
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@101273 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
bd302bc3dc
commit
7554afbb3f
|
@ -48501,3 +48501,99 @@ Compiling...
|
|||
Compilation completed in 0.00 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
Public resources found in...
|
||||
Translatable source found in...
|
||||
Found 0 cached/archived units. Used 0 / 2719 units from cache.
|
||||
Compiling...
|
||||
0% complete (ETR: 59 seconds)
|
||||
10% complete (ETR: 55 seconds)
|
||||
20% complete (ETR: 32 seconds)
|
||||
30% complete (ETR: 24 seconds)
|
||||
40% complete (ETR: 17 seconds)
|
||||
50% complete (ETR: 12 seconds)
|
||||
60% complete (ETR: 9 seconds)
|
||||
70% complete (ETR: 6 seconds)
|
||||
80% complete (ETR: 4 seconds)
|
||||
90% complete (ETR: 2 seconds)
|
||||
100% complete (ETR: 0 seconds)
|
||||
Compilation completed in 24.90 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
Public resources found in...
|
||||
Translatable source found in...
|
||||
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
|
||||
Compiling...
|
||||
Compilation completed in 0.00 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
Public resources found in...
|
||||
Translatable source found in...
|
||||
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
|
||||
Compiling...
|
||||
Compilation completed in 0.00 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
Public resources found in...
|
||||
Translatable source found in...
|
||||
Found 0 cached/archived units. Used 0 / 2719 units from cache.
|
||||
Compiling...
|
||||
30% complete (ETR: 9 seconds)
|
||||
30% complete (ETR: 9 seconds)
|
||||
30% complete (ETR: 9 seconds)
|
||||
30% complete (ETR: 9 seconds)
|
||||
40% complete (ETR: 8 seconds)
|
||||
50% complete (ETR: 6 seconds)
|
||||
60% complete (ETR: 4 seconds)
|
||||
70% complete (ETR: 3 seconds)
|
||||
80% complete (ETR: 2 seconds)
|
||||
90% complete (ETR: 1 seconds)
|
||||
100% complete (ETR: 0 seconds)
|
||||
Compilation completed in 18.82 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
Public resources found in...
|
||||
Translatable source found in...
|
||||
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
|
||||
Compiling...
|
||||
Compilation completed in 0.00 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
Public resources found in...
|
||||
Translatable source found in...
|
||||
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
|
||||
Compiling...
|
||||
Compilation completed in 0.00 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
Public resources found in...
|
||||
Translatable source found in...
|
||||
Found 0 cached/archived units. Used 0 / 2719 units from cache.
|
||||
Compiling...
|
||||
40% complete (ETR: 7 seconds)
|
||||
40% complete (ETR: 7 seconds)
|
||||
40% complete (ETR: 7 seconds)
|
||||
40% complete (ETR: 7 seconds)
|
||||
40% complete (ETR: 7 seconds)
|
||||
50% complete (ETR: 5 seconds)
|
||||
60% complete (ETR: 4 seconds)
|
||||
70% complete (ETR: 3 seconds)
|
||||
80% complete (ETR: 2 seconds)
|
||||
90% complete (ETR: 1 seconds)
|
||||
100% complete (ETR: 0 seconds)
|
||||
Compilation completed in 21.98 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
Public resources found in...
|
||||
Translatable source found in...
|
||||
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
|
||||
Compiling...
|
||||
Compilation completed in 0.00 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
Public resources found in...
|
||||
Translatable source found in...
|
||||
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
|
||||
Compiling...
|
||||
Compilation completed in 0.00 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
|
|
|
@ -90,6 +90,8 @@ import org.gcube.portlets.user.workspace.client.event.TrashEvent;
|
|||
import org.gcube.portlets.user.workspace.client.event.TrashEventHandler;
|
||||
import org.gcube.portlets.user.workspace.client.event.UnShareFolderEvent;
|
||||
import org.gcube.portlets.user.workspace.client.event.UnShareFolderEventHandler;
|
||||
import org.gcube.portlets.user.workspace.client.event.UpdateWorkspaceSizeEvent;
|
||||
import org.gcube.portlets.user.workspace.client.event.UpdateWorkspaceSizeEventHandler;
|
||||
import org.gcube.portlets.user.workspace.client.event.UpdatedVREPermissionEvent;
|
||||
import org.gcube.portlets.user.workspace.client.event.UpdatedVREPermissionEventHandler;
|
||||
import org.gcube.portlets.user.workspace.client.event.VRESettingPermissionEvent;
|
||||
|
@ -206,6 +208,14 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
}
|
||||
|
||||
private void bind() {
|
||||
|
||||
eventBus.addHandler(UpdateWorkspaceSizeEvent.TYPE, new UpdateWorkspaceSizeEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onUpdateWorkspaceSize(UpdateWorkspaceSizeEvent updateWorkspaceSizeEvent) {
|
||||
doUpdateWorkspaceSize(updateWorkspaceSizeEvent);
|
||||
}
|
||||
});
|
||||
|
||||
eventBus.addHandler(RenderForm.TYPE, new RenderFormEventHandler() {
|
||||
@Override
|
||||
|
@ -1167,8 +1177,8 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(completedFileUploadEvent.getTargetFolderModel().getIdentifier(), isLevelExpanded);
|
||||
}
|
||||
|
||||
doUpdateWorkspaceSize(new UpdateWorkspaceSizeEvent());
|
||||
notifySubscriber(completedFileUploadEvent);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1402,6 +1412,8 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
}
|
||||
|
||||
notifySubscriber(event);
|
||||
doUpdateWorkspaceSize(new UpdateWorkspaceSizeEvent());
|
||||
// eventBus.fireEvent(new UpdateWorkspaceSizeEvent());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1787,6 +1799,14 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param updateWorkspaceSizeEvent
|
||||
*
|
||||
*/
|
||||
protected void doUpdateWorkspaceSize(UpdateWorkspaceSizeEvent updateWorkspaceSizeEvent) {
|
||||
notifySubscriber(updateWorkspaceSizeEvent);
|
||||
}
|
||||
|
||||
public static native String portalURL()/*-{
|
||||
return $wnd.location.href;
|
||||
}-*/;
|
||||
|
@ -1944,6 +1964,8 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
UpdatedVREPermissionEvent vreEvent = (UpdatedVREPermissionEvent) event;
|
||||
sub.updatedVREPermissions(vreEvent.getVreFolderId());
|
||||
|
||||
}else if(event instanceof UpdateWorkspaceSizeEvent){
|
||||
sub.updateWorksapaceSize(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
package org.gcube.portlets.user.workspace.client.event;
|
||||
|
||||
import org.gcube.portlets.user.workspace.client.interfaces.EventsTypeEnum;
|
||||
import org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* @Oct 30, 2014
|
||||
*
|
||||
*/
|
||||
public class UpdateWorkspaceSizeEvent extends GwtEvent<UpdateWorkspaceSizeEventHandler> implements GuiEventInterface{
|
||||
public static Type<UpdateWorkspaceSizeEventHandler> TYPE = new Type<UpdateWorkspaceSizeEventHandler>();
|
||||
|
||||
|
||||
public UpdateWorkspaceSizeEvent() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type<UpdateWorkspaceSizeEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dispatch(UpdateWorkspaceSizeEventHandler handler) {
|
||||
handler.onUpdateWorkspaceSize(this);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface#getKey()
|
||||
*/
|
||||
@Override
|
||||
public EventsTypeEnum getKey() {
|
||||
return EventsTypeEnum.UPDATE_WORKSPACE_SIZE;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package org.gcube.portlets.user.workspace.client.event;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* @Oct 30, 2014
|
||||
*
|
||||
*/
|
||||
public interface UpdateWorkspaceSizeEventHandler extends EventHandler {
|
||||
|
||||
/**
|
||||
* @param updateWorkspaceSizeEvent
|
||||
*/
|
||||
void onUpdateWorkspaceSize(UpdateWorkspaceSizeEvent updateWorkspaceSizeEvent);
|
||||
}
|
|
@ -32,5 +32,6 @@ public enum EventsTypeEnum
|
|||
COPY_EVENT,
|
||||
TRASH_EVENT,
|
||||
UPDATED_VRE_PERMISSION,
|
||||
UPDATE_WORKSPACE_SIZE,
|
||||
ADD_ADMINISTRATOR_EVENT;
|
||||
}
|
|
@ -72,4 +72,6 @@ public interface SubscriberInterface {
|
|||
*/
|
||||
void changedFileModelId(String oldId, String newId);
|
||||
|
||||
void updateWorksapaceSize(boolean delayCall);
|
||||
|
||||
}
|
||||
|
|
|
@ -76,28 +76,7 @@ public class UpdateServiceUploader extends Window{
|
|||
throw new Exception("File absolute path on server is null");
|
||||
|
||||
String parameters = "";
|
||||
|
||||
/* parameters+=ConstantsExplorer.UPLOAD_FORM_ELEMENT+"="+fileName+"&";
|
||||
|
||||
|
||||
if(parent.getIdentifier()!=null && !parent.getIdentifier().isEmpty())
|
||||
parameters+=ConstantsExplorer.ID_FOLDER+"="+parent.getIdentifier()+"&";
|
||||
else
|
||||
throw new Exception("Parent Folder ID parameter is null or empty");
|
||||
|
||||
if(uploadType!=null && !uploadType.isEmpty())
|
||||
parameters+=ConstantsExplorer.UPLOAD_TYPE+"="+uploadType+"&";
|
||||
else
|
||||
throw new Exception("UploadType parameter is null or empty");
|
||||
|
||||
parameters+=ConstantsExplorer.IS_OVERWRITE+"="+overwrite;
|
||||
|
||||
String urlRequest = ConstantsExplorer.LOCAL_UPLOAD_WORKSPACE_SERVICE+"?"+URL.encodeQueryString(parameters);
|
||||
|
||||
String urlRequest = ConstantsExplorer.LOCAL_UPLOAD_WORKSPACE_SERVICE+"?"+parameters;
|
||||
|
||||
*/
|
||||
|
||||
String fileNameEscaped = URL.encodeQueryString(fileName);
|
||||
// fileNameEscaped = encodeUrlDelimiters(fileNameEscaped);
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
|
|||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
||||
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
|
||||
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
||||
import org.gcube.portlets.user.workspace.client.model.FolderGridModel;
|
||||
import org.gcube.portlets.user.workspace.client.model.InfoContactModel;
|
||||
|
||||
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
||||
|
|
|
@ -3224,8 +3224,13 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
|
||||
@Override
|
||||
public String getUserWorkspaceSize() throws Exception {
|
||||
workspaceLogger.info("Getting workspace size..");
|
||||
Workspace workspace = getWorkspace();
|
||||
return formatFileSize(workspace.getRoot().getSize());
|
||||
long size = workspace.getRoot().getSize();
|
||||
workspaceLogger.info("Root size is: "+size +" formatting..");
|
||||
String formatSize = formatFileSize(size);
|
||||
workspaceLogger.info("returning workspace size: "+formatSize);
|
||||
return formatSize;
|
||||
}
|
||||
/**
|
||||
* returns dynamically the formated size
|
||||
|
@ -3234,7 +3239,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
*/
|
||||
private static String formatFileSize(long size) {
|
||||
String formattedSize = null;
|
||||
|
||||
|
||||
double b = size;
|
||||
double k = size/1024.0;
|
||||
double m = ((size/1024.0)/1024.0);
|
||||
|
|
|
@ -100,10 +100,8 @@ public class WsUtil {
|
|||
* COMMENT THIS IN DEVELOP ENVIROMENT (UNCOMMENT IN PRODUCTION)*/
|
||||
user=TEST_USER;
|
||||
|
||||
//UNCOMMENT THIS IN DEVELOP ENVIROMENT
|
||||
// user = "francesco.mangiacrapa";
|
||||
if (! isWithinPortal()) {
|
||||
TEST_USER = "francesco.mangiacrapa";
|
||||
user = "francesco.mangiacrapa";
|
||||
TEST_USER_FULL_NAME = "Francesco Mangiacrapa";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue