Added error page
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/performfish-analytics-portlet@179314 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c432df0a7c
commit
851d384cbd
|
@ -7,7 +7,9 @@ import java.util.Map;
|
||||||
import org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsConstant.POPULATION_LEVEL;
|
import org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsConstant.POPULATION_LEVEL;
|
||||||
import org.gcube.portlets.user.performfishanalytics.client.annualcontrollers.PerformFishAnnualAnalyticsController;
|
import org.gcube.portlets.user.performfishanalytics.client.annualcontrollers.PerformFishAnnualAnalyticsController;
|
||||||
import org.gcube.portlets.user.performfishanalytics.client.controllers.PerformFishAnalyticsController;
|
import org.gcube.portlets.user.performfishanalytics.client.controllers.PerformFishAnalyticsController;
|
||||||
|
import org.gcube.portlets.user.performfishanalytics.client.controllers.PerformFishAnalyticsViewController;
|
||||||
import org.gcube.portlets.user.performfishanalytics.client.event.LoadPopulationTypeEvent;
|
import org.gcube.portlets.user.performfishanalytics.client.event.LoadPopulationTypeEvent;
|
||||||
|
import org.gcube.portlets.user.performfishanalytics.client.resources.PerformFishResources;
|
||||||
import org.gcube.portlets.user.performfishanalytics.client.view.util.DecodeParameterUtil;
|
import org.gcube.portlets.user.performfishanalytics.client.view.util.DecodeParameterUtil;
|
||||||
import org.gcube.portlets.user.performfishanalytics.shared.performfishservice.PerformFishInitParameter;
|
import org.gcube.portlets.user.performfishanalytics.shared.performfishservice.PerformFishInitParameter;
|
||||||
|
|
||||||
|
@ -15,8 +17,14 @@ import com.google.gwt.core.client.EntryPoint;
|
||||||
import com.google.gwt.core.client.Scheduler;
|
import com.google.gwt.core.client.Scheduler;
|
||||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||||
import com.google.gwt.core.shared.GWT;
|
import com.google.gwt.core.shared.GWT;
|
||||||
|
import com.google.gwt.dom.client.DivElement;
|
||||||
|
import com.google.gwt.dom.client.Document;
|
||||||
|
import com.google.gwt.resources.client.ImageResource;
|
||||||
|
import com.google.gwt.resources.client.TextResource;
|
||||||
import com.google.gwt.user.client.Window;
|
import com.google.gwt.user.client.Window;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
|
import com.google.gwt.user.client.ui.RootPanel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entry point classes define <code>onModuleLoad()</code>.
|
* Entry point classes define <code>onModuleLoad()</code>.
|
||||||
|
@ -50,7 +58,9 @@ public class PerformFishAnalytics implements EntryPoint {
|
||||||
final String farmidParam = initParams.get(PerformFishAnalyticsConstant.QUERY_STRING_FARMID_PARAM);
|
final String farmidParam = initParams.get(PerformFishAnalyticsConstant.QUERY_STRING_FARMID_PARAM);
|
||||||
|
|
||||||
if(farmidParam==null || farmidParam.isEmpty()){
|
if(farmidParam==null || farmidParam.isEmpty()){
|
||||||
Window.alert("Error: no '"+PerformFishAnalyticsConstant.QUERY_STRING_FARMID_PARAM+"' param detected");
|
String msg = "No '"+PerformFishAnalyticsConstant.QUERY_STRING_FARMID_PARAM+"' param detected";
|
||||||
|
showErrorPage(msg);
|
||||||
|
Window.alert("Error: "+msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +110,9 @@ public class PerformFishAnalytics implements EntryPoint {
|
||||||
|
|
||||||
//CALLING THE PORTLET WITHOUT ANNUAL CONFIGURATION
|
//CALLING THE PORTLET WITHOUT ANNUAL CONFIGURATION
|
||||||
if(batchtypeParam==null || batchtypeParam.isEmpty()){
|
if(batchtypeParam==null || batchtypeParam.isEmpty()){
|
||||||
Window.alert("Error: no '"+PerformFishAnalyticsConstant.PERFORM_FISH_BATCH_TYPE_PARAM+"' param detected");
|
String msg = "No '"+PerformFishAnalyticsConstant.PERFORM_FISH_BATCH_TYPE_PARAM+"' param detected";
|
||||||
|
showErrorPage(msg);
|
||||||
|
Window.alert("Error: "+msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,4 +139,13 @@ public class PerformFishAnalytics implements EntryPoint {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showErrorPage(String msg) {
|
||||||
|
TextResource errorHtmlPage = PerformFishResources.INSTANCE.errorPage();
|
||||||
|
HTML asHtml = new HTML(errorHtmlPage.getText());
|
||||||
|
//asHtml.asWidget().getElement().
|
||||||
|
RootPanel.get(PerformFishAnalyticsViewController.PERFORM_FISH_ANALYTICS_DIV).add(asHtml);
|
||||||
|
DivElement errorID = (DivElement) Document.get().getElementById("error-page");
|
||||||
|
errorID.setInnerHTML(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,104 +84,6 @@ public class PerformFishAnalyticsController {
|
||||||
|
|
||||||
registerHandlers();
|
registerHandlers();
|
||||||
viewController = new PerformFishAnalyticsViewController();
|
viewController = new PerformFishAnalyticsViewController();
|
||||||
|
|
||||||
/*viewAnnualController = new PerformFishAnnualAnalyticsViewController();
|
|
||||||
|
|
||||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
|
|
||||||
Map<String, String> initParams = new HashMap<String, String>();
|
|
||||||
for (String key : Window.Location.getParameterMap().keySet()) {
|
|
||||||
try {
|
|
||||||
String dKeY = DecodeParameterUtil.base64Decode(key);
|
|
||||||
String eValue = Window.Location.getParameter(key);
|
|
||||||
String dParam = DecodeParameterUtil.base64Decode(eValue);
|
|
||||||
initParams.put(dKeY, dParam);
|
|
||||||
} catch (Exception e) {
|
|
||||||
GWT.log("Error: "+e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GWT.log("Decoded parameters: "+initParams);
|
|
||||||
|
|
||||||
|
|
||||||
final String farmidParam = initParams.get(PerformFishAnalyticsConstant.QUERY_STRING_FARMID_PARAM);
|
|
||||||
|
|
||||||
if(farmidParam==null || farmidParam.isEmpty()){
|
|
||||||
Window.alert("Error: no '"+PerformFishAnalyticsConstant.QUERY_STRING_FARMID_PARAM+"' param detected");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final String annual = initParams.get(PerformFishAnalyticsConstant.QUERY_STRING_ANNUAL_PARAMETER);
|
|
||||||
|
|
||||||
boolean isAnnualCall = false;
|
|
||||||
|
|
||||||
try {
|
|
||||||
isAnnualCall = Boolean.parseBoolean(annual);
|
|
||||||
GWT.log("Read decoded isAnnual at: "+isAnnualCall);
|
|
||||||
}catch (Exception e) {
|
|
||||||
GWT.log("Forcing isAnnual at TRUE");
|
|
||||||
isAnnualCall = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
String batchtypeParam = initParams.get(PerformFishAnalyticsConstant.QUERY_STRING_BATCHTYPE_PARAM);
|
|
||||||
|
|
||||||
//IS ANNUAL CALL
|
|
||||||
if(isAnnualCall) {
|
|
||||||
|
|
||||||
//CALLING THE PORTLET WITH ANNUAL CONFIGURATION
|
|
||||||
batchtypeParam = PerformFishAnalyticsConstant.BATCH_LEVEL.GROW_OUT_AGGREGATED_CLOSED_BATCHES.name();
|
|
||||||
GWT.log("Hard cabling batchtypeParam as: "+batchtypeParam);
|
|
||||||
|
|
||||||
PerformFishInitParameter performFishInitParams = new PerformFishInitParameter();
|
|
||||||
performFishInitParams.addParameter(PerformFishAnalyticsConstant.PERFORM_FISH_BATCH_TYPE_PARAM, batchtypeParam);
|
|
||||||
performFishInitParams.addParameter(PerformFishAnalyticsConstant.PERFORM_FISH_FARMID_PARAM, farmidParam);
|
|
||||||
|
|
||||||
PerformFishAnalyticsServiceAsync.Util.getInstance().validParameters(performFishInitParams, new AsyncCallback<PerformFishInitParameter>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(PerformFishInitParameter result) {
|
|
||||||
decryptParameters = result;
|
|
||||||
eventBus.fireEvent(new LoadPopulationTypeEvent(POPULATION_LEVEL.FARM.name(), null));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
|
|
||||||
Window.alert(caught.getMessage());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}else {
|
|
||||||
|
|
||||||
//CALLING THE PORTLET WITHOUT ANNUAL CONFIGURATION
|
|
||||||
if(batchtypeParam==null || batchtypeParam.isEmpty()){
|
|
||||||
Window.alert("Error: no '"+PerformFishAnalyticsConstant.PERFORM_FISH_BATCH_TYPE_PARAM+"' param detected");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
PerformFishInitParameter performFishInitParams = new PerformFishInitParameter();
|
|
||||||
performFishInitParams.addParameter(PerformFishAnalyticsConstant.PERFORM_FISH_BATCH_TYPE_PARAM, batchtypeParam);
|
|
||||||
performFishInitParams.addParameter(PerformFishAnalyticsConstant.PERFORM_FISH_FARMID_PARAM, farmidParam);
|
|
||||||
|
|
||||||
PerformFishAnalyticsServiceAsync.Util.getInstance().validParameters(performFishInitParams, new AsyncCallback<PerformFishInitParameter>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(PerformFishInitParameter result) {
|
|
||||||
decryptParameters = result;
|
|
||||||
eventBus.fireEvent(new LoadPopulationTypeEvent(POPULATION_LEVEL.BATCH.name(), null));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
|
|
||||||
Window.alert(caught.getMessage());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -6,7 +6,7 @@ package org.gcube.portlets.user.performfishanalytics.client.dialog;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.performfishanalytics.client.resources.Icons;
|
import org.gcube.portlets.user.performfishanalytics.client.resources.PerformFishResources;
|
||||||
|
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
|
@ -34,7 +34,7 @@ public class DialogConfirm extends DialogBox implements ClickHandler {
|
||||||
private DockPanel dock = new DockPanel();
|
private DockPanel dock = new DockPanel();
|
||||||
private Button yesButton;
|
private Button yesButton;
|
||||||
private VerticalPanel vpContainer;
|
private VerticalPanel vpContainer;
|
||||||
private ImageResource loading = Icons.ICONS.loading();
|
private ImageResource loading = PerformFishResources.INSTANCE.loading();
|
||||||
private HorizontalPanel hpButtons = new HorizontalPanel();
|
private HorizontalPanel hpButtons = new HorizontalPanel();
|
||||||
private Button noButton;
|
private Button noButton;
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,7 +5,7 @@ package org.gcube.portlets.user.performfishanalytics.client.dialog;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.performfishanalytics.client.resources.Icons;
|
import org.gcube.portlets.user.performfishanalytics.client.resources.PerformFishResources;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Alert;
|
import com.github.gwtbootstrap.client.ui.Alert;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||||
|
@ -35,7 +35,7 @@ public abstract class PanelConfirmBuilder {
|
||||||
private DockPanel dock = new DockPanel();
|
private DockPanel dock = new DockPanel();
|
||||||
private Button yesButton;
|
private Button yesButton;
|
||||||
private VerticalPanel vpContainer;
|
private VerticalPanel vpContainer;
|
||||||
private ImageResource loading = Icons.ICONS.loading();
|
private ImageResource loading = PerformFishResources.INSTANCE.loading();
|
||||||
private HorizontalPanel hpButtons = new HorizontalPanel();
|
private HorizontalPanel hpButtons = new HorizontalPanel();
|
||||||
private Button noButton;
|
private Button noButton;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,153 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
|
||||||
|
|
||||||
|
<title>PerformFish Error Page</title>
|
||||||
|
|
||||||
|
<!-- Google font -->
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Raleway:400,700"
|
||||||
|
rel="stylesheet">
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Passion+One:900"
|
||||||
|
rel="stylesheet">
|
||||||
|
|
||||||
|
<!-- Custom stlylesheet -->
|
||||||
|
<style type="text/css">
|
||||||
|
* {
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#notfound {
|
||||||
|
position: relative;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
#notfound .notfound {
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
-webkit-transform: translate(-50%, -50%);
|
||||||
|
-ms-transform: translate(-50%, -50%);
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.notfound {
|
||||||
|
max-width: 710px;
|
||||||
|
width: 100%;
|
||||||
|
padding-left: 190px;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
#the-title{
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notfound .notfound-404 {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 150px;
|
||||||
|
height: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notfound .notfound-404 h1 {
|
||||||
|
font-family: 'Passion One', cursive;
|
||||||
|
color: #00b5c3;
|
||||||
|
font-size: 150px;
|
||||||
|
letter-spacing: 15.5px;
|
||||||
|
margin: 0px;
|
||||||
|
font-weight: 900;
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
-webkit-transform: translate(-50%, -50%);
|
||||||
|
-ms-transform: translate(-50%, -50%);
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.notfound h2 {
|
||||||
|
font-family: 'Raleway', sans-serif;
|
||||||
|
color: #292929;
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 700;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 2.5px;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notfound p {
|
||||||
|
font-family: 'Raleway', sans-serif;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 400;
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notfound a {
|
||||||
|
font-family: 'Raleway', sans-serif;
|
||||||
|
font-size: 14px;
|
||||||
|
text-decoration: none;
|
||||||
|
text-transform: uppercase;
|
||||||
|
background: #fff;
|
||||||
|
display: inline-block;
|
||||||
|
padding: 15px 30px;
|
||||||
|
border-radius: 40px;
|
||||||
|
color: #292929;
|
||||||
|
font-weight: 700;
|
||||||
|
-webkit-box-shadow: 0px 4px 15px -5px rgba(0, 0, 0, 0.3);
|
||||||
|
box-shadow: 0px 4px 15px -5px rgba(0, 0, 0, 0.3);
|
||||||
|
-webkit-transition: 0.2s all;
|
||||||
|
transition: 0.2s all;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notfound a:hover {
|
||||||
|
color: #fff;
|
||||||
|
background-color: #00b5c3;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 480px) {
|
||||||
|
.notfound {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.notfound .notfound-404 {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
.notfound {
|
||||||
|
padding-left: 15px;
|
||||||
|
padding-right: 15px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div id="notfound">
|
||||||
|
<div class="notfound">
|
||||||
|
<div class="notfound-404">
|
||||||
|
<h1>:(</h1>
|
||||||
|
</div>
|
||||||
|
<div id="the-title">PerformFISH Error Page</div>
|
||||||
|
<p id="error-page"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
|
@ -6,17 +6,19 @@ package org.gcube.portlets.user.performfishanalytics.client.resources;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.resources.client.ClientBundle;
|
import com.google.gwt.resources.client.ClientBundle;
|
||||||
import com.google.gwt.resources.client.ImageResource;
|
import com.google.gwt.resources.client.ImageResource;
|
||||||
|
import com.google.gwt.resources.client.TextResource;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Interface Icons.
|
* The Interface PerformFishResources.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
* Jan 16, 2019
|
*
|
||||||
|
* May 8, 2019
|
||||||
*/
|
*/
|
||||||
public interface Icons extends ClientBundle {
|
public interface PerformFishResources extends ClientBundle {
|
||||||
|
|
||||||
public static final Icons ICONS = GWT.create(Icons.class);
|
public static final PerformFishResources INSTANCE = GWT.create(PerformFishResources.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loading.
|
* Loading.
|
||||||
|
@ -73,4 +75,7 @@ public interface Icons extends ClientBundle {
|
||||||
*/
|
*/
|
||||||
@Source("github.png")
|
@Source("github.png")
|
||||||
ImageResource github();
|
ImageResource github();
|
||||||
|
|
||||||
|
@Source("Error_Page.html")
|
||||||
|
public TextResource errorPage();
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.performfishanalytics.client.view;
|
package org.gcube.portlets.user.performfishanalytics.client.view;
|
||||||
|
|
||||||
import org.gcube.portlets.user.performfishanalytics.client.resources.Icons;
|
import org.gcube.portlets.user.performfishanalytics.client.resources.PerformFishResources;
|
||||||
|
|
||||||
import com.google.gwt.user.client.ui.FocusPanel;
|
import com.google.gwt.user.client.ui.FocusPanel;
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
|
@ -19,7 +19,7 @@ import com.google.gwt.user.client.ui.Image;
|
||||||
public class LoaderIcon extends FocusPanel{
|
public class LoaderIcon extends FocusPanel{
|
||||||
|
|
||||||
|
|
||||||
private Image imgLoading = new Image(Icons.ICONS.loading());
|
private Image imgLoading = new Image(PerformFishResources.INSTANCE.loading());
|
||||||
private HTML txtLoading = new HTML("");
|
private HTML txtLoading = new HTML("");
|
||||||
|
|
||||||
private HorizontalPanel hp = new HorizontalPanel();
|
private HorizontalPanel hp = new HorizontalPanel();
|
||||||
|
|
Loading…
Reference in New Issue