Addressed review comments
Signed-off-by: asharani-murugesh <asharani.murugesh@in.bosch.com>
This commit is contained in:
@@ -25,4 +25,4 @@ public class HtmlButtonRendererConnector extends ButtonRendererConnector {
|
||||
public org.eclipse.hawkbit.ui.customrenderers.client.renderers.HtmlButtonRenderer getRenderer() {
|
||||
return (org.eclipse.hawkbit.ui.customrenderers.client.renderers.HtmlButtonRenderer) super.getRenderer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,4 +26,4 @@ public class LinkRendererConnector extends ButtonRendererConnector {
|
||||
public org.eclipse.hawkbit.ui.customrenderers.client.renderers.LinkRenderer getRenderer() {
|
||||
return (org.eclipse.hawkbit.ui.customrenderers.client.renderers.LinkRenderer) super.getRenderer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,5 +66,4 @@ public class HtmlLabelRenderer extends WidgetRenderer<String, VLabel> {
|
||||
}
|
||||
return details;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,17 +12,17 @@ import com.vaadin.ui.renderers.ButtonRenderer;
|
||||
|
||||
/**
|
||||
*
|
||||
* Renders button with provided HTML content.
|
||||
* Used to display button with icons.
|
||||
* Renders button with provided HTML content. Used to display button with icons.
|
||||
*
|
||||
*/
|
||||
public class HtmlButtonRenderer extends ButtonRenderer {
|
||||
private static final long serialVersionUID = -1242995370043404892L;
|
||||
|
||||
public HtmlButtonRenderer() {
|
||||
super();
|
||||
}
|
||||
|
||||
public HtmlButtonRenderer(RendererClickListener listener) {
|
||||
super(listener);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,4 +24,4 @@ public class LinkRenderer extends ButtonRenderer {
|
||||
super(listener);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,63 @@ public final class DistributionBarHelper {
|
||||
private DistributionBarHelper() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string with details of status and count .
|
||||
*
|
||||
* @param statusTotalCountMap
|
||||
* map with status and count
|
||||
*
|
||||
* @return string of format "status1:count,status2:count"
|
||||
*/
|
||||
public static String getDistributionBarAsHTMLString(Map<Status, Long> statusTotalCountMap) {
|
||||
StringBuilder htmlString = new StringBuilder();
|
||||
Map<Status, Long> statusMapWithNonZeroValues = getStatusMapWithNonZeroValues(statusTotalCountMap);
|
||||
Long totalValue = getTotalSizes(statusTotalCountMap);
|
||||
if (statusMapWithNonZeroValues.size() <= 0) {
|
||||
return getUnintialisedBar();
|
||||
}
|
||||
int partIndex = 1;
|
||||
htmlString.append(getParentDivStart());
|
||||
for (Map.Entry<Status, Long> entry : statusMapWithNonZeroValues.entrySet()) {
|
||||
if (entry.getValue() > 0) {
|
||||
htmlString.append(getPart(partIndex, entry.getKey(), entry.getValue(), totalValue,
|
||||
statusMapWithNonZeroValues.size()));
|
||||
partIndex++;
|
||||
}
|
||||
}
|
||||
htmlString.append(getParentDivEnd());
|
||||
return htmlString.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the map with status having non zero values.
|
||||
*
|
||||
* @param statusTotalCountMap
|
||||
* map with status and count
|
||||
* @return map with non zero values
|
||||
*/
|
||||
public static Map<Status, Long> getStatusMapWithNonZeroValues(Map<Status, Long> statusTotalCountMap) {
|
||||
return statusTotalCountMap.entrySet().stream().filter(p -> p.getValue() > 0)
|
||||
.collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns tool tip for progress bar.
|
||||
*
|
||||
* @param statusCountMap
|
||||
* map with status and count details
|
||||
* @return tool tip
|
||||
*/
|
||||
public static String getTooltip(Map<Status, Long> statusCountMap) {
|
||||
Map<Status, Long> nonZeroStatusCountMap = DistributionBarHelper.getStatusMapWithNonZeroValues(statusCountMap);
|
||||
StringBuilder tooltip = new StringBuilder();
|
||||
for (Entry<Status, Long> entry : nonZeroStatusCountMap.entrySet()) {
|
||||
tooltip.append(entry.getKey().toString().toLowerCase()).append(" : ").append(entry.getValue())
|
||||
.append("<br>");
|
||||
}
|
||||
return tooltip.toString();
|
||||
}
|
||||
|
||||
private static String getPartStyle(int partIndex, int noOfParts, String customStyle) {
|
||||
StringBuilder mainStyle = new StringBuilder();
|
||||
StringBuilder styleName = new StringBuilder(GwtDistributionBar.CLASSNAME);
|
||||
@@ -60,55 +117,11 @@ public final class DistributionBarHelper {
|
||||
|
||||
private static String getPart(int partIndex, Status status, Long value, Long totalValue, int noOfParts) {
|
||||
String partValue = status.toString().toLowerCase();
|
||||
// return "<div class=\"" + getPartStyle(partIndex, noOfParts,
|
||||
// partValue) + "\" style=\"width: "
|
||||
// + getPartWidth(value, totalValue, noOfParts) + ";\" title = \"" +
|
||||
// partValue + "\"><span class=\""
|
||||
// + DISTRIBUTION_BAR_PART_VALUE_CLASSNAME + "\">" + value +
|
||||
// "</span></div>";
|
||||
return "<div class=\"" + getPartStyle(partIndex, noOfParts, partValue) + "\" style=\"width: "
|
||||
+ getPartWidth(value, totalValue, noOfParts) + ";\"><span class=\""
|
||||
+ DISTRIBUTION_BAR_PART_VALUE_CLASSNAME + "\">" + value + "</span></div>";
|
||||
}
|
||||
|
||||
public static String getDistributionBarAsHTMLString(Map<Status, Long> statusTotalCountMap) {
|
||||
StringBuilder htmlString = new StringBuilder();
|
||||
htmlString.append(getParentDivStart());
|
||||
Long totalValue = getTotalSizes(statusTotalCountMap);
|
||||
Map<Status, Long> statusMapWithNonZeroValues = getNonZeroStatusList(statusTotalCountMap);
|
||||
|
||||
if (statusMapWithNonZeroValues.size() > 0) {
|
||||
int partIndex = 1;
|
||||
for (Map.Entry<Status, Long> entry : statusMapWithNonZeroValues.entrySet()) {
|
||||
if (entry.getValue() > 0) {
|
||||
htmlString.append(getPart(partIndex, entry.getKey(), entry.getValue(), totalValue,
|
||||
statusMapWithNonZeroValues.size()));
|
||||
partIndex++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return getUnintialisedBar();
|
||||
}
|
||||
htmlString.append(getParentDivEnd());
|
||||
return htmlString.toString();
|
||||
}
|
||||
|
||||
public static Map<Status, Long> getNonZeroStatusList(Map<Status, Long> statusTotalCountMap) {
|
||||
return statusTotalCountMap.entrySet().stream().filter(p -> p.getValue() > 0)
|
||||
.collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue()));
|
||||
}
|
||||
|
||||
|
||||
public static String getTooltip(Map<Status, Long> statusCountMap) {
|
||||
Map<Status, Long> nonZeroStatusCountMap = DistributionBarHelper.getNonZeroStatusList(statusCountMap);
|
||||
StringBuilder tooltip = new StringBuilder();
|
||||
for (Entry<Status, Long> entry : nonZeroStatusCountMap.entrySet()) {
|
||||
tooltip.append(entry.getKey().toString().toLowerCase()).append(" : ").append(entry.getValue())
|
||||
.append("<br>");
|
||||
}
|
||||
return tooltip.toString();
|
||||
}
|
||||
|
||||
private static String getUnintialisedBar() {
|
||||
return "<div class=\"" + UNINITIALIZED_VALUE_CLASSNAME + "\" style=\"width: 100%;\"><span class=\""
|
||||
+ DISTRIBUTION_BAR_PART_VALUE_CLASSNAME + "\">uninitialized</span></div>";
|
||||
@@ -130,5 +143,4 @@ public final class DistributionBarHelper {
|
||||
private static String getParentDivEnd() {
|
||||
return "</div>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.eclipse.hawkbit.ui.rollout;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
|
||||
import com.google.gwt.i18n.client.AutoDirectionHandler.Target;
|
||||
import com.vaadin.server.FontAwesome;
|
||||
|
||||
/**
|
||||
*
|
||||
* Helper class which holds the details of font icon to be displayed for
|
||||
* {@link Rollout}/ {@link RolloutGroup} / Rollout {@link Target}
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class StatusFontIcon {
|
||||
final FontAwesome fontIcon;
|
||||
final String style;
|
||||
|
||||
public StatusFontIcon(FontAwesome fontIcon, String style) {
|
||||
super();
|
||||
this.fontIcon = fontIcon;
|
||||
this.style = style;
|
||||
}
|
||||
|
||||
public FontAwesome getFontIcon() {
|
||||
return fontIcon;
|
||||
}
|
||||
|
||||
public String getStyle() {
|
||||
return style;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,8 +10,10 @@ package org.eclipse.hawkbit.ui.rollout.rollout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
@@ -27,6 +29,7 @@ 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;
|
||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
@@ -100,6 +103,8 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
@Autowired
|
||||
private transient SpPermissionChecker permissionChecker;
|
||||
|
||||
private transient Map<RolloutStatus, StatusFontIcon> statusIconMap = new EnumMap<>(RolloutStatus.class);
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
@@ -114,9 +119,15 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final RolloutEvent event) {
|
||||
if (event == RolloutEvent.FILTER_BY_TEXT || event == RolloutEvent.CREATE_ROLLOUT
|
||||
|| event == RolloutEvent.UPDATE_ROLLOUT || event == RolloutEvent.SHOW_ROLLOUTS) {
|
||||
switch (event) {
|
||||
case FILTER_BY_TEXT:
|
||||
case CREATE_ROLLOUT:
|
||||
case UPDATE_ROLLOUT:
|
||||
case SHOW_ROLLOUTS:
|
||||
refreshGrid();
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,22 +140,22 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
@SuppressWarnings("unchecked")
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
public void onEvent(final RolloutChangeEvent rolloutChangeEvent) {
|
||||
if (rolloutUIState.isShowRollOuts()) {
|
||||
final Rollout rollout = rolloutManagement.findRolloutWithDetailedStatus(rolloutChangeEvent.getRolloutId());
|
||||
final TotalTargetCountStatus totalTargetCountStatus = rollout.getTotalTargetCountStatus();
|
||||
final LazyQueryContainer rolloutContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
final Item item = rolloutContainer.getItem(rolloutChangeEvent.getRolloutId());
|
||||
if (null != item) {
|
||||
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 (null != rollout.getRolloutGroups() && groupCount != rollout.getRolloutGroups().size()) {
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS)
|
||||
.setValue(Long.valueOf(rollout.getRolloutGroups().size()));
|
||||
}
|
||||
}
|
||||
if (!rolloutUIState.isShowRollOuts()) {
|
||||
return;
|
||||
}
|
||||
final Rollout rollout = rolloutManagement.findRolloutWithDetailedStatus(rolloutChangeEvent.getRolloutId());
|
||||
final TotalTargetCountStatus totalTargetCountStatus = rollout.getTotalTargetCountStatus();
|
||||
final LazyQueryContainer rolloutContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
final Item item = rolloutContainer.getItem(rolloutChangeEvent.getRolloutId());
|
||||
if (item == null) {
|
||||
return;
|
||||
}
|
||||
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()) {
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS)
|
||||
.setValue(Long.valueOf(rollout.getRolloutGroups().size()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,11 +286,32 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
protected void addColumnRenderes() {
|
||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setRenderer(new HtmlRenderer(),
|
||||
new TotalTargetCountStatusConverter());
|
||||
|
||||
createRolloutStatusToFontMap();
|
||||
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)));
|
||||
}
|
||||
|
||||
private void createRolloutStatusToFontMap() {
|
||||
statusIconMap.put(RolloutStatus.FINISHED,
|
||||
new StatusFontIcon(FontAwesome.CHECK_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_GREEN));
|
||||
statusIconMap.put(RolloutStatus.PAUSED,
|
||||
new StatusFontIcon(FontAwesome.PAUSE, SPUIStyleDefinitions.STATUS_ICON_BLUE));
|
||||
statusIconMap.put(RolloutStatus.RUNNING, new StatusFontIcon(null, SPUIStyleDefinitions.STATUS_SPINNER_YELLOW));
|
||||
statusIconMap.put(RolloutStatus.READY,
|
||||
new StatusFontIcon(FontAwesome.DOT_CIRCLE_O, SPUIStyleDefinitions.STATUS_ICON_LIGHT_BLUE));
|
||||
statusIconMap.put(RolloutStatus.STOPPED,
|
||||
new StatusFontIcon(FontAwesome.STOP, SPUIStyleDefinitions.STATUS_ICON_RED));
|
||||
statusIconMap.put(RolloutStatus.CREATING, new StatusFontIcon(null, SPUIStyleDefinitions.STATUS_SPINNER_GREY));
|
||||
statusIconMap.put(RolloutStatus.STARTING, new StatusFontIcon(null, SPUIStyleDefinitions.STATUS_SPINNER_BLUE));
|
||||
statusIconMap.put(RolloutStatus.ERROR_CREATING,
|
||||
new StatusFontIcon(FontAwesome.EXCLAMATION_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_RED));
|
||||
statusIconMap.put(RolloutStatus.ERROR_STARTING,
|
||||
new StatusFontIcon(FontAwesome.EXCLAMATION_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_RED));
|
||||
}
|
||||
|
||||
private void alignColumns() {
|
||||
setCellStyleGenerator(new CellStyleGenerator() {
|
||||
private static final long serialVersionUID = 5573570647129792429L;
|
||||
@@ -313,77 +345,57 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
}
|
||||
|
||||
private ContextMenu createContextMenu(final Long rolloutId) {
|
||||
final ContextMenu context = new ContextMenu();
|
||||
context.addItemClickListener(event -> menuItemClicked(event));
|
||||
final Item row = getContainerDataSource().getItem(rolloutId);
|
||||
final RolloutStatus rolloutStatus = (RolloutStatus) row.getItemProperty(SPUILabelDefinitions.VAR_STATUS)
|
||||
.getValue();
|
||||
final ContextMenu context = new ContextMenu();
|
||||
context.addItemClickListener(event -> menuItemClicked(event));
|
||||
if (rolloutStatus == RolloutStatus.READY) {
|
||||
|
||||
switch (rolloutStatus) {
|
||||
case READY:
|
||||
final ContextMenuItem startItem = context.addItem(START_OPTION);
|
||||
startItem.setData(new ContextMenuData(rolloutId, ACTION.START));
|
||||
} else if (rolloutStatus == RolloutStatus.RUNNING) {
|
||||
final ContextMenuItem pauseItem = context.addItem(PAUSE_OPTION);
|
||||
pauseItem.setData(new ContextMenuData(rolloutId, ACTION.PAUSE));
|
||||
} else if (rolloutStatus == RolloutStatus.PAUSED) {
|
||||
final ContextMenuItem resumeItem = context.addItem(RESUME_OPTION);
|
||||
resumeItem.setData(new ContextMenuData(rolloutId, ACTION.RESUME));
|
||||
} else if (rolloutStatus == RolloutStatus.STARTING || rolloutStatus == RolloutStatus.CREATING) {
|
||||
return context;
|
||||
}
|
||||
if (permissionChecker.hasRolloutUpdatePermission()) {
|
||||
final ContextMenuItem cancelItem = context.addItem(UPDATE_OPTION);
|
||||
cancelItem.setData(new ContextMenuData(rolloutId, ACTION.UPDATE));
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
private String convertRolloutStatusToString(final RolloutStatus value) {
|
||||
String result = null;
|
||||
switch (value) {
|
||||
case FINISHED:
|
||||
result = HawkbitCommonUtil.getStatusLabelDetailsInString(
|
||||
Integer.toString(FontAwesome.CHECK_CIRCLE.getCodepoint()), SPUIStyleDefinitions.STATUS_ICON_GREEN,
|
||||
SPUIComponetIdProvider.ROLLOUT_STATUS_LABEL_ID);
|
||||
break;
|
||||
case PAUSED:
|
||||
result = HawkbitCommonUtil.getStatusLabelDetailsInString(Integer.toString(FontAwesome.PAUSE.getCodepoint()),
|
||||
SPUIStyleDefinitions.STATUS_ICON_BLUE, SPUIComponetIdProvider.ROLLOUT_STATUS_LABEL_ID);
|
||||
break;
|
||||
case RUNNING:
|
||||
result = HawkbitCommonUtil.getStatusLabelDetailsInString(null, SPUIStyleDefinitions.STATUS_SPINNER_YELLOW,
|
||||
SPUIComponetIdProvider.ROLLOUT_STATUS_LABEL_ID);
|
||||
final ContextMenuItem pauseItem = context.addItem(PAUSE_OPTION);
|
||||
pauseItem.setData(new ContextMenuData(rolloutId, ACTION.PAUSE));
|
||||
break;
|
||||
case READY:
|
||||
result = HawkbitCommonUtil.getStatusLabelDetailsInString(
|
||||
Integer.toString(FontAwesome.DOT_CIRCLE_O.getCodepoint()),
|
||||
SPUIStyleDefinitions.STATUS_ICON_LIGHT_BLUE, SPUIComponetIdProvider.ROLLOUT_STATUS_LABEL_ID);
|
||||
break;
|
||||
case STOPPED:
|
||||
result = HawkbitCommonUtil.getStatusLabelDetailsInString(Integer.toString(FontAwesome.STOP.getCodepoint()),
|
||||
SPUIStyleDefinitions.STATUS_ICON_RED, SPUIComponetIdProvider.ROLLOUT_STATUS_LABEL_ID);
|
||||
break;
|
||||
case CREATING:
|
||||
result = HawkbitCommonUtil.getStatusLabelDetailsInString(null, SPUIStyleDefinitions.STATUS_SPINNER_GREY,
|
||||
SPUIComponetIdProvider.ROLLOUT_STATUS_LABEL_ID);
|
||||
case PAUSED:
|
||||
final ContextMenuItem resumeItem = context.addItem(RESUME_OPTION);
|
||||
resumeItem.setData(new ContextMenuData(rolloutId, ACTION.RESUME));
|
||||
break;
|
||||
case STARTING:
|
||||
result = HawkbitCommonUtil.getStatusLabelDetailsInString(null, SPUIStyleDefinitions.STATUS_SPINNER_BLUE,
|
||||
SPUIComponetIdProvider.ROLLOUT_STATUS_LABEL_ID);
|
||||
break;
|
||||
case CREATING:
|
||||
case ERROR_CREATING:
|
||||
result = HawkbitCommonUtil.getStatusLabelDetailsInString(
|
||||
Integer.toString(FontAwesome.EXCLAMATION_CIRCLE.getCodepoint()),
|
||||
SPUIStyleDefinitions.STATUS_ICON_RED, SPUIComponetIdProvider.ROLLOUT_STATUS_LABEL_ID);
|
||||
break;
|
||||
case ERROR_STARTING:
|
||||
result = HawkbitCommonUtil.getStatusLabelDetailsInString(
|
||||
Integer.toString(FontAwesome.EXCLAMATION_CIRCLE.getCodepoint()),
|
||||
SPUIStyleDefinitions.STATUS_ICON_RED, SPUIComponetIdProvider.ROLLOUT_STATUS_LABEL_ID);
|
||||
break;
|
||||
// do not provide any action on these statuses
|
||||
return context;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
getUpdateMenuItem(context, rolloutId);
|
||||
return context;
|
||||
}
|
||||
|
||||
|
||||
private void getUpdateMenuItem(final ContextMenu context, final Long rolloutId) {
|
||||
// Add 'Update' option only if user has update permission
|
||||
if (!permissionChecker.hasRolloutUpdatePermission()) {
|
||||
return;
|
||||
}
|
||||
final ContextMenuItem cancelItem = context.addItem(UPDATE_OPTION);
|
||||
cancelItem.setData(new ContextMenuData(rolloutId, ACTION.UPDATE));
|
||||
}
|
||||
|
||||
private String convertRolloutStatusToString(final RolloutStatus value) {
|
||||
StatusFontIcon statusFontIcon = statusIconMap.get(value);
|
||||
if (statusFontIcon == null) {
|
||||
return null;
|
||||
}
|
||||
String codePoint = statusFontIcon.getFontIcon() != null
|
||||
? Integer.toString(statusFontIcon.getFontIcon().getCodepoint()) : null;
|
||||
return HawkbitCommonUtil.getStatusLabelDetailsInString(codePoint, statusFontIcon.getStyle(),
|
||||
SPUIComponetIdProvider.ROLLOUT_STATUS_LABEL_ID);
|
||||
}
|
||||
|
||||
private void menuItemClicked(final ContextMenuItemClickEvent event) {
|
||||
@@ -391,24 +403,35 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
final ContextMenuData contextMenuData = (ContextMenuData) item.getData();
|
||||
final Item row = getContainerDataSource().getItem(contextMenuData.getRolloutId());
|
||||
final String rolloutName = (String) row.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();
|
||||
if (contextMenuData.getAction() == ACTION.PAUSE) {
|
||||
switch (contextMenuData.getAction()) {
|
||||
case PAUSE:
|
||||
rolloutManagement.pauseRollout(rolloutManagement.findRolloutById(contextMenuData.getRolloutId()));
|
||||
uiNotification.displaySuccess(i18n.get("message.rollout.paused", rolloutName));
|
||||
} else if (contextMenuData.getAction() == ACTION.RESUME) {
|
||||
break;
|
||||
case RESUME:
|
||||
rolloutManagement.resumeRollout(rolloutManagement.findRolloutById(contextMenuData.getRolloutId()));
|
||||
uiNotification.displaySuccess(i18n.get("message.rollout.resumed", rolloutName));
|
||||
} else if (contextMenuData.getAction() == ACTION.START) {
|
||||
break;
|
||||
case START:
|
||||
rolloutManagement.startRolloutAsync(rolloutManagement.findRolloutByName(rolloutName));
|
||||
uiNotification.displaySuccess(i18n.get("message.rollout.started", rolloutName));
|
||||
} else if (contextMenuData.getAction() == ACTION.UPDATE) {
|
||||
addUpdateRolloutWindow.populateData(contextMenuData.getRolloutId());
|
||||
final Window addTargetWindow = addUpdateRolloutWindow.getWindow();
|
||||
addTargetWindow.setCaption(i18n.get("caption.update.rollout"));
|
||||
UI.getCurrent().addWindow(addTargetWindow);
|
||||
addTargetWindow.setVisible(Boolean.TRUE);
|
||||
break;
|
||||
case UPDATE:
|
||||
onUpdate(contextMenuData);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void onUpdate(final ContextMenuData contextMenuData) {
|
||||
addUpdateRolloutWindow.populateData(contextMenuData.getRolloutId());
|
||||
final Window addTargetWindow = addUpdateRolloutWindow.getWindow();
|
||||
addTargetWindow.setCaption(i18n.get("caption.update.rollout"));
|
||||
UI.getCurrent().addWindow(addTargetWindow);
|
||||
addTargetWindow.setVisible(Boolean.TRUE);
|
||||
}
|
||||
|
||||
private void refreshGrid() {
|
||||
((LazyQueryContainer) getContainerDataSource()).refresh();
|
||||
}
|
||||
@@ -443,9 +466,8 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
} else if (SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS.equals(cell.getPropertyId())) {
|
||||
return DistributionBarHelper
|
||||
.getTooltip(((TotalTargetCountStatus) cell.getValue()).getStatusTotalCountMap());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
enum ACTION {
|
||||
@@ -568,6 +590,6 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
public Class<String> getPresentationType() {
|
||||
return String.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,8 +10,10 @@ package org.eclipse.hawkbit.ui.rollout.rolloutgroup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
@@ -26,6 +28,7 @@ import org.eclipse.hawkbit.ui.common.grid.AbstractGrid;
|
||||
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;
|
||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
@@ -76,6 +79,8 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
@Autowired
|
||||
private transient SpPermissionChecker permissionChecker;
|
||||
|
||||
private transient Map<RolloutGroupStatus, StatusFontIcon> statusIconMap = new EnumMap<>(RolloutGroupStatus.class);
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
@@ -90,9 +95,10 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final RolloutEvent event) {
|
||||
if (event == RolloutEvent.SHOW_ROLLOUT_GROUPS) {
|
||||
((LazyQueryContainer) getContainerDataSource()).refresh();
|
||||
if (RolloutEvent.SHOW_ROLLOUT_GROUPS != event) {
|
||||
return;
|
||||
}
|
||||
((LazyQueryContainer) getContainerDataSource()).refresh();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,17 +113,19 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
@SuppressWarnings("unchecked")
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
public void onEvent(final RolloutGroupChangeEvent rolloutGroupChangeEvent) {
|
||||
if (rolloutUIState.isShowRolloutGroups()) {
|
||||
final RolloutGroup rolloutGroup = rolloutGroupManagement
|
||||
.findRolloutGroupWithDetailedStatus(rolloutGroupChangeEvent.getRolloutGroupId());
|
||||
final LazyQueryContainer rolloutContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
final Item item = rolloutContainer.getItem(rolloutGroup.getId());
|
||||
if (item != null) {
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_STATUS).setValue(rolloutGroup.getStatus());
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS)
|
||||
.setValue(rolloutGroup.getTotalTargetCountStatus());
|
||||
}
|
||||
if (!rolloutUIState.isShowRolloutGroups()) {
|
||||
return;
|
||||
}
|
||||
final RolloutGroup rolloutGroup = rolloutGroupManagement
|
||||
.findRolloutGroupWithDetailedStatus(rolloutGroupChangeEvent.getRolloutGroupId());
|
||||
final LazyQueryContainer rolloutContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
final Item item = rolloutContainer.getItem(rolloutGroup.getId());
|
||||
if (item == null) {
|
||||
return;
|
||||
}
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_STATUS).setValue(rolloutGroup.getStatus());
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS)
|
||||
.setValue(rolloutGroup.getTotalTargetCountStatus());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -229,8 +237,10 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
|
||||
@Override
|
||||
protected void addColumnRenderes() {
|
||||
createRolloutGroupStatusToFontMap();
|
||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setRenderer(new HtmlLabelRenderer(),
|
||||
new RolloutGroupStatusConverter());
|
||||
|
||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setRenderer(new HtmlRenderer(),
|
||||
new TotalTargetCountStatusConverter());
|
||||
if (permissionChecker.hasRolloutTargetsReadPermission()) {
|
||||
@@ -255,7 +265,7 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
@Override
|
||||
protected CellDescriptionGenerator getDescriptionGenerator() {
|
||||
return cell -> getDescription(cell);
|
||||
};
|
||||
}
|
||||
|
||||
private void onClickOfRolloutGroupName(RendererClickEvent event) {
|
||||
rolloutUIState
|
||||
@@ -264,40 +274,30 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
}
|
||||
|
||||
private String convertRolloutGroupStatusToString(final RolloutGroupStatus value) {
|
||||
String result = null;
|
||||
switch (value) {
|
||||
case FINISHED:
|
||||
result = HawkbitCommonUtil.getStatusLabelDetailsInString(
|
||||
Integer.toString(FontAwesome.CHECK_CIRCLE.getCodepoint()), SPUIStyleDefinitions.STATUS_ICON_GREEN,
|
||||
SPUIComponetIdProvider.ROLLOUT_GROUP_STATUS_LABEL_ID);
|
||||
break;
|
||||
case SCHEDULED:
|
||||
result = HawkbitCommonUtil.getStatusLabelDetailsInString(
|
||||
Integer.toString(FontAwesome.HOURGLASS_1.getCodepoint()), SPUIStyleDefinitions.STATUS_ICON_PENDING,
|
||||
SPUIComponetIdProvider.ROLLOUT_GROUP_STATUS_LABEL_ID);
|
||||
break;
|
||||
case RUNNING:
|
||||
result = HawkbitCommonUtil.getStatusLabelDetailsInString(
|
||||
Integer.toString(FontAwesome.ADJUST.getCodepoint()), SPUIStyleDefinitions.STATUS_ICON_YELLOW,
|
||||
SPUIComponetIdProvider.ROLLOUT_GROUP_STATUS_LABEL_ID);
|
||||
break;
|
||||
case READY:
|
||||
result = HawkbitCommonUtil.getStatusLabelDetailsInString(
|
||||
Integer.toString(FontAwesome.DOT_CIRCLE_O.getCodepoint()),
|
||||
SPUIStyleDefinitions.STATUS_ICON_LIGHT_BLUE, SPUIComponetIdProvider.ROLLOUT_GROUP_STATUS_LABEL_ID);
|
||||
break;
|
||||
case ERROR:
|
||||
result = HawkbitCommonUtil.getStatusLabelDetailsInString(
|
||||
Integer.toString(FontAwesome.EXCLAMATION_CIRCLE.getCodepoint()),
|
||||
SPUIStyleDefinitions.STATUS_ICON_RED, SPUIComponetIdProvider.ROLLOUT_GROUP_STATUS_LABEL_ID);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
StatusFontIcon statusFontIcon = statusIconMap.get(value);
|
||||
if (statusFontIcon == null) {
|
||||
return null;
|
||||
}
|
||||
return result;
|
||||
String codePoint = statusFontIcon.getFontIcon() != null
|
||||
? Integer.toString(statusFontIcon.getFontIcon().getCodepoint()) : null;
|
||||
return HawkbitCommonUtil.getStatusLabelDetailsInString(codePoint, statusFontIcon.getStyle(),
|
||||
SPUIComponetIdProvider.ROLLOUT_GROUP_STATUS_LABEL_ID);
|
||||
|
||||
}
|
||||
|
||||
private void createRolloutGroupStatusToFontMap() {
|
||||
statusIconMap.put(RolloutGroupStatus.FINISHED,
|
||||
new StatusFontIcon(FontAwesome.CHECK_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_GREEN));
|
||||
statusIconMap.put(RolloutGroupStatus.SCHEDULED,
|
||||
new StatusFontIcon(FontAwesome.HOURGLASS_1, SPUIStyleDefinitions.STATUS_ICON_PENDING));
|
||||
statusIconMap.put(RolloutGroupStatus.RUNNING,
|
||||
new StatusFontIcon(FontAwesome.ADJUST, SPUIStyleDefinitions.STATUS_ICON_YELLOW));
|
||||
statusIconMap.put(RolloutGroupStatus.READY,
|
||||
new StatusFontIcon(FontAwesome.DOT_CIRCLE_O, SPUIStyleDefinitions.STATUS_ICON_LIGHT_BLUE));
|
||||
statusIconMap.put(RolloutGroupStatus.ERROR,
|
||||
new StatusFontIcon(FontAwesome.EXCLAMATION_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_RED));
|
||||
}
|
||||
|
||||
private String getDescription(CellReference cell) {
|
||||
if (SPUILabelDefinitions.VAR_STATUS.equals(cell.getPropertyId())) {
|
||||
return cell.getProperty().getValue().toString().toLowerCase();
|
||||
@@ -308,9 +308,8 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
} else if (SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS.equals(cell.getPropertyId())) {
|
||||
return DistributionBarHelper
|
||||
.getTooltip(((TotalTargetCountStatus) cell.getValue()).getStatusTotalCountMap());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void alignColumns() {
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
package org.eclipse.hawkbit.ui.rollout.rolloutgrouptargets;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
@@ -20,6 +22,7 @@ import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
|
||||
import org.eclipse.hawkbit.ui.common.grid.AbstractGrid;
|
||||
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlLabelRenderer;
|
||||
import org.eclipse.hawkbit.ui.rollout.StatusFontIcon;
|
||||
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
@@ -27,6 +30,7 @@ import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||
@@ -61,6 +65,8 @@ public class RolloutGroupTargetsListGrid extends AbstractGrid {
|
||||
@Autowired
|
||||
private transient RolloutUIState rolloutUIState;
|
||||
|
||||
private transient Map<Status, StatusFontIcon> statusIconMap = new EnumMap<>(Status.class);
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
@@ -75,10 +81,11 @@ public class RolloutGroupTargetsListGrid extends AbstractGrid {
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final RolloutEvent event) {
|
||||
if (event == RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS) {
|
||||
((LazyQueryContainer) getContainerDataSource()).refresh();
|
||||
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS_COUNT);
|
||||
if (RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS != event) {
|
||||
return;
|
||||
}
|
||||
((LazyQueryContainer) getContainerDataSource()).refresh();
|
||||
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS_COUNT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -165,20 +172,19 @@ public class RolloutGroupTargetsListGrid extends AbstractGrid {
|
||||
|
||||
@Override
|
||||
protected void addColumnRenderes() {
|
||||
createRolloutStatusToFontMap();
|
||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setRenderer(new HtmlLabelRenderer(), new StatusConverter());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setHiddenColumns() {
|
||||
/**
|
||||
* No hidden columns.
|
||||
*/
|
||||
// No hidden columns
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CellDescriptionGenerator getDescriptionGenerator() {
|
||||
return cell -> getDescription(cell);
|
||||
};
|
||||
}
|
||||
|
||||
private void alignColumns() {
|
||||
setCellStyleGenerator(new CellStyleGenerator() {
|
||||
@@ -218,9 +224,8 @@ public class RolloutGroupTargetsListGrid extends AbstractGrid {
|
||||
// In these cases display a appropriate status with
|
||||
// description
|
||||
return getStatus();
|
||||
} else {
|
||||
return processActionStatus(status);
|
||||
}
|
||||
return processActionStatus(status);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -236,39 +241,34 @@ public class RolloutGroupTargetsListGrid extends AbstractGrid {
|
||||
}
|
||||
|
||||
private String processActionStatus(final Status status) {
|
||||
String result = null;
|
||||
switch (status) {
|
||||
case FINISHED:
|
||||
result = HawkbitCommonUtil.getStatusLabelDetailsInString(
|
||||
Integer.toString(FontAwesome.CHECK_CIRCLE.getCodepoint()), "statusIconGreen", null);
|
||||
break;
|
||||
case SCHEDULED:
|
||||
result = HawkbitCommonUtil.getStatusLabelDetailsInString(
|
||||
Integer.toString(FontAwesome.HOURGLASS_1.getCodepoint()), "statusIconPending", null);
|
||||
break;
|
||||
case RUNNING:
|
||||
case RETRIEVED:
|
||||
case WARNING:
|
||||
case DOWNLOAD:
|
||||
result = HawkbitCommonUtil.getStatusLabelDetailsInString(
|
||||
Integer.toString(FontAwesome.ADJUST.getCodepoint()), "statusIconYellow", null);
|
||||
break;
|
||||
case CANCELING:
|
||||
result = HawkbitCommonUtil.getStatusLabelDetailsInString(
|
||||
Integer.toString(FontAwesome.TIMES_CIRCLE.getCodepoint()), "statusIconPending", null);
|
||||
break;
|
||||
case CANCELED:
|
||||
result = HawkbitCommonUtil.getStatusLabelDetailsInString(
|
||||
Integer.toString(FontAwesome.TIMES_CIRCLE.getCodepoint()), "statusIconGreen", null);
|
||||
break;
|
||||
case ERROR:
|
||||
result = HawkbitCommonUtil.getStatusLabelDetailsInString(
|
||||
Integer.toString(FontAwesome.EXCLAMATION_CIRCLE.getCodepoint()), "statusIconRed", null);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
StatusFontIcon statusFontIcon = statusIconMap.get(status);
|
||||
if (statusFontIcon == null) {
|
||||
return null;
|
||||
}
|
||||
return result;
|
||||
String codePoint = statusFontIcon.getFontIcon() != null
|
||||
? Integer.toString(statusFontIcon.getFontIcon().getCodepoint()) : null;
|
||||
return HawkbitCommonUtil.getStatusLabelDetailsInString(codePoint, statusFontIcon.getStyle(), null);
|
||||
}
|
||||
|
||||
private void createRolloutStatusToFontMap() {
|
||||
statusIconMap.put(Status.FINISHED,
|
||||
new StatusFontIcon(FontAwesome.CHECK_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_GREEN));
|
||||
statusIconMap.put(Status.SCHEDULED,
|
||||
new StatusFontIcon(FontAwesome.HOURGLASS_1, SPUIStyleDefinitions.STATUS_ICON_PENDING));
|
||||
statusIconMap.put(Status.RUNNING,
|
||||
new StatusFontIcon(FontAwesome.ADJUST, SPUIStyleDefinitions.STATUS_ICON_YELLOW));
|
||||
statusIconMap.put(Status.RETRIEVED,
|
||||
new StatusFontIcon(FontAwesome.ADJUST, SPUIStyleDefinitions.STATUS_ICON_YELLOW));
|
||||
statusIconMap.put(Status.WARNING,
|
||||
new StatusFontIcon(FontAwesome.ADJUST, SPUIStyleDefinitions.STATUS_ICON_YELLOW));
|
||||
statusIconMap.put(Status.DOWNLOAD,
|
||||
new StatusFontIcon(FontAwesome.ADJUST, SPUIStyleDefinitions.STATUS_ICON_YELLOW));
|
||||
statusIconMap.put(Status.CANCELING,
|
||||
new StatusFontIcon(FontAwesome.TIMES_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_PENDING));
|
||||
statusIconMap.put(Status.CANCELED,
|
||||
new StatusFontIcon(FontAwesome.TIMES_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_GREEN));
|
||||
statusIconMap.put(Status.ERROR,
|
||||
new StatusFontIcon(FontAwesome.EXCLAMATION_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_RED));
|
||||
}
|
||||
|
||||
private String getStatus() {
|
||||
@@ -287,16 +287,16 @@ public class RolloutGroupTargetsListGrid extends AbstractGrid {
|
||||
}
|
||||
|
||||
private String getDescription(CellReference cell) {
|
||||
if (SPUILabelDefinitions.VAR_STATUS.equals(cell.getPropertyId())) {
|
||||
if (null != cell.getProperty().getValue()) {
|
||||
return cell.getProperty().getValue().toString().toLowerCase();
|
||||
|
||||
} else {
|
||||
return getDescriptionWhenNoAction();
|
||||
}
|
||||
if (!SPUILabelDefinitions.VAR_STATUS.equals(cell.getPropertyId())) {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
if (cell.getProperty().getValue() == null) {
|
||||
// status could be null when there is no action.
|
||||
return getDescriptionWhenNoAction();
|
||||
}
|
||||
return cell.getProperty().getValue().toString().toLowerCase();
|
||||
}
|
||||
|
||||
|
||||
private String getDescriptionWhenNoAction() {
|
||||
final RolloutGroup rolloutGroup = rolloutUIState.getRolloutGroup().isPresent()
|
||||
@@ -307,8 +307,7 @@ public class RolloutGroupTargetsListGrid extends AbstractGrid {
|
||||
String ds = rolloutUIState.getRolloutDistributionSet().isPresent()
|
||||
? rolloutUIState.getRolloutDistributionSet().get() : "";
|
||||
return i18n.get("message.dist.already.assigned", new Object[] { ds });
|
||||
} else {
|
||||
return "unknown";
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1361,14 +1361,13 @@ public final class HawkbitCommonUtil {
|
||||
*/
|
||||
public static String getFormattedString(Map<Status, Long> details) {
|
||||
StringBuilder val = new StringBuilder();
|
||||
String finalVal = null;
|
||||
if (null != details && !details.isEmpty()) {
|
||||
for (Entry<Status, Long> entry : details.entrySet()) {
|
||||
val.append(entry.getKey()).append(":").append(entry.getValue()).append(",");
|
||||
}
|
||||
finalVal = val.substring(0, val.length() - 1);
|
||||
return val.substring(0, val.length() - 1);
|
||||
}
|
||||
return finalVal;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user