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
@@ -13,6 +13,7 @@ import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleTiny;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.vaadin.server.Resource;
|
||||
import com.vaadin.shared.ui.label.ContentMode;
|
||||
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,
|
||||
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,
|
||||
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);
|
||||
if (!Strings.isNullOrEmpty(id)) {
|
||||
window.setId(id);
|
||||
}
|
||||
window.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);
|
||||
|
||||
if (icon != null) {
|
||||
|
||||
@@ -549,10 +549,10 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
||||
}
|
||||
|
||||
if (distId.equals(installedDistItemIds)) {
|
||||
return SPUIDefinitions.HIGHTLIGHT_GREEN;
|
||||
return SPUIDefinitions.HIGHLIGHT_GREEN;
|
||||
}
|
||||
if (distId.equals(assignedDistTableItemIds)) {
|
||||
return SPUIDefinitions.HIGHTLIGHT_ORANGE;
|
||||
return SPUIDefinitions.HIGHLIGHT_ORANGE;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -712,11 +712,11 @@ public class TargetTable extends AbstractTable<Target, Long> {
|
||||
private String getTargetTableStyle(final Long assignedDistributionSetId, final Long installedDistributionSetId) {
|
||||
return managementUIState.getTargetTableFilters().getPinnedDistId().map(distPinned -> {
|
||||
if (distPinned.equals(installedDistributionSetId)) {
|
||||
return SPUIDefinitions.HIGHTLIGHT_GREEN;
|
||||
return SPUIDefinitions.HIGHLIGHT_GREEN;
|
||||
}
|
||||
|
||||
if (distPinned.equals(assignedDistributionSetId)) {
|
||||
return SPUIDefinitions.HIGHTLIGHT_ORANGE;
|
||||
return SPUIDefinitions.HIGHLIGHT_ORANGE;
|
||||
}
|
||||
|
||||
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.state.RolloutUIState;
|
||||
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.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||
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.LazyQueryContainer;
|
||||
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));
|
||||
}
|
||||
|
||||
RolloutListGrid(final VaadinMessageSource i18n, final UIEventBus eventBus, final RolloutManagement rolloutManagement,
|
||||
final UINotification uiNotification, final RolloutUIState rolloutUIState,
|
||||
final SpPermissionChecker permissionChecker, final TargetManagement targetManagement,
|
||||
final EntityFactory entityFactory, final UiProperties uiProperties,
|
||||
RolloutListGrid(final VaadinMessageSource i18n, final UIEventBus eventBus,
|
||||
final RolloutManagement rolloutManagement, final UINotification uiNotification,
|
||||
final RolloutUIState rolloutUIState, final SpPermissionChecker permissionChecker,
|
||||
final TargetManagement targetManagement, final EntityFactory entityFactory, final UiProperties uiProperties,
|
||||
final TargetFilterQueryManagement targetFilterQueryManagement) {
|
||||
super(i18n, eventBus, permissionChecker);
|
||||
this.rolloutManagement = rolloutManagement;
|
||||
@@ -308,7 +308,8 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
getColumn(DS_TYPE).setHeaderCaption(i18n.getMessage("header.type"));
|
||||
getColumn(SW_MODULES).setHeaderCaption(i18n.getMessage("header.swmodules"));
|
||||
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_TOTAL_TARGETS).setHeaderCaption(i18n.getMessage("header.total.targets"));
|
||||
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 ConfirmationDialog confirmationDialog = new ConfirmationDialog(i18n.getMessage("caption.confirm.delete.rollout"),
|
||||
formattedConfirmationQuestion, i18n.getMessage("button.ok"), i18n.getMessage("button.cancel"), ok -> {
|
||||
final ConfirmationDialog confirmationDialog = new ConfirmationDialog(
|
||||
i18n.getMessage("caption.confirm.delete.rollout"), formattedConfirmationQuestion,
|
||||
i18n.getMessage("button.ok"), i18n.getMessage("button.cancel"), ok -> {
|
||||
if (!ok) {
|
||||
return;
|
||||
}
|
||||
@@ -524,7 +526,7 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
final String rolloutName = (String) row.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();
|
||||
rolloutManagement.deleteRollout(rolloutId);
|
||||
uiNotification.displaySuccess(i18n.getMessage("message.rollout.deleted", rolloutName));
|
||||
});
|
||||
}, UIComponentIdProvider.ROLLOUT_DELETE_CONFIRMATION_DIALOG);
|
||||
UI.getCurrent().addWindow(confirmationDialog.getWindow());
|
||||
confirmationDialog.getWindow().bringToFront();
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
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.TotalTargetCountStatus;
|
||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||
@@ -303,10 +304,14 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
|
||||
@Override
|
||||
public void click(final RendererClickEvent event) {
|
||||
rolloutGroupManagement.findRolloutGroupWithDetailedStatus((Long) event.getItemId()).ifPresent(group -> {
|
||||
rolloutUIState.setRolloutGroup(group);
|
||||
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS);
|
||||
});
|
||||
final Optional<RolloutGroup> group = rolloutGroupManagement
|
||||
.findRolloutGroupWithDetailedStatus((Long) event.getItemId());
|
||||
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.
|
||||
*/
|
||||
public static final String HIGHTLIGHT_ORANGE = "highlight-orange";
|
||||
public static final String HIGHLIGHT_ORANGE = "highlight-orange";
|
||||
|
||||
/**
|
||||
* 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.
|
||||
|
||||
@@ -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_ENABLE_ID = "distribution.set.select.enable";
|
||||
|
||||
/**
|
||||
* Id of the unread notification button
|
||||
*/
|
||||
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";
|
||||
|
||||
/**
|
||||
* Id of the unread notification icon in the 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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user