Insert possibility to set an ID for confirmation dialog and fix redirect to rollout overview (#445)
* redirect to rollout view if rollout is deleted and group targets shall be shown Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Insert Id for confirmation dialogs Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>
This commit is contained in:
committed by
Kai Zimmermann
parent
dd25af482a
commit
59107c521f
@@ -582,33 +582,33 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Action> findActiveActionsByTarget(final String controllerId) {
|
public List<Action> findActiveActionsByTarget(final String controllerId) {
|
||||||
throwExceptionIfTargetFoesNotExist(controllerId);
|
throwExceptionIfTargetDoesNotExist(controllerId);
|
||||||
|
|
||||||
return actionRepository.findByActiveAndTarget(controllerId, true);
|
return actionRepository.findByActiveAndTarget(controllerId, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Action> findInActiveActionsByTarget(final String controllerId) {
|
public List<Action> findInActiveActionsByTarget(final String controllerId) {
|
||||||
throwExceptionIfTargetFoesNotExist(controllerId);
|
throwExceptionIfTargetDoesNotExist(controllerId);
|
||||||
|
|
||||||
return actionRepository.findByActiveAndTarget(controllerId, false);
|
return actionRepository.findByActiveAndTarget(controllerId, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long countActionsByTarget(final String controllerId) {
|
public Long countActionsByTarget(final String controllerId) {
|
||||||
throwExceptionIfTargetFoesNotExist(controllerId);
|
throwExceptionIfTargetDoesNotExist(controllerId);
|
||||||
|
|
||||||
return actionRepository.countByTargetControllerId(controllerId);
|
return actionRepository.countByTargetControllerId(controllerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long countActionsByTarget(final String rsqlParam, final String controllerId) {
|
public Long countActionsByTarget(final String rsqlParam, final String controllerId) {
|
||||||
throwExceptionIfTargetFoesNotExist(controllerId);
|
throwExceptionIfTargetDoesNotExist(controllerId);
|
||||||
|
|
||||||
return actionRepository.count(createSpecificationFor(controllerId, rsqlParam));
|
return actionRepository.count(createSpecificationFor(controllerId, rsqlParam));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void throwExceptionIfTargetFoesNotExist(final String controllerId) {
|
private void throwExceptionIfTargetDoesNotExist(final String controllerId) {
|
||||||
if (!targetRepository.existsByControllerId(controllerId)) {
|
if (!targetRepository.existsByControllerId(controllerId)) {
|
||||||
throw new EntityNotFoundException(Target.class, controllerId);
|
throw new EntityNotFoundException(Target.class, controllerId);
|
||||||
}
|
}
|
||||||
@@ -677,14 +677,14 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<DistributionSet> getAssignedDistributionSet(final String controllerId) {
|
public Optional<DistributionSet> getAssignedDistributionSet(final String controllerId) {
|
||||||
throwExceptionIfTargetFoesNotExist(controllerId);
|
throwExceptionIfTargetDoesNotExist(controllerId);
|
||||||
|
|
||||||
return distributoinSetRepository.findAssignedToTarget(controllerId);
|
return distributoinSetRepository.findAssignedToTarget(controllerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<DistributionSet> getInstalledDistributionSet(final String controllerId) {
|
public Optional<DistributionSet> getInstalledDistributionSet(final String controllerId) {
|
||||||
throwExceptionIfTargetFoesNotExist(controllerId);
|
throwExceptionIfTargetDoesNotExist(controllerId);
|
||||||
|
|
||||||
return distributoinSetRepository.findInstalledAtTarget(controllerId);
|
return distributoinSetRepository.findInstalledAtTarget(controllerId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleTiny;
|
|||||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
|
|
||||||
|
import com.google.common.base.Strings;
|
||||||
import com.vaadin.server.Resource;
|
import com.vaadin.server.Resource;
|
||||||
import com.vaadin.shared.ui.label.ContentMode;
|
import com.vaadin.shared.ui.label.ContentMode;
|
||||||
import com.vaadin.ui.Alignment;
|
import com.vaadin.ui.Alignment;
|
||||||
@@ -53,7 +54,28 @@ public class ConfirmationDialog implements Button.ClickListener {
|
|||||||
*/
|
*/
|
||||||
public ConfirmationDialog(final String caption, final String question, final String okLabel,
|
public ConfirmationDialog(final String caption, final String question, final String okLabel,
|
||||||
final String cancelLabel, final ConfirmationDialogCallback callback) {
|
final String cancelLabel, final ConfirmationDialogCallback callback) {
|
||||||
this(caption, question, okLabel, cancelLabel, callback, null);
|
this(caption, question, okLabel, cancelLabel, callback, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for configuring confirmation dialog.
|
||||||
|
*
|
||||||
|
* @param caption
|
||||||
|
* the dialog caption.
|
||||||
|
* @param question
|
||||||
|
* the question.
|
||||||
|
* @param okLabel
|
||||||
|
* the Ok button label.
|
||||||
|
* @param cancelLabel
|
||||||
|
* the cancel button label.
|
||||||
|
* @param callback
|
||||||
|
* the callback.
|
||||||
|
* @param id
|
||||||
|
* the id of the confirmation dialog
|
||||||
|
*/
|
||||||
|
public ConfirmationDialog(final String caption, final String question, final String okLabel,
|
||||||
|
final String cancelLabel, final ConfirmationDialogCallback callback, final String id) {
|
||||||
|
this(caption, question, okLabel, cancelLabel, callback, null, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -74,7 +96,33 @@ public class ConfirmationDialog implements Button.ClickListener {
|
|||||||
*/
|
*/
|
||||||
public ConfirmationDialog(final String caption, final String question, final String okLabel,
|
public ConfirmationDialog(final String caption, final String question, final String okLabel,
|
||||||
final String cancelLabel, final ConfirmationDialogCallback callback, final Resource icon) {
|
final String cancelLabel, final ConfirmationDialogCallback callback, final Resource icon) {
|
||||||
|
this(caption, question, okLabel, cancelLabel, callback, icon, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for configuring confirmation dialog.
|
||||||
|
*
|
||||||
|
* @param caption
|
||||||
|
* the dialog caption.
|
||||||
|
* @param question
|
||||||
|
* the question.
|
||||||
|
* @param okLabel
|
||||||
|
* the Ok button label.
|
||||||
|
* @param cancelLabel
|
||||||
|
* the cancel button label.
|
||||||
|
* @param callback
|
||||||
|
* the callback.
|
||||||
|
* @param icon
|
||||||
|
* the icon of the dialog
|
||||||
|
* @param id
|
||||||
|
* the id of the confirmation dialog
|
||||||
|
*/
|
||||||
|
public ConfirmationDialog(final String caption, final String question, final String okLabel,
|
||||||
|
final String cancelLabel, final ConfirmationDialogCallback callback, final Resource icon, final String id) {
|
||||||
window = new Window(caption);
|
window = new Window(caption);
|
||||||
|
if (!Strings.isNullOrEmpty(id)) {
|
||||||
|
window.setId(id);
|
||||||
|
}
|
||||||
window.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);
|
window.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);
|
||||||
|
|
||||||
if (icon != null) {
|
if (icon != null) {
|
||||||
|
|||||||
@@ -549,10 +549,10 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (distId.equals(installedDistItemIds)) {
|
if (distId.equals(installedDistItemIds)) {
|
||||||
return SPUIDefinitions.HIGHTLIGHT_GREEN;
|
return SPUIDefinitions.HIGHLIGHT_GREEN;
|
||||||
}
|
}
|
||||||
if (distId.equals(assignedDistTableItemIds)) {
|
if (distId.equals(assignedDistTableItemIds)) {
|
||||||
return SPUIDefinitions.HIGHTLIGHT_ORANGE;
|
return SPUIDefinitions.HIGHLIGHT_ORANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -712,11 +712,11 @@ public class TargetTable extends AbstractTable<Target, Long> {
|
|||||||
private String getTargetTableStyle(final Long assignedDistributionSetId, final Long installedDistributionSetId) {
|
private String getTargetTableStyle(final Long assignedDistributionSetId, final Long installedDistributionSetId) {
|
||||||
return managementUIState.getTargetTableFilters().getPinnedDistId().map(distPinned -> {
|
return managementUIState.getTargetTableFilters().getPinnedDistId().map(distPinned -> {
|
||||||
if (distPinned.equals(installedDistributionSetId)) {
|
if (distPinned.equals(installedDistributionSetId)) {
|
||||||
return SPUIDefinitions.HIGHTLIGHT_GREEN;
|
return SPUIDefinitions.HIGHLIGHT_GREEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (distPinned.equals(assignedDistributionSetId)) {
|
if (distPinned.equals(assignedDistributionSetId)) {
|
||||||
return SPUIDefinitions.HIGHTLIGHT_ORANGE;
|
return SPUIDefinitions.HIGHLIGHT_ORANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -46,12 +46,12 @@ import org.eclipse.hawkbit.ui.rollout.StatusFontIcon;
|
|||||||
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
||||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
||||||
@@ -121,10 +121,10 @@ public class RolloutListGrid extends AbstractGrid {
|
|||||||
statusIconMap.put(RolloutStatus.DELETING, new StatusFontIcon(null, SPUIStyleDefinitions.STATUS_SPINNER_RED));
|
statusIconMap.put(RolloutStatus.DELETING, new StatusFontIcon(null, SPUIStyleDefinitions.STATUS_SPINNER_RED));
|
||||||
}
|
}
|
||||||
|
|
||||||
RolloutListGrid(final VaadinMessageSource i18n, final UIEventBus eventBus, final RolloutManagement rolloutManagement,
|
RolloutListGrid(final VaadinMessageSource i18n, final UIEventBus eventBus,
|
||||||
final UINotification uiNotification, final RolloutUIState rolloutUIState,
|
final RolloutManagement rolloutManagement, final UINotification uiNotification,
|
||||||
final SpPermissionChecker permissionChecker, final TargetManagement targetManagement,
|
final RolloutUIState rolloutUIState, final SpPermissionChecker permissionChecker,
|
||||||
final EntityFactory entityFactory, final UiProperties uiProperties,
|
final TargetManagement targetManagement, final EntityFactory entityFactory, final UiProperties uiProperties,
|
||||||
final TargetFilterQueryManagement targetFilterQueryManagement) {
|
final TargetFilterQueryManagement targetFilterQueryManagement) {
|
||||||
super(i18n, eventBus, permissionChecker);
|
super(i18n, eventBus, permissionChecker);
|
||||||
this.rolloutManagement = rolloutManagement;
|
this.rolloutManagement = rolloutManagement;
|
||||||
@@ -308,7 +308,8 @@ public class RolloutListGrid extends AbstractGrid {
|
|||||||
getColumn(DS_TYPE).setHeaderCaption(i18n.getMessage("header.type"));
|
getColumn(DS_TYPE).setHeaderCaption(i18n.getMessage("header.type"));
|
||||||
getColumn(SW_MODULES).setHeaderCaption(i18n.getMessage("header.swmodules"));
|
getColumn(SW_MODULES).setHeaderCaption(i18n.getMessage("header.swmodules"));
|
||||||
getColumn(IS_REQUIRED_MIGRATION_STEP).setHeaderCaption(i18n.getMessage("header.migrations.step"));
|
getColumn(IS_REQUIRED_MIGRATION_STEP).setHeaderCaption(i18n.getMessage("header.migrations.step"));
|
||||||
getColumn(SPUILabelDefinitions.VAR_DIST_NAME_VERSION).setHeaderCaption(i18n.getMessage("header.distributionset"));
|
getColumn(SPUILabelDefinitions.VAR_DIST_NAME_VERSION)
|
||||||
|
.setHeaderCaption(i18n.getMessage("header.distributionset"));
|
||||||
getColumn(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).setHeaderCaption(i18n.getMessage("header.numberofgroups"));
|
getColumn(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).setHeaderCaption(i18n.getMessage("header.numberofgroups"));
|
||||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setHeaderCaption(i18n.getMessage("header.total.targets"));
|
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setHeaderCaption(i18n.getMessage("header.total.targets"));
|
||||||
getColumn(SPUILabelDefinitions.VAR_CREATED_DATE).setHeaderCaption(i18n.getMessage("header.createdDate"));
|
getColumn(SPUILabelDefinitions.VAR_CREATED_DATE).setHeaderCaption(i18n.getMessage("header.createdDate"));
|
||||||
@@ -515,8 +516,9 @@ public class RolloutListGrid extends AbstractGrid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final String formattedConfirmationQuestion = getConfirmationQuestion(rollout.get());
|
final String formattedConfirmationQuestion = getConfirmationQuestion(rollout.get());
|
||||||
final ConfirmationDialog confirmationDialog = new ConfirmationDialog(i18n.getMessage("caption.confirm.delete.rollout"),
|
final ConfirmationDialog confirmationDialog = new ConfirmationDialog(
|
||||||
formattedConfirmationQuestion, i18n.getMessage("button.ok"), i18n.getMessage("button.cancel"), ok -> {
|
i18n.getMessage("caption.confirm.delete.rollout"), formattedConfirmationQuestion,
|
||||||
|
i18n.getMessage("button.ok"), i18n.getMessage("button.cancel"), ok -> {
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -524,7 +526,7 @@ public class RolloutListGrid extends AbstractGrid {
|
|||||||
final String rolloutName = (String) row.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();
|
final String rolloutName = (String) row.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();
|
||||||
rolloutManagement.deleteRollout(rolloutId);
|
rolloutManagement.deleteRollout(rolloutId);
|
||||||
uiNotification.displaySuccess(i18n.getMessage("message.rollout.deleted", rolloutName));
|
uiNotification.displaySuccess(i18n.getMessage("message.rollout.deleted", rolloutName));
|
||||||
});
|
}, UIComponentIdProvider.ROLLOUT_DELETE_CONFIRMATION_DIALOG);
|
||||||
UI.getCurrent().addWindow(confirmationDialog.getWindow());
|
UI.getCurrent().addWindow(confirmationDialog.getWindow());
|
||||||
confirmationDialog.getWindow().bringToFront();
|
confirmationDialog.getWindow().bringToFront();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import java.util.Map;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
||||||
|
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||||
@@ -303,10 +304,14 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void click(final RendererClickEvent event) {
|
public void click(final RendererClickEvent event) {
|
||||||
rolloutGroupManagement.findRolloutGroupWithDetailedStatus((Long) event.getItemId()).ifPresent(group -> {
|
final Optional<RolloutGroup> group = rolloutGroupManagement
|
||||||
rolloutUIState.setRolloutGroup(group);
|
.findRolloutGroupWithDetailedStatus((Long) event.getItemId());
|
||||||
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS);
|
if (!group.isPresent()) {
|
||||||
});
|
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUTS);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
rolloutUIState.setRolloutGroup(group.get());
|
||||||
|
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -248,12 +248,12 @@ public final class SPUIDefinitions {
|
|||||||
/**
|
/**
|
||||||
* Style to highlight row in orange color.
|
* Style to highlight row in orange color.
|
||||||
*/
|
*/
|
||||||
public static final String HIGHTLIGHT_ORANGE = "highlight-orange";
|
public static final String HIGHLIGHT_ORANGE = "highlight-orange";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Style to highlight row in green color.
|
* Style to highlight row in green color.
|
||||||
*/
|
*/
|
||||||
public static final String HIGHTLIGHT_GREEN = "highlight-green";
|
public static final String HIGHLIGHT_GREEN = "highlight-green";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Combo box specific style for Distribution set.
|
* The Combo box specific style for Distribution set.
|
||||||
|
|||||||
@@ -977,13 +977,26 @@ public final class UIComponentIdProvider {
|
|||||||
public static final String DIST_SET_SELECT_CONS_WINDOW_ID = "distribution.set.select.consequences.window";
|
public static final String DIST_SET_SELECT_CONS_WINDOW_ID = "distribution.set.select.consequences.window";
|
||||||
|
|
||||||
public static final String DIST_SET_SELECT_ENABLE_ID = "distribution.set.select.enable";
|
public static final String DIST_SET_SELECT_ENABLE_ID = "distribution.set.select.enable";
|
||||||
|
/**
|
||||||
|
* Id of the unread notification button
|
||||||
|
*/
|
||||||
public static final String NOTIFICATION_UNREAD_ID = "notification.unread";
|
public static final String NOTIFICATION_UNREAD_ID = "notification.unread";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Id of the unread notification popup
|
||||||
|
*/
|
||||||
public static final String NOTIFICATION_UNREAD_POPUP_id = "notification.unread.popup";
|
public static final String NOTIFICATION_UNREAD_POPUP_id = "notification.unread.popup";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Id of the unread notification icon in the menu
|
||||||
|
*/
|
||||||
public static final String NOTIFICATION_MENU_ID = "notification.menu.";
|
public static final String NOTIFICATION_MENU_ID = "notification.menu.";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Id of the rollout deletion confirmation window
|
||||||
|
*/
|
||||||
|
public static final String ROLLOUT_DELETE_CONFIRMATION_DIALOG = "rollout.delete.confirmation.window";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* /* Private Constructor.
|
* /* Private Constructor.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user