Merge pull request 'feature/21729' (!2) from feature/21729 into master

Reviewed-on: #2
This commit is contained in:
Giancarlo Panichi 2021-06-30 17:39:51 +02:00
commit b829c6bf2f
7 changed files with 77 additions and 65 deletions

View File

@ -3,6 +3,14 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for "accounting-manager"
## [v1.14.0] - 2021-06-28
### Fixes
- Fixed display errors generated in Root scope [#21729]
## [v1.13.0] - 2021-03-23
### Features

View File

@ -1,4 +1,8 @@
<ReleaseNotes>
<Changeset component="org.gcube.portlets.admin.accounting-manager.1-14-0"
date="2021-06-28">
<Change>Fixed display errors generated in Root scope [#21729]</Change>
</Changeset>
<Changeset component="org.gcube.portlets.admin.accounting-manager.1-13-0"
date="2021-03-23">
<Change>Migrate accounting-manager to postgresql persistence [#21013]</Change>

View File

@ -15,7 +15,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.gcube.portlets.admin</groupId>
<artifactId>accounting-manager</artifactId>
<version>1.13.0</version>
<version>1.14.0</version>
<packaging>war</packaging>
@ -445,7 +445,7 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>3.6.0</version>
<version>3.6.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>

View File

@ -68,6 +68,7 @@ public class AccountingManagerController {
private BorderLayoutContainer mainPanel;
private AccountingMonitor accountingMonitor;
private EnableTabs enableTabs;
private Context availableContext;
public AccountingManagerController() {
eventBus = new SimpleEventBus();
@ -106,7 +107,7 @@ public class AccountingManagerController {
@Override
public void onFailure(Throwable caught) {
Log.info("No valid user found: " + caught.getMessage());
Log.error("No valid user found: " + caught.getLocalizedMessage(), caught);
if (caught instanceof SessionExpiredException) {
UtilsGXT3.alert("Error", "Expired Session");
sessionExpiredShowDelayed();
@ -131,7 +132,7 @@ public class AccountingManagerController {
@Override
public void onFailure(Throwable caught) {
Log.info("No valid user found: " + caught.getMessage());
Log.error("Error in check root scope: " + caught.getLocalizedMessage(), caught);
if (caught instanceof SessionExpiredException) {
UtilsGXT3.alert("Error", "Expired Session");
sessionExpiredShowDelayed();
@ -156,7 +157,7 @@ public class AccountingManagerController {
@Override
public void onFailure(Throwable caught) {
Log.error("Error retrieving enable tabs: " + caught.getLocalizedMessage());
Log.error("Error retrieving enable tabs: " + caught.getLocalizedMessage(), caught);
if (caught instanceof SessionExpiredException) {
UtilsGXT3.alert("Error", "Expired Session");
sessionExpiredShowDelayed();
@ -293,7 +294,7 @@ public class AccountingManagerController {
Log.debug("AccountingType: " + event.getAccountingType());
accountingStateData = accountingState.getState(event.getAccountingType());
if (accountingStateData == null) {
createDefaultChart(event.getAccountingType());
configureDefaultChart(event.getAccountingType());
} else {
accountingType = event.getAccountingType();
StateChangeEvent stateChangeEvent = new StateChangeEvent(StateChangeType.Restore, accountingStateData);
@ -310,18 +311,51 @@ public class AccountingManagerController {
if (enableTabs != null && enableTabs.getTabs() != null && enableTabs.getTabs().size() > 0
&& enableTabs.getTabs().get(0) != null) {
Log.debug("Create DefaultChart");
createDefaultChart(enableTabs.getTabs().get(0).getAccountingType());
configureDefaultChart(enableTabs.getTabs().get(0).getAccountingType());
}
}
private void createDefaultChart(AccountingType accountingType) {
private void configureDefaultChart(AccountingType accountingType) {
accountingMonitor = new AccountingMonitor();
this.accountingType = accountingType;
if (availableContext == null) {
retrieveContext();
} else {
createDefaultChart();
}
}
private void createDefaultChart() {
AccountingClientStateData accountingStateData = new AccountingClientStateData(accountingType, rootScope);
accountingStateData.setAvailableContext(availableContext);
accountingState.setState(accountingType, accountingStateData);
retrieveFilterKey();
}
private void retrieveContext() {
AccountingManagerServiceAsync.INSTANCE.getContext(new AsyncCallback<Context>() {
@Override
public void onFailure(Throwable caught) {
accountingMonitor.hide();
Log.error("Error retrieving contexts: " + caught.getLocalizedMessage(), caught);
if (caught instanceof SessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
} else {
UtilsGXT3.alert("Error retrieving contexts ", caught.getLocalizedMessage());
}
}
@Override
public void onSuccess(Context result) {
Log.debug("Available Context: " + result);
availableContext = result;
createDefaultChart();
}
});
}
@ -332,6 +366,7 @@ public class AccountingManagerController {
@Override
public void onFailure(Throwable caught) {
accountingMonitor.hide();
Log.error("Error retrieving filter keys: " + caught.getLocalizedMessage(), caught);
if (caught instanceof SessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
} else {
@ -348,34 +383,6 @@ public class AccountingManagerController {
AccountingClientStateData accountingStateData = accountingState.getState(accountingType);
accountingStateData.setAvailableFilterKeys(result);
accountingState.setState(accountingType, accountingStateData);
retrieveContext();
}
});
}
private void retrieveContext() {
AccountingManagerServiceAsync.INSTANCE.getContext(new AsyncCallback<Context>() {
@Override
public void onFailure(Throwable caught) {
accountingMonitor.hide();
if (caught instanceof SessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
} else {
Log.error("Error retrieving contexts for " + accountingType + ":" + caught.getLocalizedMessage());
UtilsGXT3.alert("Error retrieving contexts ", caught.getLocalizedMessage());
}
}
@Override
public void onSuccess(Context result) {
Log.debug("Available Context: " + result);
AccountingClientStateData accountingStateData = accountingState.getState(accountingType);
accountingStateData.setAvailableContext(result);
accountingState.setState(accountingType, accountingStateData);
retrieveSpace();
}
});
@ -383,7 +390,7 @@ public class AccountingManagerController {
}
private void retrieveSpace() {
if (rootScope) {
/* if (rootScope) {
AccountingManagerServiceAsync.INSTANCE.getSpaces(new AsyncCallback<Spaces>() {
@ -393,7 +400,7 @@ public class AccountingManagerController {
if (caught instanceof SessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
} else {
Log.error("Error retrieving sapces for " + accountingType + ":" + caught.getLocalizedMessage());
Log.error("Error retrieving spaces for " + accountingType + ":" + caught.getLocalizedMessage());
UtilsGXT3.alert("Error retrieving spaces ", caught.getLocalizedMessage());
}
@ -407,7 +414,9 @@ public class AccountingManagerController {
});
} else {
createDefaultSeriesRequest(null);
}
} */
createDefaultSeriesRequest(null);
}
private void createDefaultSeriesRequest(Spaces spaces) {
@ -838,8 +847,6 @@ public class AccountingManagerController {
});
}
private void doExportRequest(ExportRequestEvent event) {
StringBuilder actionUrl = new StringBuilder();
actionUrl.append(GWT.getModuleBaseURL());

View File

@ -97,7 +97,7 @@ public class AccountingManagerServiceImpl extends RemoteServiceServlet
throw e;
} catch (Throwable e) {
logger.error("Hello(): " + e.getLocalizedMessage(), e);
throw new ServiceException(e.getLocalizedMessage());
throw new ServiceException(e.getLocalizedMessage(),e);
}
}
@ -130,9 +130,8 @@ public class AccountingManagerServiceImpl extends RemoteServiceServlet
e.printStackTrace();
throw e;
} catch (Throwable e) {
e.printStackTrace();
logger.error("getEnableTabs(): " + e.getLocalizedMessage(), e);
throw new ServiceException(e.getLocalizedMessage());
throw new ServiceException(e.getLocalizedMessage(),e);
}
}
@ -153,10 +152,9 @@ public class AccountingManagerServiceImpl extends RemoteServiceServlet
e.printStackTrace();
throw e;
} catch (Throwable e) {
e.printStackTrace();
logger.error(
"getClientMonitorTimeout(): " + e.getLocalizedMessage(), e);
throw new ServiceException(e.getLocalizedMessage());
throw new ServiceException(e.getLocalizedMessage(),e);
}
}
@ -202,7 +200,7 @@ public class AccountingManagerServiceImpl extends RemoteServiceServlet
throw e;
} catch (Throwable e) {
logger.error("getSeries(): " + e.getLocalizedMessage(), e);
throw new ServiceException(e.getLocalizedMessage());
throw new ServiceException(e.getLocalizedMessage(),e);
}
}
@ -249,7 +247,7 @@ public class AccountingManagerServiceImpl extends RemoteServiceServlet
throw e;
} catch (Throwable e) {
logger.error("getSeries(): " + e.getLocalizedMessage(), e);
throw new ServiceException(e.getLocalizedMessage());
throw new ServiceException(e.getLocalizedMessage(),e);
}
}
@ -301,7 +299,7 @@ public class AccountingManagerServiceImpl extends RemoteServiceServlet
throw e;
} catch (Throwable e) {
logger.error("Operation Monitor(): " + e.getLocalizedMessage(), e);
throw new ServiceException(e.getLocalizedMessage());
throw new ServiceException(e.getLocalizedMessage(),e);
}
}
@ -331,9 +329,8 @@ public class AccountingManagerServiceImpl extends RemoteServiceServlet
e.printStackTrace();
throw e;
} catch (Throwable e) {
e.printStackTrace();
logger.error("getFilterKeys(): " + e.getLocalizedMessage(), e);
throw new ServiceException(e.getLocalizedMessage());
throw new ServiceException(e.getLocalizedMessage(),e);
}
}
@ -391,9 +388,8 @@ public class AccountingManagerServiceImpl extends RemoteServiceServlet
e.printStackTrace();
throw e;
} catch (Throwable e) {
e.printStackTrace();
logger.error("getFilterValues(): " + e.getLocalizedMessage(), e);
throw new ServiceException(e.getLocalizedMessage());
throw new ServiceException(e.getLocalizedMessage(),e);
}
}
@ -424,9 +420,8 @@ public class AccountingManagerServiceImpl extends RemoteServiceServlet
e.printStackTrace();
throw e;
} catch (Throwable e) {
e.printStackTrace();
logger.error("getCategories(): " + e.getLocalizedMessage(), e);
throw new ServiceException(e.getLocalizedMessage());
throw new ServiceException(e.getLocalizedMessage(),e);
}
}
@ -450,9 +445,8 @@ public class AccountingManagerServiceImpl extends RemoteServiceServlet
e.printStackTrace();
throw e;
} catch (Throwable e) {
e.printStackTrace();
logger.error("getContext(): " + e.getLocalizedMessage(), e);
throw new ServiceException(e.getLocalizedMessage());
throw new ServiceException(e.getLocalizedMessage(),e);
}
}
@ -485,9 +479,8 @@ public class AccountingManagerServiceImpl extends RemoteServiceServlet
e.printStackTrace();
throw e;
} catch (Throwable e) {
e.printStackTrace();
logger.error("isRoot(): " + e.getLocalizedMessage(), e);
throw new ServiceException(e.getLocalizedMessage());
logger.error("isRootScope(): " + e.getLocalizedMessage(), e);
throw new ServiceException(e.getLocalizedMessage(),e);
}
}
@ -522,7 +515,6 @@ public class AccountingManagerServiceImpl extends RemoteServiceServlet
throw e;
} catch (Throwable e) {
logger.error("SaveDataOnWorkspace(): " + e.getLocalizedMessage(), e);
e.printStackTrace();
throw new ServiceException(e.getLocalizedMessage(), e);
}
}

View File

@ -77,7 +77,8 @@ public class BuildEnableTabs {
}
}
if (isRootScope) {
//SPACE Tab Disabled
/*if (isRootScope) {
boolean spaceTabPresent = false;
for (EnableTab enableTab : enableTabList) {
if (enableTab.getAccountingType().compareTo(
@ -91,7 +92,7 @@ public class BuildEnableTabs {
AccountingType.SPACE, null);
enableTabList.add(enableTabDataSpace);
}
}
}*/
EnableTabs enableTabs = new EnableTabs(enableTabList);
logger.debug("EnableTabsData: " + enableTabs);
return enableTabs;

View File

@ -98,7 +98,7 @@ defaultOptions.exporting = {
//enabled: true,
//filename: 'chart',
type: 'image/png',
url: 'http://export.highcharts.com/',
url: 'https://export.highcharts.com/',
//width: undefined,
//scale: 2
buttons: {