latest version to integrate workspace quote
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@101326 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0711b07d69
commit
b1dc733510
|
@ -108,6 +108,7 @@ import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
|
||||||
import org.gcube.portlets.user.workspace.shared.TrashContent;
|
import org.gcube.portlets.user.workspace.shared.TrashContent;
|
||||||
import org.gcube.portlets.user.workspace.shared.TrashOperationContent;
|
import org.gcube.portlets.user.workspace.shared.TrashOperationContent;
|
||||||
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
|
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
|
||||||
|
import org.gcube.portlets.user.workspace.shared.WorkspaceUserQuote;
|
||||||
import org.gcube.portlets.widgets.sessionchecker.client.CheckSession;
|
import org.gcube.portlets.widgets.sessionchecker.client.CheckSession;
|
||||||
import org.gcube.portlets.widgets.wsmail.client.forms.MailForm;
|
import org.gcube.portlets.widgets.wsmail.client.forms.MailForm;
|
||||||
|
|
||||||
|
@ -1265,8 +1266,20 @@ public class AppController implements SubscriberInterface {
|
||||||
rootPanel.add(htmlWorkspaceSize);
|
rootPanel.add(htmlWorkspaceSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setWorkspaceSize(String size){
|
private void setWorkspaceUserQuotes(String size, long totalItems){
|
||||||
String html = "<div style=\"width: 100%; text-align: left; font-size: 9px; padding: 5px;\">" + size +" of storage space used</div>";
|
String msg;
|
||||||
|
|
||||||
|
if(totalItems<=0){
|
||||||
|
msg = "No items";
|
||||||
|
}else if(totalItems==1){
|
||||||
|
msg = totalItems + " item";
|
||||||
|
}else {
|
||||||
|
msg = totalItems + " items";
|
||||||
|
}
|
||||||
|
|
||||||
|
msg+= ". "+size +" of storage space used";
|
||||||
|
|
||||||
|
String html = "<div style=\"width: 100%; text-align: left; font-size: 9px; padding: 5px;\">" + msg +"</div>";
|
||||||
htmlWorkspaceSize.setHTML(html);
|
htmlWorkspaceSize.setHTML(html);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1658,7 +1671,7 @@ public class AppController implements SubscriberInterface {
|
||||||
if(folderId!=null && !folderId.isEmpty()){
|
if(folderId!=null && !folderId.isEmpty()){
|
||||||
HashMap<String, String> params = new HashMap<String, String>(1);
|
HashMap<String, String> params = new HashMap<String, String>(1);
|
||||||
params.put(ConstantsExplorer.GET_ITEMID_PARAMETER, folderId);
|
params.put(ConstantsExplorer.GET_ITEMID_PARAMETER, folderId);
|
||||||
logger.log(Level.INFO, "show logut with parameter is: "+folderId);
|
logger.log(Level.INFO, "show logout with parameter is: "+folderId);
|
||||||
CheckSession.showLogoutDialog(params);
|
CheckSession.showLogoutDialog(params);
|
||||||
}else{
|
}else{
|
||||||
logger.log(Level.INFO, "show logut without parameters");
|
logger.log(Level.INFO, "show logut without parameters");
|
||||||
|
@ -1793,8 +1806,10 @@ public class AppController implements SubscriberInterface {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
default:{
|
default:{
|
||||||
|
|
||||||
|
@ -1848,6 +1863,10 @@ public class AppController implements SubscriberInterface {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setVisibleUserQuote(boolean bool){
|
||||||
|
htmlWorkspaceSize.setVisible(bool);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.gcube.portlets.user.workspace.client.interfaces.SubscriberInterface#updateWorksapaceSize()
|
* @see org.gcube.portlets.user.workspace.client.interfaces.SubscriberInterface#updateWorksapaceSize()
|
||||||
|
@ -1859,14 +1878,24 @@ public class AppController implements SubscriberInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
AppControllerExplorer.rpcWorkspaceService.getUserWorkspaceSize(new AsyncCallback<String>() {
|
|
||||||
@Override
|
AppControllerExplorer.rpcWorkspaceService.getUserWorkspaceQuote(new AsyncCallback<WorkspaceUserQuote>() {
|
||||||
public void onFailure(Throwable caught) { }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String size) {
|
public void onFailure(Throwable arg0) {
|
||||||
GWT.log("Updating worskpace size as: "+size);
|
GWT.log("Failed get worskpace quote as", arg0);
|
||||||
setWorkspaceSize(size);
|
setVisibleUserQuote(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(WorkspaceUserQuote wsquote) {
|
||||||
|
|
||||||
|
if(wsquote==null)
|
||||||
|
setVisibleUserQuote(false);
|
||||||
|
else{
|
||||||
|
GWT.log("Updating worskpace quote as: "+wsquote);
|
||||||
|
setWorkspaceUserQuotes(wsquote.getDiskSpaceFormatted(), wsquote.getTotalItems());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue