Added Default Show to Accounting Manager
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/accounting-manager@117356 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ee8d5f95bc
commit
012eb588cb
|
@ -108,6 +108,7 @@ public class AccountingManager implements EntryPoint {
|
||||||
bind(mainPanelLayout);
|
bind(mainPanelLayout);
|
||||||
controller.setMainPanelLayout(mainPanelLayout);
|
controller.setMainPanelLayout(mainPanelLayout);
|
||||||
controller.restoreUISession();
|
controller.restoreUISession();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void bind(BorderLayoutContainer mainWidget) {
|
protected void bind(BorderLayoutContainer mainWidget) {
|
||||||
|
|
|
@ -16,6 +16,8 @@ import org.gcube.portlets.admin.accountingmanager.client.type.StateChangeType;
|
||||||
import org.gcube.portlets.admin.accountingmanager.client.type.UIStateType;
|
import org.gcube.portlets.admin.accountingmanager.client.type.UIStateType;
|
||||||
import org.gcube.portlets.admin.accountingmanager.client.utils.UtilsGXT3;
|
import org.gcube.portlets.admin.accountingmanager.client.utils.UtilsGXT3;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.Constants;
|
import org.gcube.portlets.admin.accountingmanager.shared.Constants;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingPeriod;
|
||||||
|
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingPeriodMode;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
|
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
|
||||||
|
@ -30,6 +32,7 @@ import com.google.gwt.i18n.client.LocaleInfo;
|
||||||
import com.google.gwt.user.client.Cookies;
|
import com.google.gwt.user.client.Cookies;
|
||||||
import com.google.gwt.user.client.Timer;
|
import com.google.gwt.user.client.Timer;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.gwt.user.datepicker.client.CalendarUtil;
|
||||||
import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer;
|
import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -155,7 +158,7 @@ public class AccountingManagerController {
|
||||||
//
|
//
|
||||||
public void restoreUISession() {
|
public void restoreUISession() {
|
||||||
checkLocale();
|
checkLocale();
|
||||||
|
showDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind Controller to events on bus
|
// Bind Controller to events on bus
|
||||||
|
@ -207,18 +210,16 @@ public class AccountingManagerController {
|
||||||
case TASK:
|
case TASK:
|
||||||
case JOB:
|
case JOB:
|
||||||
Log.debug("AccountingType: " + event.getAccountingType());
|
Log.debug("AccountingType: " + event.getAccountingType());
|
||||||
accountingType = event.getAccountingType();
|
|
||||||
accountingStateData = accountingState.getState(event
|
accountingStateData = accountingState.getState(event
|
||||||
.getAccountingType());
|
.getAccountingType());
|
||||||
if (accountingStateData == null) {
|
if (accountingStateData == null) {
|
||||||
accountingStateData = new AccountingStateData(
|
createDefaultChart(event.getAccountingType());
|
||||||
event.getAccountingType(), null, null);
|
} else {
|
||||||
accountingState.setState(event.getAccountingType(),
|
accountingType = event.getAccountingType();
|
||||||
accountingStateData);
|
|
||||||
}
|
|
||||||
StateChangeEvent stateChangeEvent = new StateChangeEvent(
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(
|
||||||
StateChangeType.Restore, accountingStateData);
|
StateChangeType.Restore, accountingStateData);
|
||||||
eventBus.fireEvent(stateChangeEvent);
|
eventBus.fireEvent(stateChangeEvent);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -226,6 +227,73 @@ public class AccountingManagerController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void showDefault(){
|
||||||
|
createDefaultChart(AccountingType.STORAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void createDefaultChart(AccountingType accountingType) {
|
||||||
|
accountingMonitor = new AccountingMonitor();
|
||||||
|
Date d=new Date();
|
||||||
|
CalendarUtil.addMonthsToDate(d, -1);
|
||||||
|
|
||||||
|
SeriesRequest seriesRequest=new SeriesRequest(
|
||||||
|
new AccountingPeriod(d,new Date(),AccountingPeriodMode.DAILY));
|
||||||
|
this.accountingType = accountingType;
|
||||||
|
|
||||||
|
AccountingStateData accountingStateData = new AccountingStateData(
|
||||||
|
accountingType, seriesRequest, null);
|
||||||
|
accountingState.setState(accountingType,
|
||||||
|
accountingStateData);
|
||||||
|
|
||||||
|
callDefaultSeriesRequest(accountingStateData);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void callDefaultSeriesRequest(final AccountingStateData accountingStateData) {
|
||||||
|
|
||||||
|
AccountingManagerServiceAsync.INSTANCE.getSeries(
|
||||||
|
accountingStateData.getAccountingType(),
|
||||||
|
accountingStateData.getSeriesRequest(),
|
||||||
|
new AsyncCallback<SeriesResponse>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(SeriesResponse seriesResponse) {
|
||||||
|
Log.debug("SeriesResponse: " + seriesResponse);
|
||||||
|
accountingStateData.setSeriesResponse(seriesResponse);
|
||||||
|
accountingState.setState(accountingType,
|
||||||
|
accountingStateData);
|
||||||
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(
|
||||||
|
StateChangeType.Restore, accountingStateData);
|
||||||
|
eventBus.fireEvent(stateChangeEvent);
|
||||||
|
accountingMonitor.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
accountingMonitor.hide();
|
||||||
|
if (caught instanceof AccountingManagerSessionExpiredException) {
|
||||||
|
eventBus.fireEvent(new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
Log.error("Error:" + caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3.alert("Error",
|
||||||
|
caught.getLocalizedMessage());
|
||||||
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(
|
||||||
|
StateChangeType.Restore, accountingStateData);
|
||||||
|
eventBus.fireEvent(stateChangeEvent);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void doFiltersChangeCommand(FiltersChangeEvent event) {
|
private void doFiltersChangeCommand(FiltersChangeEvent event) {
|
||||||
if (event == null || event.getFiltersChangeType() == null) {
|
if (event == null || event.getFiltersChangeType() == null) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -206,7 +206,7 @@ public class HightChartPanel extends FramedPanel {
|
||||||
|
|
||||||
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
|
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
|
||||||
ChartOptions options = highchartsFactory.createChartOptions();
|
ChartOptions options = highchartsFactory.createChartOptions();
|
||||||
options.chart().zoomType("x");
|
options.chart().zoomType("xy");
|
||||||
|
|
||||||
options.title().text("Accounting Storage");
|
options.title().text("Accounting Storage");
|
||||||
|
|
||||||
|
@ -223,6 +223,8 @@ public class HightChartPanel extends FramedPanel {
|
||||||
// yAxis
|
// yAxis
|
||||||
// options.yAxis().title().text("Exchange rate");
|
// options.yAxis().title().text("Exchange rate");
|
||||||
// Highcharts.getOptions().colors[0]
|
// Highcharts.getOptions().colors[0]
|
||||||
|
|
||||||
|
|
||||||
String multiAxis = "[{" + " \"id\": \"OperationCount\","
|
String multiAxis = "[{" + " \"id\": \"OperationCount\","
|
||||||
+ " \"labels\": { " + " \"format\": \"{value}\","
|
+ " \"labels\": { " + " \"format\": \"{value}\","
|
||||||
+ " \"style\": { " + " \"color\": \""
|
+ " \"style\": { " + " \"color\": \""
|
||||||
|
@ -354,7 +356,7 @@ public class HightChartPanel extends FramedPanel {
|
||||||
|
|
||||||
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
|
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
|
||||||
ChartOptions options = highchartsFactory.createChartOptions();
|
ChartOptions options = highchartsFactory.createChartOptions();
|
||||||
options.chart().zoomType("x");
|
options.chart().zoomType("xy");
|
||||||
|
|
||||||
options.title().text("Accounting Service");
|
options.title().text("Accounting Service");
|
||||||
|
|
||||||
|
@ -371,6 +373,48 @@ public class HightChartPanel extends FramedPanel {
|
||||||
// yAxis
|
// yAxis
|
||||||
// options.yAxis().title().text("Exchange rate");
|
// options.yAxis().title().text("Exchange rate");
|
||||||
// Highcharts.getOptions().colors[0]
|
// Highcharts.getOptions().colors[0]
|
||||||
|
|
||||||
|
/*
|
||||||
|
String multiAxis = "[{" + " \"id\": \"OperationCount\","
|
||||||
|
+ " \"labels\": { " + " \"format\": \"{value}\","
|
||||||
|
+ " \"style\": { " + " \"color\": \""
|
||||||
|
+ colors.get(1)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " },"
|
||||||
|
+ " \"title\": { "
|
||||||
|
+ " \"text\": \"Operation Count\","
|
||||||
|
+ " \"style\": {"
|
||||||
|
+ " \"color\": \""
|
||||||
|
+ colors.get(1)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " }"
|
||||||
|
+ "} , {"
|
||||||
|
+ " \"id\": \"ServiceData\", "
|
||||||
|
+ " \"linkedTo\": \"0\","
|
||||||
|
+" \"gridLineWidth\": \"0\","
|
||||||
|
+ " \"title\": {"
|
||||||
|
+ " \"text\": \"\","
|
||||||
|
+ " \"style\": {"
|
||||||
|
+ " \"color\": \""
|
||||||
|
+ colors.get(1)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " },"
|
||||||
|
+ " \"labels\": {"
|
||||||
|
+ " \"format\": \"{value} ms\","
|
||||||
|
+ " \"style\": {"
|
||||||
|
+ " \"color\": \""
|
||||||
|
+ colors.get(1)
|
||||||
|
+ "\""
|
||||||
|
+ " }"
|
||||||
|
+ " }," + " \"opposite\": \"true\""
|
||||||
|
//+ ", \"showFirstLabel\": \"false\""
|
||||||
|
+ "}]";
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
String multiAxis = "[{" + " \"id\": \"OperationCount\","
|
String multiAxis = "[{" + " \"id\": \"OperationCount\","
|
||||||
+ " \"labels\": { " + " \"format\": \"{value}\","
|
+ " \"labels\": { " + " \"format\": \"{value}\","
|
||||||
+ " \"style\": { " + " \"color\": \""
|
+ " \"style\": { " + " \"color\": \""
|
||||||
|
@ -404,6 +448,7 @@ public class HightChartPanel extends FramedPanel {
|
||||||
+ "\""
|
+ "\""
|
||||||
+ " }"
|
+ " }"
|
||||||
+ " }," + " \"opposite\": \"true\""
|
+ " }," + " \"opposite\": \"true\""
|
||||||
|
+ ", \"showFirstLabel\": \"false\""
|
||||||
+ "} , {"
|
+ "} , {"
|
||||||
+ " \"id\": \"MaxInvocationTime\", "
|
+ " \"id\": \"MaxInvocationTime\", "
|
||||||
+ " \"title\": {"
|
+ " \"title\": {"
|
||||||
|
@ -422,6 +467,7 @@ public class HightChartPanel extends FramedPanel {
|
||||||
+ "\""
|
+ "\""
|
||||||
+ " }"
|
+ " }"
|
||||||
+ " }," + " \"opposite\": \"true\""
|
+ " }," + " \"opposite\": \"true\""
|
||||||
|
+ ", \"showFirstLabel\": \"false\""
|
||||||
+ "} , {"
|
+ "} , {"
|
||||||
+ " \"id\": \"MinInvocationTime\", "
|
+ " \"id\": \"MinInvocationTime\", "
|
||||||
+ " \"title\": {"
|
+ " \"title\": {"
|
||||||
|
@ -439,7 +485,9 @@ public class HightChartPanel extends FramedPanel {
|
||||||
+ colors.get(3)
|
+ colors.get(3)
|
||||||
+ "\""
|
+ "\""
|
||||||
+ " }"
|
+ " }"
|
||||||
+ " }," + " \"opposite\": \"true\"" + "}]"
|
+ " }," + " \"opposite\": \"true\""
|
||||||
|
+ ", \"showFirstLabel\": \"false\""
|
||||||
|
+ "}]"
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -496,7 +544,6 @@ public class HightChartPanel extends FramedPanel {
|
||||||
seriesMinInvocationTime.color(colors.get(3));
|
seriesMinInvocationTime.color(colors.get(3));
|
||||||
seriesMinInvocationTime.yAxisAsString("MinInvocationTime");
|
seriesMinInvocationTime.yAxisAsString("MinInvocationTime");
|
||||||
|
|
||||||
|
|
||||||
ArrayNumber dataMinInvocationTime = seriesMinInvocationTime.dataAsArrayNumber();
|
ArrayNumber dataMinInvocationTime = seriesMinInvocationTime.dataAsArrayNumber();
|
||||||
|
|
||||||
|
|
||||||
|
@ -568,7 +615,7 @@ public class HightChartPanel extends FramedPanel {
|
||||||
|
|
||||||
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
|
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
|
||||||
ChartOptions options = highchartsFactory.createChartOptions();
|
ChartOptions options = highchartsFactory.createChartOptions();
|
||||||
options.chart().zoomType("x");
|
options.chart().zoomType("xy");
|
||||||
|
|
||||||
options.title().text("Accounting Portlet");
|
options.title().text("Accounting Portlet");
|
||||||
|
|
||||||
|
@ -714,7 +761,7 @@ public class HightChartPanel extends FramedPanel {
|
||||||
|
|
||||||
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
|
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
|
||||||
ChartOptions options = highchartsFactory.createChartOptions();
|
ChartOptions options = highchartsFactory.createChartOptions();
|
||||||
options.chart().zoomType("x");
|
options.chart().zoomType("xy");
|
||||||
|
|
||||||
options.title().text("Accounting Task");
|
options.title().text("Accounting Task");
|
||||||
|
|
||||||
|
@ -861,7 +908,7 @@ public class HightChartPanel extends FramedPanel {
|
||||||
|
|
||||||
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
|
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
|
||||||
ChartOptions options = highchartsFactory.createChartOptions();
|
ChartOptions options = highchartsFactory.createChartOptions();
|
||||||
options.chart().zoomType("x");
|
options.chart().zoomType("xy");
|
||||||
|
|
||||||
options.title().text("Accounting Job");
|
options.title().text("Accounting Job");
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class AccountingCaller {
|
||||||
throw new AccountingManagerServiceException(
|
throw new AccountingManagerServiceException(
|
||||||
"Error retrieving list of info: list is null!");
|
"Error retrieving list of info: list is null!");
|
||||||
}
|
}
|
||||||
logger.debug("Retrived Infos");
|
logger.debug("Retrieved Infos");
|
||||||
|
|
||||||
SeriesResponseBuilder seriesResponseBuilder = getSeriesResponseBuilder(
|
SeriesResponseBuilder seriesResponseBuilder = getSeriesResponseBuilder(
|
||||||
accountingType, infos);
|
accountingType, infos);
|
||||||
|
|
|
@ -27,7 +27,10 @@ public class SeriesResponse4Job extends SeriesResponseBuilder {
|
||||||
@Override
|
@Override
|
||||||
public void buildSeriesResponse() throws AccountingManagerServiceException {
|
public void buildSeriesResponse() throws AccountingManagerServiceException {
|
||||||
logger.debug("Infos: "+infos);
|
logger.debug("Infos: "+infos);
|
||||||
|
if(infos.size()<=0){
|
||||||
|
logger.error("Error creating series for job accounting: No data available!");
|
||||||
|
throw new AccountingManagerServiceException("No data available!");
|
||||||
|
}
|
||||||
|
|
||||||
SeriesResponse seriesResponse = new SeriesResponse();
|
SeriesResponse seriesResponse = new SeriesResponse();
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,10 @@ public class SeriesResponse4Portlet extends SeriesResponseBuilder {
|
||||||
@Override
|
@Override
|
||||||
public void buildSeriesResponse() throws AccountingManagerServiceException {
|
public void buildSeriesResponse() throws AccountingManagerServiceException {
|
||||||
logger.debug("Infos: "+infos);
|
logger.debug("Infos: "+infos);
|
||||||
|
if(infos.size()<=0){
|
||||||
|
logger.error("Error creating series for portlet accounting: No data available!");
|
||||||
|
throw new AccountingManagerServiceException("No data available!");
|
||||||
|
}
|
||||||
|
|
||||||
SeriesResponse seriesResponse = new SeriesResponse();
|
SeriesResponse seriesResponse = new SeriesResponse();
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,10 @@ public class SeriesResponse4Service extends SeriesResponseBuilder {
|
||||||
public void buildSeriesResponse() throws AccountingManagerServiceException {
|
public void buildSeriesResponse() throws AccountingManagerServiceException {
|
||||||
try {
|
try {
|
||||||
logger.debug("Infos: " + infos);
|
logger.debug("Infos: " + infos);
|
||||||
|
if(infos.size()<=0){
|
||||||
|
logger.error("Error creating series for service accounting: No data available!");
|
||||||
|
throw new AccountingManagerServiceException("No data available!");
|
||||||
|
}
|
||||||
|
|
||||||
ArrayList<SeriesServiceData> series=new ArrayList<SeriesServiceData>();
|
ArrayList<SeriesServiceData> series=new ArrayList<SeriesServiceData>();
|
||||||
for (Info info : infos) {
|
for (Info info : infos) {
|
||||||
|
|
|
@ -33,6 +33,10 @@ public class SeriesResponse4Storage extends SeriesResponseBuilder {
|
||||||
public void buildSeriesResponse() throws AccountingManagerServiceException {
|
public void buildSeriesResponse() throws AccountingManagerServiceException {
|
||||||
try {
|
try {
|
||||||
logger.debug("Infos: " + infos);
|
logger.debug("Infos: " + infos);
|
||||||
|
if(infos.size()<=0){
|
||||||
|
logger.error("Error creating series for storage accounting: No data available!");
|
||||||
|
throw new AccountingManagerServiceException("No data available!");
|
||||||
|
}
|
||||||
|
|
||||||
ArrayList<SeriesStorageData> series=new ArrayList<SeriesStorageData>();
|
ArrayList<SeriesStorageData> series=new ArrayList<SeriesStorageData>();
|
||||||
for (Info info : infos) {
|
for (Info info : infos) {
|
||||||
|
|
|
@ -27,7 +27,10 @@ public class SeriesResponse4Task extends SeriesResponseBuilder {
|
||||||
@Override
|
@Override
|
||||||
public void buildSeriesResponse() throws AccountingManagerServiceException {
|
public void buildSeriesResponse() throws AccountingManagerServiceException {
|
||||||
logger.debug("Infos: "+infos);
|
logger.debug("Infos: "+infos);
|
||||||
|
if(infos.size()<=0){
|
||||||
|
logger.error("Error creating series for task accounting: No data available!");
|
||||||
|
throw new AccountingManagerServiceException("No data available!");
|
||||||
|
}
|
||||||
|
|
||||||
SeriesResponse seriesResponse = new SeriesResponse();
|
SeriesResponse seriesResponse = new SeriesResponse();
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@ public class Constants {
|
||||||
public static final String AM_LANG_COOKIE = "AMLangCookie";
|
public static final String AM_LANG_COOKIE = "AMLangCookie";
|
||||||
public static final String AM_LANG = "AMLang";
|
public static final String AM_LANG = "AMLang";
|
||||||
public final static String DEFAULT_USER = "test.user";
|
public final static String DEFAULT_USER = "test.user";
|
||||||
public final static String DEFAULT_SCOPE = "/gcube/devNext";
|
//public final static String DEFAULT_SCOPE = "/gcube/devNext";
|
||||||
//public final static String DEFAULT_SCOPE = "/gcube/devsec/devVRE";
|
public final static String DEFAULT_SCOPE = "/gcube/devsec/devVRE";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue