ref 11711: SAI - Add a simple text viewer so that log files created by Data Miner algorithms can be directly viewed in the browser
https://support.d4science.org/issues/11711 Added service info[ticket #12594] Added support to show log information [ticket #11711] Added support to show files html, json, pdf, txt [ticket #17106] Updated information show to the user when a computation is submitted [ticket #17030] git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@181871 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ad17f51709
commit
091b0ef530
|
@ -92,7 +92,7 @@ public class ComputationValueFilePanel extends SimpleContainer {
|
|||
if (fileName != null && !fileName.isEmpty()) {
|
||||
String fileNameLowerCase = fileName.toLowerCase();
|
||||
if (fileNameLowerCase.endsWith(".html") || fileNameLowerCase.endsWith(".htm")
|
||||
|| fileNameLowerCase.endsWith(".log") || fileNameLowerCase.endsWith(".json")
|
||||
|| fileNameLowerCase.endsWith(".pdf")|| fileNameLowerCase.endsWith(".log") || fileNameLowerCase.endsWith(".json")
|
||||
|| fileNameLowerCase.endsWith(".txt")) {
|
||||
buttonsContainer.add(showFileButton, buttonBoxLayoutData);
|
||||
}
|
||||
|
|
|
@ -21,9 +21,11 @@ import com.sencha.gxt.widget.core.client.TabPanel;
|
|||
*
|
||||
*/
|
||||
public class WorkflowPanel extends TabPanel {
|
||||
|
||||
public static final String DEFAULT_OPERATOR = "AQUAMAPS_SUITABLE";
|
||||
|
||||
private static final String OPERATOR = "Operator";
|
||||
private static final String COMPUTATIONS_EXECUTION = "Computations Execution";
|
||||
private static final String SERVICE_INFO = "Service Profile";
|
||||
|
||||
|
||||
private ComputationExecutionPanel computationExecutionPanel;
|
||||
private ComputationPanel computationPanel;
|
||||
private ServiceInfoPanel environmentPanel;
|
||||
|
@ -45,7 +47,7 @@ public class WorkflowPanel extends TabPanel {
|
|||
|
||||
private void create() {
|
||||
|
||||
TabItemConfig tabWorkFlowLcItemConf = new TabItemConfig("Operator",
|
||||
TabItemConfig tabWorkFlowLcItemConf = new TabItemConfig(OPERATOR,
|
||||
false);
|
||||
tabWorkFlowLcItemConf.setIcon(DataMinerManager.resources
|
||||
.folderExplore());
|
||||
|
@ -63,14 +65,14 @@ public class WorkflowPanel extends TabPanel {
|
|||
add(computationPanel, tabWorkFlowLcItemConf);
|
||||
|
||||
TabItemConfig tabComputationPanelItemConf = new TabItemConfig(
|
||||
"Computations Execution", false);
|
||||
COMPUTATIONS_EXECUTION, false);
|
||||
tabComputationPanelItemConf.setIcon(DataMinerManager.resources
|
||||
.folderExplore());
|
||||
computationExecutionPanel = new ComputationExecutionPanel();
|
||||
add(computationExecutionPanel, tabComputationPanelItemConf);
|
||||
|
||||
TabItemConfig tabEnvironmentPanelItemConf = new TabItemConfig(
|
||||
"Service Info", false);
|
||||
SERVICE_INFO, false);
|
||||
tabEnvironmentPanelItemConf.setIcon(DataMinerManager.resources
|
||||
.folderExplore());
|
||||
environmentPanel = new ServiceInfoPanel();
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
package org.gcube.portlets.user.dataminermanager.client.info;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ServiceInfoData implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 4732143678328978038L;
|
||||
private String key;
|
||||
private String value;
|
||||
|
||||
public ServiceInfoData() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ServiceInfoData(String key, String value) {
|
||||
super();
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ServiceInfoData [key=" + key + ", value=" + value + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
package org.gcube.portlets.user.dataminermanager.client.info;
|
||||
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.service.ServiceInfoData;
|
||||
|
||||
import com.google.gwt.editor.client.Editor.Path;
|
||||
import com.sencha.gxt.core.client.ValueProvider;
|
||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||
|
@ -17,6 +19,6 @@ public interface ServiceInfoDataProperties extends PropertyAccess<ServiceInfoDat
|
|||
|
||||
ValueProvider<ServiceInfoData, String> key();
|
||||
ValueProvider<ServiceInfoData, String> value();
|
||||
|
||||
ValueProvider<ServiceInfoData, String> category();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.service.ServiceInfo;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.service.ServiceInfoData;
|
||||
import org.gcube.portlets.user.dataminermanager.client.common.EventBusProvider;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.ServiceInfoEvent;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.ServiceInfoRequestEvent;
|
||||
|
@ -24,6 +25,7 @@ import com.sencha.gxt.widget.core.client.form.FieldSet;
|
|||
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
|
||||
import com.sencha.gxt.widget.core.client.grid.Grid;
|
||||
import com.sencha.gxt.widget.core.client.grid.GroupingView;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -33,6 +35,8 @@ import com.sencha.gxt.widget.core.client.grid.Grid;
|
|||
*/
|
||||
public class ServiceInfoPanel extends FramedPanel {
|
||||
|
||||
private static final String RUNTIME_FEATURE = "Runtime features";
|
||||
private static final String SERVICE_INFO_TITLE = "Service Profile";
|
||||
private static final ServiceInfoDataProperties props = GWT.create(ServiceInfoDataProperties.class);
|
||||
private VerticalLayoutContainer v;
|
||||
private VerticalLayoutContainer environmentVBox;
|
||||
|
@ -55,7 +59,7 @@ public class ServiceInfoPanel extends FramedPanel {
|
|||
setBodyStyle("backgroundColor:white;");
|
||||
setHeaderVisible(false);
|
||||
setResize(true);
|
||||
setHeadingText("Service Info");
|
||||
setHeadingText(SERVICE_INFO_TITLE);
|
||||
setBodyStyle("backgroundColor:white;");
|
||||
|
||||
}
|
||||
|
@ -90,17 +94,23 @@ public class ServiceInfoPanel extends FramedPanel {
|
|||
private void createView() {
|
||||
|
||||
SimpleContainer sectionTitle = new SimpleContainer();
|
||||
SimpleContainer sectionSubTitle = new SimpleContainer();
|
||||
|
||||
// title
|
||||
HtmlLayoutContainer title = new HtmlLayoutContainer(
|
||||
"<center style='font-size:16px;font-weight:bold;'>Service Info</center>");
|
||||
"<center style='font-size:16px;font-weight:bold;'>" + SERVICE_INFO_TITLE + "</center>");
|
||||
sectionTitle.add(title, new MarginData());
|
||||
sectionTitle.getElement().getStyle().setMarginRight(20, Unit.PX);
|
||||
// v.add(sectionTitle, new VerticalLayoutData(1, -1, new
|
||||
// Margins(0)));
|
||||
v.add(sectionTitle, new VerticalLayoutData(-1, -1, new Margins(10)));
|
||||
|
||||
FieldSet environmentFieldSet = environmentView();
|
||||
v.add(environmentFieldSet, new VerticalLayoutData(-1, -1, new Margins(10)));
|
||||
// subtitle
|
||||
HtmlLayoutContainer subtitle = new HtmlLayoutContainer(
|
||||
"<p style='font-size:12px;'>This page reports information on the DataMiner "
|
||||
+ "service instance serving this working environment giving an up to date "
|
||||
+ "picture of its capacities and capabilities.</p>");
|
||||
sectionSubTitle.add(subtitle, new MarginData());
|
||||
sectionSubTitle.getElement().getStyle().setMarginRight(20, Unit.PX);
|
||||
v.add(sectionSubTitle, new VerticalLayoutData(-1, -1, new Margins(10)));
|
||||
|
||||
}
|
||||
|
||||
|
@ -109,7 +119,7 @@ public class ServiceInfoPanel extends FramedPanel {
|
|||
environmentVBox = new VerticalLayoutContainer();
|
||||
|
||||
FieldSet configurationFieldSet = new FieldSet();
|
||||
configurationFieldSet.setHeadingText("Environment");
|
||||
configurationFieldSet.setHeadingText(RUNTIME_FEATURE);
|
||||
configurationFieldSet.setCollapsible(true);
|
||||
configurationFieldSet.add(environmentVBox);
|
||||
configurationFieldSet.getElement().getStyle().setMarginRight(20, Unit.PX);
|
||||
|
@ -120,20 +130,55 @@ public class ServiceInfoPanel extends FramedPanel {
|
|||
}
|
||||
}
|
||||
|
||||
private void showAddress(ServiceInfoData address) {
|
||||
// address
|
||||
SimpleContainer sectionServerAddress = new SimpleContainer();
|
||||
|
||||
HtmlLayoutContainer addressHtml = new HtmlLayoutContainer(
|
||||
"<p style='font-size:12px;'>The base url of the service instance is " + "<a href='" + address.getValue() + "'>"
|
||||
+ address.getValue() + "</a>.</p>");
|
||||
sectionServerAddress.add(addressHtml, new MarginData());
|
||||
sectionServerAddress.getElement().getStyle().setMarginRight(20, Unit.PX);
|
||||
v.add(sectionServerAddress, new VerticalLayoutData(-1, -1, new Margins(10)));
|
||||
|
||||
}
|
||||
|
||||
private void showServiceInfo(ServiceInfo serviceInfo) {
|
||||
|
||||
if (serviceInfo != null && serviceInfo.getServiceProperties() != null
|
||||
&& !serviceInfo.getServiceProperties().isEmpty()) {
|
||||
ArrayList<ServiceInfoData> serviceInfoDataList = new ArrayList<>();
|
||||
for (String key : serviceInfo.getServiceProperties().keySet()) {
|
||||
ServiceInfoData serviceInfoData = new ServiceInfoData(key, serviceInfo.getServiceProperties().get(key));
|
||||
serviceInfoDataList.add(serviceInfoData);
|
||||
|
||||
ServiceInfoData address=null;
|
||||
ArrayList<ServiceInfoData> properties=serviceInfo.getServiceProperties();
|
||||
for(ServiceInfoData serviceInfoData:properties) {
|
||||
if(serviceInfoData.getKey().compareTo("Address")==0){
|
||||
address = serviceInfoData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(address!=null){
|
||||
properties.remove(address);
|
||||
showAddress(address);
|
||||
}
|
||||
|
||||
FieldSet environmentFieldSet = environmentView();
|
||||
v.add(environmentFieldSet, new VerticalLayoutData(-1, -1, new Margins(10)));
|
||||
|
||||
Grid<ServiceInfoData> grid = createInfoGrid(serviceInfoDataList);
|
||||
environmentVBox.add(grid, new VerticalLayoutData(1, -1, new Margins(0, 4, 0, 4)));
|
||||
if (!properties.isEmpty()) {
|
||||
Grid<ServiceInfoData> grid = createInfoGrid(properties);
|
||||
environmentVBox.add(grid, new VerticalLayoutData(1, -1, new Margins(0, 4, 0, 4)));
|
||||
} else {
|
||||
HtmlLayoutContainer emptyInfoContainer = new HtmlLayoutContainer(
|
||||
"<div class='service-property'><p>No Info Available.</p></div>");
|
||||
|
||||
environmentVBox.add(emptyInfoContainer, new VerticalLayoutData(1, -1, new Margins(0, 4, 0, 4)));
|
||||
|
||||
}
|
||||
} else {
|
||||
FieldSet environmentFieldSet = environmentView();
|
||||
v.add(environmentFieldSet, new VerticalLayoutData(-1, -1, new Margins(10)));
|
||||
|
||||
HtmlLayoutContainer emptyInfoContainer = new HtmlLayoutContainer(
|
||||
"<div class='service-property'><p>No Info Available.</p></div>");
|
||||
|
||||
|
@ -144,31 +189,40 @@ public class ServiceInfoPanel extends FramedPanel {
|
|||
|
||||
}
|
||||
|
||||
private Grid<ServiceInfoData> createInfoGrid(ArrayList<ServiceInfoData> serviceInfoDataList) {
|
||||
private Grid<ServiceInfoData> createInfoGrid(ArrayList<ServiceInfoData> properties) {
|
||||
|
||||
ColumnConfig<ServiceInfoData, String> keyCol = new ColumnConfig<ServiceInfoData, String>(props.key(), 100,
|
||||
"Key");
|
||||
ColumnConfig<ServiceInfoData, String> valueCol = new ColumnConfig<ServiceInfoData, String>(props.value(), 100,
|
||||
"Value");
|
||||
ColumnConfig<ServiceInfoData, String> categoryCol = new ColumnConfig<ServiceInfoData, String>(props.category(),
|
||||
100,"Category");
|
||||
|
||||
List<ColumnConfig<ServiceInfoData, ?>> columns = new ArrayList<ColumnConfig<ServiceInfoData, ?>>();
|
||||
columns.add(keyCol);
|
||||
columns.add(valueCol);
|
||||
columns.add(categoryCol);
|
||||
|
||||
ColumnModel<ServiceInfoData> cm = new ColumnModel<ServiceInfoData>(columns);
|
||||
|
||||
ListStore<ServiceInfoData> store = new ListStore<ServiceInfoData>(props.id());
|
||||
store.addAll(serviceInfoDataList);
|
||||
store.addAll(properties);
|
||||
|
||||
final GroupingView<ServiceInfoData> groupingView = new GroupingView<ServiceInfoData>();
|
||||
groupingView.setShowGroupedColumn(false);
|
||||
groupingView.groupBy(categoryCol);
|
||||
groupingView.setForceFit(true);
|
||||
groupingView.setAutoExpandColumn(valueCol);
|
||||
groupingView.setEmptyText("No info retrieved");
|
||||
|
||||
// grid.getView().setAutoFill(true);
|
||||
// groupingView.setStripeRows(true);
|
||||
// groupingView.setColumnLines(true);
|
||||
|
||||
Grid<ServiceInfoData> grid = new Grid<ServiceInfoData>(store, cm, groupingView);
|
||||
|
||||
Grid<ServiceInfoData> grid = new Grid<ServiceInfoData>(store, cm);
|
||||
|
||||
grid.setAllowTextSelection(false);
|
||||
grid.getView().setAutoFill(true);
|
||||
grid.getView().setAutoExpandColumn(valueCol);
|
||||
grid.getView().setEmptyText("No info retrieved");
|
||||
grid.setAllowTextSelection(true);
|
||||
grid.getView().setStripeRows(true);
|
||||
grid.getView().setColumnLines(true);
|
||||
grid.setBorders(false);
|
||||
grid.setColumnReordering(false);
|
||||
|
||||
|
|
|
@ -55,9 +55,14 @@ public class FileViewer extends SimpleContainer {
|
|||
private void create() {
|
||||
VerticalLayoutContainer lc = new VerticalLayoutContainer();
|
||||
final String fileName = fileResource.getName();
|
||||
String fileDescription = fileResource.getDescription();
|
||||
final String fileUrl = fileResource.getUrl();
|
||||
|
||||
if(fileDescription==null||fileDescription.isEmpty()){
|
||||
fileDescription="Unknow";
|
||||
}
|
||||
HtmlLayoutContainer fileNameHtml = new HtmlLayoutContainer("<div class='computation-output-fileName'><p>"
|
||||
+ new SafeHtmlBuilder().appendEscaped(fileName).toSafeHtml().asString() + "</p></div>");
|
||||
+ new SafeHtmlBuilder().appendEscaped(fileDescription).toSafeHtml().asString() + "</p></div>");
|
||||
lc.add(fileNameHtml, new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||
|
||||
TextButton showFileButton = new TextButton("Show");
|
||||
|
@ -100,7 +105,7 @@ public class FileViewer extends SimpleContainer {
|
|||
if (fileName != null && !fileName.isEmpty()) {
|
||||
String fileNameLowerCase = fileName.toLowerCase();
|
||||
if (fileNameLowerCase.endsWith(".html") || fileNameLowerCase.endsWith(".htm")
|
||||
|| fileNameLowerCase.endsWith(".log") || fileNameLowerCase.endsWith(".json")
|
||||
|| fileNameLowerCase.endsWith(".pdf")|| fileNameLowerCase.endsWith(".log") || fileNameLowerCase.endsWith(".json")
|
||||
|| fileNameLowerCase.endsWith(".txt")) {
|
||||
buttonsContainer.add(showFileButton, buttonBoxLayoutData);
|
||||
}
|
||||
|
|
|
@ -25,19 +25,19 @@ public class ImageViewer extends SimpleContainer {
|
|||
protected static final String SAVE_OK_TITLE = "Saving operation was successful";
|
||||
protected static final String SAVE_FAIL_TITLE = "Error";
|
||||
protected static final String SAVE_FAIL_MESSAGE = "Error in saving images.";
|
||||
private ImageResource imagesResource;
|
||||
private ImageResource imageResource;
|
||||
// private ComputationId computationId;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param computationId
|
||||
* computation id
|
||||
* @param imagesResource
|
||||
* @param imageResource
|
||||
* image resource
|
||||
*/
|
||||
public ImageViewer(ComputationId computationId, ImageResource imagesResource) {
|
||||
public ImageViewer(ComputationId computationId, ImageResource imageResource) {
|
||||
super();
|
||||
this.imagesResource = imagesResource;
|
||||
this.imageResource = imageResource;
|
||||
// this.computationId = computationId;
|
||||
create();
|
||||
}
|
||||
|
@ -45,23 +45,27 @@ public class ImageViewer extends SimpleContainer {
|
|||
private void create() {
|
||||
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||
add(v);
|
||||
if (imagesResource == null || imagesResource.getLink() == null || imagesResource.getLink().isEmpty())
|
||||
if (imageResource == null || imageResource.getLink() == null || imageResource.getLink().isEmpty())
|
||||
v.add(new HtmlLayoutContainer("<i>No image found.</i>"), new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||
else {
|
||||
v.add(new HtmlLayoutContainer(imagesResource.getName()), new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||
String imageName="Unknow";
|
||||
if(imageResource.getName()!=null&&!imageResource.getName().isEmpty()){
|
||||
imageName=imageResource.getName();
|
||||
}
|
||||
v.add(new HtmlLayoutContainer(imageName), new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||
TextButton saveImageBtn = new TextButton("Download Image");
|
||||
saveImageBtn.setIcon(DataMinerManager.resources.download());
|
||||
saveImageBtn.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
com.google.gwt.user.client.Window.open(imagesResource.getLink(), imagesResource.getName(), "");
|
||||
com.google.gwt.user.client.Window.open(imageResource.getLink(), imageResource.getName(), "");
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
v.add(saveImageBtn, new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||
final Image img = new Image(imagesResource.getLink());
|
||||
final Image img = new Image(imageResource.getLink());
|
||||
v.add(img, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
}
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@ import static org.gcube.common.authorization.client.Constants.authorizationServi
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.common.authorization.library.provider.UserInfo;
|
||||
import org.gcube.data.analysis.dataminermanagercl.server.is.InformationSystemUtils;
|
||||
import org.gcube.data.analysis.dataminermanagercl.server.util.ServiceCredentials;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.service.ServiceInfoData;
|
||||
import org.gcube.portlets.user.dataminermanager.shared.Constants;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -64,7 +64,7 @@ public class TestInformationSystemRequests extends TestCase {
|
|||
|
||||
}
|
||||
|
||||
Map<String, String> serviceProperties = InformationSystemUtils.retrieveServiceProperties(
|
||||
ArrayList<ServiceInfoData> serviceProperties = InformationSystemUtils.retrieveServiceProperties(
|
||||
Constants.DATAMINER_SERVICE_CATEGORY, Constants.DATA_MINER_SERVICE_NAME, serviceCredentials.getScope());
|
||||
logger.debug("Service Properties retrieved:" + serviceProperties);
|
||||
if (serviceProperties == null || serviceProperties.isEmpty()) {
|
||||
|
@ -72,8 +72,8 @@ public class TestInformationSystemRequests extends TestCase {
|
|||
throw new Exception("No DataMiner service properties available!");
|
||||
} else {
|
||||
logger.info("DataMiner service properties found: ");
|
||||
for (String key : serviceProperties.keySet()) {
|
||||
logger.debug("Property: " + key + "=" + serviceProperties.get(key));
|
||||
for (ServiceInfoData serviceInfoData : serviceProperties) {
|
||||
logger.debug("Property: " + serviceInfoData);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue