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
Feature/N18291
Giancarlo Panichi 6 years ago
parent 26968a4db2
commit 62744af781

@ -312,6 +312,8 @@ public class Chart extends HTMLPanel {
options : {
animation : false,
responsive : false,
maintainAspectRatio : true,
aspectRatio : 1, // width == height
legend : {
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);
@ -347,6 +362,19 @@ public class Chart extends HTMLPanel {
var canvasW = canvas.width;
var canvasH = canvas.height;
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);
}-*/;
}

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

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

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

@ -2,6 +2,8 @@ package org.gcube.portlets.user.accountingdashboard.server;
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.server.accounting.AccountingService;
import org.gcube.portlets.user.accountingdashboard.server.accounting.AccountingServiceType;
@ -66,9 +68,8 @@ public class AccountingDashboardServiceImpl extends RemoteServiceServlet impleme
public ScopeData getScopeData() throws ServiceException {
try {
logger.debug("AccountingDashboardServiceImpl getScopeData()");
@SuppressWarnings("unused")
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());
return scopeData;
} catch (ServiceException e) {
@ -85,9 +86,8 @@ public class AccountingDashboardServiceImpl extends RemoteServiceServlet impleme
public ReportData getReport(RequestReportData requestReportData) throws ServiceException {
try {
logger.debug("AccountingDashboardServiceImpl getReport(): " + requestReportData);
@SuppressWarnings("unused")
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);
return reportData;
} 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;
}
}
}

@ -20,8 +20,6 @@ import org.gcube.portlets.user.accountingdashboard.shared.exception.ServiceExcep
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author Giancarlo Panichi
@ -235,7 +233,12 @@ public class AccountingService {
}
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;
}

@ -3,7 +3,6 @@
<html>
<head>
<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 -->
<!-- -->

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

161383
test.log.1

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save