ref 12119:AccountingDashboard - Create a new Accounting Dashboard

https://support.d4science.org/issues/12119

Updated Export file support. Added CSV file export.

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/accounting-dashboard@169893 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2018-07-20 17:17:11 +00:00
parent 26968a4db2
commit 62744af781
11 changed files with 161467 additions and 12 deletions

View File

@ -312,6 +312,8 @@ public class Chart extends HTMLPanel {
options : { options : {
animation : false, animation : false,
responsive : false, responsive : false,
maintainAspectRatio : true,
aspectRatio : 1, // width == height
legend : { legend : {
position : 'top', position : 'top',
}, },
@ -337,6 +339,19 @@ public class Chart extends HTMLPanel {
} }
} ] } ]
}, },
tooltips : {
tooltips : {
mode : 'x'
}
},
zoom : {
enabled : true,
mode : 'xy',
limits : {
max : 20,
min : 0.1
}
}
} }
}); });
console.log('Chart: ' + chart); console.log('Chart: ' + chart);
@ -347,6 +362,19 @@ public class Chart extends HTMLPanel {
var canvasW = canvas.width; var canvasW = canvas.width;
var canvasH = canvas.height; var canvasH = canvas.height;
console.log('Canvas dimensions: ' + canvasW + ' x ' + canvasH); console.log('Canvas dimensions: ' + canvasW + ' x ' + canvasH);
//Decide whether to align left or right based on position on canvas
//console.log('View1:['+Chart.global+']');
//console.log('This coords:['+this.x+', '+this.y+']');
//if (this.x > this.chart.width / 2) {
// this.x -= this.xOffset + this.width;
//} else {
// this.x += this.xOffset;
//}
//console.log('This coords computed:'+this.x);
}-*/; }-*/;
} }

View File

