git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/admin/vre-deploy@160117 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2017-12-06 15:22:11 +00:00
parent 27d8febb23
commit 5ea45659f0
12 changed files with 33 additions and 792 deletions

View File

@ -5,6 +5,7 @@
cretions</Change>
<Change>Task #10052, send email to infraManagers upon new VRE cretions
</Change>
<Change>Feature #6315, remove the mandatory node in creation phase</Change>
</Changeset>
<Changeset component="org.gcube.portlets-admin.vre-deploy.4-0-1"
date="2016-10-04">

View File

@ -1,9 +1,6 @@
package org.gcube.portlets.admin.vredeployer.client;
import java.util.List;
import org.gcube.portlets.admin.vredeployer.client.model.VREFunctionalityModel;
import org.gcube.portlets.admin.vredeployer.shared.GHNProfile;
import org.gcube.portlets.admin.vredeployer.shared.VREDeployerStatusType;
import org.gcube.portlets.admin.vredeployer.shared.VREDescrBean;
import org.gcube.portlets.admin.vredeployer.shared.deployreport.ClientDeployReport;
@ -23,18 +20,8 @@ public interface VredeployerService extends RemoteService {
VREDeployerStatusType isApprovingModeEnabled();
int isCloudSelected();
VREFunctionalityModel getFunctionality();
List<GHNProfile> getAvailableGHNs();
boolean setGHNsSelected(String[] selectedGHNIds);
boolean setCloudDeploy(int virtualMachines);
int getCloudVMSelected();
boolean deployVRE();
ClientDeployReport checkCreateVRE();

View File

@ -1,9 +1,6 @@
package org.gcube.portlets.admin.vredeployer.client;
import java.util.List;
import org.gcube.portlets.admin.vredeployer.client.model.VREFunctionalityModel;
import org.gcube.portlets.admin.vredeployer.shared.GHNProfile;
import org.gcube.portlets.admin.vredeployer.shared.VREDeployerStatusType;
import org.gcube.portlets.admin.vredeployer.shared.VREDescrBean;
import org.gcube.portlets.admin.vredeployer.shared.deployreport.ClientDeployReport;
@ -19,16 +16,6 @@ public interface VredeployerServiceAsync {
void isApprovingModeEnabled(AsyncCallback<VREDeployerStatusType> callback);
void getAvailableGHNs(AsyncCallback<List<GHNProfile>> callback);
void setGHNsSelected(String[] selectedGHNIds, AsyncCallback<Boolean> callback);
void isCloudSelected(AsyncCallback<Integer> callback);
void setCloudDeploy(int virtualMachines, AsyncCallback<Boolean> callback);
void getCloudVMSelected(AsyncCallback<Integer> callback);
void checkCreateVRE(AsyncCallback<ClientDeployReport> callback);
void deployVRE(AsyncCallback<Boolean> callback);

View File

@ -4,10 +4,8 @@ import org.gcube.portlets.admin.vredeployer.client.VREDeployerConstants;
import org.gcube.portlets.admin.vredeployer.client.Vredeployer;
import org.gcube.portlets.admin.vredeployer.client.model.AtomicTreeNode;
import org.gcube.portlets.admin.vredeployer.client.view.panels.CenterPanel;
import org.gcube.portlets.admin.vredeployer.shared.GHNBean;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.google.gwt.core.client.GWT;
public class Controller {
@ -37,21 +35,10 @@ public class Controller {
vreDeployer.getModel().getFunctionality();
vreDeployer.getMainContainer().showEastPanel(true);
break;
case ARCHITECTURE:
cp.setHeading("Select nodes to deploy VRE Services");
cp.setIconStyle("images/icons/architecture.png");
cp.emptyPanel();
showLoading();
showEastPanelLoading();
vreDeployer.getModel().getAvailableGhnList();
vreDeployer.getModel().checkCloudSelected();
vreDeployer.getMainContainer().showEastPanel(true);
break;
case REPORT:
cp.setHeading("Finalize");
cp.setIconStyle("images/icons/play.png");
cp.emptyPanel();
vreDeployer.getMainContainer().getCenterPanel().mask("Step Architecture Missing, define nodes first", "");
vreDeployer.getMainContainer().getEastPanel().hide();
vreDeployer.getModel().getSummary();
break;
@ -68,14 +55,6 @@ public class Controller {
vreDeployer.getMainContainer().getCenterPanel().mask(VREDeployerConstants.LOADING_TEXT, "loading-indicator");
}
/**
*
*/
private void showEastPanelLoading() {
vreDeployer.getMainContainer().getEastPanel().setIconStyle("images/icons/cloud.png");
vreDeployer.getMainContainer().getEastPanel().mask("Checking cloud availability please wait...", "loading-indicator");
}
/**
*
*/
@ -95,26 +74,13 @@ public class Controller {
vreDeployer.getMainContainer().getEastPanel().layout();
}
/**
*
* @param selectedGHNIds
* @param idCandidateGHN
*/
public void setGHNsSelected(GHNBean[] selectedGHNIds) {
vreDeployer.getModel().setGHNsSelected(selectedGHNIds);
}
public void maskCenterPanel(boolean mask) {
if (mask)
vreDeployer.getMainContainer().getCenterPanel().mask();
else
vreDeployer.getMainContainer().getCenterPanel().unmask();
}
public void setCloudSelected(boolean selected, int vMachines) {
vreDeployer.getModel().setCloudSelected(selected, vMachines);
}
public void createVreButtonClicked() {
vreDeployer.getModel().startVREDeploymentStatus();
}

View File

@ -21,15 +21,8 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
public class Model {
private VREDescrBean vreDesc;
private GHNBean[] selectedGHNs;
private boolean isCloudSelected = false;
private boolean isCloudAvailable = true;
/**
* Create a remote service proxy to talk to the server-side Greeting service.
@ -115,90 +108,13 @@ public class Model {
});
}
/**
*
*/
public void getAvailableGhnList() {
deployerService.getAvailableGHNs(new AsyncCallback<List<GHNProfile>>() {
public void onFailure(Throwable caught) {
applyActionsOnException(caught);
}
public void onSuccess(List<GHNProfile> result) {
GHNMemory mem = new GHNMemory("9900000000", "990000000");
GHNSite site = new GHNSite("Lucca", "Italy", "d4science.org");
List<RunningInstance> run = new LinkedList<RunningInstance>();
List<String> libs = new LinkedList<String>();
GHNProfile dummy = new GHNProfile(
"13ea2882-97f7-4961-bae1-872fa2ff7157", "node-dummy",
run, false, mem, site, libs, false);
result.add(dummy);
mainContainer.getCenterPanel().showGHNList(result);
mainContainer.getCenterPanel().layout();
if (! isCloudSelected)
mainContainer.getCenterPanel().unmask();
}
});
}
/**
*
* @param selectedGHNIds
* @param idCandidateGHN
* @return
*/
public void setGHNsSelected(GHNBean[] selectedGHNs) {
this.selectedGHNs = selectedGHNs;
isCloudSelected = false;
String[] selectedIds = new String[selectedGHNs.length];
for (int i = 0; i < selectedGHNs.length; i++) {
selectedIds[i] = selectedGHNs[i].getId();
}
deployerService.setGHNsSelected(selectedIds, new AsyncCallback<Boolean>() {
public void onSuccess(Boolean result) {
Info.display("Saving Operation", "The ghn selection was saved successfully");
}
public void onFailure(Throwable caught) {
MessageBox.alert("Error", "Error while saving ghn list: " + caught.getMessage(), null);
}
});
}
/**
*
*/
public void checkCloudSelected() {
deployerService.isCloudSelected(new AsyncCallback<Integer>() {
public void onFailure(Throwable caught) {
mainContainer.getEastPanel().addText("There was an error on server: " + caught.getMessage());
mainContainer.getEastPanel().unmask();
mainContainer.getEastPanel().layout();
}
public void onSuccess(Integer result) {
if (result != -1) {
isCloudSelected = true;
mainContainer.getEastPanel().showCloudPanel(true, result);
}
else {
isCloudSelected = false;
mainContainer.getEastPanel().showCloudPanel(false, -1);
}
}
});
}
/**
*
*/
public void getSummary() {
mainContainer.getCenterPanel().showFinalize(vreDesc, selectedGHNs, isCloudSelected());
mainContainer.getCenterPanel().showFinalize(vreDesc);
mainContainer.getCenterPanel().layout();
}
@ -223,34 +139,9 @@ public class Model {
}
/**
* @return -
*/
public boolean isCloudSelected() {
return isCloudSelected;
}
/**
*
* @param isCloudSelected .
* @param virtualMachines .
*/
public void setCloudSelected(boolean isCloudSelected, int virtualMachines) {
this.isCloudSelected = isCloudSelected;
mainContainer.getEastPanel().mask("Applying settings, please hold", "loading-indicator");
deployerService.setCloudDeploy(virtualMachines, new AsyncCallback<Boolean>() {
public void onSuccess(Boolean result) {
mainContainer.getEastPanel().unmask();
Info.display("Saving Operation", "The Cloud selection was saved successfully");
}
public void onFailure(Throwable caught) {
mainContainer.getEastPanel().unmask();
}
});
}
/**
*
* @return -
@ -259,13 +150,6 @@ public class Model {
return vreDesc;
}
/**
*
* @return -
*/
public GHNBean[] getSelectedGHNs() {
return selectedGHNs;
}
/**
*

View File

@ -24,9 +24,5 @@ public enum NodeType {
/**
* REPORT
*/
REPORT,
/**
* ARCHITECTURE
*/
ARCHITECTURE;
REPORT
}

View File

@ -1,20 +1,14 @@
package org.gcube.portlets.admin.vredeployer.client.view.panels;
import java.util.List;
import org.gcube.portlets.admin.vredeployer.client.VredeployerService;
import org.gcube.portlets.admin.vredeployer.client.VredeployerServiceAsync;
import org.gcube.portlets.admin.vredeployer.client.constants.ImagesConstants;
import org.gcube.portlets.admin.vredeployer.client.control.Controller;
import org.gcube.portlets.admin.vredeployer.client.model.VREFunctionalityModel;
import org.gcube.portlets.admin.vredeployer.client.util.CheckTimer;
import org.gcube.portlets.admin.vredeployer.client.view.panels.builders.CloudDeployStatus;
import org.gcube.portlets.admin.vredeployer.client.view.panels.builders.GhnGrid;
import org.gcube.portlets.admin.vredeployer.client.view.panels.builders.OverallDeployStatus;
import org.gcube.portlets.admin.vredeployer.client.view.panels.builders.ResourcesDeployStatus;
import org.gcube.portlets.admin.vredeployer.client.view.panels.builders.ServicesDeployStatus;
import org.gcube.portlets.admin.vredeployer.shared.GHNBean;
import org.gcube.portlets.admin.vredeployer.shared.GHNProfile;
import org.gcube.portlets.admin.vredeployer.shared.VREDescrBean;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
@ -183,7 +177,7 @@ public class CenterPanel extends ContentPanel {
setLayout(new FitLayout());
tree.expandAll();
tree.setAutoExpand(true);
controller.setEastPanelContent(getInitFuncInfo());
tree.addListener(Events.OnClick, new Listener<TreePanelEvent<ModelData>>() {
@ -211,57 +205,28 @@ public class CenterPanel extends ContentPanel {
cp.setLayout(new FitLayout());
return cp;
}
/**
* view for architecture step
* @param vDesc
*/
public void showGHNList(final List<GHNProfile> ghnodes) {
GhnGrid ghnGrid = new GhnGrid(controller, ghnodes);
add(ghnGrid.getGrid());
setLayout(new FitLayout());
}
/**
* view for finalize step
* @param vDesc
*/
public void showFinalize(VREDescrBean desc, GHNBean[] ghns, boolean isCloudSelected) {
public void showFinalize(VREDescrBean desc) {
ContentPanel cp = new ContentPanel(new FitLayout());
cp.setHeaderVisible(false);
String toShow = "";
if ( (ghns == null && (! isCloudSelected) ) ) {
toShow = "<h3>Step Architecture Selection is Missing</h3>";
}
else {
unmask();
toShow = "<h3>" + desc.getName() + " is ready to be deployed.</h3>";
toShow += "<br/><br/>selected nodes:";
unmask();
toShow = "<h3>" + desc.getName() + " is ready to be deployed.</h3>";
toShow += "<br/><br/>click create button to start the creation process";
cp.add(new HTML(toShow, true));
cp.addButton(new Button("Create", new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
controller.createVreButtonClicked();
}
}));
if (isCloudSelected) {
toShow += "<p><img src=\""+ ImagesConstants.CLOUD_IMAGE + " \" /></p>";
} else {
toShow += "<p><ul>";
for (int i = 0; i < ghns.length; i++) {
if (ghns[i].isSelected())
toShow += "<li>&nbsp; - &nbsp; <b>"+ ghns[i].getHost()+ "</b> (" + ghns[i].getCountry() + ")</li>" ;
}
toShow += "</ul></p>";
}
toShow += "<br/><br/>click create button to start the creation process";
cp.add(new HTML(toShow, true));
cp.addButton(new Button("Create", new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
controller.createVreButtonClicked();
}
}));
}
cp.setStyleAttribute("margin", "10px");
cp.add(new HTML(toShow, true));
add(cp);

View File

@ -1,33 +1,8 @@
package org.gcube.portlets.admin.vredeployer.client.view.panels;
import org.gcube.portlets.admin.vredeployer.client.constants.ImagesConstants;
import org.gcube.portlets.admin.vredeployer.client.control.Controller;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.Style.Orientation;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.FieldEvent;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
import com.extjs.gxt.ui.client.widget.Html;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.CheckBox;
import com.extjs.gxt.ui.client.widget.form.CheckBoxGroup;
import com.extjs.gxt.ui.client.widget.form.FieldSet;
import com.extjs.gxt.ui.client.widget.form.FormPanel;
import com.extjs.gxt.ui.client.widget.form.SimpleComboBox;
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
import com.extjs.gxt.ui.client.widget.layout.FormData;
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
import com.extjs.gxt.ui.client.widget.layout.RowData;
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
import com.extjs.gxt.ui.client.widget.layout.TableData;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Image;
public class EastPanel extends ContentPanel {
/**
@ -46,123 +21,4 @@ public class EastPanel extends ContentPanel {
setHeight("100%");
}
/**
*
*/
public void showCloudPanel(boolean selected, int vmSelected) {
setHeading("deploy VRE Services on Cloud");
final Button saveButton = new Button("Commit changes");
saveButton.setEnabled(false);
removeAll();
unmask();
LayoutContainer toShow = new LayoutContainer();
HorizontalPanel hp = new HorizontalPanel();
hp.setWidth("100%");
hp.setTableWidth("100%");
TableData td = new TableData();
td.setHorizontalAlign(HorizontalAlignment.CENTER);
//toShow.setStyleAttribute("margin", "10px");
RowLayout rlayout = new RowLayout(Orientation.VERTICAL);
toShow.setLayout(rlayout);
String toAdd = "";
toAdd = "<div style=\"width:100%; font-size:24px; color: gray;text-align:center;\">Cloud available</div>";
hp.add(new Html(toAdd), td);
HorizontalPanel hp2 = new HorizontalPanel();
hp2.setWidth("100%");
hp2.setTableWidth("100%");
hp2.add(new Image(ImagesConstants.CLOUD_IMAGE), td);
toShow.add(hp);
toShow.add(hp2);
FormData formData = new FormData("-20");
FormPanel form = new FormPanel();
form.setHeaderVisible(false);
form.setBorders(false);
form.setBodyBorder(false);
form.setFrame(false);
form.setWidth("100%");
FieldSet fieldSet = new FieldSet();
fieldSet.setHeading("Resources Setup");
//fieldSet.setCheckboxToggle(true);
FormLayout layout = new FormLayout();
layout.setLabelWidth(100);
fieldSet.setLayout(layout);
final CheckBox useCloud = new CheckBox();
useCloud.addListener(Events.Change, new Listener<FieldEvent>() {
public void handleEvent(FieldEvent be) {
boolean checked = useCloud.getValue();
controller.maskCenterPanel(checked);
saveButton.setEnabled(checked);
}
});
controller.maskCenterPanel(selected);
useCloud.setValue(selected);
useCloud.setBoxLabel("");
CheckBoxGroup checkGroup = new CheckBoxGroup();
checkGroup.setFieldLabel("Use Cloud");
checkGroup.add(useCloud);
final SimpleComboBox<String> combo = new SimpleComboBox<String>();
combo.setFieldLabel("Virtual machines");
combo.add("2");
combo.add("3");
combo.add("4");
combo.add("5");
combo.add("10");
combo.add("20");
combo.setTriggerAction(TriggerAction.ALL);
combo.setSimpleValue("2");
combo.setAllowBlank(false);
combo.setEditable(false);
if (vmSelected != -1) {
combo.setSimpleValue(""+vmSelected);
}
fieldSet.add(checkGroup, formData);
fieldSet.add(combo, formData);
form.add(fieldSet, formData);
form.addButton(saveButton);
saveButton.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
int vMachines = Integer.parseInt(combo.getSimpleValue());
controller.setCloudSelected(true, vMachines);
}
});
toShow.add(form, new RowData(-1, 165));
add(toShow);
layout();
}
}

View File

@ -24,7 +24,6 @@ public class WestPanel extends ContentPanel {
final AtomicTreeNode info = new AtomicTreeNode("Info", "Info", "info-icon", NodeType.INFO);
final AtomicTreeNode func = new AtomicTreeNode("Functionality", "Functionality", "functionality-icon",NodeType.FUNCTIONALITY);
final AtomicTreeNode arch = new AtomicTreeNode("Architecture", "Architecture", "architecture-icon",NodeType.ARCHITECTURE);
final AtomicTreeNode finalize = new AtomicTreeNode("Finalize", "Finalize", "play-icon",NodeType.REPORT);
public WestPanel(Controller c) {
@ -36,11 +35,9 @@ public class WestPanel extends ContentPanel {
root.add(info);
//root.add(metadata);
root.add(func);
root.add(arch);
root.add(finalize);
TreeStore<ModelData> store = new TreeStore<ModelData>();
// The root node will not be shown
store.add(root.getChildren(), true);

View File

@ -1,252 +0,0 @@
package org.gcube.portlets.admin.vredeployer.client.view.panels.builders;
import java.util.ArrayList;
import java.util.List;
import org.gcube.portlets.admin.vredeployer.client.control.Controller;
import org.gcube.portlets.admin.vredeployer.shared.GHNBean;
import org.gcube.portlets.admin.vredeployer.shared.GHNProfile;
import org.gcube.portlets.admin.vredeployer.shared.RunningInstance;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.Style.SortDir;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.GridEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.CheckBox;
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
import com.extjs.gxt.ui.client.widget.grid.CheckColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.HTML;
/**
*
* @author massi
*
*/
public class GhnGrid {
private List<GHNProfile> myGHNList;
private Controller controller;
public GhnGrid(Controller controller, List<GHNProfile> list) {
myGHNList = list;
this.controller = controller;
}
public List<GHNProfile> getGHNList() {
return myGHNList;
}
public ContentPanel getGrid() {
List<GHNBean> toShow = new ArrayList<GHNBean>();
for (GHNProfile p : myGHNList) {
toShow.add(new GHNBean(p.getId(), p.getHost(), p.getMemory().getVirtualAvailable(),
p.getSite().getDomain(), p.isSelected(), p.getMemory().getLocalAvailableSpace(),
p.getSite().getLocation(), p.getSite().getCountry(), p.isSecure()));
}
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
ColumnConfig column = new ColumnConfig();
column.setId("id");
column.setHeader("ID");
column.setWidth(50);
column.setHidden(true);
configs.add(column);
column = new ColumnConfig();
column.setId("host");
column.setHeader("Host name");
column.setWidth(150);
configs.add(column);
column = new ColumnConfig();
column.setId("domain");
column.setHeader("Domain");
column.setHidden(true);
column.setWidth(150);
configs.add(column);
column = new ColumnConfig();
column.setId("memory");
column.setHeader("mem avail.");
column.setAlignment(HorizontalAlignment.CENTER);
column.setWidth(40);
configs.add(column);
column = new ColumnConfig();
column.setId("diskspace");
column.setHeader("disk avail.");
column.setAlignment(HorizontalAlignment.CENTER);
column.setHidden(false);
column.setWidth(50);
configs.add(column);
column = new ColumnConfig();
column.setId("country");
column.setHeader("Country");
column.setAlignment(HorizontalAlignment.CENTER);
column.setHidden(true);
column.setWidth(50);
configs.add(column);
column = new ColumnConfig();
column.setId("location");
column.setHeader("Location");
column.setHidden(true);
column.setAlignment(HorizontalAlignment.CENTER);
column.setWidth(50);
configs.add(column);
column = new ColumnConfig();
column.setId("isSecure");
column.setHeader("isSecure");
column.setAlignment(HorizontalAlignment.CENTER);
column.setHidden(true);
column.setWidth(40);
configs.add(column);
CheckColumnConfig checkColumn = new CheckColumnConfig("isSelected", "isSelected", 35) {
@Override
protected void onMouseDown(final GridEvent<ModelData> ge) {
super.onMouseDown(ge);
GHNBean bean = (GHNBean) ge.getModel();
showGHNAdditionalInfo(bean.getId(), myGHNList);
}
};
checkColumn.setHeader("Select");
checkColumn.setAlignment(HorizontalAlignment.CENTER);
CheckBox checkbox = new CheckBox();
CellEditor checkBoxEditor = new CellEditor(checkbox);
checkColumn.setEditor(checkBoxEditor);
configs.add(checkColumn);
final ColumnModel cm = new ColumnModel(configs);
/**
* load the grid data
*/
final ListStore<GHNBean> store = new ListStore<GHNBean>();
//store.groupBy("domain");
store.sort("isSelectable", SortDir.DESC);
store.add(toShow);
Grid<GHNBean> grid = new Grid<GHNBean>(store, cm);
grid.addPlugin(checkColumn);
grid.setStyleAttribute("borderTop", "none");
grid.setAutoExpandColumn("host");
grid.setBorders(true);
grid.setStripeRows(true);
grid.getView().setForceFit(true);
ContentPanel gridPanel = new ContentPanel(new FitLayout());
gridPanel.setHeaderVisible(false);
gridPanel.add(grid);
gridPanel.addButton(new Button("Reset", new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
store.rejectChanges();
}
}));
gridPanel.addButton(new Button("Commit changes", new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
List<GHNBean> ghns = store.getModels();
int selectedCounter = 0;
for (GHNBean ghn : ghns)
if (ghn.isSelected())
selectedCounter++;
if (selectedCounter < 1)
MessageBox.alert("Alert", "At least one node must be added for deploying ", null);
else {
GHNBean[] selectedGHNIds = new GHNBean[selectedCounter];
//get the selected ghnID
int j = 0;
for (int i = 0; i < ghns.size(); i++)
if (ghns.get(i).isSelected()) {
selectedGHNIds[j] = ghns.get(i);;
j++;
}
GWT.log("Storing GHN List");
store.commitChanges();
controller.setGHNsSelected(selectedGHNIds);
}
}
}));
return gridPanel;
}
/**
*
* @param ghnID
* @param ghnodes
*/
private void showGHNAdditionalInfo(String ghnID, List<GHNProfile> ghnodes) {
for (GHNProfile ghn : ghnodes) {
if (ghn.getId().compareTo(ghnID) == 0) {
ContentPanel cp = new ContentPanel();
cp.setHeaderVisible(false);
cp.setBodyBorder(false);
String toAdd = "<h3>" + ghn.getHost() + "</h3>";
toAdd += "<br /><b>Site:</b>";
toAdd += "<ul>";
toAdd += "<li>&nbsp; - &nbsp; <b>Location:</b> " + ghn.getSite().getLocation() + "</li>" ;
toAdd += "<li>&nbsp; - &nbsp; <b>Country:</b> " + ghn.getSite().getCountry() + "</li>" ;
toAdd += "<li>&nbsp; - &nbsp; <b>Domain:</b> " + ghn.getSite().getDomain() + "</li>" ;
toAdd += "</ul>";
toAdd += "<br /><b>Running Instances:</b>";
List<RunningInstance> ris = ghn.getRunningInstances();
if (ris != null) {
toAdd += "<ul>";
for (RunningInstance ri : ris) {
toAdd += "<li>&nbsp; - &nbsp; <b>"+ ri.getName()+ "</b> (" + ri.getServiceClass() + ")</li>" ;
}
if (ris.size() == 0)
toAdd += "<li>&nbsp; - &nbsp; none</li>" ;
toAdd += "</ul>";
}
cp.add(new HTML(toAdd, true ));
cp.setStyleAttribute("margin", "10px");
cp.setLayout(new FitLayout());
controller.setEastPanelContent(cp);
break;
}
}
}
}

View File

@ -131,7 +131,7 @@ public class NewVRECreatedThread implements Runnable {
body.append("<body><br />")
.append("<div style=\"color:#000; font-size:13px; font-family:'lucida grande',tahoma,verdana,arial,sans-serif;\">")
.append("Dear ").append(userFirstName).append(",") //dear <user>
.append("<p>").append(sender).append(" ").append("created the following email: ") // has done something
.append("<p>").append(sender).append(" ").append("created the following VRE: ") // has done something
.append(vreScope)
.append("</div><br />")
.append("<p>You received this email because you are an Infrastructure Manager in this portal</p>")

View File

@ -54,12 +54,8 @@ import org.gcube.portal.custom.communitymanager.impl.GCubeSiteManagerImpl;
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
import org.gcube.portlets.admin.vredeployer.client.VredeployerService;
import org.gcube.portlets.admin.vredeployer.client.model.VREFunctionalityModel;
import org.gcube.portlets.admin.vredeployer.shared.GHNMemory;
import org.gcube.portlets.admin.vredeployer.shared.GHNProfile;
import org.gcube.portlets.admin.vredeployer.shared.GHNSite;
import org.gcube.portlets.admin.vredeployer.shared.ResourceCategory;
import org.gcube.portlets.admin.vredeployer.shared.ResourceCategoryItem;
import org.gcube.portlets.admin.vredeployer.shared.RunningInstance;
import org.gcube.portlets.admin.vredeployer.shared.VREDeployerStatusType;
import org.gcube.portlets.admin.vredeployer.shared.VREDescrBean;
import org.gcube.portlets.admin.vredeployer.shared.deployreport.ClientCloudReport;
@ -466,138 +462,6 @@ public class VREDeployerServiceImpl extends RemoteServiceServlet implements Vre
}
}
/**
* return the ghn available list
* @return
* @throws RemoteException
*/
@Override
public List<GHNProfile> getAvailableGHNs() {
List<GHNProfile> toReturn = new ArrayList<GHNProfile>();
VREGeneratorEvo vreGenerator = null;
if (isTesting) {
vreGenerator = new VREGeneratorEvo(getASLSession(), customEPR);
}
else {
ASLSession aslSession = getASLSession();
vreGenerator = getVREGeneratorEvo(aslSession);
}
List<GHN> ghns = null;
try {
log.debug("Asking gHN list");
ghns = vreGenerator.getGHNs();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (ghns == null)
return toReturn;
log.debug("got gHN list, menbers: " + ghns.size());
for (GHN ghn : ghns) {
List<RunningInstance> ris = new ArrayList<RunningInstance>();
if (ghn.relatedRIs() != null) {
for (int i = 0; i < ghn.relatedRIs().size(); i++) {
ris.add(new RunningInstance(ghn.relatedRIs().get(i).serviceName(), ghn.relatedRIs().get(i).serviceClass()));
}
}
toReturn.add(new GHNProfile(ghn.id(), ghn.host(), ris, ghn.securityEnabled(),
new GHNMemory(ghn.memory().memorySize()+"", ghn.memory().diskSpace()+""),
new GHNSite(ghn.site().location(), ghn.site().country(), ghn.site().domain()), null,
ghn.selected()) );
}
return toReturn;
}
/**
*
* @param selectedGHNIds
* @param idCandidateGHN
* @return
*/
public boolean setGHNsSelected(String[] selectedGHNIds) {
VREGeneratorEvo vreGenerator = null;
if (isTesting) {
vreGenerator = new VREGeneratorEvo(getASLSession(), customEPR);
}
else {
ASLSession aslSession = getASLSession();
vreGenerator = getVREGeneratorEvo(aslSession);
}
try {
log.debug(" selectedIDs");
for (int i = 0; i < selectedGHNIds.length; i++) {
System.out.println(" id: " + selectedGHNIds[i].toString());
}
vreGenerator.setGHNs(selectedGHNIds);
} catch (RemoteException e) {
e.printStackTrace();
return false;
}
return true;
}
/**
*
* @return
*/
public int isCloudSelected() {
VREGeneratorEvo vreGenerator = null;
if (isTesting) {
vreGenerator = new VREGeneratorEvo(getASLSession(), customEPR);
}
else {
ASLSession aslSession = getASLSession();
vreGenerator = getVREGeneratorEvo(aslSession);
}
if (vreGenerator.isCloudSelected())
return vreGenerator.getCloudVMSelected();
else
return -1;
}
/**
*
*/
public int getCloudVMSelected() {
VREGeneratorEvo vreGenerator = null;
if (isTesting) {
vreGenerator = new VREGeneratorEvo(getASLSession(), customEPR);
}
else {
ASLSession aslSession = getASLSession();
vreGenerator = getVREGeneratorEvo(aslSession);
}
return vreGenerator.getCloudVMSelected();
}
/**
*
* @param virtualMachines
* @return
*/
public boolean setCloudDeploy(int virtualMachines) {
VREGeneratorEvo vreGenerator = null;
if (isTesting) {
vreGenerator = new VREGeneratorEvo(getASLSession(), customEPR);
}
else {
ASLSession aslSession = getASLSession();
vreGenerator = getVREGeneratorEvo(aslSession);
}
return vreGenerator.setCloudDeploy(virtualMachines);
}
public boolean deployVRE() {
log.info("--- deployVRE started ---");
VREGeneratorEvo vreGenerator = null;
@ -741,8 +605,8 @@ public class VREDeployerServiceImpl extends RemoteServiceServlet implements Vre
log.info("onAfterCreate VRE: " + vreScope);
long currGroupId = PortalContext.getConfiguration().getCurrentGroupId(getThreadLocalRequest());
Thread emailManagersThread = new Thread(new NewVRECreatedThread(userManager.getUsername(), userManager.getFullname(), vreScope, vreName, currGroupId));
emailManagersThread.start();
Thread emailManagersThread = new Thread(new NewVRECreatedThread(userManager.getUsername(), userManager.getFullname(), vreScope, vreName, currGroupId));
emailManagersThread.start();
} else
@ -860,7 +724,7 @@ public class VREDeployerServiceImpl extends RemoteServiceServlet implements Vre
log.error("NO VRE-MANAGER FOUND IN THIS VRE");
}
ScopeProvider.instance.set(currScope);
}
}
/**
* return the infrastructure name
@ -964,21 +828,11 @@ public class VREDeployerServiceImpl extends RemoteServiceServlet implements Vre
//*** Cloud deploy report part
GHNonCloudReport cDeploy = toConvert.getCloudDeployingReport();
if (isCloudSelected() != -1) {
System.out.println("***** GHNonCloudReportSelected ******");
List<DeployStatus> singleCloudStatus = new LinkedList<DeployStatus>();
for (int i = 0; i < cDeploy.getDeployingState().length; i++) {
singleCloudStatus.add(convStatus(cDeploy.getDeployingState()[i]));
}
System.out.println("***** GHNonCloudReport Not Selected ******");
ClientCloudReport cdp = new ClientCloudReport();
cdp.setStatus(DeployStatus.SKIP);
toReturn.setCloudReport(cdp);
toReturn.setCloudReport(new ClientCloudReport(convStatus(cDeploy.getStatus()), singleCloudStatus));
}
else {
System.out.println("***** GHNonCloudReport Not Selected ******");
ClientCloudReport cdp = new ClientCloudReport();
cdp.setStatus(DeployStatus.SKIP);
toReturn.setCloudReport(cdp);
}
//*** ResourceManager deploy report part
toReturn.setResourceManagerReport(
new ClientResourceManagerDeployingReport(convStatus(toConvert.getResourceDeployingReport().getStatus()), toConvert.getResourceDeployingReport().toString()));
@ -1095,19 +949,19 @@ public class VREDeployerServiceImpl extends RemoteServiceServlet implements Vre
GCUBESiteLayout siteLayout = GCubeSiteManagerImpl.getBaseLayout(vreName, false, session.getUsername());
org.gcube.vomanagement.usermanagement.model.GCubeGroup vreCreated = gm.createVRE(vreName, parentVirtualOrganizationId, desc);
long groupId = vreCreated.getGroupId();
Group lrGroup = GroupLocalServiceUtil.getGroup(groupId);
GCubeUser userBean = new LiferayUserManager().getUserByUsername(session.getUsername());
User lrUser = UserLocalServiceUtil.getUser(userBean.getUserId());
SiteManagerUtil.createLayout(lrGroup, lrUser, siteLayout);
Theme themeToApply = ThemeLocalServiceUtil.getTheme(SiteManagerUtil.getCompany().getCompanyId(), themid, false);
//update theme
LayoutSetLocalServiceUtil.updateLookAndFeel(groupId, themeToApply.getThemeId(), "", "", false);
log.debug("LayoutSet Theme with id " + themid + " Applied Correctly");
log.info("Assigned theme with id: " + themid + " to groupid: " + groupId);
//the method above create a VRE and assign the manager Role to the person that triggers the creation
@ -1116,7 +970,7 @@ public class VREDeployerServiceImpl extends RemoteServiceServlet implements Vre
//if the manager is not the one who triggered the creation
String currUser = session.getUsername();
log.info("***Username of who triggered the creation is: " + currUser);
log.info("Trying to create VRE Group Folder through HomeLibrary ...");
createVRESharedGroupFolder(vreCreated, designer, manager, description);