Merge pull request #142 from bsinno/Rollout_Management_issues_refactor
Rollout management issues refactor
This commit is contained in:
@@ -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,37 @@
|
||||
/**
|
||||
* 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.client.renderers.RolloutRendererData;
|
||||
|
||||
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;
|
||||
/**
|
||||
* A connector for {@link CustomObjectRenderer }.
|
||||
*
|
||||
*/
|
||||
@Connect(org.eclipse.hawkbit.ui.customrenderers.renderers.RolloutRenderer.class)
|
||||
public class RolloutRendererConnector extends ClickableRendererConnector<RolloutRendererData> {
|
||||
private static final long serialVersionUID = 7734682321931830566L;
|
||||
|
||||
public org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRenderer getRenderer() {
|
||||
return (org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRenderer) super.getRenderer();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected HandlerRegistration addClickHandler(
|
||||
RendererClickHandler<JsonObject> handler) {
|
||||
return getRenderer().addClickHandler(handler);
|
||||
}
|
||||
}
|
||||
@@ -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,65 @@
|
||||
/**
|
||||
* 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.core.shared.GWT;
|
||||
import com.vaadin.client.renderers.ClickableRenderer;
|
||||
import com.vaadin.client.ui.VButton;
|
||||
import com.vaadin.client.widget.grid.RendererCellReference;
|
||||
|
||||
/**
|
||||
* Renders button with provided CustomObject.
|
||||
* Used to display button with link.
|
||||
*
|
||||
*/
|
||||
public class RolloutRenderer extends ClickableRenderer<RolloutRendererData, 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, RolloutRendererData 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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* 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 java.io.Serializable;
|
||||
|
||||
/**
|
||||
* RendererData class with Name and Status.
|
||||
*
|
||||
*/
|
||||
|
||||
public class RolloutRendererData implements Serializable {
|
||||
private static final long serialVersionUID = -5018181529953620263L;
|
||||
|
||||
private String name;
|
||||
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* Initialize the RendererData.
|
||||
*/
|
||||
public RolloutRendererData() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the RendererData.
|
||||
*
|
||||
* @param name
|
||||
* Name of the Rollout.
|
||||
* @param status
|
||||
* Status of Rollout.
|
||||
*/
|
||||
public RolloutRendererData(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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* 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 org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
|
||||
|
||||
import com.vaadin.ui.renderers.ClickableRenderer;
|
||||
|
||||
import elemental.json.JsonValue;
|
||||
|
||||
/**
|
||||
* Renders button with provided CustomObject.
|
||||
* Used to display button with link.
|
||||
*
|
||||
*/
|
||||
|
||||
public class RolloutRenderer extends ClickableRenderer<RolloutRendererData> {
|
||||
|
||||
private static final long serialVersionUID = -8754180585906263554L;
|
||||
|
||||
/**
|
||||
* Creates a new custom object renderer.
|
||||
*/
|
||||
public RolloutRenderer() {
|
||||
super(RolloutRendererData.class, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize custom object renderer with {@link Class<CustomObject>}
|
||||
*
|
||||
* @param presentationType
|
||||
* Class<CustomObject>
|
||||
*/
|
||||
|
||||
public RolloutRenderer(Class<RolloutRendererData> presentationType) {
|
||||
super(presentationType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new custom object renderer and adds the given click listener to it.
|
||||
*
|
||||
* @param listener
|
||||
* the click listener to register
|
||||
*/
|
||||
public RolloutRenderer(RendererClickListener listener) {
|
||||
this();
|
||||
addClickListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonValue encode(RolloutRendererData resource) {
|
||||
return super.encode(resource, RolloutRendererData.class);
|
||||
}
|
||||
}
|
||||
@@ -9,122 +9,133 @@
|
||||
package org.eclipse.hawkbit.ui.rollout.rollout;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
|
||||
|
||||
import com.vaadin.server.FontAwesome;
|
||||
|
||||
/**
|
||||
* Proxy rollout with suctome properties.
|
||||
* Proxy rollout with custom properties.
|
||||
*
|
||||
*/
|
||||
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 RolloutRendererData rendererData;
|
||||
|
||||
/**
|
||||
* @return the numberOfGroups
|
||||
*/
|
||||
public Long getNumberOfGroups() {
|
||||
return numberOfGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param numberOfGroups
|
||||
* the numberOfGroups to set
|
||||
*/
|
||||
public void setNumberOfGroups(final Long numberOfGroups) {
|
||||
this.numberOfGroups = numberOfGroups;
|
||||
}
|
||||
public RolloutRendererData getRendererData() {
|
||||
return rendererData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the createdDate
|
||||
*/
|
||||
public String getCreatedDate() {
|
||||
return createdDate;
|
||||
}
|
||||
public void setRendererData(RolloutRendererData rendererData) {
|
||||
this.rendererData = rendererData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param createdDate
|
||||
* the createdDate to set
|
||||
*/
|
||||
public void setCreatedDate(final String createdDate) {
|
||||
this.createdDate = createdDate;
|
||||
}
|
||||
/**
|
||||
* @return the distributionSetNameVersion
|
||||
*/
|
||||
public String getDistributionSetNameVersion() {
|
||||
return distributionSetNameVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the modifiedDate
|
||||
*/
|
||||
public String getModifiedDate() {
|
||||
return modifiedDate;
|
||||
}
|
||||
/**
|
||||
* @param distributionSetNameVersion
|
||||
* the distributionSetNameVersion to set
|
||||
*/
|
||||
public void setDistributionSetNameVersion(final String distributionSetNameVersion) {
|
||||
this.distributionSetNameVersion = distributionSetNameVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param modifiedDate
|
||||
* the modifiedDate to set
|
||||
*/
|
||||
public void setModifiedDate(final String modifiedDate) {
|
||||
this.modifiedDate = modifiedDate;
|
||||
}
|
||||
/**
|
||||
* @return the numberOfGroups
|
||||
*/
|
||||
public Long getNumberOfGroups() {
|
||||
return numberOfGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the isActionRecieved
|
||||
*/
|
||||
public Boolean getIsActionRecieved() {
|
||||
return isActionRecieved;
|
||||
}
|
||||
/**
|
||||
* @param numberOfGroups
|
||||
* the numberOfGroups to set
|
||||
*/
|
||||
public void setNumberOfGroups(final Long numberOfGroups) {
|
||||
this.numberOfGroups = numberOfGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isActionRecieved
|
||||
* the isActionRecieved to set
|
||||
*/
|
||||
public void setIsActionRecieved(final Boolean isActionRecieved) {
|
||||
this.isActionRecieved = isActionRecieved;
|
||||
}
|
||||
/**
|
||||
* @return the createdDate
|
||||
*/
|
||||
public String getCreatedDate() {
|
||||
return createdDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the totalTargetsCount
|
||||
*/
|
||||
public String getTotalTargetsCount() {
|
||||
return totalTargetsCount;
|
||||
}
|
||||
/**
|
||||
* @param createdDate
|
||||
* the createdDate to set
|
||||
*/
|
||||
public void setCreatedDate(final String createdDate) {
|
||||
this.createdDate = createdDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.RolloutRendererData;
|
||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||
@@ -39,163 +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());
|
||||
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 RolloutRendererData(rollout.getName(), rollout.getStatus().toString()));
|
||||
|
||||
final TotalTargetCountStatus totalTargetCountActionStatus = rollout.getTotalTargetCountStatus();
|
||||
proxyRollout.setTotalTargetCountStatus(totalTargetCountActionStatus);
|
||||
proxyRollout.setTotalTargetsCount(String.valueOf(rollout.getTotalTargets()));
|
||||
|
||||
proxyRolloutList.add(proxyRollout);
|
||||
}
|
||||
return proxyRolloutList;
|
||||
}
|
||||
final TotalTargetCountStatus totalTargetCountActionStatus = rollout.getTotalTargetCountStatus();
|
||||
proxyRollout.setTotalTargetCountStatus(totalTargetCountActionStatus);
|
||||
proxyRollout.setTotalTargetsCount(String.valueOf(rollout.getTotalTargets()));
|
||||
|
||||
/*
|
||||
* (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
|
||||
*/
|
||||
}
|
||||
proxyRolloutList.add(proxyRollout);
|
||||
}
|
||||
return proxyRolloutList;
|
||||
}
|
||||
|
||||
/*
|
||||
* (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;
|
||||
}
|
||||
/*
|
||||
* (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 rolloutManagement
|
||||
*/
|
||||
public RolloutManagement getRolloutManagement() {
|
||||
if (null == rolloutManagement) {
|
||||
rolloutManagement = SpringContextHelper.getBean(RolloutManagement.class);
|
||||
}
|
||||
return rolloutManagement;
|
||||
}
|
||||
/*
|
||||
* (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 filterQueryManagement
|
||||
*/
|
||||
public TargetFilterQueryManagement getFilterQueryManagement() {
|
||||
if (null == filterQueryManagement) {
|
||||
filterQueryManagement = SpringContextHelper.getBean(TargetFilterQueryManagement.class);
|
||||
}
|
||||
return filterQueryManagement;
|
||||
}
|
||||
/**
|
||||
* @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 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,200 +9,211 @@
|
||||
package org.eclipse.hawkbit.ui.rollout.rolloutgroup;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
|
||||
|
||||
/**
|
||||
* Proxy rollout group with suctome properties.
|
||||
* Proxy rollout group with renderer properties.
|
||||
*
|
||||
*/
|
||||
public class ProxyRolloutGroup extends RolloutGroup {
|
||||
|
||||
private static final long serialVersionUID = -2745056813306692356L;
|
||||
private static final long serialVersionUID = -2745056813306692356L;
|
||||
|
||||
private String createdDate;
|
||||
private String createdDate;
|
||||
|
||||
private String modifiedDate;
|
||||
private String modifiedDate;
|
||||
|
||||
private String finishedPercentage;
|
||||
private String finishedPercentage;
|
||||
|
||||
private Long runningTargetsCount;
|
||||
private Long runningTargetsCount;
|
||||
|
||||
private Long scheduledTargetsCount;
|
||||
private Long scheduledTargetsCount;
|
||||
|
||||
private Long cancelledTargetsCount;
|
||||
private Long cancelledTargetsCount;
|
||||
|
||||
private Long errorTargetsCount;
|
||||
private Long errorTargetsCount;
|
||||
|
||||
private Long finishedTargetsCount;
|
||||
private Long finishedTargetsCount;
|
||||
|
||||
private Long notStartedTargetsCount;
|
||||
private Long notStartedTargetsCount;
|
||||
|
||||
private Boolean isActionRecieved = Boolean.FALSE;
|
||||
private Boolean isActionRecieved = Boolean.FALSE;
|
||||
|
||||
private String totalTargetsCount;
|
||||
private String totalTargetsCount;
|
||||
|
||||
/**
|
||||
* @return the createdDate
|
||||
*/
|
||||
public String getCreatedDate() {
|
||||
return createdDate;
|
||||
}
|
||||
private RolloutRendererData rendererData;
|
||||
|
||||
/**
|
||||
* @param createdDate
|
||||
* the createdDate to set
|
||||
*/
|
||||
public void setCreatedDate(final String createdDate) {
|
||||
this.createdDate = createdDate;
|
||||
}
|
||||
public RolloutRendererData getRendererData() {
|
||||
return rendererData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the modifiedDate
|
||||
*/
|
||||
public String getModifiedDate() {
|
||||
return modifiedDate;
|
||||
}
|
||||
public void setRendererData(RolloutRendererData rendererData) {
|
||||
this.rendererData = rendererData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param modifiedDate
|
||||
* the modifiedDate to set
|
||||
*/
|
||||
public void setModifiedDate(final String modifiedDate) {
|
||||
this.modifiedDate = modifiedDate;
|
||||
}
|
||||
/**
|
||||
* @return the createdDate
|
||||
*/
|
||||
public String getCreatedDate() {
|
||||
return createdDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the finishedPercentage
|
||||
*/
|
||||
public String getFinishedPercentage() {
|
||||
return finishedPercentage;
|
||||
}
|
||||
/**
|
||||
* @param createdDate
|
||||
* the createdDate to set
|
||||
*/
|
||||
public void setCreatedDate(final String createdDate) {
|
||||
this.createdDate = createdDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param finishedPercentage
|
||||
* the finishedPercentage to set
|
||||
*/
|
||||
public void setFinishedPercentage(final String finishedPercentage) {
|
||||
this.finishedPercentage = finishedPercentage;
|
||||
}
|
||||
/**
|
||||
* @return the modifiedDate
|
||||
*/
|
||||
public String getModifiedDate() {
|
||||
return modifiedDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the runningTargetsCount
|
||||
*/
|
||||
public Long getRunningTargetsCount() {
|
||||
return runningTargetsCount;
|
||||
}
|
||||
/**
|
||||
* @param modifiedDate
|
||||
* the modifiedDate to set
|
||||
*/
|
||||
public void setModifiedDate(final String modifiedDate) {
|
||||
this.modifiedDate = modifiedDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param runningTargetsCount
|
||||
* the runningTargetsCount to set
|
||||
*/
|
||||
public void setRunningTargetsCount(final Long runningTargetsCount) {
|
||||
this.runningTargetsCount = runningTargetsCount;
|
||||
}
|
||||
/**
|
||||
* @return the finishedPercentage
|
||||
*/
|
||||
public String getFinishedPercentage() {
|
||||
return finishedPercentage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the scheduledTargetsCount
|
||||
*/
|
||||
public Long getScheduledTargetsCount() {
|
||||
return scheduledTargetsCount;
|
||||
}
|
||||
/**
|
||||
* @param finishedPercentage
|
||||
* the finishedPercentage to set
|
||||
*/
|
||||
public void setFinishedPercentage(final String finishedPercentage) {
|
||||
this.finishedPercentage = finishedPercentage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param scheduledTargetsCount
|
||||
* the scheduledTargetsCount to set
|
||||
*/
|
||||
public void setScheduledTargetsCount(final Long scheduledTargetsCount) {
|
||||
this.scheduledTargetsCount = scheduledTargetsCount;
|
||||
}
|
||||
/**
|
||||
* @return the runningTargetsCount
|
||||
*/
|
||||
public Long getRunningTargetsCount() {
|
||||
return runningTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cancelledTargetsCount
|
||||
*/
|
||||
public Long getCancelledTargetsCount() {
|
||||
return cancelledTargetsCount;
|
||||
}
|
||||
/**
|
||||
* @param runningTargetsCount
|
||||
* the runningTargetsCount to set
|
||||
*/
|
||||
public void setRunningTargetsCount(final Long runningTargetsCount) {
|
||||
this.runningTargetsCount = runningTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cancelledTargetsCount
|
||||
* the cancelledTargetsCount to set
|
||||
*/
|
||||
public void setCancelledTargetsCount(final Long cancelledTargetsCount) {
|
||||
this.cancelledTargetsCount = cancelledTargetsCount;
|
||||
}
|
||||
/**
|
||||
* @return the scheduledTargetsCount
|
||||
*/
|
||||
public Long getScheduledTargetsCount() {
|
||||
return scheduledTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the errorTargetsCount
|
||||
*/
|
||||
public Long getErrorTargetsCount() {
|
||||
return errorTargetsCount;
|
||||
}
|
||||
/**
|
||||
* @param scheduledTargetsCount
|
||||
* the scheduledTargetsCount to set
|
||||
*/
|
||||
public void setScheduledTargetsCount(final Long scheduledTargetsCount) {
|
||||
this.scheduledTargetsCount = scheduledTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param errorTargetsCount
|
||||
* the errorTargetsCount to set
|
||||
*/
|
||||
public void setErrorTargetsCount(final Long errorTargetsCount) {
|
||||
this.errorTargetsCount = errorTargetsCount;
|
||||
}
|
||||
/**
|
||||
* @return the cancelledTargetsCount
|
||||
*/
|
||||
public Long getCancelledTargetsCount() {
|
||||
return cancelledTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the finishedTargetsCount
|
||||
*/
|
||||
public Long getFinishedTargetsCount() {
|
||||
return finishedTargetsCount;
|
||||
}
|
||||
/**
|
||||
* @param cancelledTargetsCount
|
||||
* the cancelledTargetsCount to set
|
||||
*/
|
||||
public void setCancelledTargetsCount(final Long cancelledTargetsCount) {
|
||||
this.cancelledTargetsCount = cancelledTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param finishedTargetsCount
|
||||
* the finishedTargetsCount to set
|
||||
*/
|
||||
public void setFinishedTargetsCount(final Long finishedTargetsCount) {
|
||||
this.finishedTargetsCount = finishedTargetsCount;
|
||||
}
|
||||
/**
|
||||
* @return the errorTargetsCount
|
||||
*/
|
||||
public Long getErrorTargetsCount() {
|
||||
return errorTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the notStartedTargetsCount
|
||||
*/
|
||||
public Long getNotStartedTargetsCount() {
|
||||
return notStartedTargetsCount;
|
||||
}
|
||||
/**
|
||||
* @param errorTargetsCount
|
||||
* the errorTargetsCount to set
|
||||
*/
|
||||
public void setErrorTargetsCount(final Long errorTargetsCount) {
|
||||
this.errorTargetsCount = errorTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param notStartedTargetsCount
|
||||
* the notStartedTargetsCount to set
|
||||
*/
|
||||
public void setNotStartedTargetsCount(final Long notStartedTargetsCount) {
|
||||
this.notStartedTargetsCount = notStartedTargetsCount;
|
||||
}
|
||||
/**
|
||||
* @return the finishedTargetsCount
|
||||
*/
|
||||
public Long getFinishedTargetsCount() {
|
||||
return finishedTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the isActionRecieved
|
||||
*/
|
||||
public Boolean getIsActionRecieved() {
|
||||
return isActionRecieved;
|
||||
}
|
||||
/**
|
||||
* @param finishedTargetsCount
|
||||
* the finishedTargetsCount to set
|
||||
*/
|
||||
public void setFinishedTargetsCount(final Long finishedTargetsCount) {
|
||||
this.finishedTargetsCount = finishedTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isActionRecieved
|
||||
* the isActionRecieved to set
|
||||
*/
|
||||
public void setIsActionRecieved(final Boolean isActionRecieved) {
|
||||
this.isActionRecieved = isActionRecieved;
|
||||
}
|
||||
/**
|
||||
* @return the notStartedTargetsCount
|
||||
*/
|
||||
public Long getNotStartedTargetsCount() {
|
||||
return notStartedTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the totalTargetsCount
|
||||
*/
|
||||
public String getTotalTargetsCount() {
|
||||
return totalTargetsCount;
|
||||
}
|
||||
/**
|
||||
* @param notStartedTargetsCount
|
||||
* the notStartedTargetsCount to set
|
||||
*/
|
||||
public void setNotStartedTargetsCount(final Long notStartedTargetsCount) {
|
||||
this.notStartedTargetsCount = notStartedTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param totalTargetsCount
|
||||
* the totalTargetsCount to set
|
||||
*/
|
||||
public void setTotalTargetsCount(final String totalTargetsCount) {
|
||||
this.totalTargetsCount = totalTargetsCount;
|
||||
}
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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.RolloutRendererData;
|
||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||
@@ -34,158 +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));
|
||||
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 RolloutRendererData(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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,13 +17,16 @@ import java.util.Map;
|
||||
|
||||
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.RolloutRendererData;
|
||||
import org.eclipse.hawkbit.ui.customrenderers.renderers.RolloutRenderer;
|
||||
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;
|
||||
@@ -57,315 +60,329 @@ 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 transient RolloutGroupManagement rolloutGroupManagement;
|
||||
private static final String customObject = "customObject";
|
||||
|
||||
@Autowired
|
||||
private transient RolloutUIState rolloutUIState;
|
||||
@Autowired
|
||||
private transient RolloutGroupManagement rolloutGroupManagement;
|
||||
|
||||
@Autowired
|
||||
private transient SpPermissionChecker permissionChecker;
|
||||
@Autowired
|
||||
private transient RolloutManagement rolloutManagement;
|
||||
|
||||
private transient Map<RolloutGroupStatus, StatusFontIcon> statusIconMap = new EnumMap<>(RolloutGroupStatus.class);
|
||||
@Autowired
|
||||
private transient RolloutUIState rolloutUIState;
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final RolloutEvent event) {
|
||||
if (RolloutEvent.SHOW_ROLLOUT_GROUPS != event) {
|
||||
return;
|
||||
}
|
||||
((LazyQueryContainer) getContainerDataSource()).refresh();
|
||||
}
|
||||
@Autowired
|
||||
private transient SpPermissionChecker permissionChecker;
|
||||
|
||||
/**
|
||||
*
|
||||
* 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());
|
||||
}
|
||||
private transient Map<RolloutGroupStatus, StatusFontIcon> statusIconMap = new EnumMap<>(RolloutGroupStatus.class);
|
||||
|
||||
@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;
|
||||
}
|
||||
((LazyQueryContainer) getContainerDataSource()).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 = (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());
|
||||
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 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 = (LazyQueryContainer) getContainerDataSource();
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, "", false, false);
|
||||
|
||||
}
|
||||
rolloutGroupGridContainer.addContainerProperty(customObject, RolloutRendererData.class, null, 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);
|
||||
|
||||
@Override
|
||||
protected void setColumnExpandRatio() {
|
||||
getColumn(SPUILabelDefinitions.VAR_NAME).setMinimumWidth(40);
|
||||
getColumn(SPUILabelDefinitions.VAR_NAME).setMaximumWidth(200);
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD, String.class, null,
|
||||
false, false);
|
||||
|
||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setMinimumWidth(40);
|
||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setMaximumWidth(100);
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, String.class, null, false,
|
||||
false);
|
||||
|
||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setMinimumWidth(75);
|
||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setMaximumWidth(75);
|
||||
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);
|
||||
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE).setMinimumWidth(40);
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE).setMaximumWidth(100);
|
||||
}
|
||||
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD).setMinimumWidth(40);
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD).setMaximumWidth(100);
|
||||
@Override
|
||||
protected void setColumnExpandRatio() {
|
||||
getColumn(customObject).setMinimumWidth(40);
|
||||
getColumn(customObject).setMaximumWidth(200);
|
||||
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD).setMinimumWidth(40);
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD).setMaximumWidth(100);
|
||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setMinimumWidth(40);
|
||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setMaximumWidth(100);
|
||||
|
||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setMinimumWidth(280);
|
||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setMinimumWidth(75);
|
||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setMaximumWidth(75);
|
||||
|
||||
setFrozenColumnCount(7);
|
||||
}
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE).setMinimumWidth(40);
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE).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.ROLLOUT_GROUP_ERROR_THRESHOLD).setMinimumWidth(40);
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD).setMaximumWidth(100);
|
||||
|
||||
@Override
|
||||
protected String getGridId() {
|
||||
return SPUIComponetIdProvider.ROLLOUT_GROUP_LIST_GRID_ID;
|
||||
}
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD).setMinimumWidth(40);
|
||||
getColumn(SPUILabelDefinitions.ROLLOUT_GROUP_THRESHOLD).setMaximumWidth(100);
|
||||
|
||||
@Override
|
||||
protected void setColumnProperties() {
|
||||
final 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();
|
||||
}
|
||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setMinimumWidth(280);
|
||||
|
||||
@Override
|
||||
protected void addColumnRenderes() {
|
||||
createRolloutGroupStatusToFontMap();
|
||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setRenderer(new HtmlLabelRenderer(),
|
||||
new RolloutGroupStatusConverter());
|
||||
setFrozenColumnCount(7);
|
||||
}
|
||||
|
||||
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 void setColumnHeaderNames() {
|
||||
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 setHiddenColumns() {
|
||||
final 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 (final Object propertyId : columnsToBeHidden) {
|
||||
getColumn(propertyId).setHidden(true);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected String getGridId() {
|
||||
return SPUIComponetIdProvider.ROLLOUT_GROUP_LIST_GRID_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CellDescriptionGenerator getDescriptionGenerator() {
|
||||
return cell -> getDescription(cell);
|
||||
}
|
||||
@Override
|
||||
protected void setColumnProperties() {
|
||||
final List<Object> columnList = new ArrayList<>();
|
||||
columnList.add(customObject);
|
||||
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();
|
||||
}
|
||||
|
||||
private void onClickOfRolloutGroupName(final RendererClickEvent event) {
|
||||
rolloutUIState
|
||||
.setRolloutGroup(rolloutGroupManagement.findRolloutGroupWithDetailedStatus((Long) event.getItemId()));
|
||||
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS);
|
||||
}
|
||||
@Override
|
||||
protected void addColumnRenderes() {
|
||||
createRolloutGroupStatusToFontMap();
|
||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setRenderer(new HtmlLabelRenderer(),
|
||||
new RolloutGroupStatusConverter());
|
||||
|
||||
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));
|
||||
}
|
||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setRenderer(new HtmlRenderer(),
|
||||
new TotalTargetCountStatusConverter());
|
||||
if (permissionChecker.hasRolloutTargetsReadPermission()) {
|
||||
getColumn(customObject).setRenderer(new RolloutRenderer(event -> onClickOfRolloutGroupName(event)));
|
||||
}
|
||||
}
|
||||
|
||||
private String getDescription(final 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;
|
||||
}
|
||||
@Override
|
||||
protected void setHiddenColumns() {
|
||||
final 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 (final Object propertyId : columnsToBeHidden) {
|
||||
getColumn(propertyId).setHidden(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void alignColumns() {
|
||||
setCellStyleGenerator(new CellStyleGenerator() {
|
||||
private static final long serialVersionUID = 5573570647129792429L;
|
||||
@Override
|
||||
protected CellDescriptionGenerator getDescriptionGenerator() {
|
||||
return cell -> getDescription(cell);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStyle(final CellReference cellReference) {
|
||||
final String[] coulmnNames = { SPUILabelDefinitions.VAR_STATUS,
|
||||
SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS };
|
||||
if (Arrays.asList(coulmnNames).contains(cellReference.getPropertyId())) {
|
||||
return "centeralign";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
private void onClickOfRolloutGroupName(final RendererClickEvent event) {
|
||||
rolloutUIState
|
||||
.setRolloutGroup(rolloutGroupManagement.findRolloutGroupWithDetailedStatus((Long) event.getItemId()));
|
||||
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 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(final 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 ((RolloutRendererData) cell.getProperty().getValue()).getName();
|
||||
} else if (SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS.equals(cell.getPropertyId())) {
|
||||
return DistributionBarHelper
|
||||
.getTooltip(((TotalTargetCountStatus) cell.getValue()).getStatusTotalCountMap());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TotalTargetCountStatus convertToModel(final String value,
|
||||
final Class<? extends TotalTargetCountStatus> targetType, final Locale locale)
|
||||
throws com.vaadin.data.util.converter.Converter.ConversionException {
|
||||
return null;
|
||||
}
|
||||
private void alignColumns() {
|
||||
setCellStyleGenerator(new CellStyleGenerator() {
|
||||
private static final long serialVersionUID = 5573570647129792429L;
|
||||
|
||||
@Override
|
||||
public String convertToPresentation(final TotalTargetCountStatus value,
|
||||
final Class<? extends String> targetType, final Locale locale)
|
||||
throws com.vaadin.data.util.converter.Converter.ConversionException {
|
||||
return DistributionBarHelper.getDistributionBarAsHTMLString(value.getStatusTotalCountMap());
|
||||
}
|
||||
@Override
|
||||
public String getStyle(final CellReference cellReference) {
|
||||
final 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<TotalTargetCountStatus> getModelType() {
|
||||
return TotalTargetCountStatus.class;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Converts {@link TotalTargetCountStatus} into formatted string with status
|
||||
* and count details.
|
||||
*
|
||||
*/
|
||||
class TotalTargetCountStatusConverter implements Converter<String, TotalTargetCountStatus> {
|
||||
|
||||
@Override
|
||||
public Class<String> getPresentationType() {
|
||||
return String.class;
|
||||
}
|
||||
}
|
||||
private static final long serialVersionUID = -9205943894818450807L;
|
||||
|
||||
/**
|
||||
*
|
||||
* Converts {@link RolloutGroupStatus} to string.
|
||||
*
|
||||
*/
|
||||
class RolloutGroupStatusConverter implements Converter<String, RolloutGroupStatus> {
|
||||
@Override
|
||||
public TotalTargetCountStatus convertToModel(final String value,
|
||||
final Class<? extends TotalTargetCountStatus> targetType, final Locale locale)
|
||||
throws com.vaadin.data.util.converter.Converter.ConversionException {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 5448062736373292820L;
|
||||
@Override
|
||||
public String convertToPresentation(final TotalTargetCountStatus value,
|
||||
final Class<? extends String> targetType, final Locale locale)
|
||||
throws com.vaadin.data.util.converter.Converter.ConversionException {
|
||||
return DistributionBarHelper.getDistributionBarAsHTMLString(value.getStatusTotalCountMap());
|
||||
}
|
||||
|
||||
@Override
|
||||
public RolloutGroupStatus convertToModel(final String value,
|
||||
final Class<? extends RolloutGroupStatus> targetType, final Locale locale) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<TotalTargetCountStatus> getModelType() {
|
||||
return TotalTargetCountStatus.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String convertToPresentation(final RolloutGroupStatus value, final Class<? extends String> targetType,
|
||||
final Locale locale) {
|
||||
return convertRolloutGroupStatusToString(value);
|
||||
}
|
||||
@Override
|
||||
public Class<String> getPresentationType() {
|
||||
return String.class;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<RolloutGroupStatus> getModelType() {
|
||||
return RolloutGroupStatus.class;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Converts {@link RolloutGroupStatus} to string.
|
||||
*
|
||||
*/
|
||||
class RolloutGroupStatusConverter implements Converter<String, RolloutGroupStatus> {
|
||||
|
||||
@Override
|
||||
public Class<String> getPresentationType() {
|
||||
return String.class;
|
||||
}
|
||||
private static final long serialVersionUID = 5448062736373292820L;
|
||||
|
||||
private String convertRolloutGroupStatusToString(final RolloutGroupStatus value) {
|
||||
final StatusFontIcon statusFontIcon = statusIconMap.get(value);
|
||||
final String codePoint = HawkbitCommonUtil.getCodePoint(statusFontIcon);
|
||||
return HawkbitCommonUtil.getStatusLabelDetailsInString(codePoint, statusFontIcon.getStyle(),
|
||||
SPUIComponetIdProvider.ROLLOUT_GROUP_STATUS_LABEL_ID);
|
||||
@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;
|
||||
}
|
||||
|
||||
private String convertRolloutGroupStatusToString(final RolloutGroupStatus value) {
|
||||
final StatusFontIcon statusFontIcon = statusIconMap.get(value);
|
||||
final String codePoint = HawkbitCommonUtil.getCodePoint(statusFontIcon);
|
||||
return HawkbitCommonUtil.getStatusLabelDetailsInString(codePoint, statusFontIcon.getStyle(),
|
||||
SPUIComponetIdProvider.ROLLOUT_GROUP_STATUS_LABEL_ID);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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