@ -94,6 +94,12 @@ public interface AppResources extends ClientBundle {
@Source("jspdf.min.js") @Source("jspdf.min.js")
TextResource jsPDF(); TextResource jsPDF();
@Source("hammer.min.js")
TextResource hammerJS();
@Source("chartjs-plugin-zoom.min.js")
TextResource chartJSPluginZoom();
@Source("settings.png") @Source("settings.png")
ImageResource settingsImage(); ImageResource settingsImage();

View File

@ -15,6 +15,10 @@ public class ResourceLoader {
ResourceLoader(AppResources appResources) { ResourceLoader(AppResources appResources) {
appResources.uiDataCss().ensureInjected(); appResources.uiDataCss().ensureInjected();
ScriptInjector.fromString(appResources.chartJS().getText()) ScriptInjector.fromString(appResources.chartJS().getText())
.inject();
ScriptInjector.fromString(appResources.hammerJS().getText())
.inject();
ScriptInjector.fromString(appResources.chartJSPluginZoom().getText())
.inject(); .inject();
ScriptInjector.fromString(appResources.jsPDF().getText()) ScriptInjector.fromString(appResources.jsPDF().getText())
.inject(); .inject();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -61,9 +61,11 @@
} }
.uiDataChartCanvas { .uiDataChartCanvas {
min-height: 500px; height: 500px;
height: 100%; width: 990px;
max-height: 800px; -moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
} }
.uiDataChartMenuPosition { .uiDataChartMenuPosition {

View File

@ -2,6 +2,8 @@ package org.gcube.portlets.user.accountingdashboard.server;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import org.gcube.common.scope.impl.ScopeBean;
import org.gcube.common.scope.impl.ScopeBean.Type;
import org.gcube.portlets.user.accountingdashboard.client.rpc.AccountingDashboardService; import org.gcube.portlets.user.accountingdashboard.client.rpc.AccountingDashboardService;
import org.gcube.portlets.user.accountingdashboard.server.accounting.AccountingService; import org.gcube.portlets.user.accountingdashboard.server.accounting.AccountingService;
import org.gcube.portlets.user.accountingdashboard.server.accounting.AccountingServiceType; import org.gcube.portlets.user.accountingdashboard.server.accounting.AccountingServiceType;
@ -66,9 +68,8 @@ public class AccountingDashboardServiceImpl extends RemoteServiceServlet impleme
public ScopeData getScopeData() throws ServiceException { public ScopeData getScopeData() throws ServiceException {
try { try {
logger.debug("AccountingDashboardServiceImpl getScopeData()"); logger.debug("AccountingDashboardServiceImpl getScopeData()");
@SuppressWarnings("unused")
ServiceCredentials serviceCredentials = SessionUtil.getServiceCredentials(this.getThreadLocalRequest()); ServiceCredentials serviceCredentials = SessionUtil.getServiceCredentials(this.getThreadLocalRequest());
AccountingService as = new AccountingService(AccountingServiceType.PortalContex); AccountingService as = new AccountingService(getAccountingContext(serviceCredentials.getScope()));
ScopeData scopeData = as.getTree(this.getThreadLocalRequest()); ScopeData scopeData = as.getTree(this.getThreadLocalRequest());
return scopeData; return scopeData;
} catch (ServiceException e) { } catch (ServiceException e) {
@ -85,9 +86,8 @@ public class AccountingDashboardServiceImpl extends RemoteServiceServlet impleme
public ReportData getReport(RequestReportData requestReportData) throws ServiceException { public ReportData getReport(RequestReportData requestReportData) throws ServiceException {
try { try {
logger.debug("AccountingDashboardServiceImpl getReport(): " + requestReportData); logger.debug("AccountingDashboardServiceImpl getReport(): " + requestReportData);
@SuppressWarnings("unused")
ServiceCredentials serviceCredentials = SessionUtil.getServiceCredentials(this.getThreadLocalRequest()); ServiceCredentials serviceCredentials = SessionUtil.getServiceCredentials(this.getThreadLocalRequest());
AccountingService as = new AccountingService(AccountingServiceType.PortalContex); AccountingService as = new AccountingService(getAccountingContext(serviceCredentials.getScope()));
ReportData reportData = as.getReport(this.getThreadLocalRequest(), requestReportData); ReportData reportData = as.getReport(this.getThreadLocalRequest(), requestReportData);
return reportData; return reportData;
} catch (ServiceException e) { } catch (ServiceException e) {
@ -99,4 +99,18 @@ public class AccountingDashboardServiceImpl extends RemoteServiceServlet impleme
} }
} }
private AccountingServiceType getAccountingContext(String scope) {
try {
ScopeBean scopeBean = new ScopeBean(scope);
if (scopeBean.is(Type.VRE)) {
return AccountingServiceType.CurrentScope;
} else {
return AccountingServiceType.PortalContex;
}
} catch (Throwable e) {
logger.error("getAccountingContext(): " + e.getLocalizedMessage(), e);
return AccountingServiceType.CurrentScope;
}
}
} }

View File

@ -20,8 +20,6 @@ import org.gcube.portlets.user.accountingdashboard.shared.exception.ServiceExcep
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi
@ -235,7 +233,12 @@ public class AccountingService {
} }
private ScopeData debugScope() { private ScopeData debugScope() {
ScopeData scopeData = new ScopeData("Debug", "Debug", "/Debug", null); ArrayList<ScopeData> children=new ArrayList<>();
ScopeData child1=new ScopeData("Child1","Child1","/Debug/ChildChild1",null);
ScopeData child2=new ScopeData("Child2","Child2","/Debug/ChildChild2",null);
children.add(child1);
children.add(child2);
ScopeData scopeData = new ScopeData("Debug", "Debug", "/Debug", children);
return scopeData; return scopeData;
} }

View File

@ -3,7 +3,6 @@
<html> <html>
<head> <head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- --> <!-- -->
<!-- Consider inlining CSS to reduce the number of requested files --> <!-- Consider inlining CSS to reduce the number of requested files -->
<!-- --> <!-- -->

View File

@ -1,6 +1,5 @@
<%@page contentType="text/html"%> <%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%> <%@page pageEncoding="UTF-8"%>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- --> <!-- -->
<!-- The module reference below is the link --> <!-- The module reference below is the link -->
<!-- between html and your Web Toolkit module --> <!-- between html and your Web Toolkit module -->

161383
test.log.1 Normal file

File diff suppressed because it is too large Load Diff