Improve and fix texts of confirmation popups in UI (#1002)

* fix force action confirm text, add plural wording for multiple assigning

Signed-off-by: Stefan Klotz <stefan.klotz@bosch-si.com>

* fix hard coded plural s on DeleteSupport

Signed-off-by: Stefan Klotz <stefan.klotz@bosch-si.com>

* fix entity creation and deletion notification i18n

Signed-off-by: Stefan Klotz <stefan.klotz@bosch-si.com>

* remove placeholder for optional plural s from UI messages

Signed-off-by: Stefan Klotz <stefan.klotz@bosch-si.com>

* renaming

Signed-off-by: Stefan Klotz <stefan.klotz@bosch-si.com>
This commit is contained in:
Stefan Klotz
2020-09-04 14:08:49 +02:00
committed by GitHub
parent 1921fbf607
commit 29bb9194a6
24 changed files with 253 additions and 154 deletions

View File

@@ -117,7 +117,7 @@ public class HawkbitEntityEventListener {
if (eventPayloadIdentifier.shouldBeDeffered()) {
notificationUnreadButton.incrementUnreadNotification(
eventPayloadIdentifier.getEventTypeMessageKey(), remoteEventPayload);
eventPayloadIdentifier.getNotificationType(), remoteEventPayload);
} else {
eventBus.publish(EventTopics.ENTITY_MODIFIED, UI.getCurrent(), remoteEventPayload);
}

View File

@@ -84,8 +84,8 @@ public class ArtifactDetailsGrid extends AbstractGrid<ProxyArtifact, Long> {
this.notification = notification;
this.artifactManagement = artifactManagement;
this.artifactDeleteSupport = new DeleteSupport<>(this, i18n, notification,
i18n.getMessage("artifact.details.header"), ProxyArtifact::getFilename, this::artifactsDeletionCallback,
this.artifactDeleteSupport = new DeleteSupport<>(this, i18n, notification, "artifact.details.header",
"caption.artifacts", ProxyArtifact::getFilename, this::artifactsDeletionCallback,
UIComponentIdProvider.ARTIFACT_DELETE_CONFIRMATION_DIALOG);
setFilterSupport(

View File

@@ -112,9 +112,9 @@ public class SoftwareModuleGrid extends AbstractGrid<ProxySoftwareModule, SwFilt
getSelectionSupport().enableMultiSelection();
}
this.swModuleDeleteSupport = new DeleteSupport<>(this, i18n, notification,
i18n.getMessage("caption.software.module"), ProxySoftwareModule::getNameAndVersion,
this::deleteSoftwareModules, UIComponentIdProvider.SM_DELETE_CONFIRMATION_DIALOG);
this.swModuleDeleteSupport = new DeleteSupport<>(this, i18n, notification, "caption.software.module",
"caption.softwaremodules", ProxySoftwareModule::getNameAndVersion, this::deleteSoftwareModules,
UIComponentIdProvider.SM_DELETE_CONFIRMATION_DIALOG);
setFilterSupport(new FilterSupport<>(
new SoftwareModuleDataProvider(softwareModuleManagement,

View File

@@ -54,9 +54,9 @@ public class SMTypeFilterButtons extends AbstractTypeFilterButtons {
* @param smTypeWindowBuilder
* SmTypeWindowBuilder
* @param typeFilterLayoutUiState
* TypeFilterLayoutUiState
* TypeFilterLayoutUiState
* @param view
* EventView
* EventView
*/
public SMTypeFilterButtons(final UIEventBus eventBus, final VaadinMessageSource i18n,
final UINotification uiNotification, final SpPermissionChecker permChecker,
@@ -85,8 +85,13 @@ public class SMTypeFilterButtons extends AbstractTypeFilterButtons {
}
@Override
protected String getFilterButtonsType() {
return i18n.getMessage("caption.entity.software.module.type");
protected String getMessageKeyEntityTypeSing() {
return "caption.entity.software.module.type";
}
@Override
protected String getMessageKeyEntityTypePlur() {
return "caption.entity.software.module.types";
}
@Override

View File

@@ -29,7 +29,7 @@ import org.vaadin.spring.events.EventBus.UIEventBus;
* Grid for MetaData pop up layout.
*
* @param <F>
* Generic type
* Generic type
*/
public class MetaDataWindowGrid<F> extends AbstractGrid<ProxyMetaData, F> implements MasterEntityAwareComponent<F> {
private static final long serialVersionUID = 1L;
@@ -44,17 +44,17 @@ public class MetaDataWindowGrid<F> extends AbstractGrid<ProxyMetaData, F> implem
* Constructor for MetaDataWindowGrid
*
* @param i18n
* VaadinMessageSource
* VaadinMessageSource
* @param eventBus
* UIEventBus
* UIEventBus
* @param permissionChecker
* SpPermissionChecker
* SpPermissionChecker
* @param notification
* UINotification
* UINotification
* @param dataProvider
* AbstractMetaDataDataProvider for filter support
* AbstractMetaDataDataProvider for filter support
* @param itemsDeletionCallback
* Grid item deletion Call back for event listener
* Grid item deletion Call back for event listener
*
*/
public MetaDataWindowGrid(final VaadinMessageSource i18n, final UIEventBus eventBus,
@@ -63,8 +63,8 @@ public class MetaDataWindowGrid<F> extends AbstractGrid<ProxyMetaData, F> implem
final Predicate<Collection<ProxyMetaData>> itemsDeletionCallback) {
super(i18n, eventBus, permissionChecker);
this.metaDataDeleteSupport = new DeleteSupport<>(this, i18n, notification, i18n.getMessage("caption.metadata"),
ProxyMetaData::getKey, itemsDeletionCallback,
this.metaDataDeleteSupport = new DeleteSupport<>(this, i18n, notification, "caption.metadata",
"caption.metadata.plur", ProxyMetaData::getKey, itemsDeletionCallback,
UIComponentIdProvider.METADATA_DELETE_CONFIRMATION_DIALOG);
setFilterSupport(new FilterSupport<>(dataProvider));

View File

@@ -12,7 +12,6 @@ import java.util.Objects;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyIdentifiableEntity;
import org.eclipse.hawkbit.ui.common.event.EntityModifiedEventPayload.EntityModifiedEventType;
import org.springframework.util.StringUtils;
import com.google.common.base.MoreObjects;
@@ -23,15 +22,15 @@ public class EntityModifiedEventPayloadIdentifier {
private final Class<? extends ProxyIdentifiableEntity> parentType;
private final Class<? extends ProxyIdentifiableEntity> entityType;
private final EntityModifiedEventType modifiedEventType;
private final String eventTypeMessageKey;
private final EventNotificationType notificationType;
/**
* Constructor for EntityModifiedEventPayloadIdentifier
*
* @param entityType
* Event payload of identifiable entity type
* Event payload of identifiable entity type
* @param modifiedEventType
* EntityModifiedEventType
* EntityModifiedEventType
*/
public EntityModifiedEventPayloadIdentifier(final Class<? extends ProxyIdentifiableEntity> entityType,
final EntityModifiedEventType modifiedEventType) {
@@ -42,26 +41,26 @@ public class EntityModifiedEventPayloadIdentifier {
* Constructor for EntityModifiedEventPayloadIdentifier
*
* @param entityType
* Event payload of identifiable entity type
* Event payload of identifiable entity type
* @param modifiedEventType
* EntityModifiedEventType
* @param eventTypeMessageKey
* Key for event type message
* EntityModifiedEventType
* @param notificationType
* type of notification that is triggered by the event
*/
public EntityModifiedEventPayloadIdentifier(final Class<? extends ProxyIdentifiableEntity> entityType,
final EntityModifiedEventType modifiedEventType, final String eventTypeMessageKey) {
this(null, entityType, modifiedEventType, eventTypeMessageKey);
final EntityModifiedEventType modifiedEventType, final EventNotificationType notificationType) {
this(null, entityType, modifiedEventType, notificationType);
}
/**
* Constructor for EntityModifiedEventPayloadIdentifier
*
* @param parentType
* Event payload of identifiable parent type
* Event payload of identifiable parent type
* @param entityType
* Event payload of identifiable entity type
* Event payload of identifiable entity type
* @param modifiedEventType
* EntityModifiedEventType
* EntityModifiedEventType
*/
public EntityModifiedEventPayloadIdentifier(final Class<? extends ProxyIdentifiableEntity> parentType,
final Class<? extends ProxyIdentifiableEntity> entityType,
@@ -73,21 +72,21 @@ public class EntityModifiedEventPayloadIdentifier {
* Constructor for EntityModifiedEventPayloadIdentifier
*
* @param parentType
* Event payload of identifiable parent type
* Event payload of identifiable parent type
* @param entityType
* Event payload of identifiable entity type
* Event payload of identifiable entity type
* @param modifiedEventType
* EntityModifiedEventType
* @param eventTypeMessageKey
* Key for event type message
* EntityModifiedEventType
* @param notificationType
* type of notification that is triggered by the event
*/
public EntityModifiedEventPayloadIdentifier(final Class<? extends ProxyIdentifiableEntity> parentType,
final Class<? extends ProxyIdentifiableEntity> entityType, final EntityModifiedEventType modifiedEventType,
final String eventTypeMessageKey) {
final EventNotificationType notificationType) {
this.parentType = parentType;
this.entityType = entityType;
this.modifiedEventType = modifiedEventType;
this.eventTypeMessageKey = eventTypeMessageKey;
this.notificationType = notificationType;
}
/**
@@ -112,10 +111,10 @@ public class EntityModifiedEventPayloadIdentifier {
}
/**
* @return Key of event type message
* @return type of notification
*/
public String getEventTypeMessageKey() {
return eventTypeMessageKey;
public EventNotificationType getNotificationType() {
return notificationType;
}
/**
@@ -123,14 +122,14 @@ public class EntityModifiedEventPayloadIdentifier {
* <code>false</code>
*/
public boolean shouldBeDeffered() {
return !StringUtils.isEmpty(eventTypeMessageKey);
return notificationType != null;
}
/**
* Static method for constructor EntityModifiedEventPayloadIdentifier
*
* @param eventPayload
* EntityModifiedEventPayload
* EntityModifiedEventPayload
*
* @return Payload identifier containing information about an modified event
*/
@@ -141,7 +140,7 @@ public class EntityModifiedEventPayloadIdentifier {
@Override
public int hashCode() {
// eventTypeMessageKey is omitted intentionally, because it is not
// notificationType is omitted intentionally, because it is not
// relevant for event identification
return getParentType() != null
? Objects.hash(getParentType().getName(), getEntityType().getName(), modifiedEventType)
@@ -158,7 +157,7 @@ public class EntityModifiedEventPayloadIdentifier {
}
final EntityModifiedEventPayloadIdentifier other = (EntityModifiedEventPayloadIdentifier) obj;
// eventTypeMessageKey is omitted intentionally, because it is not
// notificationType is omitted intentionally, because it is not
// relevant for event identification
return Objects.equals(this.getParentType(), other.getParentType())
&& Objects.equals(this.getEntityType(), other.getEntityType())

View File

@@ -0,0 +1,43 @@
/**
* Copyright (c) 2020 Bosch.IO 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.common.event;
/**
* Types of event notification that can be displayed in the UI
*/
public enum EventNotificationType {
// Target
TARGET_CREATED("event.notifcation.target.created", "event.notifcation.targets.created"), TARGET_DELETED(
"event.notifcation.target.deleted", "event.notifcation.targets.deleted"),
// Distribution set
DISTRIBUTIONSET_CREATED("event.notifcation.distributionset.created",
"event.notifcation.distributionsets.created"), DISTRIBUTIONSET_DELETED(
"event.notifcation.distributionset.deleted", "event.notifcation.distributionsets.deleted"),
// Software module
SOFTWAREMODULE_CREATED("event.notifcation.softwaremodule.created",
"event.notifcation.softwaremodules.created"), SOFTWAREMODULE_DELETED(
"event.notifcation.softwaremodule.deleted", "event.notifcation.softwaremodules.deleted");
private final String notificationMessageKeySing;
private final String notificationMessageKeyPlur;
EventNotificationType(final String notificationMessageKeySing, final String notificationMessageKeyPlur) {
this.notificationMessageKeySing = notificationMessageKeySing;
this.notificationMessageKeyPlur = notificationMessageKeyPlur;
}
public String getNotificationMessageKeySing() {
return notificationMessageKeySing;
}
public String getNotificationMessageKeyPlur() {
return notificationMessageKeyPlur;
}
}

View File

@@ -57,8 +57,8 @@ public abstract class AbstractFilterButtons<T extends ProxyFilterButton, F> exte
final UINotification notification, final SpPermissionChecker permChecker) {
super(i18n, eventBus, permChecker);
this.filterButtonDeleteSupport = new DeleteSupport<>(this, i18n, notification, getFilterButtonsType(),
ProxyFilterButton::getName, this::deleteFilterButtons,
this.filterButtonDeleteSupport = new DeleteSupport<>(this, i18n, notification, getMessageKeyEntityTypeSing(),
getMessageKeyEntityTypePlur(), ProxyFilterButton::getName, this::deleteFilterButtons,
UIComponentIdProvider.FILTER_BUTTON_DELETE_CONFIRMATION_DIALOG);
}
@@ -75,7 +75,9 @@ public abstract class AbstractFilterButtons<T extends ProxyFilterButton, F> exte
addStyleName(ValoTheme.TABLE_COMPACT);
}
protected abstract String getFilterButtonsType();
protected abstract String getMessageKeyEntityTypeSing();
protected abstract String getMessageKeyEntityTypePlur();
protected abstract boolean deleteFilterButtons(Collection<T> filterButtonsToDelete);

View File

@@ -71,9 +71,9 @@ public abstract class AbstractDsGrid<F> extends AbstractGrid<ProxyDistributionSe
getSelectionSupport().enableMultiSelection();
}
this.distributionDeleteSupport = new DeleteSupport<>(this, i18n, notification,
i18n.getMessage("distribution.details.header"), ProxyDistributionSet::getNameVersion,
this::deleteDistributionSets, UIComponentIdProvider.DS_DELETE_CONFIRMATION_DIALOG);
this.distributionDeleteSupport = new DeleteSupport<>(this, i18n, notification, "distribution.details.header",
"caption.distributionsets", ProxyDistributionSet::getNameVersion, this::deleteDistributionSets,
UIComponentIdProvider.DS_DELETE_CONFIRMATION_DIALOG);
}
@Override

View File

@@ -38,7 +38,8 @@ public class DeleteSupport<T extends ProxyIdentifiableEntity> {
private final Grid<T> grid;
private final VaadinMessageSource i18n;
private final String entityType;
private final String localizedEntityTypeSing;
private final String localizedEntityTypePlur;
private final UINotification notification;
private final Predicate<Collection<T>> itemsDeletionCallback;
private final String deletionWindowId;
@@ -50,26 +51,30 @@ public class DeleteSupport<T extends ProxyIdentifiableEntity> {
* Constructor for DeleteSupport
*
* @param grid
* Vaadin Grid
* Vaadin Grid
* @param i18n
* VaadinMessageSource
* VaadinMessageSource
* @param notification
* UINotification
* @param entityType
* Entity type
* UINotification
* @param messageKeyEntityTypeSing
* message key for the singular entity name for i18n
* @param messageKeyEntityTypePlur
* message key for the plural entity name for i18n
* @param entityNameGenerator
* Entity name generator
* Entity name generator
* @param itemsDeletionCallback
* Callback for delete event
* Callback for delete event
* @param deletionWindowId
* Id of deletion Grid window
* Id of deletion Grid window
*/
public DeleteSupport(final Grid<T> grid, final VaadinMessageSource i18n, final UINotification notification,
final String entityType, final Function<T, String> entityNameGenerator,
final Predicate<Collection<T>> itemsDeletionCallback, final String deletionWindowId) {
final String messageKeyEntityTypeSing, final String messageKeyEntityTypePlur,
final Function<T, String> entityNameGenerator, final Predicate<Collection<T>> itemsDeletionCallback,
final String deletionWindowId) {
this.grid = grid;
this.i18n = i18n;
this.entityType = entityType;
this.localizedEntityTypeSing = i18n.getMessage(messageKeyEntityTypeSing);
this.localizedEntityTypePlur = i18n.getMessage(messageKeyEntityTypePlur);
this.entityNameGenerator = entityNameGenerator;
this.notification = notification;
this.itemsDeletionCallback = itemsDeletionCallback;
@@ -80,14 +85,15 @@ public class DeleteSupport<T extends ProxyIdentifiableEntity> {
* Open confirmation pop up window for delete action
*
* @param clickedItem
* Item selected for deletion
* Item selected for deletion
*/
public void openConfirmationWindowDeleteAction(final T clickedItem) {
final Set<T> itemsToBeDeleted = getItemsForDeletion(clickedItem);
final int itemsToBeDeletedSize = itemsToBeDeleted.size();
final String clickedItemName = entityNameGenerator.apply(clickedItem);
final String confirmationCaption = i18n.getMessage("caption.entity.delete.action.confirmbox", entityType);
final String confirmationCaption = i18n.getMessage("caption.entity.delete.action.confirmbox",
localizedEntityTypeSing);
final StringBuilder confirmationQuestionBuilder = new StringBuilder();
confirmationQuestionBuilder.append(createDeletionText(UIMessageIdProvider.MESSAGE_CONFIRM_DELETE_ENTITY,
@@ -131,9 +137,9 @@ public class DeleteSupport<T extends ProxyIdentifiableEntity> {
private String createDeletionText(final String messageId, final int itemsToBeDeletedSize,
final String clickedItemName) {
if (itemsToBeDeletedSize == 1) {
return i18n.getMessage(messageId, entityType, clickedItemName, "");
return i18n.getMessage(messageId, localizedEntityTypeSing, clickedItemName);
} else {
return i18n.getMessage(messageId, itemsToBeDeletedSize, entityType, "s");
return i18n.getMessage(messageId, itemsToBeDeletedSize, localizedEntityTypePlur);
}
}
@@ -157,7 +163,8 @@ public class DeleteSupport<T extends ProxyIdentifiableEntity> {
} catch (final RuntimeException ex) {
final String itemsToBeDeletedIds = itemsToBeDeleted.stream().map(ProxyIdentifiableEntity::getId)
.map(String::valueOf).collect(Collectors.joining(","));
LOG.warn("Deletion of {} with ids '{}' failed: {}", entityType, itemsToBeDeletedIds, ex.getMessage());
LOG.warn("Deletion of {} with ids '{}' failed: {}", localizedEntityTypeSing, itemsToBeDeletedIds,
ex.getMessage());
}
if (isDeletionSuccessfull) {
@@ -171,7 +178,7 @@ public class DeleteSupport<T extends ProxyIdentifiableEntity> {
* Sets the question to confirm the delete action
*
* @param confirmationQuestionDetailsGenerator
* Confirmation detail for delete action
* Confirmation detail for delete action
*/
public void setConfirmationQuestionDetailsGenerator(
final Function<T, String> confirmationQuestionDetailsGenerator) {

View File

@@ -55,11 +55,11 @@ public abstract class DeploymentAssignmentSupport<S extends ProxyNamedEntity, T
if (sourceItemsToAssignCount > 1) {
return i18n.getMessage(UIMessageIdProvider.MESSAGE_CONFIRM_ASSIGN_MULTIPLE_ENTITIES_TO_ENTITY,
sourceItemsToAssignCount, sourceEntityType(), targetEntityType(), targetItemName);
sourceItemsToAssignCount, sourceEntityTypePlur(), targetEntityType(), targetItemName);
}
return i18n.getMessage(UIMessageIdProvider.MESSAGE_CONFIRM_ASSIGN_MULTIPLE_ENTITIES_TO_ENTITY,
sourceEntityType(), sourceItemNames.get(0), targetEntityType(), targetItemName);
sourceEntityTypeSing(), sourceItemNames.get(0), targetEntityType(), targetItemName);
}
private ConfirmationDialog createConfirmationWindow(final String confirmationMessage, final Component content,
@@ -73,7 +73,9 @@ public abstract class DeploymentAssignmentSupport<S extends ProxyNamedEntity, T
}, content, confirmationWindowId());
}
protected abstract String sourceEntityType();
protected abstract String sourceEntityTypeSing();
protected abstract String sourceEntityTypePlur();
protected abstract String targetEntityType();

View File

@@ -41,17 +41,17 @@ public class DistributionSetsToTargetAssignmentSupport
* Constructor for DistributionSetsToTargetAssignmentSupport
*
* @param notification
* UINotification
* UINotification
* @param i18n
* VaadinMessageSource
* VaadinMessageSource
* @param systemSecurityContext
* SystemSecurityContext
* SystemSecurityContext
* @param configManagement
* TenantConfigurationManagement
* TenantConfigurationManagement
* @param permChecker
* SpPermissionChecker
* SpPermissionChecker
* @param assignmentController
* DeploymentAssignmentWindowController
* DeploymentAssignmentWindowController
*/
public DistributionSetsToTargetAssignmentSupport(final UINotification notification, final VaadinMessageSource i18n,
final SystemSecurityContext systemSecurityContext, final TenantConfigurationManagement configManagement,
@@ -98,10 +98,15 @@ public class DistributionSetsToTargetAssignmentSupport
}
@Override
protected String sourceEntityType() {
protected String sourceEntityTypeSing() {
return i18n.getMessage("distribution.details.header");
}
@Override
protected String sourceEntityTypePlur() {
return i18n.getMessage("caption.distributionsets");
}
@Override
protected String targetEntityType() {
return i18n.getMessage("caption.target");

View File

@@ -186,10 +186,15 @@ public class SwModulesToDistributionSetAssignmentSupport
}
@Override
protected String sourceEntityType() {
protected String sourceEntityTypeSing() {
return i18n.getMessage("caption.software.module");
}
@Override
protected String sourceEntityTypePlur() {
return i18n.getMessage("caption.softwaremodules");
}
@Override
protected String targetEntityType() {
return i18n.getMessage("distribution.details.header");

View File

@@ -36,13 +36,13 @@ public class TargetsToDistributionSetAssignmentSupport
* Constructor for TargetsToDistributionSetAssignmentSupport
*
* @param notification
* UINotification
* UINotification
* @param i18n
* VaadinMessageSource
* VaadinMessageSource
* @param permChecker
* SpPermissionChecker
* SpPermissionChecker
* @param assignmentController
* DeploymentAssignmentWindowController
* DeploymentAssignmentWindowController
*/
public TargetsToDistributionSetAssignmentSupport(final UINotification notification, final VaadinMessageSource i18n,
final SpPermissionChecker permChecker, final DeploymentAssignmentWindowController assignmentController) {
@@ -75,10 +75,15 @@ public class TargetsToDistributionSetAssignmentSupport
}
@Override
protected String sourceEntityType() {
protected String sourceEntityTypeSing() {
return i18n.getMessage("caption.target");
}
@Override
protected String sourceEntityTypePlur() {
return i18n.getMessage("caption.targets");
}
@Override
protected String targetEntityType() {
return i18n.getMessage("distribution.details.header");

View File

@@ -13,6 +13,7 @@ import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import org.eclipse.hawkbit.ui.common.event.EntityModifiedEventPayload;
import org.eclipse.hawkbit.ui.common.event.EventNotificationType;
import org.eclipse.hawkbit.ui.common.event.EventTopics;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
@@ -51,7 +52,7 @@ public class NotificationUnreadButton extends Button {
private int unreadNotificationCounter;
private Window notificationsWindow;
private final transient Map<String, EntityModifiedEventPayload> remotelyOriginatedEventsStore;
private final transient Map<EventNotificationType, EntityModifiedEventPayload> remotelyOriginatedEventsStore;
/**
* Constructor.
@@ -142,15 +143,18 @@ public class NotificationUnreadButton extends Button {
return notificationsLayout;
}
private Label buildEventNotificationLabel(final Entry<String, EntityModifiedEventPayload> remotelyOriginatedEvent) {
private Label buildEventNotificationLabel(
final Entry<EventNotificationType, EntityModifiedEventPayload> remotelyOriginatedEvent) {
final EventNotificationType notificationType = remotelyOriginatedEvent.getKey();
final int modifiedEntitiesCount = remotelyOriginatedEvent.getValue().getEntityIds().size();
final StringBuilder notificationLabelBuilder = new StringBuilder(String.valueOf(modifiedEntitiesCount));
notificationLabelBuilder.append(" ");
final String pluralPrefix = modifiedEntitiesCount > 1 ? "s" : "";
notificationLabelBuilder.append(i18n.getMessage(remotelyOriginatedEvent.getKey(), pluralPrefix));
return new Label(notificationLabelBuilder.toString());
String message = "";
if (modifiedEntitiesCount == 1) {
message = i18n.getMessage(notificationType.getNotificationMessageKeySing());
} else {
message = i18n.getMessage(notificationType.getNotificationMessageKeyPlur(),
String.valueOf(modifiedEntitiesCount));
}
return new Label(message);
}
private void dispatchEntityModifiedEvents() {
@@ -167,21 +171,20 @@ public class NotificationUnreadButton extends Button {
/**
* Increments the unread notifications
*
* @param entityNotificationMsgKey
* Key value for notification message
* @param notificationType
* notification type for message
* @param eventPayload
* EntityModifiedEventPayload
* EntityModifiedEventPayload
*/
public void incrementUnreadNotification(final String entityNotificationMsgKey,
public void incrementUnreadNotification(final EventNotificationType notificationType,
final EntityModifiedEventPayload eventPayload) {
remotelyOriginatedEventsStore.merge(entityNotificationMsgKey, eventPayload,
(oldEventPayload, newEventPayload) -> {
// currently we do not support parent aware differed events,
// thus ignoring parentId of the incoming eventPayload
oldEventPayload.getEntityIds().addAll(newEventPayload.getEntityIds());
remotelyOriginatedEventsStore.merge(notificationType, eventPayload, (oldEventPayload, newEventPayload) -> {
// currently we do not support parent aware differed events,
// thus ignoring parentId of the incoming eventPayload
oldEventPayload.getEntityIds().addAll(newEventPayload.getEntityIds());
return oldEventPayload;
});
return oldEventPayload;
});
unreadNotificationCounter += eventPayload.getEntityIds().size();
refreshCaption();

View File

@@ -34,8 +34,6 @@ import com.vaadin.ui.Window;
public class DSTypeFilterButtons extends AbstractTypeFilterButtons {
private static final long serialVersionUID = 1L;
private static final String DS_SET_TYPE = "Distribution set Type";
private final transient DistributionSetTypeManagement distributionSetTypeManagement;
private final transient DsTypeWindowBuilder dsTypeWindowBuilder;
private final transient SystemManagement systemManagement;
@@ -81,8 +79,13 @@ public class DSTypeFilterButtons extends AbstractTypeFilterButtons {
}
@Override
protected String getFilterButtonsType() {
return DS_SET_TYPE;
protected String getMessageKeyEntityTypeSing() {
return "caption.entity.distribution.type";
}
@Override
protected String getMessageKeyEntityTypePlur() {
return "caption.entity.distribution.types";
}
@Override

View File

@@ -99,9 +99,9 @@ public class TargetFilterGrid extends AbstractGrid<ProxyTargetFilterQuery, Strin
this.targetFilterQueryManagement = targetFilterQueryManagement;
this.autoAssignmentWindowBuilder = autoAssignmentWindowBuilder;
this.targetFilterDeleteSupport = new DeleteSupport<>(this, i18n, notification,
i18n.getMessage("caption.filter.custom"), ProxyTargetFilterQuery::getName,
this::targetFiltersDeletionCallback, UIComponentIdProvider.TARGET_FILTER_DELETE_CONFIRMATION_DIALOG);
this.targetFilterDeleteSupport = new DeleteSupport<>(this, i18n, notification, "caption.filter.custom",
"caption.filter.custom.plur", ProxyTargetFilterQuery::getName, this::targetFiltersDeletionCallback,
UIComponentIdProvider.TARGET_FILTER_DELETE_CONFIRMATION_DIALOG);
setFilterSupport(new FilterSupport<>(new TargetFilterQueryDataProvider(targetFilterQueryManagement,
new TargetFilterQueryToProxyTargetFilterMapper())));

View File

@@ -124,7 +124,7 @@ public class ActionHistoryGrid extends AbstractGrid<ProxyAction, String> {
* Map entity id to proxy entity
*
* @param entityId
* Entity id
* Entity id
*
* @return Proxy action
*/
@@ -290,7 +290,7 @@ public class ActionHistoryGrid extends AbstractGrid<ProxyAction, String> {
*/
private void confirmAndForceAction(final Long actionId) {
final ConfirmationDialog confirmDialog = new ConfirmationDialog(i18n,
i18n.getMessage(UIMessageIdProvider.BUTTON_OK), i18n.getMessage(UIMessageIdProvider.BUTTON_CANCEL),
i18n.getMessage("caption.force.action.confirmbox"), i18n.getMessage("message.force.action.confirm"),
ok -> {
if (ok) {
forceActiveAction(actionId);

View File

@@ -46,21 +46,21 @@ public class DistributionTagButtons extends AbstractTagFilterButtons {
* Constructor for DistributionTagButtons
*
* @param eventBus
* UIEventBus
* UIEventBus
* @param i18n
* VaadinMessageSource
* VaadinMessageSource
* @param uiNotification
* UINotification
* UINotification
* @param permChecker
* SpPermissionChecker
* SpPermissionChecker
* @param distributionSetTagManagement
* DistributionSetTagManagement
* DistributionSetTagManagement
* @param distributionSetManagement
* DistributionSetManagement
* DistributionSetManagement
* @param dsTagWindowBuilder
* DsTagWindowBuilder
* DsTagWindowBuilder
* @param distributionTagLayoutUiState
* TagFilterLayoutUiState
* TagFilterLayoutUiState
*/
public DistributionTagButtons(final UIEventBus eventBus, final VaadinMessageSource i18n,
final UINotification uiNotification, final SpPermissionChecker permChecker,
@@ -91,8 +91,13 @@ public class DistributionTagButtons extends AbstractTagFilterButtons {
}
@Override
protected String getFilterButtonsType() {
return i18n.getMessage(UIMessageIdProvider.CAPTION_DISTRIBUTION_TAG);
protected String getMessageKeyEntityTypeSing() {
return UIMessageIdProvider.CAPTION_DISTRIBUTION_TAG;
}
@Override
protected String getMessageKeyEntityTypePlur() {
return "caption.entity.distribution.tags";
}
@Override

View File

@@ -147,8 +147,8 @@ public class TargetGrid extends AbstractGrid<ProxyTarget, TargetManagementFilter
getSelectionSupport().enableMultiSelection();
}
this.targetDeleteSupport = new DeleteSupport<>(this, i18n, notification,
i18n.getMessage("target.details.header"), ProxyTarget::getName, this::deleteTargets,
this.targetDeleteSupport = new DeleteSupport<>(this, i18n, notification, "target.details.header",
"caption.targets", ProxyTarget::getName, this::deleteTargets,
UIComponentIdProvider.TARGET_DELETE_CONFIRMATION_DIALOG);
this.pinSupport = new PinSupport<>(this::refreshItem, this::publishPinningChangedEvent,

View File

@@ -67,8 +67,13 @@ public class TargetTagFilterButtons extends AbstractTagFilterButtons {
}
@Override
protected String getFilterButtonsType() {
return i18n.getMessage(UIMessageIdProvider.CAPTION_TARGET_TAG);
protected String getMessageKeyEntityTypeSing() {
return UIMessageIdProvider.CAPTION_TARGET_TAG;
}
@Override
protected String getMessageKeyEntityTypePlur() {
return "caption.entity.target.tags";
}
@Override

View File

@@ -48,6 +48,7 @@ import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTargetFilterQuery;
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyType;
import org.eclipse.hawkbit.ui.common.event.EntityModifiedEventPayload.EntityModifiedEventType;
import org.eclipse.hawkbit.ui.common.event.EntityModifiedEventPayloadIdentifier;
import org.eclipse.hawkbit.ui.common.event.EventNotificationType;
import org.eclipse.hawkbit.ui.push.event.ActionChangedEvent;
import org.eclipse.hawkbit.ui.push.event.RolloutChangedEvent;
import org.eclipse.hawkbit.ui.push.event.RolloutGroupChangedEvent;
@@ -64,29 +65,27 @@ public class HawkbitEventProvider implements UIEventProvider {
static {
EVENTS.put(TargetCreatedEvent.class, new EntityModifiedEventPayloadIdentifier(ProxyTarget.class,
EntityModifiedEventType.ENTITY_ADDED, "target.created.event.container.notifcation.message"));
EntityModifiedEventType.ENTITY_ADDED, EventNotificationType.TARGET_CREATED));
EVENTS.put(TargetUpdatedEvent.class,
new EntityModifiedEventPayloadIdentifier(ProxyTarget.class, EntityModifiedEventType.ENTITY_UPDATED));
EVENTS.put(TargetDeletedEvent.class, new EntityModifiedEventPayloadIdentifier(ProxyTarget.class,
EntityModifiedEventType.ENTITY_REMOVED, "target.deleted.event.container.notifcation.message"));
EntityModifiedEventType.ENTITY_REMOVED, EventNotificationType.TARGET_DELETED));
EVENTS.put(DistributionSetCreatedEvent.class,
new EntityModifiedEventPayloadIdentifier(ProxyDistributionSet.class,
EntityModifiedEventType.ENTITY_ADDED,
"distribution.created.event.container.notifcation.message"));
EntityModifiedEventType.ENTITY_ADDED, EventNotificationType.DISTRIBUTIONSET_CREATED));
EVENTS.put(DistributionSetUpdatedEvent.class, new EntityModifiedEventPayloadIdentifier(
ProxyDistributionSet.class, EntityModifiedEventType.ENTITY_UPDATED));
EVENTS.put(DistributionSetDeletedEvent.class,
new EntityModifiedEventPayloadIdentifier(ProxyDistributionSet.class,
EntityModifiedEventType.ENTITY_REMOVED,
"distribution.deleted.event.container.notifcation.message"));
EntityModifiedEventType.ENTITY_REMOVED, EventNotificationType.DISTRIBUTIONSET_DELETED));
EVENTS.put(SoftwareModuleCreatedEvent.class, new EntityModifiedEventPayloadIdentifier(ProxySoftwareModule.class,
EntityModifiedEventType.ENTITY_ADDED, "software.module.created.event.container.notifcation.message"));
EntityModifiedEventType.ENTITY_ADDED, EventNotificationType.SOFTWAREMODULE_CREATED));
EVENTS.put(SoftwareModuleUpdatedEvent.class, new EntityModifiedEventPayloadIdentifier(ProxySoftwareModule.class,
EntityModifiedEventType.ENTITY_UPDATED));
EVENTS.put(SoftwareModuleDeletedEvent.class, new EntityModifiedEventPayloadIdentifier(ProxySoftwareModule.class,
EntityModifiedEventType.ENTITY_REMOVED, "software.module.deleted.event.container.notifcation.message"));
EntityModifiedEventType.ENTITY_REMOVED, EventNotificationType.SOFTWAREMODULE_DELETED));
EVENTS.put(TargetTagCreatedEvent.class, new EntityModifiedEventPayloadIdentifier(ProxyTarget.class,
ProxyTag.class, EntityModifiedEventType.ENTITY_ADDED));

View File

@@ -127,8 +127,8 @@ public class RolloutGrid extends AbstractGrid<ProxyRollout, String> {
this::mapIdToProxyEntity, this::getSelectedEntityIdFromUiState, this::setSelectedEntityIdToUiState));
getSelectionSupport().disableSelection();
this.rolloutDeleteSupport = new DeleteSupport<>(this, i18n, uiNotification,
i18n.getMessage(ROLLOUT_CAPTION_MSG_KEY), ProxyRollout::getName, this::deleteRollout,
this.rolloutDeleteSupport = new DeleteSupport<>(this, i18n, uiNotification, ROLLOUT_CAPTION_MSG_KEY,
"caption.rollouts", ProxyRollout::getName, this::deleteRollout,
UIComponentIdProvider.ROLLOUT_DELETE_CONFIRMATION_DIALOG);
this.rolloutDeleteSupport.setConfirmationQuestionDetailsGenerator(this::getDeletionDetails);

View File

@@ -83,18 +83,18 @@ header.action.delete=Delete
header.status=Status
# event container
target.created.event.container.notifcation.message=target{0} created
target.deleted.event.container.notifcation.message=target{0} deleted
distribution.created.event.container.notifcation.message=distribution set{0} created
distribution.deleted.event.container.notifcation.message=distribution set{0} deleted
target.tag.created.event.container.notifcation.message=target tag{0} created
target.tag.deleted.event.container.notifcation.message=target tag{0} deleted
target.tag.updated.event.container.notifcation.message=target tag{0} changed
software.module.created.event.container.notifcation.message=software module{0} created
software.module.deleted.event.container.notifcation.message=software module{0} deleted
distribution.set.tag.created.event.container.notifcation.message=distribution set tag{0} created
distribution.set.tag.deleted.event.container.notifcation.message=distribution set tag{0} deleted
distribution.set.tag.updated.event.container.notifcation.message=distribution set tag{0} changed
event.notifcation.target.created = 1 target created
event.notifcation.target.deleted = 1 target deleted
event.notifcation.targets.created = {0} targets created
event.notifcation.targets.deleted = {0} targets deleted
event.notifcation.distributionset.created = 1 distribution set created
event.notifcation.distributionset.deleted = 1 distribution set deleted
event.notifcation.distributionsets.created = {0} distribution sets created
event.notifcation.distributionsets.deleted = {0} distribution sets deleted
event.notifcation.softwaremodule.created = 1 software module created
event.notifcation.softwaremodule.deleted = 1 software module deleted
event.notifcation.softwaremodules.created = {0} software modules created
event.notifcation.softwaremodules.deleted = {0} software modules deleted
# Captions prefix with - caption
caption.filter.by.type = Filter by type
@@ -371,8 +371,8 @@ tooltip.in.time = In Time
message.save.success = {0} saved successfully
message.save.fail = {0} could not be saved, possibly due to invalid user input
message.update.success = {0} updated successfully
message.delete.success = {0} {1}{2} deleted successfully
message.delete.fail = {0} {1}{2} deletion failed
message.delete.success = {0} {1} deleted successfully
message.delete.fail = {0} {1} deletion failed
message.dist.pending.action = Target {0} is already assigned with distribution {1} . Pending for action
message.empty.target.tags= No Tags Created
message.empty.disttype.tags = No Distribution type tags created
@@ -767,16 +767,27 @@ rollout.not.exists=Rollout {0} does not exist. Maybe the rollout was deleted.
color.not.exists=There is no mapping for the provided colour {0}
caption.entity.target.tag = Target Tag
caption.entity.target.tags = Target Tags
caption.entity.distribution.tag = Distribution Tag
caption.entity.distribution.tags = Distribution Tags
caption.entity.distribution.type = Distribution set Type
caption.entity.distribution.types = Distribution set Types
caption.entity.software.module.type = Software Module Type
caption.entity.software.module.types = Software Module Types
validator.textfield.min.length = Please enter a text consisting of at least one and a maximum of {0} characters.
caption.entity.delete.action.confirmbox = Confirm Deletion
message.confirm.delete.entity = Are you sure you want to delete {0} {1}{2}?
message.confirm.delete.entity = Are you sure you want to delete {0} {1}?
caption.entity.assign.action.confirmbox = Confirm Assignment
message.confirm.assign.multiple.entities.to.entity = Are you sure you want to assign {0} {1} to {2} {3}?
caption.distributionsets = Distribution sets
caption.softwaremodules = Software Modules
caption.targets = Targets
caption.artifacts = Artifacts
caption.metadata.plur = Metadata
caption.rollouts = Rollouts
caption.filter.custom.plur = Custom Filters
# character descriptions
character.whitespace = whitespace