Merge branch 'master' into MECS-1454_Search_filter_improvements
Conflicts: hawkbit-ui/src/main/resources/messages.properties hawkbit-ui/src/main/resources/messages_de.properties hawkbit-ui/src/main/resources/messages_en.properties
This commit is contained in:
@@ -139,4 +139,42 @@ public class SpPermissionChecker implements Serializable {
|
||||
return hasReadDistributionPermission() && permissionService.hasPermission(SpPermission.DELETE_REPOSITORY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the SP rollout create permission.
|
||||
*
|
||||
* @return permission for rollout update
|
||||
*/
|
||||
public boolean hasRolloutUpdatePermission() {
|
||||
return hasUpdateTargetPermission() && hasReadDistributionPermission()
|
||||
&& permissionService.hasPermission(SpPermission.ROLLOUT_MANAGEMENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the SP rollout create permission.
|
||||
*
|
||||
* @return permission for rollout create
|
||||
*/
|
||||
public boolean hasRolloutCreatePermission() {
|
||||
return hasUpdateTargetPermission() && hasReadDistributionPermission()
|
||||
&& permissionService.hasPermission(SpPermission.ROLLOUT_MANAGEMENT);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Gets the SP rollout read permission.
|
||||
*
|
||||
* @return Gets the SP rollout read permission.
|
||||
*/
|
||||
public boolean hasRolloutReadPermission() {
|
||||
return permissionService.hasPermission(SpPermission.ROLLOUT_MANAGEMENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the SP rollout targets read permission.
|
||||
*
|
||||
* @return permission to read rollout targets
|
||||
*/
|
||||
public boolean hasRolloutTargetsReadPermission() {
|
||||
return hasTargetReadPermission() && permissionService.hasPermission(SpPermission.ROLLOUT_MANAGEMENT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,4 +21,10 @@
|
||||
|
||||
<inherits name="org.vaadin.tokenfield.TokenfieldWidgetset" />
|
||||
|
||||
|
||||
<inherits name="org.vaadin.alump.distributionbar.gwt.DistributionBarWidgetset" />
|
||||
|
||||
|
||||
|
||||
<inherits name="org.vaadin.peter.contextmenu.ContextmenuWidgetset" />
|
||||
</module>
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.vaadin.server.Resource;
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
@Order(400)
|
||||
@Order(500)
|
||||
public class UploadArtifactViewMenuItem implements DashboardMenuItem {
|
||||
|
||||
private static final long serialVersionUID = 4096851897640769726L;
|
||||
|
||||
@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.ui.components;
|
||||
import java.net.URI;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||
@@ -53,6 +54,8 @@ public class ProxyTarget extends Target {
|
||||
|
||||
private String modifiedByUser;
|
||||
|
||||
private Status status;
|
||||
|
||||
/**
|
||||
* @param controllerId
|
||||
*/
|
||||
@@ -297,4 +300,19 @@ public class ProxyTarget extends Target {
|
||||
public void setPollStatusToolTip(final String pollStatusToolTip) {
|
||||
this.pollStatusToolTip = pollStatusToolTip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the status
|
||||
*/
|
||||
public Status getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param status
|
||||
* the status to set
|
||||
*/
|
||||
public void setStatus(final Status status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.vaadin.server.Resource;
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
@Order(300)
|
||||
@Order(400)
|
||||
public class DistributionsViewMenuItem implements DashboardMenuItem {
|
||||
|
||||
private static final long serialVersionUID = -4048522766974227222L;
|
||||
|
||||
@@ -45,7 +45,10 @@ public enum DocumentationPageLink {
|
||||
TARGET_SECURITY_TOKEN("security.html", DocumentationUtil.DEVELOPERGUIDE, "concepts"),
|
||||
|
||||
// userguide/targetfilter
|
||||
TARGET_FILTER_VIEW("targetfilter.html", DocumentationUtil.USERGUIDE);
|
||||
TARGET_FILTER_VIEW("targetfilter.html", DocumentationUtil.USERGUIDE),
|
||||
|
||||
// userguide/ROLLOUT
|
||||
ROLLOUT_VIEW("rollout.html", DocumentationUtil.USERGUIDE);
|
||||
|
||||
private static final String ROOT_PATH = "../documentation";
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ public class CreateOrUpdateFilterTable extends Table {
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER, i18n
|
||||
.get("header.installed.ds"), 0.125F));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_DESC, i18n.get("header.description"), 0.1F));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.STATUS_ICON, i18n.get("header.target.status"), 0.1F));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.STATUS_ICON, i18n.get("header.status"), 0.1F));
|
||||
return columnList;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.vaadin.server.Resource;
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
@Order(200)
|
||||
@Order(300)
|
||||
public class FilterManagementViewMenuItem implements DashboardMenuItem {
|
||||
|
||||
private static final long serialVersionUID = -1272853053031512243L;
|
||||
|
||||
@@ -63,20 +63,20 @@ public final class FilterQueryValidation {
|
||||
setExceptionDetails(new Exception(ex.getCause().getCause()), expectedTokens, result, tokenDesc);
|
||||
result.setMessage(getCustomMessage(ex.getCause().getMessage(), result.getExpectedTokens()));
|
||||
result.setIsValidationFailed(Boolean.TRUE);
|
||||
LOGGER.info("Syntax exception on parsing :", ex);
|
||||
LOGGER.trace("Syntax exception on parsing :", ex);
|
||||
} catch (final RSQLParserException ex) {
|
||||
setExceptionDetails(ex, expectedTokens, result, tokenDesc);
|
||||
result.setMessage(getCustomMessage(ex.getMessage(), result.getExpectedTokens()));
|
||||
result.setIsValidationFailed(Boolean.TRUE);
|
||||
LOGGER.info("Exception on parsing :", ex);
|
||||
LOGGER.trace("Exception on parsing :", ex);
|
||||
} catch (final IllegalArgumentException ex) {
|
||||
result.setMessage(getCustomMessage(ex.getMessage(), null));
|
||||
result.setIsValidationFailed(Boolean.TRUE);
|
||||
LOGGER.info("Illegal argument on parsing :", ex);
|
||||
LOGGER.trace("Illegal argument on parsing :", ex);
|
||||
} catch (final RSQLParameterUnsupportedFieldException ex) {
|
||||
result.setMessage(getCustomMessage(ex.getMessage(), null));
|
||||
result.setIsValidationFailed(Boolean.TRUE);
|
||||
LOGGER.info("Unsupported field on parsing :", ex);
|
||||
LOGGER.trace("Unsupported field on parsing :", ex);
|
||||
}
|
||||
return result;
|
||||
|
||||
|
||||
@@ -97,6 +97,7 @@ public class TargetFilterBeanQuery extends AbstractBeanQuery<ProxyTargetFilter>
|
||||
proxyTarFilter.setCreatedBy(HawkbitCommonUtil.getIMUser(tarFilterQuery.getCreatedBy()));
|
||||
proxyTarFilter.setModifiedDate(SPDateTimeUtil.getFormattedDate(tarFilterQuery.getLastModifiedAt()));
|
||||
proxyTarFilter.setLastModifiedBy(HawkbitCommonUtil.getIMUser(tarFilterQuery.getLastModifiedBy()));
|
||||
proxyTarFilter.setQuery(tarFilterQuery.getQuery());
|
||||
proxyTargetFilter.add(proxyTarFilter);
|
||||
}
|
||||
return proxyTargetFilter;
|
||||
|
||||
@@ -142,6 +142,15 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
createContainer();
|
||||
setContainerDataSource(hierarchicalContainer);
|
||||
addGeneratedColumns();
|
||||
setColumnExpandRatioForMinimisedTable();
|
||||
}
|
||||
|
||||
private void setColumnExpandRatioForMinimisedTable() {
|
||||
setColumnExpandRatio(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID, 0.1f);
|
||||
setColumnExpandRatio(SPUIDefinitions.ACTION_HIS_TBL_DIST, 0.3f);
|
||||
setColumnExpandRatio(SPUIDefinitions.ACTION_HIS_TBL_STATUS, 0.15f);
|
||||
setColumnExpandRatio(SPUIDefinitions.ACTION_HIS_TBL_DATETIME, 0.3f);
|
||||
setColumnExpandRatio(SPUIDefinitions.ACTION_HIS_TBL_FORCED, 0.15f);
|
||||
}
|
||||
|
||||
private void initializeTableSettings() {
|
||||
@@ -190,7 +199,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
hierarchicalContainer.addContainerProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN, Action.Status.class,
|
||||
null);
|
||||
hierarchicalContainer.addContainerProperty(SPUIDefinitions.ACTION_HIS_TBL_MSGS_HIDDEN, List.class, null);
|
||||
|
||||
hierarchicalContainer.addContainerProperty(SPUIDefinitions.ACTION_HIS_TBL_ROLLOUT_NAME, String.class, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,6 +218,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
visibleColumnIds.add(SPUIDefinitions.ACTION_HIS_TBL_STATUS);
|
||||
visibleColumnIds.add(SPUIDefinitions.ACTION_HIS_TBL_FORCED);
|
||||
if (managementUIState.isActionHistoryMaximized()) {
|
||||
visibleColumnIds.add(SPUIDefinitions.ACTION_HIS_TBL_ROLLOUT_NAME);
|
||||
visibleColumnIds.add(SPUIDefinitions.ACTION_HIS_TBL_MSGS);
|
||||
visibleColumnIds.add(1, SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID);
|
||||
}
|
||||
@@ -265,14 +275,14 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
|
||||
final Item item = hierarchicalContainer.addItem(actionWithStatusCount.getActionId());
|
||||
|
||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN)
|
||||
.setValue(actionWithStatusCount.getActionStatus());
|
||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN).setValue(
|
||||
actionWithStatusCount.getActionStatus());
|
||||
|
||||
/*
|
||||
* add action id.
|
||||
*/
|
||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID)
|
||||
.setValue(actionWithStatusCount.getActionId().toString());
|
||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID).setValue(
|
||||
actionWithStatusCount.getActionId().toString());
|
||||
/*
|
||||
* add active/inactive status to the item which will be used in
|
||||
* Column generator to generate respective icon
|
||||
@@ -284,24 +294,28 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
* add action Id to the item which will be used for fetching child
|
||||
* items ( previous action status ) during expand
|
||||
*/
|
||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID_HIDDEN)
|
||||
.setValue(actionWithStatusCount.getActionId());
|
||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID_HIDDEN).setValue(
|
||||
actionWithStatusCount.getActionId());
|
||||
|
||||
/*
|
||||
* add distribution name to the item which will be displayed in the
|
||||
* table. The name should not exceed certain limit.
|
||||
*/
|
||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST).setValue(HawkbitCommonUtil
|
||||
.getFormattedText(actionWithStatusCount.getDsName() + ":" + actionWithStatusCount.getDsVersion()));
|
||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST).setValue(
|
||||
HawkbitCommonUtil.getFormattedText(actionWithStatusCount.getDsName() + ":"
|
||||
+ actionWithStatusCount.getDsVersion()));
|
||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_FORCED).setValue(action);
|
||||
|
||||
/* Default no child */
|
||||
((Hierarchical) hierarchicalContainer).setChildrenAllowed(actionWithStatusCount.getActionId(), false);
|
||||
|
||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DATETIME)
|
||||
.setValue(SPDateTimeUtil.getFormattedDate((actionWithStatusCount.getActionLastModifiedAt() != null)
|
||||
? actionWithStatusCount.getActionLastModifiedAt()
|
||||
: actionWithStatusCount.getActionCreatedAt()));
|
||||
.setValue(
|
||||
SPDateTimeUtil.getFormattedDate((actionWithStatusCount.getActionLastModifiedAt() != null) ? actionWithStatusCount
|
||||
.getActionLastModifiedAt() : actionWithStatusCount.getActionCreatedAt()));
|
||||
|
||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ROLLOUT_NAME).setValue(
|
||||
actionWithStatusCount.getRolloutName());
|
||||
|
||||
if (actionWithStatusCount.getActionStatusCount() > 0) {
|
||||
((Hierarchical) hierarchicalContainer).setChildrenAllowed(actionWithStatusCount.getActionId(), true);
|
||||
@@ -338,9 +352,6 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
return getForcedColumn(itemId);
|
||||
}
|
||||
});
|
||||
setColumnExpandRatio(SPUIDefinitions.ACTION_HIS_TBL_DIST, 0.4f);
|
||||
setColumnExpandRatio(SPUIDefinitions.ACTION_HIS_TBL_STATUS, 0.2f);
|
||||
setColumnExpandRatio(SPUIDefinitions.ACTION_HIS_TBL_DATETIME, 0.4f);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -368,14 +379,21 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
* @return
|
||||
*/
|
||||
private Component getActiveColumn(final Object itemId) {
|
||||
final String activeValue = (String) hierarchicalContainer.getItem(itemId)
|
||||
.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTIVE_HIDDEN).getValue();
|
||||
final Action.Status status = (Action.Status) hierarchicalContainer.getItem(itemId)
|
||||
.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN).getValue();
|
||||
String activeValue;
|
||||
if (status == Action.Status.SCHEDULED) {
|
||||
activeValue = Action.Status.SCHEDULED.toString().toLowerCase();
|
||||
} else {
|
||||
activeValue = (String) hierarchicalContainer.getItem(itemId)
|
||||
.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTIVE_HIDDEN).getValue();
|
||||
}
|
||||
final String distName = (String) hierarchicalContainer.getItem(itemId)
|
||||
.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST).getValue();
|
||||
final Label activeStatusIcon = createActiveStatusLabel(activeValue,
|
||||
final Label activeStatusIcon = createActiveStatusLabel(
|
||||
activeValue,
|
||||
(Action.Status) hierarchicalContainer.getItem(itemId)
|
||||
.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN)
|
||||
.getValue() == Action.Status.ERROR);
|
||||
.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN).getValue() == Action.Status.ERROR);
|
||||
activeStatusIcon.setId(new StringJoiner(".").add(distName).add(itemId.toString())
|
||||
.add(SPUIDefinitions.ACTION_HIS_TBL_ACTIVE).add(activeValue).toString());
|
||||
return activeStatusIcon;
|
||||
@@ -429,14 +447,14 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
*/
|
||||
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTIVE_HIDDEN).setValue("");
|
||||
|
||||
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST)
|
||||
.setValue(HawkbitCommonUtil.getFormattedText(action.getDistributionSet().getName() + ":"
|
||||
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST).setValue(
|
||||
HawkbitCommonUtil.getFormattedText(action.getDistributionSet().getName() + ":"
|
||||
+ action.getDistributionSet().getVersion()));
|
||||
|
||||
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DATETIME)
|
||||
.setValue(SPDateTimeUtil.getFormattedDate(actionStatus.getCreatedAt()));
|
||||
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN)
|
||||
.setValue(actionStatus.getStatus());
|
||||
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DATETIME).setValue(
|
||||
SPDateTimeUtil.getFormattedDate(actionStatus.getCreatedAt()));
|
||||
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN).setValue(
|
||||
actionStatus.getStatus());
|
||||
showOrHideMessage(childItem, actionStatus);
|
||||
/* No further child items allowed for the child items */
|
||||
((Hierarchical) hierarchicalContainer).setChildrenAllowed(childId, false);
|
||||
@@ -512,6 +530,10 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
label.setStyleName(statusIconPending);
|
||||
label.setDescription(i18n.get("label.download"));
|
||||
label.setValue(FontAwesome.CLOUD_DOWNLOAD.getHtml());
|
||||
} else if (Action.Status.SCHEDULED == status) {
|
||||
label.setStyleName(statusIconPending);
|
||||
label.setDescription(i18n.get("label.scheduled"));
|
||||
label.setValue(FontAwesome.BULLSEYE.getHtml());
|
||||
} else {
|
||||
label.setDescription("");
|
||||
label.setValue("");
|
||||
@@ -539,11 +561,13 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
if (actionWithActiveStatus.isHitAutoForceTime(currentTimeMillis)) {
|
||||
autoForceLabel.setDescription("autoforced");
|
||||
autoForceLabel.setStyleName(STATUS_ICON_GREEN);
|
||||
autoForceLabel.setDescription("auto forced since " + SPDateTimeUtil
|
||||
.getDurationFormattedString(actionWithActiveStatus.getForcedTime(), currentTimeMillis, i18n));
|
||||
autoForceLabel.setDescription("auto forced since "
|
||||
+ SPDateTimeUtil.getDurationFormattedString(actionWithActiveStatus.getForcedTime(),
|
||||
currentTimeMillis, i18n));
|
||||
} else {
|
||||
autoForceLabel.setDescription("auto forcing in " + SPDateTimeUtil
|
||||
.getDurationFormattedString(currentTimeMillis, actionWithActiveStatus.getForcedTime(), i18n));
|
||||
autoForceLabel.setDescription("auto forcing in "
|
||||
+ SPDateTimeUtil.getDurationFormattedString(currentTimeMillis,
|
||||
actionWithActiveStatus.getForcedTime(), i18n));
|
||||
autoForceLabel.setStyleName("statusIconPending");
|
||||
autoForceLabel.setValue(FontAwesome.HISTORY.getHtml());
|
||||
}
|
||||
@@ -560,7 +584,10 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
private Label createActiveStatusLabel(final String activeValue, final boolean endedWithError) {
|
||||
final Label label = SPUIComponentProvider.getLabel("", SPUILabelDefinitions.SP_LABEL_SIMPLE);
|
||||
label.setContentMode(ContentMode.HTML);
|
||||
if (SPUIDefinitions.ACTIVE.equals(activeValue)) {
|
||||
if (SPUIDefinitions.SCHEDULED.equals(activeValue)) {
|
||||
label.setDescription("Scheduled");
|
||||
label.setValue(FontAwesome.BULLSEYE.getHtml());
|
||||
} else if (SPUIDefinitions.ACTIVE.equals(activeValue)) {
|
||||
label.setDescription("Active");
|
||||
label.setStyleName("statusIconActive");
|
||||
} else if (SPUIDefinitions.IN_ACTIVE.equals(activeValue)) {
|
||||
@@ -605,11 +632,19 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
}
|
||||
});
|
||||
setVisibleColumns(getVisbleColumns().toArray());
|
||||
/* set messages column can expand the rest of the available space */
|
||||
setColumnExpandRatio(SPUIDefinitions.ACTION_HIS_TBL_DIST, 0.3f);
|
||||
setColumnExpandRatio(SPUIDefinitions.ACTION_HIS_TBL_MSGS, 0.7f);
|
||||
setColumnExpandRatio(SPUIDefinitions.ACTION_HIS_TBL_DATETIME, 0.3f);
|
||||
setColumnExpantRatioOnTableMaximize();
|
||||
}
|
||||
|
||||
private void setColumnExpantRatioOnTableMaximize() {
|
||||
/* set messages column can expand the rest of the available space */
|
||||
setColumnExpandRatio(SPUIDefinitions.ACTION_HIS_TBL_ACTIVE, 0.1f);
|
||||
setColumnExpandRatio(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID, 0.1f);
|
||||
setColumnExpandRatio(SPUIDefinitions.ACTION_HIS_TBL_STATUS, 0.1f);
|
||||
setColumnExpandRatio(SPUIDefinitions.ACTION_HIS_TBL_DIST, 0.2f);
|
||||
setColumnExpandRatio(SPUIDefinitions.ACTION_HIS_TBL_FORCED, 0.1f);
|
||||
setColumnExpandRatio(SPUIDefinitions.ACTION_HIS_TBL_ROLLOUT_NAME, 0.1f);
|
||||
setColumnExpandRatio(SPUIDefinitions.ACTION_HIS_TBL_MSGS, 0.35f);
|
||||
setColumnExpandRatio(SPUIDefinitions.ACTION_HIS_TBL_DATETIME, 0.15f);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -668,8 +703,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
managementUIState.setActionHistoryMaximized(false);
|
||||
removeGeneratedColumn(SPUIDefinitions.ACTION_HIS_TBL_MSGS);
|
||||
setVisibleColumns(getVisbleColumns().toArray());
|
||||
setColumnExpandRatio(SPUIDefinitions.ACTION_HIS_TBL_DIST, 0.6f);
|
||||
setColumnExpandRatio(SPUIDefinitions.ACTION_HIS_TBL_DATETIME, 0.4f);
|
||||
setColumnExpandRatioForMinimisedTable();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -742,8 +776,9 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
|
||||
private void confirmAndForceQuitAction(final Long actionId) {
|
||||
/* Display the confirmation */
|
||||
final ConfirmationDialog confirmDialog = new ConfirmationDialog(i18n.get("caption.forcequit.action.confirmbox"),
|
||||
i18n.get("message.forcequit.action.confirm"), i18n.get("button.ok"), i18n.get("button.cancel"), ok -> {
|
||||
final ConfirmationDialog confirmDialog = new ConfirmationDialog(
|
||||
i18n.get("caption.forcequit.action.confirmbox"), i18n.get("message.forcequit.action.confirm"),
|
||||
i18n.get("button.ok"), i18n.get("button.cancel"), ok -> {
|
||||
if (ok) {
|
||||
final boolean cancelResult = forceQuitActiveAction(actionId);
|
||||
if (cancelResult) {
|
||||
@@ -758,7 +793,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
notification.displayValidationError(i18n.get("message.forcequit.action.failed"));
|
||||
}
|
||||
}
|
||||
} , FontAwesome.WARNING);
|
||||
}, FontAwesome.WARNING);
|
||||
UI.getCurrent().addWindow(confirmDialog.getWindow());
|
||||
confirmDialog.getWindow().bringToFront();
|
||||
}
|
||||
@@ -845,8 +880,8 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
|
||||
if (managementUIState.getDistributionTableFilters().getPinnedTargetId().isPresent()
|
||||
&& null != managementUIState.getDistributionTableFilters().getPinnedTargetId().get()) {
|
||||
final String alreadyPinnedControllerId = managementUIState.getDistributionTableFilters().getPinnedTargetId()
|
||||
.get();
|
||||
final String alreadyPinnedControllerId = managementUIState.getDistributionTableFilters()
|
||||
.getPinnedTargetId().get();
|
||||
// if the current target is pinned publish a pin event again
|
||||
if (null != alreadyPinnedControllerId && alreadyPinnedControllerId.equals(target.getControllerId())) {
|
||||
eventBus.publish(this, PinUnpinEvent.PIN_TARGET);
|
||||
|
||||
@@ -18,7 +18,6 @@ import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssigmentResult;
|
||||
import org.eclipse.hawkbit.ui.management.state.DistributionTableFilters;
|
||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
@@ -69,9 +68,6 @@ public class DistributionTagDropEvent implements DropHandler {
|
||||
@Autowired
|
||||
private ManagementViewAcceptCriteria managementViewAcceptCriteria;
|
||||
|
||||
@Autowired
|
||||
private ManagementUIState managementUIState;
|
||||
|
||||
private static final String ITEMID = "itemId";
|
||||
|
||||
@Override
|
||||
@@ -90,8 +86,8 @@ public class DistributionTagDropEvent implements DropHandler {
|
||||
private Boolean isNoTagAssigned(final DragAndDropEvent event) {
|
||||
final String tagName = ((DragAndDropWrapper) (event.getTargetDetails().getTarget())).getData().toString();
|
||||
if (tagName.equals(SPUIDefinitions.DISTRIBUTION_TAG_BUTTON)) {
|
||||
notification.displayValidationError(
|
||||
i18n.get("message.tag.cannot.be.assigned", new Object[] { i18n.get("label.no.tag.assigned") }));
|
||||
notification.displayValidationError(i18n.get("message.tag.cannot.be.assigned",
|
||||
new Object[] { i18n.get("label.no.tag.assigned") }));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -176,8 +172,8 @@ public class DistributionTagDropEvent implements DropHandler {
|
||||
SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS);
|
||||
|
||||
final List<String> tagsClickedList = distFilterParameters.getDistSetTags();
|
||||
final DistributionSetTagAssigmentResult result = distributionSetManagement.toggleTagAssignment(distributionList,
|
||||
distTagName);
|
||||
final DistributionSetTagAssigmentResult result = distributionSetManagement.toggleTagAssignment(
|
||||
distributionList, distTagName);
|
||||
|
||||
notification.displaySuccess(HawkbitCommonUtil.getDistributionTagAssignmentMsg(distTagName, result, i18n));
|
||||
if (result.getUnassigned() >= 1 && !tagsClickedList.isEmpty()) {
|
||||
|
||||
@@ -127,8 +127,8 @@ public class ActionTypeOptionGroupLayout extends HorizontalLayout {
|
||||
forcedTimeDateField.setStyleName("dist-window-forcedtime");
|
||||
|
||||
final TimeZone tz = SPDateTimeUtil.getBrowserTimeZone();
|
||||
forcedTimeDateField.setValue(
|
||||
Date.from(LocalDateTime.now().plusWeeks(2).atZone(SPDateTimeUtil.getTimeZoneId(tz)).toInstant()));
|
||||
forcedTimeDateField.setValue(Date.from(LocalDateTime.now().plusWeeks(2)
|
||||
.atZone(SPDateTimeUtil.getTimeZoneId(tz)).toInstant()));
|
||||
forcedTimeDateField.setImmediate(true);
|
||||
forcedTimeDateField.setTimeZone(tz);
|
||||
forcedTimeDateField.setLocale(i18n.getLocale());
|
||||
@@ -145,7 +145,7 @@ public class ActionTypeOptionGroupLayout extends HorizontalLayout {
|
||||
actionTypeOptionGroup.select(ActionTypeOption.FORCED);
|
||||
}
|
||||
|
||||
enum ActionTypeOption {
|
||||
public enum ActionTypeOption {
|
||||
FORCED(ActionType.FORCED), SOFT(ActionType.SOFT), AUTO_FORCED(ActionType.TIMEFORCED);
|
||||
|
||||
private final ActionType actionType;
|
||||
|
||||
@@ -207,39 +207,12 @@ public class BulkUploadHandler extends CustomComponent
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
long innerCounter = 0;
|
||||
String line;
|
||||
if (tempFile == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try (InputStream tempStream = new FileInputStream(tempFile)) {
|
||||
try (BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(tempStream, Charset.defaultCharset()))) {
|
||||
LOG.info("Bulk file upload started");
|
||||
final double totalFileSize = getTotalNumberOfLines();
|
||||
|
||||
/**
|
||||
* Once control is in upload succeeded method automatically
|
||||
* upload button is re-enabled. To disable the button firing
|
||||
* below event.
|
||||
*/
|
||||
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.BULK_UPLOAD_PROCESS_STARTED));
|
||||
while ((line = reader.readLine()) != null) {
|
||||
innerCounter++;
|
||||
readEachLine(line, innerCounter, totalFileSize);
|
||||
}
|
||||
doAssignments();
|
||||
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.BULK_UPLOAD_COMPLETED));
|
||||
|
||||
// Clearing after assignments are done
|
||||
managementUIState.getTargetTableFilters().getBulkUpload().getTargetsCreated().clear();
|
||||
} catch (final IOException e) {
|
||||
LOG.error("Error reading file {}", tempFile.getName(), e);
|
||||
} finally {
|
||||
resetCounts();
|
||||
deleteFile();
|
||||
}
|
||||
readFileStream(tempStream);
|
||||
} catch (final FileNotFoundException e) {
|
||||
LOG.error("Temporary file not found with name {}", tempFile.getName(), e);
|
||||
} catch (final IOException e) {
|
||||
@@ -248,6 +221,37 @@ public class BulkUploadHandler extends CustomComponent
|
||||
|
||||
}
|
||||
|
||||
private void readFileStream(final InputStream tempStream) {
|
||||
String line;
|
||||
try (BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(tempStream, Charset.defaultCharset()))) {
|
||||
LOG.info("Bulk file upload started");
|
||||
long innerCounter = 0;
|
||||
final double totalFileSize = getTotalNumberOfLines();
|
||||
|
||||
/**
|
||||
* Once control is in upload succeeded method automatically
|
||||
* upload button is re-enabled. To disable the button firing
|
||||
* below event.
|
||||
*/
|
||||
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.BULK_UPLOAD_PROCESS_STARTED));
|
||||
while ((line = reader.readLine()) != null) {
|
||||
innerCounter++;
|
||||
readEachLine(line, innerCounter, totalFileSize);
|
||||
}
|
||||
doAssignments();
|
||||
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.BULK_UPLOAD_COMPLETED));
|
||||
|
||||
// Clearing after assignments are done
|
||||
managementUIState.getTargetTableFilters().getBulkUpload().getTargetsCreated().clear();
|
||||
} catch (final IOException e) {
|
||||
LOG.error("Error reading file {}", tempFile.getName(), e);
|
||||
} finally {
|
||||
resetCounts();
|
||||
deleteFile();
|
||||
}
|
||||
}
|
||||
|
||||
private void doAssignments() {
|
||||
final StringBuilder errorMessage = new StringBuilder();
|
||||
String dsAssignmentFailedMsg = null;
|
||||
|
||||
@@ -73,8 +73,8 @@ import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.gwt.thirdparty.guava.common.base.Strings;
|
||||
import com.vaadin.data.Container;
|
||||
import com.vaadin.data.Item;
|
||||
import com.vaadin.event.Action;
|
||||
@@ -249,7 +249,7 @@ public class TargetTable extends AbstractTable implements Handler {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#getTableId()
|
||||
*/
|
||||
@@ -260,7 +260,7 @@ public class TargetTable extends AbstractTable implements Handler {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#createContainer(
|
||||
* )
|
||||
@@ -285,7 +285,7 @@ public class TargetTable extends AbstractTable implements Handler {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTable#addContainerProperties
|
||||
* (com.vaadin.data.Container )
|
||||
*/
|
||||
@@ -312,7 +312,7 @@ public class TargetTable extends AbstractTable implements Handler {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTable#
|
||||
* addCustomGeneratedColumns ()
|
||||
*/
|
||||
@@ -326,7 +326,7 @@ public class TargetTable extends AbstractTable implements Handler {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTable#
|
||||
* isFirstRowSelectedOnLoad ()
|
||||
*/
|
||||
@@ -338,7 +338,7 @@ public class TargetTable extends AbstractTable implements Handler {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTable#getItemIdToSelect()
|
||||
*/
|
||||
@Override
|
||||
@@ -352,7 +352,7 @@ public class TargetTable extends AbstractTable implements Handler {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#onValueChange()
|
||||
*/
|
||||
@@ -377,7 +377,7 @@ public class TargetTable extends AbstractTable implements Handler {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#isMaximized()
|
||||
*/
|
||||
@@ -388,7 +388,7 @@ public class TargetTable extends AbstractTable implements Handler {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTable#getTableVisibleColumns
|
||||
* ()
|
||||
*/
|
||||
@@ -415,7 +415,7 @@ public class TargetTable extends AbstractTable implements Handler {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTable#getTableDropHandler()
|
||||
*/
|
||||
@Override
|
||||
@@ -1154,5 +1154,4 @@ public class TargetTable extends AbstractTable implements Handler {
|
||||
private boolean isFilteredByTags() {
|
||||
return !managementUIState.getTargetTableFilters().getClickedTargetTags().isEmpty();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
/**
|
||||
* 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.rollout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.TableColumn;
|
||||
|
||||
import com.vaadin.data.Container;
|
||||
import com.vaadin.ui.Table;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Abstract table class.
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractSimpleTable extends Table {
|
||||
|
||||
private static final long serialVersionUID = 4856562746502217630L;
|
||||
|
||||
/**
|
||||
* Initialize the components.
|
||||
*/
|
||||
protected void init() {
|
||||
addStyleName("sp-table rollout-table");
|
||||
setSizeFull();
|
||||
setImmediate(true);
|
||||
setHeight(100.0f, Unit.PERCENTAGE);
|
||||
addStyleName(ValoTheme.TABLE_NO_VERTICAL_LINES);
|
||||
addStyleName(ValoTheme.TABLE_SMALL);
|
||||
setSortEnabled(false);
|
||||
setId(getTableId());
|
||||
addCustomGeneratedColumns();
|
||||
addNewContainerDS();
|
||||
setColumnProperties();
|
||||
addValueChangeListener(event -> onValueChange());
|
||||
setPageLength(SPUIDefinitions.PAGE_SIZE);
|
||||
setSelectable(false);
|
||||
setColumnCollapsingAllowed(true);
|
||||
setCollapsiblecolumns();
|
||||
}
|
||||
|
||||
private void setColumnProperties() {
|
||||
final List<TableColumn> columnList = getTableVisibleColumns();
|
||||
final List<Object> columnIds = new ArrayList<>();
|
||||
for (final TableColumn column : columnList) {
|
||||
setColumnHeader(column.getColumnPropertyId(), column.getColumnHeader());
|
||||
setColumnExpandRatio(column.getColumnPropertyId(), column.getExpandRatio());
|
||||
columnIds.add(column.getColumnPropertyId());
|
||||
}
|
||||
setVisibleColumns(columnIds.toArray());
|
||||
}
|
||||
|
||||
private void addNewContainerDS() {
|
||||
final Container container = createContainer();
|
||||
addContainerProperties(container);
|
||||
setContainerDataSource(container);
|
||||
int size = 0;
|
||||
if (container != null) {
|
||||
size = container.size();
|
||||
}
|
||||
if (size == 0) {
|
||||
setData(SPUIDefinitions.NO_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Based on table state (max/min) columns to be shown are returned.
|
||||
*
|
||||
* @return List<TableColumn> list of visible columns
|
||||
*/
|
||||
protected abstract List<TableColumn> getTableVisibleColumns();
|
||||
|
||||
/**
|
||||
* Create container of the data to be displayed by the table.
|
||||
*/
|
||||
protected abstract Container createContainer();
|
||||
|
||||
/**
|
||||
* Add container properties to the container passed in the reference.
|
||||
*
|
||||
* @param container
|
||||
* reference of {@link Container}
|
||||
*/
|
||||
protected abstract void addContainerProperties(Container container);
|
||||
|
||||
/**
|
||||
* Get Id of the table.
|
||||
*
|
||||
* @return Id.
|
||||
*/
|
||||
protected abstract String getTableId();
|
||||
|
||||
/**
|
||||
* On select of row.
|
||||
*/
|
||||
protected abstract void onValueChange();
|
||||
|
||||
/**
|
||||
* Add any generated columns if required.
|
||||
*/
|
||||
protected abstract void addCustomGeneratedColumns();
|
||||
|
||||
/**
|
||||
* Set list of columns collapsible.
|
||||
*/
|
||||
protected abstract void setCollapsiblecolumns();
|
||||
}
|
||||
@@ -0,0 +1,273 @@
|
||||
/**
|
||||
* 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.rollout;
|
||||
|
||||
import org.eclipse.hawkbit.ui.components.SPUIButton;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||
|
||||
import com.google.gwt.thirdparty.guava.common.base.Strings;
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.ui.AbstractTextField.TextChangeEventMode;
|
||||
import com.vaadin.ui.Alignment;
|
||||
import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.HorizontalLayout;
|
||||
import com.vaadin.ui.TextField;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
|
||||
/**
|
||||
*
|
||||
* Abstract table header.
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractSimpleTableHeader extends VerticalLayout {
|
||||
|
||||
private static final long serialVersionUID = -24429876573255519L;
|
||||
|
||||
private HorizontalLayout headerCaptionLayout;
|
||||
|
||||
private TextField searchField;
|
||||
|
||||
private SPUIButton searchResetIcon;
|
||||
|
||||
private Button addButton;
|
||||
|
||||
private Button closeButton;
|
||||
|
||||
protected void init() {
|
||||
createComponents();
|
||||
buildLayout();
|
||||
restoreState();
|
||||
}
|
||||
|
||||
private void restoreState() {
|
||||
final String onLoadSearchBoxValue = onLoadSearchBoxValue();
|
||||
if (!Strings.isNullOrEmpty(onLoadSearchBoxValue)) {
|
||||
openSearchTextField();
|
||||
searchField.setValue(onLoadSearchBoxValue);
|
||||
}
|
||||
restoreCaption();
|
||||
}
|
||||
|
||||
private void createComponents() {
|
||||
headerCaptionLayout = getHeaderCaptionLayout();
|
||||
if (isRollout()) {
|
||||
searchField = createSearchField();
|
||||
searchResetIcon = createSearchResetIcon();
|
||||
addButton = createAddButton();
|
||||
}
|
||||
closeButton = createCloseButton();
|
||||
}
|
||||
|
||||
private void buildLayout() {
|
||||
final HorizontalLayout titleFilterIconsLayout = createHeaderFilterIconLayout();
|
||||
titleFilterIconsLayout.addComponents(headerCaptionLayout);
|
||||
|
||||
if (isAllowSearch() && isRollout()) {
|
||||
titleFilterIconsLayout.addComponents(searchField, searchResetIcon);
|
||||
titleFilterIconsLayout.setExpandRatio(headerCaptionLayout, 0.3F);
|
||||
titleFilterIconsLayout.setExpandRatio(searchField, 0.7F);
|
||||
}
|
||||
if (hasCreatePermission() && isRollout()) {
|
||||
titleFilterIconsLayout.addComponent(addButton);
|
||||
titleFilterIconsLayout.setComponentAlignment(addButton, Alignment.TOP_LEFT);
|
||||
}
|
||||
if (showCloseButton()) {
|
||||
titleFilterIconsLayout.addComponent(closeButton);
|
||||
titleFilterIconsLayout.setComponentAlignment(closeButton, Alignment.TOP_RIGHT);
|
||||
}
|
||||
|
||||
titleFilterIconsLayout.setHeight("40px");
|
||||
addComponent(titleFilterIconsLayout);
|
||||
addStyleName("bordered-layout");
|
||||
addStyleName("no-border-bottom");
|
||||
}
|
||||
|
||||
private HorizontalLayout createHeaderFilterIconLayout() {
|
||||
final HorizontalLayout titleFilterIconsLayout = new HorizontalLayout();
|
||||
titleFilterIconsLayout.addStyleName(SPUIStyleDefinitions.WIDGET_TITLE);
|
||||
titleFilterIconsLayout.setSpacing(false);
|
||||
titleFilterIconsLayout.setMargin(false);
|
||||
titleFilterIconsLayout.setSizeFull();
|
||||
return titleFilterIconsLayout;
|
||||
}
|
||||
|
||||
private TextField createSearchField() {
|
||||
final TextField textField = SPUIComponentProvider.getTextField("filter-box", "text-style filter-box-hide",
|
||||
false, "", "", false, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
textField.setId(getSearchBoxId());
|
||||
textField.setWidth(100.0f, Unit.PERCENTAGE);
|
||||
textField.addTextChangeListener(event -> searchBy(event.getText()));
|
||||
textField.setTextChangeEventMode(TextChangeEventMode.LAZY);
|
||||
textField.setTextChangeTimeout(1000);
|
||||
return textField;
|
||||
}
|
||||
|
||||
private SPUIButton createSearchResetIcon() {
|
||||
final SPUIButton button = (SPUIButton) SPUIComponentProvider.getButton(getSearchRestIconId(), "", "", null,
|
||||
false, FontAwesome.SEARCH, SPUIButtonStyleSmallNoBorder.class);
|
||||
button.addClickListener(event -> onSearchResetClick());
|
||||
button.setData(Boolean.FALSE);
|
||||
return button;
|
||||
}
|
||||
|
||||
private Button createAddButton() {
|
||||
final Button button = SPUIComponentProvider.getButton(getAddIconId(), "", "", null, false, FontAwesome.PLUS,
|
||||
SPUIButtonStyleSmallNoBorder.class);
|
||||
button.addClickListener(event -> addNewItem(event));
|
||||
return button;
|
||||
}
|
||||
|
||||
private Button createCloseButton() {
|
||||
final Button button = SPUIComponentProvider.getButton(getCloseButtonId(), "", "", null, false,
|
||||
FontAwesome.TIMES, SPUIButtonStyleSmallNoBorder.class);
|
||||
button.addClickListener(event -> onClose(event));
|
||||
return button;
|
||||
}
|
||||
|
||||
private void onSearchResetClick() {
|
||||
final Boolean flag = isSearchFieldOpen();
|
||||
if (flag == null || Boolean.FALSE.equals(flag)) {
|
||||
// Clicked on search Icon
|
||||
openSearchTextField();
|
||||
} else {
|
||||
// Clicked on rest icon
|
||||
closeSearchTextField();
|
||||
}
|
||||
}
|
||||
|
||||
protected Boolean isSearchFieldOpen() {
|
||||
return (Boolean) searchResetIcon.getData();
|
||||
}
|
||||
|
||||
private void openSearchTextField() {
|
||||
searchResetIcon.addStyleName(SPUIDefinitions.FILTER_RESET_ICON);
|
||||
searchResetIcon.togleIcon(FontAwesome.TIMES);
|
||||
searchResetIcon.setData(Boolean.TRUE);
|
||||
searchField.removeStyleName(SPUIDefinitions.FILTER_BOX_HIDE);
|
||||
searchField.focus();
|
||||
}
|
||||
|
||||
private void closeSearchTextField() {
|
||||
searchField.setValue("");
|
||||
searchField.addStyleName(SPUIDefinitions.FILTER_BOX_HIDE);
|
||||
searchResetIcon.removeStyleName(SPUIDefinitions.FILTER_RESET_ICON);
|
||||
searchResetIcon.togleIcon(FontAwesome.SEARCH);
|
||||
searchResetIcon.setData(Boolean.FALSE);
|
||||
resetSearchText();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be called when user resets the search text means on
|
||||
* click of (X) icon.
|
||||
*/
|
||||
protected abstract void resetSearchText();
|
||||
|
||||
/**
|
||||
* get Id of search text field.
|
||||
*
|
||||
* @return Id of the text field.
|
||||
*/
|
||||
protected abstract String getSearchBoxId();
|
||||
|
||||
/**
|
||||
* Get search reset Icon Id.
|
||||
*
|
||||
* @return Id of search reset icon.
|
||||
*/
|
||||
protected abstract String getSearchRestIconId();
|
||||
|
||||
/**
|
||||
* On search by text.
|
||||
*
|
||||
* @param newSearchText
|
||||
* search text
|
||||
*/
|
||||
protected abstract void searchBy(String newSearchText);
|
||||
|
||||
/**
|
||||
* Get Id of add Icon.
|
||||
*
|
||||
* @return String of add Icon.
|
||||
*/
|
||||
protected abstract String getAddIconId();
|
||||
|
||||
/**
|
||||
* On click add button.
|
||||
*
|
||||
* @param event
|
||||
* add button click event
|
||||
*/
|
||||
protected abstract void addNewItem(final Button.ClickEvent event);
|
||||
|
||||
/**
|
||||
* On click of close button.
|
||||
*
|
||||
* @param event
|
||||
* close button click event
|
||||
*/
|
||||
protected abstract void onClose(final Button.ClickEvent event);
|
||||
|
||||
/**
|
||||
* Checks create permission.
|
||||
*
|
||||
* @return boolean Returns true if user has create permission
|
||||
*/
|
||||
protected abstract boolean hasCreatePermission();
|
||||
|
||||
/**
|
||||
* Get close button id.
|
||||
*
|
||||
* @return String button id
|
||||
*/
|
||||
protected abstract String getCloseButtonId();
|
||||
|
||||
/**
|
||||
* Checks if close button to be displayed.
|
||||
*
|
||||
* @return true if close button has to be displayed
|
||||
*/
|
||||
protected abstract boolean showCloseButton();
|
||||
|
||||
/**
|
||||
* Checks if search is allowed.
|
||||
*
|
||||
* @return boolean if true search field is displayed.
|
||||
*/
|
||||
protected abstract boolean isAllowSearch();
|
||||
|
||||
/**
|
||||
* Get search box on load text value.
|
||||
*
|
||||
* @return value of search box.
|
||||
*/
|
||||
protected abstract String onLoadSearchBoxValue();
|
||||
|
||||
/**
|
||||
* Checks for the rollout group.
|
||||
*
|
||||
* @return boolean value for Rollout Group.
|
||||
*/
|
||||
protected abstract boolean isRollout();
|
||||
|
||||
/**
|
||||
* Get header caption layout.
|
||||
*
|
||||
* @return layout with caption
|
||||
*/
|
||||
protected abstract HorizontalLayout getHeaderCaptionLayout();
|
||||
|
||||
/**
|
||||
* Restore caption details on refresh.
|
||||
*/
|
||||
protected abstract void restoreCaption();
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/**
|
||||
* 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.rollout;
|
||||
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
|
||||
import com.vaadin.ui.Alignment;
|
||||
import com.vaadin.ui.HorizontalLayout;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
|
||||
/**
|
||||
*
|
||||
* Abstract table layout class which builds layout with table
|
||||
* {@link AbstractSimpleTable} and table header
|
||||
* {@link AbstractSimpleTableHeader}.
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractSimpleTableLayout extends VerticalLayout {
|
||||
|
||||
private static final long serialVersionUID = 8611248179949245460L;
|
||||
|
||||
private AbstractSimpleTableHeader tableHeader;
|
||||
|
||||
private AbstractSimpleTable table;
|
||||
|
||||
protected void init(final AbstractSimpleTableHeader tableHeader, final AbstractSimpleTable table) {
|
||||
this.tableHeader = tableHeader;
|
||||
this.table = table;
|
||||
buildLayout();
|
||||
}
|
||||
|
||||
private void buildLayout() {
|
||||
setSizeFull();
|
||||
setSpacing(true);
|
||||
setMargin(false);
|
||||
setStyleName("group");
|
||||
final VerticalLayout tableHeaderLayout = new VerticalLayout();
|
||||
tableHeaderLayout.setSizeFull();
|
||||
tableHeaderLayout.setSpacing(false);
|
||||
tableHeaderLayout.setMargin(false);
|
||||
|
||||
tableHeaderLayout.setStyleName("table-layout");
|
||||
tableHeaderLayout.addComponent(tableHeader);
|
||||
|
||||
tableHeaderLayout.setComponentAlignment(tableHeader, Alignment.TOP_CENTER);
|
||||
tableHeaderLayout.addComponent(table);
|
||||
tableHeaderLayout.setComponentAlignment(table, Alignment.TOP_CENTER);
|
||||
tableHeaderLayout.setExpandRatio(table, 1.0f);
|
||||
|
||||
|
||||
addComponent(tableHeaderLayout);
|
||||
setComponentAlignment(tableHeaderLayout, Alignment.TOP_CENTER);
|
||||
setExpandRatio(tableHeaderLayout, 1.0f);
|
||||
if (hasCountMessage()) {
|
||||
final HorizontalLayout rolloutGroupTargetsCountLayout = createCountMessageComponent();
|
||||
addComponent(rolloutGroupTargetsCountLayout);
|
||||
setComponentAlignment(rolloutGroupTargetsCountLayout, Alignment.BOTTOM_CENTER);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*
|
||||
*/
|
||||
private HorizontalLayout createCountMessageComponent() {
|
||||
final HorizontalLayout rolloutGroupTargetsCountLayout = new HorizontalLayout();
|
||||
final Label countMessageLabel = getCountMessageLabel();
|
||||
countMessageLabel.setId(SPUIComponetIdProvider.ROLLOUT_GROUP_TARGET_LABEL);
|
||||
rolloutGroupTargetsCountLayout.addComponent(getCountMessageLabel());
|
||||
rolloutGroupTargetsCountLayout.setStyleName("footer-layout");
|
||||
rolloutGroupTargetsCountLayout.setWidth("100%");
|
||||
return rolloutGroupTargetsCountLayout;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Only in rollout group targets view count message is displayed.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected abstract boolean hasCountMessage();
|
||||
|
||||
protected abstract Label getCountMessageLabel();
|
||||
}
|
||||
@@ -0,0 +1,848 @@
|
||||
/**
|
||||
* 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.rollout;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupConditions;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupErrorAction;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupErrorCondition;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessAction;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessCondition;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||
import org.eclipse.hawkbit.ui.documentation.DocumentationPageLink;
|
||||
import org.eclipse.hawkbit.ui.filtermanagement.TargetFilterBeanQuery;
|
||||
import org.eclipse.hawkbit.ui.management.footer.ActionTypeOptionGroupLayout;
|
||||
import org.eclipse.hawkbit.ui.management.footer.ActionTypeOptionGroupLayout.ActionTypeOption;
|
||||
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||
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.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.vaadin.data.Container;
|
||||
import com.vaadin.data.Item;
|
||||
import com.vaadin.data.Property.ValueChangeEvent;
|
||||
import com.vaadin.data.Validator;
|
||||
import com.vaadin.data.validator.IntegerRangeValidator;
|
||||
import com.vaadin.data.validator.RegexpValidator;
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
import com.vaadin.ui.Alignment;
|
||||
import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.ComboBox;
|
||||
import com.vaadin.ui.CustomComponent;
|
||||
import com.vaadin.ui.HorizontalLayout;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.Link;
|
||||
import com.vaadin.ui.OptionGroup;
|
||||
import com.vaadin.ui.TextArea;
|
||||
import com.vaadin.ui.TextField;
|
||||
import com.vaadin.ui.UI;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
import com.vaadin.ui.Window;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
*
|
||||
* Rollout add or update popup layout.
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
public class AddUpdateRolloutWindowLayout extends CustomComponent {
|
||||
|
||||
private static final long serialVersionUID = 2999293468801479916L;
|
||||
|
||||
private static final String MESSAGE_ROLLOUT_FIELD_VALUE_RANGE = "message.rollout.field.value.range";
|
||||
|
||||
private static final String MESSAGE_ENTER_NUMBER = "message.enter.number";
|
||||
|
||||
private static final String NUMBER_REGEXP = "[-]?[0-9]*\\.?,?[0-9]+";
|
||||
|
||||
@Autowired
|
||||
private ActionTypeOptionGroupLayout actionTypeOptionGroupLayout;
|
||||
|
||||
@Autowired
|
||||
private transient RolloutManagement rolloutManagement;
|
||||
|
||||
@Autowired
|
||||
private transient DistributionSetManagement distributionSetManagement;
|
||||
|
||||
@Autowired
|
||||
private transient TargetManagement targetManagement;
|
||||
|
||||
@Autowired
|
||||
private UINotification uiNotification;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
private Label madatoryLabel;
|
||||
|
||||
private TextField rolloutName;
|
||||
|
||||
private ComboBox distributionSet;
|
||||
|
||||
private ComboBox targetFilterQueryCombo;
|
||||
|
||||
private TextField noOfGroups;
|
||||
|
||||
private Label groupSizeLabel;
|
||||
|
||||
private TextField triggerThreshold;
|
||||
|
||||
private TextField errorThreshold;
|
||||
|
||||
private TextArea description;
|
||||
|
||||
private Button saveRollout;
|
||||
|
||||
private Button discardRolllout;
|
||||
|
||||
private OptionGroup errorThresholdOptionGroup;
|
||||
|
||||
private Link linkToHelp;
|
||||
|
||||
private Window addUpdateRolloutWindow;
|
||||
|
||||
private Boolean editRollout;
|
||||
|
||||
private Rollout rolloutForEdit;
|
||||
|
||||
private Long totalTargetsCount;
|
||||
|
||||
private Label totalTargetsLabel;
|
||||
|
||||
private TextArea targetFilterQuery;
|
||||
|
||||
/**
|
||||
* Create components and layout.
|
||||
*/
|
||||
public void init() {
|
||||
createRequiredComponents();
|
||||
buildLayout();
|
||||
}
|
||||
|
||||
public Window getWindow() {
|
||||
addUpdateRolloutWindow = SPUIComponentProvider.getWindow(i18n.get("caption.configure.rollout"), null,
|
||||
SPUIDefinitions.CREATE_UPDATE_WINDOW);
|
||||
addUpdateRolloutWindow.setContent(this);
|
||||
return addUpdateRolloutWindow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the field values.
|
||||
*/
|
||||
public void resetComponents() {
|
||||
editRollout = Boolean.FALSE;
|
||||
rolloutName.clear();
|
||||
targetFilterQuery.clear();
|
||||
resetFields();
|
||||
enableFields();
|
||||
populateDistributionSet();
|
||||
populateTargetFilterQuery();
|
||||
setDefaultSaveStartGroupOption();
|
||||
totalTargetsLabel.setVisible(false);
|
||||
groupSizeLabel.setVisible(false);
|
||||
targetFilterQuery.setVisible(false);
|
||||
targetFilterQueryCombo.setVisible(true);
|
||||
actionTypeOptionGroupLayout.selectDefaultOption();
|
||||
totalTargetsCount = 0L;
|
||||
rolloutForEdit = null;
|
||||
}
|
||||
|
||||
private void resetFields() {
|
||||
rolloutName.removeStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_ERROR);
|
||||
noOfGroups.clear();
|
||||
noOfGroups.removeStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_ERROR);
|
||||
triggerThreshold.clear();
|
||||
triggerThreshold.removeStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_ERROR);
|
||||
errorThreshold.clear();
|
||||
errorThreshold.removeStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_ERROR);
|
||||
description.clear();
|
||||
description.removeStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_ERROR);
|
||||
}
|
||||
|
||||
private void buildLayout() {
|
||||
final VerticalLayout mainLayout = new VerticalLayout();
|
||||
mainLayout.setSpacing(Boolean.TRUE);
|
||||
mainLayout.setSizeUndefined();
|
||||
|
||||
mainLayout.addComponents(madatoryLabel, rolloutName, distributionSet, getTargetFilterLayout(),
|
||||
getGroupDetailsLayout(), getTriggerThresoldLayout(), getErrorThresoldLayout(), description,
|
||||
actionTypeOptionGroupLayout, linkToHelp, getSaveDiscardButtonLayout());
|
||||
mainLayout.setComponentAlignment(linkToHelp, Alignment.BOTTOM_RIGHT);
|
||||
setCompositionRoot(mainLayout);
|
||||
}
|
||||
|
||||
private HorizontalLayout getGroupDetailsLayout() {
|
||||
final HorizontalLayout groupLayout = new HorizontalLayout();
|
||||
groupLayout.setSizeFull();
|
||||
groupLayout.addComponents(noOfGroups, groupSizeLabel);
|
||||
groupLayout.setExpandRatio(noOfGroups, 1.0f);
|
||||
groupLayout.setComponentAlignment(groupSizeLabel, Alignment.MIDDLE_LEFT);
|
||||
return groupLayout;
|
||||
}
|
||||
|
||||
private HorizontalLayout getErrorThresoldLayout() {
|
||||
final HorizontalLayout errorThresoldLayout = new HorizontalLayout();
|
||||
errorThresoldLayout.setSizeFull();
|
||||
errorThresoldLayout.addComponents(errorThreshold, errorThresholdOptionGroup);
|
||||
errorThresoldLayout.setExpandRatio(errorThreshold, 1.0f);
|
||||
return errorThresoldLayout;
|
||||
}
|
||||
|
||||
private HorizontalLayout getTargetFilterLayout() {
|
||||
final HorizontalLayout targetFilterLayout = new HorizontalLayout();
|
||||
targetFilterLayout.setSizeFull();
|
||||
targetFilterLayout.addComponents(targetFilterQueryCombo, targetFilterQuery, totalTargetsLabel);
|
||||
targetFilterLayout.setExpandRatio(targetFilterQueryCombo, 0.71f);
|
||||
targetFilterLayout.setExpandRatio(targetFilterQuery, 0.70f);
|
||||
targetFilterLayout.setExpandRatio(totalTargetsLabel, 0.29f);
|
||||
targetFilterLayout.setComponentAlignment(totalTargetsLabel, Alignment.MIDDLE_LEFT);
|
||||
return targetFilterLayout;
|
||||
}
|
||||
|
||||
private HorizontalLayout getTriggerThresoldLayout() {
|
||||
final HorizontalLayout triggerThresholdLayout = new HorizontalLayout();
|
||||
triggerThresholdLayout.setSizeFull();
|
||||
triggerThresholdLayout.addComponents(triggerThreshold, getPercentHintLabel());
|
||||
triggerThresholdLayout.setExpandRatio(triggerThreshold, 1.0f);
|
||||
return triggerThresholdLayout;
|
||||
}
|
||||
|
||||
private Label getPercentHintLabel() {
|
||||
final Label percentSymbol = new Label("%");
|
||||
percentSymbol.addStyleName(ValoTheme.LABEL_TINY + " " + ValoTheme.LABEL_BOLD);
|
||||
percentSymbol.setSizeUndefined();
|
||||
return percentSymbol;
|
||||
}
|
||||
|
||||
private HorizontalLayout getSaveDiscardButtonLayout() {
|
||||
final HorizontalLayout buttonsLayout = new HorizontalLayout();
|
||||
buttonsLayout.setSizeFull();
|
||||
buttonsLayout.addComponents(saveRollout, discardRolllout);
|
||||
buttonsLayout.setComponentAlignment(saveRollout, Alignment.BOTTOM_LEFT);
|
||||
buttonsLayout.setComponentAlignment(discardRolllout, Alignment.BOTTOM_RIGHT);
|
||||
buttonsLayout.addStyleName("window-style");
|
||||
return buttonsLayout;
|
||||
}
|
||||
|
||||
private void createRequiredComponents() {
|
||||
madatoryLabel = createMandatoryLabel();
|
||||
rolloutName = createRolloutNameField();
|
||||
distributionSet = createDistributionSetCombo();
|
||||
populateDistributionSet();
|
||||
|
||||
targetFilterQueryCombo = createTargetFilterQueryCombo();
|
||||
populateTargetFilterQuery();
|
||||
|
||||
noOfGroups = createNoOfGroupsField();
|
||||
groupSizeLabel = createGroupSizeLabel();
|
||||
triggerThreshold = createTriggerThresold();
|
||||
errorThreshold = createErrorThresold();
|
||||
description = createDescription();
|
||||
errorThresholdOptionGroup = createErrorThresholdOptionGroup();
|
||||
setDefaultSaveStartGroupOption();
|
||||
saveRollout = createSaveButton();
|
||||
discardRolllout = createDiscardButton();
|
||||
actionTypeOptionGroupLayout.selectDefaultOption();
|
||||
|
||||
totalTargetsLabel = createTotalTargetsLabel();
|
||||
targetFilterQuery = createTargetFilterQuery();
|
||||
|
||||
linkToHelp = DocumentationPageLink.ROLLOUT_VIEW.getLink();
|
||||
actionTypeOptionGroupLayout.addStyleName(SPUIStyleDefinitions.ROLLOUT_ACTION_TYPE_LAYOUT);
|
||||
|
||||
}
|
||||
|
||||
private Label createGroupSizeLabel() {
|
||||
final Label groupSize = SPUIComponentProvider.getLabel("", SPUILabelDefinitions.SP_LABEL_SIMPLE);
|
||||
groupSize.addStyleName(ValoTheme.LABEL_TINY + " " + "rollout-target-count-message");
|
||||
groupSize.setImmediate(true);
|
||||
groupSize.setVisible(false);
|
||||
groupSize.setSizeUndefined();
|
||||
return groupSize;
|
||||
}
|
||||
|
||||
private TextArea createTargetFilterQuery() {
|
||||
final TextArea filterField = SPUIComponentProvider.getTextArea("text-area-style", ValoTheme.TEXTFIELD_TINY,
|
||||
false, null, null, SPUILabelDefinitions.TARGET_FILTER_QUERY_TEXT_FIELD_LENGTH);
|
||||
filterField.setId(SPUIComponetIdProvider.ROLLOUT_TARGET_FILTER_QUERY_FIELD);
|
||||
filterField.setNullRepresentation(HawkbitCommonUtil.SP_STRING_EMPTY);
|
||||
filterField.setVisible(false);
|
||||
filterField.setEnabled(false);
|
||||
filterField.setSizeFull();
|
||||
return filterField;
|
||||
}
|
||||
|
||||
private Label createTotalTargetsLabel() {
|
||||
final Label targetCountLabel = SPUIComponentProvider.getLabel("", SPUILabelDefinitions.SP_LABEL_SIMPLE);
|
||||
targetCountLabel.addStyleName(ValoTheme.LABEL_TINY + " " + "rollout-target-count-message");
|
||||
targetCountLabel.setImmediate(true);
|
||||
targetCountLabel.setVisible(false);
|
||||
targetCountLabel.setSizeUndefined();
|
||||
return targetCountLabel;
|
||||
}
|
||||
|
||||
private OptionGroup createErrorThresholdOptionGroup() {
|
||||
final OptionGroup errorThresoldOptions = new OptionGroup();
|
||||
for (final ERRORTHRESOLDOPTIONS option : ERRORTHRESOLDOPTIONS.values()) {
|
||||
errorThresoldOptions.addItem(option.getValue());
|
||||
}
|
||||
errorThresoldOptions.setId(SPUIComponetIdProvider.ROLLOUT_ERROR_THRESOLD_OPTION_ID);
|
||||
errorThresoldOptions.addStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL);
|
||||
errorThresoldOptions.addStyleName(SPUIStyleDefinitions.ROLLOUT_OPTION_GROUP);
|
||||
errorThresoldOptions.setSizeUndefined();
|
||||
errorThresoldOptions.addValueChangeListener(event -> onErrorThresoldOptionChange(event));
|
||||
return errorThresoldOptions;
|
||||
}
|
||||
|
||||
private void onErrorThresoldOptionChange(final ValueChangeEvent event) {
|
||||
errorThreshold.clear();
|
||||
errorThreshold.removeAllValidators();
|
||||
if (event.getProperty().getValue().equals(ERRORTHRESOLDOPTIONS.COUNT.getValue())) {
|
||||
errorThreshold.addValidator(new ErrorThresoldOptionValidator());
|
||||
} else {
|
||||
errorThreshold.addValidator(new ThresoldFieldValidator());
|
||||
}
|
||||
errorThreshold.getValidators();
|
||||
}
|
||||
|
||||
private ComboBox createTargetFilterQueryCombo() {
|
||||
final ComboBox targetFilter = SPUIComponentProvider.getComboBox("", "", null, null, true, "",
|
||||
i18n.get("prompt.target.filter"));
|
||||
targetFilter.setImmediate(true);
|
||||
targetFilter.setPageLength(7);
|
||||
targetFilter.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME);
|
||||
targetFilter.setId(SPUIComponetIdProvider.ROLLOUT_TARGET_FILTER_COMBO_ID);
|
||||
targetFilter.setSizeFull();
|
||||
targetFilter.addValueChangeListener(event -> onTargetFilterChange());
|
||||
return targetFilter;
|
||||
}
|
||||
|
||||
private void onTargetFilterChange() {
|
||||
final String filterQueryString = getTargetFilterQuery();
|
||||
if (!Strings.isNullOrEmpty(filterQueryString)) {
|
||||
totalTargetsCount = targetManagement.countTargetByTargetFilterQuery(filterQueryString);
|
||||
totalTargetsLabel.setValue(getTotalTargetMessage());
|
||||
totalTargetsLabel.setVisible(true);
|
||||
} else {
|
||||
totalTargetsCount = 0L;
|
||||
totalTargetsLabel.setVisible(false);
|
||||
}
|
||||
onGroupNumberChange();
|
||||
}
|
||||
|
||||
private String getTotalTargetMessage() {
|
||||
return new StringBuilder(i18n.get("label.target.filter.count")).append(totalTargetsCount).toString();
|
||||
}
|
||||
|
||||
private String getTargetPerGroupMessage(final String value) {
|
||||
return new StringBuilder(i18n.get("label.target.per.group")).append(value).toString();
|
||||
}
|
||||
|
||||
private void populateTargetFilterQuery() {
|
||||
final Container container = createTargetFilterComboContainer();
|
||||
targetFilterQueryCombo.setContainerDataSource(container);
|
||||
}
|
||||
|
||||
private Container createTargetFilterComboContainer() {
|
||||
final BeanQueryFactory<TargetFilterBeanQuery> targetFilterQF = new BeanQueryFactory<>(
|
||||
TargetFilterBeanQuery.class);
|
||||
return new LazyQueryContainer(new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE,
|
||||
SPUILabelDefinitions.VAR_NAME), targetFilterQF);
|
||||
|
||||
}
|
||||
|
||||
private Button createDiscardButton() {
|
||||
final Button discardRollloutBtn = SPUIComponentProvider.getButton(
|
||||
SPUIComponetIdProvider.ROLLOUT_CREATE_UPDATE_DISCARD_ID, "", "", "", true, FontAwesome.TIMES,
|
||||
SPUIButtonStyleSmallNoBorder.class);
|
||||
discardRollloutBtn.addClickListener(event -> onDiscard());
|
||||
return discardRollloutBtn;
|
||||
}
|
||||
|
||||
private Button createSaveButton() {
|
||||
final Button saveRolloutBtn = SPUIComponentProvider.getButton(
|
||||
SPUIComponetIdProvider.ROLLOUT_CREATE_UPDATE_SAVE_ID, "", "", "", true, FontAwesome.SAVE,
|
||||
SPUIButtonStyleSmallNoBorder.class);
|
||||
saveRolloutBtn.addClickListener(event -> onRolloutSave());
|
||||
saveRolloutBtn.setImmediate(true);
|
||||
return saveRolloutBtn;
|
||||
}
|
||||
|
||||
private void onDiscard() {
|
||||
closeThisWindow();
|
||||
}
|
||||
|
||||
private void onRolloutSave() {
|
||||
if (editRollout) {
|
||||
editRollout();
|
||||
} else {
|
||||
createRollout();
|
||||
}
|
||||
}
|
||||
|
||||
private void editRollout() {
|
||||
if (mandatoryCheckForEdit() && validateFields() && duplicateCheckForEdit() && null != rolloutForEdit) {
|
||||
rolloutForEdit.setName(rolloutName.getValue());
|
||||
rolloutForEdit.setDescription(description.getValue());
|
||||
final DistributionSetIdName distributionSetIdName = (DistributionSetIdName) distributionSet.getValue();
|
||||
rolloutForEdit.setDistributionSet(distributionSetManagement.findDistributionSetById(distributionSetIdName
|
||||
.getId()));
|
||||
rolloutForEdit.setActionType(getActionType());
|
||||
rolloutForEdit.setForcedTime(getForcedTimeStamp());
|
||||
final int amountGroup = Integer.parseInt(noOfGroups.getValue());
|
||||
final int errorThresoldPercent = getErrorThresoldPercentage(amountGroup);
|
||||
|
||||
for (final RolloutGroup rolloutGroup : rolloutForEdit.getRolloutGroups()) {
|
||||
rolloutGroup.setErrorConditionExp(triggerThreshold.getValue());
|
||||
rolloutGroup.setSuccessConditionExp(String.valueOf(errorThresoldPercent));
|
||||
}
|
||||
final Rollout updatedRollout = rolloutManagement.updateRollout(rolloutForEdit);
|
||||
uiNotification
|
||||
.displaySuccess(i18n.get("message.update.success", new Object[] { updatedRollout.getName() }));
|
||||
closeThisWindow();
|
||||
eventBus.publish(this, RolloutEvent.UPDATE_ROLLOUT);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean duplicateCheckForEdit() {
|
||||
final String rolloutNameVal = getRolloutName();
|
||||
if (!rolloutForEdit.getName().equals(rolloutNameVal)
|
||||
&& rolloutManagement.findRolloutByName(rolloutNameVal) != null) {
|
||||
uiNotification.displayValidationError(i18n.get("message.rollout.duplicate.check", rolloutNameVal));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private long getForcedTimeStamp() {
|
||||
return (((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout.getActionTypeOptionGroup()
|
||||
.getValue()) == ActionTypeOption.AUTO_FORCED) ? actionTypeOptionGroupLayout.getForcedTimeDateField()
|
||||
.getValue().getTime() : Action.NO_FORCE_TIME;
|
||||
}
|
||||
|
||||
private ActionType getActionType() {
|
||||
return ((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout.getActionTypeOptionGroup()
|
||||
.getValue()).getActionType();
|
||||
}
|
||||
|
||||
private void createRollout() {
|
||||
if (mandatoryCheck() && validateFields() && duplicateCheck()) {
|
||||
final Rollout rolloutToCreate = saveRollout();
|
||||
uiNotification.displaySuccess(i18n.get("message.save.success", new Object[] { rolloutToCreate.getName() }));
|
||||
eventBus.publish(this, RolloutEvent.CREATE_ROLLOUT);
|
||||
closeThisWindow();
|
||||
}
|
||||
}
|
||||
|
||||
private Rollout saveRollout() {
|
||||
Rollout rolloutToCreate = new Rollout();
|
||||
final int amountGroup = Integer.parseInt(noOfGroups.getValue());
|
||||
final String targetFilter = getTargetFilterQuery();
|
||||
final int errorThresoldPercent = getErrorThresoldPercentage(amountGroup);
|
||||
|
||||
final RolloutGroupConditions conditions = new RolloutGroup.RolloutGroupConditionBuilder()
|
||||
.successAction(RolloutGroupSuccessAction.NEXTGROUP, null)
|
||||
.successCondition(RolloutGroupSuccessCondition.THRESHOLD, triggerThreshold.getValue())
|
||||
.errorCondition(RolloutGroupErrorCondition.THRESHOLD, String.valueOf(errorThresoldPercent))
|
||||
.errorAction(RolloutGroupErrorAction.PAUSE, null).build();
|
||||
|
||||
final DistributionSetIdName distributionSetIdName = (DistributionSetIdName) distributionSet.getValue();
|
||||
rolloutToCreate.setName(rolloutName.getValue());
|
||||
rolloutToCreate.setDescription(description.getValue());
|
||||
rolloutToCreate.setTargetFilterQuery(targetFilter);
|
||||
rolloutToCreate.setDistributionSet(distributionSetManagement.findDistributionSetById(distributionSetIdName
|
||||
.getId()));
|
||||
rolloutToCreate.setActionType(getActionType());
|
||||
rolloutToCreate.setForcedTime(getForcedTimeStamp());
|
||||
|
||||
rolloutToCreate = rolloutManagement.createRolloutAsync(rolloutToCreate, amountGroup, conditions);
|
||||
return rolloutToCreate;
|
||||
}
|
||||
|
||||
private String getTargetFilterQuery() {
|
||||
if (null != targetFilterQueryCombo.getValue()
|
||||
&& HawkbitCommonUtil.trimAndNullIfEmpty((String) targetFilterQueryCombo.getValue()) != null) {
|
||||
final Item filterItem = targetFilterQueryCombo.getContainerDataSource().getItem(
|
||||
targetFilterQueryCombo.getValue());
|
||||
return (String) filterItem.getItemProperty("query").getValue();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private int getErrorThresoldPercentage(final int amountGroup) {
|
||||
int errorThresoldPercent = Integer.parseInt(errorThreshold.getValue());
|
||||
if (errorThresholdOptionGroup.getValue().equals(ERRORTHRESOLDOPTIONS.COUNT.getValue())) {
|
||||
final int groupSize = (int) Math.ceil((double) totalTargetsCount / (double) amountGroup);
|
||||
final int erroThresoldCount = Integer.parseInt(errorThreshold.getValue());
|
||||
errorThresoldPercent = (int) Math.ceil(((float) erroThresoldCount / (float) groupSize) * 100);
|
||||
}
|
||||
return errorThresoldPercent;
|
||||
}
|
||||
|
||||
private boolean validateFields() {
|
||||
if (!noOfGroups.isValid() || !errorThreshold.isValid() || !triggerThreshold.isValid()) {
|
||||
uiNotification.displayValidationError(i18n.get("message.correct.invalid.value"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void closeThisWindow() {
|
||||
addUpdateRolloutWindow.close();
|
||||
UI.getCurrent().removeWindow(addUpdateRolloutWindow);
|
||||
}
|
||||
|
||||
private boolean mandatoryCheck() {
|
||||
final DistributionSetIdName ds = getDistributionSetSelected();
|
||||
final String targetFilter = (String) targetFilterQueryCombo.getValue();
|
||||
final String triggerThresoldValue = triggerThreshold.getValue();
|
||||
final String errorThresoldValue = errorThreshold.getValue();
|
||||
if (hasNoNameOrTargetFilter(targetFilter) || ds == null
|
||||
|| HawkbitCommonUtil.trimAndNullIfEmpty(noOfGroups.getValue()) == null
|
||||
|| isThresholdValueMissing(triggerThresoldValue, errorThresoldValue)) {
|
||||
uiNotification.displayValidationError(i18n.get("message.mandatory.check"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean mandatoryCheckForEdit() {
|
||||
final DistributionSetIdName ds = getDistributionSetSelected();
|
||||
final String targetFilter = targetFilterQuery.getValue();
|
||||
final String triggerThresoldValue = triggerThreshold.getValue();
|
||||
final String errorThresoldValue = errorThreshold.getValue();
|
||||
if (hasNoNameOrTargetFilter(targetFilter) || ds == null
|
||||
|| HawkbitCommonUtil.trimAndNullIfEmpty(noOfGroups.getValue()) == null
|
||||
|| isThresholdValueMissing(triggerThresoldValue, errorThresoldValue)) {
|
||||
uiNotification.displayValidationError(i18n.get("message.mandatory.check"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean hasNoNameOrTargetFilter(final String targetFilter) {
|
||||
return getRolloutName() == null || targetFilter == null;
|
||||
}
|
||||
|
||||
private boolean isThresholdValueMissing(final String triggerThresoldValue, final String errorThresoldValue) {
|
||||
return HawkbitCommonUtil.trimAndNullIfEmpty(triggerThresoldValue) == null
|
||||
|| HawkbitCommonUtil.trimAndNullIfEmpty(errorThresoldValue) == null;
|
||||
}
|
||||
|
||||
private boolean duplicateCheck() {
|
||||
if (rolloutManagement.findRolloutByName(getRolloutName()) != null) {
|
||||
uiNotification.displayValidationError(i18n.get("message.rollout.duplicate.check",
|
||||
new Object[] { getRolloutName() }));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void setDefaultSaveStartGroupOption() {
|
||||
errorThresholdOptionGroup.setValue(ERRORTHRESOLDOPTIONS.PERCENT.getValue());
|
||||
}
|
||||
|
||||
private TextArea createDescription() {
|
||||
final TextArea descriptionField = SPUIComponentProvider.getTextArea("text-area-style",
|
||||
ValoTheme.TEXTFIELD_TINY, false, null, i18n.get("textfield.description"),
|
||||
SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
|
||||
descriptionField.setId(SPUIComponetIdProvider.ROLLOUT_DESCRIPTION_ID);
|
||||
descriptionField.setNullRepresentation(HawkbitCommonUtil.SP_STRING_EMPTY);
|
||||
descriptionField.setSizeFull();
|
||||
return descriptionField;
|
||||
}
|
||||
|
||||
private TextField createErrorThresold() {
|
||||
final TextField errorField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, true, null,
|
||||
i18n.get("prompt.error.threshold"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
errorField.addValidator(new ThresoldFieldValidator());
|
||||
errorField.setId(SPUIComponetIdProvider.ROLLOUT_ERROR_THRESOLD_ID);
|
||||
errorField.setMaxLength(7);
|
||||
errorField.setSizeFull();
|
||||
return errorField;
|
||||
}
|
||||
|
||||
private TextField createTriggerThresold() {
|
||||
final TextField thresholdField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, true, null,
|
||||
i18n.get("prompt.tigger.thresold"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
thresholdField.setId(SPUIComponetIdProvider.ROLLOUT_TRIGGER_THRESOLD_ID);
|
||||
thresholdField.addValidator(new ThresoldFieldValidator());
|
||||
thresholdField.setSizeFull();
|
||||
thresholdField.setMaxLength(3);
|
||||
return thresholdField;
|
||||
}
|
||||
|
||||
private TextField createNoOfGroupsField() {
|
||||
final TextField noOfGroupsField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, true, null,
|
||||
i18n.get("prompt.number.of.groups"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
noOfGroupsField.setId(SPUIComponetIdProvider.ROLLOUT_NO_OF_GROUPS_ID);
|
||||
noOfGroupsField.addValidator(new GroupNumberValidator());
|
||||
noOfGroupsField.setSizeFull();
|
||||
noOfGroupsField.setMaxLength(3);
|
||||
noOfGroupsField.addValueChangeListener(evevt -> onGroupNumberChange());
|
||||
return noOfGroupsField;
|
||||
}
|
||||
|
||||
private void onGroupNumberChange() {
|
||||
if (noOfGroups.isValid() && !Strings.isNullOrEmpty(noOfGroups.getValue())) {
|
||||
groupSizeLabel.setValue(getTargetPerGroupMessage(String.valueOf(getGroupSize())));
|
||||
groupSizeLabel.setVisible(true);
|
||||
} else {
|
||||
groupSizeLabel.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
private ComboBox createDistributionSetCombo() {
|
||||
final ComboBox dsSet = SPUIComponentProvider.getComboBox("", "", null, null, true, "",
|
||||
i18n.get("prompt.distribution.set"));
|
||||
dsSet.setImmediate(true);
|
||||
dsSet.setPageLength(7);
|
||||
dsSet.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME);
|
||||
dsSet.setId(SPUIComponetIdProvider.ROLLOUT_DS_ID);
|
||||
dsSet.setSizeFull();
|
||||
return dsSet;
|
||||
}
|
||||
|
||||
private void populateDistributionSet() {
|
||||
final Container container = createDsComboContainer();
|
||||
distributionSet.setContainerDataSource(container);
|
||||
}
|
||||
|
||||
private Container createDsComboContainer() {
|
||||
final BeanQueryFactory<DistBeanQuery> distributionQF = new BeanQueryFactory<>(DistBeanQuery.class);
|
||||
return new LazyQueryContainer(new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE,
|
||||
SPUILabelDefinitions.VAR_DIST_ID_NAME), distributionQF);
|
||||
|
||||
}
|
||||
|
||||
private TextField createRolloutNameField() {
|
||||
final TextField rolloutNameField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, true, null,
|
||||
i18n.get("textfield.name"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
rolloutNameField.setId(SPUIComponetIdProvider.ROLLOUT_NAME_FIELD_ID);
|
||||
rolloutNameField.setSizeFull();
|
||||
return rolloutNameField;
|
||||
}
|
||||
|
||||
private Label createMandatoryLabel() {
|
||||
final Label madatoryLbl = new Label(i18n.get("label.mandatory.field"));
|
||||
madatoryLbl.addStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_ERROR + " " + ValoTheme.LABEL_SMALL);
|
||||
return madatoryLbl;
|
||||
}
|
||||
|
||||
private String getRolloutName() {
|
||||
return HawkbitCommonUtil.trimAndNullIfEmpty(rolloutName.getValue());
|
||||
}
|
||||
|
||||
private DistributionSetIdName getDistributionSetSelected() {
|
||||
return (DistributionSetIdName) distributionSet.getValue();
|
||||
}
|
||||
|
||||
class ErrorThresoldOptionValidator implements Validator {
|
||||
private static final long serialVersionUID = 9049939751976326550L;
|
||||
|
||||
@Override
|
||||
public void validate(final Object value) {
|
||||
try {
|
||||
if (HawkbitCommonUtil.trimAndNullIfEmpty(noOfGroups.getValue()) == null
|
||||
|| HawkbitCommonUtil.trimAndNullIfEmpty((String) targetFilterQueryCombo.getValue()) == null) {
|
||||
uiNotification.displayValidationError(i18n
|
||||
.get("message.rollout.noofgroups.or.targetfilter.missing"));
|
||||
} else {
|
||||
new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value);
|
||||
final int groupSize = getGroupSize();
|
||||
new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, groupSize), 0, groupSize)
|
||||
.validate(Integer.valueOf(value.toString()));
|
||||
}
|
||||
} catch (final InvalidValueException ex) {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private int getGroupSize() {
|
||||
return (int) Math.ceil((double) totalTargetsCount / Double.parseDouble(noOfGroups.getValue()));
|
||||
}
|
||||
|
||||
class ThresoldFieldValidator implements Validator {
|
||||
private static final long serialVersionUID = 9049939751976326550L;
|
||||
|
||||
@Override
|
||||
public void validate(final Object value) {
|
||||
try {
|
||||
new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value);
|
||||
new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, 100), 0, 100).validate(Integer
|
||||
.valueOf(value.toString()));
|
||||
} catch (final InvalidValueException ex) {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class GroupNumberValidator implements Validator {
|
||||
private static final long serialVersionUID = 9049939751976326550L;
|
||||
|
||||
@Override
|
||||
public void validate(final Object value) {
|
||||
try {
|
||||
new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value);
|
||||
new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, 500), 0, 500).validate(Integer
|
||||
.valueOf(value.toString()));
|
||||
} catch (final InvalidValueException ex) {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Populate rollout details.
|
||||
*
|
||||
* @param rolloutId
|
||||
* rollout id
|
||||
*/
|
||||
public void populateData(final Long rolloutId) {
|
||||
resetComponents();
|
||||
editRollout = Boolean.TRUE;
|
||||
rolloutForEdit = rolloutManagement.findRolloutById(rolloutId);
|
||||
rolloutName.setValue(rolloutForEdit.getName());
|
||||
description.setValue(rolloutForEdit.getDescription());
|
||||
distributionSet.setValue(rolloutForEdit.getDistributionSet().getDistributionSetIdName());
|
||||
final List<RolloutGroup> rolloutGroups = rolloutForEdit.getRolloutGroups();
|
||||
setThresoldValues(rolloutGroups);
|
||||
setActionType(rolloutForEdit);
|
||||
if (rolloutForEdit.getStatus() != RolloutStatus.READY) {
|
||||
disableRequiredFieldsOnEdit();
|
||||
}
|
||||
|
||||
noOfGroups.setEnabled(false);
|
||||
targetFilterQuery.setValue(rolloutForEdit.getTargetFilterQuery());
|
||||
targetFilterQuery.setVisible(true);
|
||||
targetFilterQueryCombo.setVisible(false);
|
||||
|
||||
totalTargetsCount = targetManagement.countTargetByTargetFilterQuery(rolloutForEdit.getTargetFilterQuery());
|
||||
totalTargetsLabel.setValue(getTotalTargetMessage());
|
||||
totalTargetsLabel.setVisible(true);
|
||||
}
|
||||
|
||||
private void disableRequiredFieldsOnEdit() {
|
||||
distributionSet.setEnabled(false);
|
||||
errorThreshold.setEnabled(false);
|
||||
triggerThreshold.setEnabled(false);
|
||||
actionTypeOptionGroupLayout.getActionTypeOptionGroup().setEnabled(false);
|
||||
errorThresholdOptionGroup.setEnabled(false);
|
||||
actionTypeOptionGroupLayout.addStyleName(SPUIStyleDefinitions.DISABLE_ACTION_TYPE_LAYOUT);
|
||||
}
|
||||
|
||||
private void enableFields() {
|
||||
distributionSet.setEnabled(true);
|
||||
errorThreshold.setEnabled(true);
|
||||
triggerThreshold.setEnabled(true);
|
||||
actionTypeOptionGroupLayout.getActionTypeOptionGroup().setEnabled(true);
|
||||
actionTypeOptionGroupLayout.removeStyleName(SPUIStyleDefinitions.DISABLE_ACTION_TYPE_LAYOUT);
|
||||
noOfGroups.setEnabled(true);
|
||||
targetFilterQueryCombo.setEnabled(true);
|
||||
errorThresholdOptionGroup.setEnabled(true);
|
||||
}
|
||||
|
||||
private void setActionType(final Rollout rollout) {
|
||||
for (final ActionTypeOptionGroupLayout.ActionTypeOption groupAction : ActionTypeOptionGroupLayout.ActionTypeOption
|
||||
.values()) {
|
||||
if (groupAction.getActionType() == rollout.getActionType()) {
|
||||
actionTypeOptionGroupLayout.getActionTypeOptionGroup().setValue(groupAction);
|
||||
final SimpleDateFormat format = new SimpleDateFormat(SPUIDefinitions.LAST_QUERY_DATE_FORMAT);
|
||||
format.setTimeZone(SPDateTimeUtil.getBrowserTimeZone());
|
||||
actionTypeOptionGroupLayout.getForcedTimeDateField().setValue(new Date(rollout.getForcedTime()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rolloutGroups
|
||||
*/
|
||||
private void setThresoldValues(final List<RolloutGroup> rolloutGroups) {
|
||||
if (null != rolloutGroups && !rolloutGroups.isEmpty()) {
|
||||
errorThreshold.setValue(rolloutGroups.get(0).getErrorConditionExp());
|
||||
triggerThreshold.setValue(rolloutGroups.get(0).getSuccessConditionExp());
|
||||
noOfGroups.setValue(String.valueOf(rolloutGroups.size()));
|
||||
} else {
|
||||
errorThreshold.setValue("0");
|
||||
triggerThreshold.setValue("0");
|
||||
noOfGroups.setValue("0");
|
||||
}
|
||||
}
|
||||
|
||||
enum SAVESTARTOPTIONS {
|
||||
SAVE("Save"), START("Start");
|
||||
|
||||
String value;
|
||||
|
||||
private SAVESTARTOPTIONS(final String val) {
|
||||
this.value = val;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the value
|
||||
*/
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
enum ERRORTHRESOLDOPTIONS {
|
||||
PERCENT("%"), COUNT("Count");
|
||||
|
||||
String value;
|
||||
|
||||
private ERRORTHRESOLDOPTIONS(final String val) {
|
||||
this.value = val;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the value
|
||||
*/
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
/**
|
||||
* 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.rollout;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.hawkbit.repository.DistributionSetFilter;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetFilter.DistributionSetFilterBuilder;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.ui.components.ProxyDistribution;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
|
||||
import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
|
||||
|
||||
/**
|
||||
* Bean query for distribution set combo.
|
||||
*
|
||||
*/
|
||||
public class DistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
|
||||
|
||||
private static final long serialVersionUID = 5176481314404662215L;
|
||||
private Sort sort = new Sort(Direction.ASC, "name", "version");
|
||||
private transient DistributionSetManagement distributionSetManagement;
|
||||
private transient Page<DistributionSet> firstPageDistributionSets = null;
|
||||
|
||||
/**
|
||||
* Parametric Constructor.
|
||||
*
|
||||
* @param definition
|
||||
* as QueryDefinition
|
||||
* @param queryConfig
|
||||
* as Config
|
||||
* @param sortPropertyIds
|
||||
* as sort
|
||||
* @param sortStates
|
||||
* as Sort status
|
||||
*/
|
||||
public DistBeanQuery(final QueryDefinition definition, final Map<String, Object> queryConfig,
|
||||
final Object[] sortPropertyIds, final boolean[] sortStates) {
|
||||
super(definition, queryConfig, sortPropertyIds, sortStates);
|
||||
|
||||
if (sortStates.length > 0) {
|
||||
// Initalize sort
|
||||
sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortPropertyIds[0]);
|
||||
// Add sort
|
||||
for (int distId = 1; distId < sortPropertyIds.length; distId++) {
|
||||
sort.and(new Sort(sortStates[distId] ? Direction.ASC : Direction.DESC, (String) sortPropertyIds[distId]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#constructBean()
|
||||
*/
|
||||
@Override
|
||||
protected ProxyDistribution constructBean() {
|
||||
return new ProxyDistribution();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#loadBeans(int,
|
||||
* int)
|
||||
*/
|
||||
@Override
|
||||
protected List<ProxyDistribution> loadBeans(final int startIndex, final int count) {
|
||||
Page<DistributionSet> distBeans;
|
||||
final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder().setIsDeleted(false)
|
||||
.build();
|
||||
if (startIndex == 0 && firstPageDistributionSets != null) {
|
||||
distBeans = firstPageDistributionSets;
|
||||
} else {
|
||||
distBeans = getDistributionSetManagement().findDistributionSetsByFilters(
|
||||
new PageRequest(startIndex / count, count, sort), distributionSetFilter);
|
||||
}
|
||||
return createProxyDistributions(distBeans);
|
||||
}
|
||||
|
||||
private List<ProxyDistribution> createProxyDistributions(final Page<DistributionSet> distBeans) {
|
||||
final List<ProxyDistribution> proxyDistributions = new ArrayList<>();
|
||||
for (final DistributionSet distributionSet : distBeans) {
|
||||
final ProxyDistribution proxyDistribution = new ProxyDistribution();
|
||||
proxyDistribution.setName(HawkbitCommonUtil.getFormattedNameVersion(distributionSet.getName(),
|
||||
distributionSet.getVersion()));
|
||||
proxyDistribution.setDescription(distributionSet.getDescription());
|
||||
proxyDistribution.setDistId(distributionSet.getId());
|
||||
proxyDistribution.setId(distributionSet.getId());
|
||||
proxyDistribution.setVersion(distributionSet.getVersion());
|
||||
proxyDistribution.setCreatedDate(SPDateTimeUtil.getFormattedDate(distributionSet.getCreatedAt()));
|
||||
proxyDistribution.setLastModifiedDate(SPDateTimeUtil.getFormattedDate(distributionSet.getLastModifiedAt()));
|
||||
proxyDistribution.setDescription(distributionSet.getDescription());
|
||||
proxyDistribution.setCreatedByUser(HawkbitCommonUtil.getIMUser(distributionSet.getCreatedBy()));
|
||||
proxyDistribution.setModifiedByUser(HawkbitCommonUtil.getIMUser(distributionSet.getLastModifiedBy()));
|
||||
proxyDistribution.setIsComplete(distributionSet.isComplete());
|
||||
proxyDistributions.add(proxyDistribution);
|
||||
}
|
||||
return proxyDistributions;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#saveBeans(java.
|
||||
* util.List, java.util.List, java.util.List)
|
||||
*/
|
||||
@Override
|
||||
protected void saveBeans(final List<ProxyDistribution> arg0, final List<ProxyDistribution> arg1,
|
||||
final List<ProxyDistribution> arg2) {
|
||||
// Add,Delete and Update are performed through repository methods
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#size()
|
||||
*/
|
||||
@Override
|
||||
public int size() {
|
||||
final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder().setIsDeleted(false)
|
||||
.setIsComplete(true).build();
|
||||
|
||||
firstPageDistributionSets = getDistributionSetManagement().findDistributionSetsByFilters(
|
||||
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), distributionSetFilter);
|
||||
final long size = firstPageDistributionSets.getTotalElements();
|
||||
if (size > Integer.MAX_VALUE) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
return (int) size;
|
||||
}
|
||||
|
||||
private DistributionSetManagement getDistributionSetManagement() {
|
||||
if (distributionSetManagement == null) {
|
||||
distributionSetManagement = SpringContextHelper.getBean(DistributionSetManagement.class);
|
||||
}
|
||||
return distributionSetManagement;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||
in.defaultReadObject();
|
||||
firstPageDistributionSets = (Page<DistributionSet>) in.readObject();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
/**
|
||||
* 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.rollout;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
|
||||
/**
|
||||
* Proxy rollout with suctome properties.
|
||||
*
|
||||
*/
|
||||
public class ProxyRollout extends Rollout {
|
||||
|
||||
private static final long serialVersionUID = 4539849939617681918L;
|
||||
|
||||
private String distributionSetNameVersion;
|
||||
|
||||
private String createdDate;
|
||||
|
||||
private String modifiedDate;
|
||||
|
||||
private String createdBy;
|
||||
|
||||
private String lastModifiedBy;
|
||||
|
||||
private Long numberOfGroups;
|
||||
|
||||
private Long runningTargetsCount;
|
||||
|
||||
private Long scheduledTargetsCount;
|
||||
|
||||
private Long cancelledTargetsCount;
|
||||
|
||||
private Long errorTargetsCount;
|
||||
|
||||
private Long finishedTargetsCount;
|
||||
|
||||
private Long notStartedTargetsCount;
|
||||
|
||||
private Boolean isActionRecieved = Boolean.FALSE;
|
||||
|
||||
private String totalTargetsCount;
|
||||
|
||||
/**
|
||||
* @return the distributionSetNameVersion
|
||||
*/
|
||||
public String getDistributionSetNameVersion() {
|
||||
return distributionSetNameVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param distributionSetNameVersion
|
||||
* the distributionSetNameVersion to set
|
||||
*/
|
||||
public void setDistributionSetNameVersion(final String distributionSetNameVersion) {
|
||||
this.distributionSetNameVersion = distributionSetNameVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the numberOfGroups
|
||||
*/
|
||||
public Long getNumberOfGroups() {
|
||||
return numberOfGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param numberOfGroups
|
||||
* the numberOfGroups to set
|
||||
*/
|
||||
public void setNumberOfGroups(final Long numberOfGroups) {
|
||||
this.numberOfGroups = numberOfGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the createdDate
|
||||
*/
|
||||
public String getCreatedDate() {
|
||||
return createdDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 createdBy
|
||||
*/
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param createdBy
|
||||
* the createdBy to set
|
||||
*/
|
||||
public void setCreatedBy(final String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the lastModifiedBy
|
||||
*/
|
||||
public String getLastModifiedBy() {
|
||||
return lastModifiedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param lastModifiedBy
|
||||
* the lastModifiedBy to set
|
||||
*/
|
||||
public void setLastModifiedBy(final String lastModifiedBy) {
|
||||
this.lastModifiedBy = lastModifiedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the runningTargetsCount
|
||||
*/
|
||||
public Long getRunningTargetsCount() {
|
||||
return runningTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param runningTargetsCount
|
||||
* the runningTargetsCount to set
|
||||
*/
|
||||
public void setRunningTargetsCount(final Long runningTargetsCount) {
|
||||
this.runningTargetsCount = runningTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the scheduledTargetsCount
|
||||
*/
|
||||
public Long getScheduledTargetsCount() {
|
||||
return scheduledTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param scheduledTargetsCount
|
||||
* the scheduledTargetsCount to set
|
||||
*/
|
||||
public void setScheduledTargetsCount(final Long scheduledTargetsCount) {
|
||||
this.scheduledTargetsCount = scheduledTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cancelledTargetsCount
|
||||
*/
|
||||
public Long getCancelledTargetsCount() {
|
||||
return cancelledTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cancelledTargetsCount
|
||||
* the cancelledTargetsCount to set
|
||||
*/
|
||||
public void setCancelledTargetsCount(final Long cancelledTargetsCount) {
|
||||
this.cancelledTargetsCount = cancelledTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the errorTargetsCount
|
||||
*/
|
||||
public Long getErrorTargetsCount() {
|
||||
return errorTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param errorTargetsCount
|
||||
* the errorTargetsCount to set
|
||||
*/
|
||||
public void setErrorTargetsCount(final Long errorTargetsCount) {
|
||||
this.errorTargetsCount = errorTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the finishedTargetsCount
|
||||
*/
|
||||
public Long getFinishedTargetsCount() {
|
||||
return finishedTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param finishedTargetsCount
|
||||
* the finishedTargetsCount to set
|
||||
*/
|
||||
public void setFinishedTargetsCount(final Long finishedTargetsCount) {
|
||||
this.finishedTargetsCount = finishedTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 notStartedTargetsCount
|
||||
*/
|
||||
public Long getNotStartedTargetsCount() {
|
||||
return notStartedTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param notStartedTargetsCount
|
||||
* the notStartedTargetsCount to set
|
||||
*/
|
||||
public void setNotStartedTargetsCount(final Long notStartedTargetsCount) {
|
||||
this.notStartedTargetsCount = notStartedTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the totalTargetsCount
|
||||
*/
|
||||
public String getTotalTargetsCount() {
|
||||
return totalTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param totalTargetsCount
|
||||
* the totalTargetsCount to set
|
||||
*/
|
||||
public void setTotalTargetsCount(final String totalTargetsCount) {
|
||||
this.totalTargetsCount = totalTargetsCount;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
/**
|
||||
* 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.rollout;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
|
||||
/**
|
||||
* Proxy rollout group with suctome properties.
|
||||
*
|
||||
*/
|
||||
public class ProxyRolloutGroup extends RolloutGroup {
|
||||
|
||||
private static final long serialVersionUID = -2745056813306692356L;
|
||||
|
||||
private String createdDate;
|
||||
|
||||
private String modifiedDate;
|
||||
|
||||
private String createdBy;
|
||||
|
||||
private String lastModifiedBy;
|
||||
|
||||
private String finishedPercentage;
|
||||
|
||||
private Long runningTargetsCount;
|
||||
|
||||
private Long scheduledTargetsCount;
|
||||
|
||||
private Long cancelledTargetsCount;
|
||||
|
||||
private Long errorTargetsCount;
|
||||
|
||||
private Long finishedTargetsCount;
|
||||
|
||||
private Long notStartedTargetsCount;
|
||||
|
||||
private Boolean isActionRecieved = Boolean.FALSE;
|
||||
|
||||
private String totalTargetsCount;
|
||||
|
||||
/**
|
||||
* @return the createdDate
|
||||
*/
|
||||
public String getCreatedDate() {
|
||||
return createdDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 createdBy
|
||||
*/
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param createdBy
|
||||
* the createdBy to set
|
||||
*/
|
||||
public void setCreatedBy(final String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the lastModifiedBy
|
||||
*/
|
||||
public String getLastModifiedBy() {
|
||||
return lastModifiedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param lastModifiedBy
|
||||
* the lastModifiedBy to set
|
||||
*/
|
||||
public void setLastModifiedBy(final String lastModifiedBy) {
|
||||
this.lastModifiedBy = lastModifiedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the finishedPercentage
|
||||
*/
|
||||
public String getFinishedPercentage() {
|
||||
return finishedPercentage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param finishedPercentage
|
||||
* the finishedPercentage to set
|
||||
*/
|
||||
public void setFinishedPercentage(final String finishedPercentage) {
|
||||
this.finishedPercentage = finishedPercentage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the runningTargetsCount
|
||||
*/
|
||||
public Long getRunningTargetsCount() {
|
||||
return runningTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param runningTargetsCount
|
||||
* the runningTargetsCount to set
|
||||
*/
|
||||
public void setRunningTargetsCount(final Long runningTargetsCount) {
|
||||
this.runningTargetsCount = runningTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the scheduledTargetsCount
|
||||
*/
|
||||
public Long getScheduledTargetsCount() {
|
||||
return scheduledTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param scheduledTargetsCount
|
||||
* the scheduledTargetsCount to set
|
||||
*/
|
||||
public void setScheduledTargetsCount(final Long scheduledTargetsCount) {
|
||||
this.scheduledTargetsCount = scheduledTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cancelledTargetsCount
|
||||
*/
|
||||
public Long getCancelledTargetsCount() {
|
||||
return cancelledTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cancelledTargetsCount
|
||||
* the cancelledTargetsCount to set
|
||||
*/
|
||||
public void setCancelledTargetsCount(final Long cancelledTargetsCount) {
|
||||
this.cancelledTargetsCount = cancelledTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the errorTargetsCount
|
||||
*/
|
||||
public Long getErrorTargetsCount() {
|
||||
return errorTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param errorTargetsCount
|
||||
* the errorTargetsCount to set
|
||||
*/
|
||||
public void setErrorTargetsCount(final Long errorTargetsCount) {
|
||||
this.errorTargetsCount = errorTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the finishedTargetsCount
|
||||
*/
|
||||
public Long getFinishedTargetsCount() {
|
||||
return finishedTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param finishedTargetsCount
|
||||
* the finishedTargetsCount to set
|
||||
*/
|
||||
public void setFinishedTargetsCount(final Long finishedTargetsCount) {
|
||||
this.finishedTargetsCount = finishedTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the notStartedTargetsCount
|
||||
*/
|
||||
public Long getNotStartedTargetsCount() {
|
||||
return notStartedTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param notStartedTargetsCount
|
||||
* the notStartedTargetsCount to set
|
||||
*/
|
||||
public void setNotStartedTargetsCount(final Long notStartedTargetsCount) {
|
||||
this.notStartedTargetsCount = notStartedTargetsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
/**
|
||||
* 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.rollout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Slice;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
|
||||
import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
/**
|
||||
*
|
||||
* Simple implementation of generics bean query which dynamically loads a batch
|
||||
* of {@link ProxyRollout} beans.
|
||||
*
|
||||
*/
|
||||
public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
|
||||
|
||||
private static final long serialVersionUID = 4027879794344836185L;
|
||||
|
||||
private final String searchText;
|
||||
|
||||
private Sort sort = new Sort(Direction.ASC, "createdAt");
|
||||
|
||||
private transient RolloutManagement rolloutManagement;
|
||||
|
||||
private transient TargetFilterQueryManagement filterQueryManagement;
|
||||
|
||||
private transient RolloutUIState rolloutUIState;
|
||||
|
||||
/**
|
||||
* Parametric Constructor.
|
||||
*
|
||||
* @param definition
|
||||
* as QueryDefinition
|
||||
* @param queryConfig
|
||||
* as Config
|
||||
* @param sortIds
|
||||
* as sort
|
||||
* @param sortStates
|
||||
* as Sort status
|
||||
*/
|
||||
public RolloutBeanQuery(final QueryDefinition definition, final Map<String, Object> queryConfig,
|
||||
final Object[] sortIds, final boolean[] sortStates) {
|
||||
super(definition, queryConfig, sortIds, sortStates);
|
||||
|
||||
searchText = getSearchText();
|
||||
|
||||
if (HawkbitCommonUtil.checkBolArray(sortStates)) {
|
||||
// Initalize Sor
|
||||
sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortIds[0]);
|
||||
// Add sort.
|
||||
for (int targetId = 1; targetId < sortIds.length; targetId++) {
|
||||
sort.and(new Sort(sortStates[targetId] ? Direction.ASC : Direction.DESC, (String) sortIds[targetId]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getSearchText() {
|
||||
if (getRolloutUIState().getSearchText().isPresent()) {
|
||||
return String.format("%%%s%%", getRolloutUIState().getSearchText().get());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ProxyRollout constructBean() {
|
||||
return new ProxyRollout();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#loadBeans(int,
|
||||
* int)
|
||||
*/
|
||||
@Override
|
||||
protected List<ProxyRollout> loadBeans(final int startIndex, final int count) {
|
||||
final Slice<Rollout> rolloutBeans;
|
||||
if (Strings.isNullOrEmpty(searchText)) {
|
||||
rolloutBeans = getRolloutManagement().findAllRolloutsWithDetailedStatus(
|
||||
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort));
|
||||
} else {
|
||||
rolloutBeans = getRolloutManagement().findRolloutByFilters(
|
||||
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort),
|
||||
searchText);
|
||||
}
|
||||
return getProxyRolloutList(rolloutBeans);
|
||||
}
|
||||
|
||||
private List<ProxyRollout> getProxyRolloutList(final Slice<Rollout> rolloutBeans) {
|
||||
final List<ProxyRollout> proxyRolloutList = new ArrayList<>();
|
||||
for (final Rollout rollout : rolloutBeans) {
|
||||
final ProxyRollout proxyRollout = new ProxyRollout();
|
||||
proxyRollout.setName(rollout.getName());
|
||||
proxyRollout.setDescription(rollout.getDescription());
|
||||
final DistributionSet distributionSet = rollout.getDistributionSet();
|
||||
proxyRollout.setDistributionSetNameVersion(HawkbitCommonUtil.getFormattedNameVersion(
|
||||
distributionSet.getName(), distributionSet.getVersion()));
|
||||
proxyRollout.setDistributionSet(distributionSet);
|
||||
proxyRollout.setNumberOfGroups(Long.valueOf(rollout.getRolloutGroups().size()));
|
||||
proxyRollout.setCreatedDate(SPDateTimeUtil.getFormattedDate(rollout.getCreatedAt()));
|
||||
proxyRollout.setModifiedDate(SPDateTimeUtil.getFormattedDate(rollout.getLastModifiedAt()));
|
||||
proxyRollout.setCreatedBy(HawkbitCommonUtil.getIMUser(rollout.getCreatedBy()));
|
||||
proxyRollout.setLastModifiedBy(HawkbitCommonUtil.getIMUser(rollout.getLastModifiedBy()));
|
||||
proxyRollout.setForcedTime(rollout.getForcedTime());
|
||||
proxyRollout.setId(rollout.getId());
|
||||
proxyRollout.setStatus(rollout.getStatus());
|
||||
|
||||
final TotalTargetCountStatus totalTargetCountActionStatus = rollout.getTotalTargetCountStatus();
|
||||
|
||||
proxyRollout.setRunningTargetsCount(totalTargetCountActionStatus
|
||||
.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.RUNNING));
|
||||
proxyRollout.setErrorTargetsCount(totalTargetCountActionStatus
|
||||
.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.ERROR));
|
||||
proxyRollout.setCancelledTargetsCount(totalTargetCountActionStatus
|
||||
.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.CANCELLED));
|
||||
proxyRollout.setFinishedTargetsCount(totalTargetCountActionStatus
|
||||
.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.FINISHED));
|
||||
proxyRollout.setScheduledTargetsCount(totalTargetCountActionStatus
|
||||
.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.SCHEDULED));
|
||||
proxyRollout.setNotStartedTargetsCount(totalTargetCountActionStatus
|
||||
.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.NOTSTARTED));
|
||||
proxyRolloutList.add(proxyRollout);
|
||||
|
||||
proxyRollout.setTotalTargetsCount(String.valueOf(rollout.getTotalTargets()));
|
||||
|
||||
}
|
||||
return proxyRolloutList;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#saveBeans(java
|
||||
* .util.List, java.util.List, java.util.List)
|
||||
*/
|
||||
@Override
|
||||
protected void saveBeans(final List<ProxyRollout> arg0, final List<ProxyRollout> arg1, final List<ProxyRollout> arg2) {
|
||||
/**
|
||||
* CRUD operations on Target will be done through repository methods
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#size()
|
||||
*/
|
||||
@Override
|
||||
public int size() {
|
||||
int size = getRolloutManagement().countRolloutsAll().intValue();
|
||||
if (!Strings.isNullOrEmpty(searchText)) {
|
||||
size = getRolloutManagement().countRolloutsAllByFilters(searchText).intValue();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolloutManagement
|
||||
*/
|
||||
public RolloutManagement getRolloutManagement() {
|
||||
if (null == rolloutManagement) {
|
||||
rolloutManagement = SpringContextHelper.getBean(RolloutManagement.class);
|
||||
}
|
||||
return rolloutManagement;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the filterQueryManagement
|
||||
*/
|
||||
public TargetFilterQueryManagement getFilterQueryManagement() {
|
||||
if (null == filterQueryManagement) {
|
||||
filterQueryManagement = SpringContextHelper.getBean(TargetFilterQueryManagement.class);
|
||||
}
|
||||
return filterQueryManagement;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolloutUIState
|
||||
*/
|
||||
public RolloutUIState getRolloutUIState() {
|
||||
if (null == rolloutUIState) {
|
||||
rolloutUIState = SpringContextHelper.getBean(RolloutUIState.class);
|
||||
}
|
||||
return rolloutUIState;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
/**
|
||||
* 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.rollout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
|
||||
import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
|
||||
|
||||
/**
|
||||
* @author gah6kor
|
||||
*
|
||||
*/
|
||||
public class RolloutGroupBeanQuery extends AbstractBeanQuery<ProxyRolloutGroup> {
|
||||
|
||||
private static final long serialVersionUID = 5342450502894318589L;
|
||||
|
||||
private Sort sort = new Sort(Direction.ASC, "createdAt");
|
||||
|
||||
private transient Page<RolloutGroup> firstPageRolloutGroupSets = null;
|
||||
|
||||
private transient RolloutManagement rolloutManagement;
|
||||
|
||||
private transient RolloutGroupManagement rolloutGroupManagement;
|
||||
|
||||
private transient RolloutUIState rolloutUIState;
|
||||
|
||||
private final Long rolloutId;
|
||||
|
||||
/**
|
||||
* Parametric Constructor.
|
||||
*
|
||||
* @param definition
|
||||
* as QueryDefinition
|
||||
* @param queryConfig
|
||||
* as Config
|
||||
* @param sortPropertyIds
|
||||
* as sort
|
||||
* @param sortStates
|
||||
* as Sort status
|
||||
*/
|
||||
public RolloutGroupBeanQuery(final QueryDefinition definition, final Map<String, Object> queryConfig,
|
||||
final Object[] sortPropertyIds, final boolean[] sortStates) {
|
||||
super(definition, queryConfig, sortPropertyIds, sortStates);
|
||||
|
||||
rolloutId = getRolloutId();
|
||||
|
||||
if (HawkbitCommonUtil.checkBolArray(sortStates)) {
|
||||
// Initalize Sor
|
||||
sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortPropertyIds[0]);
|
||||
// Add sort.
|
||||
for (int targetId = 1; targetId < sortPropertyIds.length; targetId++) {
|
||||
sort.and(new Sort(sortStates[targetId] ? Direction.ASC : Direction.DESC,
|
||||
(String) sortPropertyIds[targetId]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
private Long getRolloutId() {
|
||||
return getRolloutUIState().getRolloutId().isPresent() ? getRolloutUIState().getRolloutId().get() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ProxyRolloutGroup constructBean() {
|
||||
return new ProxyRolloutGroup();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<ProxyRolloutGroup> loadBeans(final int startIndex, final int count) {
|
||||
List<RolloutGroup> proxyRolloutGroupsList = new ArrayList<>();
|
||||
if (startIndex == 0 && firstPageRolloutGroupSets != null) {
|
||||
proxyRolloutGroupsList = firstPageRolloutGroupSets.getContent();
|
||||
} else if (null != rolloutId) {
|
||||
proxyRolloutGroupsList = getRolloutGroupManagement()
|
||||
.findAllRolloutGroupsWithDetailedStatus(rolloutId, new PageRequest(startIndex / count, count))
|
||||
.getContent();
|
||||
}
|
||||
return getProxyRolloutGroupList(proxyRolloutGroupsList);
|
||||
}
|
||||
|
||||
private List<ProxyRolloutGroup> getProxyRolloutGroupList(final List<RolloutGroup> rolloutGroupBeans) {
|
||||
final List<ProxyRolloutGroup> proxyRolloutGroupsList = new ArrayList<>();
|
||||
for (final RolloutGroup rolloutGroup : rolloutGroupBeans) {
|
||||
final ProxyRolloutGroup proxyRolloutGroup = new ProxyRolloutGroup();
|
||||
proxyRolloutGroup.setName(rolloutGroup.getName());
|
||||
proxyRolloutGroup.setDescription(rolloutGroup.getDescription());
|
||||
proxyRolloutGroup.setCreatedDate(SPDateTimeUtil.getFormattedDate(rolloutGroup.getCreatedAt()));
|
||||
proxyRolloutGroup.setModifiedDate(SPDateTimeUtil.getFormattedDate(rolloutGroup.getLastModifiedAt()));
|
||||
proxyRolloutGroup.setCreatedBy(HawkbitCommonUtil.getIMUser(rolloutGroup.getCreatedBy()));
|
||||
proxyRolloutGroup.setLastModifiedBy(HawkbitCommonUtil.getIMUser(rolloutGroup.getLastModifiedBy()));
|
||||
proxyRolloutGroup.setId(rolloutGroup.getId());
|
||||
proxyRolloutGroup.setStatus(rolloutGroup.getStatus());
|
||||
proxyRolloutGroup.setErrorAction(rolloutGroup.getErrorAction());
|
||||
proxyRolloutGroup.setErrorActionExp(rolloutGroup.getErrorActionExp());
|
||||
proxyRolloutGroup.setErrorCondition(rolloutGroup.getErrorCondition());
|
||||
proxyRolloutGroup.setErrorConditionExp(rolloutGroup.getErrorConditionExp());
|
||||
proxyRolloutGroup.setSuccessCondition(rolloutGroup.getSuccessCondition());
|
||||
proxyRolloutGroup.setSuccessConditionExp(rolloutGroup.getSuccessConditionExp());
|
||||
proxyRolloutGroup.setFinishedPercentage(calculateFinishedPercentage(rolloutGroup));
|
||||
|
||||
final TotalTargetCountStatus totalTargetCountActionStatus = rolloutGroup.getTotalTargetCountStatus();
|
||||
|
||||
proxyRolloutGroup.setRunningTargetsCount(
|
||||
totalTargetCountActionStatus.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.RUNNING));
|
||||
proxyRolloutGroup.setErrorTargetsCount(
|
||||
totalTargetCountActionStatus.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.ERROR));
|
||||
proxyRolloutGroup.setCancelledTargetsCount(
|
||||
totalTargetCountActionStatus.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.CANCELLED));
|
||||
proxyRolloutGroup.setFinishedTargetsCount(
|
||||
totalTargetCountActionStatus.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.FINISHED));
|
||||
proxyRolloutGroup.setScheduledTargetsCount(
|
||||
totalTargetCountActionStatus.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.SCHEDULED));
|
||||
proxyRolloutGroup.setNotStartedTargetsCount(
|
||||
totalTargetCountActionStatus.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.NOTSTARTED));
|
||||
|
||||
proxyRolloutGroup.setTotalTargetsCount(String.valueOf(rolloutGroup.getTotalTargets()));
|
||||
|
||||
proxyRolloutGroupsList.add(proxyRolloutGroup);
|
||||
}
|
||||
return proxyRolloutGroupsList;
|
||||
}
|
||||
|
||||
private String calculateFinishedPercentage(final RolloutGroup rolloutGroup) {
|
||||
return HawkbitCommonUtil.formattingFinishedPercentage(rolloutGroup, getRolloutManagement()
|
||||
.getFinishedPercentForRunningGroup(rolloutGroup.getRollout().getId(), rolloutGroup));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void saveBeans(final List<ProxyRolloutGroup> arg0, final List<ProxyRolloutGroup> arg1,
|
||||
final List<ProxyRolloutGroup> arg2) {
|
||||
/**
|
||||
* CRUD operations be done through repository methods.
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
long size = 0;
|
||||
if (null != rolloutId) {
|
||||
firstPageRolloutGroupSets = getRolloutGroupManagement().findAllRolloutGroupsWithDetailedStatus(rolloutId,
|
||||
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort));
|
||||
size = firstPageRolloutGroupSets.getTotalElements();
|
||||
}
|
||||
if (size > Integer.MAX_VALUE) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
return (int) size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolloutManagement
|
||||
*/
|
||||
public RolloutManagement getRolloutManagement() {
|
||||
if (null == rolloutManagement) {
|
||||
rolloutManagement = SpringContextHelper.getBean(RolloutManagement.class);
|
||||
}
|
||||
return rolloutManagement;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolloutManagement
|
||||
*/
|
||||
public RolloutGroupManagement getRolloutGroupManagement() {
|
||||
if (null == rolloutGroupManagement) {
|
||||
rolloutGroupManagement = SpringContextHelper.getBean(RolloutGroupManagement.class);
|
||||
}
|
||||
return rolloutGroupManagement;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolloutUIState
|
||||
*/
|
||||
public RolloutUIState getRolloutUIState() {
|
||||
if (null == rolloutUIState) {
|
||||
rolloutUIState = SpringContextHelper.getBean(RolloutUIState.class);
|
||||
}
|
||||
return rolloutUIState;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,361 @@
|
||||
/**
|
||||
* 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.rollout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.RolloutGroupChangeEvent;
|
||||
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
|
||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
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.TableColumn;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
||||
import org.vaadin.alump.distributionbar.DistributionBar;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
import com.vaadin.data.Container;
|
||||
import com.vaadin.data.Item;
|
||||
import com.vaadin.data.Property;
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.shared.ui.label.ContentMode;
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.Component;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Rollout Group Table in List view.
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
public class RolloutGroupListTable extends AbstractSimpleTable {
|
||||
|
||||
private static final String IS_ACTION_RECIEVED = "isActionRecieved";
|
||||
|
||||
private static final long serialVersionUID = 1182656768844867443L;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private transient RolloutGroupManagement rolloutGroupManagement;
|
||||
|
||||
@Autowired
|
||||
private transient RolloutManagement rolloutManagement;
|
||||
|
||||
@Autowired
|
||||
private transient RolloutUIState rolloutUIState;
|
||||
|
||||
@Autowired
|
||||
private transient SpPermissionChecker permissionChecker;
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final RolloutEvent event) {
|
||||
if (event == RolloutEvent.SHOW_ROLLOUT_GROUPS) {
|
||||
((LazyQueryContainer) getContainerDataSource()).refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Handles the RolloutGroupChangeEvent to refresh the item in the table.
|
||||
*
|
||||
*
|
||||
* @param rolloutGroupChangeEvent
|
||||
* the event which contains the rollout group which has been
|
||||
* change
|
||||
*/
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
public void onEvent(final RolloutGroupChangeEvent rolloutGroupChangeEvent) {
|
||||
final List<Object> visibleItemIds = (List<Object>) getVisibleItemIds();
|
||||
if (visibleItemIds.contains(rolloutGroupChangeEvent.getRolloutGroupId())) {
|
||||
final RolloutGroup rolloutGroup = rolloutGroupManagement
|
||||
.findRolloutGroupWithDetailedStatus(rolloutGroupChangeEvent.getRolloutGroupId());
|
||||
final TotalTargetCountStatus totalTargetCountStatus = rolloutGroup.getTotalTargetCountStatus();
|
||||
final LazyQueryContainer rolloutContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
final Item item = rolloutContainer.getItem(rolloutGroup.getId());
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_STATUS).setValue(rolloutGroup.getStatus());
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_COUNT_TARGETS_RUNNING).setValue(
|
||||
totalTargetCountStatus.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.RUNNING));
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_COUNT_TARGETS_ERROR)
|
||||
.setValue(totalTargetCountStatus.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.ERROR));
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_COUNT_TARGETS_FINISHED).setValue(
|
||||
totalTargetCountStatus.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.FINISHED));
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_COUNT_TARGETS_NOT_STARTED).setValue(
|
||||
totalTargetCountStatus.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.NOTSTARTED));
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_COUNT_TARGETS_CANCELLED).setValue(
|
||||
totalTargetCountStatus.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.CANCELLED));
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_COUNT_TARGETS_SCHEDULED).setValue(
|
||||
totalTargetCountStatus.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.SCHEDULED));
|
||||
item.getItemProperty(IS_ACTION_RECIEVED)
|
||||
.setValue(!(Boolean) item.getItemProperty(IS_ACTION_RECIEVED).getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TableColumn> getTableVisibleColumns() {
|
||||
final List<TableColumn> columnList = new ArrayList<>();
|
||||
columnList.add(new TableColumn(SPUIDefinitions.ROLLOUT_GROUP_NAME, i18n.get("header.name"), 0.1f));
|
||||
columnList.add(new TableColumn(SPUIDefinitions.ROLLOUT_GROUP_STATUS, i18n.get("header.status"), 0.1f));
|
||||
columnList.add(new TableColumn(SPUIDefinitions.DETAIL_STATUS, i18n.get("header.detail.status"), 0.42f));
|
||||
columnList
|
||||
.add(new TableColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS, i18n.get("header.total.targets"), 0.08f));
|
||||
columnList.add(new TableColumn(SPUIDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE,
|
||||
i18n.get("header.rolloutgroup.installed.percentage"), 0.1f));
|
||||
columnList.add(new TableColumn(SPUIDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD,
|
||||
i18n.get("header.rolloutgroup.threshold.error"), 0.1f));
|
||||
columnList.add(new TableColumn(SPUIDefinitions.ROLLOUT_GROUP_THRESHOLD,
|
||||
i18n.get("header.rolloutgroup.threshold"), 0.1f));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_DATE, i18n.get("header.createdDate"), 0.15f));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_USER, i18n.get("header.createdBy"), 0.15f));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_MODIFIED_DATE, i18n.get("header.modifiedDate"), 0.15f));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_MODIFIED_BY, i18n.get("header.modifiedBy"), 0.15f));
|
||||
return columnList;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Container createContainer() {
|
||||
final BeanQueryFactory<RolloutGroupBeanQuery> rolloutQf = new BeanQueryFactory<>(RolloutGroupBeanQuery.class);
|
||||
return new LazyQueryContainer(
|
||||
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_ID), rolloutQf);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addContainerProperties(final Container container) {
|
||||
final LazyQueryContainer rolloutTableContainer = (LazyQueryContainer) container;
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_ID, String.class, null, false, false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, "", false, false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, null, false, false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_STATUS, RolloutGroupStatus.class, null,
|
||||
false, false);
|
||||
rolloutTableContainer.addContainerProperty(SPUIDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE, String.class,
|
||||
null, false, false);
|
||||
rolloutTableContainer.addContainerProperty(SPUIDefinitions.ROLLOUT_GROUP_ERROR_THRESHOLD, String.class, null,
|
||||
false, false);
|
||||
|
||||
rolloutTableContainer.addContainerProperty(SPUIDefinitions.ROLLOUT_GROUP_THRESHOLD, String.class, null, false,
|
||||
false);
|
||||
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, String.class, null, false,
|
||||
false);
|
||||
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_DATE, String.class, null, false,
|
||||
false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_USER, String.class, null, false,
|
||||
false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_BY, String.class, null, false,
|
||||
false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_COUNT_TARGETS_NOT_STARTED, Long.class, 0L,
|
||||
false, false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_COUNT_TARGETS_RUNNING, Long.class, 0L,
|
||||
false, false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_COUNT_TARGETS_SCHEDULED, Long.class, 0L,
|
||||
false, false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_COUNT_TARGETS_ERROR, Long.class, 0L, false,
|
||||
false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_COUNT_TARGETS_FINISHED, Long.class, 0L,
|
||||
false, false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_COUNT_TARGETS_CANCELLED, Long.class, 0L,
|
||||
false, false);
|
||||
rolloutTableContainer.addContainerProperty(IS_ACTION_RECIEVED, Boolean.class, false, false, false);
|
||||
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS, String.class, "0", false,
|
||||
false);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTableId() {
|
||||
return SPUIComponetIdProvider.ROLLOUT_GROUP_LIST_TABLE_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onValueChange() {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addCustomGeneratedColumns() {
|
||||
addGeneratedColumn(SPUIDefinitions.ROLLOUT_GROUP_NAME,
|
||||
(source, itemId, columnId) -> getRolloutNameLink(itemId));
|
||||
addGeneratedColumn(SPUIDefinitions.ROLLOUT_GROUP_STATUS, (source, itemId, columnId) -> getStatusLabel(itemId));
|
||||
addGeneratedColumn(SPUIDefinitions.DETAIL_STATUS, (source, itemId, columnId) -> getProgressBar(itemId));
|
||||
setColumnAlignment(SPUIDefinitions.ROLLOUT_GROUP_STATUS, Align.CENTER);
|
||||
|
||||
}
|
||||
|
||||
private Label getStatusLabel(final Object itemId) {
|
||||
final Label statusLabel = new Label();
|
||||
statusLabel.setHeightUndefined();
|
||||
statusLabel.setContentMode(ContentMode.HTML);
|
||||
setStatusIcon(itemId, statusLabel);
|
||||
statusLabel.setDescription(getDescription(itemId));
|
||||
statusLabel.setSizeUndefined();
|
||||
addPropertyChangeListener(itemId, statusLabel);
|
||||
return statusLabel;
|
||||
}
|
||||
|
||||
private void addPropertyChangeListener(final Object itemId, final Label statusLabel) {
|
||||
final Property status = getContainerProperty(itemId, SPUILabelDefinitions.VAR_STATUS);
|
||||
final Property.ValueChangeNotifier notifier = (Property.ValueChangeNotifier) status;
|
||||
notifier.addValueChangeListener(new ValueChangeListener() {
|
||||
@Override
|
||||
public void valueChange(final com.vaadin.data.Property.ValueChangeEvent event) {
|
||||
setStatusIcon(itemId, statusLabel);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String getDescription(final Object itemId) {
|
||||
final Item item = getItem(itemId);
|
||||
if (item != null) {
|
||||
final RolloutGroupStatus rolloutGroupStatus = (RolloutGroupStatus) item
|
||||
.getItemProperty(SPUILabelDefinitions.VAR_STATUS).getValue();
|
||||
return rolloutGroupStatus.toString().toLowerCase();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void setStatusIcon(final Object itemId, final Label statusLabel) {
|
||||
final Item item = getItem(itemId);
|
||||
if (item != null) {
|
||||
final RolloutGroupStatus rolloutGroupStatus = (RolloutGroupStatus) item
|
||||
.getItemProperty(SPUILabelDefinitions.VAR_STATUS).getValue();
|
||||
setRolloutStatusIcon(rolloutGroupStatus, statusLabel);
|
||||
}
|
||||
}
|
||||
|
||||
private void setRolloutStatusIcon(final RolloutGroupStatus rolloutGroupStatus, final Label statusLabel) {
|
||||
switch (rolloutGroupStatus) {
|
||||
case FINISHED:
|
||||
statusLabel.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
|
||||
statusLabel.setStyleName("statusIconGreen");
|
||||
break;
|
||||
case SCHEDULED:
|
||||
statusLabel.setValue(FontAwesome.BULLSEYE.getHtml());
|
||||
statusLabel.setStyleName("statusIconBlue");
|
||||
break;
|
||||
case RUNNING:
|
||||
statusLabel.setValue(FontAwesome.ADJUST.getHtml());
|
||||
statusLabel.setStyleName("statusIconYellow");
|
||||
break;
|
||||
case READY:
|
||||
statusLabel.setValue(FontAwesome.DOT_CIRCLE_O.getHtml());
|
||||
statusLabel.setStyleName("statusIconLightBlue");
|
||||
break;
|
||||
case ERROR:
|
||||
statusLabel.setValue(FontAwesome.EXCLAMATION_CIRCLE.getHtml());
|
||||
statusLabel.setStyleName("statusIconRed");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
statusLabel.addStyleName(ValoTheme.LABEL_SMALL);
|
||||
}
|
||||
|
||||
private Component getRolloutNameLink(final Object itemId) {
|
||||
final Item row = getItem(itemId);
|
||||
final String rolloutGroupName = (String) row.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();
|
||||
if (permissionChecker.hasRolloutTargetsReadPermission()) {
|
||||
final Button rolloutGroupNameLink = SPUIComponentProvider.getButton(getDetailLinkId(rolloutGroupName),
|
||||
rolloutGroupName, SPUILabelDefinitions.SHOW_ROLLOUT_GROUP_DETAILS, null, false, null,
|
||||
SPUIButtonStyleSmallNoBorder.class);
|
||||
rolloutGroupNameLink.setData(rolloutGroupName);
|
||||
rolloutGroupNameLink.addStyleName(ValoTheme.LINK_SMALL + " " + "on-focus-no-border link");
|
||||
rolloutGroupNameLink.addClickListener(event -> showRolloutGroups(itemId));
|
||||
return rolloutGroupNameLink;
|
||||
} else {
|
||||
final Label rolloutGroupNameLabel = new Label();
|
||||
rolloutGroupNameLabel.setHeightUndefined();
|
||||
rolloutGroupNameLabel.addStyleName(ValoTheme.LABEL_SMALL);
|
||||
rolloutGroupNameLabel.setValue(rolloutGroupName);
|
||||
return rolloutGroupNameLabel;
|
||||
}
|
||||
}
|
||||
|
||||
private void showRolloutGroups(final Object itemId) {
|
||||
rolloutUIState.setRolloutGroup(rolloutGroupManagement.findRolloutGroupWithDetailedStatus((Long) itemId));
|
||||
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS);
|
||||
}
|
||||
|
||||
private DistributionBar getProgressBar(final Object itemId) {
|
||||
final DistributionBar bar = new DistributionBar(2);
|
||||
bar.setSizeFull();
|
||||
bar.setZeroSizedVisible(false);
|
||||
HawkbitCommonUtil.initialiseProgressBar(bar, getItem(itemId));
|
||||
addPropertyChangeListenerOnActionRecieved(itemId, bar);
|
||||
return bar;
|
||||
}
|
||||
|
||||
private void addPropertyChangeListenerOnActionRecieved(final Object itemId, final DistributionBar bar) {
|
||||
final Property status = getContainerProperty(itemId, IS_ACTION_RECIEVED);
|
||||
final Property.ValueChangeNotifier notifier = (Property.ValueChangeNotifier) status;
|
||||
notifier.addValueChangeListener(new ValueChangeListener() {
|
||||
@Override
|
||||
public void valueChange(final com.vaadin.data.Property.ValueChangeEvent event) {
|
||||
HawkbitCommonUtil.initialiseProgressBar(bar, getItem(itemId));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static String getDetailLinkId(final String rolloutGroupName) {
|
||||
return new StringBuilder(SPUIComponetIdProvider.ROLLOUT_GROUP_NAME_LINK_ID).append('.').append(rolloutGroupName)
|
||||
.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setCollapsiblecolumns() {
|
||||
setColumnCollapsed(SPUILabelDefinitions.VAR_CREATED_DATE, true);
|
||||
setColumnCollapsed(SPUILabelDefinitions.VAR_MODIFIED_DATE, true);
|
||||
setColumnCollapsed(SPUILabelDefinitions.VAR_CREATED_USER, true);
|
||||
setColumnCollapsed(SPUILabelDefinitions.VAR_MODIFIED_BY, true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
/**
|
||||
* 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.rollout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetWithActionStatus;
|
||||
import org.eclipse.hawkbit.ui.components.ProxyTarget;
|
||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
|
||||
import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
|
||||
|
||||
/**
|
||||
* @author gah6kor
|
||||
*
|
||||
*/
|
||||
public class RolloutGroupTargetsBeanQuery extends AbstractBeanQuery<ProxyTarget> {
|
||||
|
||||
private static final long serialVersionUID = -8841076207255485907L;
|
||||
|
||||
private final Sort sort = new Sort(Direction.ASC, "createdAt");
|
||||
|
||||
private transient Page<TargetWithActionStatus> firstPageTargetSets = null;
|
||||
|
||||
private transient RolloutManagement rolloutManagement;
|
||||
|
||||
private transient RolloutGroupManagement rolloutGroupManagement;
|
||||
|
||||
private transient RolloutUIState rolloutUIState;
|
||||
|
||||
private final RolloutGroup rolloutGroup;
|
||||
|
||||
/**
|
||||
* Parametric Constructor.
|
||||
*
|
||||
* @param definition
|
||||
* as QueryDefinition
|
||||
* @param queryConfig
|
||||
* as Config
|
||||
* @param sortPropertyIds
|
||||
* as sort
|
||||
* @param sortStates
|
||||
* as Sort status
|
||||
*/
|
||||
public RolloutGroupTargetsBeanQuery(final QueryDefinition definition, final Map<String, Object> queryConfig,
|
||||
final Object[] sortPropertyIds, final boolean[] sortStates) {
|
||||
|
||||
super(definition, queryConfig, sortPropertyIds, sortStates);
|
||||
|
||||
rolloutGroup = getRolloutUIState().getRolloutGroup().isPresent() ? getRolloutUIState().getRolloutGroup().get()
|
||||
: null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ProxyTarget constructBean() {
|
||||
return new ProxyTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<ProxyTarget> loadBeans(final int startIndex, final int count) {
|
||||
List<TargetWithActionStatus> rolloutGroupTargetsList = new ArrayList<>();
|
||||
if (startIndex == 0 && firstPageTargetSets != null) {
|
||||
rolloutGroupTargetsList = firstPageTargetSets.getContent();
|
||||
} else if (null != rolloutGroup) {
|
||||
rolloutGroupTargetsList = getRolloutGroupManagement().findAllTargetsWithActionStatus(
|
||||
new PageRequest(startIndex / count, count), rolloutGroup).getContent();
|
||||
}
|
||||
return getProxyRolloutGroupTargetsList(rolloutGroupTargetsList);
|
||||
}
|
||||
|
||||
private List<ProxyTarget> getProxyRolloutGroupTargetsList(final List<TargetWithActionStatus> rolloutGroupTargets) {
|
||||
final List<ProxyTarget> proxyTargetBeans = new ArrayList<>();
|
||||
for (final TargetWithActionStatus targetWithActionStatus : rolloutGroupTargets) {
|
||||
final Target targ = targetWithActionStatus.getTarget();
|
||||
final ProxyTarget prxyTarget = new ProxyTarget();
|
||||
prxyTarget.setTargetIdName(targ.getTargetIdName());
|
||||
prxyTarget.setName(targ.getName());
|
||||
prxyTarget.setDescription(targ.getDescription());
|
||||
prxyTarget.setControllerId(targ.getControllerId());
|
||||
prxyTarget.setInstallationDate(targ.getTargetInfo().getInstallationDate());
|
||||
prxyTarget.setAddress(targ.getTargetInfo().getAddress());
|
||||
prxyTarget.setLastTargetQuery(targ.getTargetInfo().getLastTargetQuery());
|
||||
prxyTarget.setLastModifiedDate(SPDateTimeUtil.getFormattedDate(targ.getLastModifiedAt()));
|
||||
prxyTarget.setCreatedDate(SPDateTimeUtil.getFormattedDate(targ.getCreatedAt()));
|
||||
prxyTarget.setCreatedAt(targ.getCreatedAt());
|
||||
prxyTarget.setCreatedByUser(HawkbitCommonUtil.getIMUser(targ.getCreatedBy()));
|
||||
prxyTarget.setModifiedByUser(HawkbitCommonUtil.getIMUser(targ.getLastModifiedBy()));
|
||||
if (targetWithActionStatus.getStatus() != null) {
|
||||
prxyTarget.setStatus(targetWithActionStatus.getStatus());
|
||||
}
|
||||
prxyTarget.setLastTargetQuery(targ.getTargetInfo().getLastTargetQuery());
|
||||
prxyTarget.setTargetInfo(targ.getTargetInfo());
|
||||
prxyTarget.setId(targ.getId());
|
||||
if (targ.getAssignedDistributionSet() != null) {
|
||||
prxyTarget.setAssignedDistNameVersion(HawkbitCommonUtil.getFormattedNameVersion(targ
|
||||
.getAssignedDistributionSet().getName(), targ.getAssignedDistributionSet().getVersion()));
|
||||
}
|
||||
proxyTargetBeans.add(prxyTarget);
|
||||
|
||||
}
|
||||
return proxyTargetBeans;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void saveBeans(final List<ProxyTarget> arg0, final List<ProxyTarget> arg1, final List<ProxyTarget> arg2) {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
long size = 0;
|
||||
if (null != rolloutGroup) {
|
||||
firstPageTargetSets = getRolloutGroupManagement().findAllTargetsWithActionStatus(
|
||||
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), rolloutGroup);
|
||||
size = firstPageTargetSets.getTotalElements();
|
||||
}
|
||||
getRolloutUIState().setRolloutGroupTargetsTotalCount(size);
|
||||
if (size > SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES) {
|
||||
getRolloutUIState().setRolloutGroupTargetsTruncated(size - SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES);
|
||||
return SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES;
|
||||
}
|
||||
|
||||
return (int) size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolloutManagement
|
||||
*/
|
||||
public RolloutManagement getRolloutManagement() {
|
||||
if (null == rolloutManagement) {
|
||||
rolloutManagement = SpringContextHelper.getBean(RolloutManagement.class);
|
||||
}
|
||||
return rolloutManagement;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolloutManagement
|
||||
*/
|
||||
public RolloutGroupManagement getRolloutGroupManagement() {
|
||||
if (null == rolloutGroupManagement) {
|
||||
rolloutGroupManagement = SpringContextHelper.getBean(RolloutGroupManagement.class);
|
||||
}
|
||||
return rolloutGroupManagement;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolloutUIState
|
||||
*/
|
||||
public RolloutUIState getRolloutUIState() {
|
||||
if (null == rolloutUIState) {
|
||||
rolloutUIState = SpringContextHelper.getBean(RolloutUIState.class);
|
||||
}
|
||||
return rolloutUIState;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
/**
|
||||
* 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.rollout;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.shared.ui.label.ContentMode;
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
import com.vaadin.ui.Label;
|
||||
|
||||
/**
|
||||
* count message label for the targets of the rollout group.
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
public class RolloutGroupTargetsCountLabelMessage extends Label {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -3876685878918411453L;
|
||||
|
||||
@Autowired
|
||||
private transient RolloutUIState rolloutUIState;
|
||||
|
||||
@Autowired
|
||||
private transient RolloutGroupTargetsListTable rolloutGroupTargetsListTable;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
/**
|
||||
* PostConstruct method called by spring after bean has been initialized.
|
||||
*/
|
||||
@PostConstruct
|
||||
public void postConstruct() {
|
||||
applyStyle();
|
||||
displayRolloutGroupTargetMessage();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Event Listener to show the message count.
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
public void onEvent(final RolloutEvent event) {
|
||||
if (event == RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS_COUNT) {
|
||||
displayRolloutGroupTargetMessage();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void applyStyle() {
|
||||
/* Create label for Targets count message displaying below the table */
|
||||
addStyleName(SPUILabelDefinitions.SP_LABEL_MESSAGE_STYLE);
|
||||
setContentMode(ContentMode.HTML);
|
||||
setId(SPUIComponetIdProvider.COUNT_LABEL);
|
||||
}
|
||||
|
||||
private void displayRolloutGroupTargetMessage() {
|
||||
long totalTargetTableEnteries = rolloutGroupTargetsListTable.size();
|
||||
if (rolloutUIState.getRolloutGroupTargetsTruncated() != null) {
|
||||
// set the icon
|
||||
setIcon(FontAwesome.INFO_CIRCLE);
|
||||
setDescription(i18n.get("rollout.group.label.target.truncated",
|
||||
rolloutUIState.getRolloutGroupTargetsTruncated(), SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES));
|
||||
totalTargetTableEnteries += rolloutUIState.getRolloutGroupTargetsTruncated();
|
||||
} else {
|
||||
setIcon(null);
|
||||
setDescription(null);
|
||||
}
|
||||
|
||||
final StringBuilder message = new StringBuilder(i18n.get("label.target.filter.count"));
|
||||
message.append(rolloutUIState.getRolloutGroupTargetsTotalCount());
|
||||
message.append(HawkbitCommonUtil.SP_STRING_SPACE);
|
||||
if (totalTargetTableEnteries > SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES) {
|
||||
message.append(i18n.get("label.filter.shown"));
|
||||
message.append(SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES);
|
||||
} else {
|
||||
message.append(i18n.get("label.filter.shown"));
|
||||
message.append(rolloutGroupTargetsListTable.size());
|
||||
}
|
||||
message.append(HawkbitCommonUtil.SP_STRING_SPACE);
|
||||
setCaption(message.toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,218 @@
|
||||
/**
|
||||
* 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.rollout;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.Button.ClickEvent;
|
||||
import com.vaadin.ui.HorizontalLayout;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Header Layout of Rollout Group Targets list view.
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
public class RolloutGroupTargetsListHeader extends AbstractSimpleTableHeader {
|
||||
|
||||
private static final long serialVersionUID = 5613986489156507581L;
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private RolloutUIState rolloutUiState;
|
||||
|
||||
private Button rolloutsGroupViewLink;
|
||||
private Label headerCaption;
|
||||
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final RolloutEvent event) {
|
||||
if (event == RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS) {
|
||||
setCaptionDetails();
|
||||
}
|
||||
}
|
||||
|
||||
private void setCaptionDetails() {
|
||||
RolloutGroup rolloutGroup;
|
||||
if (rolloutUiState.getRolloutGroup().isPresent()) {
|
||||
rolloutGroup = rolloutUiState.getRolloutGroup().get();
|
||||
headerCaption.setCaption(rolloutGroup.getName());
|
||||
}
|
||||
|
||||
rolloutsGroupViewLink.setCaption(rolloutUiState.getRolloutName().isPresent() ? rolloutUiState.getRolloutName()
|
||||
.get() : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void resetSearchText() {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getSearchBoxId() {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getSearchRestIconId() {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void searchBy(final String newSearchText) {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getAddIconId() {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addNewItem(final ClickEvent event) {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onClose(final ClickEvent event) {
|
||||
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUPS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasCreatePermission() {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getCloseButtonId() {
|
||||
return SPUIComponetIdProvider.ROLLOUT_TARGET_VIEW_CLOSE_BUTTON_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean showCloseButton() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isAllowSearch() {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String onLoadSearchBoxValue() {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isRollout() {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.rollout.AbstractSimpleTableHeader#
|
||||
* getHeaderCaptionLayout()
|
||||
*/
|
||||
@Override
|
||||
protected HorizontalLayout getHeaderCaptionLayout() {
|
||||
headerCaption = SPUIComponentProvider.getLabel("", SPUILabelDefinitions.SP_WIDGET_CAPTION);
|
||||
headerCaption.setStyleName(ValoTheme.LABEL_BOLD + " " + ValoTheme.LABEL_SMALL);
|
||||
final Button rolloutsListViewLink = SPUIComponentProvider.getButton(null, "", "", null, false, null,
|
||||
SPUIButtonStyleSmallNoBorder.class);
|
||||
rolloutsListViewLink.setStyleName(ValoTheme.LINK_SMALL + " " + "on-focus-no-border link rollout-caption-links");
|
||||
rolloutsListViewLink.setDescription(i18n.get("message.rollouts"));
|
||||
rolloutsListViewLink.setCaption(i18n.get("message.rollouts"));
|
||||
rolloutsListViewLink.addClickListener(value -> showRolloutListView());
|
||||
|
||||
rolloutsGroupViewLink = SPUIComponentProvider.getButton(null, "", "", null, false, null,
|
||||
SPUIButtonStyleSmallNoBorder.class);
|
||||
rolloutsGroupViewLink
|
||||
.setStyleName(ValoTheme.LINK_SMALL + " " + "on-focus-no-border link rollout-caption-links");
|
||||
rolloutsGroupViewLink.setDescription("Rollouts Group");
|
||||
rolloutsGroupViewLink.addClickListener(value -> showRolloutGroupListView());
|
||||
|
||||
final HorizontalLayout headerCaptionLayout = new HorizontalLayout();
|
||||
headerCaptionLayout.addComponent(rolloutsListViewLink);
|
||||
headerCaptionLayout.addComponent(new Label(">"));
|
||||
headerCaptionLayout.addComponent(rolloutsGroupViewLink);
|
||||
headerCaptionLayout.addComponent(new Label(">"));
|
||||
headerCaptionLayout.addComponent(headerCaption);
|
||||
|
||||
return headerCaptionLayout;
|
||||
}
|
||||
|
||||
private void showRolloutGroupListView() {
|
||||
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUPS);
|
||||
}
|
||||
|
||||
private void showRolloutListView() {
|
||||
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUTS);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.ui.rollout.AbstractSimpleTableHeader#restoreCaption()
|
||||
*/
|
||||
@Override
|
||||
protected void restoreCaption() {
|
||||
setCaptionDetails();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,229 @@
|
||||
/**
|
||||
* 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.rollout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
|
||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||
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.TableColumn;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
import com.vaadin.data.Container;
|
||||
import com.vaadin.data.Item;
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.shared.ui.label.ContentMode;
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Rollout Group Targets Table in List view.
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
public class RolloutGroupTargetsListTable extends AbstractSimpleTable {
|
||||
|
||||
private static final long serialVersionUID = 7984314603271801746L;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private transient RolloutUIState rolloutUIState;
|
||||
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TableColumn> getTableVisibleColumns() {
|
||||
final List<TableColumn> columnList = new ArrayList<>();
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get("header.name"), 0.15f));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_BY, i18n.get("header.createdBy"), 0.15f));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_DATE, i18n.get("header.createdDate"), 0.15f));
|
||||
columnList
|
||||
.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, i18n.get("header.modifiedBy"), 0.15f));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, i18n.get("header.modifiedDate"),
|
||||
0.15f));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_DESC, i18n.get("header.description"), 0.15f));
|
||||
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_TARGET_STATUS, i18n.get("header.status"), 0.1f));
|
||||
|
||||
return columnList;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Container createContainer() {
|
||||
final BeanQueryFactory<RolloutGroupTargetsBeanQuery> rolloutgrouBeanQueryFactory = new BeanQueryFactory<>(
|
||||
RolloutGroupTargetsBeanQuery.class);
|
||||
return new LazyQueryContainer(new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE,
|
||||
SPUILabelDefinitions.VAR_ID), rolloutgrouBeanQueryFactory);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addContainerProperties(final Container container) {
|
||||
final LazyQueryContainer rolloutGroupTargetTableContainer = (LazyQueryContainer) container;
|
||||
rolloutGroupTargetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_CONT_ID, String.class, "",
|
||||
false, false);
|
||||
rolloutGroupTargetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, "", false,
|
||||
true);
|
||||
rolloutGroupTargetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_STATUS, Status.class,
|
||||
Status.RETRIEVED, false, false);
|
||||
|
||||
rolloutGroupTargetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_TARGET_STATUS,
|
||||
TargetUpdateStatus.class, TargetUpdateStatus.UNKNOWN, false, false);
|
||||
|
||||
rolloutGroupTargetTableContainer.addContainerProperty(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER,
|
||||
String.class, "", false, true);
|
||||
rolloutGroupTargetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_BY, String.class, null,
|
||||
false, true);
|
||||
rolloutGroupTargetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, String.class,
|
||||
null, false, true);
|
||||
rolloutGroupTargetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, String.class,
|
||||
null, false, true);
|
||||
rolloutGroupTargetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE,
|
||||
String.class, null, false, true);
|
||||
rolloutGroupTargetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, "", false,
|
||||
true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTableId() {
|
||||
|
||||
return SPUIComponetIdProvider.ROLLOUT_GROUP_TARGETS_LIST_TABLE_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onValueChange() {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addCustomGeneratedColumns() {
|
||||
addGeneratedColumn(SPUILabelDefinitions.VAR_TARGET_STATUS, (source, itemId, columnId) -> getStatusLabel(itemId));
|
||||
setColumnAlignment(SPUILabelDefinitions.VAR_TARGET_STATUS, Align.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setCollapsiblecolumns() {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
}
|
||||
|
||||
private Label getStatusLabel(final Object itemId) {
|
||||
final Label statusLabel = new Label();
|
||||
statusLabel.addStyleName(ValoTheme.LABEL_SMALL);
|
||||
statusLabel.setHeightUndefined();
|
||||
statusLabel.setContentMode(ContentMode.HTML);
|
||||
setStatusIcon(itemId, statusLabel);
|
||||
statusLabel.setSizeUndefined();
|
||||
return statusLabel;
|
||||
}
|
||||
|
||||
private void setStatusIcon(final Object itemId, final Label statusLabel) {
|
||||
final Item item = getItem(itemId);
|
||||
final RolloutGroup rolloutGroup = rolloutUIState.getRolloutGroup().isPresent() ? rolloutUIState
|
||||
.getRolloutGroup().get() : null;
|
||||
if (item != null) {
|
||||
final Status status = (Status) item.getItemProperty(SPUILabelDefinitions.VAR_STATUS).getValue();
|
||||
if (status == null) {
|
||||
if (rolloutGroup != null && rolloutGroup.getStatus() == RolloutGroupStatus.READY) {
|
||||
statusLabel.setValue(FontAwesome.DOT_CIRCLE_O.getHtml());
|
||||
statusLabel.addStyleName("statusIconLightBlue");
|
||||
statusLabel.setDescription(RolloutGroupStatus.READY.toString().toLowerCase());
|
||||
} else if (rolloutGroup != null && rolloutGroup.getStatus() == RolloutGroupStatus.FINISHED) {
|
||||
statusLabel.setValue(FontAwesome.MINUS_CIRCLE.getHtml());
|
||||
statusLabel.addStyleName("statusIconBlue");
|
||||
|
||||
final String dsNameVersion = (String) item.getItemProperty(
|
||||
SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER).getValue();
|
||||
statusLabel.setDescription(i18n
|
||||
.get("message.dist.already.assigned", new Object[] { dsNameVersion }));
|
||||
}
|
||||
} else {
|
||||
setRolloutStatusIcon(status, statusLabel);
|
||||
statusLabel.setDescription(status.toString().toLowerCase());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setRolloutStatusIcon(final Status targetUpdateStatus, final Label statusLabel) {
|
||||
switch (targetUpdateStatus) {
|
||||
case ERROR:
|
||||
statusLabel.setValue(FontAwesome.EXCLAMATION_CIRCLE.getHtml());
|
||||
statusLabel.addStyleName("statusIconRed");
|
||||
break;
|
||||
case SCHEDULED:
|
||||
statusLabel.setValue(FontAwesome.BULLSEYE.getHtml());
|
||||
statusLabel.addStyleName("statusIconBlue");
|
||||
break;
|
||||
case FINISHED:
|
||||
statusLabel.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
|
||||
statusLabel.addStyleName("statusIconGreen");
|
||||
break;
|
||||
case RUNNING:
|
||||
case RETRIEVED:
|
||||
case WARNING:
|
||||
case DOWNLOAD:
|
||||
statusLabel.setValue(FontAwesome.ADJUST.getHtml());
|
||||
statusLabel.addStyleName("statusIconYellow");
|
||||
break;
|
||||
case CANCELED:
|
||||
case CANCELING:
|
||||
statusLabel.setValue(FontAwesome.TIMES_CIRCLE.getHtml());
|
||||
statusLabel.addStyleName("statusIconPending");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* 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.rollout;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
import com.vaadin.ui.Label;
|
||||
|
||||
/**
|
||||
* Rollout Group Targets List View.
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
public class RolloutGroupTargetsListView extends AbstractSimpleTableLayout {
|
||||
|
||||
private static final long serialVersionUID = 26089134783467012L;
|
||||
|
||||
@Autowired
|
||||
private RolloutGroupTargetsListHeader rolloutGroupTargetsListHeader;
|
||||
|
||||
@Autowired
|
||||
private RolloutGroupTargetsListTable rolloutGroupTargetsListTable;
|
||||
|
||||
@Autowired
|
||||
private RolloutGroupTargetsCountLabelMessage rolloutGroupTargetsCountLabelMessage;
|
||||
|
||||
/**
|
||||
* Initialization of Rollout group component.
|
||||
*/
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init(rolloutGroupTargetsListHeader, rolloutGroupTargetsListTable);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasCountMessage() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Label getCountMessageLabel() {
|
||||
|
||||
return rolloutGroupTargetsCountLabelMessage;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
/**
|
||||
* 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.rollout;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.Button.ClickEvent;
|
||||
import com.vaadin.ui.HorizontalLayout;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Header Layout of Rollout Group list view.
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
public class RolloutGroupsListHeader extends AbstractSimpleTableHeader {
|
||||
|
||||
private static final long serialVersionUID = 5077741997839715209L;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private RolloutUIState rolloutUiState;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
private Label headerCaption;
|
||||
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final RolloutEvent event) {
|
||||
if (event == RolloutEvent.SHOW_ROLLOUT_GROUPS) {
|
||||
setCaptionDetails();
|
||||
}
|
||||
}
|
||||
|
||||
private void setCaptionDetails() {
|
||||
headerCaption.setCaption(rolloutUiState.getRolloutName().isPresent() ? rolloutUiState.getRolloutName().get()
|
||||
: "");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void resetSearchText() {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getSearchBoxId() {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getSearchRestIconId() {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void searchBy(final String newSearchText) {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getAddIconId() {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addNewItem(final ClickEvent event) {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onClose(final ClickEvent event) {
|
||||
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUTS);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasCreatePermission() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getCloseButtonId() {
|
||||
return SPUIComponetIdProvider.ROLLOUT_GROUP_CLOSE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean showCloseButton() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isAllowSearch() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String onLoadSearchBoxValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isRollout() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.rollout.AbstractSimpleTableHeader#
|
||||
* getHeaderCaptionLayout()
|
||||
*/
|
||||
@Override
|
||||
protected HorizontalLayout getHeaderCaptionLayout() {
|
||||
headerCaption = SPUIComponentProvider.getLabel("", SPUILabelDefinitions.SP_WIDGET_CAPTION);
|
||||
headerCaption.setId(SPUIComponetIdProvider.ROLLOUT_GROUP_HEADER_CAPTION);
|
||||
final Button rolloutsListViewLink = SPUIComponentProvider.getButton(null, "", "", null, false, null,
|
||||
SPUIButtonStyleSmallNoBorder.class);
|
||||
rolloutsListViewLink.setStyleName(ValoTheme.LINK_SMALL + " " + "on-focus-no-border link rollout-caption-links");
|
||||
rolloutsListViewLink.setDescription(i18n.get("message.rollouts"));
|
||||
rolloutsListViewLink.setCaption(i18n.get("message.rollouts"));
|
||||
rolloutsListViewLink.addClickListener(value -> showRolloutListView());
|
||||
|
||||
final HorizontalLayout headerCaptionLayout = new HorizontalLayout();
|
||||
headerCaptionLayout.addComponent(rolloutsListViewLink);
|
||||
headerCaptionLayout.addComponent(new Label(">"));
|
||||
headerCaptionLayout.addComponent(headerCaption);
|
||||
|
||||
return headerCaptionLayout;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.ui.rollout.AbstractSimpleTableHeader#restoreCaption()
|
||||
*/
|
||||
@Override
|
||||
protected void restoreCaption() {
|
||||
setCaptionDetails();
|
||||
}
|
||||
|
||||
private void showRolloutListView() {
|
||||
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUTS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* 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.rollout;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
import com.vaadin.ui.Label;
|
||||
|
||||
/**
|
||||
* Groups List View.
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
public class RolloutGroupsListView extends AbstractSimpleTableLayout {
|
||||
|
||||
private static final long serialVersionUID = 7252345838154270259L;
|
||||
|
||||
@Autowired
|
||||
private RolloutGroupsListHeader rolloutGroupListHeader;
|
||||
|
||||
@Autowired
|
||||
private RolloutGroupListTable rolloutGroupListTable;
|
||||
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init(rolloutGroupListHeader, rolloutGroupListTable);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasCountMessage() {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Label getCountMessageLabel() {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
/**
|
||||
* 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.rollout;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
import com.vaadin.ui.Button.ClickEvent;
|
||||
import com.vaadin.ui.HorizontalLayout;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.UI;
|
||||
import com.vaadin.ui.Window;
|
||||
|
||||
/**
|
||||
*
|
||||
* Header layout of rollout list view.
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
public class RolloutListHeader extends AbstractSimpleTableHeader {
|
||||
private static final long serialVersionUID = 2365400733081333174L;
|
||||
|
||||
@Autowired
|
||||
private SpPermissionChecker permissionChecker;
|
||||
|
||||
@Autowired
|
||||
private transient RolloutUIState rolloutUIState;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private AddUpdateRolloutWindowLayout addUpdateRolloutWindow;
|
||||
|
||||
/**
|
||||
* Initialization of Target Header Component.
|
||||
*/
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
addUpdateRolloutWindow.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void resetSearchText() {
|
||||
rolloutUIState.setSearchText(null);
|
||||
eventBus.publish(this, RolloutEvent.FILTER_BY_TEXT);
|
||||
}
|
||||
|
||||
protected String getHeaderCaption() {
|
||||
return SPUIDefinitions.ROLLOUT_LIST_HEADER_CAPTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getSearchBoxId() {
|
||||
return SPUIComponetIdProvider.ROLLOUT_LIST_SEARCH_BOX_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getSearchRestIconId() {
|
||||
return SPUIComponetIdProvider.ROLLOUT_LIST_SEARCH_RESET_ICON_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void searchBy(final String newSearchText) {
|
||||
rolloutUIState.setSearchText(newSearchText);
|
||||
eventBus.publish(this, RolloutEvent.FILTER_BY_TEXT);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getAddIconId() {
|
||||
return SPUIComponetIdProvider.ROLLOUT_ADD_ICON_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addNewItem(final ClickEvent event) {
|
||||
addUpdateRolloutWindow.resetComponents();
|
||||
final Window addTargetWindow = addUpdateRolloutWindow.getWindow();
|
||||
UI.getCurrent().addWindow(addTargetWindow);
|
||||
addTargetWindow.setVisible(Boolean.TRUE);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onClose(final ClickEvent event) {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasCreatePermission() {
|
||||
return permissionChecker.hasRolloutCreatePermission();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getCloseButtonId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean showCloseButton() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isAllowSearch() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String onLoadSearchBoxValue() {
|
||||
return rolloutUIState.getSearchText().isPresent() ? rolloutUIState.getSearchText().get() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isRollout() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.rollout.AbstractSimpleTableHeader#
|
||||
* getHeaderCaptionLayout()
|
||||
*/
|
||||
@Override
|
||||
protected HorizontalLayout getHeaderCaptionLayout() {
|
||||
final Label headerCaption = SPUIComponentProvider.getLabel(getHeaderCaption(),
|
||||
SPUILabelDefinitions.SP_WIDGET_CAPTION);
|
||||
final HorizontalLayout headerCaptionLayout = new HorizontalLayout();
|
||||
headerCaptionLayout.addComponent(headerCaption);
|
||||
|
||||
return headerCaptionLayout;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.ui.rollout.AbstractSimpleTableHeader#restoreCaption()
|
||||
*/
|
||||
@Override
|
||||
protected void restoreCaption() {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,552 @@
|
||||
/**
|
||||
* 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.rollout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.RolloutChangeEvent;
|
||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
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.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
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.TableColumn;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
||||
import org.vaadin.alump.distributionbar.DistributionBar;
|
||||
import org.vaadin.peter.contextmenu.ContextMenu;
|
||||
import org.vaadin.peter.contextmenu.ContextMenu.ContextMenuItem;
|
||||
import org.vaadin.peter.contextmenu.ContextMenu.ContextMenuItemClickEvent;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
import com.vaadin.data.Container;
|
||||
import com.vaadin.data.Item;
|
||||
import com.vaadin.data.Property;
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.shared.ui.label.ContentMode;
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.Button.ClickEvent;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.UI;
|
||||
import com.vaadin.ui.Window;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
*
|
||||
* Rollout table in list view.
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
public class RolloutListTable extends AbstractSimpleTable {
|
||||
|
||||
private static final String IS_ACTION_RECIEVED = "isActionRecieved";
|
||||
|
||||
private static final long serialVersionUID = 8141874975649180139L;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private transient RolloutManagement rolloutManagement;
|
||||
|
||||
@Autowired
|
||||
private AddUpdateRolloutWindowLayout addUpdateRolloutWindow;
|
||||
|
||||
@Autowired
|
||||
private UINotification uiNotification;
|
||||
|
||||
@Autowired
|
||||
private transient RolloutUIState rolloutUIState;
|
||||
|
||||
@Autowired
|
||||
private transient SpPermissionChecker permissionChecker;
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@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) {
|
||||
refreshTable();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the RolloutChangeEvent to refresh the item in the table.
|
||||
*
|
||||
* @param rolloutChangeEvent
|
||||
* the event which contains the rollout which has been changed
|
||||
*/
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
public void onEvent(final RolloutChangeEvent rolloutChangeEvent) {
|
||||
final List<Object> visibleItemIds = (List<Object>) getVisibleItemIds();
|
||||
if (visibleItemIds.contains(rolloutChangeEvent.getRolloutId())) {
|
||||
final Rollout rollout = rolloutManagement.findRolloutWithDetailedStatus(rolloutChangeEvent.getRolloutId());
|
||||
final TotalTargetCountStatus totalTargetCountStatus = rollout.getTotalTargetCountStatus();
|
||||
final LazyQueryContainer rolloutContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
final Item item = rolloutContainer.getItem(rolloutChangeEvent.getRolloutId());
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_STATUS).setValue(rollout.getStatus());
|
||||
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_COUNT_TARGETS_RUNNING).setValue(
|
||||
totalTargetCountStatus.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.RUNNING));
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_COUNT_TARGETS_ERROR).setValue(
|
||||
totalTargetCountStatus.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.ERROR));
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_COUNT_TARGETS_FINISHED).setValue(
|
||||
totalTargetCountStatus.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.FINISHED));
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_COUNT_TARGETS_NOT_STARTED).setValue(
|
||||
totalTargetCountStatus.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.NOTSTARTED));
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_COUNT_TARGETS_CANCELLED).setValue(
|
||||
totalTargetCountStatus.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.CANCELLED));
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_COUNT_TARGETS_SCHEDULED).setValue(
|
||||
totalTargetCountStatus.getTotalTargetCountByStatus(TotalTargetCountStatus.Status.SCHEDULED));
|
||||
item.getItemProperty(IS_ACTION_RECIEVED).setValue(
|
||||
!(Boolean) item.getItemProperty(IS_ACTION_RECIEVED).getValue());
|
||||
|
||||
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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TableColumn> getTableVisibleColumns() {
|
||||
final List<TableColumn> columnList = new ArrayList<>();
|
||||
columnList.add(new TableColumn(SPUIDefinitions.ROLLOUT_NAME, i18n.get("header.name"), 0.225f));
|
||||
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_DIST_NAME_VERSION, i18n.get("header.distributionset"),
|
||||
0.225f));
|
||||
columnList.add(new TableColumn(SPUIDefinitions.ROLLOUT_STATUS, i18n.get("header.status"), 0.07f));
|
||||
columnList.add(new TableColumn(SPUIDefinitions.DETAIL_STATUS, i18n.get("header.detail.status"), 0.58f));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS, i18n.get("header.numberofgroups"),
|
||||
0.1f));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS, i18n.get("header.total.targets"), 0.1f));
|
||||
columnList.add(new TableColumn(SPUIDefinitions.ROLLOUT_ACTION, i18n.get("upload.action"), 0.1f));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_DATE, i18n.get("header.createdDate"), 0.1f));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_USER, i18n.get("header.createdBy"), 0.1f));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_MODIFIED_DATE, i18n.get("header.modifiedDate"), 0.1f));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_MODIFIED_BY, i18n.get("header.modifiedBy"), 0.1f));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_DESC, i18n.get("header.description"), 0.1f));
|
||||
return columnList;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Container createContainer() {
|
||||
final BeanQueryFactory<RolloutBeanQuery> rolloutQf = new BeanQueryFactory<>(RolloutBeanQuery.class);
|
||||
return new LazyQueryContainer(new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE,
|
||||
SPUILabelDefinitions.VAR_ID), rolloutQf);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addContainerProperties(final Container container) {
|
||||
final LazyQueryContainer rolloutTableContainer = (LazyQueryContainer) container;
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_ID, String.class, null, false, false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, "", false, false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, null, false, false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_STATUS, RolloutStatus.class, null, false,
|
||||
false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_DIST_NAME_VERSION, String.class, null,
|
||||
false, false);
|
||||
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_TARGETFILTERQUERY, String.class, null,
|
||||
false, false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, String.class, null, false,
|
||||
false);
|
||||
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_DATE, String.class, null, false,
|
||||
false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_USER, String.class, null, false,
|
||||
false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_BY, String.class, null, false,
|
||||
false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS, Integer.class, 0, false,
|
||||
false);
|
||||
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_COUNT_TARGETS_NOT_STARTED, Long.class, 0L,
|
||||
false, false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_COUNT_TARGETS_RUNNING, Long.class, 0L,
|
||||
false, false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_COUNT_TARGETS_SCHEDULED, Long.class, 0L,
|
||||
false, false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_COUNT_TARGETS_ERROR, Long.class, 0L, false,
|
||||
false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_COUNT_TARGETS_FINISHED, Long.class, 0L,
|
||||
false, false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_COUNT_TARGETS_CANCELLED, Long.class, 0L,
|
||||
false, false);
|
||||
rolloutTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS, String.class, "0", false,
|
||||
false);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTableId() {
|
||||
return SPUIComponetIdProvider.ROLLOUT_LIST_TABLE_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onValueChange() {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addCustomGeneratedColumns() {
|
||||
addGeneratedColumn(SPUIDefinitions.ROLLOUT_NAME, (source, itemId, columnId) -> getRolloutNameLink(itemId));
|
||||
addGeneratedColumn(SPUIDefinitions.ROLLOUT_STATUS, (source, itemId, columnId) -> getStatusLabel(itemId));
|
||||
addGeneratedColumn(SPUIDefinitions.DETAIL_STATUS, (source, itemId, columnId) -> getProgressBar(itemId));
|
||||
addGeneratedColumn(SPUIDefinitions.ROLLOUT_ACTION, (source, itemId, columnId) -> getActionButton(itemId));
|
||||
|
||||
setColumnAlignment(SPUIDefinitions.ROLLOUT_STATUS, Align.CENTER);
|
||||
setColumnAlignment(SPUIDefinitions.DETAIL_STATUS, Align.CENTER);
|
||||
setColumnAlignment(SPUIDefinitions.ROLLOUT_ACTION, Align.CENTER);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setCollapsiblecolumns() {
|
||||
setColumnCollapsed(SPUILabelDefinitions.VAR_CREATED_DATE, true);
|
||||
setColumnCollapsed(SPUILabelDefinitions.VAR_MODIFIED_DATE, true);
|
||||
setColumnCollapsed(SPUILabelDefinitions.VAR_CREATED_USER, true);
|
||||
setColumnCollapsed(SPUILabelDefinitions.VAR_MODIFIED_BY, true);
|
||||
setColumnCollapsed(SPUILabelDefinitions.VAR_DESC, true);
|
||||
}
|
||||
|
||||
private Button getActionButton(final Object itemId) {
|
||||
final Item row = getItem(itemId);
|
||||
final String rolloutName = (String) row.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();
|
||||
final Button actionButton = SPUIComponentProvider.getButton(getActionButtonId(rolloutName), "",
|
||||
SPUILabelDefinitions.ACTION, ValoTheme.BUTTON_TINY + " ", true, FontAwesome.CIRCLE_O,
|
||||
SPUIButtonStyleSmallNoBorder.class);
|
||||
actionButton.setData(itemId);
|
||||
actionButton.setHtmlContentAllowed(true);
|
||||
actionButton.addClickListener(event -> onAction(event));
|
||||
addStatusPropertyChangeListener(itemId, actionButton);
|
||||
|
||||
final RolloutStatus rolloutStatus = (RolloutStatus) row.getItemProperty(SPUILabelDefinitions.VAR_STATUS)
|
||||
.getValue();
|
||||
enableDisableActions(rolloutStatus, actionButton);
|
||||
return actionButton;
|
||||
}
|
||||
|
||||
private void enableDisableActions(final RolloutStatus rolloutStatus, final Button actionButton) {
|
||||
final RolloutStatus[] statusList = new RolloutStatus[] { RolloutStatus.FINISHED, RolloutStatus.STARTING,
|
||||
RolloutStatus.CREATING, RolloutStatus.ERROR_CREATING, RolloutStatus.ERROR_STARTING };
|
||||
if (Arrays.asList(statusList).contains(rolloutStatus)) {
|
||||
actionButton.setEnabled(false);
|
||||
} else {
|
||||
actionButton.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void addStatusPropertyChangeListener(final Object itemId, final Button actionButton) {
|
||||
final Property status = getContainerProperty(itemId, SPUILabelDefinitions.VAR_STATUS);
|
||||
final Property.ValueChangeNotifier notifier = (Property.ValueChangeNotifier) status;
|
||||
notifier.addValueChangeListener(new ValueChangeListener() {
|
||||
@Override
|
||||
public void valueChange(final com.vaadin.data.Property.ValueChangeEvent event) {
|
||||
final Item row = getItem(itemId);
|
||||
final RolloutStatus rolloutStatus = (RolloutStatus) row
|
||||
.getItemProperty(SPUILabelDefinitions.VAR_STATUS).getValue();
|
||||
enableDisableActions(rolloutStatus, actionButton);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private ContextMenu createContextMenu(final Long rolloutId) {
|
||||
final Item row = 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) {
|
||||
final ContextMenuItem startItem = context.addItem("Start");
|
||||
startItem.setData(new ContextMenuData(rolloutId, ACTION.START));
|
||||
} else if (rolloutStatus == RolloutStatus.RUNNING) {
|
||||
final ContextMenuItem pauseItem = context.addItem("Pause");
|
||||
pauseItem.setData(new ContextMenuData(rolloutId, ACTION.PAUSE));
|
||||
} else if (rolloutStatus == RolloutStatus.PAUSED) {
|
||||
final ContextMenuItem resumeItem = context.addItem("Resume");
|
||||
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");
|
||||
cancelItem.setData(new ContextMenuData(rolloutId, ACTION.UPDATE));
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
private void menuItemClicked(final ContextMenuItemClickEvent event) {
|
||||
final ContextMenuItem item = (ContextMenuItem) event.getSource();
|
||||
final ContextMenuData contextMenuData = (ContextMenuData) item.getData();
|
||||
final Item row = getItem(contextMenuData.getRolloutId());
|
||||
final String rolloutName = (String) row.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();
|
||||
|
||||
if (contextMenuData.getAction() == ACTION.PAUSE) {
|
||||
rolloutManagement.pauseRollout(rolloutManagement.findRolloutById(contextMenuData.getRolloutId()));
|
||||
uiNotification.displaySuccess(i18n.get("message.rollout.paused", rolloutName));
|
||||
} else if (contextMenuData.getAction() == ACTION.RESUME) {
|
||||
rolloutManagement.resumeRollout(rolloutManagement.findRolloutById(contextMenuData.getRolloutId()));
|
||||
uiNotification.displaySuccess(i18n.get("message.rollout.resumed", rolloutName));
|
||||
} else if (contextMenuData.getAction() == ACTION.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);
|
||||
}
|
||||
}
|
||||
|
||||
private void onAction(final ClickEvent event) {
|
||||
final ContextMenu contextMenu = createContextMenu((Long) event.getButton().getData());
|
||||
contextMenu.setAsContextMenuOf(event.getButton());
|
||||
contextMenu.open(event.getClientX(), event.getClientY());
|
||||
}
|
||||
|
||||
private Button getRolloutNameLink(final Object itemId) {
|
||||
final Item row = getItem(itemId);
|
||||
final String rolloutName = (String) row.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();
|
||||
final Button updateIcon = SPUIComponentProvider.getButton(getDetailLinkId(rolloutName), rolloutName,
|
||||
SPUILabelDefinitions.SHOW_ROLLOUT_GROUP_DETAILS, null, false, null, SPUIButtonStyleSmallNoBorder.class);
|
||||
updateIcon.setData(rolloutName);
|
||||
updateIcon.addStyleName(ValoTheme.LINK_SMALL + " " + "on-focus-no-border link");
|
||||
updateIcon.addClickListener(event -> showRolloutGroups(itemId));
|
||||
return updateIcon;
|
||||
}
|
||||
|
||||
private void showRolloutGroups(final Object itemId) {
|
||||
rolloutUIState.setRolloutId((long) itemId);
|
||||
final String rolloutName = (String) getItem(itemId).getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();
|
||||
rolloutUIState.setRolloutName(rolloutName);
|
||||
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUPS);
|
||||
}
|
||||
|
||||
private static String getActionButtonId(final String rollOutName) {
|
||||
return new StringBuilder(SPUIComponetIdProvider.ROLLOUT_ACTION_BUTTON_ID).append('.').append(rollOutName)
|
||||
.toString();
|
||||
}
|
||||
|
||||
private static String getDetailLinkId(final String rollOutName) {
|
||||
return new StringBuilder(SPUIComponetIdProvider.ROLLOUT_NAME_LINK_ID).append('.').append(rollOutName)
|
||||
.toString();
|
||||
}
|
||||
|
||||
private DistributionBar getProgressBar(final Object itemId) {
|
||||
final DistributionBar bar = new DistributionBar(2);
|
||||
bar.setId(SPUIComponetIdProvider.ROLLOUT_PROGRESS_BAR);
|
||||
bar.setSizeFull();
|
||||
bar.setZeroSizedVisible(false);
|
||||
HawkbitCommonUtil.initialiseProgressBar(bar, getItem(itemId));
|
||||
addPropertyChangeListenerOnActionRecieved(itemId, bar);
|
||||
return bar;
|
||||
}
|
||||
|
||||
private void addPropertyChangeListenerOnActionRecieved(final Object itemId, final DistributionBar bar) {
|
||||
final Property status = getContainerProperty(itemId, IS_ACTION_RECIEVED);
|
||||
final Property.ValueChangeNotifier notifier = (Property.ValueChangeNotifier) status;
|
||||
notifier.addValueChangeListener(new ValueChangeListener() {
|
||||
@Override
|
||||
public void valueChange(final com.vaadin.data.Property.ValueChangeEvent event) {
|
||||
HawkbitCommonUtil.initialiseProgressBar(bar, getItem(itemId));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private Label getStatusLabel(final Object itemId) {
|
||||
final Label statusLabel = new Label();
|
||||
statusLabel.setHeightUndefined();
|
||||
statusLabel.setContentMode(ContentMode.HTML);
|
||||
statusLabel.setId(getRolloutStatusId(itemId));
|
||||
setStatusIcon(itemId, statusLabel);
|
||||
statusLabel.setSizeUndefined();
|
||||
addPropertyChangeListener(itemId, statusLabel);
|
||||
return statusLabel;
|
||||
}
|
||||
|
||||
private void addPropertyChangeListener(final Object itemId, final Label statusLabel) {
|
||||
final Property status = getContainerProperty(itemId, SPUILabelDefinitions.VAR_STATUS);
|
||||
final Property.ValueChangeNotifier notifier = (Property.ValueChangeNotifier) status;
|
||||
notifier.addValueChangeListener(new ValueChangeListener() {
|
||||
@Override
|
||||
public void valueChange(final com.vaadin.data.Property.ValueChangeEvent event) {
|
||||
setStatusIcon(itemId, statusLabel);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String getRolloutStatusId(final Object itemId) {
|
||||
final String rolloutName = (String) getItem(itemId).getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();
|
||||
return new StringBuilder(SPUIComponetIdProvider.ROLLOUT_STATUS_LABEL_ID).append(".").append(rolloutName)
|
||||
.toString();
|
||||
}
|
||||
|
||||
private void setStatusIcon(final Object itemId, final Label statusLabel) {
|
||||
final Item item = getItem(itemId);
|
||||
if (item != null) {
|
||||
final RolloutStatus rolloutStatus = (RolloutStatus) item.getItemProperty(SPUILabelDefinitions.VAR_STATUS)
|
||||
.getValue();
|
||||
setRolloutStatusIcon(rolloutStatus, statusLabel);
|
||||
}
|
||||
}
|
||||
|
||||
private void setRolloutStatusIcon(final RolloutStatus rolloutStatus, final Label statusLabel) {
|
||||
statusLabel.setDescription(rolloutStatus.toString().toLowerCase());
|
||||
switch (rolloutStatus) {
|
||||
case FINISHED:
|
||||
statusLabel.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
|
||||
statusLabel.setStyleName("statusIconGreen");
|
||||
break;
|
||||
case PAUSED:
|
||||
statusLabel.setValue(FontAwesome.PAUSE.getHtml());
|
||||
statusLabel.setStyleName("statusIconBlue");
|
||||
break;
|
||||
case RUNNING:
|
||||
statusLabel.setValue(null);
|
||||
statusLabel.setStyleName("yellowSpinner");
|
||||
break;
|
||||
case READY:
|
||||
statusLabel.setValue(FontAwesome.DOT_CIRCLE_O.getHtml());
|
||||
statusLabel.setStyleName("statusIconLightBlue");
|
||||
break;
|
||||
case STOPPED:
|
||||
statusLabel.setValue(FontAwesome.STOP.getHtml());
|
||||
statusLabel.setStyleName("statusIconRed");
|
||||
break;
|
||||
case CREATING:
|
||||
statusLabel.setValue(null);
|
||||
statusLabel.setStyleName("greySpinner");
|
||||
break;
|
||||
case STARTING:
|
||||
statusLabel.setValue(null);
|
||||
statusLabel.setStyleName("blueSpinner");
|
||||
break;
|
||||
case ERROR_CREATING:
|
||||
statusLabel.setValue(FontAwesome.EXCLAMATION_CIRCLE.getHtml());
|
||||
statusLabel.setStyleName("statusIconRed");
|
||||
statusLabel.setDescription(i18n.get("message.error.creating.rollout"));
|
||||
break;
|
||||
case ERROR_STARTING:
|
||||
statusLabel.setValue(FontAwesome.EXCLAMATION_CIRCLE.getHtml());
|
||||
statusLabel.setStyleName("statusIconRed");
|
||||
statusLabel.setDescription(i18n.get("message.error.starting.rollout"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
statusLabel.addStyleName(ValoTheme.LABEL_SMALL);
|
||||
}
|
||||
|
||||
private void refreshTable() {
|
||||
final LazyQueryContainer container = (LazyQueryContainer) getContainerDataSource();
|
||||
container.refresh();
|
||||
}
|
||||
|
||||
enum ACTION {
|
||||
PAUSE, RESUME, START, UPDATE
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents data of context menu item.
|
||||
*
|
||||
*/
|
||||
public static class ContextMenuData {
|
||||
|
||||
private Long rolloutId;
|
||||
|
||||
private ACTION action;
|
||||
|
||||
/**
|
||||
* Set rollout if and action.
|
||||
*
|
||||
* @param rolloutId
|
||||
* id of rollout
|
||||
* @param action
|
||||
* user action {@link ACTION}
|
||||
*/
|
||||
public ContextMenuData(final Long rolloutId, final ACTION action) {
|
||||
this.action = action;
|
||||
this.rolloutId = rolloutId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolloutId
|
||||
*/
|
||||
public Long getRolloutId() {
|
||||
return rolloutId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rolloutId
|
||||
* the rolloutId to set
|
||||
*/
|
||||
public void setRolloutId(final Long rolloutId) {
|
||||
this.rolloutId = rolloutId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the action
|
||||
*/
|
||||
public ACTION getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param action
|
||||
* the action to set
|
||||
*/
|
||||
public void setAction(final ACTION action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* 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.rollout;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
import com.vaadin.ui.Label;
|
||||
|
||||
/**
|
||||
*
|
||||
* Rollout list view.
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
public class RolloutListView extends AbstractSimpleTableLayout {
|
||||
|
||||
private static final long serialVersionUID = -2703552177439393208L;
|
||||
|
||||
@Autowired
|
||||
private RolloutListHeader rolloutListHeader;
|
||||
|
||||
@Autowired
|
||||
private RolloutListTable rolloutListTable;
|
||||
|
||||
@PostConstruct
|
||||
void init() {
|
||||
super.init(rolloutListHeader, rolloutListTable);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected boolean hasCountMessage() {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Label getCountMessageLabel() {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
/**
|
||||
* 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.rollout;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.HawkbitUI;
|
||||
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
import com.vaadin.navigator.View;
|
||||
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
|
||||
import com.vaadin.spring.annotation.SpringView;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
|
||||
/**
|
||||
* Rollout management view.
|
||||
*/
|
||||
@SpringView(name = RolloutView.VIEW_NAME, ui = HawkbitUI.class)
|
||||
@ViewScope
|
||||
public class RolloutView extends VerticalLayout implements View {
|
||||
|
||||
private static final long serialVersionUID = -6199789714170913988L;
|
||||
|
||||
public static final String VIEW_NAME = "rollout";
|
||||
|
||||
@Autowired
|
||||
private SpPermissionChecker permChecker;
|
||||
|
||||
@Autowired
|
||||
private RolloutListView rolloutListView;
|
||||
|
||||
@Autowired
|
||||
private RolloutGroupsListView rolloutGroupsListView;
|
||||
|
||||
@Autowired
|
||||
private RolloutGroupTargetsListView rolloutGroupTargetsListView;
|
||||
|
||||
@Autowired
|
||||
private transient RolloutUIState rolloutUIState;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Override
|
||||
public void enter(final ViewChangeEvent event) {
|
||||
setSizeFull();
|
||||
if (!(rolloutUIState.isShowRollOuts() || rolloutUIState.isShowRolloutGroups() || rolloutUIState
|
||||
.isShowRolloutGroupTargets())) {
|
||||
rolloutUIState.setShowRollOuts(true);
|
||||
}
|
||||
buildLayout();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final RolloutEvent event) {
|
||||
if (event == RolloutEvent.SHOW_ROLLOUTS) {
|
||||
rolloutUIState.setShowRollOuts(true);
|
||||
rolloutUIState.setShowRolloutGroups(false);
|
||||
rolloutUIState.setShowRolloutGroupTargets(false);
|
||||
buildLayout();
|
||||
} else if (event == RolloutEvent.SHOW_ROLLOUT_GROUPS) {
|
||||
rolloutUIState.setShowRollOuts(false);
|
||||
rolloutUIState.setShowRolloutGroups(true);
|
||||
rolloutUIState.setShowRolloutGroupTargets(false);
|
||||
buildLayout();
|
||||
} else if (event == RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS) {
|
||||
rolloutUIState.setShowRollOuts(false);
|
||||
rolloutUIState.setShowRolloutGroups(false);
|
||||
rolloutUIState.setShowRolloutGroupTargets(true);
|
||||
buildLayout();
|
||||
}
|
||||
}
|
||||
|
||||
private void buildLayout() {
|
||||
if (permChecker.hasRolloutReadPermission() && rolloutUIState.isShowRollOuts()) {
|
||||
showRolloutListView();
|
||||
} else if (permChecker.hasRolloutReadPermission() && rolloutUIState.isShowRolloutGroups()) {
|
||||
showRolloutGroupListView();
|
||||
} else if (permChecker.hasRolloutTargetsReadPermission() && rolloutUIState.isShowRolloutGroupTargets()) {
|
||||
showRolloutGroupTargetsListView();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void showRolloutGroupTargetsListView() {
|
||||
rolloutGroupTargetsListView.setVisible(true);
|
||||
if (rolloutListView.isVisible()) {
|
||||
rolloutListView.setVisible(false);
|
||||
}
|
||||
if (rolloutGroupsListView.isVisible()) {
|
||||
rolloutGroupsListView.setVisible(false);
|
||||
}
|
||||
addComponent(rolloutGroupTargetsListView);
|
||||
setExpandRatio(rolloutGroupTargetsListView, 1.0f);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void showRolloutGroupListView() {
|
||||
rolloutGroupsListView.setVisible(true);
|
||||
if (rolloutListView.isVisible()) {
|
||||
rolloutListView.setVisible(false);
|
||||
}
|
||||
if (rolloutGroupTargetsListView.isVisible()) {
|
||||
rolloutGroupTargetsListView.setVisible(false);
|
||||
}
|
||||
addComponent(rolloutGroupsListView);
|
||||
setExpandRatio(rolloutGroupsListView, 1.0f);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void showRolloutListView() {
|
||||
rolloutListView.setVisible(true);
|
||||
if (rolloutGroupsListView.isVisible()) {
|
||||
rolloutGroupsListView.setVisible(false);
|
||||
}
|
||||
if (rolloutGroupTargetsListView.isVisible()) {
|
||||
rolloutGroupTargetsListView.setVisible(false);
|
||||
}
|
||||
addComponent(rolloutListView);
|
||||
setExpandRatio(rolloutListView, 1.0f);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* 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.rollout;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission;
|
||||
import org.eclipse.hawkbit.ui.menu.DashboardMenuItem;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.server.Resource;
|
||||
|
||||
/**
|
||||
* Menu item for rollout .
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
@Order(200)
|
||||
public class RolloutViewMenuItem implements DashboardMenuItem {
|
||||
|
||||
private static final long serialVersionUID = 6112540239655168995L;
|
||||
|
||||
@Override
|
||||
public String getViewName() {
|
||||
return RolloutView.VIEW_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resource getDashboardIcon() {
|
||||
return FontAwesome.TASKS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDashboardCaption() {
|
||||
return "Rollout";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDashboardCaptionLong() {
|
||||
return "Rollout Management";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getPermissions() {
|
||||
return Arrays.asList(SpPermission.ROLLOUT_MANAGEMENT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* 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.rollout.event;
|
||||
|
||||
/**
|
||||
* Enum for events in rollout management.
|
||||
*
|
||||
*/
|
||||
public enum RolloutEvent {
|
||||
FILTER_BY_TEXT, CREATE_ROLLOUT, UPDATE_ROLLOUT, SHOW_ROLLOUTS, SHOW_ROLLOUT_GROUPS, SHOW_ROLLOUT_GROUP_TARGETS, SHOW_ROLLOUT_GROUP_TARGETS_COUNT
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
/**
|
||||
* 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.rollout.state;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.VaadinSessionScope;
|
||||
|
||||
/**
|
||||
* Stores user actions in rollout management view.
|
||||
*
|
||||
*/
|
||||
@VaadinSessionScope
|
||||
@SpringComponent
|
||||
public class RolloutUIState implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -5751690471177053140L;
|
||||
|
||||
private String searchText;
|
||||
|
||||
private Long rolloutId;
|
||||
|
||||
private String rolloutName;
|
||||
|
||||
private RolloutGroup rolloutGroup;
|
||||
|
||||
private boolean showRolloutGroups;
|
||||
|
||||
private boolean showRolloutGroupTargets;
|
||||
|
||||
private boolean showRollOuts = true;
|
||||
|
||||
private Long rolloutGroupTargetsTruncated;
|
||||
|
||||
private long rolloutGroupTargetsTotalCount;
|
||||
|
||||
/**
|
||||
* @return the searchText
|
||||
*/
|
||||
public Optional<String> getSearchText() {
|
||||
return null != searchText ? Optional.of(searchText) : Optional.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param searchText
|
||||
* the searchText to set
|
||||
*/
|
||||
public void setSearchText(final String searchText) {
|
||||
this.searchText = searchText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolloutId
|
||||
*/
|
||||
public Optional<Long> getRolloutId() {
|
||||
return rolloutId != null ? Optional.of(rolloutId) : Optional.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rolloutId
|
||||
* the rolloutId to set
|
||||
*/
|
||||
public void setRolloutId(final long rolloutId) {
|
||||
this.rolloutId = rolloutId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolloutGroup
|
||||
*/
|
||||
public Optional<RolloutGroup> getRolloutGroup() {
|
||||
return rolloutGroup == null ? Optional.empty() : Optional.of(rolloutGroup);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rolloutGroup
|
||||
* the rolloutGroup to set
|
||||
*/
|
||||
public void setRolloutGroup(final RolloutGroup rolloutGroup) {
|
||||
this.rolloutGroup = rolloutGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the showRolloutGroups
|
||||
*/
|
||||
public boolean isShowRolloutGroups() {
|
||||
return showRolloutGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param showRolloutGroups
|
||||
* the showRolloutGroups to set
|
||||
*/
|
||||
public void setShowRolloutGroups(final boolean showRolloutGroups) {
|
||||
this.showRolloutGroups = showRolloutGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the showRolloutGroupTargets
|
||||
*/
|
||||
public boolean isShowRolloutGroupTargets() {
|
||||
return showRolloutGroupTargets;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param showRolloutGroupTargets
|
||||
* the showRolloutGroupTargets to set
|
||||
*/
|
||||
public void setShowRolloutGroupTargets(final boolean showRolloutGroupTargets) {
|
||||
this.showRolloutGroupTargets = showRolloutGroupTargets;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the showRollOuts
|
||||
*/
|
||||
public boolean isShowRollOuts() {
|
||||
return showRollOuts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param showRollOuts
|
||||
* the showRollOuts to set
|
||||
*/
|
||||
public void setShowRollOuts(final boolean showRollOuts) {
|
||||
this.showRollOuts = showRollOuts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolloutName
|
||||
*/
|
||||
public Optional<String> getRolloutName() {
|
||||
return rolloutName == null ? Optional.empty() : Optional.of(rolloutName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rolloutName
|
||||
* the rolloutName to set
|
||||
*/
|
||||
public void setRolloutName(final String rolloutName) {
|
||||
this.rolloutName = rolloutName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolloutGroupTargetsTruncated
|
||||
*/
|
||||
public Long getRolloutGroupTargetsTruncated() {
|
||||
return rolloutGroupTargetsTruncated;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rolloutGroupTargetsTruncated
|
||||
* the rolloutGroupTargetsTruncated to set
|
||||
*/
|
||||
public void setRolloutGroupTargetsTruncated(final long rolloutGroupTargetsTruncated) {
|
||||
this.rolloutGroupTargetsTruncated = rolloutGroupTargetsTruncated;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolloutGroupTargetsTotalCount
|
||||
*/
|
||||
public long getRolloutGroupTargetsTotalCount() {
|
||||
return rolloutGroupTargetsTotalCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rolloutGroupTargetsTotalCount
|
||||
* the rolloutGroupTargetsTotalCount to set
|
||||
*/
|
||||
public void setRolloutGroupTargetsTotalCount(final long rolloutGroupTargetsTotalCount) {
|
||||
this.rolloutGroupTargetsTotalCount = rolloutGroupTargetsTotalCount;
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.ui.utils;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
@@ -23,12 +24,14 @@ import org.eclipse.hawkbit.im.authentication.UserPrincipal;
|
||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssigmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||
import org.eclipse.hawkbit.repository.model.TargetInfo.PollStatus;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTagAssigmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||
import org.eclipse.hawkbit.ui.management.dstable.DistributionTable;
|
||||
import org.eclipse.hawkbit.ui.management.targettable.TargetTable;
|
||||
import org.slf4j.Logger;
|
||||
@@ -40,6 +43,7 @@ import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
|
||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
||||
import org.vaadin.alump.distributionbar.DistributionBar;
|
||||
|
||||
import com.vaadin.data.Container;
|
||||
import com.vaadin.data.Item;
|
||||
@@ -1258,4 +1262,116 @@ public final class HawkbitCommonUtil {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set status progress bar value.
|
||||
*
|
||||
* @param bar
|
||||
* DistributionBar
|
||||
* @param statusName
|
||||
* status name
|
||||
* @param count
|
||||
* target counts in a status
|
||||
* @param index
|
||||
* bar part index
|
||||
*/
|
||||
public static void setBarPartSize(final DistributionBar bar, final String statusName, final int count,
|
||||
final int index) {
|
||||
bar.setPartSize(index, count);
|
||||
bar.setPartTooltip(index, statusName);
|
||||
bar.setPartStyleName(index, "status-bar-part-" + statusName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize status progress bar with values and number of parts on load.
|
||||
*
|
||||
* @param bar
|
||||
* DistributionBar
|
||||
* @param item
|
||||
* row of a table
|
||||
*/
|
||||
public static void initialiseProgressBar(final DistributionBar bar, final Item item) {
|
||||
final Long notStartedTargetsCount = getStatusCount(SPUILabelDefinitions.VAR_COUNT_TARGETS_NOT_STARTED, item);
|
||||
final Long runningTargetsCount = getStatusCount(SPUILabelDefinitions.VAR_COUNT_TARGETS_RUNNING, item);
|
||||
final Long scheduledTargetsCount = getStatusCount(SPUILabelDefinitions.VAR_COUNT_TARGETS_SCHEDULED, item);
|
||||
final Long errorTargetsCount = getStatusCount(SPUILabelDefinitions.VAR_COUNT_TARGETS_ERROR, item);
|
||||
final Long finishedTargetsCount = getStatusCount(SPUILabelDefinitions.VAR_COUNT_TARGETS_FINISHED, item);
|
||||
final Long cancelledTargetsCount = getStatusCount(SPUILabelDefinitions.VAR_COUNT_TARGETS_CANCELLED, item);
|
||||
if (isNoTargets(errorTargetsCount, notStartedTargetsCount, runningTargetsCount, scheduledTargetsCount,
|
||||
finishedTargetsCount, cancelledTargetsCount)) {
|
||||
HawkbitCommonUtil.setBarPartSize(bar, TotalTargetCountStatus.Status.SCHEDULED.toString().toLowerCase(), 0,
|
||||
0);
|
||||
HawkbitCommonUtil.setBarPartSize(bar, TotalTargetCountStatus.Status.FINISHED.toString().toLowerCase(), 0,
|
||||
1);
|
||||
|
||||
} else {
|
||||
bar.setNumberOfParts(6);
|
||||
setProgressBarDetails(bar, item);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the finished percentage of a rollout group into a string with one
|
||||
* digit after comma.
|
||||
*
|
||||
* @param rolloutGroup
|
||||
* the rollout group
|
||||
* @param finishedPercentage
|
||||
* the calculated finished percentage of the rolloutgroup
|
||||
* @return formatted String value
|
||||
*/
|
||||
public static String formattingFinishedPercentage(final RolloutGroup rolloutGroup, final float finishedPercentage) {
|
||||
float tmpFinishedPercentage = 0;
|
||||
switch (rolloutGroup.getStatus()) {
|
||||
case READY:
|
||||
case SCHEDULED:
|
||||
case ERROR:
|
||||
tmpFinishedPercentage = 0.0F;
|
||||
break;
|
||||
case FINISHED:
|
||||
tmpFinishedPercentage = 100.0F;
|
||||
break;
|
||||
case RUNNING:
|
||||
tmpFinishedPercentage = finishedPercentage;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return String.format("%.1f", tmpFinishedPercentage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the values of status progress bar on change of values.
|
||||
*
|
||||
* @param bar
|
||||
* DistributionBar
|
||||
* @param item
|
||||
* row of the table
|
||||
*/
|
||||
private static void setProgressBarDetails(final DistributionBar bar, final Item item) {
|
||||
bar.setNumberOfParts(6);
|
||||
final Long notStartedTargetsCount = getStatusCount(SPUILabelDefinitions.VAR_COUNT_TARGETS_NOT_STARTED, item);
|
||||
HawkbitCommonUtil.setBarPartSize(bar, TotalTargetCountStatus.Status.NOTSTARTED.toString().toLowerCase(),
|
||||
notStartedTargetsCount.intValue(), 0);
|
||||
HawkbitCommonUtil.setBarPartSize(bar, TotalTargetCountStatus.Status.SCHEDULED.toString().toLowerCase(),
|
||||
getStatusCount(SPUILabelDefinitions.VAR_COUNT_TARGETS_SCHEDULED, item).intValue(), 1);
|
||||
HawkbitCommonUtil.setBarPartSize(bar, TotalTargetCountStatus.Status.RUNNING.toString().toLowerCase(),
|
||||
getStatusCount(SPUILabelDefinitions.VAR_COUNT_TARGETS_RUNNING, item).intValue(), 2);
|
||||
HawkbitCommonUtil.setBarPartSize(bar, TotalTargetCountStatus.Status.ERROR.toString().toLowerCase(),
|
||||
getStatusCount(SPUILabelDefinitions.VAR_COUNT_TARGETS_ERROR, item).intValue(), 3);
|
||||
HawkbitCommonUtil.setBarPartSize(bar, TotalTargetCountStatus.Status.FINISHED.toString().toLowerCase(),
|
||||
getStatusCount(SPUILabelDefinitions.VAR_COUNT_TARGETS_FINISHED, item).intValue(), 4);
|
||||
HawkbitCommonUtil.setBarPartSize(bar, TotalTargetCountStatus.Status.CANCELLED.toString().toLowerCase(),
|
||||
getStatusCount(SPUILabelDefinitions.VAR_COUNT_TARGETS_CANCELLED, item).intValue(), 5);
|
||||
}
|
||||
|
||||
private static boolean isNoTargets(final Long... statusCount) {
|
||||
if (Arrays.asList(statusCount).stream().filter(value -> value > 0).toArray().length > 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static Long getStatusCount(final String propertName, final Item item) {
|
||||
return (Long) item.getItemProperty(propertName).getValue();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -722,6 +722,147 @@ public final class SPUIComponetIdProvider {
|
||||
|
||||
public static final String BULK_UPLOAD_CLOSE_BUTTON_ID = "bulk.upload.close.button.id";
|
||||
|
||||
/**
|
||||
* Rollout list view - search box id.
|
||||
*/
|
||||
public static final String ROLLOUT_LIST_SEARCH_BOX_ID = "rollout.list.search.id";
|
||||
|
||||
/**
|
||||
* Rollout list view - search reset icon id.
|
||||
*/
|
||||
public static final String ROLLOUT_LIST_SEARCH_RESET_ICON_ID = "rollout.list.search.reset.icon.id";
|
||||
|
||||
/**
|
||||
* Rollout list view - add icon id.
|
||||
*/
|
||||
public static final String ROLLOUT_ADD_ICON_ID = "rollout.add.button.id";
|
||||
|
||||
/**
|
||||
* Rollout list table id.
|
||||
*/
|
||||
public static final String ROLLOUT_LIST_TABLE_ID = "rollout.table.id";
|
||||
|
||||
/**
|
||||
* Rollout group list table id.
|
||||
*/
|
||||
public static final String ROLLOUT_GROUP_LIST_TABLE_ID = "rollout.group.table.id";
|
||||
|
||||
/**
|
||||
* Rollout group list table id.
|
||||
*/
|
||||
public static final String ROLLOUT_GROUP_TARGETS_LIST_TABLE_ID = "rollout.group.targets.table.id";
|
||||
|
||||
/**
|
||||
* Rollout delete button id.
|
||||
*/
|
||||
public static final String ROLLOUT_DELETE_ICON = "rollout.delete.button.id";
|
||||
|
||||
/**
|
||||
* Rollout text field name id.
|
||||
*/
|
||||
public static final String ROLLOUT_NAME_FIELD_ID = "rollout.name.field.id";
|
||||
/**
|
||||
* Rollout number of groups id.
|
||||
*/
|
||||
public static final String ROLLOUT_NO_OF_GROUPS_ID = "rollout.no.ofgroups.id";
|
||||
|
||||
/**
|
||||
* Rollout trigger threshold field if.
|
||||
*/
|
||||
public static final String ROLLOUT_TRIGGER_THRESOLD_ID = "rollout.trigger.thresold.id";
|
||||
|
||||
/**
|
||||
* Rollout error thresold field id.
|
||||
*/
|
||||
public static final String ROLLOUT_ERROR_THRESOLD_ID = "rollout.error.thresold.id";
|
||||
|
||||
/**
|
||||
* Rollout distribution set combo id.
|
||||
*/
|
||||
public static final String ROLLOUT_DS_ID = "rollout.ds.id";
|
||||
/**
|
||||
* Rollout description field id.
|
||||
*/
|
||||
public static final String ROLLOUT_DESCRIPTION_ID = "rollout.description.id";
|
||||
/**
|
||||
* Rollout create update window - save buttopn id.
|
||||
*/
|
||||
public static final String ROLLOUT_CREATE_UPDATE_SAVE_ID = "rollout.create.update.save.id";
|
||||
|
||||
/**
|
||||
* Rollout create update - discard button id.
|
||||
*/
|
||||
public static final String ROLLOUT_CREATE_UPDATE_DISCARD_ID = "rollout.create.update.discard.id";
|
||||
/**
|
||||
* Rollout name link id.
|
||||
*/
|
||||
public static final String ROLLOUT_NAME_LINK_ID = "rollout.name.link";
|
||||
/**
|
||||
* Rollout Group name link id.
|
||||
*/
|
||||
public static final String ROLLOUT_GROUP_NAME_LINK_ID = "rollout.group.name.link";
|
||||
/**
|
||||
* Rollout target filter query combo id.
|
||||
*/
|
||||
public static final String ROLLOUT_TARGET_FILTER_COMBO_ID = "rollout.target.filter.combo.id";
|
||||
/**
|
||||
* Rollout action button id.
|
||||
*/
|
||||
public static final String ROLLOUT_ACTION_BUTTON_ID = "rollout.action.button.id";
|
||||
/**
|
||||
* Rollout pause button id.
|
||||
*/
|
||||
public static final String ROLLOUT_PAUSE_BUTTON_ID = "rollout.pause.button.id";
|
||||
|
||||
/**
|
||||
* Rollout resume button id.
|
||||
*/
|
||||
public static final String ROLLOUT_RESUME_BUTTON_ID = "rollout.resume.button.id";
|
||||
|
||||
/**
|
||||
* Rollout save or start option group id.
|
||||
*/
|
||||
public static final String ROLLOUT_SAVESTARTOPTION_ID = "rollout.savestartoption.id";
|
||||
/**
|
||||
* Rollout status label id.
|
||||
*/
|
||||
public static final String ROLLOUT_STATUS_LABEL_ID = "rollout.status.id";
|
||||
|
||||
/**
|
||||
* Rollout % or count option group id.
|
||||
*/
|
||||
public static final String ROLLOUT_ERROR_THRESOLD_OPTION_ID = "rollout.error.thresold.option.id";
|
||||
|
||||
/**
|
||||
* Rollout target filter query value text area id.
|
||||
*/
|
||||
public static final String ROLLOUT_TARGET_FILTER_QUERY_FIELD = "rollout.target.filter.query.field.id";
|
||||
|
||||
/**
|
||||
* Rollout target view- close button id.
|
||||
*/
|
||||
public static final String ROLLOUT_TARGET_VIEW_CLOSE_BUTTON_ID = "rollout.group.target.close.id";
|
||||
/**
|
||||
* Rollout status progress bar id.
|
||||
*/
|
||||
public static final String ROLLOUT_PROGRESS_BAR = "rollout.status.progress.bar.id";
|
||||
/**
|
||||
* Rollout group header caption.
|
||||
*/
|
||||
public static final String ROLLOUT_GROUP_HEADER_CAPTION = "rollout.group.header.caption";
|
||||
/**
|
||||
* Rollout group target header caption.
|
||||
*/
|
||||
public static final String ROLLOUT_GROUP_TARGET_HEADER_CAPTION = "rollout.group.header.target.caption";
|
||||
/**
|
||||
* Rollout group close id.
|
||||
*/
|
||||
public static final String ROLLOUT_GROUP_CLOSE = "rollout.group.close.id";
|
||||
/**
|
||||
* Rollout group targets count message label.
|
||||
*/
|
||||
public static final String ROLLOUT_GROUP_TARGET_LABEL = "rollout.group.target.label";
|
||||
|
||||
/**
|
||||
* /* Private Constructor.
|
||||
*/
|
||||
|
||||
@@ -98,7 +98,12 @@ public final class SPUIDefinitions {
|
||||
public static final String ACTION_HIS_TBL_MSGS_HIDDEN = "Messages_Hidden";
|
||||
|
||||
/**
|
||||
* Action history status hidden column. This is using to generate status
|
||||
* Action history layout - rollout name column.
|
||||
*/
|
||||
public static final String ACTION_HIS_TBL_ROLLOUT_NAME = "Rollout name";
|
||||
|
||||
/**
|
||||
* /** Action history status hidden column. This is using to generate status
|
||||
* icons under status coloumn.
|
||||
*/
|
||||
public static final String ACTION_HIS_TBL_STATUS_HIDDEN = "Status_Hidden";
|
||||
@@ -118,6 +123,11 @@ public final class SPUIDefinitions {
|
||||
*/
|
||||
public static final String IN_ACTIVE = "inactive";
|
||||
|
||||
/**
|
||||
* Action history helping constant.
|
||||
*/
|
||||
public static final String SCHEDULED = "scheduled";
|
||||
|
||||
/**
|
||||
* Action history lazy fetch page length.
|
||||
*/
|
||||
@@ -932,6 +942,11 @@ public final class SPUIDefinitions {
|
||||
*/
|
||||
public static final String BULK_UPLOD_DS_COMBO_STYLE = "bulk-upload-ds-combo";
|
||||
|
||||
/**
|
||||
* Bulk Targets upload window.
|
||||
*/
|
||||
public static final String BULK_UPLOAD_WINDOW = "bulk-update-window";
|
||||
|
||||
/**
|
||||
* Filter by target filter query.
|
||||
*/
|
||||
@@ -947,6 +962,70 @@ public final class SPUIDefinitions {
|
||||
*/
|
||||
public static final Direction TARGET_TABLE_CREATE_AT_SORT_ORDER = Direction.ASC;
|
||||
|
||||
/**
|
||||
* Rollout list view - header caption .
|
||||
*/
|
||||
public static final String ROLLOUT_LIST_HEADER_CAPTION = "Rollouts";
|
||||
|
||||
/**
|
||||
* Rollout status.
|
||||
*/
|
||||
public static final String ROLLOUT_STATUS = "rollout-status";
|
||||
|
||||
/**
|
||||
* Rollout group list view - header caption .
|
||||
*/
|
||||
public static final String ROLLOUT_GROUP_LIST_HEADER_CAPTION = "Rollout Groups";
|
||||
|
||||
/**
|
||||
* Rollout delete - column property name.
|
||||
*/
|
||||
public static final String DELETE = "delete";
|
||||
|
||||
/**
|
||||
* Rollout detail status - column property status.
|
||||
*/
|
||||
public static final String DETAIL_STATUS = "detail-status";
|
||||
|
||||
/**
|
||||
* Rollout name column property.
|
||||
*/
|
||||
public static final String ROLLOUT_NAME = "rollout-name";
|
||||
/**
|
||||
* Rollout group name column property.
|
||||
*/
|
||||
public static final String ROLLOUT_GROUP_NAME = "Name";
|
||||
|
||||
/**
|
||||
* Rollout group started date column property.
|
||||
*/
|
||||
public static final String ROLLOUT_GROUP_STARTED_DATE = "Started date";
|
||||
|
||||
/**
|
||||
* Rollout group started date column property.
|
||||
*/
|
||||
public static final String ROLLOUT_GROUP_ERROR_THRESHOLD = "errorConditionExp";
|
||||
|
||||
/**
|
||||
* Rollout group started date column property.
|
||||
*/
|
||||
public static final String ROLLOUT_GROUP_THRESHOLD = "successConditionExp";
|
||||
|
||||
/**
|
||||
* Rollout group installed percentage column property.
|
||||
*/
|
||||
public static final String ROLLOUT_GROUP_INSTALLED_PERCENTAGE = "finishedPercentage";
|
||||
|
||||
/**
|
||||
* Rollout group status column property.
|
||||
*/
|
||||
public static final String ROLLOUT_GROUP_STATUS = "Status";
|
||||
|
||||
/**
|
||||
* Rollout action column property.
|
||||
*/
|
||||
public static final String ROLLOUT_ACTION = "rollout-action";
|
||||
|
||||
/**
|
||||
* /** Constructor.
|
||||
*/
|
||||
|
||||
@@ -464,6 +464,82 @@ public final class SPUILabelDefinitions {
|
||||
*/
|
||||
public static final int TARGET_FILTER_QUERY_TEXT_FIELD_LENGTH = 1024;
|
||||
|
||||
/**
|
||||
* Status - column property.
|
||||
*/
|
||||
public static final String VAR_STATUS = "status";
|
||||
|
||||
/**
|
||||
* Target filter query - column property.
|
||||
*/
|
||||
public static final String VAR_TARGETFILTERQUERY = "targetFilterQuery";
|
||||
|
||||
/**
|
||||
* Distribution name and version - column property.
|
||||
*/
|
||||
public static final String VAR_DIST_NAME_VERSION = "distributionSetNameVersion";
|
||||
|
||||
/**
|
||||
* Number of groups in rollout- column property.
|
||||
*/
|
||||
public static final String VAR_NUMBER_OF_GROUPS = "numberOfGroups";
|
||||
|
||||
/**
|
||||
* Delete label.
|
||||
*/
|
||||
public static final String DELETE = "Delete";
|
||||
/**
|
||||
* Rollout name link's description.
|
||||
*/
|
||||
public static final String SHOW_ROLLOUT_GROUP_DETAILS = "show group details";
|
||||
/**
|
||||
* Rollout action button description.
|
||||
*/
|
||||
public static final String ACTION = "Action";
|
||||
/**
|
||||
* Rollout pause button name.
|
||||
*/
|
||||
public static final String PAUSE = "Pause";
|
||||
|
||||
/**
|
||||
* Rollout resume button name.
|
||||
*/
|
||||
public static final String RESUME = "Resume";
|
||||
/**
|
||||
* Rollout and rollout group property - count of not started targets.
|
||||
*/
|
||||
public static final String VAR_COUNT_TARGETS_NOT_STARTED = "notStartedTargetsCount";
|
||||
|
||||
/**
|
||||
* Rollout and rollout group property - count of running targets.
|
||||
*/
|
||||
public static final String VAR_COUNT_TARGETS_RUNNING = "runningTargetsCount";
|
||||
|
||||
/**
|
||||
* Rollout and rollout group property - count of scheduled targets.
|
||||
*/
|
||||
public static final String VAR_COUNT_TARGETS_SCHEDULED = "scheduledTargetsCount";
|
||||
|
||||
/**
|
||||
* Rollout and rollout group property - count of targets in error.
|
||||
*/
|
||||
public static final String VAR_COUNT_TARGETS_ERROR = "errorTargetsCount";
|
||||
|
||||
/**
|
||||
* Rollout and rollout group property - count of finished targets.
|
||||
*/
|
||||
public static final String VAR_COUNT_TARGETS_FINISHED = "finishedTargetsCount";
|
||||
|
||||
/**
|
||||
* Rollout and rollout group property - count of targets cancelled targets.
|
||||
*/
|
||||
public static final String VAR_COUNT_TARGETS_CANCELLED = "cancelledTargetsCount";
|
||||
|
||||
/**
|
||||
* Total target coulmn property name.
|
||||
*/
|
||||
public static final String VAR_TOTAL_TARGETS = "totalTargetsCount";
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
|
||||
@@ -225,6 +225,19 @@ public final class SPUIStyleDefinitions {
|
||||
* Query validator icon -error style.
|
||||
*/
|
||||
public static final String ERROR_ICON = "error-icon";
|
||||
/**
|
||||
* Rollout action type layout style.
|
||||
*/
|
||||
public static final String ROLLOUT_ACTION_TYPE_LAYOUT = "rollout-action-type-layout";
|
||||
/**
|
||||
* Rollout save option group style.
|
||||
*/
|
||||
public static final String ROLLOUT_OPTION_GROUP = "rollout-option-group";
|
||||
|
||||
/**
|
||||
* Style to disable the action type layout.
|
||||
*/
|
||||
public static final String DISABLE_ACTION_TYPE_LAYOUT = "disable-action-type-layout";
|
||||
|
||||
/**
|
||||
* Bulk upload progress indicator style.
|
||||
|
||||
@@ -127,3 +127,11 @@ $white-hex-color: #fff;
|
||||
$tag-border-green-color: #2c9720;
|
||||
$tag-button-disabled-grey:#c0c0c0;
|
||||
$twin-table-border-grey:#888;
|
||||
|
||||
|
||||
$progress-bar-scheduled-part: $blue-color;
|
||||
$progress-bar-running-part: $signal-yellow-color;
|
||||
$progress-bar-error-part: $signal-red-color;
|
||||
$progress-bar-finished-part: $signal-green-color;
|
||||
$progress-bar-cancelled-part: $grey-light;
|
||||
$progress-bar-notstarted-part: $grey-color;
|
||||
@@ -198,19 +198,34 @@
|
||||
.statusIconNeutral {
|
||||
color: $hawkbit-primary-color;
|
||||
}
|
||||
|
||||
|
||||
.greySpinner{
|
||||
@include valo-spinner($size: $v-font-size--small,$color: $grey-color);
|
||||
pointer-events: auto !important;
|
||||
}
|
||||
|
||||
.yellowSpinner{
|
||||
@include valo-spinner($size: $v-font-size--small,$color: $signal-yellow-color);
|
||||
pointer-events: auto !important;
|
||||
}
|
||||
.blueSpinner{
|
||||
@include valo-spinner($size: $v-font-size--small,$color: $bosch-color-light-blue);
|
||||
pointer-events: auto !important;
|
||||
}
|
||||
|
||||
// Disabled row style when distribution is incomplete
|
||||
.v-table-row-incomplete-distribution {
|
||||
color: $disabled-row-color-grey !important;
|
||||
}
|
||||
.v-table-row-incomplete-distribution {
|
||||
color: $disabled-row-color-grey !important;
|
||||
}
|
||||
|
||||
.v-link {
|
||||
text-decoration: none;
|
||||
padding-right: 10px;
|
||||
font-weight: 300;
|
||||
}
|
||||
.v-link {
|
||||
text-decoration: none;
|
||||
padding-right: 10px;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.v-tooltip{
|
||||
max-width:43em;
|
||||
}
|
||||
.v-tooltip{
|
||||
max-width:43em;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@mixin rollout {
|
||||
.rollout-option-group{
|
||||
font-size:12px;
|
||||
font-weight:400;
|
||||
margin-left:8px;
|
||||
}
|
||||
|
||||
.rollout-action-type-layout {
|
||||
.v-caption-padding-right-style{
|
||||
padding-right:0px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.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{
|
||||
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;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.disable-action-type-layout{
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.rollout-caption-links{
|
||||
font-weight: 400;
|
||||
height: 25px ;
|
||||
padding: 0px 4px ;
|
||||
}
|
||||
|
||||
.rollout-target-count-message{
|
||||
color: $info-message-color-grey;
|
||||
}
|
||||
|
||||
.rollout-table{
|
||||
.v-table-cell-wrapper {
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@mixin statusprogressbar {
|
||||
.alump-dbar {
|
||||
.status-bar-part-scheduled {
|
||||
background-color: $progress-bar-scheduled-part !important;
|
||||
}
|
||||
|
||||
.status-bar-part-running {
|
||||
background-color: $progress-bar-running-part !important;
|
||||
}
|
||||
|
||||
.status-bar-part-error {
|
||||
background-color: $progress-bar-error-part !important;
|
||||
}
|
||||
|
||||
.status-bar-part-finished {
|
||||
background-color: $progress-bar-finished-part !important;
|
||||
}
|
||||
|
||||
.status-bar-part-cancelled {
|
||||
background-color: $progress-bar-cancelled-part !important;
|
||||
}
|
||||
|
||||
.status-bar-part-notstarted {
|
||||
background-color: $progress-bar-notstarted-part !important;
|
||||
}
|
||||
|
||||
.alump-dbar-left {
|
||||
padding: 3px 0px 3px 0px !important;
|
||||
}
|
||||
|
||||
.alump-dbar-middle {
|
||||
padding: 3px 0px 3px 0px !important;
|
||||
}
|
||||
|
||||
.alump-dbar-right {
|
||||
padding: 3px 0px 3px 0px !important;
|
||||
}
|
||||
|
||||
.alump-dbar-only {
|
||||
padding: 3px 0px 3px 0px !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
&.alump-dbar-tooltip {
|
||||
background-color: rgba(27, 54, 73, 0.9);
|
||||
border-radius: 3px;
|
||||
color: white;
|
||||
z-index: 100;
|
||||
padding: 3px;
|
||||
font-size: 10px;
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
|
||||
-moz-box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
|
||||
-webkit-box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
//Table header - filter text field style
|
||||
.filter-box {
|
||||
height: 21px !important;
|
||||
height: 25px !important;
|
||||
transition: width .5s ease-in-out;
|
||||
float: right;
|
||||
border-radius: $v-border-radius;
|
||||
|
||||
@@ -54,6 +54,9 @@ $v-table-border-color: $widget-border-color;
|
||||
@import 'customstyles/footer-common';
|
||||
@import 'customstyles/popup-common';
|
||||
@import 'customstyles/target-filter-query';
|
||||
@import 'customstyles/statusprogressbar';
|
||||
@import 'customstyles/rollout';
|
||||
|
||||
|
||||
// Optimize the CSS output
|
||||
$v-included-components: remove($v-included-components, calendar);
|
||||
@@ -88,7 +91,10 @@ $v-included-components: remove($v-included-components, form);
|
||||
@include popup-common;
|
||||
@include valo-menu-responsive;
|
||||
@include target-filter-query;
|
||||
|
||||
@include statusprogressbar;
|
||||
@include rollout;
|
||||
|
||||
|
||||
.v-app-loading {
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
background-image: $app-background-image, linear-gradient(to bottom, $app-background-image-gradient);
|
||||
@@ -120,5 +126,4 @@ $v-included-components: remove($v-included-components, form);
|
||||
left: 50%;
|
||||
margin-left: -20px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,11 @@
|
||||
*/
|
||||
@import "customstyles/hawkbitvariables";
|
||||
@import "../hawkbit/hawkbittheme";
|
||||
@import "../hawkbit/addons";
|
||||
|
||||
/* This file prefixes all rules with the theme name to avoid causing conflicts with other themes. */
|
||||
/* The actual styles should be defined in testvalothemedemo.scss */
|
||||
.hawkbit {
|
||||
@include addons;
|
||||
@include hawkbittheme;
|
||||
}
|
||||
|
||||
@@ -123,11 +123,18 @@ label.combobox.type = Select Type
|
||||
label.combobox.tag = Select Tag
|
||||
label.choose.tag = Choose Tag to update
|
||||
label.choose.tag.color = Choose Tag Color
|
||||
<<<<<<< HEAD
|
||||
label.filter = Filter:
|
||||
label.target.filter.count = Total Targets:
|
||||
label.target.filtered.total = Total filtered targets :
|
||||
label.filter.selected = Selected:
|
||||
label.filter.shown = Shown:
|
||||
=======
|
||||
label.filter = Filter :
|
||||
label.target.filter.count = Total Targets :
|
||||
label.filter.selected = Selected :
|
||||
label.filter.shown = Shown :
|
||||
>>>>>>> refs/heads/master
|
||||
label.filter.targets = Filtered targets :
|
||||
label.filter.status = Status,
|
||||
label.filter.tags = Tags,
|
||||
@@ -420,6 +427,10 @@ header.assigned.ds = Assigned DS
|
||||
header.installed.ds = Installed DS
|
||||
header.target.status = Status
|
||||
header.target.tags = Tags
|
||||
header.distributionset = Distribution set
|
||||
header.numberofgroups = No. of groups
|
||||
header.detail.status = Detail status
|
||||
header.total.targets = Total targets
|
||||
|
||||
distribution.details.header = Distribution set
|
||||
target.details.header = Target
|
||||
@@ -434,5 +445,42 @@ combo.type.tag.name = Type tag name
|
||||
label.yes = Yes
|
||||
label.no = No
|
||||
|
||||
#rollout - start
|
||||
header.distributionset = Distribution set
|
||||
header.numberofgroups = No. of groups
|
||||
header.detail.status = Detail status
|
||||
|
||||
header.rolloutgroup.installed.percentage = % Finished
|
||||
header.rolloutgroup.threshold.error = Error threshold
|
||||
header.rolloutgroup.threshold = Trigger threshold
|
||||
header.rolloutgroup.target.date = Date and time
|
||||
header.rolloutgroup.target.message = Messages
|
||||
rollout.group.label.target.truncated = {0} targets has been truncated in the list due the target size limit of {1}
|
||||
|
||||
|
||||
prompt.number.of.groups = Number of groups
|
||||
prompt.tigger.thresold = Trigger threshold
|
||||
prompt.error.threshold = Error threshold
|
||||
prompt.distribution.set = Distribution set
|
||||
caption.configure.rollout = Configure rollout
|
||||
caption.update.rollout = Update rollout
|
||||
prompt.target.filter = Custom target filter
|
||||
message.rollout.nonzero.group.number = Number of groups must be greater than zero
|
||||
message.rollout.max.group.number = Number of groups must not be greater than 500
|
||||
message.rollout.duplicate.check = Rollout [ {0} ] must be unique, entered value already exists.
|
||||
message.correct.invalid.value = Please correct invalid values
|
||||
message.enter.number = Please enter number
|
||||
message.rollout.field.value.range = Value should be in range {0} to {1}
|
||||
message.rollout.started = Rollout {0} started successfully
|
||||
message.rollout.paused = Rollout {0} paused successfully
|
||||
message.rollout.resumed = Rollout {0} resumed successfully
|
||||
message.rollout.noofgroups.or.targetfilter.missing = Please enter number of groups and select target filter
|
||||
message.rollouts = Rollouts
|
||||
label.target.per.group = Targets per group :
|
||||
message.dist.already.assigned = Distribution {0} is already assigned to target
|
||||
message.error.creating.rollout = Server error. Error creating rollout. Please contact the administrator
|
||||
message.error.starting.rollout = Server error. Error starting rollout. Please contact the administrator
|
||||
#rollout - end
|
||||
|
||||
#Menu
|
||||
menu.title = Software Provisioning
|
||||
|
||||
@@ -122,11 +122,18 @@ label.combobox.type = Select Type
|
||||
label.combobox.tag = Select Tag
|
||||
label.choose.tag = Choose Tag to update
|
||||
label.choose.tag.color = Choose Tag Color
|
||||
<<<<<<< HEAD
|
||||
label.filter = Filter:
|
||||
label.target.filter.count = Total Targets:
|
||||
label.target.filtered.total = Total filtered targets :
|
||||
label.filter.selected = Selected:
|
||||
label.filter.shown = Shown:
|
||||
=======
|
||||
label.filter = Filter :
|
||||
label.target.filter.count = Total Targets :
|
||||
label.filter.selected = Selected :
|
||||
label.filter.shown = Shown :
|
||||
>>>>>>> refs/heads/master
|
||||
label.filter.status = Status,
|
||||
label.filter.tags = Tags,
|
||||
label.filter.text = Search Text
|
||||
@@ -143,6 +150,7 @@ label.cancelled = Cancelled
|
||||
label.cancelling = Canceling
|
||||
label.retrieved = Retrieved
|
||||
label.download = Downloading
|
||||
label.scheduled = Scheduled
|
||||
label.target.id = Controller Id :
|
||||
label.target.ip = Controller IP :
|
||||
label.target.security.token = Security token :
|
||||
@@ -406,6 +414,24 @@ header.createdBy = Created By
|
||||
header.createdDate = Created Date
|
||||
header.modifiedBy = Modified By
|
||||
header.modifiedDate = Modified Date
|
||||
header.delete = Delete
|
||||
header.assigned.ds = Assigned DS
|
||||
header.installed.ds = Installed DS
|
||||
header.status = Status
|
||||
header.target.tags = Tags
|
||||
header.distributionset = Distribution set
|
||||
header.numberofgroups = No. of groups
|
||||
header.detail.status = Detail status
|
||||
header.total.targets = Total targets
|
||||
|
||||
header.rolloutgroup.installed.percentage = % Finished
|
||||
header.rolloutgroup.threshold.error = Error threshold
|
||||
header.rolloutgroup.threshold = Trigger threshold
|
||||
|
||||
header.rolloutgroup.target.date = Date and time
|
||||
header.rolloutgroup.target.message = Messages
|
||||
|
||||
rollout.group.label.target.truncated = {0} targets has been truncated in the list due the target size limit of {1}
|
||||
|
||||
distribution.details.header = Distribution set
|
||||
target.details.header = Target
|
||||
@@ -423,3 +449,28 @@ label.no =No
|
||||
|
||||
#Menu
|
||||
menu.title = Software Provisioning
|
||||
|
||||
|
||||
#Rollout management
|
||||
prompt.number.of.groups = Number of groups
|
||||
prompt.tigger.thresold = Trigger threshold
|
||||
prompt.error.threshold = Error threshold
|
||||
prompt.distribution.set = Distribution set
|
||||
caption.configure.rollout = Configure rollout
|
||||
caption.update.rollout = Update rollout
|
||||
prompt.target.filter = Custom target filter
|
||||
message.rollout.nonzero.group.number = Number of groups must be greater than zero
|
||||
message.rollout.max.group.number = Number of groups must not be greater than 500
|
||||
message.rollout.duplicate.check = Rollout [ {0} ] must be unique, entered value already exists.
|
||||
message.rollout.field.value.range = Value should be in range {0} to {1}
|
||||
message.correct.invalid.value = Please correct invalid values
|
||||
message.enter.number = Please enter number
|
||||
message.rollout.started = Rollout {0} started successfully
|
||||
message.rollout.paused = Rollout {0} paused successfully
|
||||
message.rollout.resumed = Rollout {0} resumed successfully
|
||||
message.rollout.noofgroups.or.targetfilter.missing = Please enter number of groups and select target filter
|
||||
message.rollouts = Rollouts
|
||||
label.target.per.group = Targets per group :
|
||||
message.dist.already.assigned = Distribution {0} is already assigned to target
|
||||
message.error.creating.rollout = Server error. Error creating rollout. Please contact the administrator
|
||||
message.error.starting.rollout = Server error. Error starting rollout. Please contact the administrator
|
||||
|
||||
@@ -82,8 +82,7 @@ caption.attributes = Attributes
|
||||
caption.panel.dist.installed = Installed distribution set
|
||||
caption.panel.dist.assigned = Assigned distribution set
|
||||
caption.soft.delete.confirmbox = Confirm Software Module Delete Action
|
||||
caption.cancel.action.confirmbox = Confirm action cancel
|
||||
caption.forcequit.action.confirmbox = Confirm force quit action
|
||||
caption.cancel.action.confirmbox = Confirm action cancellation
|
||||
caption.forced.datefield = Force update at time
|
||||
caption.force.action.confirmbox = Confirm Force Active Action
|
||||
|
||||
@@ -123,18 +122,25 @@ label.combobox.type = Select Type
|
||||
label.combobox.tag = Select Tag
|
||||
label.choose.tag = Choose Tag to update
|
||||
label.choose.tag.color = Choose Tag Color
|
||||
<<<<<<< HEAD
|
||||
label.filter = Filter:
|
||||
label.target.filter.count = Total Targets:
|
||||
label.target.filtered.total = Total filtered targets :
|
||||
label.filter.selected = Selected:
|
||||
label.filter.shown = Shown:
|
||||
label.filter.targets = Filtered targets :
|
||||
=======
|
||||
label.filter = Filter :
|
||||
label.target.filter.count = Total Targets :
|
||||
label.filter.selected = Selected :
|
||||
label.filter.shown = Shown :
|
||||
>>>>>>> refs/heads/master
|
||||
label.filter.status = Status,
|
||||
label.filter.tags = Tags,
|
||||
label.filter.text = Search Text
|
||||
label.filter.dist = Distribution,
|
||||
label.filter.custom = Custom
|
||||
label.target.filter.truncated={0} targets has been truncated in the list due the target size limit of {1}, use filters to reduce the targets to be shown
|
||||
label.target.filter.truncated={0} targets has been truncated in the list due the target size limit of {1}, use filters to reduce the targets to be shown
|
||||
label.active =Active
|
||||
label.inactive = In-active
|
||||
label.finished = Finished
|
||||
@@ -145,7 +151,7 @@ label.cancelled = Cancelled
|
||||
label.cancelling = Canceling
|
||||
label.retrieved = Retrieved
|
||||
label.download = Downloading
|
||||
label.unknown = Unknown
|
||||
label.scheduled = Scheduled
|
||||
label.target.id = Controller Id :
|
||||
label.target.ip = Controller IP :
|
||||
label.target.security.token = Security token :
|
||||
@@ -211,10 +217,8 @@ message.target.assigned.pending = Some target(s) are already assigned.Pending f
|
||||
message.cannot.delete = Cannot be deleted
|
||||
message.check.softwaremodule = Please provide both name and verion!
|
||||
message.duplicate.softwaremodule = {0} : {1} already exists!
|
||||
message.cannot.delete.default.dstype = Default distribution set type cannot be deleted
|
||||
message.tag.delete = Please unclick the tag {0}, then try to delete
|
||||
message.dist.type.check.delete = Please unclick the distribution type {0}, then try to delete
|
||||
message.cannot.delete.default.dstype = Default distribution set type cannot be deleted
|
||||
message.swmodule.type.check.delete = Please unclick the software module type {0}, then try to delete
|
||||
message.targets.already.deleted = Few Target(s) are already deleted.Pending for action
|
||||
message.dists.already.deleted = Few distribution(s) are already deleted.Pending for action
|
||||
@@ -261,7 +265,7 @@ message.sm.delete.confirm = Are you sure that you want to delete the selected {0
|
||||
message.error.os.softmodule = Please select the OS to delete
|
||||
message.error.ah.softmodule = Please select the Application to delete
|
||||
message.error.softmodule.deleted = The selected software module is already deleted
|
||||
message.cancel.action = Cancel..
|
||||
message.cancel.action = Cancel
|
||||
message.cancel.action.success = Action cancelled successfully !
|
||||
message.cancel.action.failed = Unable to cancel the action !
|
||||
message.cancel.action.confirm = Are you sure that you want to cancel this action?
|
||||
@@ -270,10 +274,6 @@ message.dist.alreadyAssigned = {0} Distribution Set(s) were already assigned
|
||||
message.force.action = Force
|
||||
message.force.action.confirm = Are you sure that you want to force this action?
|
||||
message.force.action.success = Action forced successfully !
|
||||
message.forcequit.action = Force Quit..
|
||||
message.forcequit.action.success = Action has been force quit successfully !
|
||||
message.forcequit.action.failed = Force Quitting the action is not possible !
|
||||
message.forcequit.action.confirm = Attention!\nForce quit should only be used when the assignment action is not working properly.\nForce quitting an action has no effect on the connected target. It is just resetting \nthe data stored on the SP update server. \nAre you absolutely sure that you want to force quit this action?
|
||||
message.distribution.no.update = distribution {0} set is already assigned to targets and cannot be changed
|
||||
message.action.not.allowed = Action not allowed
|
||||
message.onlyone.distribution.assigned = Only one distribution set can be assigned
|
||||
@@ -287,15 +287,13 @@ message.type.delete = Please unclick the distribution type {0}, then try to dele
|
||||
message.error.dist.set.type.update= Distribution Set Type is already assigned to targets and cannot be changed
|
||||
message.target.ds.assign.success = Assignments saved successfully !
|
||||
message.no.directory.upload = Directory upload is not supported
|
||||
|
||||
message.delete.filter.confirm = Are you sure that you want to delete custom filter?
|
||||
message.delete.filter.success = Custom filter {0} deleted Successfully!
|
||||
message.create.filter.success = Custom filter {0} created Successfully!
|
||||
message.update.filter.success = Custom filter updated Successfully!
|
||||
message.target.filter.validation = Please enter name and query
|
||||
message.target.filter.duplicate = {0} already exists, please enter another value
|
||||
message.tag.use.bulk.upload = {0} cannot be deleted .It is in use in targets bulk upload
|
||||
message.bulk.upload.tag.assignment.failed = Tag {0} assignment failed as tag no longer exists
|
||||
message.bulk.upload.tag.assignments.failed= Few tag assignments failed as tags no longer exists
|
||||
|
||||
# action info
|
||||
action.target.table.selectall = Select all (Ctrl+A)
|
||||
@@ -318,8 +316,6 @@ message.swModule.deleted = {0} Software module(s) deleted
|
||||
message.upload.failed = Streaming Failed
|
||||
message.uploadedfile.size.exceeded = File size exceeded .Allowed size {0} bytes
|
||||
message.file.not.found = File not found
|
||||
message.artifact.deleted =Artifact with file {0} deleted successfully
|
||||
|
||||
|
||||
upload.swModuleTable.header = Software module
|
||||
upload.selectedfile.name = file selected for upload
|
||||
@@ -345,13 +341,9 @@ caption.tab.description = Description
|
||||
|
||||
caption.delete.artifact.confirmbox = Confirm Artifact Delete Action
|
||||
|
||||
custom.filter.name = Filter Name
|
||||
custom.filter.created.by = Created By
|
||||
custom.created.date = Created Date
|
||||
|
||||
#Manage distributions view
|
||||
label.drop.dist.delete.area = Drop here<br>to delete
|
||||
label.no.tag.assigned = NO TAG
|
||||
caption.assign.software.dist.accordion.tab = Assign Software Modules
|
||||
message.software.assignment = {0} Software Module(s) Assignment(s) done
|
||||
message.dist.inuse = {0} Distribution is already assigned to target
|
||||
@@ -363,8 +355,6 @@ message.sw.module.type.delete = {0} Software Module Type(s) deleted successfully
|
||||
message.dist.type.discard.success = All Distribution Types are discarded successfully !
|
||||
message.dist.discard.success = All Distributions are discarded successfully !
|
||||
message.assign.discard.success = All assignments are discarded successfully !
|
||||
message.bulk.upload.assignment.failed = Distribution set assignment failed as distribution set no longer exists!
|
||||
message.target.ds.assign.success = Assignments saved successfully !
|
||||
|
||||
# Login view
|
||||
notification.login.title=Welcome to Bosch IoT Software Provisioning.
|
||||
@@ -419,21 +409,57 @@ header.modifiedDate = Modified Date
|
||||
header.delete = Delete
|
||||
header.assigned.ds = Assigned DS
|
||||
header.installed.ds = Installed DS
|
||||
header.target.status = Status
|
||||
header.status = Status
|
||||
header.target.tags = Tags
|
||||
header.distributionset = Distribution set
|
||||
header.numberofgroups = No. of groups
|
||||
header.detail.status = Detail status
|
||||
header.total.targets = Total targets
|
||||
|
||||
header.rolloutgroup.installed.percentage = % Finished
|
||||
header.rolloutgroup.threshold.error = Error threshold
|
||||
header.rolloutgroup.threshold = Trigger threshold
|
||||
|
||||
header.rolloutgroup.target.date = Date and time
|
||||
header.rolloutgroup.target.message = Messages
|
||||
|
||||
rollout.group.label.target.truncated = {0} targets has been truncated in the list due the target size limit of {1}
|
||||
|
||||
distribution.details.header = Distribution set
|
||||
target.details.header = Target
|
||||
header.caption.mandatory = Mandatory
|
||||
header.caption.typename = SoftwareModuleType
|
||||
header.caption.softwaremodule = SoftwareModule
|
||||
header.caption.unassign = Unassign
|
||||
message.sw.unassigned = Software module {0} successfully unassigned
|
||||
header.caption.upload.details = Upload details
|
||||
combo.type.tag.name = Type tag name
|
||||
|
||||
label.yes = Yes
|
||||
label.no = No
|
||||
label.no =No
|
||||
|
||||
#Menu
|
||||
menu.title = Software Provisioning
|
||||
|
||||
|
||||
#Rollout management
|
||||
prompt.number.of.groups = Number of groups
|
||||
prompt.tigger.thresold = Trigger threshold
|
||||
prompt.error.threshold = Error threshold
|
||||
prompt.distribution.set = Distribution set
|
||||
caption.configure.rollout = Configure rollout
|
||||
caption.update.rollout = Update rollout
|
||||
prompt.target.filter = Custom target filter
|
||||
message.rollout.nonzero.group.number = Number of groups must be greater than zero
|
||||
message.rollout.max.group.number = Number of groups must not be greater than 500
|
||||
message.rollout.duplicate.check = Rollout [ {0} ] must be unique, entered value already exists.
|
||||
message.correct.invalid.value = Please correct invalid values
|
||||
message.enter.number = Please enter number
|
||||
message.rollout.field.value.range = Value should be in range {0} to {1}
|
||||
message.rollout.started = Rollout {0} started successfully
|
||||
message.rollout.paused = Rollout {0} paused successfully
|
||||
message.rollout.resumed = Rollout {0} resumed successfully
|
||||
message.rollout.noofgroups.or.targetfilter.missing = Please enter number of groups and select target filter
|
||||
message.rollouts = Rollouts
|
||||
label.target.per.group = Targets per group :
|
||||
message.dist.already.assigned = Distribution {0} is already assigned to target
|
||||
message.error.creating.rollout = Server error. Error creating rollout. Please contact the administrator
|
||||
message.error.starting.rollout = Server error. Error starting rollout. Please contact the administrator
|
||||
|
||||
Reference in New Issue
Block a user