From 6d164eb7f15c07f8f795f4072f794490db33bc40 Mon Sep 17 00:00:00 2001 From: "giancarlo.panichi" Date: Thu, 14 Apr 2016 13:16:32 +0000 Subject: [PATCH] refs 3251: Accounting Manager - Fix back button behavior Task-Url: https://support.d4science.org/issues/3251 Fix back button behavior git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/accounting-manager@128086 82a268e6-3cf1-43bd-a215-b396298e98cf --- distro/changelog.xml | 19 +++-- .../client/AccountingManager.java | 72 ++++++++++++------- src/main/webapp/WEB-INF/web.xml | 19 ++++- 3 files changed, 80 insertions(+), 30 deletions(-) diff --git a/distro/changelog.xml b/distro/changelog.xml index f8d4bce..ffcf8b7 100644 --- a/distro/changelog.xml +++ b/distro/changelog.xml @@ -1,10 +1,21 @@ - - Added to Storage Accounting more formats for DataVolume axis [Ticket #1831] - Fixed on Storage Accounting the popup validation on filters [Ticket #1832] + + Added Top N Chart[Ticket #2251] + Fixed back button behavior[Ticket #3251] + + + Added to Storage Accounting more formats for DataVolume axis + [Ticket #1831] + + Fixed on Storage Accounting the popup validation on filters + [Ticket #1832] + Fixed library dependencies - + First Release \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/admin/accountingmanager/client/AccountingManager.java b/src/main/java/org/gcube/portlets/admin/accountingmanager/client/AccountingManager.java index 97397df..c100136 100644 --- a/src/main/java/org/gcube/portlets/admin/accountingmanager/client/AccountingManager.java +++ b/src/main/java/org/gcube/portlets/admin/accountingmanager/client/AccountingManager.java @@ -6,6 +6,8 @@ import org.gcube.portlets.admin.accountingmanager.client.menu.AccountingManagerM import org.gcube.portlets.admin.accountingmanager.client.resource.AccountingManagerResources; import org.gcube.portlets.admin.accountingmanager.client.rpc.AccountingManagerService; import org.gcube.portlets.admin.accountingmanager.client.rpc.AccountingManagerServiceAsync; +import org.gcube.portlets.admin.accountingmanager.client.utils.UtilsGXT3; +import org.gcube.portlets.user.gcubewidgets.client.ClientScopeHelper; import com.allen_sauer.gwt.log.client.Log; import com.google.gwt.core.client.EntryPoint; @@ -13,6 +15,8 @@ import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler.ScheduledCommand; import com.google.gwt.event.shared.EventBus; +import com.google.gwt.user.client.Window.Location; +import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.RootPanel; import com.sencha.gxt.core.client.util.Margins; import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer; @@ -28,12 +32,8 @@ import com.sencha.gxt.widget.core.client.container.Viewport; */ public class AccountingManager implements EntryPoint { - - private static final String JSP_TAG_ID = "AccountingManagerPortlet"; - - @SuppressWarnings("unused") private final AccountingManagerServiceAsync accountingManagerService = GWT .create(AccountingManagerService.class); @@ -41,7 +41,6 @@ public class AccountingManager implements EntryPoint { // Main Panel private static BorderLayoutContainer mainPanelLayout; - /** * {@inheritDoc} */ @@ -57,16 +56,41 @@ public class AccountingManager implements EntryPoint { // onModuleLoad2 Scheduler.get().scheduleDeferred(new ScheduledCommand() { public void execute() { - loadMainPanel(); + loadScope(); } }); } - protected void loadMainPanel() { - AccountingManagerResources.INSTANCE.accountingManagerCSS().ensureInjected(); - //ScriptInjector.fromString(AccountingManagerResources.INSTANCE.jqueryJs().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject(); - + private void loadScope() { + ClientScopeHelper.getService().setScope(Location.getHref(), + new AsyncCallback() { + @Override + public void onSuccess(Boolean result) { + if (result) { + loadMainPanel(); + } else { + UtilsGXT3 + .info("Attention", + "ClientScopeHelper has returned a false value!"); + } + } + + @Override + public void onFailure(Throwable caught) { + UtilsGXT3.alert("Error", "Error setting scope: " + + caught.getLocalizedMessage()); + caught.printStackTrace(); + } + }); + + } + + private void loadMainPanel() { + AccountingManagerResources.INSTANCE.accountingManagerCSS() + .ensureInjected(); + // ScriptInjector.fromString(AccountingManagerResources.INSTANCE.jqueryJs().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject(); + AccountingManagerController controller = new AccountingManagerController(); EventBus eventBus = controller.getEventBus(); @@ -75,26 +99,26 @@ public class AccountingManager implements EntryPoint { mainPanelLayout.setId("mainPanelLayout"); mainPanelLayout.setBorders(false); mainPanelLayout.setResize(true); - //mainPanelLayout.getElement().getStyle().setBackgroundColor("rgb(3, 126, 207)"); - - - //Main - final MainDataPanel mainDataPanel=new MainDataPanel(eventBus); + // mainPanelLayout.getElement().getStyle().setBackgroundColor("rgb(3, 126, 207)"); + + // Main + final MainDataPanel mainDataPanel = new MainDataPanel(eventBus); MarginData mainData = new MarginData(new Margins(2)); mainPanelLayout.setCenterWidget(mainDataPanel, mainData); - - //Menu - AccountingManagerMenu accountingManagerMenu=new AccountingManagerMenu(eventBus); - + + // Menu + AccountingManagerMenu accountingManagerMenu = new AccountingManagerMenu( + eventBus); + BorderLayoutData menuData = new BorderLayoutData(58); menuData.setMargins(new Margins(5)); menuData.setCollapsible(false); menuData.setSplit(false); mainPanelLayout.setNorthWidget(accountingManagerMenu, menuData); - - //Filters - FiltersPanel filtersPanel=new FiltersPanel(eventBus); + + // Filters + FiltersPanel filtersPanel = new FiltersPanel(eventBus); BorderLayoutData westData = new BorderLayoutData(410); westData.setCollapsible(false); westData.setSplit(false); @@ -107,11 +131,11 @@ public class AccountingManager implements EntryPoint { mainPanelLayout.setWestWidget(filtersPanel, westData); filtersPanel.expand(); filtersPanel.enable(); - + bind(mainPanelLayout); controller.setMainPanelLayout(mainPanelLayout); controller.restoreUISession(); - + } protected void bind(BorderLayoutContainer mainWidget) { diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index 48fe117..225c523 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -18,13 +18,19 @@ checkServlet org.gcube.portlets.widgets.sessionchecker.server.SessionCheckerServiceImpl - + + + + scopeService + org.gcube.portlets.user.gcubewidgets.server.ScopeServiceImpl + + AccountingManagerService org.gcube.portlets.admin.accountingmanager.server.AccountingManagerServiceImpl - + @@ -39,6 +45,12 @@ /accountingman/checksession + + + scopeService + /accountingman/scopeService + + AccountingManagerService @@ -46,6 +58,9 @@ + + + AccountingManager.html