introduced paging while retrieving the target/ds tags (#1006)
Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>
This commit is contained in:
@@ -33,8 +33,6 @@ import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||
*/
|
||||
public abstract class AbstractTagToken<T extends ProxyNamedEntity>
|
||||
implements TagAssignmentListener, MasterEntityAwareComponent<T> {
|
||||
protected static final int MAX_TAG_QUERY = 1000;
|
||||
|
||||
protected TagPanelLayout tagPanelLayout;
|
||||
|
||||
protected final SpPermissionChecker checker;
|
||||
|
||||
@@ -24,9 +24,9 @@ import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTag;
|
||||
import org.eclipse.hawkbit.ui.common.event.EntityModifiedEventPayload;
|
||||
import org.eclipse.hawkbit.ui.common.event.EntityModifiedEventPayload.EntityModifiedEventType;
|
||||
import org.eclipse.hawkbit.ui.common.event.EventTopics;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||
|
||||
/**
|
||||
@@ -106,15 +106,16 @@ public class DistributionTagToken extends AbstractTagToken<ProxyDistributionSet>
|
||||
|
||||
@Override
|
||||
protected List<ProxyTag> getAllTags() {
|
||||
return distributionSetTagManagement.findAll(PageRequest.of(0, MAX_TAG_QUERY)).getContent().stream()
|
||||
return HawkbitCommonUtil.getEntitiesByPageableProvider(distributionSetTagManagement::findAll).stream()
|
||||
.map(tagMapper::map).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<ProxyTag> getAssignedTags() {
|
||||
return getMasterEntity().map(masterEntity -> distributionSetTagManagement
|
||||
.findByDistributionSet(PageRequest.of(0, MAX_TAG_QUERY), masterEntity.getId()).getContent().stream()
|
||||
.map(tagMapper::map).collect(Collectors.toList())).orElse(Collections.emptyList());
|
||||
return getMasterEntity().map(masterEntity -> HawkbitCommonUtil
|
||||
.getEntitiesByPageableProvider(
|
||||
p -> distributionSetTagManagement.findByDistributionSet(p, masterEntity.getId()))
|
||||
.stream().map(tagMapper::map).collect(Collectors.toList())).orElse(Collections.emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,9 +24,9 @@ import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTarget;
|
||||
import org.eclipse.hawkbit.ui.common.event.EntityModifiedEventPayload;
|
||||
import org.eclipse.hawkbit.ui.common.event.EntityModifiedEventPayload.EntityModifiedEventType;
|
||||
import org.eclipse.hawkbit.ui.common.event.EventTopics;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||
|
||||
/**
|
||||
@@ -106,15 +106,15 @@ public class TargetTagToken extends AbstractTagToken<ProxyTarget> {
|
||||
|
||||
@Override
|
||||
protected List<ProxyTag> getAllTags() {
|
||||
return targetTagManagement.findAll(PageRequest.of(0, MAX_TAG_QUERY)).stream()
|
||||
return HawkbitCommonUtil.getEntitiesByPageableProvider(targetTagManagement::findAll).stream()
|
||||
.map(tag -> new ProxyTag(tag.getId(), tag.getName(), tag.getColour())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<ProxyTag> getAssignedTags() {
|
||||
return getMasterEntity().map(masterEntity -> targetTagManagement
|
||||
.findByTarget(PageRequest.of(0, MAX_TAG_QUERY), masterEntity.getControllerId()).stream()
|
||||
.map(tagMapper::map).collect(Collectors.toList())).orElse(Collections.emptyList());
|
||||
return getMasterEntity().map(masterEntity -> HawkbitCommonUtil
|
||||
.getEntitiesByPageableProvider(p -> targetTagManagement.findByTarget(p, masterEntity.getControllerId()))
|
||||
.stream().map(tagMapper::map).collect(Collectors.toList())).orElse(Collections.emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,9 +20,9 @@ import org.eclipse.hawkbit.ui.common.data.mappers.TagToProxyTagMapper;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTag;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTarget;
|
||||
import org.eclipse.hawkbit.ui.common.tagdetails.AbstractTagToken;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||
|
||||
@@ -60,7 +60,7 @@ public class TargetBulkTokenTags extends AbstractTagToken<ProxyTarget> {
|
||||
|
||||
@Override
|
||||
protected List<ProxyTag> getAllTags() {
|
||||
return tagManagement.findAll(PageRequest.of(0, MAX_TAG_QUERY)).stream()
|
||||
return HawkbitCommonUtil.getEntitiesByPageableProvider(tagManagement::findAll).stream()
|
||||
.map(tag -> new ProxyTag(tag.getId(), tag.getName(), tag.getColour())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user