Merge branch 'master' into
Download_server_supports_download_through_HTTP_and_HTTPs Conflicts: hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/configuration/TenantConfigurationKey.java Signed-off-by: Michael Hirsch <michael.hirsch@bosch-si.com>
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* 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;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagCreatedBulkEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagDeletedEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagUpdateEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.Event;
|
||||
import org.eclipse.hawkbit.eventbus.event.RolloutChangeEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.RolloutGroupChangeEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetCreatedEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetDeletedEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetInfoUpdateEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetTagCreatedBulkEvent;
|
||||
|
||||
/**
|
||||
* The default hawkbit event provider.
|
||||
*/
|
||||
public class HawkbitEventProvider implements UIEventProvider {
|
||||
|
||||
private static final Set<Class<? extends Event>> SINGLE_EVENTS = new HashSet<>(6);
|
||||
private static final Set<Class<? extends Event>> BULK_EVENTS = new HashSet<>(3);
|
||||
|
||||
static {
|
||||
SINGLE_EVENTS.add(TargetTagCreatedBulkEvent.class);
|
||||
SINGLE_EVENTS.add(DistributionSetTagCreatedBulkEvent.class);
|
||||
SINGLE_EVENTS.add(DistributionSetTagDeletedEvent.class);
|
||||
SINGLE_EVENTS.add(DistributionSetTagUpdateEvent.class);
|
||||
SINGLE_EVENTS.add(RolloutGroupChangeEvent.class);
|
||||
SINGLE_EVENTS.add(RolloutChangeEvent.class);
|
||||
|
||||
BULK_EVENTS.add(TargetCreatedEvent.class);
|
||||
BULK_EVENTS.add(TargetInfoUpdateEvent.class);
|
||||
BULK_EVENTS.add(TargetDeletedEvent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Class<? extends Event>> getSingleEvents() {
|
||||
return SINGLE_EVENTS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Class<? extends Event>> getBulkEvents() {
|
||||
return BULK_EVENTS;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* 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;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.Event;
|
||||
|
||||
/**
|
||||
* The UI event provider hold all supported repository events which will
|
||||
* delegated to the UI. A event type can delegated as single event or bulk
|
||||
* event. Bulk event means, that all events from one type is collected by the
|
||||
* provider. The delegater and delegated as a list of this events.
|
||||
*/
|
||||
public interface UIEventProvider {
|
||||
|
||||
/**
|
||||
* Return all supported repository single event types. All events which this
|
||||
* type are delegated to the UI as single event.
|
||||
*
|
||||
* @return list of provided event types. Should not be null
|
||||
*/
|
||||
default Set<Class<? extends Event>> getSingleEvents() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all supported repository bulk event types. All events which this
|
||||
* type are delegated to the UI as a list. This list contains all collected
|
||||
* events from one type.
|
||||
*
|
||||
* @return list of provided bulk event types. Should not be null
|
||||
*/
|
||||
default Set<Class<? extends Event>> getBulkEvents() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all filtered bulk event types by the given events. The default
|
||||
* maps the events by class.
|
||||
*
|
||||
* @param allEvents
|
||||
* the events
|
||||
* @return list of provided bulk event types which are filtered. Should not
|
||||
* be null
|
||||
*/
|
||||
default Set<Class<?>> getFilteredBulkEventsType(final List<Event> allEvents) {
|
||||
return allEvents.stream().map(Event::getClass).filter(getBulkEvents()::contains).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,8 +28,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
|
||||
import com.vaadin.event.FieldEvents.TextChangeEvent;
|
||||
import com.vaadin.event.FieldEvents.TextChangeListener;
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
@@ -245,27 +243,21 @@ public class SoftwareModuleAddUpdateWindow implements Serializable {
|
||||
}
|
||||
|
||||
private void addDescriptionTextChangeListener() {
|
||||
descTextArea.addTextChangeListener(new TextChangeListener() {
|
||||
@Override
|
||||
public void textChange(final TextChangeEvent event) {
|
||||
if (event.getText().equals(oldDescriptionValue) && vendorTextField.getValue().equals(oldVendorValue)) {
|
||||
saveSoftware.setEnabled(false);
|
||||
} else {
|
||||
saveSoftware.setEnabled(true);
|
||||
}
|
||||
descTextArea.addTextChangeListener(event -> {
|
||||
if (event.getText().equals(oldDescriptionValue) && vendorTextField.getValue().equals(oldVendorValue)) {
|
||||
saveSoftware.setEnabled(false);
|
||||
} else {
|
||||
saveSoftware.setEnabled(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addVendorTextChangeListener() {
|
||||
vendorTextField.addTextChangeListener(new TextChangeListener() {
|
||||
@Override
|
||||
public void textChange(final TextChangeEvent event) {
|
||||
if (event.getText().equals(oldVendorValue) && descTextArea.getValue().equals(oldDescriptionValue)) {
|
||||
saveSoftware.setEnabled(false);
|
||||
} else {
|
||||
saveSoftware.setEnabled(true);
|
||||
}
|
||||
vendorTextField.addTextChangeListener(event -> {
|
||||
if (event.getText().equals(oldVendorValue) && descTextArea.getValue().equals(oldDescriptionValue)) {
|
||||
saveSoftware.setEnabled(false);
|
||||
} else {
|
||||
saveSoftware.setEnabled(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -280,7 +272,7 @@ public class SoftwareModuleAddUpdateWindow implements Serializable {
|
||||
final String description = HawkbitCommonUtil.trimAndNullIfEmpty(descTextArea.getValue());
|
||||
final String type = typeComboBox.getValue() != null ? typeComboBox.getValue().toString() : null;
|
||||
if (mandatoryCheck(name, version, type)) {
|
||||
if (HawkbitCommonUtil.isDuplicate(name, version)) {
|
||||
if (HawkbitCommonUtil.isDuplicate(name, version, type)) {
|
||||
uiNotifcation.displayValidationError(
|
||||
i18n.get("message.duplicate.softwaremodule", new Object[] { name, version }));
|
||||
} else {
|
||||
|
||||
@@ -97,9 +97,9 @@ public class SMTypeFilterButtons extends AbstractFilterButtons {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isClickedByDefault(final Long buttonId) {
|
||||
protected boolean isClickedByDefault(final String typeName) {
|
||||
return artifactUploadState.getSoftwareModuleFilters().getSoftwareModuleType().isPresent() && artifactUploadState
|
||||
.getSoftwareModuleFilters().getSoftwareModuleType().get().getId().equals(buttonId);
|
||||
.getSoftwareModuleFilters().getSoftwareModuleType().get().getName().equals(typeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -161,7 +161,6 @@ public class SoftwareModuleDetailsTable extends Table {
|
||||
if (null != distributionSet) {
|
||||
if (isUnassignSoftModAllowed && permissionChecker.hasUpdateDistributionPermission()) {
|
||||
try {
|
||||
distributionSetManagement.checkDistributionSetAlreadyUse(distributionSet);
|
||||
isTargetAssigned = false;
|
||||
} catch (final EntityLockedException exception) {
|
||||
isTargetAssigned = true;
|
||||
|
||||
@@ -114,7 +114,7 @@ public abstract class AbstractFilterButtons extends Table {
|
||||
typeButton.addClickListener(event -> filterButtonClickBehaviour.processFilterButtonClick(event));
|
||||
if (typeButton.getData().equals(SPUIDefinitions.NO_TAG_BUTTON_ID) && isNoTagSateSelected()) {
|
||||
filterButtonClickBehaviour.setDefaultClickedButton(typeButton);
|
||||
} else if (id != null && isClickedByDefault(id)) {
|
||||
} else if (id != null && isClickedByDefault(name)) {
|
||||
filterButtonClickBehaviour.setDefaultClickedButton(typeButton);
|
||||
}
|
||||
final DragAndDropWrapper wrapper = createDragAndDropWrapper(typeButton, name, id);
|
||||
@@ -205,10 +205,11 @@ public abstract class AbstractFilterButtons extends Table {
|
||||
/**
|
||||
* Check if button should be displayed as clicked by default.
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
* @param buttonCaption
|
||||
* button caption
|
||||
* @return true if button is clicked
|
||||
*/
|
||||
protected abstract boolean isClickedByDefault(final Long buttonId);
|
||||
protected abstract boolean isClickedByDefault(final String buttonCaption);
|
||||
|
||||
/**
|
||||
* Get filter button Id.
|
||||
|
||||
@@ -12,10 +12,7 @@ import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
|
||||
import com.vaadin.data.Container;
|
||||
import com.vaadin.data.Container.Indexed;
|
||||
import com.vaadin.shared.ui.grid.HeightMode;
|
||||
import com.vaadin.ui.Grid;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Abstract table class.
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.TagManagement;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssigmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
|
||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent.DistributionComponentEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||
@@ -100,7 +100,7 @@ public class DistributionTagToken extends AbstractTagToken {
|
||||
@Override
|
||||
protected void assignTag(final String tagNameSelected) {
|
||||
if (tagNameSelected != null) {
|
||||
final DistributionSetTagAssigmentResult result = toggleAssignment(tagNameSelected);
|
||||
final DistributionSetTagAssignmentResult result = toggleAssignment(tagNameSelected);
|
||||
if (result.getAssigned() >= 1 && NOTAGS_SELECTED) {
|
||||
eventBus.publish(this, ManagementUIEvent.ASSIGN_DISTRIBUTION_TAG);
|
||||
}
|
||||
@@ -109,10 +109,10 @@ public class DistributionTagToken extends AbstractTagToken {
|
||||
}
|
||||
}
|
||||
|
||||
private DistributionSetTagAssigmentResult toggleAssignment(final String tagNameSelected) {
|
||||
private DistributionSetTagAssignmentResult toggleAssignment(final String tagNameSelected) {
|
||||
final Set<Long> distributionList = new HashSet<>();
|
||||
distributionList.add(selectedDS.getId());
|
||||
final DistributionSetTagAssigmentResult result = distributionSetManagement.toggleTagAssignment(distributionList,
|
||||
final DistributionSetTagAssignmentResult result = distributionSetManagement.toggleTagAssignment(distributionList,
|
||||
tagNameSelected);
|
||||
uinotification.displaySuccess(HawkbitCommonUtil.getDistributionTagAssignmentMsg(tagNameSelected, result, i18n));
|
||||
return result;
|
||||
@@ -120,7 +120,7 @@ public class DistributionTagToken extends AbstractTagToken {
|
||||
|
||||
@Override
|
||||
protected void unassignTag(final String tagName) {
|
||||
final DistributionSetTagAssigmentResult result = toggleAssignment(tagName);
|
||||
final DistributionSetTagAssignmentResult result = toggleAssignment(tagName);
|
||||
if (result.getUnassigned() >= 1 && (isClickedTagListEmpty() || getClickedTagList().contains(tagName))) {
|
||||
eventBus.publish(this, ManagementUIEvent.UNASSIGN_DISTRIBUTION_TAG);
|
||||
}
|
||||
@@ -202,7 +202,7 @@ public class DistributionTagToken extends AbstractTagToken {
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onTargetTagAssigmentResultEvent(final DistributionSetTagAssigmentResultEvent event) {
|
||||
final DistributionSetTagAssigmentResult assignmentResult = event.getAssigmentResult();
|
||||
final DistributionSetTagAssignmentResult assignmentResult = event.getAssigmentResult();
|
||||
final DistributionSetTag tag = assignmentResult.getDistributionSetTag();
|
||||
if (isAssign(assignmentResult)) {
|
||||
addNewToken(tag.getId());
|
||||
@@ -212,7 +212,7 @@ public class DistributionTagToken extends AbstractTagToken {
|
||||
|
||||
}
|
||||
|
||||
protected boolean isAssign(final DistributionSetTagAssigmentResult assignmentResult) {
|
||||
protected boolean isAssign(final DistributionSetTagAssignmentResult assignmentResult) {
|
||||
if (assignmentResult.getAssigned() > 0) {
|
||||
final List<Long> assignedDsNames = assignmentResult.getAssignedDs().stream().map(t -> t.getId())
|
||||
.collect(Collectors.toList());
|
||||
@@ -223,7 +223,7 @@ public class DistributionTagToken extends AbstractTagToken {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isUnassign(final DistributionSetTagAssigmentResult assignmentResult) {
|
||||
protected boolean isUnassign(final DistributionSetTagAssignmentResult assignmentResult) {
|
||||
if (assignmentResult.getUnassigned() > 0) {
|
||||
final List<Long> assignedDsNames = assignmentResult.getUnassignedDs().stream().map(t -> t.getId())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@@ -19,7 +19,7 @@ import org.eclipse.hawkbit.eventbus.event.TargetTagUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTagAssigmentResult;
|
||||
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.management.event.TargetTableEvent.TargetComponentEvent;
|
||||
@@ -68,7 +68,7 @@ public class TargetTagToken extends AbstractTargetTagToken {
|
||||
@Override
|
||||
protected void assignTag(final String tagNameSelected) {
|
||||
if (tagNameSelected != null) {
|
||||
final TargetTagAssigmentResult result = toggleAssignment(tagNameSelected);
|
||||
final TargetTagAssignmentResult result = toggleAssignment(tagNameSelected);
|
||||
if (result.getAssigned() >= 1 && NOTAGS_SELECTED) {
|
||||
eventBus.publish(this, ManagementUIEvent.ASSIGN_TARGET_TAG);
|
||||
}
|
||||
@@ -77,17 +77,17 @@ public class TargetTagToken extends AbstractTargetTagToken {
|
||||
}
|
||||
}
|
||||
|
||||
private TargetTagAssigmentResult toggleAssignment(final String tagNameSelected) {
|
||||
private TargetTagAssignmentResult toggleAssignment(final String tagNameSelected) {
|
||||
final Set<String> targetList = new HashSet<>();
|
||||
targetList.add(selectedTarget.getControllerId());
|
||||
final TargetTagAssigmentResult result = targetManagement.toggleTagAssignment(targetList, tagNameSelected);
|
||||
final TargetTagAssignmentResult result = targetManagement.toggleTagAssignment(targetList, tagNameSelected);
|
||||
uinotification.displaySuccess(HawkbitCommonUtil.getTargetTagAssigmentMsg(tagNameSelected, result, i18n));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void unassignTag(final String tagName) {
|
||||
final TargetTagAssigmentResult result = toggleAssignment(tagName);
|
||||
final TargetTagAssignmentResult result = toggleAssignment(tagName);
|
||||
if (result.getUnassigned() >= 1 && (isClickedTagListEmpty() || getClickedTagList().contains(tagName))) {
|
||||
eventBus.publish(this, ManagementUIEvent.UNASSIGN_TARGET_TAG);
|
||||
}
|
||||
@@ -139,7 +139,7 @@ public class TargetTagToken extends AbstractTargetTagToken {
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onTargetTagAssigmentResultEvent(final TargetTagAssigmentResultEvent event) {
|
||||
final TargetTagAssigmentResult assignmentResult = event.getAssigmentResult();
|
||||
final TargetTagAssignmentResult assignmentResult = event.getAssigmentResult();
|
||||
final TargetTag targetTag = assignmentResult.getTargetTag();
|
||||
if (isAssign(assignmentResult)) {
|
||||
addNewToken(targetTag.getId());
|
||||
@@ -149,7 +149,7 @@ public class TargetTagToken extends AbstractTargetTagToken {
|
||||
|
||||
}
|
||||
|
||||
protected boolean isAssign(final TargetTagAssigmentResult assignmentResult) {
|
||||
protected boolean isAssign(final TargetTagAssignmentResult assignmentResult) {
|
||||
if (assignmentResult.getAssigned() > 0) {
|
||||
final List<String> assignedTargetNames = assignmentResult.getAssignedTargets().stream()
|
||||
.map(t -> t.getControllerId()).collect(Collectors.toList());
|
||||
@@ -160,7 +160,7 @@ public class TargetTagToken extends AbstractTargetTagToken {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isUnassign(final TargetTagAssigmentResult assignmentResult) {
|
||||
protected boolean isUnassign(final TargetTagAssignmentResult assignmentResult) {
|
||||
if (assignmentResult.getUnassigned() > 0) {
|
||||
final List<String> unassignedTargetNamesList = assignmentResult.getUnassignedTargets().stream()
|
||||
.map(t -> t.getControllerId()).collect(Collectors.toList());
|
||||
|
||||
@@ -79,10 +79,9 @@ public class DSTypeFilterButtons extends AbstractFilterButtons {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isClickedByDefault(final Long buttonId) {
|
||||
|
||||
protected boolean isClickedByDefault(final String typeName) {
|
||||
return manageDistUIState.getManageDistFilters().getClickedDistSetType() != null
|
||||
&& manageDistUIState.getManageDistFilters().getClickedDistSetType().getId().equals(buttonId);
|
||||
&& manageDistUIState.getManageDistFilters().getClickedDistSetType().getName().equals(typeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,8 +22,6 @@ import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
||||
import org.springframework.data.domain.Slice;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
|
||||
import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
|
||||
|
||||
@@ -79,9 +77,8 @@ public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem>
|
||||
final Slice<CustomSoftwareModule> swModuleBeans;
|
||||
final List<ProxyBaseSwModuleItem> proxyBeans = new ArrayList<>();
|
||||
|
||||
swModuleBeans = getSoftwareManagement().findSoftwareModuleOrderByDistribution(
|
||||
new OffsetBasedPageRequest(startIndex, count, new Sort(Direction.ASC, "name", "version")),
|
||||
orderByDistId, searchText, type);
|
||||
swModuleBeans = getSoftwareManagement().findSoftwareModuleOrderBySetAssignmentAndModuleNameAscModuleVersionAsc(
|
||||
new OffsetBasedPageRequest(startIndex, count), orderByDistId, searchText, type);
|
||||
|
||||
for (final CustomSoftwareModule swModule : swModuleBeans) {
|
||||
proxyBeans.add(getProxyBean(swModule));
|
||||
|
||||
@@ -82,10 +82,9 @@ public class DistSMTypeFilterButtons extends AbstractFilterButtons {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isClickedByDefault(final Long buttonId) {
|
||||
|
||||
protected boolean isClickedByDefault(final String typeName) {
|
||||
return manageDistUIState.getSoftwareModuleFilters().getSoftwareModuleType().isPresent()
|
||||
&& manageDistUIState.getSoftwareModuleFilters().getSoftwareModuleType().get().getId().equals(buttonId);
|
||||
&& manageDistUIState.getSoftwareModuleFilters().getSoftwareModuleType().get().getName().equals(typeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssigmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
||||
@@ -360,7 +360,7 @@ public class DistributionTable extends AbstractTable {
|
||||
final String distTagName = HawkbitCommonUtil.removePrefix(event.getTransferable().getSourceComponent().getId(),
|
||||
SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS);
|
||||
|
||||
final DistributionSetTagAssigmentResult result = distributionSetManagement.toggleTagAssignment(distList,
|
||||
final DistributionSetTagAssignmentResult result = distributionSetManagement.toggleTagAssignment(distList,
|
||||
distTagName);
|
||||
|
||||
notification.displaySuccess(HawkbitCommonUtil.getDistributionTagAssignmentMsg(distTagName, result, i18n));
|
||||
@@ -564,7 +564,7 @@ public class DistributionTable extends AbstractTable {
|
||||
.getItemProperty(SPUILabelDefinitions.VAR_DIST_ID_NAME).getValue();
|
||||
final Button pinBtn = getPinBtn(itemId, dist.getName(), dist.getVersion());
|
||||
saveDistributionPinnedBtn(pinBtn);
|
||||
pinBtn.addClickListener(event -> addPinClickListener(event));
|
||||
pinBtn.addClickListener(this::addPinClickListener);
|
||||
rePinDistribution(pinBtn, dist.getId());
|
||||
return pinBtn;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import javax.annotation.PreDestroy;
|
||||
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagCreatedBulkEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagDeletedEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.TagManagement;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtonClickBehaviour;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtons;
|
||||
@@ -58,9 +57,6 @@ public class DistributionTagButtons extends AbstractFilterButtons {
|
||||
@Autowired
|
||||
private DistributionTagDropEvent spDistTagDropEvent;
|
||||
|
||||
@Autowired
|
||||
private transient TagManagement tagMgmtService;
|
||||
|
||||
@Autowired
|
||||
private ManagementUIState managementUIState;
|
||||
|
||||
@@ -121,10 +117,9 @@ public class DistributionTagButtons extends AbstractFilterButtons {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isClickedByDefault(final Long buttonId) {
|
||||
final DistributionSetTag dsTagObject = tagMgmtService.findDistributionSetTagById(buttonId);
|
||||
protected boolean isClickedByDefault(final String tagName) {
|
||||
return null != managementUIState.getDistributionTableFilters().getDistSetTags()
|
||||
&& managementUIState.getDistributionTableFilters().getDistSetTags().contains(dsTagObject.getName());
|
||||
&& managementUIState.getDistributionTableFilters().getDistSetTags().contains(tagName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.stream.Collectors;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssigmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
|
||||
import org.eclipse.hawkbit.ui.management.state.DistributionTableFilters;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
@@ -147,7 +147,7 @@ public class DistributionTagDropEvent implements DropHandler {
|
||||
SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS);
|
||||
|
||||
final List<String> tagsClickedList = distFilterParameters.getDistSetTags();
|
||||
final DistributionSetTagAssigmentResult result = distributionSetManagement.toggleTagAssignment(distributionList,
|
||||
final DistributionSetTagAssignmentResult result = distributionSetManagement.toggleTagAssignment(distributionList,
|
||||
distTagName);
|
||||
|
||||
notification.displaySuccess(HawkbitCommonUtil.getDistributionTagAssignmentMsg(distTagName, result, i18n));
|
||||
|
||||
@@ -15,7 +15,6 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -33,7 +32,7 @@ import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||
import org.eclipse.hawkbit.repository.model.TargetInfo;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTagAssigmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
||||
import org.eclipse.hawkbit.ui.filter.FilterExpression;
|
||||
@@ -105,12 +104,11 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
@ViewScope
|
||||
public class TargetTable extends AbstractTable implements Handler {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TargetTable.class);
|
||||
private static final String TARGET_PINNED = "targetPinned";
|
||||
|
||||
private static final long serialVersionUID = -2300392868806614568L;
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TargetTable.class);
|
||||
|
||||
private static final int PROPERTY_DEPT = 3;
|
||||
private static final String ITEMID = "itemId";
|
||||
private static final String ACTION_NOT_ALLOWED_MSG = "message.action.not.allowed";
|
||||
@@ -141,8 +139,6 @@ public class TargetTable extends AbstractTable implements Handler {
|
||||
private Boolean isTargetPinned = Boolean.FALSE;
|
||||
private ShortcutAction actionSelectAll;
|
||||
private ShortcutAction actionUnSelectAll;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
@@ -329,38 +325,20 @@ public class TargetTable extends AbstractTable implements Handler {
|
||||
(source, itemId, columnId) -> getTagetPollTime(itemId));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTable#
|
||||
* isFirstRowSelectedOnLoad ()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isFirstRowSelectedOnLoad() {
|
||||
return !managementUIState.getSelectedTargetIdName().isPresent()
|
||||
|| managementUIState.getSelectedTargetIdName().get().isEmpty();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTable#getItemIdToSelect()
|
||||
*/
|
||||
@Override
|
||||
protected Object getItemIdToSelect() {
|
||||
if (managementUIState.getSelectedTargetIdName().isPresent()) {
|
||||
setCurrentPageFirstItemId(managementUIState.getLastSelectedTargetIdName());
|
||||
return managementUIState.getSelectedTargetIdName().get();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#onValueChange()
|
||||
*/
|
||||
@Override
|
||||
protected void onValueChange() {
|
||||
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||
@@ -380,23 +358,11 @@ public class TargetTable extends AbstractTable implements Handler {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#isMaximized()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isMaximized() {
|
||||
return managementUIState.isTargetTableMaximized();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTable#getTableVisibleColumns
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
protected List<TableColumn> getTableVisibleColumns() {
|
||||
final List<TableColumn> columnList = new ArrayList<>();
|
||||
@@ -453,13 +419,29 @@ public class TargetTable extends AbstractTable implements Handler {
|
||||
} else {
|
||||
shouldRefreshTargets = true;
|
||||
}
|
||||
unselect(targetIdName);
|
||||
}
|
||||
|
||||
if (shouldRefreshTargets) {
|
||||
refreshOnDelete();
|
||||
} else {
|
||||
targetContainer.commit();
|
||||
selectRow();
|
||||
}
|
||||
reSelectItemsAfterDeletionEvent();
|
||||
}
|
||||
|
||||
private void reSelectItemsAfterDeletionEvent() {
|
||||
Set<Object> values = new HashSet<>();
|
||||
if (isMultiSelect()) {
|
||||
values = new HashSet<>((Set<?>) getValue());
|
||||
} else {
|
||||
values.add(getValue());
|
||||
}
|
||||
unSelectAll();
|
||||
|
||||
for (final Object value : values) {
|
||||
if (getVisibleItemIds().contains(value)) {
|
||||
select(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -659,7 +641,7 @@ public class TargetTable extends AbstractTable implements Handler {
|
||||
}
|
||||
final String targTagName = HawkbitCommonUtil.removePrefix(event.getTransferable().getSourceComponent().getId(),
|
||||
SPUIDefinitions.TARGET_TAG_ID_PREFIXS);
|
||||
final TargetTagAssigmentResult result = targetManagement.toggleTagAssignment(targetList, targTagName);
|
||||
final TargetTagAssignmentResult result = targetManagement.toggleTagAssignment(targetList, targTagName);
|
||||
|
||||
final List<String> tagsClickedList = managementUIState.getTargetTableFilters().getClickedTargetTags();
|
||||
notification.displaySuccess(HawkbitCommonUtil.getTargetTagAssigmentMsg(targTagName, result, i18n));
|
||||
@@ -1038,7 +1020,7 @@ public class TargetTable extends AbstractTable implements Handler {
|
||||
final String[] tagArray = tagList.toArray(new String[tagList.size()]);
|
||||
|
||||
List<TargetIdName> targetIdList;
|
||||
targetIdList = targetManagement.findAllTargetIdsByFilters(pageRequest, filterByDistId, statusList, searchText,
|
||||
targetIdList = targetManagement.findAllTargetIdsByFilters(pageRequest, statusList, searchText, filterByDistId,
|
||||
noTagSelected, tagList.toArray(tagArray));
|
||||
Collections.reverse(targetIdList);
|
||||
return targetIdList;
|
||||
|
||||
@@ -19,11 +19,10 @@ import org.eclipse.hawkbit.eventbus.event.TargetTagCreatedBulkEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetTagDeletedEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetTagUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.TagManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTagAssigmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtons;
|
||||
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||
@@ -70,9 +69,6 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
|
||||
@Autowired
|
||||
private ManagementUIState managementUIState;
|
||||
|
||||
@Autowired
|
||||
private transient TagManagement tagMgmtService;
|
||||
|
||||
@Autowired
|
||||
private ManagementViewAcceptCriteria managementViewAcceptCriteria;
|
||||
|
||||
@@ -139,10 +135,9 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isClickedByDefault(final Long buttonId) {
|
||||
final TargetTag newTagClickedObj = tagMgmtService.findTargetTagById(buttonId);
|
||||
return managementUIState.getTargetTableFilters().getClickedTargetTags() != null && managementUIState
|
||||
.getTargetTableFilters().getClickedTargetTags().contains(newTagClickedObj.getName());
|
||||
protected boolean isClickedByDefault(final String tagName) {
|
||||
return managementUIState.getTargetTableFilters().getClickedTargetTags() != null
|
||||
&& managementUIState.getTargetTableFilters().getClickedTargetTags().contains(tagName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -248,7 +243,7 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
|
||||
|
||||
final List<String> tagsClickedList = managementUIState.getTargetTableFilters().getClickedTargetTags();
|
||||
|
||||
final TargetTagAssigmentResult result = targetManagement.toggleTagAssignment(targetList, targTagName);
|
||||
final TargetTagAssignmentResult result = targetManagement.toggleTagAssignment(targetList, targTagName);
|
||||
notification.displaySuccess(HawkbitCommonUtil.getTargetTagAssigmentMsg(targTagName, result, i18n));
|
||||
|
||||
if (result.getAssigned() >= 1 && managementUIState.getTargetTableFilters().isNoTagSelected()) {
|
||||
|
||||
@@ -19,15 +19,9 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagCreatedBulkEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.EntityEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.RolloutChangeEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.RolloutGroupChangeEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetCreatedEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetDeletedEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetInfoUpdateEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetTagCreatedBulkEvent;
|
||||
import org.eclipse.hawkbit.im.authentication.TenantAwareAuthenticationDetails;
|
||||
import org.eclipse.hawkbit.ui.UIEventProvider;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.security.core.context.SecurityContext;
|
||||
@@ -36,7 +30,6 @@ import org.springframework.security.web.context.HttpSessionSecurityContextReposi
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventBus.SessionEventBus;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.eventbus.AllowConcurrentEvents;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.vaadin.server.VaadinSession;
|
||||
@@ -49,15 +42,15 @@ import com.vaadin.ui.UI;
|
||||
* {@link com.google.common.eventbus.EventBus} and store them first in an queue
|
||||
* where they will dispatched every 2 seconds to the {@link EventBus} in a
|
||||
* Vaadin access thread {@link UI#access(Runnable)}.
|
||||
*
|
||||
*
|
||||
* This strategy avoids blocking UIs when too many events are fired and
|
||||
* dispatched to the UI thread. The UI will freeze in the time. To avoid that
|
||||
* all events are collected first and same events are merged to a list of events
|
||||
* before they dispatched to the UI thread.
|
||||
*
|
||||
*
|
||||
* The strategy also verifies the current tenant in the session with the tenant
|
||||
* in the event and only forwards event from the right tenant to the UI.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
|
||||
@@ -71,16 +64,11 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
|
||||
private ScheduledFuture<?> jobHandle;
|
||||
|
||||
/**
|
||||
* only events defined in the set are dispatched to the session event bus.
|
||||
*/
|
||||
private static final Set<Class<?>> UI_EVENTS = Sets.newHashSet(TargetInfoUpdateEvent.class,
|
||||
TargetCreatedEvent.class, TargetDeletedEvent.class, RolloutChangeEvent.class, RolloutGroupChangeEvent.class,
|
||||
TargetTagCreatedBulkEvent.class, DistributionSetTagCreatedBulkEvent.class);
|
||||
private final UIEventProvider eventProvider;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
*
|
||||
* @param eventBus
|
||||
* the session event bus to where the events should be dispatched
|
||||
* @param systemEventBus
|
||||
@@ -88,9 +76,10 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
* back-end
|
||||
*/
|
||||
public DelayedEventBusPushStrategy(final SessionEventBus eventBus,
|
||||
final com.google.common.eventbus.EventBus systemEventBus) {
|
||||
final com.google.common.eventbus.EventBus systemEventBus, final UIEventProvider eventProvider) {
|
||||
this.eventBus = eventBus;
|
||||
this.systemEventBus = systemEventBus;
|
||||
this.eventProvider = eventProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,12 +94,22 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
@AllowConcurrentEvents
|
||||
public void dispatch(final org.eclipse.hawkbit.eventbus.event.Event event) {
|
||||
// to dispatch too many events which are not interested on the UI
|
||||
if (UI_EVENTS.contains(event.getClass()) && !queue.offer(event)) {
|
||||
if (!isEventProvided(event)) {
|
||||
LOG.trace("Event is not supported in the UI!!! Dropped event is {}", event);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!queue.offer(event)) {
|
||||
LOG.warn("Deque limit is reached, cannot add more events!!! Dropped event is {}", event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isEventProvided(final org.eclipse.hawkbit.eventbus.event.Event event) {
|
||||
return eventProvider.getSingleEvents().contains(event.getClass())
|
||||
|| eventProvider.getBulkEvents().contains(event.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(final UI vaadinUI) {
|
||||
LOG.debug("Initialize delayed event push strategy");
|
||||
@@ -131,7 +130,7 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
/**
|
||||
* 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
|
||||
@@ -206,37 +205,43 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
final SecurityContext oldContext = SecurityContextHolder.getContext();
|
||||
try {
|
||||
SecurityContextHolder.setContext(userContext);
|
||||
|
||||
vaadinUI.access(() -> {
|
||||
if (vaadinSession.getState() != State.OPEN) {
|
||||
return;
|
||||
}
|
||||
fowardEvents(events, userContext);
|
||||
|
||||
// send a list of events, because ui performance issues
|
||||
publishEventAsList(events, userContext, TargetInfoUpdateEvent.class);
|
||||
publishEventAsList(events, userContext, TargetCreatedEvent.class);
|
||||
publishEventAsList(events, userContext, TargetDeletedEvent.class);
|
||||
fowardSingleEvents(events, userContext);
|
||||
fowardBulkEvents(events, userContext);
|
||||
});
|
||||
} finally {
|
||||
SecurityContextHolder.setContext(oldContext);
|
||||
}
|
||||
}
|
||||
|
||||
private void publishEventAsList(final List<org.eclipse.hawkbit.eventbus.event.Event> events,
|
||||
final SecurityContext userContext, final Class<?> eventType) {
|
||||
final List<org.eclipse.hawkbit.eventbus.event.Event> bulkEvents = events.stream()
|
||||
.filter(event -> DelayedEventBusPushStrategy.this.eventSecurityCheck(userContext, event)
|
||||
&& eventType.isInstance(event))
|
||||
.collect(Collectors.toList());
|
||||
if (bulkEvents.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
eventBus.publish(vaadinUI, bulkEvents);
|
||||
private void fowardBulkEvents(final List<org.eclipse.hawkbit.eventbus.event.Event> events,
|
||||
final SecurityContext userContext) {
|
||||
final Set<Class<?>> filterBulkEvenTypes = eventProvider.getFilteredBulkEventsType(events);
|
||||
publishBulkEvent(events, userContext, filterBulkEvenTypes);
|
||||
}
|
||||
|
||||
private void fowardEvents(final List<org.eclipse.hawkbit.eventbus.event.Event> events,
|
||||
private void publishBulkEvent(final List<org.eclipse.hawkbit.eventbus.event.Event> events,
|
||||
final SecurityContext userContext, final Set<Class<?>> filterBulkEvenTypes) {
|
||||
for (final Class<?> bulkType : filterBulkEvenTypes) {
|
||||
final List<org.eclipse.hawkbit.eventbus.event.Event> listBulkEvents = events.stream()
|
||||
.filter(event -> DelayedEventBusPushStrategy.this.eventSecurityCheck(userContext, event)
|
||||
&& bulkType.isInstance(event))
|
||||
.collect(Collectors.toList());
|
||||
if (!listBulkEvents.isEmpty()) {
|
||||
eventBus.publish(vaadinUI, listBulkEvents);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void fowardSingleEvents(final List<org.eclipse.hawkbit.eventbus.event.Event> events,
|
||||
final SecurityContext userContext) {
|
||||
events.stream().filter(event -> DelayedEventBusPushStrategy.this.eventSecurityCheck(userContext, event))
|
||||
events.stream()
|
||||
.filter(event -> DelayedEventBusPushStrategy.this.eventSecurityCheck(userContext, event)
|
||||
&& eventProvider.getSingleEvents().contains(event.getClass()))
|
||||
.forEach(event -> eventBus.publish(vaadinUI, event));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,13 +25,13 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.hawkbit.im.authentication.UserPrincipal;
|
||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssigmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||
import org.eclipse.hawkbit.repository.model.TargetInfo.PollStatus;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTagAssigmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus.Status;
|
||||
@@ -802,13 +802,16 @@ public final class HawkbitCommonUtil {
|
||||
* as string
|
||||
* @param version
|
||||
* as string
|
||||
* @param type
|
||||
* key as string
|
||||
* @return boolean as flag
|
||||
*/
|
||||
public static boolean isDuplicate(final String name, final String version) {
|
||||
public static boolean isDuplicate(final String name, final String version, final String type) {
|
||||
final SoftwareManagement swMgmtService = SpringContextHelper.getBean(SoftwareManagement.class);
|
||||
final List<SoftwareModule> swModulesList = swMgmtService.findSoftwareModuleByNameAndVersion(name, version);
|
||||
final SoftwareModule swModule = swMgmtService.findSoftwareModuleByNameAndVersion(name, version,
|
||||
swMgmtService.findSoftwareModuleTypeByName(type));
|
||||
boolean duplicate = false;
|
||||
if (swModulesList != null && !swModulesList.isEmpty()) {
|
||||
if (swModule != null) {
|
||||
duplicate = true;
|
||||
}
|
||||
return duplicate;
|
||||
@@ -875,7 +878,7 @@ public final class HawkbitCommonUtil {
|
||||
* I18N
|
||||
* @return message
|
||||
*/
|
||||
public static String getTargetTagAssigmentMsg(final String targTagName, final TargetTagAssigmentResult result,
|
||||
public static String getTargetTagAssigmentMsg(final String targTagName, final TargetTagAssignmentResult result,
|
||||
final I18N i18n) {
|
||||
final StringBuilder formMsg = new StringBuilder();
|
||||
final int assignedCount = result.getAssigned();
|
||||
@@ -922,7 +925,7 @@ public final class HawkbitCommonUtil {
|
||||
* @return message
|
||||
*/
|
||||
public static String getDistributionTagAssignmentMsg(final String targTagName,
|
||||
final DistributionSetTagAssigmentResult result, final I18N i18n) {
|
||||
final DistributionSetTagAssignmentResult result, final I18N i18n) {
|
||||
final StringBuilder formMsg = new StringBuilder();
|
||||
final int assignedCount = result.getAssigned();
|
||||
final int alreadyAssignedCount = result.getAlreadyAssigned();
|
||||
@@ -1359,12 +1362,12 @@ public final class HawkbitCommonUtil {
|
||||
* details of status and count
|
||||
* @return String
|
||||
*/
|
||||
public static String getFormattedString(Map<Status, Long> details) {
|
||||
StringBuilder val = new StringBuilder();
|
||||
public static String getFormattedString(final Map<Status, Long> details) {
|
||||
final StringBuilder val = new StringBuilder();
|
||||
if (details == null || details.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
for (Entry<Status, Long> entry : details.entrySet()) {
|
||||
for (final Entry<Status, Long> entry : details.entrySet()) {
|
||||
val.append(entry.getKey()).append(":").append(entry.getValue()).append(",");
|
||||
}
|
||||
return val.substring(0, val.length() - 1);
|
||||
@@ -1382,8 +1385,8 @@ public final class HawkbitCommonUtil {
|
||||
* label id
|
||||
* @return
|
||||
*/
|
||||
public static String getStatusLabelDetailsInString(String value, String style, String id) {
|
||||
StringBuilder val = new StringBuilder();
|
||||
public static String getStatusLabelDetailsInString(final String value, final String style, final String id) {
|
||||
final StringBuilder val = new StringBuilder();
|
||||
if (!Strings.isNullOrEmpty(value)) {
|
||||
val.append("value:").append(value).append(",");
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.8 KiB |
Reference in New Issue
Block a user