diff --git a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/SimulationController.java b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/SimulationController.java index 426860d8b..649d88477 100644 --- a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/SimulationController.java +++ b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/SimulationController.java @@ -86,7 +86,10 @@ public class SimulationController { final String deviceId = name + i; repository.add(deviceFactory.createSimulatedDevice(deviceId, tenant, protocol, pollDelay, new URL(endpoint), gatewayToken)); - spSenderService.createOrUpdateThing(tenant, deviceId); + + if (protocol == Protocol.DMF_AMQP) { + spSenderService.createOrUpdateThing(tenant, deviceId); + } } return ResponseEntity.ok("Updated " + amount + " DMF connected targets!"); diff --git a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/SimulatorStartup.java b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/SimulatorStartup.java index 60f3055bd..b772bae1f 100644 --- a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/SimulatorStartup.java +++ b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/SimulatorStartup.java @@ -11,6 +11,7 @@ package org.eclipse.hawkbit.simulator; import java.net.MalformedURLException; import java.net.URL; +import org.eclipse.hawkbit.simulator.AbstractSimulatedDevice.Protocol; import org.eclipse.hawkbit.simulator.amqp.SpSenderService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -52,7 +53,9 @@ public class SimulatorStartup implements ApplicationListener +- Create launch configuration for the SuperDevMode + - The main class to execute should be com.google.gwt.dev.codeserver.CodeServer. + - Add fully-qualified class name of widgetset (org.eclipse.hawkbit.ui.AppWidgetSet) as parameter +- Enable debug in chrome + - Chrome inspector window ▸ Click on settings icon ▸ Scripts ▸ Enable source maps option +- Run the SuperDevMode Code Server with the launch configuration created above +- Open http://localhost:8080/UI/?debug .Click on "SuperDev" button in debug console (Alternatively can directly add ?superdevmode parameter to URL) +- Widgetset is compiled and you can see the java code files loaded in 'Chrome inspector window ▸ Source tab' + + +#### Using SuperDevMode with Eclipse : + +- Install the plugin from http://sdbg.github.io/p2 +- Start the server and Super Dev Mode as mentioned above +- Create a new launch configuration in Eclipse + - Type is "Launch Chrome" + - http://localhost:8080/UI/?superdevmode +- Launch the new configuration in debug mode +- Now breakpoints in eclipse can be set diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/client/LinkRendererConnector.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/client/LinkRendererConnector.java deleted file mode 100644 index bc48d64d7..000000000 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/client/LinkRendererConnector.java +++ /dev/null @@ -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(); - } -} diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/client/RolloutRendererConnector.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/client/RolloutRendererConnector.java new file mode 100644 index 000000000..2175dea29 --- /dev/null +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/client/RolloutRendererConnector.java @@ -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 { + 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 handler) { + return getRenderer().addClickHandler(handler); + } +} \ No newline at end of file diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/client/renderers/LinkRenderer.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/client/renderers/LinkRenderer.java deleted file mode 100644 index 0abe4044b..000000000 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/client/renderers/LinkRenderer.java +++ /dev/null @@ -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(); - } -} diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/client/renderers/RolloutRenderer.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/client/renderers/RolloutRenderer.java new file mode 100644 index 000000000..da8fc2544 --- /dev/null +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/client/renderers/RolloutRenderer.java @@ -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 { + + @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(); + } + +} \ No newline at end of file diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/client/renderers/RolloutRendererData.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/client/renderers/RolloutRendererData.java new file mode 100644 index 000000000..6c751e6a2 --- /dev/null +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/client/renderers/RolloutRendererData.java @@ -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; + } + +} diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/renderers/LinkRenderer.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/renderers/LinkRenderer.java deleted file mode 100644 index d913ca380..000000000 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/renderers/LinkRenderer.java +++ /dev/null @@ -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); - } -} diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/renderers/RolloutRenderer.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/renderers/RolloutRenderer.java new file mode 100644 index 000000000..29663dd9d --- /dev/null +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/renderers/RolloutRenderer.java @@ -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 { + + 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} + * + * @param presentationType + * Class + */ + + public RolloutRenderer(Class 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); + } +} diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/ProxyRollout.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/ProxyRollout.java index b1309f8b9..6514ba2df 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/ProxyRollout.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/ProxyRollout.java @@ -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 rolloutRendererData; - /** - * @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 getRolloutRendererData() { + return rolloutRendererData; + } - /** - * @return the createdDate - */ - public String getCreatedDate() { - return createdDate; - } + public void setRolloutRendererData(RolloutRendererData rendererData) { + this.rolloutRendererData = 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(); - } - } diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/RolloutBeanQuery.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/RolloutBeanQuery.java index 624f18b2f..a7a23a5c3 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/RolloutBeanQuery.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/RolloutBeanQuery.java @@ -18,6 +18,7 @@ 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.common.UserDetailsFormatter; +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; @@ -131,6 +132,8 @@ public class RolloutBeanQuery extends AbstractBeanQuery { proxyRollout.setForcedTime(rollout.getForcedTime()); proxyRollout.setId(rollout.getId()); proxyRollout.setStatus(rollout.getStatus()); + proxyRollout + .setRolloutRendererData(new RolloutRendererData(rollout.getName(), rollout.getStatus().toString())); final TotalTargetCountStatus totalTargetCountActionStatus = rollout.getTotalTargetCountStatus(); proxyRollout.setTotalTargetCountStatus(totalTargetCountActionStatus); diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/RolloutListGrid.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/RolloutListGrid.java index 9c3e1992b..1bb0fd831 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/RolloutListGrid.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/RolloutListGrid.java @@ -22,9 +22,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.RolloutRendererData; 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.customrenderers.renderers.RolloutRenderer; import org.eclipse.hawkbit.ui.rollout.DistributionBarHelper; import org.eclipse.hawkbit.ui.rollout.StatusFontIcon; import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent; @@ -77,6 +78,7 @@ public class RolloutListGrid extends AbstractGrid { private static final String START_OPTION = "Start"; + private static final String ROLLOUT_RENDERER_DATA = "rolloutRendererData"; @Autowired private transient RolloutManagement rolloutManagement; @@ -95,7 +97,10 @@ public class RolloutListGrid extends AbstractGrid { private transient Map statusIconMap = new EnumMap<>(RolloutStatus.class); - + /** + * Handles the RolloutEvent to refresh Grid. + * + */ @EventBusListenerMethod(scope = EventScope.SESSION) void onEvent(final RolloutEvent event) { switch (event) { @@ -132,10 +137,16 @@ public class RolloutListGrid extends AbstractGrid { item.getItemProperty(SPUILabelDefinitions.VAR_STATUS).setValue(rollout.getStatus()); item.getItemProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setValue(totalTargetCountStatus); final Long groupCount = (Long) item.getItemProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).getValue(); - if (rollout.getRolloutGroups() != null && groupCount != 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())); } + item.getItemProperty(ROLLOUT_RENDERER_DATA) + .setValue(new RolloutRendererData(rollout.getName(), rollout.getStatus().toString())); + } @Override @@ -149,6 +160,7 @@ public class RolloutListGrid extends AbstractGrid { protected void addContainerProperties() { final LazyQueryContainer rolloutGridContainer = (LazyQueryContainer) getContainerDataSource(); rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, "", false, false); + rolloutGridContainer.addContainerProperty(ROLLOUT_RENDERER_DATA, RolloutRendererData.class, null, false, false); rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, null, false, false); rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_STATUS, RolloutStatus.class, null, false, false); @@ -163,7 +175,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); @@ -177,8 +189,9 @@ public class RolloutListGrid extends AbstractGrid { @Override protected void setColumnExpandRatio() { - getColumn(SPUILabelDefinitions.VAR_NAME).setMinimumWidth(40); - getColumn(SPUILabelDefinitions.VAR_NAME).setMaximumWidth(150); + + getColumn(ROLLOUT_RENDERER_DATA).setMinimumWidth(40); + getColumn(ROLLOUT_RENDERER_DATA).setMaximumWidth(150); getColumn(SPUILabelDefinitions.VAR_DIST_NAME_VERSION).setMinimumWidth(40); getColumn(SPUILabelDefinitions.VAR_DIST_NAME_VERSION).setMaximumWidth(150); @@ -202,7 +215,7 @@ public class RolloutListGrid extends AbstractGrid { @Override protected void setColumnHeaderNames() { - getColumn(SPUILabelDefinitions.VAR_NAME).setHeaderCaption(i18n.get("header.name")); + getColumn(ROLLOUT_RENDERER_DATA).setHeaderCaption(i18n.get("header.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")); @@ -225,7 +238,7 @@ public class RolloutListGrid extends AbstractGrid { @Override protected void setColumnProperties() { final List columnList = new ArrayList<>(); - columnList.add(SPUILabelDefinitions.VAR_NAME); + columnList.add(ROLLOUT_RENDERER_DATA); columnList.add(SPUILabelDefinitions.VAR_DIST_NAME_VERSION); columnList.add(SPUILabelDefinitions.VAR_STATUS); columnList.add(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS); @@ -245,6 +258,7 @@ public class RolloutListGrid extends AbstractGrid { @Override protected void setHiddenColumns() { final List 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); @@ -263,6 +277,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()); @@ -270,7 +286,11 @@ 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))); + + final RolloutRenderer customObjectRenderer = new RolloutRenderer(RolloutRendererData.class); + customObjectRenderer.addClickListener(event -> onClickOfRolloutName(event)); + getColumn(ROLLOUT_RENDERER_DATA).setRenderer(customObjectRenderer); + } private void createRolloutStatusToFontMap() { @@ -403,6 +423,9 @@ public class RolloutListGrid extends AbstractGrid { ((LazyQueryContainer) getContainerDataSource()).refresh(); } + /** + * Generator to generate fontIcon by String. + */ public final class FontIconGenerator extends PropertyValueGenerator { private static final long serialVersionUID = 2544026030795375748L; @@ -428,8 +451,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 (ROLLOUT_RENDERER_DATA.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()); @@ -546,14 +569,14 @@ public class RolloutListGrid extends AbstractGrid { @Override public TotalTargetCountStatus convertToModel(final String value, final Class targetType, final Locale locale) - throws com.vaadin.data.util.converter.Converter.ConversionException { + throws com.vaadin.data.util.converter.Converter.ConversionException { return null; } @Override public String convertToPresentation(final TotalTargetCountStatus value, final Class targetType, final Locale locale) - throws com.vaadin.data.util.converter.Converter.ConversionException { + throws com.vaadin.data.util.converter.Converter.ConversionException { return DistributionBarHelper.getDistributionBarAsHTMLString(value.getStatusTotalCountMap()); } @@ -568,4 +591,39 @@ public class RolloutListGrid extends AbstractGrid { } } + /** + * Converter to convert 0 to empty, if total target groups is zero. + * + */ + class TotalTargetGroupsConverter implements Converter { + + private static final long serialVersionUID = 6589305227035220369L; + + @Override + public Long convertToModel(final String value, final Class targetType, final Locale locale) + throws com.vaadin.data.util.converter.Converter.ConversionException { + return null; + } + + @Override + public String convertToPresentation(final Long value, final Class targetType, + final Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException { + if (value == 0) { + return ""; + } + return value.toString(); + } + + @Override + public Class getModelType() { + return Long.class; + } + + @Override + public Class getPresentationType() { + return String.class; + } + + } + } diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rolloutgroup/ProxyRolloutGroup.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rolloutgroup/ProxyRolloutGroup.java index bb802c123..08f2c0a0b 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rolloutgroup/ProxyRolloutGroup.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rolloutgroup/ProxyRolloutGroup.java @@ -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 rolloutRendererData; - /** - * @param createdDate - * the createdDate to set - */ - public void setCreatedDate(final String createdDate) { - this.createdDate = createdDate; - } + public RolloutRendererData getRolloutRendererData() { + return rolloutRendererData; + } - /** - * @return the modifiedDate - */ - public String getModifiedDate() { - return modifiedDate; - } + public void setRolloutRendererData(RolloutRendererData rendererData) { + this.rolloutRendererData = 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; + } } diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rolloutgroup/RolloutGroupBeanQuery.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rolloutgroup/RolloutGroupBeanQuery.java index 8273ed436..5a37d1341 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rolloutgroup/RolloutGroupBeanQuery.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rolloutgroup/RolloutGroupBeanQuery.java @@ -16,6 +16,7 @@ import org.eclipse.hawkbit.repository.RolloutGroupManagement; import org.eclipse.hawkbit.repository.RolloutManagement; import org.eclipse.hawkbit.repository.model.RolloutGroup; import org.eclipse.hawkbit.ui.common.UserDetailsFormatter; +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; @@ -123,6 +124,8 @@ public class RolloutGroupBeanQuery extends AbstractBeanQuery proxyRolloutGroup.setSuccessConditionExp(rolloutGroup.getSuccessConditionExp()); proxyRolloutGroup.setFinishedPercentage(calculateFinishedPercentage(rolloutGroup)); + proxyRolloutGroup.setRolloutRendererData(new RolloutRendererData(rolloutGroup.getName(), null)); + proxyRolloutGroup.setTotalTargetsCount(String.valueOf(rolloutGroup.getTotalTargets())); proxyRolloutGroup.setTotalTargetCountStatus(rolloutGroup.getTotalTargetCountStatus()); diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rolloutgroup/RolloutGroupListGrid.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rolloutgroup/RolloutGroupListGrid.java index 4ae74c545..f09b02cfc 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rolloutgroup/RolloutGroupListGrid.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rolloutgroup/RolloutGroupListGrid.java @@ -17,13 +17,15 @@ 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.HtmlLabelRenderer; -import org.eclipse.hawkbit.ui.customrenderers.renderers.LinkRenderer; +import org.eclipse.hawkbit.ui.customrenderers.renderers.RolloutRenderer; import org.eclipse.hawkbit.ui.rollout.DistributionBarHelper; import org.eclipse.hawkbit.ui.rollout.StatusFontIcon; import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent; @@ -59,9 +61,14 @@ import com.vaadin.ui.renderers.HtmlRenderer; public class RolloutGroupListGrid extends AbstractGrid { private static final long serialVersionUID = 4060904914954370524L; + private static final String ROLLOUT_RENDERER_DATA = "rolloutRendererData"; + @Autowired private transient RolloutGroupManagement rolloutGroupManagement; + @Autowired + private transient RolloutManagement rolloutManagement; + @Autowired private transient RolloutUIState rolloutUIState; @@ -103,6 +110,13 @@ 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 @@ -116,6 +130,9 @@ public class RolloutGroupListGrid extends AbstractGrid { protected void addContainerProperties() { final LazyQueryContainer rolloutGroupGridContainer = (LazyQueryContainer) getContainerDataSource(); rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, "", false, false); + + rolloutGroupGridContainer.addContainerProperty(ROLLOUT_RENDERER_DATA, 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); @@ -145,8 +162,8 @@ public class RolloutGroupListGrid extends AbstractGrid { @Override protected void setColumnExpandRatio() { - getColumn(SPUILabelDefinitions.VAR_NAME).setMinimumWidth(40); - getColumn(SPUILabelDefinitions.VAR_NAME).setMaximumWidth(200); + getColumn(ROLLOUT_RENDERER_DATA).setMinimumWidth(40); + getColumn(ROLLOUT_RENDERER_DATA).setMaximumWidth(200); getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setMinimumWidth(40); getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setMaximumWidth(100); @@ -170,7 +187,7 @@ public class RolloutGroupListGrid extends AbstractGrid { @Override protected void setColumnHeaderNames() { - getColumn(SPUILabelDefinitions.VAR_NAME).setHeaderCaption(i18n.get("header.name")); + getColumn(ROLLOUT_RENDERER_DATA).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")); @@ -196,7 +213,7 @@ public class RolloutGroupListGrid extends AbstractGrid { @Override protected void setColumnProperties() { final List columnList = new ArrayList<>(); - columnList.add(SPUILabelDefinitions.VAR_NAME); + columnList.add(ROLLOUT_RENDERER_DATA); columnList.add(SPUILabelDefinitions.VAR_STATUS); columnList.add(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS); columnList.add(SPUILabelDefinitions.VAR_TOTAL_TARGETS); @@ -221,14 +238,15 @@ 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(ROLLOUT_RENDERER_DATA) + .setRenderer(new RolloutRenderer(event -> onClickOfRolloutGroupName(event))); } } @Override protected void setHiddenColumns() { final List 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); @@ -268,8 +286,8 @@ 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 (ROLLOUT_RENDERER_DATA.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()); @@ -306,14 +324,14 @@ public class RolloutGroupListGrid extends AbstractGrid { @Override public TotalTargetCountStatus convertToModel(final String value, final Class targetType, final Locale locale) - throws com.vaadin.data.util.converter.Converter.ConversionException { + throws com.vaadin.data.util.converter.Converter.ConversionException { return null; } @Override public String convertToPresentation(final TotalTargetCountStatus value, final Class targetType, final Locale locale) - throws com.vaadin.data.util.converter.Converter.ConversionException { + throws com.vaadin.data.util.converter.Converter.ConversionException { return DistributionBarHelper.getDistributionBarAsHTMLString(value.getStatusTotalCountMap()); } diff --git a/hawkbit-ui/src/main/resources/VAADIN/themes/hawkbit/customstyles/rollout.scss b/hawkbit-ui/src/main/resources/VAADIN/themes/hawkbit/customstyles/rollout.scss index 712e04ec1..b9049068e 100644 --- a/hawkbit-ui/src/main/resources/VAADIN/themes/hawkbit/customstyles/rollout.scss +++ b/hawkbit-ui/src/main/resources/VAADIN/themes/hawkbit/customstyles/rollout.scss @@ -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; + } + } \ No newline at end of file