Rollout management issues
Signed-off-by: venu1278 <venugopal.boodidadinne@in.bosch.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package org.eclipse.hawkbit.ui.customrenderers.client;
|
||||
|
||||
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.CustomObject;
|
||||
|
||||
import com.google.web.bindery.event.shared.HandlerRegistration;
|
||||
import com.vaadin.client.connectors.ClickableRendererConnector;
|
||||
import com.vaadin.client.renderers.ClickableRenderer.RendererClickHandler;
|
||||
import com.vaadin.shared.ui.Connect;
|
||||
|
||||
import elemental.json.JsonObject;
|
||||
|
||||
@Connect(org.eclipse.hawkbit.ui.customrenderers.renderers.CustomObjectRenderer.class)
|
||||
public class CustomObjectRendererConnector extends ClickableRendererConnector<CustomObject> {
|
||||
private static final long serialVersionUID = 7734682321931830566L;
|
||||
|
||||
public org.eclipse.hawkbit.ui.customrenderers.client.renderers.CustomObjectRenederer getRenderer() {
|
||||
return (org.eclipse.hawkbit.ui.customrenderers.client.renderers.CustomObjectRenederer) super.getRenderer();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected HandlerRegistration addClickHandler(
|
||||
RendererClickHandler<JsonObject> handler) {
|
||||
return getRenderer().addClickHandler(handler);
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.customrenderers.client;
|
||||
|
||||
import org.eclipse.hawkbit.ui.customrenderers.renderers.LinkRenderer;
|
||||
|
||||
import com.vaadin.client.connectors.ButtonRendererConnector;
|
||||
import com.vaadin.shared.ui.Connect;
|
||||
|
||||
/**
|
||||
*
|
||||
* A connector for {@link LinkRenderer}.
|
||||
*
|
||||
*/
|
||||
@Connect(org.eclipse.hawkbit.ui.customrenderers.renderers.LinkRenderer.class)
|
||||
public class LinkRendererConnector extends ButtonRendererConnector {
|
||||
private static final long serialVersionUID = 7987417436367399331L;
|
||||
|
||||
@Override
|
||||
public org.eclipse.hawkbit.ui.customrenderers.client.renderers.LinkRenderer getRenderer() {
|
||||
return (org.eclipse.hawkbit.ui.customrenderers.client.renderers.LinkRenderer) super.getRenderer();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package org.eclipse.hawkbit.ui.customrenderers.client.renderers;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class CustomObject implements Serializable {
|
||||
private static final long serialVersionUID = -5018181529953620263L;
|
||||
|
||||
private String name;
|
||||
|
||||
private String status;
|
||||
|
||||
public CustomObject(){
|
||||
|
||||
}
|
||||
|
||||
public CustomObject(String name, String status) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package org.eclipse.hawkbit.ui.customrenderers.client.renderers;
|
||||
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
import com.vaadin.client.renderers.ClickableRenderer;
|
||||
import com.vaadin.client.ui.VButton;
|
||||
import com.vaadin.client.widget.grid.RendererCellReference;
|
||||
|
||||
public class CustomObjectRenederer extends ClickableRenderer<CustomObject, VButton> {
|
||||
|
||||
@Override
|
||||
public VButton createWidget() {
|
||||
VButton b = GWT.create(VButton.class);
|
||||
b.addClickHandler(this);
|
||||
b.setStylePrimaryName("v-nativebutton");
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(RendererCellReference cell, CustomObject text, VButton button) {
|
||||
final String creating = "CREATING";
|
||||
button.setText(text.getName());
|
||||
applystyle(button);
|
||||
// this is to allow the button to disappear, if the text is null
|
||||
button.setVisible(text.getName() != null);
|
||||
button.getElement().setId(new StringBuilder("link").append(".").append(text.getName()).toString());
|
||||
/*
|
||||
* checking Rollout Status for applying button style. If Rollout status
|
||||
* is not "CREATING", then the Rollout button is applying hyperlink
|
||||
* style
|
||||
*/
|
||||
final boolean isStatusCreate = text.getStatus() != null && creating.equalsIgnoreCase(text.getStatus());
|
||||
if (isStatusCreate) {
|
||||
button.addStyleName(getStyle("boldhide"));
|
||||
button.setEnabled(false);
|
||||
} else {
|
||||
button.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void applystyle(VButton button) {
|
||||
button.setStyleName(VButton.CLASSNAME);
|
||||
button.addStyleName(getStyle("borderless"));
|
||||
button.addStyleName(getStyle("small"));
|
||||
button.addStyleName(getStyle("on-focus-no-border"));
|
||||
button.addStyleName(getStyle("link"));
|
||||
}
|
||||
|
||||
private String getStyle(final String style) {
|
||||
return new StringBuilder(style).append(" ").append(VButton.CLASSNAME).append("-").append(style).toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.customrenderers.client.renderers;
|
||||
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.vaadin.client.renderers.ButtonRenderer;
|
||||
import com.vaadin.client.ui.VButton;
|
||||
import com.vaadin.client.widget.grid.RendererCellReference;
|
||||
|
||||
/**
|
||||
*
|
||||
* Renders link with provided text.
|
||||
*
|
||||
*/
|
||||
public class LinkRenderer extends ButtonRenderer {
|
||||
@Override
|
||||
public void render(RendererCellReference cell, String text, Button button) {
|
||||
button.setText(text);
|
||||
applystyle(button);
|
||||
// this is to allow the button to disappear, if the text is null
|
||||
button.setVisible(text != null);
|
||||
button.getElement().setId(new StringBuilder("link").append(".").append(text).toString());
|
||||
}
|
||||
|
||||
private void applystyle(Button button) {
|
||||
button.setStyleName(VButton.CLASSNAME);
|
||||
button.addStyleName(getStyle("borderless"));
|
||||
button.addStyleName(getStyle("small"));
|
||||
button.addStyleName(getStyle("on-focus-no-border"));
|
||||
button.addStyleName(getStyle("link"));
|
||||
}
|
||||
|
||||
private String getStyle(final String style) {
|
||||
return new StringBuilder(style).append(" ").append(VButton.CLASSNAME).append("-").append(style).toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package org.eclipse.hawkbit.ui.customrenderers.renderers;
|
||||
|
||||
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.CustomObject;
|
||||
|
||||
import com.vaadin.ui.renderers.ClickableRenderer;
|
||||
|
||||
import elemental.json.JsonValue;
|
||||
|
||||
public class CustomObjectRenderer extends ClickableRenderer<CustomObject> {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -8754180585906263554L;
|
||||
|
||||
/**
|
||||
* Creates a new image renderer.
|
||||
*/
|
||||
public CustomObjectRenderer() {
|
||||
super(CustomObject.class, null);
|
||||
}
|
||||
|
||||
public CustomObjectRenderer(Class<CustomObject> presentationType) {
|
||||
super(presentationType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new image renderer and adds the given click listener to it.
|
||||
*
|
||||
* @param listener
|
||||
* the click listener to register
|
||||
*/
|
||||
public CustomObjectRenderer(RendererClickListener listener) {
|
||||
this();
|
||||
addClickListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonValue encode(CustomObject resource) {
|
||||
return super.encode(resource, CustomObject.class);
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.customrenderers.renderers;
|
||||
|
||||
import com.vaadin.ui.renderers.ButtonRenderer;
|
||||
|
||||
/**
|
||||
*
|
||||
* Renders link with provided text.
|
||||
*
|
||||
*/
|
||||
public class LinkRenderer extends ButtonRenderer {
|
||||
private static final long serialVersionUID = -1242995370043404892L;
|
||||
|
||||
/**
|
||||
* Intialise link renderer.
|
||||
*/
|
||||
public LinkRenderer() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Intialise link renderer with {@link RendererClickListener}
|
||||
*
|
||||
* @param listener
|
||||
* RendererClickListener
|
||||
*/
|
||||
public LinkRenderer(RendererClickListener listener) {
|
||||
super(listener);
|
||||
}
|
||||
}
|
||||
@@ -9,6 +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 com.vaadin.server.FontAwesome;
|
||||
|
||||
@@ -18,113 +19,122 @@ import com.vaadin.server.FontAwesome;
|
||||
*/
|
||||
public class ProxyRollout extends Rollout {
|
||||
|
||||
private static final long serialVersionUID = 4539849939617681918L;
|
||||
private static final long serialVersionUID = 4539849939617681918L;
|
||||
|
||||
private String distributionSetNameVersion;
|
||||
private String distributionSetNameVersion;
|
||||
|
||||
private String createdDate;
|
||||
private String createdDate;
|
||||
|
||||
private String modifiedDate;
|
||||
private String modifiedDate;
|
||||
|
||||
private Long numberOfGroups;
|
||||
private Long numberOfGroups;
|
||||
|
||||
private Boolean isActionRecieved = Boolean.FALSE;
|
||||
private Boolean isActionRecieved = Boolean.FALSE;
|
||||
|
||||
private String totalTargetsCount;
|
||||
|
||||
/**
|
||||
* @return the distributionSetNameVersion
|
||||
*/
|
||||
public String getDistributionSetNameVersion() {
|
||||
return distributionSetNameVersion;
|
||||
}
|
||||
private String totalTargetsCount;
|
||||
|
||||
/**
|
||||
* @param distributionSetNameVersion
|
||||
* the distributionSetNameVersion to set
|
||||
*/
|
||||
public void setDistributionSetNameVersion(final String distributionSetNameVersion) {
|
||||
this.distributionSetNameVersion = distributionSetNameVersion;
|
||||
}
|
||||
private CustomObject customObject;
|
||||
|
||||
/**
|
||||
* @return the numberOfGroups
|
||||
*/
|
||||
public Long getNumberOfGroups() {
|
||||
return numberOfGroups;
|
||||
}
|
||||
public CustomObject getCustomObject() {
|
||||
return customObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param numberOfGroups
|
||||
* the numberOfGroups to set
|
||||
*/
|
||||
public void setNumberOfGroups(final Long numberOfGroups) {
|
||||
this.numberOfGroups = numberOfGroups;
|
||||
}
|
||||
public void setCustomObject(CustomObject customObject) {
|
||||
this.customObject = customObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the createdDate
|
||||
*/
|
||||
public String getCreatedDate() {
|
||||
return createdDate;
|
||||
}
|
||||
/**
|
||||
* @return the distributionSetNameVersion
|
||||
*/
|
||||
public String getDistributionSetNameVersion() {
|
||||
return distributionSetNameVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param createdDate
|
||||
* the createdDate to set
|
||||
*/
|
||||
public void setCreatedDate(final String createdDate) {
|
||||
this.createdDate = createdDate;
|
||||
}
|
||||
/**
|
||||
* @param distributionSetNameVersion
|
||||
* the distributionSetNameVersion to set
|
||||
*/
|
||||
public void setDistributionSetNameVersion(final String distributionSetNameVersion) {
|
||||
this.distributionSetNameVersion = distributionSetNameVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the modifiedDate
|
||||
*/
|
||||
public String getModifiedDate() {
|
||||
return modifiedDate;
|
||||
}
|
||||
/**
|
||||
* @return the numberOfGroups
|
||||
*/
|
||||
public Long getNumberOfGroups() {
|
||||
return numberOfGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param modifiedDate
|
||||
* the modifiedDate to set
|
||||
*/
|
||||
public void setModifiedDate(final String modifiedDate) {
|
||||
this.modifiedDate = modifiedDate;
|
||||
}
|
||||
/**
|
||||
* @param numberOfGroups
|
||||
* the numberOfGroups to set
|
||||
*/
|
||||
public void setNumberOfGroups(final Long numberOfGroups) {
|
||||
this.numberOfGroups = numberOfGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the isActionRecieved
|
||||
*/
|
||||
public Boolean getIsActionRecieved() {
|
||||
return isActionRecieved;
|
||||
}
|
||||
/**
|
||||
* @return the createdDate
|
||||
*/
|
||||
public String getCreatedDate() {
|
||||
return createdDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isActionRecieved
|
||||
* the isActionRecieved to set
|
||||
*/
|
||||
public void setIsActionRecieved(final Boolean isActionRecieved) {
|
||||
this.isActionRecieved = isActionRecieved;
|
||||
}
|
||||
/**
|
||||
* @param createdDate
|
||||
* the createdDate to set
|
||||
*/
|
||||
public void setCreatedDate(final String createdDate) {
|
||||
this.createdDate = createdDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the totalTargetsCount
|
||||
*/
|
||||
public String getTotalTargetsCount() {
|
||||
return totalTargetsCount;
|
||||
}
|
||||
/**
|
||||
* @return the modifiedDate
|
||||
*/
|
||||
public String getModifiedDate() {
|
||||
return modifiedDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param modifiedDate
|
||||
* the modifiedDate to set
|
||||
*/
|
||||
public void setModifiedDate(final String modifiedDate) {
|
||||
this.modifiedDate = modifiedDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the isActionRecieved
|
||||
*/
|
||||
public Boolean getIsActionRecieved() {
|
||||
return isActionRecieved;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isActionRecieved
|
||||
* the isActionRecieved to set
|
||||
*/
|
||||
public void setIsActionRecieved(final Boolean isActionRecieved) {
|
||||
this.isActionRecieved = isActionRecieved;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the totalTargetsCount
|
||||
*/
|
||||
public String getTotalTargetsCount() {
|
||||
return totalTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param totalTargetsCount
|
||||
* the totalTargetsCount to set
|
||||
*/
|
||||
public void setTotalTargetsCount(final String totalTargetsCount) {
|
||||
this.totalTargetsCount = totalTargetsCount;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return FontAwesome.CIRCLE_O.getHtml();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param totalTargetsCount
|
||||
* the totalTargetsCount to set
|
||||
*/
|
||||
public void setTotalTargetsCount(final String totalTargetsCount) {
|
||||
this.totalTargetsCount = totalTargetsCount;
|
||||
}
|
||||
|
||||
|
||||
public String getAction() {
|
||||
return FontAwesome.CIRCLE_O.getHtml();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +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.rollout.state.RolloutUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||
@@ -130,7 +131,8 @@ public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
|
||||
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()));
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,6 +9,7 @@
|
||||
package org.eclipse.hawkbit.ui.rollout.rolloutgroup;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.CustomObject;
|
||||
|
||||
/**
|
||||
* Proxy rollout group with suctome properties.
|
||||
@@ -39,6 +40,16 @@ public class ProxyRolloutGroup extends RolloutGroup {
|
||||
private Boolean isActionRecieved = Boolean.FALSE;
|
||||
|
||||
private String totalTargetsCount;
|
||||
|
||||
private CustomObject customObject;
|
||||
|
||||
public CustomObject getCustomObject() {
|
||||
return customObject;
|
||||
}
|
||||
|
||||
public void setCustomObject(CustomObject customObject) {
|
||||
this.customObject = customObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the createdDate
|
||||
|
||||
@@ -15,6 +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.rollout.state.RolloutUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||
@@ -121,6 +122,8 @@ public class RolloutGroupBeanQuery extends AbstractBeanQuery<ProxyRolloutGroup>
|
||||
proxyRolloutGroup.setSuccessCondition(rolloutGroup.getSuccessCondition());
|
||||
proxyRolloutGroup.setSuccessConditionExp(rolloutGroup.getSuccessConditionExp());
|
||||
proxyRolloutGroup.setFinishedPercentage(calculateFinishedPercentage(rolloutGroup));
|
||||
|
||||
proxyRolloutGroup.setCustomObject(new CustomObject(rolloutGroup.getName(), null));
|
||||
|
||||
proxyRolloutGroup.setTotalTargetsCount(String.valueOf(rolloutGroup.getTotalTargets()));
|
||||
proxyRolloutGroup.setTotalTargetCountStatus(rolloutGroup.getTotalTargetCountStatus());
|
||||
|
||||
@@ -20,13 +20,15 @@ import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.RolloutGroupChangeEvent;
|
||||
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
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.renderers.CustomObjectRenderer;
|
||||
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlLabelRenderer;
|
||||
import org.eclipse.hawkbit.ui.customrenderers.renderers.LinkRenderer;
|
||||
import org.eclipse.hawkbit.ui.rollout.DistributionBarHelper;
|
||||
import org.eclipse.hawkbit.ui.rollout.StatusFontIcon;
|
||||
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
||||
@@ -47,6 +49,7 @@ import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
import com.vaadin.data.Container;
|
||||
import com.vaadin.data.Item;
|
||||
import com.vaadin.data.util.GeneratedPropertyContainer;
|
||||
import com.vaadin.data.util.converter.Converter;
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
@@ -62,335 +65,392 @@ import com.vaadin.ui.renderers.HtmlRenderer;
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
public class RolloutGroupListGrid extends AbstractGrid {
|
||||
private static final long serialVersionUID = 4060904914954370524L;
|
||||
private static final long serialVersionUID = 4060904914954370524L;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private transient RolloutGroupManagement rolloutGroupManagement;
|
||||
@Autowired
|
||||
private transient RolloutGroupManagement rolloutGroupManagement;
|
||||
|
||||
@Autowired
|
||||
private transient RolloutUIState rolloutUIState;
|
||||
@Autowired
|
||||
private transient RolloutManagement rolloutManagement;
|
||||
|
||||
@Autowired
|
||||
private transient SpPermissionChecker permissionChecker;
|
||||
@Autowired
|
||||
private transient RolloutUIState rolloutUIState;
|
||||
|
||||
private transient Map<RolloutGroupStatus, StatusFontIcon> statusIconMap = new EnumMap<>(RolloutGroupStatus.class);
|
||||
@Autowired
|
||||
private transient SpPermissionChecker permissionChecker;
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
private transient Map<RolloutGroupStatus, StatusFontIcon> statusIconMap = new EnumMap<>(RolloutGroupStatus.class);
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
private final String name = "name";
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final RolloutEvent event) {
|
||||
if (RolloutEvent.SHOW_ROLLOUT_GROUPS != event) {
|
||||
return;
|
||||
}
|
||||
((LazyQueryContainer) getContainerDataSource()).refresh();
|
||||
}
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Handles the RolloutGroupChangeEvent to refresh the item in the grid.
|
||||
*
|
||||
*
|
||||
* @param rolloutGroupChangeEvent
|
||||
* the event which contains the rollout group which has been
|
||||
* change
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
public void onEvent(final RolloutGroupChangeEvent rolloutGroupChangeEvent) {
|
||||
if (!rolloutUIState.isShowRolloutGroups()) {
|
||||
return;
|
||||
}
|
||||
final RolloutGroup rolloutGroup = rolloutGroupManagement
|
||||
.findRolloutGroupWithDetailedStatus(rolloutGroupChangeEvent.getRolloutGroupId());
|
||||
final LazyQueryContainer rolloutContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
final Item item = rolloutContainer.getItem(rolloutGroup.getId());
|
||||
if (item == null) {
|
||||
return;
|
||||
}
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_STATUS).setValue(rolloutGroup.getStatus());
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS)
|
||||
.setValue(rolloutGroup.getTotalTargetCountStatus());
|
||||
}
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Container createContainer() {
|
||||
final BeanQueryFactory<RolloutGroupBeanQuery> rolloutQf = new BeanQueryFactory<>(RolloutGroupBeanQuery.class);
|
||||
return new LazyQueryContainer(
|
||||
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_ID), rolloutQf);
|
||||
}
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final RolloutEvent event) {
|
||||
if (RolloutEvent.SHOW_ROLLOUT_GROUPS != event) {
|
||||
return;
|
||||
}
|
||||
getLazyQueryContainer().refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addContainerProperties() {
|
||||
final LazyQueryContainer rolloutGroupGridContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, "", false, false);
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, null, false, false);
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_STATUS, RolloutGroupStatus.class, null,
|
||||
false, false);
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE,
|
||||
String.class, null, false, false);
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD, String.class,
|
||||
null, false, false);
|
||||
/**
|
||||
*
|
||||
* Handles the RolloutGroupChangeEvent to refresh the item in the grid.
|
||||
*
|
||||
*
|
||||
* @param rolloutGroupChangeEvent
|
||||
* the event which contains the rollout group which has been
|
||||
* change
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
public void onEvent(final RolloutGroupChangeEvent rolloutGroupChangeEvent) {
|
||||
if (!rolloutUIState.isShowRolloutGroups()) {
|
||||
return;
|
||||
}
|
||||
final RolloutGroup rolloutGroup = rolloutGroupManagement
|
||||
.findRolloutGroupWithDetailedStatus(rolloutGroupChangeEvent.getRolloutGroupId());
|
||||
final LazyQueryContainer rolloutContainer = getLazyQueryContainer();
|
||||
final Item item = rolloutContainer.getItem(rolloutGroup.getId());
|
||||
if (item == null) {
|
||||
return;
|
||||
}
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_STATUS).setValue(rolloutGroup.getStatus());
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS)
|
||||
.setValue(rolloutGroup.getTotalTargetCountStatus());
|
||||
item.getItemProperty(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE)
|
||||
.setValue(calculateFinishedPercentage(rolloutGroup));
|
||||
}
|
||||
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD, String.class, null,
|
||||
false, false);
|
||||
private String calculateFinishedPercentage(final RolloutGroup rolloutGroup) {
|
||||
return HawkbitCommonUtil.formattingFinishedPercentage(rolloutGroup,
|
||||
rolloutManagement.getFinishedPercentForRunningGroup(rolloutGroup.getRollout().getId(), rolloutGroup));
|
||||
}
|
||||
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, String.class, null, false,
|
||||
false);
|
||||
@Override
|
||||
protected Container createContainer() {
|
||||
final BeanQueryFactory<RolloutGroupBeanQuery> rolloutQf = new BeanQueryFactory<>(RolloutGroupBeanQuery.class);
|
||||
return new GeneratedPropertyContainer(new LazyQueryContainer(
|
||||
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_ID), rolloutQf));
|
||||
}
|
||||
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_DATE, String.class, null,
|
||||
false, false);
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_USER, String.class, null, false,
|
||||
false);
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_BY, String.class, null, false,
|
||||
false);
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS, String.class, "0", false,
|
||||
false);
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS,
|
||||
TotalTargetCountStatus.class, null, false, false);
|
||||
@Override
|
||||
protected void addContainerProperties() {
|
||||
final LazyQueryContainer rolloutGroupGridContainer = getLazyQueryContainer();
|
||||
rolloutGroupGridContainer.addContainerProperty("customObject", CustomObject.class, null, false, false);
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, "", false, false);
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, null, false, false);
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_STATUS, RolloutGroupStatus.class, null,
|
||||
false, false);
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE,
|
||||
String.class, null, false, false);
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD, String.class,
|
||||
null, false, false);
|
||||
|
||||
}
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD, String.class, null,
|
||||
false, false);
|
||||
|
||||
@Override
|
||||
protected void setColumnExpandRatio() {
|
||||
getColumn(SPUILabelDefinitions.VAR_NAME).setMinimumWidth(40);
|
||||
getColumn(SPUILabelDefinitions.VAR_NAME).setMaximumWidth(200);
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, String.class, null, false,
|
||||
false);
|
||||
|
||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setMinimumWidth(40);
|
||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setMaximumWidth(100);
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_DATE, String.class, null,
|
||||
false, false);
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_USER, String.class, null, false,
|
||||
false);
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_BY, String.class, null, false,
|
||||
false);
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS, String.class, "0", false,
|
||||
false);
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS,
|
||||
TotalTargetCountStatus.class, null, false, false);
|
||||
// addGeneratedProperties();
|
||||
}
|
||||
|
||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setMinimumWidth(75);
|
||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setMaximumWidth(75);
|
||||
/*
|
||||
* private void addGeneratedProperties() { GeneratedPropertyContainer
|
||||
* generatedPropertyContainer = (GeneratedPropertyContainer)
|
||||
* getContainerDataSource(); //
|
||||
* generatedPropertyContainer.addGeneratedProperty(SPUILabelDefinitions.
|
||||
* VAR_NAME, // new PropertyValueGenerator<CustomRollOutDetails>() { //
|
||||
* private static final long serialVersionUID = -9203261132281441831L; //
|
||||
* // @Override // public CustomRollOutDetails getValue(Item item, Object
|
||||
* itemId, Object // propertyId) { // CustomRollOutDetails
|
||||
* customRollOutDetails = new // CustomRollOutDetails(); //
|
||||
* customRollOutDetails.setRolloutName( // (String) //
|
||||
* item.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue().toString()
|
||||
* ); // return customRollOutDetails; // } // // @Override // public
|
||||
* Class<CustomRollOutDetails> getType() { // return
|
||||
* CustomRollOutDetails.class; // } // });
|
||||
*
|
||||
* }
|
||||
*/
|
||||
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE).setMinimumWidth(40);
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE).setMaximumWidth(100);
|
||||
@Override
|
||||
protected void setColumnExpandRatio() {
|
||||
/*getColumn(SPUILabelDefinitions.VAR_NAME).setMinimumWidth(40);
|
||||
getColumn(SPUILabelDefinitions.VAR_NAME).setMaximumWidth(200);*/
|
||||
|
||||
getColumn("customObject").setMinimumWidth(40);
|
||||
getColumn("customObject").setMaximumWidth(200);
|
||||
|
||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setMinimumWidth(40);
|
||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setMaximumWidth(100);
|
||||
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD).setMinimumWidth(40);
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD).setMaximumWidth(100);
|
||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setMinimumWidth(75);
|
||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setMaximumWidth(75);
|
||||
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD).setMinimumWidth(40);
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD).setMaximumWidth(100);
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE).setMinimumWidth(40);
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE).setMaximumWidth(100);
|
||||
|
||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setMinimumWidth(280);
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD).setMinimumWidth(40);
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD).setMaximumWidth(100);
|
||||
|
||||
setFrozenColumnCount(7);
|
||||
}
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD).setMinimumWidth(40);
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD).setMaximumWidth(100);
|
||||
|
||||
@Override
|
||||
protected void setColumnHeaderNames() {
|
||||
getColumn(SPUILabelDefinitions.VAR_NAME).setHeaderCaption(i18n.get("header.name"));
|
||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setHeaderCaption(i18n.get("header.status"));
|
||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS)
|
||||
.setHeaderCaption(i18n.get("header.detail.status"));
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE)
|
||||
.setHeaderCaption(i18n.get("header.rolloutgroup.installed.percentage"));
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD)
|
||||
.setHeaderCaption(i18n.get("header.rolloutgroup.threshold.error"));
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD)
|
||||
.setHeaderCaption(i18n.get("header.rolloutgroup.threshold"));
|
||||
getColumn(SPUILabelDefinitions.VAR_CREATED_USER).setHeaderCaption(i18n.get("header.createdBy"));
|
||||
getColumn(SPUILabelDefinitions.VAR_CREATED_DATE).setHeaderCaption(i18n.get("header.createdDate"));
|
||||
getColumn(SPUILabelDefinitions.VAR_MODIFIED_DATE).setHeaderCaption(i18n.get("header.modifiedDate"));
|
||||
getColumn(SPUILabelDefinitions.VAR_MODIFIED_BY).setHeaderCaption(i18n.get("header.modifiedBy"));
|
||||
getColumn(SPUILabelDefinitions.VAR_DESC).setHeaderCaption(i18n.get("header.description"));
|
||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setHeaderCaption(i18n.get("header.total.targets"));
|
||||
}
|
||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setMinimumWidth(280);
|
||||
|
||||
@Override
|
||||
protected String getGridId() {
|
||||
return SPUIComponetIdProvider.ROLLOUT_GROUP_LIST_GRID_ID;
|
||||
}
|
||||
setFrozenColumnCount(7);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setColumnProperties() {
|
||||
List<Object> columnList = new ArrayList<>();
|
||||
columnList.add(SPUILabelDefinitions.VAR_NAME);
|
||||
columnList.add(SPUILabelDefinitions.VAR_STATUS);
|
||||
columnList.add(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS);
|
||||
columnList.add(SPUILabelDefinitions.VAR_TOTAL_TARGETS);
|
||||
columnList.add(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE);
|
||||
columnList.add(SPUILabelDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD);
|
||||
columnList.add(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD);
|
||||
columnList.add(SPUILabelDefinitions.VAR_CREATED_DATE);
|
||||
columnList.add(SPUILabelDefinitions.VAR_CREATED_USER);
|
||||
columnList.add(SPUILabelDefinitions.VAR_MODIFIED_DATE);
|
||||
columnList.add(SPUILabelDefinitions.VAR_MODIFIED_BY);
|
||||
columnList.add(SPUILabelDefinitions.VAR_DESC);
|
||||
setColumnOrder(columnList.toArray());
|
||||
alignColumns();
|
||||
}
|
||||
@Override
|
||||
protected void setColumnHeaderNames() {
|
||||
//getColumn(SPUILabelDefinitions.VAR_NAME).setHeaderCaption(i18n.get("header.name"));
|
||||
getColumn("customObject").setHeaderCaption(i18n.get("header.name"));
|
||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setHeaderCaption(i18n.get("header.status"));
|
||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS)
|
||||
.setHeaderCaption(i18n.get("header.detail.status"));
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE)
|
||||
.setHeaderCaption(i18n.get("header.rolloutgroup.installed.percentage"));
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD)
|
||||
.setHeaderCaption(i18n.get("header.rolloutgroup.threshold.error"));
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD)
|
||||
.setHeaderCaption(i18n.get("header.rolloutgroup.threshold"));
|
||||
getColumn(SPUILabelDefinitions.VAR_CREATED_USER).setHeaderCaption(i18n.get("header.createdBy"));
|
||||
getColumn(SPUILabelDefinitions.VAR_CREATED_DATE).setHeaderCaption(i18n.get("header.createdDate"));
|
||||
getColumn(SPUILabelDefinitions.VAR_MODIFIED_DATE).setHeaderCaption(i18n.get("header.modifiedDate"));
|
||||
getColumn(SPUILabelDefinitions.VAR_MODIFIED_BY).setHeaderCaption(i18n.get("header.modifiedBy"));
|
||||
getColumn(SPUILabelDefinitions.VAR_DESC).setHeaderCaption(i18n.get("header.description"));
|
||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setHeaderCaption(i18n.get("header.total.targets"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addColumnRenderes() {
|
||||
createRolloutGroupStatusToFontMap();
|
||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setRenderer(new HtmlLabelRenderer(),
|
||||
new RolloutGroupStatusConverter());
|
||||
|
||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setRenderer(new HtmlRenderer(),
|
||||
new TotalTargetCountStatusConverter());
|
||||
if (permissionChecker.hasRolloutTargetsReadPermission()) {
|
||||
getColumn(SPUILabelDefinitions.VAR_NAME)
|
||||
.setRenderer(new LinkRenderer(event -> onClickOfRolloutGroupName(event)));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected String getGridId() {
|
||||
return SPUIComponetIdProvider.ROLLOUT_GROUP_LIST_GRID_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setHiddenColumns() {
|
||||
List<Object> columnsToBeHidden = new ArrayList<>();
|
||||
columnsToBeHidden.add(SPUILabelDefinitions.VAR_CREATED_DATE);
|
||||
columnsToBeHidden.add(SPUILabelDefinitions.VAR_CREATED_USER);
|
||||
columnsToBeHidden.add(SPUILabelDefinitions.VAR_MODIFIED_DATE);
|
||||
columnsToBeHidden.add(SPUILabelDefinitions.VAR_MODIFIED_BY);
|
||||
columnsToBeHidden.add(SPUILabelDefinitions.VAR_DESC);
|
||||
for (Object propertyId : columnsToBeHidden) {
|
||||
getColumn(propertyId).setHidden(true);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void setColumnProperties() {
|
||||
List<Object> columnList = new ArrayList<>();
|
||||
columnList.add("customObject");
|
||||
//columnList.add(SPUILabelDefinitions.VAR_NAME);
|
||||
columnList.add(SPUILabelDefinitions.VAR_STATUS);
|
||||
columnList.add(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS);
|
||||
columnList.add(SPUILabelDefinitions.VAR_TOTAL_TARGETS);
|
||||
columnList.add(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE);
|
||||
columnList.add(SPUILabelDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD);
|
||||
columnList.add(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD);
|
||||
columnList.add(SPUILabelDefinitions.VAR_CREATED_DATE);
|
||||
columnList.add(SPUILabelDefinitions.VAR_CREATED_USER);
|
||||
columnList.add(SPUILabelDefinitions.VAR_MODIFIED_DATE);
|
||||
columnList.add(SPUILabelDefinitions.VAR_MODIFIED_BY);
|
||||
columnList.add(SPUILabelDefinitions.VAR_DESC);
|
||||
setColumnOrder(columnList.toArray());
|
||||
alignColumns();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CellDescriptionGenerator getDescriptionGenerator() {
|
||||
return cell -> getDescription(cell);
|
||||
}
|
||||
@Override
|
||||
protected void addColumnRenderes() {
|
||||
createRolloutGroupStatusToFontMap();
|
||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setRenderer(new HtmlLabelRenderer(),
|
||||
new RolloutGroupStatusConverter());
|
||||
|
||||
private void onClickOfRolloutGroupName(RendererClickEvent event) {
|
||||
rolloutUIState
|
||||
.setRolloutGroup(rolloutGroupManagement.findRolloutGroupWithDetailedStatus((Long) event.getItemId()));
|
||||
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS);
|
||||
}
|
||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setRenderer(new HtmlRenderer(),
|
||||
new TotalTargetCountStatusConverter());
|
||||
if (permissionChecker.hasRolloutTargetsReadPermission()) {
|
||||
/*
|
||||
* getColumn(SPUILabelDefinitions.VAR_NAME) .setRenderer(new
|
||||
* LinkRenderer(event -> onClickOfRolloutGroupName(event)));
|
||||
*/
|
||||
CustomObjectRenderer cor = new CustomObjectRenderer(CustomObject.class);
|
||||
cor.addClickListener(event -> onClickOfRolloutGroupName(event));
|
||||
getColumn("customObject").setRenderer(cor);
|
||||
|
||||
private String convertRolloutGroupStatusToString(final RolloutGroupStatus value) {
|
||||
StatusFontIcon statusFontIcon = statusIconMap.get(value);
|
||||
if (statusFontIcon == null) {
|
||||
return null;
|
||||
}
|
||||
String codePoint = statusFontIcon.getFontIcon() != null
|
||||
? Integer.toString(statusFontIcon.getFontIcon().getCodepoint()) : null;
|
||||
return HawkbitCommonUtil.getStatusLabelDetailsInString(codePoint, statusFontIcon.getStyle(),
|
||||
SPUIComponetIdProvider.ROLLOUT_GROUP_STATUS_LABEL_ID);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
protected void setHiddenColumns() {
|
||||
List<Object> columnsToBeHidden = new ArrayList<>();
|
||||
columnsToBeHidden.add(SPUILabelDefinitions.VAR_NAME);
|
||||
columnsToBeHidden.add(SPUILabelDefinitions.VAR_CREATED_DATE);
|
||||
columnsToBeHidden.add(SPUILabelDefinitions.VAR_CREATED_USER);
|
||||
columnsToBeHidden.add(SPUILabelDefinitions.VAR_MODIFIED_DATE);
|
||||
columnsToBeHidden.add(SPUILabelDefinitions.VAR_MODIFIED_BY);
|
||||
columnsToBeHidden.add(SPUILabelDefinitions.VAR_DESC);
|
||||
for (Object propertyId : columnsToBeHidden) {
|
||||
getColumn(propertyId).setHidden(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void createRolloutGroupStatusToFontMap() {
|
||||
statusIconMap.put(RolloutGroupStatus.FINISHED,
|
||||
new StatusFontIcon(FontAwesome.CHECK_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_GREEN));
|
||||
statusIconMap.put(RolloutGroupStatus.SCHEDULED,
|
||||
new StatusFontIcon(FontAwesome.HOURGLASS_1, SPUIStyleDefinitions.STATUS_ICON_PENDING));
|
||||
statusIconMap.put(RolloutGroupStatus.RUNNING,
|
||||
new StatusFontIcon(FontAwesome.ADJUST, SPUIStyleDefinitions.STATUS_ICON_YELLOW));
|
||||
statusIconMap.put(RolloutGroupStatus.READY,
|
||||
new StatusFontIcon(FontAwesome.DOT_CIRCLE_O, SPUIStyleDefinitions.STATUS_ICON_LIGHT_BLUE));
|
||||
statusIconMap.put(RolloutGroupStatus.ERROR,
|
||||
new StatusFontIcon(FontAwesome.EXCLAMATION_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_RED));
|
||||
}
|
||||
@Override
|
||||
protected CellDescriptionGenerator getDescriptionGenerator() {
|
||||
return cell -> getDescription(cell);
|
||||
}
|
||||
|
||||
private String getDescription(CellReference cell) {
|
||||
if (SPUILabelDefinitions.VAR_STATUS.equals(cell.getPropertyId())) {
|
||||
return cell.getProperty().getValue().toString().toLowerCase();
|
||||
} else if (SPUILabelDefinitions.ACTION.equals(cell.getPropertyId())) {
|
||||
return SPUILabelDefinitions.ACTION.toLowerCase();
|
||||
} else if (SPUILabelDefinitions.VAR_NAME.equals(cell.getPropertyId())) {
|
||||
return cell.getProperty().getValue().toString();
|
||||
} else if (SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS.equals(cell.getPropertyId())) {
|
||||
return DistributionBarHelper
|
||||
.getTooltip(((TotalTargetCountStatus) cell.getValue()).getStatusTotalCountMap());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private void onClickOfRolloutGroupName(RendererClickEvent event) {
|
||||
rolloutUIState
|
||||
.setRolloutGroup(rolloutGroupManagement.findRolloutGroupWithDetailedStatus((Long) event.getItemId()));
|
||||
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS);
|
||||
}
|
||||
|
||||
private void alignColumns() {
|
||||
setCellStyleGenerator(new CellStyleGenerator() {
|
||||
private static final long serialVersionUID = 5573570647129792429L;
|
||||
private String convertRolloutGroupStatusToString(final RolloutGroupStatus value) {
|
||||
StatusFontIcon statusFontIcon = statusIconMap.get(value);
|
||||
if (statusFontIcon == null) {
|
||||
return null;
|
||||
}
|
||||
String codePoint = statusFontIcon.getFontIcon() != null
|
||||
? Integer.toString(statusFontIcon.getFontIcon().getCodepoint()) : null;
|
||||
return HawkbitCommonUtil.getStatusLabelDetailsInString(codePoint, statusFontIcon.getStyle(),
|
||||
SPUIComponetIdProvider.ROLLOUT_GROUP_STATUS_LABEL_ID);
|
||||
|
||||
@Override
|
||||
public String getStyle(final CellReference cellReference) {
|
||||
String[] coulmnNames = { SPUILabelDefinitions.VAR_STATUS,
|
||||
SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS };
|
||||
if (Arrays.asList(coulmnNames).contains(cellReference.getPropertyId())) {
|
||||
return "centeralign";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Converts {@link TotalTargetCountStatus} into formatted string with status
|
||||
* and count details.
|
||||
*
|
||||
*/
|
||||
class TotalTargetCountStatusConverter implements Converter<String, TotalTargetCountStatus> {
|
||||
private void createRolloutGroupStatusToFontMap() {
|
||||
statusIconMap.put(RolloutGroupStatus.FINISHED,
|
||||
new StatusFontIcon(FontAwesome.CHECK_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_GREEN));
|
||||
statusIconMap.put(RolloutGroupStatus.SCHEDULED,
|
||||
new StatusFontIcon(FontAwesome.HOURGLASS_1, SPUIStyleDefinitions.STATUS_ICON_PENDING));
|
||||
statusIconMap.put(RolloutGroupStatus.RUNNING,
|
||||
new StatusFontIcon(FontAwesome.ADJUST, SPUIStyleDefinitions.STATUS_ICON_YELLOW));
|
||||
statusIconMap.put(RolloutGroupStatus.READY,
|
||||
new StatusFontIcon(FontAwesome.DOT_CIRCLE_O, SPUIStyleDefinitions.STATUS_ICON_LIGHT_BLUE));
|
||||
statusIconMap.put(RolloutGroupStatus.ERROR,
|
||||
new StatusFontIcon(FontAwesome.EXCLAMATION_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_RED));
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -9205943894818450807L;
|
||||
private String getDescription(CellReference cell) {
|
||||
if (SPUILabelDefinitions.VAR_STATUS.equals(cell.getPropertyId())) {
|
||||
return cell.getProperty().getValue().toString().toLowerCase();
|
||||
} else if (SPUILabelDefinitions.ACTION.equals(cell.getPropertyId())) {
|
||||
return SPUILabelDefinitions.ACTION.toLowerCase();
|
||||
} else if ("customObject".equals(cell.getPropertyId())) {
|
||||
return ((CustomObject) cell.getProperty().getValue()).getName();
|
||||
// getNameToolTip(cell.getProperty().getValue().toString());
|
||||
} else if (SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS.equals(cell.getPropertyId())) {
|
||||
return DistributionBarHelper
|
||||
.getTooltip(((TotalTargetCountStatus) cell.getValue()).getStatusTotalCountMap());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TotalTargetCountStatus convertToModel(String value, Class<? extends TotalTargetCountStatus> targetType,
|
||||
Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException {
|
||||
return null;
|
||||
}
|
||||
private String getNameToolTip(final String text) {
|
||||
String[] nameList = text.split(":");
|
||||
if (nameList[0].equalsIgnoreCase(name)) {
|
||||
return nameList[1];
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String convertToPresentation(TotalTargetCountStatus value, Class<? extends String> targetType,
|
||||
Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException {
|
||||
return DistributionBarHelper.getDistributionBarAsHTMLString(value.getStatusTotalCountMap());
|
||||
}
|
||||
private void alignColumns() {
|
||||
setCellStyleGenerator(new CellStyleGenerator() {
|
||||
private static final long serialVersionUID = 5573570647129792429L;
|
||||
|
||||
@Override
|
||||
public Class<TotalTargetCountStatus> getModelType() {
|
||||
return TotalTargetCountStatus.class;
|
||||
}
|
||||
@Override
|
||||
public String getStyle(final CellReference cellReference) {
|
||||
String[] coulmnNames = { SPUILabelDefinitions.VAR_STATUS,
|
||||
SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS };
|
||||
if (Arrays.asList(coulmnNames).contains(cellReference.getPropertyId())) {
|
||||
return "centeralign";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<String> getPresentationType() {
|
||||
return String.class;
|
||||
}
|
||||
}
|
||||
private LazyQueryContainer getLazyQueryContainer() {
|
||||
return ((LazyQueryContainer) (((GeneratedPropertyContainer) getContainerDataSource()).getWrappedContainer()));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Converts {@link RolloutGroupStatus} to string.
|
||||
*
|
||||
*/
|
||||
class RolloutGroupStatusConverter implements Converter<String, RolloutGroupStatus> {
|
||||
/**
|
||||
*
|
||||
* Converts {@link TotalTargetCountStatus} into formatted string with status
|
||||
* and count details.
|
||||
*
|
||||
*/
|
||||
class TotalTargetCountStatusConverter implements Converter<String, TotalTargetCountStatus> {
|
||||
|
||||
private static final long serialVersionUID = 5448062736373292820L;
|
||||
private static final long serialVersionUID = -9205943894818450807L;
|
||||
|
||||
@Override
|
||||
public RolloutGroupStatus convertToModel(final String value,
|
||||
final Class<? extends RolloutGroupStatus> targetType, final Locale locale) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public TotalTargetCountStatus convertToModel(String value, Class<? extends TotalTargetCountStatus> targetType,
|
||||
Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String convertToPresentation(final RolloutGroupStatus value, final Class<? extends String> targetType,
|
||||
final Locale locale) {
|
||||
return convertRolloutGroupStatusToString(value);
|
||||
}
|
||||
@Override
|
||||
public String convertToPresentation(TotalTargetCountStatus value, Class<? extends String> targetType,
|
||||
Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException {
|
||||
return DistributionBarHelper.getDistributionBarAsHTMLString(value.getStatusTotalCountMap());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<RolloutGroupStatus> getModelType() {
|
||||
return RolloutGroupStatus.class;
|
||||
}
|
||||
@Override
|
||||
public Class<TotalTargetCountStatus> getModelType() {
|
||||
return TotalTargetCountStatus.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<String> getPresentationType() {
|
||||
return String.class;
|
||||
}
|
||||
@Override
|
||||
public Class<String> getPresentationType() {
|
||||
return String.class;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Converts {@link RolloutGroupStatus} to string.
|
||||
*
|
||||
*/
|
||||
class RolloutGroupStatusConverter implements Converter<String, RolloutGroupStatus> {
|
||||
|
||||
private static final long serialVersionUID = 5448062736373292820L;
|
||||
|
||||
@Override
|
||||
public RolloutGroupStatus convertToModel(final String value,
|
||||
final Class<? extends RolloutGroupStatus> targetType, final Locale locale) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String convertToPresentation(final RolloutGroupStatus value, final Class<? extends String> targetType,
|
||||
final Locale locale) {
|
||||
return convertRolloutGroupStatusToString(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<RolloutGroupStatus> getModelType() {
|
||||
return RolloutGroupStatus.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<String> getPresentationType() {
|
||||
return String.class;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,20 +19,32 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.v-context-menu .v-context-menu-item-basic-icon-container{
|
||||
height:0px !important;
|
||||
width:0px !important;
|
||||
}
|
||||
|
||||
.v-context-menu, .v-context-menu .v-context-menu-item-basic{
|
||||
.v-context-menu .v-context-menu-item-basic{
|
||||
background-color: #feffff !important;
|
||||
border-radius: 4px;
|
||||
font-family : $app-font-family;
|
||||
font-size : $app-text-font-size;
|
||||
font-weight : normal;
|
||||
font-style : normal;
|
||||
}
|
||||
|
||||
|
||||
.v-context-menu{
|
||||
background-color: #feffff !important;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.v-context-menu .v-context-menu-item-basic:focus, .v-context-menu .v-context-menu-item-basic-submenu:focus, .v-context-menu .v-context-menu-item-basic-open {
|
||||
@include valo-gradient($color: $hawkbit-primary-color);
|
||||
background-color: $hawkbit-primary-color !important;
|
||||
color: #e8eef3;
|
||||
height: 30px;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
@@ -77,5 +89,9 @@
|
||||
border-left: $v-grid-border-size solid $widget-border-color ;
|
||||
}
|
||||
|
||||
.v-button-boldhide{
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user