Rollout -added new custom label renderer
Signed-off-by: asharani-murugesh <asharani.murugesh@in.bosch.com>
This commit is contained in:
@@ -90,9 +90,9 @@
|
|||||||
</manifest>
|
</manifest>
|
||||||
<manifestEntries>
|
<manifestEntries>
|
||||||
<!-- Package format version - do not change -->
|
<!-- Package format version - do not change -->
|
||||||
<Implementation-Title>DistributionBarRenderer</Implementation-Title>
|
<Implementation-Title>CustomRenderers</Implementation-Title>
|
||||||
<Vaadin-Package-Version>1</Vaadin-Package-Version>
|
<Vaadin-Package-Version>1</Vaadin-Package-Version>
|
||||||
<Vaadin-Widgetsets>org.eclipse.hawkbit.ui.distributionbar.DistributionBarRendererWidgetSet</Vaadin-Widgetsets>
|
<Vaadin-Widgetsets>org.eclipse.hawkbit.ui.customrenderers.CustomRendererWidgetSet</Vaadin-Widgetsets>
|
||||||
</manifestEntries>
|
</manifestEntries>
|
||||||
</archive>
|
</archive>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
@@ -25,11 +25,12 @@
|
|||||||
<inherits name="org.vaadin.peter.contextmenu.ContextmenuWidgetset" />
|
<inherits name="org.vaadin.peter.contextmenu.ContextmenuWidgetset" />
|
||||||
|
|
||||||
<inherits
|
<inherits
|
||||||
name="org.eclipse.hawkbit.ui.distributionbar.DistributionBarRendererWidgetSet" />
|
name="org.vaadin.hene.flexibleoptiongroup.widgetset.FlexibleOptionGroupWidgetset" />
|
||||||
|
|
||||||
|
<inherits
|
||||||
|
name="org.vaadin.alump.distributionbar.gwt.DistributionBarWidgetset" />
|
||||||
|
|
||||||
|
<inherits name="org.eclipse.hawkbit.ui.customrenderers.CustomRendererWidgetSet" />
|
||||||
<inherits name="org.eclipse.hawkbit.ui.distributionbar.DistributionBarRendererWidgetSet" />
|
|
||||||
|
|
||||||
<inherits name="org.vaadin.hene.flexibleoptiongroup.widgetset.FlexibleOptionGroupWidgetset" />
|
<inherits name="org.vaadin.hene.flexibleoptiongroup.widgetset.FlexibleOptionGroupWidgetset" />
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<module>
|
<module>
|
||||||
|
|
||||||
<!-- Inherit DefaultWidgetSet -->
|
<!-- Inherit DefaultWidgetSet -->
|
||||||
<inherits name="com.vaadin.DefaultWidgetSet"/>
|
<inherits name="com.vaadin.DefaultWidgetSet"/>
|
||||||
|
|
||||||
@@ -13,5 +12,4 @@
|
|||||||
|
|
||||||
<inherits name="org.vaadin.hene.flexibleoptiongroup.widgetset.FlexibleOptionGroupWidgetset" />
|
<inherits name="org.vaadin.hene.flexibleoptiongroup.widgetset.FlexibleOptionGroupWidgetset" />
|
||||||
|
|
||||||
|
|
||||||
</module>
|
</module>
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
package org.eclipse.hawkbit.ui.distributionbar.client;
|
package org.eclipse.hawkbit.ui.customrenderers.client;
|
||||||
|
|
||||||
import com.vaadin.client.connectors.ButtonRendererConnector;
|
import com.vaadin.client.connectors.ButtonRendererConnector;
|
||||||
import com.vaadin.shared.ui.Connect;
|
import com.vaadin.shared.ui.Connect;
|
||||||
|
|
||||||
@Connect(org.eclipse.hawkbit.ui.distributionbar.renderers.HtmlButtonRenderer.class)
|
@Connect(org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlButtonRenderer.class)
|
||||||
public class HtmlButtonRendererConnector extends ButtonRendererConnector {
|
public class HtmlButtonRendererConnector extends ButtonRendererConnector {
|
||||||
private static final long serialVersionUID = 7987417436367399331L;
|
private static final long serialVersionUID = 7987417436367399331L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public org.eclipse.hawkbit.ui.distributionbar.client.renderers.HtmlButtonRenderer getRenderer() {
|
public org.eclipse.hawkbit.ui.customrenderers.client.renderers.HtmlButtonRenderer getRenderer() {
|
||||||
return (org.eclipse.hawkbit.ui.distributionbar.client.renderers.HtmlButtonRenderer) super.getRenderer();
|
return (org.eclipse.hawkbit.ui.customrenderers.client.renderers.HtmlButtonRenderer) super.getRenderer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package org.eclipse.hawkbit.ui.customrenderers.client;
|
||||||
|
|
||||||
|
import com.vaadin.client.connectors.AbstractRendererConnector;
|
||||||
|
import com.vaadin.shared.ui.Connect;
|
||||||
|
|
||||||
|
@Connect(org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlLabelRenderer.class)
|
||||||
|
public class HtmlLabelRendererConnector extends AbstractRendererConnector<String> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 7697966991925490786L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public org.eclipse.hawkbit.ui.customrenderers.client.renderers.HtmlLabelRenderer getRenderer() {
|
||||||
|
return (org.eclipse.hawkbit.ui.customrenderers.client.renderers.HtmlLabelRenderer) super.getRenderer();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
package org.eclipse.hawkbit.ui.distributionbar.client;
|
package org.eclipse.hawkbit.ui.customrenderers.client;
|
||||||
|
|
||||||
import com.vaadin.client.connectors.ButtonRendererConnector;
|
import com.vaadin.client.connectors.ButtonRendererConnector;
|
||||||
import com.vaadin.shared.ui.Connect;
|
import com.vaadin.shared.ui.Connect;
|
||||||
|
|
||||||
@Connect(org.eclipse.hawkbit.ui.distributionbar.renderers.LinkRenderer.class)
|
@Connect(org.eclipse.hawkbit.ui.customrenderers.renderers.LinkRenderer.class)
|
||||||
public class LinkRendererConnector extends ButtonRendererConnector {
|
public class LinkRendererConnector extends ButtonRendererConnector {
|
||||||
private static final long serialVersionUID = 7987417436367399331L;
|
private static final long serialVersionUID = 7987417436367399331L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public org.eclipse.hawkbit.ui.distributionbar.client.renderers.LinkRenderer getRenderer() {
|
public org.eclipse.hawkbit.ui.customrenderers.client.renderers.LinkRenderer getRenderer() {
|
||||||
return (org.eclipse.hawkbit.ui.distributionbar.client.renderers.LinkRenderer) super.getRenderer();
|
return (org.eclipse.hawkbit.ui.customrenderers.client.renderers.LinkRenderer) super.getRenderer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
package org.eclipse.hawkbit.ui.distributionbar.client;
|
package org.eclipse.hawkbit.ui.customrenderers.client;
|
||||||
|
|
||||||
import com.vaadin.client.connectors.AbstractRendererConnector;
|
import com.vaadin.client.connectors.AbstractRendererConnector;
|
||||||
import com.vaadin.shared.ui.Connect;
|
import com.vaadin.shared.ui.Connect;
|
||||||
|
|
||||||
@Connect(org.eclipse.hawkbit.ui.distributionbar.renderers.StringDistributionBarRenderer.class)
|
@Connect(org.eclipse.hawkbit.ui.customrenderers.renderers.StringDistributionBarRenderer.class)
|
||||||
public class StringDistributionBarRendererConnector extends AbstractRendererConnector<String> {
|
public class StringDistributionBarRendererConnector extends AbstractRendererConnector<String> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 7697966991925490786L;
|
private static final long serialVersionUID = 7697966991925490786L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public org.eclipse.hawkbit.ui.distributionbar.client.renderers.StringDistributionBarRenderer getRenderer() {
|
public org.eclipse.hawkbit.ui.customrenderers.client.renderers.StringDistributionBarRenderer getRenderer() {
|
||||||
org.eclipse.hawkbit.ui.distributionbar.client.renderers.StringDistributionBarRenderer renderer = (org.eclipse.hawkbit.ui.distributionbar.client.renderers.StringDistributionBarRenderer) super.getRenderer();
|
org.eclipse.hawkbit.ui.customrenderers.client.renderers.StringDistributionBarRenderer renderer = (org.eclipse.hawkbit.ui.customrenderers.client.renderers.StringDistributionBarRenderer) super.getRenderer();
|
||||||
renderer.setUiWidgetClassName(StringDistributionBarRendererConnector.this.getConnection().getUIConnector().getWidget().getParent().getStyleName());
|
renderer.setUiWidgetClassName(StringDistributionBarRendererConnector.this.getConnection().getUIConnector().getWidget().getParent().getStyleName());
|
||||||
return renderer;
|
return renderer;
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.eclipse.hawkbit.ui.distributionbar.client.renderers;
|
package org.eclipse.hawkbit.ui.customrenderers.client.renderers;
|
||||||
|
|
||||||
import com.google.gwt.user.client.ui.Button;
|
import com.google.gwt.user.client.ui.Button;
|
||||||
import com.vaadin.client.renderers.ButtonRenderer;
|
import com.vaadin.client.renderers.ButtonRenderer;
|
||||||
@@ -10,12 +10,18 @@ public class HtmlButtonRenderer extends ButtonRenderer {
|
|||||||
if (text != null) {
|
if (text != null) {
|
||||||
button.setHTML(text);
|
button.setHTML(text);
|
||||||
}
|
}
|
||||||
button.setStylePrimaryName("v-button");
|
applystyles(button);
|
||||||
button.addStyleName(
|
|
||||||
"tiny v-button-tiny borderless v-button-borderless icon-only v-button-icon-only button-no-border v-button-button-no-border");
|
|
||||||
// this is to allow the button to disappear, if the text is null
|
// this is to allow the button to disappear, if the text is null
|
||||||
button.setVisible(text != null);
|
button.setVisible(text != null);
|
||||||
button.getElement().setId("rollout.action.button.id");
|
button.getElement().setId("rollout.action.button.id");
|
||||||
button.getElement().setTitle("action");
|
button.getElement().setTitle("action");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void applystyles(Button button) {
|
||||||
|
button.setStylePrimaryName("v-button");
|
||||||
|
button.addStyleName("tiny v-button-tiny");
|
||||||
|
button.addStyleName("borderless v-button-borderless");
|
||||||
|
button.addStyleName("icon-only v-button-icon-only");
|
||||||
|
button.addStyleName("button-no-border v-button-button-no-border");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package org.eclipse.hawkbit.ui.customrenderers.client.renderers;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.vaadin.client.renderers.WidgetRenderer;
|
||||||
|
import com.vaadin.client.ui.VLabel;
|
||||||
|
import com.vaadin.client.widget.grid.RendererCellReference;
|
||||||
|
|
||||||
|
public class HtmlLabelRenderer extends WidgetRenderer<String, VLabel> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VLabel createWidget() {
|
||||||
|
return GWT.create(VLabel.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(RendererCellReference cell, String input, VLabel label) {
|
||||||
|
Map<String, String> map = formatInput(input);
|
||||||
|
String value = map.containsKey("value") ? map.get("value") : null;
|
||||||
|
String description = map.containsKey("description") ? map.get("description") : null;
|
||||||
|
String style = map.containsKey("style") ? map.get("style") : null;
|
||||||
|
String id = map.containsKey("id") ? map.get("id") : null;
|
||||||
|
|
||||||
|
if (value != null) {
|
||||||
|
label.setHTML("<span>&#x" + Integer.toHexString(Integer.parseInt(value)) + ";</span>");
|
||||||
|
}
|
||||||
|
applyStyle(label, style);
|
||||||
|
label.setTitle(description);
|
||||||
|
label.getElement().setId(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applyStyle(VLabel label, String style) {
|
||||||
|
label.setStylePrimaryName("v-label");
|
||||||
|
label.addStyleName("small v-label-small");
|
||||||
|
label.addStyleName("font-icon v-label-font-icon");
|
||||||
|
if (style != null) {
|
||||||
|
label.addStyleName(style + " v-label-" + style);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, String> formatInput(String input) {
|
||||||
|
Map<String, String> details = new HashMap<>();
|
||||||
|
String[] tempData = input.split(",");
|
||||||
|
for (String statusWithCount : tempData) {
|
||||||
|
String[] statusWithCountList = statusWithCount.split(":");
|
||||||
|
details.put(statusWithCountList[0], statusWithCountList[1]);
|
||||||
|
}
|
||||||
|
return details;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.eclipse.hawkbit.ui.distributionbar.client.renderers;
|
package org.eclipse.hawkbit.ui.customrenderers.client.renderers;
|
||||||
|
|
||||||
import com.google.gwt.user.client.ui.Button;
|
import com.google.gwt.user.client.ui.Button;
|
||||||
import com.vaadin.client.renderers.ButtonRenderer;
|
import com.vaadin.client.renderers.ButtonRenderer;
|
||||||
@@ -8,11 +8,17 @@ public class LinkRenderer extends ButtonRenderer {
|
|||||||
@Override
|
@Override
|
||||||
public void render(RendererCellReference cell, String text, Button button) {
|
public void render(RendererCellReference cell, String text, Button button) {
|
||||||
button.setText(text);
|
button.setText(text);
|
||||||
button.setStylePrimaryName("v-button");
|
applystyle(button);
|
||||||
button.addStyleName(
|
|
||||||
"borderless v-button-borderless small v-button-small on-focus-no-border v-button-on-focus-no-border link v-button-link");
|
|
||||||
// this is to allow the button to disappear, if the text is null
|
// this is to allow the button to disappear, if the text is null
|
||||||
button.setVisible(text != null);
|
button.setVisible(text != null);
|
||||||
button.getElement().setId("rollout.action.button.id");
|
button.getElement().setId(new StringBuilder("link").append(".").append(text).toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applystyle(Button button) {
|
||||||
|
button.setStylePrimaryName("v-button");
|
||||||
|
button.addStyleName("borderless v-button-borderless");
|
||||||
|
button.addStyleName("small v-button-small");
|
||||||
|
button.addStyleName("on-focus-no-border v-button-on-focus-no-border");
|
||||||
|
button.addStyleName("link v-button-link");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.eclipse.hawkbit.ui.distributionbar.client.renderers;
|
package org.eclipse.hawkbit.ui.customrenderers.client.renderers;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -40,6 +40,14 @@ public class StringDistributionBarRenderer extends WidgetRenderer<String, GwtDis
|
|||||||
setBarPartSize(widget, "FINISHED".toLowerCase(), 0, 1);
|
setBarPartSize(widget, "FINISHED".toLowerCase(), 0, 1);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
setThePartDetails(widget, map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
widget.updateParts();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setThePartDetails(GwtDistributionBar widget, Map<String, Long> map) {
|
||||||
widget.setNumberOfParts(getNumberOfParts(map.values()));
|
widget.setNumberOfParts(getNumberOfParts(map.values()));
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (Entry<String, Long> entryVal : map.entrySet()) {
|
for (Entry<String, Long> entryVal : map.entrySet()) {
|
||||||
@@ -50,10 +58,6 @@ public class StringDistributionBarRenderer extends WidgetRenderer<String, GwtDis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
widget.updateParts();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<String, Long> formatData(String input) {
|
private Map<String, Long> formatData(String input) {
|
||||||
Map<String, Long> details = new HashMap<>();
|
Map<String, Long> details = new HashMap<>();
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.eclipse.hawkbit.ui.distributionbar.renderers;
|
package org.eclipse.hawkbit.ui.customrenderers.renderers;
|
||||||
|
|
||||||
import com.vaadin.ui.renderers.ButtonRenderer;
|
import com.vaadin.ui.renderers.ButtonRenderer;
|
||||||
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package org.eclipse.hawkbit.ui.customrenderers.renderers;
|
||||||
|
|
||||||
|
import com.vaadin.ui.Grid.AbstractRenderer;
|
||||||
|
|
||||||
|
public class HtmlLabelRenderer extends AbstractRenderer<String> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -7675588068526774915L;
|
||||||
|
/**
|
||||||
|
* Creates a new text renderer
|
||||||
|
*/
|
||||||
|
public HtmlLabelRenderer() {
|
||||||
|
super(String.class, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.eclipse.hawkbit.ui.distributionbar.renderers;
|
package org.eclipse.hawkbit.ui.customrenderers.renderers;
|
||||||
|
|
||||||
import com.vaadin.ui.renderers.ButtonRenderer;
|
import com.vaadin.ui.renderers.ButtonRenderer;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.eclipse.hawkbit.ui.distributionbar.renderers;
|
package org.eclipse.hawkbit.ui.customrenderers.renderers;
|
||||||
|
|
||||||
|
|
||||||
import com.vaadin.ui.Grid.AbstractRenderer;
|
import com.vaadin.ui.Grid.AbstractRenderer;
|
||||||
@@ -14,7 +14,10 @@ import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
|||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||||
import org.eclipse.hawkbit.ui.distributionbar.renderers.LinkRenderer;
|
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
|
||||||
|
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlLabelRenderer;
|
||||||
|
import org.eclipse.hawkbit.ui.customrenderers.renderers.LinkRenderer;
|
||||||
|
import org.eclipse.hawkbit.ui.customrenderers.renderers.StringDistributionBarRenderer;
|
||||||
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
||||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
@@ -37,7 +40,6 @@ import com.vaadin.server.FontAwesome;
|
|||||||
import com.vaadin.spring.annotation.SpringComponent;
|
import com.vaadin.spring.annotation.SpringComponent;
|
||||||
import com.vaadin.spring.annotation.ViewScope;
|
import com.vaadin.spring.annotation.ViewScope;
|
||||||
import com.vaadin.ui.renderers.ClickableRenderer.RendererClickEvent;
|
import com.vaadin.ui.renderers.ClickableRenderer.RendererClickEvent;
|
||||||
import com.vaadin.ui.UI;
|
|
||||||
import com.vaadin.ui.renderers.HtmlRenderer;
|
import com.vaadin.ui.renderers.HtmlRenderer;
|
||||||
|
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@@ -251,8 +253,9 @@ public class RolloutGroupListGrid extends AbstractSimpleGrid {
|
|||||||
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS);
|
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void addStatusCoulmn() {
|
private void addStatusCoulmn() {
|
||||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setRenderer(new HtmlRenderer(),
|
getColumn(SPUILabelDefinitions.VAR_STATUS).setRenderer(new HtmlLabelRenderer(),
|
||||||
new Converter<String, RolloutGroupStatus>() {
|
new Converter<String, RolloutGroupStatus>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@@ -265,29 +268,7 @@ public class RolloutGroupListGrid extends AbstractSimpleGrid {
|
|||||||
@Override
|
@Override
|
||||||
public String convertToPresentation(final RolloutGroupStatus value,
|
public String convertToPresentation(final RolloutGroupStatus value,
|
||||||
final Class<? extends String> targetType, final Locale locale) {
|
final Class<? extends String> targetType, final Locale locale) {
|
||||||
String result = null;
|
return convertRolloutGroupStatusToString(value);
|
||||||
switch (value) {
|
|
||||||
case FINISHED:
|
|
||||||
result = "<div class=\"statusIconGreen\">" + FontAwesome.CHECK_CIRCLE.getHtml() + "</div>";
|
|
||||||
break;
|
|
||||||
case SCHEDULED:
|
|
||||||
result = "<div class=\"statusIconBlue\">" + FontAwesome.BULLSEYE.getHtml() + "</div>";
|
|
||||||
break;
|
|
||||||
case RUNNING:
|
|
||||||
result = "<div class=\"statusIconYellow\"><span title=\"xxx\">" + FontAwesome.ADJUST.getHtml() + "</span></div>";
|
|
||||||
break;
|
|
||||||
case READY:
|
|
||||||
result = "<div class=\"statusIconLightBlue\"> <span title=\"xxx\">"
|
|
||||||
+ FontAwesome.DOT_CIRCLE_O.getHtml() + "</span></div>";
|
|
||||||
break;
|
|
||||||
case ERROR:
|
|
||||||
result = "<div class=\"statusIconRed\">" + FontAwesome.EXCLAMATION_CIRCLE.getHtml()
|
|
||||||
+ "</div>";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -302,9 +283,42 @@ public class RolloutGroupListGrid extends AbstractSimpleGrid {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private String convertRolloutGroupStatusToString(final RolloutGroupStatus value) {
|
||||||
|
String result = null;
|
||||||
|
switch (value) {
|
||||||
|
case FINISHED:
|
||||||
|
result = HawkbitCommonUtil.getFormattedString(Integer.toString(FontAwesome.CHECK_CIRCLE.getCodepoint()),
|
||||||
|
value.name().toLowerCase(), "statusIconGreen", SPUIComponetIdProvider.ROLLOUT_GROUP_STATUS_LABEL_ID);
|
||||||
|
break;
|
||||||
|
case SCHEDULED:
|
||||||
|
result = HawkbitCommonUtil.getFormattedString(Integer.toString(FontAwesome.BULLSEYE.getCodepoint()),
|
||||||
|
value.name().toLowerCase(), "statusIconBlue", SPUIComponetIdProvider.ROLLOUT_GROUP_STATUS_LABEL_ID);
|
||||||
|
break;
|
||||||
|
case RUNNING:
|
||||||
|
result = HawkbitCommonUtil.getFormattedString(Integer.toString(FontAwesome.ADJUST.getCodepoint()),
|
||||||
|
value.name().toLowerCase(), "statusIconYellow", SPUIComponetIdProvider.ROLLOUT_GROUP_STATUS_LABEL_ID);
|
||||||
|
break;
|
||||||
|
case READY:
|
||||||
|
result = HawkbitCommonUtil.getFormattedString(Integer.toString(FontAwesome.DOT_CIRCLE_O.getCodepoint()),
|
||||||
|
value.name().toLowerCase(), "statusIconLightBlue", SPUIComponetIdProvider.ROLLOUT_GROUP_STATUS_LABEL_ID);
|
||||||
|
break;
|
||||||
|
case ERROR:
|
||||||
|
result = HawkbitCommonUtil.getFormattedString(Integer.toString(FontAwesome.EXCLAMATION_CIRCLE.getCodepoint()),
|
||||||
|
value.name().toLowerCase(), "statusIconRed", SPUIComponetIdProvider.ROLLOUT_GROUP_STATUS_LABEL_ID);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void addDetailStatusColumn() {
|
private void addDetailStatusColumn() {
|
||||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setRenderer(
|
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setRenderer(
|
||||||
new org.eclipse.hawkbit.ui.distributionbar.renderers.StringDistributionBarRenderer(),
|
new StringDistributionBarRenderer(),
|
||||||
new Converter<String, TotalTargetCountStatus>() {
|
new Converter<String, TotalTargetCountStatus>() {
|
||||||
private static final long serialVersionUID = 2660476405836705932L;
|
private static final long serialVersionUID = 2660476405836705932L;
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.annotation.PreDestroy;
|
import javax.annotation.PreDestroy;
|
||||||
@@ -16,9 +14,9 @@ import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
|||||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
|
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus.Status;
|
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlButtonRenderer;
|
||||||
import org.eclipse.hawkbit.ui.distributionbar.renderers.HtmlButtonRenderer;
|
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlLabelRenderer;
|
||||||
import org.eclipse.hawkbit.ui.distributionbar.renderers.LinkRenderer;
|
import org.eclipse.hawkbit.ui.customrenderers.renderers.LinkRenderer;
|
||||||
import org.eclipse.hawkbit.ui.rollout.RolloutListTable.ACTION;
|
import org.eclipse.hawkbit.ui.rollout.RolloutListTable.ACTION;
|
||||||
import org.eclipse.hawkbit.ui.rollout.RolloutListTable.ContextMenuData;
|
import org.eclipse.hawkbit.ui.rollout.RolloutListTable.ContextMenuData;
|
||||||
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
||||||
@@ -40,6 +38,7 @@ import org.vaadin.spring.events.EventBus;
|
|||||||
import org.vaadin.spring.events.EventScope;
|
import org.vaadin.spring.events.EventScope;
|
||||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||||
|
|
||||||
|
import com.google.common.base.Strings;
|
||||||
import com.vaadin.data.Container;
|
import com.vaadin.data.Container;
|
||||||
import com.vaadin.data.Item;
|
import com.vaadin.data.Item;
|
||||||
import com.vaadin.data.util.PropertyValueGenerator;
|
import com.vaadin.data.util.PropertyValueGenerator;
|
||||||
@@ -48,6 +47,7 @@ import com.vaadin.server.AbstractClientConnector;
|
|||||||
import com.vaadin.server.FontAwesome;
|
import com.vaadin.server.FontAwesome;
|
||||||
import com.vaadin.spring.annotation.SpringComponent;
|
import com.vaadin.spring.annotation.SpringComponent;
|
||||||
import com.vaadin.spring.annotation.ViewScope;
|
import com.vaadin.spring.annotation.ViewScope;
|
||||||
|
import com.vaadin.ui.Label;
|
||||||
import com.vaadin.ui.UI;
|
import com.vaadin.ui.UI;
|
||||||
import com.vaadin.ui.Window;
|
import com.vaadin.ui.Window;
|
||||||
import com.vaadin.ui.renderers.ClickableRenderer.RendererClickEvent;
|
import com.vaadin.ui.renderers.ClickableRenderer.RendererClickEvent;
|
||||||
@@ -84,6 +84,8 @@ public class RolloutListGrid extends AbstractSimpleGrid {
|
|||||||
protected void init() {
|
protected void init() {
|
||||||
super.init();
|
super.init();
|
||||||
eventBus.subscribe(this);
|
eventBus.subscribe(this);
|
||||||
|
setColumnReorderingAllowed(true);
|
||||||
|
isColumnReorderingAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreDestroy
|
@PreDestroy
|
||||||
@@ -315,7 +317,7 @@ public class RolloutListGrid extends AbstractSimpleGrid {
|
|||||||
|
|
||||||
private void addDetailStatusColumn() {
|
private void addDetailStatusColumn() {
|
||||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setRenderer(
|
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setRenderer(
|
||||||
new org.eclipse.hawkbit.ui.distributionbar.renderers.StringDistributionBarRenderer(),
|
new org.eclipse.hawkbit.ui.customrenderers.renderers.StringDistributionBarRenderer(),
|
||||||
new Converter<String, TotalTargetCountStatus>() {
|
new Converter<String, TotalTargetCountStatus>() {
|
||||||
private static final long serialVersionUID = 2660476405836705932L;
|
private static final long serialVersionUID = 2660476405836705932L;
|
||||||
|
|
||||||
@@ -346,7 +348,7 @@ public class RolloutListGrid extends AbstractSimpleGrid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addStatusCoulmn() {
|
private void addStatusCoulmn() {
|
||||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setRenderer(new HtmlRenderer(),
|
getColumn(SPUILabelDefinitions.VAR_STATUS).setRenderer(new HtmlLabelRenderer(),
|
||||||
new Converter<String, RolloutStatus>() {
|
new Converter<String, RolloutStatus>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@@ -359,42 +361,7 @@ public class RolloutListGrid extends AbstractSimpleGrid {
|
|||||||
@Override
|
@Override
|
||||||
public String convertToPresentation(final RolloutStatus value,
|
public String convertToPresentation(final RolloutStatus value,
|
||||||
final Class<? extends String> targetType, final Locale locale) {
|
final Class<? extends String> targetType, final Locale locale) {
|
||||||
String result = null;
|
return convertRolloutStatusToString(value);
|
||||||
switch (value) {
|
|
||||||
case FINISHED:
|
|
||||||
result = "<div class=\"statusIconGreen\">" + FontAwesome.CHECK_CIRCLE.getHtml() + "</div>";
|
|
||||||
break;
|
|
||||||
case PAUSED:
|
|
||||||
result = "<div class=\"statusIconBlue\">" + FontAwesome.PAUSE.getHtml() + "</div>";
|
|
||||||
break;
|
|
||||||
case RUNNING:
|
|
||||||
result = "<div class=\"yellowSpinner\"></div>";
|
|
||||||
break;
|
|
||||||
case READY:
|
|
||||||
result = "<div class=\"statusIconLightBlue\"> <span title=\"xxx\">"
|
|
||||||
+ FontAwesome.DOT_CIRCLE_O.getHtml() + "</span></div>";
|
|
||||||
break;
|
|
||||||
case STOPPED:
|
|
||||||
result = "<div class=\"statusIconRed\">" + FontAwesome.STOP.getHtml() + "</div>";
|
|
||||||
break;
|
|
||||||
case CREATING:
|
|
||||||
result = "<div class=\"greySpinner\"></div>";
|
|
||||||
break;
|
|
||||||
case STARTING:
|
|
||||||
result = "<div class=\"blueSpinner\"></div>";
|
|
||||||
break;
|
|
||||||
case ERROR_CREATING:
|
|
||||||
result = "<div class=\"statusIconRed\">" + FontAwesome.EXCLAMATION_CIRCLE.getHtml()
|
|
||||||
+ "</div>";
|
|
||||||
break;
|
|
||||||
case ERROR_STARTING:
|
|
||||||
result = "<div class=\"statusIconRed\">" + FontAwesome.EXCLAMATION_CIRCLE.getHtml()
|
|
||||||
+ "</div>";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -409,6 +376,53 @@ public class RolloutListGrid extends AbstractSimpleGrid {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String convertRolloutStatusToString(final RolloutStatus value) {
|
||||||
|
String result = null;
|
||||||
|
switch (value) {
|
||||||
|
case FINISHED:
|
||||||
|
result = HawkbitCommonUtil.getFormattedString(Integer.toString(FontAwesome.CHECK_CIRCLE.getCodepoint()),
|
||||||
|
value.name().toLowerCase(), "statusIconGreen", SPUIComponetIdProvider.ROLLOUT_STATUS_LABEL_ID);
|
||||||
|
break;
|
||||||
|
case PAUSED:
|
||||||
|
result = HawkbitCommonUtil.getFormattedString(Integer.toString(FontAwesome.PAUSE.getCodepoint()),
|
||||||
|
value.name().toLowerCase(), "statusIconBlue", SPUIComponetIdProvider.ROLLOUT_STATUS_LABEL_ID);
|
||||||
|
break;
|
||||||
|
case RUNNING:
|
||||||
|
result = HawkbitCommonUtil.getFormattedString(null, value.name().toLowerCase(), "yellowSpinner",
|
||||||
|
SPUIComponetIdProvider.ROLLOUT_STATUS_LABEL_ID);
|
||||||
|
break;
|
||||||
|
case READY:
|
||||||
|
result = HawkbitCommonUtil.getFormattedString(Integer.toString(FontAwesome.DOT_CIRCLE_O.getCodepoint()),
|
||||||
|
value.name().toLowerCase(), "statusIconLightBlue", SPUIComponetIdProvider.ROLLOUT_STATUS_LABEL_ID);
|
||||||
|
break;
|
||||||
|
case STOPPED:
|
||||||
|
result = HawkbitCommonUtil.getFormattedString(Integer.toString(FontAwesome.STOP.getCodepoint()),
|
||||||
|
value.name().toLowerCase(), "statusIconRed", SPUIComponetIdProvider.ROLLOUT_STATUS_LABEL_ID);
|
||||||
|
break;
|
||||||
|
case CREATING:
|
||||||
|
result = HawkbitCommonUtil.getFormattedString(null, value.name().toLowerCase(), "greySpinner",
|
||||||
|
SPUIComponetIdProvider.ROLLOUT_STATUS_LABEL_ID);
|
||||||
|
break;
|
||||||
|
case STARTING:
|
||||||
|
result = HawkbitCommonUtil.getFormattedString(null, value.name().toLowerCase(), "blueSpinner",
|
||||||
|
SPUIComponetIdProvider.ROLLOUT_STATUS_LABEL_ID);
|
||||||
|
break;
|
||||||
|
case ERROR_CREATING:
|
||||||
|
result = HawkbitCommonUtil.getFormattedString(
|
||||||
|
Integer.toString(FontAwesome.EXCLAMATION_CIRCLE.getCodepoint()), value.name().toLowerCase(),
|
||||||
|
"statusIconRed", SPUIComponetIdProvider.ROLLOUT_STATUS_LABEL_ID);
|
||||||
|
break;
|
||||||
|
case ERROR_STARTING:
|
||||||
|
result = HawkbitCommonUtil.getFormattedString(
|
||||||
|
Integer.toString(FontAwesome.EXCLAMATION_CIRCLE.getCodepoint()), value.name().toLowerCase(),
|
||||||
|
"statusIconRed", SPUIComponetIdProvider.ROLLOUT_STATUS_LABEL_ID);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private void menuItemClicked(final ContextMenuItemClickEvent event) {
|
private void menuItemClicked(final ContextMenuItemClickEvent event) {
|
||||||
final ContextMenuItem item = (ContextMenuItem) event.getSource();
|
final ContextMenuItem item = (ContextMenuItem) event.getSource();
|
||||||
final ContextMenuData contextMenuData = (ContextMenuData) item.getData();
|
final ContextMenuData contextMenuData = (ContextMenuData) item.getData();
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
|||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
||||||
import org.vaadin.alump.distributionbar.DistributionBar;
|
import org.vaadin.alump.distributionbar.DistributionBar;
|
||||||
|
|
||||||
|
import com.google.common.base.Strings;
|
||||||
import com.vaadin.data.Container;
|
import com.vaadin.data.Container;
|
||||||
import com.vaadin.data.Item;
|
import com.vaadin.data.Item;
|
||||||
import com.vaadin.server.Sizeable.Unit;
|
import com.vaadin.server.Sizeable.Unit;
|
||||||
@@ -1370,4 +1371,20 @@ public final class HawkbitCommonUtil {
|
|||||||
return finalVal;
|
return finalVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static String getFormattedString(String value, String description, String style, String id) {
|
||||||
|
StringBuilder val = new StringBuilder();
|
||||||
|
if (!Strings.isNullOrEmpty(value)) {
|
||||||
|
val.append("value:").append(value).append(",");
|
||||||
|
}
|
||||||
|
if (!Strings.isNullOrEmpty(description)) {
|
||||||
|
val.append("description:").append(description).append(",");
|
||||||
|
}
|
||||||
|
if (!Strings.isNullOrEmpty(style)) {
|
||||||
|
val.append("style:").append(style).append(",");
|
||||||
|
}
|
||||||
|
val.append("id:").append(id);
|
||||||
|
return val.toString();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -828,6 +828,11 @@ public final class SPUIComponetIdProvider {
|
|||||||
*/
|
*/
|
||||||
public static final String ROLLOUT_STATUS_LABEL_ID = "rollout.status.id";
|
public static final String ROLLOUT_STATUS_LABEL_ID = "rollout.status.id";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rollout group status label id.
|
||||||
|
*/
|
||||||
|
public static final String ROLLOUT_GROUP_STATUS_LABEL_ID = "rollout.group.status.id";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rollout % or count option group id.
|
* Rollout % or count option group id.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -276,4 +276,10 @@
|
|||||||
.links {
|
.links {
|
||||||
padding-left: 22px;
|
padding-left: 22px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.font-icon{
|
||||||
|
font-family:FontAwesome;
|
||||||
|
font-style:normal;
|
||||||
|
font-weight:normal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user