Rollout management issues

Signed-off-by: venu1278 <venugopal.boodidadinne@in.bosch.com>
This commit is contained in:
venu1278
2016-04-18 20:12:30 +05:30
parent 6046e9b41d
commit f290eb78e5
10 changed files with 336 additions and 315 deletions

View File

@@ -9,7 +9,7 @@
package org.eclipse.hawkbit.ui.customrenderers.client; package org.eclipse.hawkbit.ui.customrenderers.client;
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.CustomObject; import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RendererData;
import com.google.web.bindery.event.shared.HandlerRegistration; import com.google.web.bindery.event.shared.HandlerRegistration;
import com.vaadin.client.connectors.ClickableRendererConnector; import com.vaadin.client.connectors.ClickableRendererConnector;
@@ -17,9 +17,12 @@ import com.vaadin.client.renderers.ClickableRenderer.RendererClickHandler;
import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.Connect;
import elemental.json.JsonObject; import elemental.json.JsonObject;
/**
* A connector for {@link CustomObjectRenderer }.
*
*/
@Connect(org.eclipse.hawkbit.ui.customrenderers.renderers.CustomObjectRenderer.class) @Connect(org.eclipse.hawkbit.ui.customrenderers.renderers.CustomObjectRenderer.class)
public class CustomObjectRendererConnector extends ClickableRendererConnector<CustomObject> { public class CustomObjectRendererConnector extends ClickableRendererConnector<RendererData> {
private static final long serialVersionUID = 7734682321931830566L; private static final long serialVersionUID = 7734682321931830566L;
public org.eclipse.hawkbit.ui.customrenderers.client.renderers.CustomObjectRenederer getRenderer() { public org.eclipse.hawkbit.ui.customrenderers.client.renderers.CustomObjectRenederer getRenderer() {

View File

@@ -18,7 +18,7 @@ import com.vaadin.client.widget.grid.RendererCellReference;
* Used to display button with link. * Used to display button with link.
* *
*/ */
public class CustomObjectRenederer extends ClickableRenderer<CustomObject, VButton> { public class CustomObjectRenederer extends ClickableRenderer<RendererData, VButton> {
@Override @Override
public VButton createWidget() { public VButton createWidget() {
@@ -29,7 +29,7 @@ public class CustomObjectRenederer extends ClickableRenderer<CustomObject, VButt
} }
@Override @Override
public void render(RendererCellReference cell, CustomObject text, VButton button) { public void render(RendererCellReference cell, RendererData text, VButton button) {
final String creating = "CREATING"; final String creating = "CREATING";
button.setText(text.getName()); button.setText(text.getName());
applystyle(button); applystyle(button);

View File

@@ -10,18 +10,34 @@ package org.eclipse.hawkbit.ui.customrenderers.client.renderers;
import java.io.Serializable; import java.io.Serializable;
public class CustomObject implements Serializable { /**
* RendererData class with Name and Status.
*
*/
public class RendererData implements Serializable {
private static final long serialVersionUID = -5018181529953620263L; private static final long serialVersionUID = -5018181529953620263L;
private String name; private String name;
private String status; private String status;
public CustomObject(){ /**
* Initialize the RendererData.
*/
public RendererData() {
} }
public CustomObject(String name, String status) { /**
* Initialize the RendererData.
*
* @param name
* Name of the Rollout.
* @param status
* Status of Rollout.
*/
public RendererData(String name, String status) {
super(); super();
this.name = name; this.name = name;
this.status = status; this.status = status;
@@ -39,7 +55,6 @@ public class CustomObject implements Serializable {
return status; return status;
} }
public void setStatus(String status) { public void setStatus(String status) {
this.status = status; this.status = status;
} }

View File

@@ -9,7 +9,7 @@
package org.eclipse.hawkbit.ui.customrenderers.renderers; package org.eclipse.hawkbit.ui.customrenderers.renderers;
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.CustomObject; import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RendererData;
import com.vaadin.ui.renderers.ClickableRenderer; import com.vaadin.ui.renderers.ClickableRenderer;
@@ -21,7 +21,7 @@ import elemental.json.JsonValue;
* *
*/ */
public class CustomObjectRenderer extends ClickableRenderer<CustomObject> { public class CustomObjectRenderer extends ClickableRenderer<RendererData> {
private static final long serialVersionUID = -8754180585906263554L; private static final long serialVersionUID = -8754180585906263554L;
@@ -29,7 +29,7 @@ public class CustomObjectRenderer extends ClickableRenderer<CustomObject> {
* Creates a new custom object renderer. * Creates a new custom object renderer.
*/ */
public CustomObjectRenderer() { public CustomObjectRenderer() {
super(CustomObject.class, null); super(RendererData.class, null);
} }
/** /**
@@ -39,7 +39,7 @@ public class CustomObjectRenderer extends ClickableRenderer<CustomObject> {
* Class<CustomObject> * Class<CustomObject>
*/ */
public CustomObjectRenderer(Class<CustomObject> presentationType) { public CustomObjectRenderer(Class<RendererData> presentationType) {
super(presentationType); super(presentationType);
} }
@@ -55,7 +55,7 @@ public class CustomObjectRenderer extends ClickableRenderer<CustomObject> {
} }
@Override @Override
public JsonValue encode(CustomObject resource) { public JsonValue encode(RendererData resource) {
return super.encode(resource, CustomObject.class); return super.encode(resource, RendererData.class);
} }
} }

View File

@@ -9,7 +9,7 @@
package org.eclipse.hawkbit.ui.rollout.rollout; package org.eclipse.hawkbit.ui.rollout.rollout;
import org.eclipse.hawkbit.repository.model.Rollout; import org.eclipse.hawkbit.repository.model.Rollout;
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.CustomObject; import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RendererData;
import com.vaadin.server.FontAwesome; import com.vaadin.server.FontAwesome;
@@ -33,14 +33,16 @@ public class ProxyRollout extends Rollout {
private String totalTargetsCount; private String totalTargetsCount;
private CustomObject customObject; private RendererData rendererData;
public CustomObject getCustomObject() {
return customObject;
public RendererData getRendererData() {
return rendererData;
} }
public void setCustomObject(CustomObject customObject) { public void setRendererData(RendererData rendererData) {
this.customObject = customObject; this.rendererData = rendererData;
} }
/** /**

View File

@@ -17,7 +17,7 @@ import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.Rollout; import org.eclipse.hawkbit.repository.model.Rollout;
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus; import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.CustomObject; import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RendererData;
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState; import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil; import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil; import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
@@ -120,8 +120,8 @@ public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
proxyRollout.setName(rollout.getName()); proxyRollout.setName(rollout.getName());
proxyRollout.setDescription(rollout.getDescription()); proxyRollout.setDescription(rollout.getDescription());
final DistributionSet distributionSet = rollout.getDistributionSet(); final DistributionSet distributionSet = rollout.getDistributionSet();
proxyRollout.setDistributionSetNameVersion(HawkbitCommonUtil.getFormattedNameVersion( proxyRollout.setDistributionSetNameVersion(
distributionSet.getName(), distributionSet.getVersion())); HawkbitCommonUtil.getFormattedNameVersion(distributionSet.getName(), distributionSet.getVersion()));
proxyRollout.setDistributionSet(distributionSet); proxyRollout.setDistributionSet(distributionSet);
proxyRollout.setNumberOfGroups(Long.valueOf(rollout.getRolloutGroups().size())); proxyRollout.setNumberOfGroups(Long.valueOf(rollout.getRolloutGroups().size()));
proxyRollout.setCreatedDate(SPDateTimeUtil.getFormattedDate(rollout.getCreatedAt())); proxyRollout.setCreatedDate(SPDateTimeUtil.getFormattedDate(rollout.getCreatedAt()));
@@ -131,7 +131,7 @@ public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
proxyRollout.setForcedTime(rollout.getForcedTime()); proxyRollout.setForcedTime(rollout.getForcedTime());
proxyRollout.setId(rollout.getId()); proxyRollout.setId(rollout.getId());
proxyRollout.setStatus(rollout.getStatus()); proxyRollout.setStatus(rollout.getStatus());
proxyRollout.setCustomObject(new CustomObject(rollout.getName(), rollout.getStatus().toString())); proxyRollout.setRendererData(new RendererData(rollout.getName(), rollout.getStatus().toString()));
final TotalTargetCountStatus totalTargetCountActionStatus = rollout.getTotalTargetCountStatus(); final TotalTargetCountStatus totalTargetCountActionStatus = rollout.getTotalTargetCountStatus();
proxyRollout.setTotalTargetCountStatus(totalTargetCountActionStatus); proxyRollout.setTotalTargetCountStatus(totalTargetCountActionStatus);
@@ -150,7 +150,8 @@ public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
* .util.List, java.util.List, java.util.List) * .util.List, java.util.List, java.util.List)
*/ */
@Override @Override
protected void saveBeans(final List<ProxyRollout> arg0, final List<ProxyRollout> arg1, final List<ProxyRollout> arg2) { protected void saveBeans(final List<ProxyRollout> arg0, final List<ProxyRollout> arg1,
final List<ProxyRollout> arg2) {
/** /**
* CRUD operations on Target will be done through repository methods * CRUD operations on Target will be done through repository methods
*/ */

View File

@@ -22,7 +22,7 @@ import org.eclipse.hawkbit.repository.model.Rollout;
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus; import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus; import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
import org.eclipse.hawkbit.ui.common.grid.AbstractGrid; import org.eclipse.hawkbit.ui.common.grid.AbstractGrid;
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.CustomObject; import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RendererData;
import org.eclipse.hawkbit.ui.customrenderers.renderers.CustomObjectRenderer; import org.eclipse.hawkbit.ui.customrenderers.renderers.CustomObjectRenderer;
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlButtonRenderer; import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlButtonRenderer;
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlLabelRenderer; import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlLabelRenderer;
@@ -145,7 +145,7 @@ public class RolloutListGrid extends AbstractGrid {
.setValue(Long.valueOf(rollout.getRolloutGroups().size())); .setValue(Long.valueOf(rollout.getRolloutGroups().size()));
} }
item.getItemProperty(customObject) item.getItemProperty(customObject)
.setValue(new CustomObject(rollout.getName(), rollout.getStatus().toString())); .setValue(new RendererData(rollout.getName(), rollout.getStatus().toString()));
} }
@@ -160,7 +160,7 @@ public class RolloutListGrid extends AbstractGrid {
protected void addContainerProperties() { protected void addContainerProperties() {
final LazyQueryContainer rolloutGridContainer = (LazyQueryContainer) getContainerDataSource(); final LazyQueryContainer rolloutGridContainer = (LazyQueryContainer) getContainerDataSource();
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, "", false, false); rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, "", false, false);
rolloutGridContainer.addContainerProperty(customObject, CustomObject.class, null, false, false); rolloutGridContainer.addContainerProperty(customObject, RendererData.class, null, false, false);
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, null, false, false); rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, null, false, false);
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_STATUS, RolloutStatus.class, null, false, rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_STATUS, RolloutStatus.class, null, false,
false); false);
@@ -287,7 +287,7 @@ public class RolloutListGrid extends AbstractGrid {
getColumn(SPUILabelDefinitions.ACTION).setRenderer(new HtmlButtonRenderer(event -> onClickOfActionBtn(event))); getColumn(SPUILabelDefinitions.ACTION).setRenderer(new HtmlButtonRenderer(event -> onClickOfActionBtn(event)));
CustomObjectRenderer customObjectRenderer = new CustomObjectRenderer(CustomObject.class); CustomObjectRenderer customObjectRenderer = new CustomObjectRenderer(RendererData.class);
customObjectRenderer.addClickListener(event -> onClickOfRolloutName(event)); customObjectRenderer.addClickListener(event -> onClickOfRolloutName(event));
getColumn(customObject).setRenderer(customObjectRenderer); getColumn(customObject).setRenderer(customObjectRenderer);
@@ -452,7 +452,7 @@ public class RolloutListGrid extends AbstractGrid {
} else if (SPUILabelDefinitions.ACTION.equals(cell.getPropertyId())) { } else if (SPUILabelDefinitions.ACTION.equals(cell.getPropertyId())) {
return SPUILabelDefinitions.ACTION.toLowerCase(); return SPUILabelDefinitions.ACTION.toLowerCase();
} else if (customObject.equals(cell.getPropertyId())) { } else if (customObject.equals(cell.getPropertyId())) {
return ((CustomObject) cell.getProperty().getValue()).getName(); return ((RendererData) cell.getProperty().getValue()).getName();
} else if (SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS.equals(cell.getPropertyId())) { } else if (SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS.equals(cell.getPropertyId())) {
return DistributionBarHelper return DistributionBarHelper
.getTooltip(((TotalTargetCountStatus) cell.getValue()).getStatusTotalCountMap()); .getTooltip(((TotalTargetCountStatus) cell.getValue()).getStatusTotalCountMap());

View File

@@ -9,10 +9,10 @@
package org.eclipse.hawkbit.ui.rollout.rolloutgroup; package org.eclipse.hawkbit.ui.rollout.rolloutgroup;
import org.eclipse.hawkbit.repository.model.RolloutGroup; import org.eclipse.hawkbit.repository.model.RolloutGroup;
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.CustomObject; import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RendererData;
/** /**
* Proxy rollout group with custom properties. * Proxy rollout group with renderer properties.
* *
*/ */
public class ProxyRolloutGroup extends RolloutGroup { public class ProxyRolloutGroup extends RolloutGroup {
@@ -41,14 +41,14 @@ public class ProxyRolloutGroup extends RolloutGroup {
private String totalTargetsCount; private String totalTargetsCount;
private CustomObject customObject; private RendererData rendererData;
public CustomObject getCustomObject() { public RendererData getRendererData() {
return customObject; return rendererData;
} }
public void setCustomObject(CustomObject customObject) { public void setRendererData(RendererData rendererData) {
this.customObject = customObject; this.rendererData = rendererData;
} }
/** /**

View File

@@ -15,7 +15,7 @@ import java.util.Map;
import org.eclipse.hawkbit.repository.RolloutGroupManagement; import org.eclipse.hawkbit.repository.RolloutGroupManagement;
import org.eclipse.hawkbit.repository.RolloutManagement; import org.eclipse.hawkbit.repository.RolloutManagement;
import org.eclipse.hawkbit.repository.model.RolloutGroup; import org.eclipse.hawkbit.repository.model.RolloutGroup;
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.CustomObject; import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RendererData;
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState; import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil; import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil; import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
@@ -123,7 +123,7 @@ public class RolloutGroupBeanQuery extends AbstractBeanQuery<ProxyRolloutGroup>
proxyRolloutGroup.setSuccessConditionExp(rolloutGroup.getSuccessConditionExp()); proxyRolloutGroup.setSuccessConditionExp(rolloutGroup.getSuccessConditionExp());
proxyRolloutGroup.setFinishedPercentage(calculateFinishedPercentage(rolloutGroup)); proxyRolloutGroup.setFinishedPercentage(calculateFinishedPercentage(rolloutGroup));
proxyRolloutGroup.setCustomObject(new CustomObject(rolloutGroup.getName(), null)); proxyRolloutGroup.setRendererData(new RendererData(rolloutGroup.getName(), null));
proxyRolloutGroup.setTotalTargetsCount(String.valueOf(rolloutGroup.getTotalTargets())); proxyRolloutGroup.setTotalTargetsCount(String.valueOf(rolloutGroup.getTotalTargets()));
proxyRolloutGroup.setTotalTargetCountStatus(rolloutGroup.getTotalTargetCountStatus()); proxyRolloutGroup.setTotalTargetCountStatus(rolloutGroup.getTotalTargetCountStatus());

View File

@@ -23,7 +23,7 @@ import org.eclipse.hawkbit.repository.model.RolloutGroup;
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus; import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus; import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
import org.eclipse.hawkbit.ui.common.grid.AbstractGrid; import org.eclipse.hawkbit.ui.common.grid.AbstractGrid;
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.CustomObject; import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RendererData;
import org.eclipse.hawkbit.ui.customrenderers.renderers.CustomObjectRenderer; import org.eclipse.hawkbit.ui.customrenderers.renderers.CustomObjectRenderer;
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlLabelRenderer; import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlLabelRenderer;
@@ -132,7 +132,7 @@ public class RolloutGroupListGrid extends AbstractGrid {
final LazyQueryContainer rolloutGroupGridContainer = (LazyQueryContainer) getContainerDataSource(); final LazyQueryContainer rolloutGroupGridContainer = (LazyQueryContainer) getContainerDataSource();
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, "", false, false); rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, "", false, false);
rolloutGroupGridContainer.addContainerProperty(customObject, CustomObject.class, null, false, false); rolloutGroupGridContainer.addContainerProperty(customObject, RendererData.class, null, false, false);
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, null, false, false); rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, null, false, false);
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_STATUS, RolloutGroupStatus.class, null, rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_STATUS, RolloutGroupStatus.class, null,
false, false); false, false);
@@ -286,7 +286,7 @@ public class RolloutGroupListGrid extends AbstractGrid {
} else if (SPUILabelDefinitions.ACTION.equals(cell.getPropertyId())) { } else if (SPUILabelDefinitions.ACTION.equals(cell.getPropertyId())) {
return SPUILabelDefinitions.ACTION.toLowerCase(); return SPUILabelDefinitions.ACTION.toLowerCase();
} else if (customObject.equals(cell.getPropertyId())) { } else if (customObject.equals(cell.getPropertyId())) {
return ((CustomObject) cell.getProperty().getValue()).getName(); return ((RendererData) cell.getProperty().getValue()).getName();
} else if (SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS.equals(cell.getPropertyId())) { } else if (SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS.equals(cell.getPropertyId())) {
return DistributionBarHelper return DistributionBarHelper
.getTooltip(((TotalTargetCountStatus) cell.getValue()).getStatusTotalCountMap()); .getTooltip(((TotalTargetCountStatus) cell.getValue()).getStatusTotalCountMap());