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;
|
||||
|
||||
@@ -32,6 +33,16 @@ public class ProxyRollout extends Rollout {
|
||||
|
||||
private String totalTargetsCount;
|
||||
|
||||
private CustomObject customObject;
|
||||
|
||||
public CustomObject getCustomObject() {
|
||||
return customObject;
|
||||
}
|
||||
|
||||
public void setCustomObject(CustomObject customObject) {
|
||||
this.customObject = customObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the distributionSetNameVersion
|
||||
*/
|
||||
@@ -122,7 +133,6 @@ public class ProxyRollout extends Rollout {
|
||||
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,6 +131,7 @@ 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);
|
||||
|
||||
@@ -25,9 +25,10 @@ import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
|
||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||
import org.eclipse.hawkbit.ui.common.grid.AbstractGrid;
|
||||
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.CustomObject;
|
||||
import org.eclipse.hawkbit.ui.customrenderers.renderers.CustomObjectRenderer;
|
||||
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlButtonRenderer;
|
||||
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;
|
||||
@@ -58,6 +59,7 @@ import com.vaadin.server.AbstractClientConnector;
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.UI;
|
||||
import com.vaadin.ui.Window;
|
||||
import com.vaadin.ui.renderers.ClickableRenderer.RendererClickEvent;
|
||||
@@ -152,11 +154,20 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
}
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_STATUS).setValue(rollout.getStatus());
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setValue(totalTargetCountStatus);
|
||||
item.getItemProperty("customObject").setValue(new CustomObject(rollout.getName(), rollout.getStatus().toString()));
|
||||
final Long groupCount = (Long) item.getItemProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).getValue();
|
||||
if (rollout.getRolloutGroups() != null && groupCount != rollout.getRolloutGroups().size()) {
|
||||
/*if (rollout.getRolloutGroups() != null && groupCount != rollout.getRolloutGroups().size()) {
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS)
|
||||
.setValue(Long.valueOf(rollout.getRolloutGroups().size()));
|
||||
}*/
|
||||
final int groupsCreated = rollout.getRolloutGroupsCreated();
|
||||
if (groupsCreated != 0) {
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).setValue(Long.valueOf(groupsCreated));
|
||||
} else if (rollout.getRolloutGroups() != null && groupCount != rollout.getRolloutGroups().size()) {
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS)
|
||||
.setValue(Long.valueOf(rollout.getRolloutGroups().size()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -169,7 +180,16 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
@Override
|
||||
protected void addContainerProperties() {
|
||||
final LazyQueryContainer rolloutGridContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, "", false, false);
|
||||
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, null, false, false);
|
||||
// rolloutGridContainer.addContainerProperty("yes", Boolean.class, null,
|
||||
// false, false);
|
||||
// rolloutGridContainer.addContainerProperty("custom",
|
||||
// CustomValue.class,
|
||||
// null, false, false);
|
||||
// rolloutGridContainer.addContainerProperty("buttonText", String.class,
|
||||
// "", false, false);
|
||||
|
||||
rolloutGridContainer.addContainerProperty("customObject", CustomObject.class, null, false, false);
|
||||
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, null, false, false);
|
||||
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_STATUS, RolloutStatus.class, null, false,
|
||||
false);
|
||||
@@ -184,7 +204,7 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
false);
|
||||
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_BY, String.class, null, false,
|
||||
false);
|
||||
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS, Integer.class, 0, false,
|
||||
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS, Long.class, 0, false,
|
||||
false);
|
||||
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS, String.class, "0", false,
|
||||
false);
|
||||
@@ -198,8 +218,8 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
|
||||
@Override
|
||||
protected void setColumnExpandRatio() {
|
||||
getColumn(SPUILabelDefinitions.VAR_NAME).setMinimumWidth(40);
|
||||
getColumn(SPUILabelDefinitions.VAR_NAME).setMaximumWidth(150);
|
||||
getColumn("customObject").setMinimumWidth(40);
|
||||
getColumn("customObject").setMaximumWidth(150);
|
||||
|
||||
getColumn(SPUILabelDefinitions.VAR_DIST_NAME_VERSION).setMinimumWidth(40);
|
||||
getColumn(SPUILabelDefinitions.VAR_DIST_NAME_VERSION).setMaximumWidth(150);
|
||||
@@ -223,7 +243,8 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
|
||||
@Override
|
||||
protected void setColumnHeaderNames() {
|
||||
getColumn(SPUILabelDefinitions.VAR_NAME).setHeaderCaption(i18n.get("header.name"));
|
||||
// getColumn(SPUILabelDefinitions.VAR_NAME).setHeaderCaption("name");
|
||||
getColumn("customObject").setHeaderCaption("Name");
|
||||
getColumn(SPUILabelDefinitions.VAR_DIST_NAME_VERSION).setHeaderCaption(i18n.get("header.distributionset"));
|
||||
getColumn(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).setHeaderCaption(i18n.get("header.numberofgroups"));
|
||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setHeaderCaption(i18n.get("header.total.targets"));
|
||||
@@ -246,7 +267,9 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
@Override
|
||||
protected void setColumnProperties() {
|
||||
List<Object> columnList = new ArrayList<>();
|
||||
columnList.add(SPUILabelDefinitions.VAR_NAME);
|
||||
// columnList.add("yes");
|
||||
columnList.add("customObject");
|
||||
// columnList.add(SPUILabelDefinitions.VAR_NAME);
|
||||
columnList.add(SPUILabelDefinitions.VAR_DIST_NAME_VERSION);
|
||||
columnList.add(SPUILabelDefinitions.VAR_STATUS);
|
||||
columnList.add(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS);
|
||||
@@ -266,6 +289,7 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
@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);
|
||||
@@ -284,6 +308,8 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
|
||||
@Override
|
||||
protected void addColumnRenderes() {
|
||||
getColumn(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).setRenderer(new HtmlRenderer(),
|
||||
new TotalTargetGroupsConverter());
|
||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setRenderer(new HtmlRenderer(),
|
||||
new TotalTargetCountStatusConverter());
|
||||
|
||||
@@ -291,7 +317,19 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setRenderer(new HtmlLabelRenderer(), new RolloutStatusConverter());
|
||||
|
||||
getColumn(SPUILabelDefinitions.ACTION).setRenderer(new HtmlButtonRenderer(event -> onClickOfActionBtn(event)));
|
||||
getColumn(SPUILabelDefinitions.VAR_NAME).setRenderer(new LinkRenderer(event -> onClickOfRolloutName(event)));
|
||||
|
||||
///////////////
|
||||
// getColumn("customObject").setRenderer(new CustomObjectRenderer(event
|
||||
// -> onClickOfRolloutName(event)));
|
||||
CustomObjectRenderer cor = new CustomObjectRenderer(CustomObject.class);
|
||||
cor.addClickListener(event -> onClickOfRolloutName(event));
|
||||
getColumn("customObject").setRenderer(cor);
|
||||
|
||||
///////////////////////
|
||||
|
||||
// getColumn("custom").setRenderer(new CheckboxRenderer());
|
||||
// getColumn("buttonText").setRenderer(new
|
||||
// MyButtonRenderer(event->x()));
|
||||
}
|
||||
|
||||
private void createRolloutStatusToFontMap() {
|
||||
@@ -329,9 +367,11 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
|
||||
private void onClickOfRolloutName(RendererClickEvent event) {
|
||||
rolloutUIState.setRolloutId((long) event.getItemId());
|
||||
final String rolloutName = (String) getContainerDataSource().getItem(event.getItemId())
|
||||
.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();
|
||||
rolloutUIState.setRolloutName(rolloutName);
|
||||
|
||||
// final String rolloutName =
|
||||
CustomObject customObject = (CustomObject) getContainerDataSource().getItem(event.getItemId())
|
||||
.getItemProperty("customObject").getValue();
|
||||
rolloutUIState.setRolloutName(customObject.getName());
|
||||
String ds = (String) getContainerDataSource().getItem(event.getItemId())
|
||||
.getItemProperty(SPUILabelDefinitions.VAR_DIST_NAME_VERSION).getValue();
|
||||
rolloutUIState.setRolloutDistributionSet(ds);
|
||||
@@ -377,7 +417,6 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
return context;
|
||||
}
|
||||
|
||||
|
||||
private void getUpdateMenuItem(final ContextMenu context, final Long rolloutId) {
|
||||
// Add 'Update' option only if user has update permission
|
||||
if (!permissionChecker.hasRolloutUpdatePermission()) {
|
||||
@@ -461,8 +500,8 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
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 ("customObject".equals(cell.getPropertyId())) {
|
||||
return ((CustomObject) cell.getProperty().getValue()).getName();
|
||||
} else if (SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS.equals(cell.getPropertyId())) {
|
||||
return DistributionBarHelper
|
||||
.getTooltip(((TotalTargetCountStatus) cell.getValue()).getStatusTotalCountMap());
|
||||
@@ -592,4 +631,41 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Converter to convert 0 to empty , if total target groups is zero.
|
||||
*
|
||||
*/
|
||||
|
||||
class TotalTargetGroupsConverter implements Converter<String, Long> {
|
||||
|
||||
private static final long serialVersionUID = 6589305227035220369L;
|
||||
|
||||
@Override
|
||||
public Long convertToModel(String value, Class<? extends Long> targetType, Locale locale)
|
||||
throws com.vaadin.data.util.converter.Converter.ConversionException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String convertToPresentation(Long value, Class<? extends String> targetType, Locale locale)
|
||||
throws com.vaadin.data.util.converter.Converter.ConversionException {
|
||||
if (value == 0) {
|
||||
return "";
|
||||
}
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Long> getModelType() {
|
||||
return Long.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<String> getPresentationType() {
|
||||
return String.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -40,6 +41,16 @@ public class ProxyRolloutGroup extends RolloutGroup {
|
||||
|
||||
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;
|
||||
@@ -122,6 +123,8 @@ public class RolloutGroupBeanQuery extends AbstractBeanQuery<ProxyRolloutGroup>
|
||||
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;
|
||||
@@ -73,6 +76,9 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
@Autowired
|
||||
private transient RolloutGroupManagement rolloutGroupManagement;
|
||||
|
||||
@Autowired
|
||||
private transient RolloutManagement rolloutManagement;
|
||||
|
||||
@Autowired
|
||||
private transient RolloutUIState rolloutUIState;
|
||||
|
||||
@@ -81,6 +87,8 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
|
||||
private transient Map<RolloutGroupStatus, StatusFontIcon> statusIconMap = new EnumMap<>(RolloutGroupStatus.class);
|
||||
|
||||
private final String name = "name";
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
@@ -98,7 +106,7 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
if (RolloutEvent.SHOW_ROLLOUT_GROUPS != event) {
|
||||
return;
|
||||
}
|
||||
((LazyQueryContainer) getContainerDataSource()).refresh();
|
||||
getLazyQueryContainer().refresh();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,7 +126,7 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
}
|
||||
final RolloutGroup rolloutGroup = rolloutGroupManagement
|
||||
.findRolloutGroupWithDetailedStatus(rolloutGroupChangeEvent.getRolloutGroupId());
|
||||
final LazyQueryContainer rolloutContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
final LazyQueryContainer rolloutContainer = getLazyQueryContainer();
|
||||
final Item item = rolloutContainer.getItem(rolloutGroup.getId());
|
||||
if (item == null) {
|
||||
return;
|
||||
@@ -126,18 +134,26 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
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));
|
||||
}
|
||||
|
||||
private String calculateFinishedPercentage(final RolloutGroup rolloutGroup) {
|
||||
return HawkbitCommonUtil.formattingFinishedPercentage(rolloutGroup,
|
||||
rolloutManagement.getFinishedPercentForRunningGroup(rolloutGroup.getRollout().getId(), rolloutGroup));
|
||||
}
|
||||
|
||||
@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);
|
||||
return new GeneratedPropertyContainer(new LazyQueryContainer(
|
||||
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_ID), rolloutQf));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addContainerProperties() {
|
||||
final LazyQueryContainer rolloutGroupGridContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
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,
|
||||
@@ -163,13 +179,35 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
false);
|
||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS,
|
||||
TotalTargetCountStatus.class, null, false, false);
|
||||
|
||||
// addGeneratedProperties();
|
||||
}
|
||||
|
||||
/*
|
||||
* 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; // } // });
|
||||
*
|
||||
* }
|
||||
*/
|
||||
|
||||
@Override
|
||||
protected void setColumnExpandRatio() {
|
||||
getColumn(SPUILabelDefinitions.VAR_NAME).setMinimumWidth(40);
|
||||
getColumn(SPUILabelDefinitions.VAR_NAME).setMaximumWidth(200);
|
||||
/*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);
|
||||
@@ -193,7 +231,8 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
|
||||
@Override
|
||||
protected void setColumnHeaderNames() {
|
||||
getColumn(SPUILabelDefinitions.VAR_NAME).setHeaderCaption(i18n.get("header.name"));
|
||||
//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"));
|
||||
@@ -219,7 +258,8 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
@Override
|
||||
protected void setColumnProperties() {
|
||||
List<Object> columnList = new ArrayList<>();
|
||||
columnList.add(SPUILabelDefinitions.VAR_NAME);
|
||||
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);
|
||||
@@ -244,14 +284,21 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
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)));
|
||||
/*
|
||||
* 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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@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);
|
||||
@@ -303,8 +350,9 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
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 ("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());
|
||||
@@ -312,6 +360,14 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getNameToolTip(final String text) {
|
||||
String[] nameList = text.split(":");
|
||||
if (nameList[0].equalsIgnoreCase(name)) {
|
||||
return nameList[1];
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private void alignColumns() {
|
||||
setCellStyleGenerator(new CellStyleGenerator() {
|
||||
private static final long serialVersionUID = 5573570647129792429L;
|
||||
@@ -328,6 +384,10 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
});
|
||||
}
|
||||
|
||||
private LazyQueryContainer getLazyQueryContainer() {
|
||||
return ((LazyQueryContainer) (((GeneratedPropertyContainer) getContainerDataSource()).getWrappedContainer()));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Converts {@link TotalTargetCountStatus} into formatted string with status
|
||||
|
||||
@@ -19,12 +19,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.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;
|
||||
}
|
||||
@@ -33,6 +44,7 @@
|
||||
@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