Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature invalidation of distribution sets [UI part] #1176

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
fbbbc01
Visualization of action/button invalidate DistributionSet
blomark Aug 12, 2021
ac4574a
introduced two dialogs to confirm ds invalidation
blomark Aug 16, 2021
3fac888
fixed dialog titles appear centered and added manamgement classes
blomark Aug 17, 2021
e72c3d4
retrieving affected entities from repository
blomark Aug 17, 2021
fa9b142
considered multiselection for invalidating dist sets
blomark Aug 17, 2021
aa643af
adapt style and tooltip of invalid distributions in grid
blomark Aug 18, 2021
e35a69c
showing errors for actions not allowed for invalidate DS
blomark Aug 18, 2021
18da6c1
enhanced error message with dist name and version
blomark Aug 18, 2021
34b484d
added ids to the labels to be used in tests
blomark Aug 18, 2021
492346d
added support for overwriting entity specific edit behaviour
blomark Aug 19, 2021
e32e444
Fixed incorrect label for cancelled action due to invalidation of ds in
blomark Aug 20, 2021
446d379
Fixed error notification to not show "please try again" for an invalid
blomark Sep 7, 2021
483ceb5
fixed typo
blomark Sep 7, 2021
8078074
fixed Sonar findings
blomark Sep 7, 2021
5fe950a
remove DS of a copied Rollout in case the DS is invalidated
blomark Sep 9, 2021
a0d9f4c
changed icon of RolloutActionStatus in case of stopped Rollout because
blomark Sep 9, 2021
71e0910
Prevent editing Metadata of invalid DS
blomark Sep 10, 2021
d3cbab5
show DS as invalidated in Rollout view
blomark Sep 14, 2021
8cb7c35
incorporated code review remarks
blomark Sep 15, 2021
9a3d886
invalidated DS should be removed from the list of DS to be invalidated
blomark Sep 15, 2021
2e7494e
fixed missing code due to merge
blomark Sep 29, 2021
377cd66
Fixed compile error due to rebase
blomark Oct 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.eclipse.hawkbit.ui.error.HawkbitUIErrorHandler;
import org.eclipse.hawkbit.ui.error.extractors.ConstraintViolationErrorExtractor;
import org.eclipse.hawkbit.ui.error.extractors.EntityNotFoundErrorExtractor;
import org.eclipse.hawkbit.ui.error.extractors.InvalidDistributionSetErrorExtractor;
import org.eclipse.hawkbit.ui.error.extractors.UiErrorDetailsExtractor;
import org.eclipse.hawkbit.ui.error.extractors.UploadErrorExtractor;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
Expand Down Expand Up @@ -49,7 +50,7 @@ public class MgmtUiConfiguration {

/**
* Permission checker for UI.
*
*
* @param permissionService
* PermissionService
*
Expand All @@ -63,7 +64,7 @@ SpPermissionChecker spPermissionChecker(final PermissionService permissionServic

/**
* Utility for Vaadin messages source.
*
*
* @param source
* Delegate MessageSource
*
Expand All @@ -77,7 +78,7 @@ VaadinMessageSource messageSourceVaadin(final MessageSource source) {

/**
* Localized system message provider bean.
*
*
* @param uiProperties
* UiProperties
* @param i18n
Expand All @@ -93,12 +94,12 @@ SystemMessagesProvider systemMessagesProvider(final UiProperties uiProperties, f

/**
* UI Error handler bean.
*
*
* @param i18n
* VaadinMessageSource
* @param uiErrorDetailsExtractor
* ui error details extractors
*
*
* @return UI Error handler
*/
@Bean
Expand All @@ -110,7 +111,7 @@ ErrorHandler uiErrorHandler(final VaadinMessageSource i18n,

/**
* UI Upload Error details extractor bean.
*
*
* @return UI Upload Error details extractor
*/
@Bean
Expand All @@ -120,7 +121,7 @@ UiErrorDetailsExtractor uploadErrorExtractor() {

/**
* UI ConstraintViolation Error details extractor bean.
*
*
* @param i18n
* VaadinMessageSource
* @return UI ConstraintViolation Error details extractor
Expand All @@ -132,7 +133,7 @@ UiErrorDetailsExtractor constraintViolationErrorExtractor(final VaadinMessageSou

/**
* UI Entity not found Error details extractor bean.
*
*
* @param i18n
* VaadinMessageSource
* @return UI EntityNotFound Error details extractor
Expand All @@ -142,6 +143,19 @@ UiErrorDetailsExtractor entityNotFoundErrorExtractor(final VaadinMessageSource i
return new EntityNotFoundErrorExtractor(i18n);
}

/**
* Details extractor bean for action not possible because of distribution
* set is invalid.
*
* @param i18n
* VaadinMessageSource
* @return UI invalid distributionset Error details extractor
*/
@Bean
UiErrorDetailsExtractor invalidDistributionSetErrorExtractor(final VaadinMessageSource i18n) {
return new InvalidDistributionSetErrorExtractor(i18n);
}

/**
* Vaadin4Spring servlet bean.
*
Expand All @@ -154,7 +168,7 @@ public VaadinServlet vaadinServlet() {

/**
* UI target entity mapper bean.
*
*
* @param i18n
* VaadinMessageSource
* @return UI target entity mapper
Expand All @@ -166,7 +180,7 @@ public TargetToProxyTargetMapper targetToProxyTargetMapper(final VaadinMessageSo

/**
* UI Management target data supplier bean.
*
*
* @param targetManagement
* TargetManagement
* @param targetToProxyTargetMapper
Expand All @@ -183,7 +197,7 @@ public TargetManagementStateDataSupplier targetManagementStateDataSupplier(final

/**
* UI Filter target data supplier bean.
*
*
* @param targetManagement
* TargetManagement
* @param targetToProxyTargetMapper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ public class CommonDialogWindow extends Window {
* Different kinds of confirm buttons
*/
public enum ConfirmStyle {
SAVE, OK
SAVE, OK, CONFIRM, NEXT
}

/**
* Constructor
*
*
* @param caption
* the caption
* @param content
Expand Down Expand Up @@ -189,7 +189,7 @@ private void createMandatoryLabel() {

/**
* Hide the line that explains the mandatory decorator
*
*
*/
public void hideMandatoryExplanation() {
if (mandatoryLabel != null) {
Expand Down Expand Up @@ -218,6 +218,14 @@ private void createSaveButton() {
confirmButton = SPUIComponentProvider.getButton(UIComponentIdProvider.SAVE_BUTTON,
i18n.getMessage(UIMessageIdProvider.BUTTON_SAVE), "", "", true, VaadinIcons.HARDDRIVE,
buttonDecorator);
} else if (confirmStyle == ConfirmStyle.NEXT) {
confirmButton = SPUIComponentProvider.getButton(UIComponentIdProvider.OK_BUTTON,
i18n.getMessage(UIMessageIdProvider.BUTTON_NEXT), "", ValoTheme.BUTTON_PRIMARY, false, null,
buttonDecorator);
} else if (confirmStyle == ConfirmStyle.CONFIRM) {
confirmButton = SPUIComponentProvider.getButton(UIComponentIdProvider.OK_BUTTON,
i18n.getMessage(UIMessageIdProvider.BUTTON_CONFIRM), "", ValoTheme.BUTTON_PRIMARY, false, null,
buttonDecorator);
} else {
confirmButton = SPUIComponentProvider.getButton(UIComponentIdProvider.OK_BUTTON,
i18n.getMessage(UIMessageIdProvider.BUTTON_OK), "", ValoTheme.BUTTON_PRIMARY, false, null,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/**
* Copyright (c) 2020 Bosch.IO GmbH and others.
*
* All rights reserved. This program and the accompanying materials
Expand Down Expand Up @@ -42,7 +42,7 @@
import com.vaadin.ui.Label;

/**
*
*
* Generate labels with icons according to entities' states
*
*/
Expand All @@ -63,7 +63,7 @@ public static class ActionStatusIconSupplier<E extends ProxyIdentifiableEntity>

/**
* constructor
*
*
* @param i18n
* message source for internationalization
* @param getEntityStatus
Expand Down Expand Up @@ -101,7 +101,7 @@ public static class RolloutStatusIconSupplier<E extends ProxyIdentifiableEntity>

/**
* constructor
*
*
* @param i18n
* message source for internationalization
* @param getEntityStatus
Expand Down Expand Up @@ -140,7 +140,7 @@ public static class RolloutGroupStatusIconSupplier<E extends ProxyIdentifiableEn

/**
* constructor
*
*
* @param i18n
* message source for internationalization
* @param getEntityStatus
Expand Down Expand Up @@ -177,7 +177,7 @@ public static class RolloutActionStatusIconSupplier<E extends ProxyIdentifiableE

/**
* constructor
*
*
* @param i18n
* message source for internationalization
* @param getEntityStatus
Expand Down Expand Up @@ -208,7 +208,7 @@ public Label getLabel(final E entity) {
if (optionalIcon.isPresent()) {
icon = getFontIconFromStatusMap(optionalIcon.get(), getEntityStatus.apply(entity), group.orElse(null));
} else {
icon = buildDefaultStatusIcon(group.orElse(null));
icon = buildStatusIcon(group.orElse(null));
}

return getLabel(entity, icon);
Expand All @@ -233,17 +233,23 @@ private static boolean isDownloadOnly(final RolloutGroup group) {
// Actions are not created for targets when rollout's status is
// READY and when duplicate assignment is done. In these cases
// display a appropriate status with description
private ProxyFontIcon buildDefaultStatusIcon(final RolloutGroup rolloutGroup) {
private ProxyFontIcon buildStatusIcon(final RolloutGroup rolloutGroup) {
if (rolloutGroup != null && rolloutGroup.getStatus() == RolloutGroupStatus.READY) {
return new ProxyFontIcon(VaadinIcons.BULLSEYE, SPUIStyleDefinitions.STATUS_ICON_LIGHT_BLUE,
i18n.getMessage(UIMessageIdProvider.TOOLTIP_ROLLOUT_GROUP_STATUS_PREFIX
+ RolloutGroupStatus.READY.toString().toLowerCase()));
} else if (rolloutGroup != null && rolloutGroup.getStatus() == RolloutGroupStatus.FINISHED) {
final DistributionSet dist = rolloutGroup.getRollout().getDistributionSet();
final String ds = HawkbitCommonUtil.getFormattedNameVersion(dist.getName(), dist.getVersion());

return new ProxyFontIcon(VaadinIcons.MINUS_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_BLUE,
i18n.getMessage("message.dist.already.assigned", ds));
if (dist.isValid()) {
return new ProxyFontIcon(VaadinIcons.MINUS_CIRCLE, SPUIStyleDefinitions.STATUS_ICON_BLUE,
i18n.getMessage(UIMessageIdProvider.MESSAGE_DISTRIBUTION_ASSIGNED, ds));
} else {
// invalidated ds, finished rollout but ds wasn't assigned
// to target
return new ProxyFontIcon(VaadinIcons.BAN, SPUIStyleDefinitions.STATUS_ICON_BLUE,
i18n.getMessage(UIMessageIdProvider.MESSAGE_DISTRIBUTION_NOT_ASSIGNED, ds));
}
blomark marked this conversation as resolved.
Show resolved Hide resolved
} else {
return generateUnknwonStateIcon();
}
Expand All @@ -264,7 +270,7 @@ public static class ActiveStatusIconSupplier<E extends ProxyIdentifiableEntity>

/**
* constructor
*
*
* @param i18n
* message source for internationalization
* @param getEntityStatus
Expand Down Expand Up @@ -298,7 +304,7 @@ public static class ActionTypeIconSupplier<E extends ProxyIdentifiableEntity>

/**
* constructor
*
*
* @param i18n
* message source for internationalization
* @param getEntityStatus
Expand Down Expand Up @@ -333,7 +339,7 @@ public static class TargetStatusIconSupplier<E extends ProxyIdentifiableEntity>

/**
* constructor
*
*
* @param i18n
* message source for internationalization
* @param getEntityStatus
Expand Down Expand Up @@ -366,7 +372,7 @@ public static class ProgressStatusIconSupplier<E extends ProxyIdentifiableEntity

/**
* constructor
*
*
* @param i18n
* message source for internationalization
* @param getEntityStatus
Expand All @@ -393,7 +399,7 @@ public static class TargetPollingStatusIconSupplier extends AbstractEntityStatus

/**
* constructor
*
*
* @param i18n
* message source for internationalization
* @param labelIdPrefix
Expand Down Expand Up @@ -424,7 +430,7 @@ public static class TimeforcedIconSupplier extends AbstractEntityStatusIconBuild

/**
* constructor
*
*
* @param i18n
* message source for internationalization
* @param labelIdPrefix
Expand Down Expand Up @@ -541,7 +547,7 @@ protected ProxyFontIcon generateUnknwonStateIcon() {

/**
* Generate a label from the entity according to its state
*
*
* @param entity
* to read the state from
* @return the label
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public ProxyDistributionSet map(final DistributionSet distributionSet) {
HawkbitCommonUtil.getFormattedNameVersion(distributionSet.getName(), distributionSet.getVersion()));
proxyDistribution.setIsComplete(distributionSet.isComplete());
proxyDistribution.setRequiredMigrationStep(distributionSet.isRequiredMigrationStep());
proxyDistribution.setIsValid(distributionSet.isValid());

final DistributionSetType type = distributionSet.getType();
final ProxyTypeInfo typeInfo = new ProxyTypeInfo(type.getId(), type.getName(), type.getKey());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public ProxyRollout map(final Rollout rollout) {
mapNamedEntityAttributes(rollout, proxyRollout);

final DistributionSet ds = rollout.getDistributionSet();
proxyRollout.setDsInfo(new ProxyDistributionSetInfo(ds.getId(), ds.getName(), ds.getVersion()));
proxyRollout.setDsInfo(new ProxyDistributionSetInfo(ds.getId(), ds.getName(), ds.getVersion(), ds.isValid()));
proxyRollout
.setNumberOfGroups(rollout.getRolloutGroupsCreated() > 0 ? rollout.getRolloutGroupsCreated() : null);
proxyRollout.setForcedTime(rollout.getForcedTime() > 0 ? rollout.getForcedTime() : null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public ProxyTargetFilterQuery map(final TargetFilterQuery targetFilterQuery) {
if (distributionSet != null) {
proxyTargetFilter.setAutoAssignmentEnabled(true);
proxyTargetFilter.setDistributionSetInfo(new ProxyDistributionSetInfo(distributionSet.getId(),
distributionSet.getName(), distributionSet.getVersion()));
distributionSet.getName(), distributionSet.getVersion(), distributionSet.isValid()));
proxyTargetFilter.setAutoAssignActionType(targetFilterQuery.getAutoAssignActionType());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public DistributionSetStatelessDataProvider(final DistributionSetManagement dist
@Override
protected Page<DistributionSet> loadBackendEntities(final PageRequest pageRequest, final String filter) {
final DistributionSetFilterBuilder builder = new DistributionSetFilterBuilder().setIsDeleted(false)
.setIsComplete(true);
.setIsComplete(true).setIsValid(true);

if (!StringUtils.isEmpty(filter)) {
builder.setFilterString(filter);
Expand Down
Loading