Feature horizontal scalability (#305)
Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
committed by
Kai Zimmermann
parent
07cb62a3dd
commit
866bc72114
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.Event;
|
||||
import org.eclipse.hawkbit.repository.event.TenantAwareEvent;
|
||||
import org.springframework.security.core.context.SecurityContext;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
@@ -28,7 +28,7 @@ import com.vaadin.util.CurrentInstance;
|
||||
public class DispatcherRunnable implements Runnable {
|
||||
|
||||
private final SecurityContext userContext;
|
||||
private final Event event;
|
||||
private final TenantAwareEvent event;
|
||||
private final VaadinSession session;
|
||||
private final EventBus eventBus;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class DispatcherRunnable implements Runnable {
|
||||
* the event which is distributed to the UI.
|
||||
*/
|
||||
public DispatcherRunnable(final EventBus eventBus, final VaadinSession session, final SecurityContext userContext,
|
||||
final Event event) {
|
||||
final TenantAwareEvent event) {
|
||||
this.eventBus = eventBus;
|
||||
this.session = session;
|
||||
this.userContext = userContext;
|
||||
|
||||
@@ -61,6 +61,8 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
|
||||
|
||||
private transient EventPushStrategy pushStrategy;
|
||||
|
||||
protected transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private SpringViewProvider viewProvider;
|
||||
|
||||
@@ -78,23 +80,23 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
|
||||
@Autowired
|
||||
private ErrorView errorview;
|
||||
|
||||
@Autowired
|
||||
protected transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public HawkbitUI() {
|
||||
// is empty, is ok.
|
||||
@Autowired
|
||||
public HawkbitUI(final EventBus.SessionEventBus eventBus) {
|
||||
this.eventBus = eventBus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor taking the push strategy.
|
||||
*
|
||||
*
|
||||
* @param pushStrategy
|
||||
* the strategy to push events from the backend to the UI
|
||||
*/
|
||||
public HawkbitUI(final EventPushStrategy pushStrategy) {
|
||||
@Autowired
|
||||
public HawkbitUI(final EventPushStrategy pushStrategy, final EventBus.SessionEventBus eventBus) {
|
||||
this(eventBus);
|
||||
this.pushStrategy = pushStrategy;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
package org.eclipse.hawkbit.ui.artifacts.event;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEvent;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseUIEntityEvent;
|
||||
|
||||
/**
|
||||
* Event to represent software add, update or delete.
|
||||
* TenantAwareEvent to represent software add, update or delete.
|
||||
*
|
||||
*/
|
||||
public class SoftwareModuleEvent extends BaseEntityEvent<SoftwareModule> {
|
||||
public class SoftwareModuleEvent extends BaseUIEntityEvent<SoftwareModule> {
|
||||
|
||||
/**
|
||||
* Software module events in the Upload UI.
|
||||
|
||||
@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.ui.artifacts.event;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
|
||||
/**
|
||||
* Event to represent software module type add, update or delete.
|
||||
* TenantAwareEvent to represent software module type add, update or delete.
|
||||
*/
|
||||
public class SoftwareModuleTypeEvent {
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
package org.eclipse.hawkbit.ui.artifacts.event;
|
||||
|
||||
/**
|
||||
* Event generated in Upload artifact UI.
|
||||
* TenantAwareEvent generated in Upload artifact UI.
|
||||
*
|
||||
*
|
||||
*
|
||||
|
||||
@@ -21,7 +21,7 @@ public class UploadFileStatus implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -3599629192216760811L;
|
||||
|
||||
private String fileName;
|
||||
private final String fileName;
|
||||
|
||||
private long contentLength;
|
||||
|
||||
@@ -30,19 +30,48 @@ public class UploadFileStatus implements Serializable {
|
||||
private String failureReason;
|
||||
|
||||
private SoftwareModule softwareModule;
|
||||
|
||||
public UploadFileStatus(String fileName) {
|
||||
|
||||
/**
|
||||
* constructor for UploadFileStatus
|
||||
*
|
||||
* @param fileName
|
||||
* name of the file to be uploaded
|
||||
*/
|
||||
public UploadFileStatus(final String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public UploadFileStatus(String fileName, long bytesRead, long contentLength,SoftwareModule softwareModule) {
|
||||
/**
|
||||
* constructor for UploadFileStatus
|
||||
*
|
||||
* @param fileName
|
||||
* name of the file to be uploaded
|
||||
* @param bytesRead
|
||||
* number of bytes
|
||||
* @param contentLength
|
||||
* length of the content (stream)
|
||||
* @param softwareModule
|
||||
* softwareModule
|
||||
*/
|
||||
public UploadFileStatus(final String fileName, final long bytesRead, final long contentLength,
|
||||
final SoftwareModule softwareModule) {
|
||||
this.fileName = fileName;
|
||||
this.contentLength = contentLength;
|
||||
this.bytesRead = bytesRead;
|
||||
this.softwareModule = softwareModule;
|
||||
}
|
||||
|
||||
public UploadFileStatus(String fileName, String failureReason,SoftwareModule selectedSw) {
|
||||
/**
|
||||
* constructor for UploadFileStatus
|
||||
*
|
||||
* @param fileName
|
||||
* name of the file to be uploaded
|
||||
* @param failureReason
|
||||
* reason of failure
|
||||
* @param selectedSw
|
||||
* the selected softwareModule
|
||||
*/
|
||||
public UploadFileStatus(final String fileName, final String failureReason, final SoftwareModule selectedSw) {
|
||||
this.failureReason = failureReason;
|
||||
this.fileName = fileName;
|
||||
this.softwareModule = selectedSw;
|
||||
@@ -63,7 +92,7 @@ public class UploadFileStatus implements Serializable {
|
||||
public String getFailureReason() {
|
||||
return failureReason;
|
||||
}
|
||||
|
||||
|
||||
public SoftwareModule getSoftwareModule() {
|
||||
return softwareModule;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ package org.eclipse.hawkbit.ui.artifacts.event;
|
||||
public class UploadStatusEvent {
|
||||
|
||||
/**
|
||||
* Event type definition of events during the artifact upload life-cycle
|
||||
* TenantAwareEvent type definition of events during the artifact upload life-cycle
|
||||
* from receiving the upload until the process end.
|
||||
*/
|
||||
public enum UploadStatusEventType {
|
||||
|
||||
@@ -94,7 +94,7 @@ public class UploadConfirmationWindow implements Button.ClickListener {
|
||||
|
||||
private final I18N i18n;
|
||||
|
||||
private Window uploadConfrimationWindow;
|
||||
private Window window;
|
||||
|
||||
private Button uploadBtn;
|
||||
|
||||
@@ -133,7 +133,7 @@ public class UploadConfirmationWindow implements Button.ClickListener {
|
||||
buildLayout();
|
||||
}
|
||||
|
||||
private Boolean checkIfArtifactDetailsDispalyed(final Long bSoftwareModuleId) {
|
||||
private Boolean checkIfArtifactDetailsDisplayed(final Long bSoftwareModuleId) {
|
||||
if (artifactUploadState.getSelectedBaseSoftwareModule().isPresent()
|
||||
&& artifactUploadState.getSelectedBaseSoftwareModule().get().getId().equals(bSoftwareModuleId)) {
|
||||
return true;
|
||||
@@ -503,15 +503,15 @@ public class UploadConfirmationWindow implements Button.ClickListener {
|
||||
uploadArtifactDetails.addComponent(footer);
|
||||
uploadArtifactDetails.setComponentAlignment(footer, Alignment.MIDDLE_CENTER);
|
||||
|
||||
uploadConfrimationWindow = new Window();
|
||||
uploadConfrimationWindow.setContent(uploadArtifactDetails);
|
||||
uploadConfrimationWindow.setResizable(Boolean.FALSE);
|
||||
uploadConfrimationWindow.setClosable(Boolean.TRUE);
|
||||
uploadConfrimationWindow.setDraggable(Boolean.TRUE);
|
||||
uploadConfrimationWindow.setModal(true);
|
||||
uploadConfrimationWindow.addCloseListener(event -> onPopupClose());
|
||||
uploadConfrimationWindow.setCaption(i18n.get("header.caption.upload.details"));
|
||||
uploadConfrimationWindow.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);
|
||||
window = new Window();
|
||||
window.setContent(uploadArtifactDetails);
|
||||
window.setResizable(Boolean.FALSE);
|
||||
window.setClosable(Boolean.TRUE);
|
||||
window.setDraggable(Boolean.TRUE);
|
||||
window.setModal(true);
|
||||
window.addCloseListener(event -> onPopupClose());
|
||||
window.setCaption(i18n.get("header.caption.upload.details"));
|
||||
window.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);
|
||||
}
|
||||
|
||||
private void onPopupClose() {
|
||||
@@ -531,16 +531,16 @@ public class UploadConfirmationWindow implements Button.ClickListener {
|
||||
}
|
||||
|
||||
public Window getUploadConfrimationWindow() {
|
||||
return uploadConfrimationWindow;
|
||||
return window;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buttonClick(final ClickEvent event) {
|
||||
if (event.getComponent().getId().equals(UIComponentIdProvider.UPLOAD_ARTIFACT_DETAILS_CLOSE)) {
|
||||
uploadConfrimationWindow.close();
|
||||
window.close();
|
||||
} else if (event.getComponent().getId().equals(UIComponentIdProvider.UPLOAD_DISCARD_DETAILS_BUTTON)) {
|
||||
uploadLayout.clearUploadedFileDetails();
|
||||
uploadConfrimationWindow.close();
|
||||
window.close();
|
||||
} else if (event.getComponent().getId().equals(UIComponentIdProvider.UPLOAD_BUTTON)) {
|
||||
processArtifactUpload();
|
||||
} else if (event.getComponent().getId().startsWith(UIComponentIdProvider.UPLOAD_DELETE_ICON)) {
|
||||
@@ -563,7 +563,7 @@ public class UploadConfirmationWindow implements Button.ClickListener {
|
||||
uploadLayout.getFileSelected().remove(customFile);
|
||||
uploadLayout.updateUploadCounts();
|
||||
if (uploadDetailsTable.getItemIds().isEmpty()) {
|
||||
uploadConfrimationWindow.close();
|
||||
window.close();
|
||||
uploadLayout.clearUploadedFileDetails();
|
||||
}
|
||||
|
||||
@@ -593,14 +593,14 @@ public class UploadConfirmationWindow implements Button.ClickListener {
|
||||
createArtifact(itemId, customFile.getFilePath(), artifactManagement, bSoftwareModule);
|
||||
}
|
||||
}
|
||||
refreshArtifactDetailsLayout = checkIfArtifactDetailsDispalyed(bSoftwareModule.getId());
|
||||
refreshArtifactDetailsLayout = checkIfArtifactDetailsDisplayed(bSoftwareModule.getId());
|
||||
}
|
||||
|
||||
if (refreshArtifactDetailsLayout) {
|
||||
uploadLayout.refreshArtifactDetailsLayout(artifactUploadState.getSelectedBaseSoftwareModule().get());
|
||||
}
|
||||
uploadLayout.clearFileList();
|
||||
uploadConfrimationWindow.close();
|
||||
window.close();
|
||||
// call upload result window
|
||||
currentUploadResultWindow = new UploadResultWindow(uploadResultList, i18n);
|
||||
UI.getCurrent().addWindow(currentUploadResultWindow.getUploadResultsWindow());
|
||||
|
||||
@@ -56,7 +56,7 @@ public abstract class AbstractAcceptCriteria extends ServerSideCriterion {
|
||||
return true;
|
||||
} else {
|
||||
// Display action not allowed notification for invalid drop
|
||||
/* mouse event will be Event.ONMOUSEUP on drop */
|
||||
/* mouse event will be TenantAwareEvent.ONMOUSEUP on drop */
|
||||
// From com.google.gwt.user.client.Event
|
||||
if (typeVal == 8) {
|
||||
invalidDrop();
|
||||
@@ -82,7 +82,7 @@ public abstract class AbstractAcceptCriteria extends ServerSideCriterion {
|
||||
|
||||
private void showHideDropAreaHighlights(final int typeVal, final Component compsource,
|
||||
final DragAndDropEvent dragEvent) {
|
||||
/* mouse event will be Event.ONMOUSEUP on drop */
|
||||
/* mouse event will be TenantAwareEvent.ONMOUSEUP on drop */
|
||||
// From com.google.gwt.user.client.Event
|
||||
if (typeVal == 8) {
|
||||
hideDropHints();
|
||||
|
||||
@@ -120,7 +120,7 @@ public class ConfirmationDialog implements Button.ClickListener {
|
||||
}
|
||||
|
||||
/**
|
||||
* Event handler for button clicks.
|
||||
* TenantAwareEvent handler for button clicks.
|
||||
*
|
||||
* @param event
|
||||
* the click event.
|
||||
|
||||
@@ -18,8 +18,8 @@ import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEvent;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseUIEntityEvent;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
@@ -117,7 +117,7 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
|
||||
* @param baseEntityEvent
|
||||
* the event
|
||||
*/
|
||||
protected void onBaseEntityEvent(final BaseEntityEvent<T> baseEntityEvent) {
|
||||
protected void onBaseEntityEvent(final BaseUIEntityEvent<T> baseEntityEvent) {
|
||||
final BaseEntityEventType eventType = baseEntityEvent.getEventType();
|
||||
if (BaseEntityEventType.SELECTED_ENTITY == eventType || BaseEntityEventType.UPDATED_ENTITY == eventType) {
|
||||
UI.getCurrent().access(() -> populateData(baseEntityEvent.getEntity()));
|
||||
|
||||
@@ -247,7 +247,7 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table {
|
||||
|
||||
}
|
||||
|
||||
protected void onBaseEntityEvent(final BaseEntityEvent<E> event) {
|
||||
protected void onBaseEntityEvent(final BaseUIEntityEvent<E> event) {
|
||||
if (BaseEntityEventType.MINIMIZED == event.getEventType()) {
|
||||
UI.getCurrent().access(() -> applyMinTableSettings());
|
||||
} else if (BaseEntityEventType.MAXIMIZED == event.getEventType()) {
|
||||
|
||||
@@ -11,10 +11,10 @@ package org.eclipse.hawkbit.ui.common.table;
|
||||
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
|
||||
/**
|
||||
* Event to represent add, update or delete.
|
||||
* TenantAwareEvent to represent add, update or delete.
|
||||
*
|
||||
*/
|
||||
public class BaseEntityEvent<T extends BaseEntity> {
|
||||
public class BaseUIEntityEvent<T extends BaseEntity> {
|
||||
|
||||
private final BaseEntityEventType eventType;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class BaseEntityEvent<T extends BaseEntity> {
|
||||
* @param entity
|
||||
* the entity reference
|
||||
*/
|
||||
public BaseEntityEvent(final BaseEntityEventType eventType, final T entity) {
|
||||
public BaseUIEntityEvent(final BaseEntityEventType eventType, final T entity) {
|
||||
this.eventType = eventType;
|
||||
this.entity = entity;
|
||||
}
|
||||
@@ -11,7 +11,6 @@ package org.eclipse.hawkbit.ui.common.tagdetails;
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
@@ -19,8 +18,8 @@ import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEvent;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseUIEntityEvent;
|
||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
@@ -98,7 +97,7 @@ public abstract class AbstractTagToken<T extends BaseEntity> implements Serializ
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
protected void onBaseEntityEvent(final BaseEntityEvent<T> baseEntityEvent) {
|
||||
protected void onBaseEntityEvent(final BaseUIEntityEvent<T> baseEntityEvent) {
|
||||
if (BaseEntityEventType.SELECTED_ENTITY != baseEntityEvent.getEventType()) {
|
||||
return;
|
||||
}
|
||||
@@ -260,13 +259,10 @@ public abstract class AbstractTagToken<T extends BaseEntity> implements Serializ
|
||||
tokensAdded.keySet().forEach(previouslyAddedToken -> tokenField.removeToken(previouslyAddedToken));
|
||||
}
|
||||
|
||||
protected Long getTagIdByTagName(final String tagName) {
|
||||
final Optional<Map.Entry<Long, TagData>> mapEntry = tagDetails.entrySet().stream()
|
||||
.filter(entry -> entry.getValue().getName().equals(tagName)).findFirst();
|
||||
if (mapEntry.isPresent()) {
|
||||
return mapEntry.get().getKey();
|
||||
}
|
||||
return null;
|
||||
protected Long getTagIdByTagName(final Long tagId) {
|
||||
return tagDetails.entrySet().stream().filter(entry -> entry.getValue().getId().equals(tagId)).findFirst()
|
||||
.map(entry -> entry.getKey()).orElse(null);
|
||||
|
||||
}
|
||||
|
||||
protected void removeTokenItem(final Long tokenId, final String name) {
|
||||
|
||||
@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.ui.common.tagdetails;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.TagManagement;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.TargetTagUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetTagUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
import org.eclipse.hawkbit.ui.push.TargetTagCreatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.TargetTagDeletedEventContainer;
|
||||
@@ -42,7 +42,7 @@ public abstract class AbstractTargetTagToken<T extends BaseEntity> extends Abstr
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onTargetTagDeletedEvent(final TargetTagDeletedEventContainer container) {
|
||||
container.getEvents().stream().map(event -> getTagIdByTagName(event.getEntity().getName()))
|
||||
container.getEvents().stream().map(event -> getTagIdByTagName(event.getEntityId()))
|
||||
.forEach(this::removeTagFromCombo);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
|
||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||
import org.eclipse.hawkbit.ui.push.DistributionSetTagAssignmentResultEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.DistributionSetTagCreatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.DistributionSetTagDeletedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.DistributionSetTagUpdatedEventContainer;
|
||||
@@ -75,6 +74,7 @@ public class DistributionTagToken extends AbstractTagToken<DistributionSet> {
|
||||
private DistributionSetTagAssignmentResult toggleAssignment(final String tagNameSelected) {
|
||||
final DistributionSetTagAssignmentResult result = distributionSetManagement
|
||||
.toggleTagAssignment(Sets.newHashSet(selectedEntity.getId()), tagNameSelected);
|
||||
processTargetTagAssigmentResult(result);
|
||||
uinotification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(tagNameSelected, result, i18n));
|
||||
return result;
|
||||
}
|
||||
@@ -125,7 +125,7 @@ public class DistributionTagToken extends AbstractTagToken<DistributionSet> {
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onDistributionSetTagDeletedEvent(final DistributionSetTagDeletedEventContainer eventContainer) {
|
||||
eventContainer.getEvents().stream().map(event -> getTagIdByTagName(event.getEntity().getName()))
|
||||
eventContainer.getEvents().stream().map(event -> getTagIdByTagName(event.getEntityId()))
|
||||
.forEach(this::removeTagFromCombo);
|
||||
}
|
||||
|
||||
@@ -139,16 +139,13 @@ public class DistributionTagToken extends AbstractTagToken<DistributionSet> {
|
||||
});
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onTargetTagAssigmentResultEvent(final DistributionSetTagAssignmentResultEventContainer eventContainer) {
|
||||
eventContainer.getEvents().stream().map(event -> event.getAssigmentResult()).forEach(assignmentResult -> {
|
||||
final DistributionSetTag tag = assignmentResult.getDistributionSetTag();
|
||||
if (isAssign(assignmentResult)) {
|
||||
addNewToken(tag.getId());
|
||||
} else if (isUnassign(assignmentResult)) {
|
||||
removeTokenItem(tag.getId(), tag.getName());
|
||||
}
|
||||
});
|
||||
private void processTargetTagAssigmentResult(final DistributionSetTagAssignmentResult assignmentResult) {
|
||||
final DistributionSetTag tag = assignmentResult.getDistributionSetTag();
|
||||
if (isAssign(assignmentResult)) {
|
||||
addNewToken(tag.getId());
|
||||
} else if (isUnassign(assignmentResult)) {
|
||||
removeTokenItem(tag.getId(), tag.getName());
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isAssign(final DistributionSetTagAssignmentResult assignmentResult) {
|
||||
|
||||
@@ -17,7 +17,6 @@ import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
|
||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
||||
import org.eclipse.hawkbit.ui.push.TargetTagAssigmentResultEventContainer;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
@@ -69,6 +68,7 @@ public class TargetTagToken extends AbstractTargetTagToken<Target> {
|
||||
final Set<String> targetList = new HashSet<>();
|
||||
targetList.add(selectedEntity.getControllerId());
|
||||
final TargetTagAssignmentResult result = targetManagement.toggleTagAssignment(targetList, tagNameSelected);
|
||||
processTargetTagAssigmentResult(result);
|
||||
uinotification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(tagNameSelected, result, i18n));
|
||||
return result;
|
||||
}
|
||||
@@ -105,17 +105,17 @@ public class TargetTagToken extends AbstractTargetTagToken<Target> {
|
||||
}
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onTargetTagAssigmentResultEvent(final TargetTagAssigmentResultEventContainer holder) {
|
||||
holder.getEvents().stream().map(event -> event.getAssigmentResult()).forEach(assignmentResult -> {
|
||||
final TargetTag targetTag = assignmentResult.getTargetTag();
|
||||
if (isAssign(assignmentResult)) {
|
||||
addNewToken(targetTag.getId());
|
||||
} else if (isUnassign(assignmentResult)) {
|
||||
removeTokenItem(targetTag.getId(), targetTag.getName());
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
*
|
||||
* @param assignmentResult
|
||||
*/
|
||||
public void processTargetTagAssigmentResult(final TargetTagAssignmentResult assignmentResult) {
|
||||
final TargetTag targetTag = assignmentResult.getTargetTag();
|
||||
if (isAssign(assignmentResult)) {
|
||||
addNewToken(targetTag.getId());
|
||||
} else if (isUnassign(assignmentResult)) {
|
||||
removeTokenItem(targetTag.getId(), targetTag.getName());
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isAssign(final TargetTagAssignmentResult assignmentResult) {
|
||||
|
||||
@@ -30,7 +30,6 @@ import org.eclipse.hawkbit.ui.common.tagdetails.DistributionTagToken;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||
import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
|
||||
import org.eclipse.hawkbit.ui.distributions.event.SoftwareModuleAssignmentDiscardEvent;
|
||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||
import org.eclipse.hawkbit.ui.management.dstable.DistributionAddUpdateWindowLayout;
|
||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||
@@ -365,22 +364,6 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
|
||||
onBaseEntityEvent(distributionTableEvent);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final SoftwareModuleAssignmentDiscardEvent softwareModuleAssignmentDiscardEvent) {
|
||||
if (softwareModuleAssignmentDiscardEvent.getDistributionSetIdName() != null) {
|
||||
UI.getCurrent().access(() -> {
|
||||
final DistributionSetIdName distIdName = softwareModuleAssignmentDiscardEvent
|
||||
.getDistributionSetIdName();
|
||||
if (distIdName.getId().equals(getSelectedBaseEntityId())
|
||||
&& distIdName.getName().equals(getSelectedBaseEntity().getName())) {
|
||||
setSelectedBaseEntity(
|
||||
distributionSetManagement.findDistributionSetByIdWithDetails(getSelectedBaseEntityId()));
|
||||
populateModule();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final SaveActionWindowEvent saveActionWindowEvent) {
|
||||
if ((saveActionWindowEvent == SaveActionWindowEvent.SAVED_ASSIGNMENTS
|
||||
@@ -422,13 +405,6 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean isDistributionSetSelected(final DistributionSet ds) {
|
||||
final DistributionSetIdName lastselectedDistDS = manageDistUIState.getLastSelectedDistribution().isPresent()
|
||||
? manageDistUIState.getLastSelectedDistribution().get() : null;
|
||||
return ds != null && lastselectedDistDS != null && lastselectedDistDS.getName().equals(ds.getName())
|
||||
&& lastselectedDistDS.getVersion().endsWith(ds.getVersion());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void showMetadata(final ClickEvent event) {
|
||||
final DistributionSet ds = distributionSetManagement
|
||||
|
||||
@@ -21,8 +21,8 @@ import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.DistributionDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.DistributionSetUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.DistributionSetDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleIdName;
|
||||
@@ -160,8 +160,8 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
|
||||
final LazyQueryContainer dsContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
final List<Object> visibleItemIds = (List<Object>) getVisibleItemIds();
|
||||
boolean shouldRefreshDs = false;
|
||||
for (final DistributionDeletedEvent deletedEvent : eventContainer.getEvents()) {
|
||||
final Long distributionSetId = deletedEvent.getDistributionSetId();
|
||||
for (final DistributionSetDeletedEvent deletedEvent : eventContainer.getEvents()) {
|
||||
final Long distributionSetId = deletedEvent.getEntityId();
|
||||
final DistributionSetIdName targetIdName = new DistributionSetIdName(distributionSetId, null, null);
|
||||
if (visibleItemIds.contains(targetIdName)) {
|
||||
dsContainer.removeItem(targetIdName);
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* 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.distributions.event;
|
||||
|
||||
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
|
||||
|
||||
/**
|
||||
* Event fired on discard of software module assignment.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SoftwareModuleAssignmentDiscardEvent {
|
||||
|
||||
private DistributionSetIdName distributionSetIdName;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param distributionSetIdName.
|
||||
*/
|
||||
public SoftwareModuleAssignmentDiscardEvent(final DistributionSetIdName distributionSetIdName) {
|
||||
this.distributionSetIdName = distributionSetIdName;
|
||||
}
|
||||
|
||||
public DistributionSetIdName getDistributionSetIdName() {
|
||||
return distributionSetIdName;
|
||||
}
|
||||
|
||||
public void setDistributionSetIdName(final DistributionSetIdName distributionSetIdName) {
|
||||
this.distributionSetIdName = distributionSetIdName;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,8 +16,8 @@ import java.util.Map;
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.DistributionCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.DistributionDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.DistributionSetDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetCreatedEvent;
|
||||
import org.eclipse.hawkbit.ui.distributions.dstable.ManageDistBeanQuery;
|
||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
@@ -86,8 +86,8 @@ public class DistributionSetSelectTable extends Table {
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvents(final List<?> events) {
|
||||
final Object firstEvent = events.get(0);
|
||||
if (DistributionCreatedEvent.class.isInstance(firstEvent)
|
||||
|| DistributionDeletedEvent.class.isInstance(firstEvent)) {
|
||||
if (DistributionSetCreatedEvent.class.isInstance(firstEvent)
|
||||
|| DistributionSetDeletedEvent.class.isInstance(firstEvent)) {
|
||||
refreshDistributions();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,9 +77,6 @@ public class TargetFilterTable extends Table {
|
||||
@Autowired
|
||||
private transient TargetFilterQueryManagement targetFilterQueryManagement;
|
||||
|
||||
@Autowired
|
||||
private transient DistributionSetManagement distributionSetManagement;
|
||||
|
||||
@Autowired
|
||||
private DistributionSetSelectWindow dsSelectWindow;
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.DistributionDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.DistributionSetUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.DistributionSetDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
@@ -127,8 +127,8 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
||||
final LazyQueryContainer dsContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
final List<Object> visibleItemIds = (List<Object>) getVisibleItemIds();
|
||||
boolean shouldRefreshDs = false;
|
||||
for (final DistributionDeletedEvent deletedEvent : eventContainer.getEvents()) {
|
||||
final Long distributionSetId = deletedEvent.getDistributionSetId();
|
||||
for (final DistributionSetDeletedEvent deletedEvent : eventContainer.getEvents()) {
|
||||
final Long distributionSetId = deletedEvent.getEntityId();
|
||||
final DistributionSetIdName targetIdName = new DistributionSetIdName(distributionSetId, null, null);
|
||||
if (visibleItemIds.contains(targetIdName)) {
|
||||
dsContainer.removeItem(targetIdName);
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
package org.eclipse.hawkbit.ui.management.event;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEvent;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseUIEntityEvent;
|
||||
|
||||
/**
|
||||
* Class which contains the Event when selecting all entries of the
|
||||
* Class which contains the TenantAwareEvent when selecting all entries of the
|
||||
* distributions table
|
||||
*/
|
||||
public class DistributionTableEvent extends BaseEntityEvent<DistributionSet> {
|
||||
public class DistributionTableEvent extends BaseUIEntityEvent<DistributionSet> {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
package org.eclipse.hawkbit.ui.management.event;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEvent;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseUIEntityEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -18,7 +18,7 @@ import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class TargetAddUpdateWindowEvent extends BaseEntityEvent<Target> {
|
||||
public class TargetAddUpdateWindowEvent extends BaseUIEntityEvent<Target> {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
package org.eclipse.hawkbit.ui.management.event;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEvent;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseUIEntityEvent;
|
||||
|
||||
/**
|
||||
* Class which contains the Event when selecting all entries of the target table
|
||||
* Class which contains the TenantAwareEvent when selecting all entries of the target table
|
||||
*/
|
||||
public class TargetTableEvent extends BaseEntityEvent<Target> {
|
||||
public class TargetTableEvent extends BaseUIEntityEvent<Target> {
|
||||
|
||||
/**
|
||||
* Target table components events.
|
||||
|
||||
@@ -80,7 +80,7 @@ public class CountMessageLabel extends Label {
|
||||
}
|
||||
|
||||
/**
|
||||
* Event Listener to show the message count.
|
||||
* TenantAwareEvent Listener to show the message count.
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
@@ -102,7 +102,7 @@ public class CountMessageLabel extends Label {
|
||||
}
|
||||
|
||||
/**
|
||||
* Event Listener for Pinning Distribution.
|
||||
* TenantAwareEvent Listener for Pinning Distribution.
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
|
||||
@@ -19,10 +19,10 @@ import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetAssignmentResult;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetAssignmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.RepositoryModelConstants;
|
||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
|
||||
|
||||
@@ -30,8 +30,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.eclipse.hawkbit.repository.FilterParams;
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.TargetDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.TargetInfoUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||
@@ -57,7 +56,6 @@ import org.eclipse.hawkbit.ui.management.state.TargetTableFilters;
|
||||
import org.eclipse.hawkbit.ui.push.CancelTargetAssignmentEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.TargetCreatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.TargetDeletedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.TargetInfoUpdateEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.TargetUpdatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.utils.AssignInstalledDSTooltipGenerator;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
@@ -134,7 +132,7 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
|
||||
final List<Object> visibleItemIds = (List<Object>) getVisibleItemIds();
|
||||
boolean shouldRefreshTargets = false;
|
||||
for (final TargetDeletedEvent deletedEvent : eventContainer.getEvents()) {
|
||||
final TargetIdName targetIdName = new TargetIdName(deletedEvent.getTargetId(), null, null);
|
||||
final TargetIdName targetIdName = new TargetIdName(deletedEvent.getEntityId(), null, null);
|
||||
if (visibleItemIds.contains(targetIdName)) {
|
||||
targetContainer.removeItem(targetIdName);
|
||||
} else {
|
||||
@@ -157,30 +155,11 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
|
||||
// history, re-select
|
||||
// the updated target so the action history gets
|
||||
// refreshed.
|
||||
reselectTargetIfSelectedInStream(eventContainer.getEvents().stream().map(event -> event.getTarget()));
|
||||
reselectTargetIfSelectedInStream(eventContainer.getEvents().stream().map(event -> event.getEntity()));
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onTargetUpdatedEvents(final TargetUpdatedEventContainer eventContainer) {
|
||||
onTargetUpdateEvents(eventContainer.getEvents().stream()
|
||||
.map(targetInfoUpdateEvent -> targetInfoUpdateEvent.getEntity()).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onTargetInfoUpdateEvents(final TargetInfoUpdateEventContainer eventContainer) {
|
||||
onTargetUpdateEvents(eventContainer.getEvents().stream()
|
||||
.map(targetInfoUpdateEvent -> targetInfoUpdateEvent.getEntity().getTarget())
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
/**
|
||||
* EventListener method which is called by the event bus to notify about a
|
||||
* list of {@link TargetInfoUpdateEvent}.
|
||||
*
|
||||
* @param updatedTargets
|
||||
* list of updated targets
|
||||
*/
|
||||
private void onTargetUpdateEvents(final List<Target> updatedTargets) {
|
||||
final LazyQueryContainer targetContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
@SuppressWarnings("unchecked")
|
||||
final List<Object> visibleItemIds = (List<Object>) getVisibleItemIds();
|
||||
@@ -188,7 +167,8 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
|
||||
if (isFilterEnabled()) {
|
||||
refreshTargets();
|
||||
} else {
|
||||
updatedTargets.stream().filter(target -> visibleItemIds.contains(target.getTargetIdName()))
|
||||
eventContainer.getEvents().stream().map(event -> event.getEntity())
|
||||
.filter(target -> visibleItemIds.contains(target.getTargetIdName()))
|
||||
.forEach(target -> updateVisibleItemOnEvent(target.getTargetInfo()));
|
||||
targetContainer.commit();
|
||||
}
|
||||
@@ -197,7 +177,7 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
|
||||
// history, re-select
|
||||
// the updated target so the action history gets
|
||||
// refreshed.
|
||||
reselectTargetIfSelectedInStream(updatedTargets.stream());
|
||||
reselectTargetIfSelectedInStream(eventContainer.getEvents().stream().map(event -> event.getEntity()));
|
||||
}
|
||||
|
||||
private void reselectTargetIfSelectedInStream(final Stream<Target> targets) {
|
||||
@@ -881,8 +861,8 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
|
||||
}
|
||||
}
|
||||
|
||||
private long getTargetsCountWithFilter(final long totalTargetsCount,
|
||||
final Long pinnedDistId, final FilterParams filterParams) {
|
||||
private long getTargetsCountWithFilter(final long totalTargetsCount, final Long pinnedDistId,
|
||||
final FilterParams filterParams) {
|
||||
final long size;
|
||||
if (managementUIState.getTargetTableFilters().getTargetFilterQuery().isPresent()) {
|
||||
size = targetManagement.countTargetByTargetFilterQuery(
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
package org.eclipse.hawkbit.ui.menu;
|
||||
|
||||
/*
|
||||
* Event bus events used in Dashboard are listed here as inner classes.
|
||||
* TenantAwareEvent bus events used in Dashboard are listed here as inner classes.
|
||||
*/
|
||||
/**
|
||||
* Containing all dashboard events.
|
||||
@@ -48,7 +48,7 @@ public final class DashboardEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Event to indicate that the current shown view has been changed.
|
||||
* TenantAwareEvent to indicate that the current shown view has been changed.
|
||||
*
|
||||
*
|
||||
*
|
||||
|
||||
@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ui.push;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.CancelTargetAssignmentEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.CancelTargetAssignmentEvent;
|
||||
|
||||
/**
|
||||
* EventHolder for {@link CancelTargetAssignmentEvent}s.
|
||||
|
||||
@@ -19,27 +19,37 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.EntityEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.Event;
|
||||
import org.eclipse.hawkbit.im.authentication.TenantAwareAuthenticationDetails;
|
||||
import org.eclipse.hawkbit.repository.event.TenantAwareEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.ActionCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.ActionUpdatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.RolloutGroupCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.RolloutGroupUpdatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.RolloutUpdatedEvent;
|
||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
import org.eclipse.hawkbit.ui.push.event.RolloutChangeEvent;
|
||||
import org.eclipse.hawkbit.ui.push.event.RolloutGroupChangeEvent;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.security.core.context.SecurityContext;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.web.context.HttpSessionSecurityContextRepository;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventBus.SessionEventBus;
|
||||
|
||||
import com.google.common.eventbus.AllowConcurrentEvents;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.vaadin.server.VaadinSession;
|
||||
import com.vaadin.server.VaadinSession.State;
|
||||
import com.vaadin.server.WrappedSession;
|
||||
import com.vaadin.ui.UI;
|
||||
|
||||
/**
|
||||
* A {@link EventPushStrategy} implementation which retrieves events from
|
||||
* {@link com.google.common.eventbus.EventBus} and store them first in an queue
|
||||
* An {@link EventPushStrategy} implementation which retrieves events from
|
||||
* {@link com.google.common.eventbus.EventBus} and store them first in a queue
|
||||
* where they will dispatched every 2 seconds to the {@link EventBus} in a
|
||||
* Vaadin access thread {@link UI#access(Runnable)}.
|
||||
*
|
||||
@@ -52,66 +62,26 @@ import com.vaadin.ui.UI;
|
||||
* in the event and only forwards event from the right tenant to the UI.
|
||||
*
|
||||
*/
|
||||
public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
public class DelayedEventBusPushStrategy implements EventPushStrategy, ApplicationListener<ApplicationEvent> {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DelayedEventBusPushStrategy.class);
|
||||
|
||||
private static final int BLOCK_SIZE = 10_000;
|
||||
private final ScheduledExecutorService executorService;
|
||||
private final BlockingDeque<Event> queue = new LinkedBlockingDeque<>(BLOCK_SIZE);
|
||||
private final EventBus.SessionEventBus eventBus;
|
||||
private final com.google.common.eventbus.EventBus systemEventBus;
|
||||
private final BlockingDeque<org.eclipse.hawkbit.repository.event.TenantAwareEvent> queue = new LinkedBlockingDeque<>(
|
||||
BLOCK_SIZE);
|
||||
private int uiid = -1;
|
||||
|
||||
@Autowired
|
||||
private ScheduledExecutorService executorService;
|
||||
|
||||
@Autowired
|
||||
private EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private UIEventProvider eventProvider;
|
||||
private ScheduledFuture<?> jobHandle;
|
||||
|
||||
private final UIEventProvider eventProvider;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param executorService
|
||||
* for scheduled execution of event forwarding to the UI
|
||||
* @param eventBus
|
||||
* the session event bus to where the events should be dispatched
|
||||
* @param systemEventBus
|
||||
* the system event bus where to retrieve the events from the
|
||||
* back-end
|
||||
* @param eventProvider
|
||||
* for event delegation to UI
|
||||
*/
|
||||
public DelayedEventBusPushStrategy(final ScheduledExecutorService executorService, final SessionEventBus eventBus,
|
||||
final com.google.common.eventbus.EventBus systemEventBus, final UIEventProvider eventProvider) {
|
||||
this.executorService = executorService;
|
||||
this.eventBus = eventBus;
|
||||
this.systemEventBus = systemEventBus;
|
||||
this.eventProvider = eventProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* An {@link com.google.common.eventbus.EventBus} subscriber which
|
||||
* subscribes {@link EntityEvent} from the repository to dispatch these
|
||||
* events to the UI {@link SessionEventBus}.
|
||||
*
|
||||
* @param event
|
||||
* the entity event which has been published from the repository
|
||||
*/
|
||||
@Subscribe
|
||||
@AllowConcurrentEvents
|
||||
public void dispatch(final Event event) {
|
||||
// to dispatch too many events which are not interested on the UI
|
||||
if (!isEventProvided(event)) {
|
||||
LOG.trace("Event is not supported in the UI!!! Dropped event is {}", event);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!queue.offer(event)) {
|
||||
LOG.trace("Deque limit is reached, cannot add more events for UI {}! Dropped event is {}", uiid, event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isEventProvided(final Event event) {
|
||||
private boolean isEventProvided(final org.eclipse.hawkbit.repository.event.TenantAwareEvent event) {
|
||||
return eventProvider.getEvents().containsKey(event.getClass());
|
||||
}
|
||||
|
||||
@@ -125,40 +95,15 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
|
||||
jobHandle = executorService.scheduleWithFixedDelay(new DispatchRunnable(vaadinUI, vaadinUI.getSession()),
|
||||
10_000, 1_000, TimeUnit.MILLISECONDS);
|
||||
systemEventBus.register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clean() {
|
||||
LOG.info("Cleanup delayed event push strategy for UI", uiid);
|
||||
systemEventBus.unregister(this);
|
||||
jobHandle.cancel(true);
|
||||
queue.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the tenant within the event is equal with the current tenant in
|
||||
* the context.
|
||||
*
|
||||
* @param userContext
|
||||
* the security context of the current session
|
||||
* @param event
|
||||
* the event to dispatch to the UI
|
||||
* @return {@code true} if the event can be dispatched to the UI otherwise
|
||||
* {@code false}
|
||||
*/
|
||||
protected static boolean eventSecurityCheck(final SecurityContext userContext, final Event event) {
|
||||
if (userContext == null || userContext.getAuthentication() == null) {
|
||||
return false;
|
||||
}
|
||||
final Object tenantAuthenticationDetails = userContext.getAuthentication().getDetails();
|
||||
if (tenantAuthenticationDetails instanceof TenantAwareAuthenticationDetails) {
|
||||
return ((TenantAwareAuthenticationDetails) tenantAuthenticationDetails).getTenant()
|
||||
.equalsIgnoreCase(event.getTenant());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private final class DispatchRunnable implements Runnable {
|
||||
|
||||
private final UI vaadinUI;
|
||||
@@ -180,7 +125,12 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
return;
|
||||
}
|
||||
|
||||
final List<Event> events = new ArrayList<>(size);
|
||||
final WrappedSession wrappedSession = vaadinSession.getSession();
|
||||
if (wrappedSession == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final List<TenantAwareEvent> events = new ArrayList<>(size);
|
||||
final int eventsSize = queue.drainTo(events);
|
||||
|
||||
if (events.isEmpty()) {
|
||||
@@ -188,11 +138,6 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
return;
|
||||
}
|
||||
|
||||
final WrappedSession wrappedSession = vaadinSession.getSession();
|
||||
if (wrappedSession == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG.debug("UI EventBus aggregator dispatches {} events for session {} for UI {}", eventsSize, vaadinSession,
|
||||
vaadinUI.getUIId());
|
||||
|
||||
@@ -203,14 +148,41 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
|
||||
}
|
||||
|
||||
private void doDispatch(final List<Event> events, final WrappedSession wrappedSession) {
|
||||
/**
|
||||
* Checks if the tenant within the event is equal with the current
|
||||
* tenant in the context.
|
||||
*
|
||||
* @param userContext
|
||||
* the security context of the current session
|
||||
* @param event
|
||||
* the event to dispatch to the UI
|
||||
* @return {@code true} if the event can be dispatched to the UI
|
||||
* otherwise {@code false}
|
||||
*/
|
||||
private boolean eventSecurityCheck(final SecurityContext userContext,
|
||||
final org.eclipse.hawkbit.repository.event.TenantAwareEvent event) {
|
||||
if (userContext == null || userContext.getAuthentication() == null) {
|
||||
return false;
|
||||
}
|
||||
final Object tenantAuthenticationDetails = userContext.getAuthentication().getDetails();
|
||||
if (tenantAuthenticationDetails instanceof TenantAwareAuthenticationDetails) {
|
||||
return ((TenantAwareAuthenticationDetails) tenantAuthenticationDetails).getTenant()
|
||||
.equalsIgnoreCase(event.getTenant());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void doDispatch(final List<org.eclipse.hawkbit.repository.event.TenantAwareEvent> events,
|
||||
final WrappedSession wrappedSession) {
|
||||
final SecurityContext userContext = (SecurityContext) wrappedSession
|
||||
.getAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY);
|
||||
final SecurityContext oldContext = SecurityContextHolder.getContext();
|
||||
try {
|
||||
SecurityContextHolder.setContext(userContext);
|
||||
|
||||
final List<EventContainer<Event>> groupedEvents = groupEvents(events, userContext, eventProvider);
|
||||
final List<EventContainer<TenantAwareEvent>> groupedEvents = groupEvents(events, userContext,
|
||||
eventProvider);
|
||||
|
||||
vaadinUI.access(() -> {
|
||||
if (vaadinSession.getState() != State.OPEN) {
|
||||
return;
|
||||
@@ -227,18 +199,19 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private List<EventContainer<Event>> groupEvents(final List<Event> events, final SecurityContext userContext,
|
||||
final UIEventProvider eventProvider) {
|
||||
private List<EventContainer<TenantAwareEvent>> groupEvents(final List<TenantAwareEvent> events,
|
||||
final SecurityContext userContext, final UIEventProvider eventProvider) {
|
||||
|
||||
return events.stream().filter(event -> eventSecurityCheck(userContext, event))
|
||||
.collect(Collectors.groupingBy(Event::getClass)).entrySet().stream().map(entry -> {
|
||||
EventContainer<Event> holder = null;
|
||||
.collect(Collectors.groupingBy(TenantAwareEvent::getClass)).entrySet().stream().map(entry -> {
|
||||
EventContainer<TenantAwareEvent> holder = null;
|
||||
try {
|
||||
final Constructor<Event> declaredConstructor = (Constructor<Event>) eventProvider
|
||||
final Constructor<TenantAwareEvent> declaredConstructor = (Constructor<TenantAwareEvent>) eventProvider
|
||||
.getEvents().get(entry.getKey()).getDeclaredConstructor(List.class);
|
||||
declaredConstructor.setAccessible(true);
|
||||
|
||||
holder = (EventContainer<Event>) declaredConstructor.newInstance(entry.getValue());
|
||||
holder = (EventContainer<TenantAwareEvent>) declaredConstructor
|
||||
.newInstance(entry.getValue());
|
||||
} catch (final ReflectiveOperationException e) {
|
||||
LOG.error("Failed to create EventHolder!", e);
|
||||
}
|
||||
@@ -248,4 +221,87 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An application event publisher subscriber which subscribes
|
||||
* {@link TenantAwareEvent} from the repository to dispatch these events to
|
||||
* the UI {@link SessionEventBus} .
|
||||
*
|
||||
* @param applicationEvent
|
||||
* the entity event which has been published from the repository
|
||||
*/
|
||||
@Override
|
||||
@Async
|
||||
public void onApplicationEvent(final ApplicationEvent applicationEvent) {
|
||||
if (!(applicationEvent instanceof org.eclipse.hawkbit.repository.event.TenantAwareEvent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final org.eclipse.hawkbit.repository.event.TenantAwareEvent event = (TenantAwareEvent) applicationEvent;
|
||||
|
||||
collectRolloutEvent(event);
|
||||
// to dispatch too many events which are not interested on the UI
|
||||
if (!isEventProvided(event)) {
|
||||
LOG.trace("Event is not supported in the UI!!! Dropped event is {}", event);
|
||||
return;
|
||||
}
|
||||
offerEvent(event);
|
||||
}
|
||||
|
||||
private void offerEventIfNotContains(final org.eclipse.hawkbit.repository.event.TenantAwareEvent event) {
|
||||
if (queue.contains(event)) {
|
||||
return;
|
||||
}
|
||||
offerEvent(event);
|
||||
}
|
||||
|
||||
private void offerEvent(final org.eclipse.hawkbit.repository.event.TenantAwareEvent event) {
|
||||
if (!queue.offer(event)) {
|
||||
LOG.warn("Deque limit is reached, cannot add more events!!! Dropped event is {}", event);
|
||||
}
|
||||
}
|
||||
|
||||
private void collectRolloutEvent(final TenantAwareEvent event) {
|
||||
Long rolloutId = null;
|
||||
Long rolloutGroupId = null;
|
||||
if (event instanceof ActionCreatedEvent) {
|
||||
rolloutId = getRolloutId(((ActionCreatedEvent) event).getEntity().getRollout());
|
||||
rolloutGroupId = getRolloutGroupId(((ActionCreatedEvent) event).getEntity().getRolloutGroup());
|
||||
} else if (event instanceof ActionUpdatedEvent) {
|
||||
rolloutId = getRolloutId(((ActionUpdatedEvent) event).getEntity().getRollout());
|
||||
rolloutGroupId = getRolloutGroupId(((ActionUpdatedEvent) event).getEntity().getRolloutGroup());
|
||||
} else if (event instanceof RolloutUpdatedEvent) {
|
||||
rolloutId = ((RolloutUpdatedEvent) event).getEntityId();
|
||||
} else if (event instanceof RolloutGroupCreatedEvent) {
|
||||
rolloutId = ((RolloutGroupCreatedEvent) event).getRolloutId();
|
||||
rolloutGroupId = ((RolloutGroupCreatedEvent) event).getEntityId();
|
||||
} else if (event instanceof RolloutGroupUpdatedEvent) {
|
||||
final RolloutGroup rolloutGroup = ((RolloutGroupUpdatedEvent) event).getEntity();
|
||||
rolloutId = rolloutGroup.getRollout().getId();
|
||||
rolloutGroupId = rolloutGroup.getId();
|
||||
}
|
||||
|
||||
if (rolloutId == null) {
|
||||
return;
|
||||
}
|
||||
offerEventIfNotContains(new RolloutChangeEvent(event.getTenant(), rolloutId));
|
||||
|
||||
if (rolloutGroupId != null) {
|
||||
offerEventIfNotContains(new RolloutGroupChangeEvent(event.getTenant(), rolloutId, rolloutGroupId));
|
||||
}
|
||||
}
|
||||
|
||||
private static Long getRolloutGroupId(final RolloutGroup rolloutGroup) {
|
||||
if (rolloutGroup != null) {
|
||||
return rolloutGroup.getId();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Long getRolloutId(final Rollout rollout) {
|
||||
if (rollout != null) {
|
||||
return rollout.getId();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,21 +10,21 @@ package org.eclipse.hawkbit.ui.push;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.DistributionCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetCreatedEvent;
|
||||
|
||||
/**
|
||||
* EventHolder for {@link DistributionCreatedEvent}s.
|
||||
* EventHolder for {@link DistributionSetCreatedEvent}s.
|
||||
*
|
||||
*/
|
||||
public class DistributionCreatedEventContainer implements EventContainer<DistributionCreatedEvent> {
|
||||
private final List<DistributionCreatedEvent> events;
|
||||
public class DistributionCreatedEventContainer implements EventContainer<DistributionSetCreatedEvent> {
|
||||
private final List<DistributionSetCreatedEvent> events;
|
||||
|
||||
DistributionCreatedEventContainer(final List<DistributionCreatedEvent> events) {
|
||||
DistributionCreatedEventContainer(final List<DistributionSetCreatedEvent> events) {
|
||||
this.events = events;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DistributionCreatedEvent> getEvents() {
|
||||
public List<DistributionSetCreatedEvent> getEvents() {
|
||||
return events;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,21 +10,21 @@ package org.eclipse.hawkbit.ui.push;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.DistributionDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.DistributionSetDeletedEvent;
|
||||
|
||||
/**
|
||||
* EventHolder for {@link DistributionDeletedEvent}s.
|
||||
* EventHolder for {@link DistributionSetDeletedEvent}s.
|
||||
*
|
||||
*/
|
||||
public class DistributionDeletedEventContainer implements EventContainer<DistributionDeletedEvent> {
|
||||
private final List<DistributionDeletedEvent> events;
|
||||
public class DistributionDeletedEventContainer implements EventContainer<DistributionSetDeletedEvent> {
|
||||
private final List<DistributionSetDeletedEvent> events;
|
||||
|
||||
DistributionDeletedEventContainer(final List<DistributionDeletedEvent> events) {
|
||||
DistributionDeletedEventContainer(final List<DistributionSetDeletedEvent> events) {
|
||||
this.events = events;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DistributionDeletedEvent> getEvents() {
|
||||
public List<DistributionSetDeletedEvent> getEvents() {
|
||||
return events;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* 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.push;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.DistributionSetTagAssigmentResultEvent;
|
||||
|
||||
/**
|
||||
* EventHolder for {@link DistributionSetTagAssigmentResultEvent}s.
|
||||
*
|
||||
*/
|
||||
public class DistributionSetTagAssignmentResultEventContainer
|
||||
implements EventContainer<DistributionSetTagAssigmentResultEvent> {
|
||||
private final List<DistributionSetTagAssigmentResultEvent> events;
|
||||
|
||||
DistributionSetTagAssignmentResultEventContainer(final List<DistributionSetTagAssigmentResultEvent> events) {
|
||||
this.events = events;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DistributionSetTagAssigmentResultEvent> getEvents() {
|
||||
return events;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ui.push;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.DistributionSetTagCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetTagCreatedEvent;
|
||||
|
||||
/**
|
||||
* EventHolder for {@link DistributionSetTagCreatedEvent}s.
|
||||
|
||||
@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ui.push;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.DistributionSetTagDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.DistributionSetTagDeletedEvent;
|
||||
|
||||
/**
|
||||
* EventHolder for {@link DistributionSetTagDeletedEvent}s.
|
||||
|
||||
@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ui.push;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.DistributionSetTagUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetTagUpdateEvent;
|
||||
|
||||
/**
|
||||
* EventHolder for {@link DistributionSetTagUpdateEvent}s.
|
||||
|
||||
@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ui.push;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.DistributionSetUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetUpdateEvent;
|
||||
|
||||
/**
|
||||
* EventHolder for {@link DistributionSetUpdateEvent}s.
|
||||
|
||||
@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ui.push;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.Event;
|
||||
import org.eclipse.hawkbit.repository.event.TenantAwareEvent;
|
||||
|
||||
/**
|
||||
* EventHolder beans contains a list of events that can be process by the UI in
|
||||
@@ -21,7 +21,7 @@ import org.eclipse.hawkbit.eventbus.event.Event;
|
||||
*
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface EventContainer<T extends Event> {
|
||||
public interface EventContainer<T extends TenantAwareEvent> {
|
||||
|
||||
/**
|
||||
* @return list of contained events
|
||||
|
||||
@@ -10,25 +10,22 @@ package org.eclipse.hawkbit.ui.push;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.Event;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.CancelTargetAssignmentEvent;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.DistributionCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.DistributionDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.DistributionSetTagAssigmentResultEvent;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.DistributionSetTagCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.DistributionSetTagDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.DistributionSetTagUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.DistributionSetUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.RolloutChangeEvent;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.RolloutGroupChangeEvent;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.TargetCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.TargetDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.TargetInfoUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.TargetTagAssigmentResultEvent;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.TargetTagCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.TargetTagDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.TargetTagUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.TargetUpdatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.TenantAwareEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.DistributionSetDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.DistributionSetTagDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetTagDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.CancelTargetAssignmentEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetTagCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetTagUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetTagCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetTagUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetUpdatedEvent;
|
||||
import org.eclipse.hawkbit.ui.push.event.RolloutChangeEvent;
|
||||
import org.eclipse.hawkbit.ui.push.event.RolloutGroupChangeEvent;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
@@ -37,30 +34,26 @@ import com.google.common.collect.Maps;
|
||||
*/
|
||||
public class HawkbitEventProvider implements UIEventProvider {
|
||||
|
||||
private static final Map<Class<? extends Event>, Class<?>> EVENTS = Maps.newHashMapWithExpectedSize(18);
|
||||
private static final Map<Class<? extends TenantAwareEvent>, Class<?>> EVENTS = Maps.newHashMapWithExpectedSize(15);
|
||||
|
||||
static {
|
||||
|
||||
EVENTS.put(TargetTagDeletedEvent.class, TargetTagDeletedEventContainer.class);
|
||||
EVENTS.put(TargetTagCreatedEvent.class, TargetTagCreatedEventContainer.class);
|
||||
EVENTS.put(TargetTagUpdateEvent.class, TargetTagUpdatedEventContainer.class);
|
||||
EVENTS.put(TargetTagAssigmentResultEvent.class, TargetTagAssigmentResultEventContainer.class);
|
||||
|
||||
EVENTS.put(DistributionSetTagCreatedEvent.class, DistributionSetTagCreatedEventContainer.class);
|
||||
EVENTS.put(DistributionSetTagDeletedEvent.class, DistributionSetTagDeletedEventContainer.class);
|
||||
EVENTS.put(DistributionSetTagUpdateEvent.class, DistributionSetTagUpdatedEventContainer.class);
|
||||
EVENTS.put(DistributionSetTagAssigmentResultEvent.class,
|
||||
DistributionSetTagAssignmentResultEventContainer.class);
|
||||
|
||||
EVENTS.put(TargetCreatedEvent.class, TargetCreatedEventContainer.class);
|
||||
EVENTS.put(TargetInfoUpdateEvent.class, TargetInfoUpdateEventContainer.class);
|
||||
EVENTS.put(TargetDeletedEvent.class, TargetDeletedEventContainer.class);
|
||||
EVENTS.put(TargetUpdatedEvent.class, TargetUpdatedEventContainer.class);
|
||||
EVENTS.put(CancelTargetAssignmentEvent.class, CancelTargetAssignmentEventContainer.class);
|
||||
|
||||
EVENTS.put(DistributionSetUpdateEvent.class, DistributionSetUpdatedEventContainer.class);
|
||||
EVENTS.put(DistributionDeletedEvent.class, DistributionDeletedEventContainer.class);
|
||||
EVENTS.put(DistributionCreatedEvent.class, DistributionCreatedEventContainer.class);
|
||||
EVENTS.put(DistributionSetDeletedEvent.class, DistributionDeletedEventContainer.class);
|
||||
EVENTS.put(DistributionSetCreatedEvent.class, DistributionCreatedEventContainer.class);
|
||||
|
||||
EVENTS.put(RolloutGroupChangeEvent.class, RolloutGroupChangeEventContainer.class);
|
||||
EVENTS.put(RolloutChangeEvent.class, RolloutChangeEventContainer.class);
|
||||
@@ -68,7 +61,7 @@ public class HawkbitEventProvider implements UIEventProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Class<? extends Event>, Class<?>> getEvents() {
|
||||
public Map<Class<? extends TenantAwareEvent>, Class<?>> getEvents() {
|
||||
return EVENTS;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ui.push;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.RolloutChangeEvent;
|
||||
import org.eclipse.hawkbit.ui.push.event.RolloutChangeEvent;
|
||||
|
||||
/**
|
||||
* EventHolder for {@link RolloutChangeEvent}s.
|
||||
|
||||
@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ui.push;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.RolloutGroupChangeEvent;
|
||||
import org.eclipse.hawkbit.ui.push.event.RolloutGroupChangeEvent;
|
||||
|
||||
/**
|
||||
* EventHolder for {@link RolloutGroupChangeEvent}s.
|
||||
|
||||
@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ui.push;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.TargetCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetCreatedEvent;
|
||||
|
||||
/**
|
||||
* EventHolder for {@link TargetCreatedEvent}s.
|
||||
|
||||
@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ui.push;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.TargetDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetDeletedEvent;
|
||||
|
||||
/**
|
||||
* EventHolder for {@link TargetDeletedEvent}s.
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/**
|
||||
* 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.push;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.TargetInfoUpdateEvent;
|
||||
|
||||
/**
|
||||
* EventHolder for {@link TargetInfoUpdateEvent}s.
|
||||
*
|
||||
*/
|
||||
public class TargetInfoUpdateEventContainer implements EventContainer<TargetInfoUpdateEvent> {
|
||||
private final List<TargetInfoUpdateEvent> events;
|
||||
|
||||
TargetInfoUpdateEventContainer(final List<TargetInfoUpdateEvent> events) {
|
||||
this.events = events;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TargetInfoUpdateEvent> getEvents() {
|
||||
return events;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/**
|
||||
* 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.push;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.TargetTagAssigmentResultEvent;
|
||||
|
||||
/**
|
||||
* EventHolder for {@link TargetTagAssigmentResultEvent}s.
|
||||
*
|
||||
*/
|
||||
public class TargetTagAssigmentResultEventContainer implements EventContainer<TargetTagAssigmentResultEvent> {
|
||||
private final List<TargetTagAssigmentResultEvent> events;
|
||||
|
||||
TargetTagAssigmentResultEventContainer(final List<TargetTagAssigmentResultEvent> events) {
|
||||
this.events = events;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TargetTagAssigmentResultEvent> getEvents() {
|
||||
return events;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ui.push;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.TargetTagCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetTagCreatedEvent;
|
||||
|
||||
/**
|
||||
* EventHolder for {@link TargetTagCreatedEvent}s.
|
||||
|
||||
@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ui.push;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.TargetTagDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetTagDeletedEvent;
|
||||
|
||||
/**
|
||||
* EventHolder for {@link TargetTagDeletedEvent}s.
|
||||
|
||||
@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ui.push;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.TargetTagUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetTagUpdateEvent;
|
||||
|
||||
/**
|
||||
* EventHolder for {@link TargetTagUpdateEvent}s.
|
||||
|
||||
@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ui.push;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.TargetUpdatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetUpdatedEvent;
|
||||
|
||||
/**
|
||||
* EventHolder for {@link TargetUpdatedEvent}s.
|
||||
|
||||
@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.ui.push;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.Event;
|
||||
import org.eclipse.hawkbit.repository.event.TenantAwareEvent;
|
||||
|
||||
/**
|
||||
* The UI event provider hold all supported repository events which will
|
||||
@@ -25,7 +25,7 @@ public interface UIEventProvider {
|
||||
*
|
||||
* @return list of provided event types. Should not be null
|
||||
*/
|
||||
default Map<Class<? extends Event>, Class<?>> getEvents() {
|
||||
default Map<Class<? extends TenantAwareEvent>, Class<?>> getEvents() {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/**
|
||||
* 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.push.event;
|
||||
|
||||
/**
|
||||
* TenantAwareEvent declaration for the UI to notify the UI that a rollout has
|
||||
* been changed.
|
||||
*
|
||||
*/
|
||||
public class RolloutChangeEvent extends TenantAwareUiEvent {
|
||||
|
||||
private final Long rolloutId;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param tenant
|
||||
* the tenant of the event
|
||||
* @param rolloutId
|
||||
* the ID of the rollout which has been changed
|
||||
*/
|
||||
public RolloutChangeEvent(final String tenant, final Long rolloutId) {
|
||||
super(tenant);
|
||||
this.rolloutId = rolloutId;
|
||||
}
|
||||
|
||||
public Long getRolloutId() {
|
||||
return rolloutId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RolloutChangeEvent [rolloutId=" + rolloutId + ", getTenant()=" + getTenant() + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((rolloutId == null) ? 0 : rolloutId.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final RolloutChangeEvent other = (RolloutChangeEvent) obj;
|
||||
if (rolloutId == null) {
|
||||
if (other.rolloutId != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!rolloutId.equals(other.rolloutId)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* 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.push.event;
|
||||
|
||||
/**
|
||||
* TenantAwareEvent declaration for the UI to notify the UI that a rollout has
|
||||
* been changed.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class RolloutGroupChangeEvent extends TenantAwareUiEvent {
|
||||
|
||||
private final Long rolloutId;
|
||||
private final Long rolloutGroupId;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param tenant
|
||||
* the tenant of the event
|
||||
* @param rolloutId
|
||||
* the ID of the rollout which has been changed
|
||||
* @param rolloutGroupId
|
||||
* the ID of the rollout group which has been changed
|
||||
*/
|
||||
public RolloutGroupChangeEvent(final String tenant, final Long rolloutId, final Long rolloutGroupId) {
|
||||
super(tenant);
|
||||
this.rolloutId = rolloutId;
|
||||
this.rolloutGroupId = rolloutGroupId;
|
||||
}
|
||||
|
||||
public Long getRolloutId() {
|
||||
return rolloutId;
|
||||
}
|
||||
|
||||
public Long getRolloutGroupId() {
|
||||
return rolloutGroupId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RolloutGroupChangeEvent [rolloutId=" + rolloutId + ", rolloutGroupId=" + rolloutGroupId
|
||||
+ ", getTenant()=" + getTenant() + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((rolloutGroupId == null) ? 0 : rolloutGroupId.hashCode());
|
||||
result = prime * result + ((rolloutId == null) ? 0 : rolloutId.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final RolloutGroupChangeEvent other = (RolloutGroupChangeEvent) obj;
|
||||
if (rolloutGroupId == null) {
|
||||
if (other.rolloutGroupId != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!rolloutGroupId.equals(other.rolloutGroupId)) {
|
||||
return false;
|
||||
}
|
||||
if (rolloutId == null) {
|
||||
if (other.rolloutId != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!rolloutId.equals(other.rolloutId)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* 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.push.event;
|
||||
|
||||
import org.eclipse.hawkbit.repository.event.TenantAwareEvent;
|
||||
|
||||
/**
|
||||
* UI event definition class which holds the necessary tenant information which
|
||||
* every UI event needs.
|
||||
*
|
||||
*/
|
||||
public class TenantAwareUiEvent implements TenantAwareEvent {
|
||||
|
||||
private final String tenant;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param tenant
|
||||
* the tenant of the event
|
||||
*/
|
||||
protected TenantAwareUiEvent(final String tenant) {
|
||||
this.tenant = tenant;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTenant() {
|
||||
return tenant;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((tenant == null) ? 0 : tenant.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final TenantAwareUiEvent other = (TenantAwareUiEvent) obj;
|
||||
if (tenant == null) {
|
||||
if (other.tenant != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!tenant.equals(other.tenant)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,7 +28,6 @@ import java.util.Set;
|
||||
|
||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.RolloutChangeEvent;
|
||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
@@ -40,6 +39,7 @@ import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlButtonRenderer;
|
||||
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlLabelRenderer;
|
||||
import org.eclipse.hawkbit.ui.customrenderers.renderers.RolloutRenderer;
|
||||
import org.eclipse.hawkbit.ui.push.RolloutChangeEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.event.RolloutChangeEvent;
|
||||
import org.eclipse.hawkbit.ui.rollout.DistributionBarHelper;
|
||||
import org.eclipse.hawkbit.ui.rollout.StatusFontIcon;
|
||||
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
||||
|
||||
@@ -16,9 +16,7 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
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.common.grid.AbstractGrid;
|
||||
@@ -66,9 +64,6 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
@Autowired
|
||||
private transient RolloutGroupManagement rolloutGroupManagement;
|
||||
|
||||
@Autowired
|
||||
private transient RolloutManagement rolloutManagement;
|
||||
|
||||
@Autowired
|
||||
private transient RolloutUIState rolloutUIState;
|
||||
|
||||
@@ -90,11 +85,10 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
* Handles the RolloutGroupChangeEvent to refresh the item in the grid.
|
||||
*
|
||||
*
|
||||
* @param rolloutGroupChangeEvent
|
||||
* @param eventContainer
|
||||
* the event which contains the rollout group which has been
|
||||
* change
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
public void onRolloutGroupChangeEvent(final RolloutGroupChangeEventContainer eventContainer) {
|
||||
if (!rolloutUIState.isShowRolloutGroups()) {
|
||||
@@ -104,11 +98,6 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
((LazyQueryContainer) getContainerDataSource()).refresh();
|
||||
}
|
||||
|
||||
private String calculateFinishedPercentage(final RolloutGroup rolloutGroup) {
|
||||
return HawkbitCommonUtil.formattingFinishedPercentage(rolloutGroup,
|
||||
rolloutManagement.getFinishedPercentForRunningGroup(rolloutGroup.getRollout().getId(), rolloutGroup));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Container createContainer() {
|
||||
final BeanQueryFactory<RolloutGroupBeanQuery> rolloutQf = new BeanQueryFactory<>(RolloutGroupBeanQuery.class);
|
||||
|
||||
@@ -66,7 +66,7 @@ public class RolloutGroupTargetsCountLabelMessage extends Label {
|
||||
}
|
||||
|
||||
/**
|
||||
* Event Listener to show the message count.
|
||||
* TenantAwareEvent Listener to show the message count.
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user