Rollout management issues
Signed-off-by: venu1278 <venugopal.boodidadinne@in.bosch.com>
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
|
||||
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.vaadin.client.connectors.ClickableRendererConnector;
|
||||
@@ -17,9 +17,12 @@ import com.vaadin.client.renderers.ClickableRenderer.RendererClickHandler;
|
||||
import com.vaadin.shared.ui.Connect;
|
||||
|
||||
import elemental.json.JsonObject;
|
||||
|
||||
/**
|
||||
* A connector for {@link CustomObjectRenderer }.
|
||||
*
|
||||
*/
|
||||
@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;
|
||||
|
||||
public org.eclipse.hawkbit.ui.customrenderers.client.renderers.CustomObjectRenederer getRenderer() {
|
||||
|
||||
@@ -18,7 +18,7 @@ import com.vaadin.client.widget.grid.RendererCellReference;
|
||||
* Used to display button with link.
|
||||
*
|
||||
*/
|
||||
public class CustomObjectRenederer extends ClickableRenderer<CustomObject, VButton> {
|
||||
public class CustomObjectRenederer extends ClickableRenderer<RendererData, VButton> {
|
||||
|
||||
@Override
|
||||
public VButton createWidget() {
|
||||
@@ -29,7 +29,7 @@ public class CustomObjectRenederer extends ClickableRenderer<CustomObject, VButt
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(RendererCellReference cell, CustomObject text, VButton button) {
|
||||
public void render(RendererCellReference cell, RendererData text, VButton button) {
|
||||
final String creating = "CREATING";
|
||||
button.setText(text.getName());
|
||||
applystyle(button);
|
||||
|
||||
@@ -10,18 +10,34 @@ package org.eclipse.hawkbit.ui.customrenderers.client.renderers;
|
||||
|
||||
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 String name;
|
||||
|
||||
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();
|
||||
this.name = name;
|
||||
this.status = status;
|
||||
@@ -39,7 +55,6 @@ public class CustomObject implements Serializable {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -29,7 +29,7 @@ public class CustomObjectRenderer extends ClickableRenderer<CustomObject> {
|
||||
* Creates a new custom object renderer.
|
||||
*/
|
||||
public CustomObjectRenderer() {
|
||||
super(CustomObject.class, null);
|
||||
super(RendererData.class, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,7 +39,7 @@ public class CustomObjectRenderer extends ClickableRenderer<CustomObject> {
|
||||
* Class<CustomObject>
|
||||
*/
|
||||
|
||||
public CustomObjectRenderer(Class<CustomObject> presentationType) {
|
||||
public CustomObjectRenderer(Class<RendererData> presentationType) {
|
||||
super(presentationType);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class CustomObjectRenderer extends ClickableRenderer<CustomObject> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonValue encode(CustomObject resource) {
|
||||
return super.encode(resource, CustomObject.class);
|
||||
public JsonValue encode(RendererData resource) {
|
||||
return super.encode(resource, RendererData.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
package org.eclipse.hawkbit.ui.rollout.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;
|
||||
|
||||
@@ -33,14 +33,16 @@ public class ProxyRollout extends Rollout {
|
||||
|
||||
private String totalTargetsCount;
|
||||
|
||||
private CustomObject customObject;
|
||||
private RendererData rendererData;
|
||||
|
||||
public CustomObject getCustomObject() {
|
||||
return customObject;
|
||||
|
||||
|
||||
public RendererData getRendererData() {
|
||||
return rendererData;
|
||||
}
|
||||
|
||||
public void setCustomObject(CustomObject customObject) {
|
||||
this.customObject = customObject;
|
||||
public void setRendererData(RendererData rendererData) {
|
||||
this.rendererData = rendererData;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
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.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||
@@ -40,164 +40,165 @@ import com.google.common.base.Strings;
|
||||
*/
|
||||
public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
|
||||
|
||||
private static final long serialVersionUID = 4027879794344836185L;
|
||||
private static final long serialVersionUID = 4027879794344836185L;
|
||||
|
||||
private final String searchText;
|
||||
private final String searchText;
|
||||
|
||||
private Sort sort = new Sort(Direction.ASC, "createdAt");
|
||||
private Sort sort = new Sort(Direction.ASC, "createdAt");
|
||||
|
||||
private transient RolloutManagement rolloutManagement;
|
||||
private transient RolloutManagement rolloutManagement;
|
||||
|
||||
private transient TargetFilterQueryManagement filterQueryManagement;
|
||||
private transient TargetFilterQueryManagement filterQueryManagement;
|
||||
|
||||
private transient RolloutUIState rolloutUIState;
|
||||
private transient RolloutUIState rolloutUIState;
|
||||
|
||||
/**
|
||||
* Parametric Constructor.
|
||||
*
|
||||
* @param definition
|
||||
* as QueryDefinition
|
||||
* @param queryConfig
|
||||
* as Config
|
||||
* @param sortIds
|
||||
* as sort
|
||||
* @param sortStates
|
||||
* as Sort status
|
||||
*/
|
||||
public RolloutBeanQuery(final QueryDefinition definition, final Map<String, Object> queryConfig,
|
||||
final Object[] sortIds, final boolean[] sortStates) {
|
||||
super(definition, queryConfig, sortIds, sortStates);
|
||||
/**
|
||||
* Parametric Constructor.
|
||||
*
|
||||
* @param definition
|
||||
* as QueryDefinition
|
||||
* @param queryConfig
|
||||
* as Config
|
||||
* @param sortIds
|
||||
* as sort
|
||||
* @param sortStates
|
||||
* as Sort status
|
||||
*/
|
||||
public RolloutBeanQuery(final QueryDefinition definition, final Map<String, Object> queryConfig,
|
||||
final Object[] sortIds, final boolean[] sortStates) {
|
||||
super(definition, queryConfig, sortIds, sortStates);
|
||||
|
||||
searchText = getSearchText();
|
||||
searchText = getSearchText();
|
||||
|
||||
if (HawkbitCommonUtil.checkBolArray(sortStates)) {
|
||||
// Initalize Sor
|
||||
sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortIds[0]);
|
||||
// Add sort.
|
||||
for (int targetId = 1; targetId < sortIds.length; targetId++) {
|
||||
sort.and(new Sort(sortStates[targetId] ? Direction.ASC : Direction.DESC, (String) sortIds[targetId]));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (HawkbitCommonUtil.checkBolArray(sortStates)) {
|
||||
// Initalize Sor
|
||||
sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortIds[0]);
|
||||
// Add sort.
|
||||
for (int targetId = 1; targetId < sortIds.length; targetId++) {
|
||||
sort.and(new Sort(sortStates[targetId] ? Direction.ASC : Direction.DESC, (String) sortIds[targetId]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getSearchText() {
|
||||
if (getRolloutUIState().getSearchText().isPresent()) {
|
||||
return String.format("%%%s%%", getRolloutUIState().getSearchText().get());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private String getSearchText() {
|
||||
if (getRolloutUIState().getSearchText().isPresent()) {
|
||||
return String.format("%%%s%%", getRolloutUIState().getSearchText().get());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ProxyRollout constructBean() {
|
||||
return new ProxyRollout();
|
||||
}
|
||||
@Override
|
||||
protected ProxyRollout constructBean() {
|
||||
return new ProxyRollout();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#loadBeans(int,
|
||||
* int)
|
||||
*/
|
||||
@Override
|
||||
protected List<ProxyRollout> loadBeans(final int startIndex, final int count) {
|
||||
final Slice<Rollout> rolloutBeans;
|
||||
if (Strings.isNullOrEmpty(searchText)) {
|
||||
rolloutBeans = getRolloutManagement().findAllRolloutsWithDetailedStatus(
|
||||
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort));
|
||||
} else {
|
||||
rolloutBeans = getRolloutManagement().findRolloutByFilters(
|
||||
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort),
|
||||
searchText);
|
||||
}
|
||||
return getProxyRolloutList(rolloutBeans);
|
||||
}
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#loadBeans(int,
|
||||
* int)
|
||||
*/
|
||||
@Override
|
||||
protected List<ProxyRollout> loadBeans(final int startIndex, final int count) {
|
||||
final Slice<Rollout> rolloutBeans;
|
||||
if (Strings.isNullOrEmpty(searchText)) {
|
||||
rolloutBeans = getRolloutManagement().findAllRolloutsWithDetailedStatus(
|
||||
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort));
|
||||
} else {
|
||||
rolloutBeans = getRolloutManagement().findRolloutByFilters(
|
||||
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort),
|
||||
searchText);
|
||||
}
|
||||
return getProxyRolloutList(rolloutBeans);
|
||||
}
|
||||
|
||||
private List<ProxyRollout> getProxyRolloutList(final Slice<Rollout> rolloutBeans) {
|
||||
final List<ProxyRollout> proxyRolloutList = new ArrayList<>();
|
||||
for (final Rollout rollout : rolloutBeans) {
|
||||
final ProxyRollout proxyRollout = new ProxyRollout();
|
||||
proxyRollout.setName(rollout.getName());
|
||||
proxyRollout.setDescription(rollout.getDescription());
|
||||
final DistributionSet distributionSet = rollout.getDistributionSet();
|
||||
proxyRollout.setDistributionSetNameVersion(HawkbitCommonUtil.getFormattedNameVersion(
|
||||
distributionSet.getName(), distributionSet.getVersion()));
|
||||
proxyRollout.setDistributionSet(distributionSet);
|
||||
proxyRollout.setNumberOfGroups(Long.valueOf(rollout.getRolloutGroups().size()));
|
||||
proxyRollout.setCreatedDate(SPDateTimeUtil.getFormattedDate(rollout.getCreatedAt()));
|
||||
proxyRollout.setModifiedDate(SPDateTimeUtil.getFormattedDate(rollout.getLastModifiedAt()));
|
||||
proxyRollout.setCreatedBy(HawkbitCommonUtil.getIMUser(rollout.getCreatedBy()));
|
||||
proxyRollout.setLastModifiedBy(HawkbitCommonUtil.getIMUser(rollout.getLastModifiedBy()));
|
||||
proxyRollout.setForcedTime(rollout.getForcedTime());
|
||||
proxyRollout.setId(rollout.getId());
|
||||
proxyRollout.setStatus(rollout.getStatus());
|
||||
proxyRollout.setCustomObject(new CustomObject(rollout.getName(), rollout.getStatus().toString()));
|
||||
|
||||
final TotalTargetCountStatus totalTargetCountActionStatus = rollout.getTotalTargetCountStatus();
|
||||
proxyRollout.setTotalTargetCountStatus(totalTargetCountActionStatus);
|
||||
proxyRollout.setTotalTargetsCount(String.valueOf(rollout.getTotalTargets()));
|
||||
|
||||
proxyRolloutList.add(proxyRollout);
|
||||
}
|
||||
return proxyRolloutList;
|
||||
}
|
||||
private List<ProxyRollout> getProxyRolloutList(final Slice<Rollout> rolloutBeans) {
|
||||
final List<ProxyRollout> proxyRolloutList = new ArrayList<>();
|
||||
for (final Rollout rollout : rolloutBeans) {
|
||||
final ProxyRollout proxyRollout = new ProxyRollout();
|
||||
proxyRollout.setName(rollout.getName());
|
||||
proxyRollout.setDescription(rollout.getDescription());
|
||||
final DistributionSet distributionSet = rollout.getDistributionSet();
|
||||
proxyRollout.setDistributionSetNameVersion(
|
||||
HawkbitCommonUtil.getFormattedNameVersion(distributionSet.getName(), distributionSet.getVersion()));
|
||||
proxyRollout.setDistributionSet(distributionSet);
|
||||
proxyRollout.setNumberOfGroups(Long.valueOf(rollout.getRolloutGroups().size()));
|
||||
proxyRollout.setCreatedDate(SPDateTimeUtil.getFormattedDate(rollout.getCreatedAt()));
|
||||
proxyRollout.setModifiedDate(SPDateTimeUtil.getFormattedDate(rollout.getLastModifiedAt()));
|
||||
proxyRollout.setCreatedBy(HawkbitCommonUtil.getIMUser(rollout.getCreatedBy()));
|
||||
proxyRollout.setLastModifiedBy(HawkbitCommonUtil.getIMUser(rollout.getLastModifiedBy()));
|
||||
proxyRollout.setForcedTime(rollout.getForcedTime());
|
||||
proxyRollout.setId(rollout.getId());
|
||||
proxyRollout.setStatus(rollout.getStatus());
|
||||
proxyRollout.setRendererData(new RendererData(rollout.getName(), rollout.getStatus().toString()));
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#saveBeans(java
|
||||
* .util.List, java.util.List, java.util.List)
|
||||
*/
|
||||
@Override
|
||||
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
|
||||
*/
|
||||
}
|
||||
final TotalTargetCountStatus totalTargetCountActionStatus = rollout.getTotalTargetCountStatus();
|
||||
proxyRollout.setTotalTargetCountStatus(totalTargetCountActionStatus);
|
||||
proxyRollout.setTotalTargetsCount(String.valueOf(rollout.getTotalTargets()));
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#size()
|
||||
*/
|
||||
@Override
|
||||
public int size() {
|
||||
int size = getRolloutManagement().countRolloutsAll().intValue();
|
||||
if (!Strings.isNullOrEmpty(searchText)) {
|
||||
size = getRolloutManagement().countRolloutsAllByFilters(searchText).intValue();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
proxyRolloutList.add(proxyRollout);
|
||||
}
|
||||
return proxyRolloutList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolloutManagement
|
||||
*/
|
||||
public RolloutManagement getRolloutManagement() {
|
||||
if (null == rolloutManagement) {
|
||||
rolloutManagement = SpringContextHelper.getBean(RolloutManagement.class);
|
||||
}
|
||||
return rolloutManagement;
|
||||
}
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#saveBeans(java
|
||||
* .util.List, java.util.List, java.util.List)
|
||||
*/
|
||||
@Override
|
||||
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
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the filterQueryManagement
|
||||
*/
|
||||
public TargetFilterQueryManagement getFilterQueryManagement() {
|
||||
if (null == filterQueryManagement) {
|
||||
filterQueryManagement = SpringContextHelper.getBean(TargetFilterQueryManagement.class);
|
||||
}
|
||||
return filterQueryManagement;
|
||||
}
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#size()
|
||||
*/
|
||||
@Override
|
||||
public int size() {
|
||||
int size = getRolloutManagement().countRolloutsAll().intValue();
|
||||
if (!Strings.isNullOrEmpty(searchText)) {
|
||||
size = getRolloutManagement().countRolloutsAllByFilters(searchText).intValue();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolloutUIState
|
||||
*/
|
||||
public RolloutUIState getRolloutUIState() {
|
||||
if (null == rolloutUIState) {
|
||||
rolloutUIState = SpringContextHelper.getBean(RolloutUIState.class);
|
||||
}
|
||||
return rolloutUIState;
|
||||
}
|
||||
/**
|
||||
* @return the rolloutManagement
|
||||
*/
|
||||
public RolloutManagement getRolloutManagement() {
|
||||
if (null == rolloutManagement) {
|
||||
rolloutManagement = SpringContextHelper.getBean(RolloutManagement.class);
|
||||
}
|
||||
return rolloutManagement;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the filterQueryManagement
|
||||
*/
|
||||
public TargetFilterQueryManagement getFilterQueryManagement() {
|
||||
if (null == filterQueryManagement) {
|
||||
filterQueryManagement = SpringContextHelper.getBean(TargetFilterQueryManagement.class);
|
||||
}
|
||||
return filterQueryManagement;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolloutUIState
|
||||
*/
|
||||
public RolloutUIState getRolloutUIState() {
|
||||
if (null == rolloutUIState) {
|
||||
rolloutUIState = SpringContextHelper.getBean(RolloutUIState.class);
|
||||
}
|
||||
return rolloutUIState;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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.TotalTargetCountStatus;
|
||||
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.HtmlButtonRenderer;
|
||||
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlLabelRenderer;
|
||||
@@ -145,7 +145,7 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
.setValue(Long.valueOf(rollout.getRolloutGroups().size()));
|
||||
}
|
||||
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() {
|
||||
final LazyQueryContainer rolloutGridContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
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_STATUS, RolloutStatus.class, null, false,
|
||||
false);
|
||||
@@ -287,7 +287,7 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
|
||||
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));
|
||||
getColumn(customObject).setRenderer(customObjectRenderer);
|
||||
|
||||
@@ -452,7 +452,7 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
} else if (SPUILabelDefinitions.ACTION.equals(cell.getPropertyId())) {
|
||||
return SPUILabelDefinitions.ACTION.toLowerCase();
|
||||
} 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())) {
|
||||
return DistributionBarHelper
|
||||
.getTooltip(((TotalTargetCountStatus) cell.getValue()).getStatusTotalCountMap());
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
package org.eclipse.hawkbit.ui.rollout.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 {
|
||||
@@ -41,14 +41,14 @@ public class ProxyRolloutGroup extends RolloutGroup {
|
||||
|
||||
private String totalTargetsCount;
|
||||
|
||||
private CustomObject customObject;
|
||||
private RendererData rendererData;
|
||||
|
||||
public CustomObject getCustomObject() {
|
||||
return customObject;
|
||||
public RendererData getRendererData() {
|
||||
return rendererData;
|
||||
}
|
||||
|
||||
public void setCustomObject(CustomObject customObject) {
|
||||
this.customObject = customObject;
|
||||
public void setRendererData(RendererData rendererData) {
|
||||
this.rendererData = rendererData;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.util.Map;
|
||||
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||
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.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||
@@ -35,160 +35,160 @@ import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
|
||||
*/
|
||||
public class RolloutGroupBeanQuery extends AbstractBeanQuery<ProxyRolloutGroup> {
|
||||
|
||||
private static final long serialVersionUID = 5342450502894318589L;
|
||||
private static final long serialVersionUID = 5342450502894318589L;
|
||||
|
||||
private Sort sort = new Sort(Direction.ASC, "createdAt");
|
||||
private Sort sort = new Sort(Direction.ASC, "createdAt");
|
||||
|
||||
private transient Page<RolloutGroup> firstPageRolloutGroupSets = null;
|
||||
private transient Page<RolloutGroup> firstPageRolloutGroupSets = null;
|
||||
|
||||
private transient RolloutManagement rolloutManagement;
|
||||
private transient RolloutManagement rolloutManagement;
|
||||
|
||||
private transient RolloutGroupManagement rolloutGroupManagement;
|
||||
private transient RolloutGroupManagement rolloutGroupManagement;
|
||||
|
||||
private transient RolloutUIState rolloutUIState;
|
||||
private transient RolloutUIState rolloutUIState;
|
||||
|
||||
private final Long rolloutId;
|
||||
private final Long rolloutId;
|
||||
|
||||
/**
|
||||
* Parametric Constructor.
|
||||
*
|
||||
* @param definition
|
||||
* as QueryDefinition
|
||||
* @param queryConfig
|
||||
* as Config
|
||||
* @param sortPropertyIds
|
||||
* as sort
|
||||
* @param sortStates
|
||||
* as Sort status
|
||||
*/
|
||||
public RolloutGroupBeanQuery(final QueryDefinition definition, final Map<String, Object> queryConfig,
|
||||
final Object[] sortPropertyIds, final boolean[] sortStates) {
|
||||
super(definition, queryConfig, sortPropertyIds, sortStates);
|
||||
/**
|
||||
* Parametric Constructor.
|
||||
*
|
||||
* @param definition
|
||||
* as QueryDefinition
|
||||
* @param queryConfig
|
||||
* as Config
|
||||
* @param sortPropertyIds
|
||||
* as sort
|
||||
* @param sortStates
|
||||
* as Sort status
|
||||
*/
|
||||
public RolloutGroupBeanQuery(final QueryDefinition definition, final Map<String, Object> queryConfig,
|
||||
final Object[] sortPropertyIds, final boolean[] sortStates) {
|
||||
super(definition, queryConfig, sortPropertyIds, sortStates);
|
||||
|
||||
rolloutId = getRolloutId();
|
||||
rolloutId = getRolloutId();
|
||||
|
||||
if (HawkbitCommonUtil.checkBolArray(sortStates)) {
|
||||
// Initalize Sor
|
||||
sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortPropertyIds[0]);
|
||||
// Add sort.
|
||||
for (int targetId = 1; targetId < sortPropertyIds.length; targetId++) {
|
||||
sort.and(new Sort(sortStates[targetId] ? Direction.ASC : Direction.DESC,
|
||||
(String) sortPropertyIds[targetId]));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (HawkbitCommonUtil.checkBolArray(sortStates)) {
|
||||
// Initalize Sor
|
||||
sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortPropertyIds[0]);
|
||||
// Add sort.
|
||||
for (int targetId = 1; targetId < sortPropertyIds.length; targetId++) {
|
||||
sort.and(new Sort(sortStates[targetId] ? Direction.ASC : Direction.DESC,
|
||||
(String) sortPropertyIds[targetId]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
private Long getRolloutId() {
|
||||
return getRolloutUIState().getRolloutId().isPresent() ? getRolloutUIState().getRolloutId().get() : null;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
private Long getRolloutId() {
|
||||
return getRolloutUIState().getRolloutId().isPresent() ? getRolloutUIState().getRolloutId().get() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ProxyRolloutGroup constructBean() {
|
||||
return new ProxyRolloutGroup();
|
||||
}
|
||||
@Override
|
||||
protected ProxyRolloutGroup constructBean() {
|
||||
return new ProxyRolloutGroup();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<ProxyRolloutGroup> loadBeans(final int startIndex, final int count) {
|
||||
List<RolloutGroup> proxyRolloutGroupsList = new ArrayList<>();
|
||||
if (startIndex == 0 && firstPageRolloutGroupSets != null) {
|
||||
proxyRolloutGroupsList = firstPageRolloutGroupSets.getContent();
|
||||
} else if (null != rolloutId) {
|
||||
proxyRolloutGroupsList = getRolloutGroupManagement()
|
||||
.findAllRolloutGroupsWithDetailedStatus(rolloutId, new PageRequest(startIndex / count, count))
|
||||
.getContent();
|
||||
}
|
||||
return getProxyRolloutGroupList(proxyRolloutGroupsList);
|
||||
}
|
||||
@Override
|
||||
protected List<ProxyRolloutGroup> loadBeans(final int startIndex, final int count) {
|
||||
List<RolloutGroup> proxyRolloutGroupsList = new ArrayList<>();
|
||||
if (startIndex == 0 && firstPageRolloutGroupSets != null) {
|
||||
proxyRolloutGroupsList = firstPageRolloutGroupSets.getContent();
|
||||
} else if (null != rolloutId) {
|
||||
proxyRolloutGroupsList = getRolloutGroupManagement()
|
||||
.findAllRolloutGroupsWithDetailedStatus(rolloutId, new PageRequest(startIndex / count, count))
|
||||
.getContent();
|
||||
}
|
||||
return getProxyRolloutGroupList(proxyRolloutGroupsList);
|
||||
}
|
||||
|
||||
private List<ProxyRolloutGroup> getProxyRolloutGroupList(final List<RolloutGroup> rolloutGroupBeans) {
|
||||
final List<ProxyRolloutGroup> proxyRolloutGroupsList = new ArrayList<>();
|
||||
for (final RolloutGroup rolloutGroup : rolloutGroupBeans) {
|
||||
final ProxyRolloutGroup proxyRolloutGroup = new ProxyRolloutGroup();
|
||||
proxyRolloutGroup.setName(rolloutGroup.getName());
|
||||
proxyRolloutGroup.setDescription(rolloutGroup.getDescription());
|
||||
proxyRolloutGroup.setCreatedDate(SPDateTimeUtil.getFormattedDate(rolloutGroup.getCreatedAt()));
|
||||
proxyRolloutGroup.setModifiedDate(SPDateTimeUtil.getFormattedDate(rolloutGroup.getLastModifiedAt()));
|
||||
proxyRolloutGroup.setCreatedBy(HawkbitCommonUtil.getIMUser(rolloutGroup.getCreatedBy()));
|
||||
proxyRolloutGroup.setLastModifiedBy(HawkbitCommonUtil.getIMUser(rolloutGroup.getLastModifiedBy()));
|
||||
proxyRolloutGroup.setId(rolloutGroup.getId());
|
||||
proxyRolloutGroup.setStatus(rolloutGroup.getStatus());
|
||||
proxyRolloutGroup.setErrorAction(rolloutGroup.getErrorAction());
|
||||
proxyRolloutGroup.setErrorActionExp(rolloutGroup.getErrorActionExp());
|
||||
proxyRolloutGroup.setErrorCondition(rolloutGroup.getErrorCondition());
|
||||
proxyRolloutGroup.setErrorConditionExp(rolloutGroup.getErrorConditionExp());
|
||||
proxyRolloutGroup.setSuccessCondition(rolloutGroup.getSuccessCondition());
|
||||
proxyRolloutGroup.setSuccessConditionExp(rolloutGroup.getSuccessConditionExp());
|
||||
proxyRolloutGroup.setFinishedPercentage(calculateFinishedPercentage(rolloutGroup));
|
||||
|
||||
proxyRolloutGroup.setCustomObject(new CustomObject(rolloutGroup.getName(), null));
|
||||
private List<ProxyRolloutGroup> getProxyRolloutGroupList(final List<RolloutGroup> rolloutGroupBeans) {
|
||||
final List<ProxyRolloutGroup> proxyRolloutGroupsList = new ArrayList<>();
|
||||
for (final RolloutGroup rolloutGroup : rolloutGroupBeans) {
|
||||
final ProxyRolloutGroup proxyRolloutGroup = new ProxyRolloutGroup();
|
||||
proxyRolloutGroup.setName(rolloutGroup.getName());
|
||||
proxyRolloutGroup.setDescription(rolloutGroup.getDescription());
|
||||
proxyRolloutGroup.setCreatedDate(SPDateTimeUtil.getFormattedDate(rolloutGroup.getCreatedAt()));
|
||||
proxyRolloutGroup.setModifiedDate(SPDateTimeUtil.getFormattedDate(rolloutGroup.getLastModifiedAt()));
|
||||
proxyRolloutGroup.setCreatedBy(HawkbitCommonUtil.getIMUser(rolloutGroup.getCreatedBy()));
|
||||
proxyRolloutGroup.setLastModifiedBy(HawkbitCommonUtil.getIMUser(rolloutGroup.getLastModifiedBy()));
|
||||
proxyRolloutGroup.setId(rolloutGroup.getId());
|
||||
proxyRolloutGroup.setStatus(rolloutGroup.getStatus());
|
||||
proxyRolloutGroup.setErrorAction(rolloutGroup.getErrorAction());
|
||||
proxyRolloutGroup.setErrorActionExp(rolloutGroup.getErrorActionExp());
|
||||
proxyRolloutGroup.setErrorCondition(rolloutGroup.getErrorCondition());
|
||||
proxyRolloutGroup.setErrorConditionExp(rolloutGroup.getErrorConditionExp());
|
||||
proxyRolloutGroup.setSuccessCondition(rolloutGroup.getSuccessCondition());
|
||||
proxyRolloutGroup.setSuccessConditionExp(rolloutGroup.getSuccessConditionExp());
|
||||
proxyRolloutGroup.setFinishedPercentage(calculateFinishedPercentage(rolloutGroup));
|
||||
|
||||
proxyRolloutGroup.setTotalTargetsCount(String.valueOf(rolloutGroup.getTotalTargets()));
|
||||
proxyRolloutGroup.setTotalTargetCountStatus(rolloutGroup.getTotalTargetCountStatus());
|
||||
proxyRolloutGroup.setRendererData(new RendererData(rolloutGroup.getName(), null));
|
||||
|
||||
proxyRolloutGroupsList.add(proxyRolloutGroup);
|
||||
}
|
||||
return proxyRolloutGroupsList;
|
||||
}
|
||||
proxyRolloutGroup.setTotalTargetsCount(String.valueOf(rolloutGroup.getTotalTargets()));
|
||||
proxyRolloutGroup.setTotalTargetCountStatus(rolloutGroup.getTotalTargetCountStatus());
|
||||
|
||||
private String calculateFinishedPercentage(final RolloutGroup rolloutGroup) {
|
||||
return HawkbitCommonUtil.formattingFinishedPercentage(rolloutGroup, getRolloutManagement()
|
||||
.getFinishedPercentForRunningGroup(rolloutGroup.getRollout().getId(), rolloutGroup));
|
||||
}
|
||||
proxyRolloutGroupsList.add(proxyRolloutGroup);
|
||||
}
|
||||
return proxyRolloutGroupsList;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void saveBeans(final List<ProxyRolloutGroup> arg0, final List<ProxyRolloutGroup> arg1,
|
||||
final List<ProxyRolloutGroup> arg2) {
|
||||
/**
|
||||
* CRUD operations be done through repository methods.
|
||||
*/
|
||||
}
|
||||
private String calculateFinishedPercentage(final RolloutGroup rolloutGroup) {
|
||||
return HawkbitCommonUtil.formattingFinishedPercentage(rolloutGroup, getRolloutManagement()
|
||||
.getFinishedPercentForRunningGroup(rolloutGroup.getRollout().getId(), rolloutGroup));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
long size = 0;
|
||||
if (null != rolloutId) {
|
||||
firstPageRolloutGroupSets = getRolloutGroupManagement().findAllRolloutGroupsWithDetailedStatus(rolloutId,
|
||||
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort));
|
||||
size = firstPageRolloutGroupSets.getTotalElements();
|
||||
}
|
||||
if (size > Integer.MAX_VALUE) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
@Override
|
||||
protected void saveBeans(final List<ProxyRolloutGroup> arg0, final List<ProxyRolloutGroup> arg1,
|
||||
final List<ProxyRolloutGroup> arg2) {
|
||||
/**
|
||||
* CRUD operations be done through repository methods.
|
||||
*/
|
||||
}
|
||||
|
||||
return (int) size;
|
||||
}
|
||||
@Override
|
||||
public int size() {
|
||||
long size = 0;
|
||||
if (null != rolloutId) {
|
||||
firstPageRolloutGroupSets = getRolloutGroupManagement().findAllRolloutGroupsWithDetailedStatus(rolloutId,
|
||||
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort));
|
||||
size = firstPageRolloutGroupSets.getTotalElements();
|
||||
}
|
||||
if (size > Integer.MAX_VALUE) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolloutManagement
|
||||
*/
|
||||
public RolloutManagement getRolloutManagement() {
|
||||
if (null == rolloutManagement) {
|
||||
rolloutManagement = SpringContextHelper.getBean(RolloutManagement.class);
|
||||
}
|
||||
return rolloutManagement;
|
||||
}
|
||||
return (int) size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolloutManagement
|
||||
*/
|
||||
public RolloutGroupManagement getRolloutGroupManagement() {
|
||||
if (null == rolloutGroupManagement) {
|
||||
rolloutGroupManagement = SpringContextHelper.getBean(RolloutGroupManagement.class);
|
||||
}
|
||||
return rolloutGroupManagement;
|
||||
}
|
||||
/**
|
||||
* @return the rolloutManagement
|
||||
*/
|
||||
public RolloutManagement getRolloutManagement() {
|
||||
if (null == rolloutManagement) {
|
||||
rolloutManagement = SpringContextHelper.getBean(RolloutManagement.class);
|
||||
}
|
||||
return rolloutManagement;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolloutUIState
|
||||
*/
|
||||
public RolloutUIState getRolloutUIState() {
|
||||
if (null == rolloutUIState) {
|
||||
rolloutUIState = SpringContextHelper.getBean(RolloutUIState.class);
|
||||
}
|
||||
return rolloutUIState;
|
||||
}
|
||||
/**
|
||||
* @return the rolloutManagement
|
||||
*/
|
||||
public RolloutGroupManagement getRolloutGroupManagement() {
|
||||
if (null == rolloutGroupManagement) {
|
||||
rolloutGroupManagement = SpringContextHelper.getBean(RolloutGroupManagement.class);
|
||||
}
|
||||
return rolloutGroupManagement;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolloutUIState
|
||||
*/
|
||||
public RolloutUIState getRolloutUIState() {
|
||||
if (null == rolloutUIState) {
|
||||
rolloutUIState = SpringContextHelper.getBean(RolloutUIState.class);
|
||||
}
|
||||
return rolloutUIState;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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.TotalTargetCountStatus;
|
||||
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.HtmlLabelRenderer;
|
||||
|
||||
@@ -132,7 +132,7 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
final LazyQueryContainer rolloutGroupGridContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
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_STATUS, RolloutGroupStatus.class, null,
|
||||
false, false);
|
||||
@@ -286,7 +286,7 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
} else if (SPUILabelDefinitions.ACTION.equals(cell.getPropertyId())) {
|
||||
return SPUILabelDefinitions.ACTION.toLowerCase();
|
||||
} 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())) {
|
||||
return DistributionBarHelper
|
||||
.getTooltip(((TotalTargetCountStatus) cell.getValue()).getStatusTotalCountMap());
|
||||
|
||||
Reference in New Issue
Block a user