Remove TargetInfo entity (#453)
Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -12,7 +12,6 @@ import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
@@ -245,12 +244,10 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
|
||||
/*
|
||||
* display Attributes details in Target details.
|
||||
*/
|
||||
|
||||
protected void updateAttributesLayout(final Target target) {
|
||||
if (null != target && null != target.getTargetInfo()
|
||||
&& null != target.getTargetInfo().getControllerAttributes()) {
|
||||
protected void updateAttributesLayout(final Map<String, String> attributes) {
|
||||
if (null != attributes) {
|
||||
attributesLayout.removeAllComponents();
|
||||
for (final Map.Entry<String, String> entry : target.getTargetInfo().getControllerAttributes().entrySet()) {
|
||||
for (final Map.Entry<String, String> entry : attributes.entrySet()) {
|
||||
final Label conAttributeLabel = SPUIComponentProvider.createNameValueLabel(
|
||||
entry.getKey().concat(" : "),
|
||||
HawkbitCommonUtil.trimAndNullIfEmpty(entry.getValue()) == null ? "" : entry.getValue());
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.common.tagdetails;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.hawkbit.repository.TagManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
@@ -28,6 +25,8 @@ import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
/**
|
||||
* Implementation of Target tag token.
|
||||
*
|
||||
@@ -74,9 +73,8 @@ public class TargetTagToken extends AbstractTargetTagToken<Target> {
|
||||
}
|
||||
|
||||
private TargetTagAssignmentResult toggleAssignment(final String tagNameSelected) {
|
||||
final Set<String> targetList = new HashSet<>();
|
||||
targetList.add(selectedEntity.getControllerId());
|
||||
final TargetTagAssignmentResult result = targetManagement.toggleTagAssignment(targetList, tagNameSelected);
|
||||
final TargetTagAssignmentResult result = targetManagement
|
||||
.toggleTagAssignment(Lists.newArrayList(selectedEntity.getControllerId()), tagNameSelected);
|
||||
processTargetTagAssigmentResult(result);
|
||||
uinotification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(tagNameSelected, result, i18n));
|
||||
return result;
|
||||
@@ -99,7 +97,8 @@ public class TargetTagToken extends AbstractTargetTagToken<Target> {
|
||||
protected void displayAlreadyAssignedTags() {
|
||||
removePreviouslyAddedTokens();
|
||||
if (selectedEntity != null) {
|
||||
for (final TargetTag tag : selectedEntity.getTags()) {
|
||||
for (final TargetTag tag : tagManagement.findAllTargetTags(new PageRequest(0, MAX_TAGS),
|
||||
selectedEntity.getControllerId())) {
|
||||
addNewToken(tag.getId());
|
||||
}
|
||||
}
|
||||
@@ -114,10 +113,6 @@ public class TargetTagToken extends AbstractTargetTagToken<Target> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param assignmentResult
|
||||
*/
|
||||
public void processTargetTagAssigmentResult(final TargetTagAssignmentResult assignmentResult) {
|
||||
final TargetTag targetTag = assignmentResult.getTargetTag();
|
||||
if (isAssign(assignmentResult)) {
|
||||
@@ -129,7 +124,7 @@ public class TargetTagToken extends AbstractTargetTagToken<Target> {
|
||||
|
||||
protected boolean isAssign(final TargetTagAssignmentResult assignmentResult) {
|
||||
if (assignmentResult.getAssigned() > 0 && managementUIState.getLastSelectedTargetId() != null) {
|
||||
return assignmentResult.getAssignedEntity().stream().map(t -> t.getId())
|
||||
return assignmentResult.getAssignedEntity().stream().map(Target::getId)
|
||||
.anyMatch(controllerId -> controllerId.equals(managementUIState.getLastSelectedTargetId()));
|
||||
}
|
||||
return false;
|
||||
@@ -137,7 +132,7 @@ public class TargetTagToken extends AbstractTargetTagToken<Target> {
|
||||
|
||||
protected boolean isUnassign(final TargetTagAssignmentResult assignmentResult) {
|
||||
if (assignmentResult.getUnassigned() > 0 && managementUIState.getLastSelectedTargetId() != null) {
|
||||
return assignmentResult.getUnassignedEntity().stream().map(t -> t.getId())
|
||||
return assignmentResult.getUnassignedEntity().stream().map(Target::getId)
|
||||
.anyMatch(controllerId -> controllerId.equals(managementUIState.getLastSelectedTargetId()));
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -70,15 +70,15 @@ public abstract class AbstractNotificationView extends VerticalLayout implements
|
||||
return;
|
||||
}
|
||||
|
||||
eventContainer.getEvents().stream().filter(event -> !anyEventMatch(event)).forEach(event -> {
|
||||
eventContainer.getEvents().stream().filter(this::noEventMatch).forEach(event -> {
|
||||
notificationUnreadButton.incrementUnreadNotification(this, eventContainer);
|
||||
viewUnreadNotifcations.incrementAndGet();
|
||||
});
|
||||
getDashboardMenuItem().setNotificationUnreadValue(viewUnreadNotifcations);
|
||||
}
|
||||
|
||||
private boolean anyEventMatch(final TenantAwareEvent tenantAwareEvent) {
|
||||
return skipUiEventsCache.asMap().keySet().stream()
|
||||
private boolean noEventMatch(final TenantAwareEvent tenantAwareEvent) {
|
||||
return !skipUiEventsCache.asMap().keySet().stream()
|
||||
.anyMatch(uiEvent -> uiEvent.matchRemoteEvent(tenantAwareEvent));
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ import java.net.URI;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.PollStatus;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetInfo;
|
||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||
|
||||
/**
|
||||
@@ -58,8 +58,6 @@ public class ProxyTarget implements Serializable {
|
||||
|
||||
private Long createdAt;
|
||||
|
||||
private TargetInfo targetInfo;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -92,14 +90,6 @@ public class ProxyTarget implements Serializable {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public TargetInfo getTargetInfo() {
|
||||
return targetInfo;
|
||||
}
|
||||
|
||||
public void setTargetInfo(final TargetInfo targetInfo) {
|
||||
this.targetInfo = targetInfo;
|
||||
}
|
||||
|
||||
public String getCreatedByUser() {
|
||||
return createdByUser;
|
||||
}
|
||||
|
||||
@@ -104,21 +104,19 @@ public class CustomTargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
|
||||
prxyTarget.setName(targ.getName());
|
||||
prxyTarget.setDescription(targ.getDescription());
|
||||
prxyTarget.setControllerId(targ.getControllerId());
|
||||
prxyTarget.setInstallationDate(targ.getTargetInfo().getInstallationDate());
|
||||
prxyTarget.setAddress(targ.getTargetInfo().getAddress());
|
||||
prxyTarget.setLastTargetQuery(targ.getTargetInfo().getLastTargetQuery());
|
||||
prxyTarget.setUpdateStatus(targ.getTargetInfo().getUpdateStatus());
|
||||
prxyTarget.setInstallationDate(targ.getInstallationDate());
|
||||
prxyTarget.setAddress(targ.getAddress());
|
||||
prxyTarget.setLastTargetQuery(targ.getLastTargetQuery());
|
||||
prxyTarget.setUpdateStatus(targ.getUpdateStatus());
|
||||
prxyTarget.setLastModifiedDate(SPDateTimeUtil.getFormattedDate(targ.getLastModifiedAt()));
|
||||
prxyTarget.setCreatedDate(SPDateTimeUtil.getFormattedDate(targ.getCreatedAt()));
|
||||
prxyTarget.setCreatedAt(targ.getCreatedAt());
|
||||
prxyTarget.setCreatedByUser(UserDetailsFormatter.loadAndFormatCreatedBy(targ));
|
||||
prxyTarget.setModifiedByUser(UserDetailsFormatter.loadAndFormatLastModifiedBy(targ));
|
||||
|
||||
prxyTarget.setUpdateStatus(targ.getTargetInfo().getUpdateStatus());
|
||||
prxyTarget.setLastTargetQuery(targ.getTargetInfo().getLastTargetQuery());
|
||||
prxyTarget.setTargetInfo(targ.getTargetInfo());
|
||||
prxyTarget.setPollStatusToolTip(
|
||||
HawkbitCommonUtil.getPollStatusToolTip(prxyTarget.getTargetInfo().getPollStatus(), getI18N()));
|
||||
prxyTarget.setUpdateStatus(targ.getUpdateStatus());
|
||||
prxyTarget.setLastTargetQuery(targ.getLastTargetQuery());
|
||||
prxyTarget.setPollStatusToolTip(HawkbitCommonUtil.getPollStatusToolTip(targ.getPollStatus(), getI18N()));
|
||||
proxyTargetBeans.add(prxyTarget);
|
||||
}
|
||||
return proxyTargetBeans;
|
||||
|
||||
@@ -141,7 +141,7 @@ public class DeploymentView extends AbstractNotificationView implements BrowserW
|
||||
managementViewClientCriterion);
|
||||
this.distributionTableLayoutNew = new DistributionTableLayout(i18n, eventBus, permChecker, managementUIState,
|
||||
distributionSetManagement, managementViewClientCriterion, entityFactory, uiNotification, tagManagement,
|
||||
systemManagement, targetManagement);
|
||||
systemManagement, targetManagement, deploymentManagement);
|
||||
this.deleteAndActionsLayout = new DeleteActionsLayout(i18n, permChecker, eventBus, uiNotification,
|
||||
tagManagement, managementViewClientCriterion, managementUIState, targetManagement, targetTable,
|
||||
deploymentManagement, distributionSetManagement);
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetUpdateEvent;
|
||||
@@ -79,9 +80,10 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
||||
private final SpPermissionChecker permissionChecker;
|
||||
private final ManagementUIState managementUIState;
|
||||
private final ManagementViewClientCriterion managementViewClientCriterion;
|
||||
private final transient TargetManagement targetService;
|
||||
private final transient TargetManagement targetManagement;
|
||||
private final DsMetadataPopupLayout dsMetadataPopupLayout;
|
||||
private final transient DistributionSetManagement distributionSetManagement;
|
||||
private final transient DeploymentManagement deploymentManagement;
|
||||
|
||||
private final String notAllowedMsg;
|
||||
private boolean isDistPinned;
|
||||
@@ -89,16 +91,18 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
||||
|
||||
DistributionTable(final UIEventBus eventBus, final VaadinMessageSource i18n, final SpPermissionChecker permissionChecker,
|
||||
final UINotification notification, final ManagementUIState managementUIState,
|
||||
final ManagementViewClientCriterion managementViewClientCriterion, final TargetManagement targetService,
|
||||
final ManagementViewClientCriterion managementViewClientCriterion, final TargetManagement targetManagement,
|
||||
final DsMetadataPopupLayout dsMetadataPopupLayout,
|
||||
final DistributionSetManagement distributionSetManagement) {
|
||||
final DistributionSetManagement distributionSetManagement,
|
||||
final DeploymentManagement deploymentManagement) {
|
||||
super(eventBus, i18n, notification);
|
||||
this.permissionChecker = permissionChecker;
|
||||
this.managementUIState = managementUIState;
|
||||
this.managementViewClientCriterion = managementViewClientCriterion;
|
||||
this.targetService = targetService;
|
||||
this.targetManagement = targetManagement;
|
||||
this.dsMetadataPopupLayout = dsMetadataPopupLayout;
|
||||
this.distributionSetManagement = distributionSetManagement;
|
||||
this.deploymentManagement = deploymentManagement;
|
||||
notAllowedMsg = i18n.getMessage("message.action.not.allowed");
|
||||
|
||||
addNewContainerDS();
|
||||
@@ -391,7 +395,7 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
||||
event.getTransferable().getSourceComponent().getId(), SPUIDefinitions.TARGET_TAG_ID_PREFIXS);
|
||||
// get all the targets assigned to the tag
|
||||
// assign dist to those targets
|
||||
final List<Target> assignedTargets = targetService.findTargetsByTag(targetTagName);
|
||||
final List<Target> assignedTargets = targetManagement.findTargetsByTag(targetTagName);
|
||||
if (!assignedTargets.isEmpty()) {
|
||||
assignTargetToDs(getItem(distItemId), assignedTargets);
|
||||
} else {
|
||||
@@ -407,7 +411,7 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
||||
final AbstractSelectTargetDetails dropData = (AbstractSelectTargetDetails) event.getTargetDetails();
|
||||
|
||||
final Object distItemId = dropData.getItemIdOver();
|
||||
assignTargetToDs(getItem(distItemId), targetService.findTargetAllById(targetIdSet));
|
||||
assignTargetToDs(getItem(distItemId), targetManagement.findTargetAllById(targetIdSet));
|
||||
|
||||
}
|
||||
|
||||
@@ -522,22 +526,15 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
||||
private void styleDistributionTableOnPinning() {
|
||||
|
||||
managementUIState.getDistributionTableFilters().getPinnedTarget().map(TargetIdName::getControllerId)
|
||||
.map(targetService::findTargetByControllerIDWithDetails)
|
||||
.ifPresent(pinnedTarget -> pinnedTarget.ifPresent(target -> {
|
||||
.ifPresent(controllerId -> {
|
||||
|
||||
final Long installedDistId = deploymentManagement.getAssignedDistributionSet(controllerId)
|
||||
.map(DistributionSet::getId).orElse(null);
|
||||
final Long assignedDistId = deploymentManagement.getAssignedDistributionSet(controllerId)
|
||||
.map(DistributionSet::getId).orElse(null);
|
||||
|
||||
final DistributionSet assignedDistribution = target.getAssignedDistributionSet();
|
||||
final DistributionSet installedDistribution = target.getTargetInfo().getInstalledDistributionSet();
|
||||
Long installedDistId = null;
|
||||
Long assignedDistId = null;
|
||||
if (null != installedDistribution) {
|
||||
installedDistId = installedDistribution.getId();
|
||||
}
|
||||
if (null != assignedDistribution) {
|
||||
assignedDistId = assignedDistribution.getId();
|
||||
}
|
||||
styleDistributionSetTable(installedDistId, assignedDistId);
|
||||
}));
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private static String getPinnedDistributionStyle(final Long installedDistItemIds,
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.management.dstable;
|
||||
|
||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||
import org.eclipse.hawkbit.repository.SystemManagement;
|
||||
@@ -34,7 +35,8 @@ public class DistributionTableLayout extends AbstractTableLayout<DistributionTab
|
||||
final DistributionSetManagement distributionSetManagement,
|
||||
final ManagementViewClientCriterion managementViewClientCriterion, final EntityFactory entityFactory,
|
||||
final UINotification notification, final TagManagement tagManagement,
|
||||
final SystemManagement systemManagement, final TargetManagement targetService) {
|
||||
final SystemManagement systemManagement, final TargetManagement targetManagement,
|
||||
final DeploymentManagement deploymentManagement) {
|
||||
|
||||
final DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout = new DistributionAddUpdateWindowLayout(
|
||||
i18n, notification, eventBus, distributionSetManagement, systemManagement, entityFactory, null);
|
||||
@@ -43,8 +45,8 @@ public class DistributionTableLayout extends AbstractTableLayout<DistributionTab
|
||||
distributionSetManagement, entityFactory, permissionChecker);
|
||||
|
||||
final DistributionTable distributionTable = new DistributionTable(eventBus, i18n, permissionChecker,
|
||||
notification, managementUIState, managementViewClientCriterion, targetService, dsMetadataPopupLayout,
|
||||
distributionSetManagement);
|
||||
notification, managementUIState, managementViewClientCriterion, targetManagement, dsMetadataPopupLayout,
|
||||
distributionSetManagement, deploymentManagement);
|
||||
|
||||
super.init(new DistributionTableHeader(i18n, permissionChecker, eventBus, managementUIState), distributionTable,
|
||||
new DistributionDetails(i18n, eventBus, permissionChecker, managementUIState, distributionSetManagement,
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||
import org.eclipse.hawkbit.repository.FilterParams;
|
||||
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
@@ -23,10 +24,10 @@ import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||
import org.eclipse.hawkbit.ui.components.ProxyTarget;
|
||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Slice;
|
||||
import org.springframework.data.domain.Sort;
|
||||
@@ -53,6 +54,7 @@ public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
|
||||
private String searchText;
|
||||
private Boolean noTagClicked;
|
||||
private transient TargetManagement targetManagement;
|
||||
private transient DeploymentManagement deploymentManagement;
|
||||
private transient VaadinMessageSource i18N;
|
||||
private Long pinnedDistId;
|
||||
private Long targetFilterQueryId;
|
||||
@@ -129,10 +131,10 @@ public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
|
||||
prxyTarget.setName(targ.getName());
|
||||
prxyTarget.setDescription(targ.getDescription());
|
||||
prxyTarget.setControllerId(targ.getControllerId());
|
||||
prxyTarget.setInstallationDate(targ.getTargetInfo().getInstallationDate());
|
||||
prxyTarget.setAddress(targ.getTargetInfo().getAddress());
|
||||
prxyTarget.setLastTargetQuery(targ.getTargetInfo().getLastTargetQuery());
|
||||
prxyTarget.setUpdateStatus(targ.getTargetInfo().getUpdateStatus());
|
||||
prxyTarget.setInstallationDate(targ.getInstallationDate());
|
||||
prxyTarget.setAddress(targ.getAddress());
|
||||
prxyTarget.setLastTargetQuery(targ.getLastTargetQuery());
|
||||
prxyTarget.setUpdateStatus(targ.getUpdateStatus());
|
||||
prxyTarget.setLastModifiedDate(SPDateTimeUtil.getFormattedDate(targ.getLastModifiedAt()));
|
||||
prxyTarget.setCreatedDate(SPDateTimeUtil.getFormattedDate(targ.getCreatedAt()));
|
||||
prxyTarget.setCreatedAt(targ.getCreatedAt());
|
||||
@@ -143,17 +145,15 @@ public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
|
||||
prxyTarget.setInstalledDistributionSet(null);
|
||||
prxyTarget.setAssignedDistributionSet(null);
|
||||
} else {
|
||||
getTargetManagement().findTargetByControllerIDWithDetails(targ.getControllerId()).ifPresent(target -> {
|
||||
prxyTarget.setInstalledDistributionSet(target.getTargetInfo().getInstalledDistributionSet());
|
||||
prxyTarget.setAssignedDistributionSet(target.getAssignedDistributionSet());
|
||||
});
|
||||
getDeploymentManagement().getAssignedDistributionSet(targ.getControllerId())
|
||||
.ifPresent(prxyTarget::setAssignedDistributionSet);
|
||||
getDeploymentManagement().getInstalledDistributionSet(targ.getControllerId())
|
||||
.ifPresent(prxyTarget::setInstalledDistributionSet);
|
||||
}
|
||||
|
||||
prxyTarget.setUpdateStatus(targ.getTargetInfo().getUpdateStatus());
|
||||
prxyTarget.setLastTargetQuery(targ.getTargetInfo().getLastTargetQuery());
|
||||
prxyTarget.setTargetInfo(targ.getTargetInfo());
|
||||
prxyTarget.setPollStatusToolTip(
|
||||
HawkbitCommonUtil.getPollStatusToolTip(prxyTarget.getTargetInfo().getPollStatus(), getI18N()));
|
||||
prxyTarget.setUpdateStatus(targ.getUpdateStatus());
|
||||
prxyTarget.setLastTargetQuery(targ.getLastTargetQuery());
|
||||
prxyTarget.setPollStatusToolTip(HawkbitCommonUtil.getPollStatusToolTip(targ.getPollStatus(), getI18N()));
|
||||
proxyTargetBeans.add(prxyTarget);
|
||||
}
|
||||
return proxyTargetBeans;
|
||||
@@ -214,6 +214,13 @@ public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
|
||||
return targetManagement;
|
||||
}
|
||||
|
||||
private DeploymentManagement getDeploymentManagement() {
|
||||
if (deploymentManagement == null) {
|
||||
deploymentManagement = SpringContextHelper.getBean(DeploymentManagement.class);
|
||||
}
|
||||
return deploymentManagement;
|
||||
}
|
||||
|
||||
private ManagementUIState getManagementUIState() {
|
||||
if (managementUIState == null) {
|
||||
managementUIState = SpringContextHelper.getBean(ManagementUIState.class);
|
||||
|
||||
@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.ui.management.targettable;
|
||||
import java.net.URI;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||
import org.eclipse.hawkbit.repository.TagManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
@@ -56,18 +57,24 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
|
||||
|
||||
private final TargetAddUpdateWindowLayout targetAddUpdateWindowLayout;
|
||||
|
||||
private final transient TargetManagement targetManagement;
|
||||
|
||||
private final transient DeploymentManagement deploymentManagement;
|
||||
|
||||
private VerticalLayout assignedDistLayout;
|
||||
private VerticalLayout installedDistLayout;
|
||||
|
||||
TargetDetails(final VaadinMessageSource i18n, final UIEventBus eventBus, final SpPermissionChecker permissionChecker,
|
||||
final ManagementUIState managementUIState, final UINotification uiNotification,
|
||||
final TagManagement tagManagement, final TargetManagement targetManagement,
|
||||
final EntityFactory entityFactory) {
|
||||
final DeploymentManagement deploymentManagement, final EntityFactory entityFactory) {
|
||||
super(i18n, eventBus, permissionChecker, managementUIState);
|
||||
this.targetTagToken = new TargetTagToken(permissionChecker, i18n, uiNotification, eventBus, managementUIState,
|
||||
tagManagement, targetManagement);
|
||||
targetAddUpdateWindowLayout = new TargetAddUpdateWindowLayout(i18n, targetManagement, eventBus, uiNotification,
|
||||
entityFactory);
|
||||
this.targetManagement = targetManagement;
|
||||
this.deploymentManagement = deploymentManagement;
|
||||
addTabs(detailsTab);
|
||||
restoreState();
|
||||
}
|
||||
@@ -141,18 +148,22 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
|
||||
@Override
|
||||
protected void populateDetailsWidget() {
|
||||
if (getSelectedBaseEntity() != null) {
|
||||
updateDetailsLayout(getSelectedBaseEntity().getControllerId(),
|
||||
getSelectedBaseEntity().getTargetInfo().getAddress(), getSelectedBaseEntity().getSecurityToken(),
|
||||
SPDateTimeUtil.getFormattedDate(getSelectedBaseEntity().getTargetInfo().getLastTargetQuery()));
|
||||
populateDistributionDtls(installedDistLayout,
|
||||
getSelectedBaseEntity().getTargetInfo().getInstalledDistributionSet());
|
||||
populateDistributionDtls(assignedDistLayout, getSelectedBaseEntity().getAssignedDistributionSet());
|
||||
updateAttributesLayout(targetManagement.getControllerAttributes(getSelectedBaseEntity().getControllerId()));
|
||||
|
||||
updateDetailsLayout(getSelectedBaseEntity().getControllerId(), getSelectedBaseEntity().getAddress(),
|
||||
getSelectedBaseEntity().getSecurityToken(),
|
||||
SPDateTimeUtil.getFormattedDate(getSelectedBaseEntity().getLastTargetQuery()));
|
||||
|
||||
populateDistributionDtls(installedDistLayout, deploymentManagement
|
||||
.getAssignedDistributionSet(getSelectedBaseEntity().getControllerId()).orElse(null));
|
||||
populateDistributionDtls(assignedDistLayout, deploymentManagement
|
||||
.getInstalledDistributionSet(getSelectedBaseEntity().getControllerId()).orElse(null));
|
||||
} else {
|
||||
updateDetailsLayout(null, null, null, null);
|
||||
populateDistributionDtls(installedDistLayout, null);
|
||||
populateDistributionDtls(assignedDistLayout, null);
|
||||
}
|
||||
updateAttributesLayout(getSelectedBaseEntity());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,7 +27,6 @@ import org.eclipse.hawkbit.repository.event.remote.entity.RemoteEntityEvent;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.Tag;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetInfo;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||
@@ -145,9 +144,9 @@ public class TargetTable extends AbstractTable<Target, Long> {
|
||||
if (isFilterEnabled()) {
|
||||
refreshTargets();
|
||||
} else {
|
||||
eventContainer.getEvents().stream().filter(event -> visibleItemIds.contains(event.getEntityId())).filter(
|
||||
event -> !Objects.isNull(event.getEntity()) && !Objects.isNull(event.getEntity().getTargetInfo()))
|
||||
.forEach(event -> updateVisibleItemOnEvent(event.getEntity().getTargetInfo()));
|
||||
eventContainer.getEvents().stream().filter(event -> visibleItemIds.contains(event.getEntityId()))
|
||||
.filter(event -> !Objects.isNull(event.getEntity()))
|
||||
.forEach(event -> updateVisibleItemOnEvent(event.getEntity()));
|
||||
}
|
||||
publishTargetSelectedEntityForRefresh(eventContainer.getEvents().stream());
|
||||
}
|
||||
@@ -668,15 +667,13 @@ public class TargetTable extends AbstractTable<Target, Long> {
|
||||
* registered for the target update status. That listener will
|
||||
* update the new status icon showing for this target in the table.
|
||||
*/
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS)
|
||||
.setValue(updatedTarget.getTargetInfo().getUpdateStatus());
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS).setValue(updatedTarget.getUpdateStatus());
|
||||
/*
|
||||
* Update the last query which will trigger the value change lister
|
||||
* registered for the target last query column. That listener will
|
||||
* update the latest query date for this target in the tooltip.
|
||||
*/
|
||||
item.getItemProperty(SPUILabelDefinitions.LAST_QUERY_DATE)
|
||||
.setValue(updatedTarget.getTargetInfo().getLastTargetQuery());
|
||||
item.getItemProperty(SPUILabelDefinitions.LAST_QUERY_DATE).setValue(updatedTarget.getLastTargetQuery());
|
||||
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY)
|
||||
.setValue(UserDetailsFormatter.loadAndFormatLastModifiedBy(updatedTarget));
|
||||
@@ -784,17 +781,16 @@ public class TargetTable extends AbstractTable<Target, Long> {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void updateVisibleItemOnEvent(final TargetInfo targetInfo) {
|
||||
final Target target = targetInfo.getTarget();
|
||||
private void updateVisibleItemOnEvent(final Target target) {
|
||||
final Long targetId = target.getId();
|
||||
|
||||
final LazyQueryContainer targetContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
final Item item = targetContainer.getItem(targetId);
|
||||
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS).setValue(targetInfo.getUpdateStatus());
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS).setValue(target.getUpdateStatus());
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_NAME).setValue(target.getName());
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_POLL_STATUS_TOOL_TIP)
|
||||
.setValue(HawkbitCommonUtil.getPollStatusToolTip(targetInfo.getPollStatus(), i18n));
|
||||
.setValue(HawkbitCommonUtil.getPollStatusToolTip(target.getPollStatus(), i18n));
|
||||
}
|
||||
|
||||
private boolean isLastSelectedTarget(final Long targetId) {
|
||||
|
||||
@@ -50,7 +50,7 @@ public class TargetTableLayout extends AbstractTableLayout<TargetTable> {
|
||||
final Executor uiExecutor) {
|
||||
this.eventBus = eventBus;
|
||||
this.targetDetails = new TargetDetails(i18n, eventbus, permissionChecker, managementUIState, uinotification,
|
||||
tagManagement, targetManagement, entityFactory);
|
||||
tagManagement, targetManagement, deploymentManagement, entityFactory);
|
||||
this.targetTableHeader = new TargetTableHeader(i18n, permissionChecker, eventBus, notification,
|
||||
managementUIState, managementViewClientCriterion, targetManagement, deploymentManagement, uiproperties,
|
||||
eventbus, entityFactory, uinotification, tagManagement, distributionSetManagement, uiExecutor);
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.eclipse.hawkbit.repository.model.TargetWithActionStatus;
|
||||
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||
import org.eclipse.hawkbit.ui.components.ProxyTarget;
|
||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
||||
@@ -106,9 +105,9 @@ public class RolloutGroupTargetsBeanQuery extends AbstractBeanQuery<ProxyTarget>
|
||||
prxyTarget.setName(targ.getName());
|
||||
prxyTarget.setDescription(targ.getDescription());
|
||||
prxyTarget.setControllerId(targ.getControllerId());
|
||||
prxyTarget.setInstallationDate(targ.getTargetInfo().getInstallationDate());
|
||||
prxyTarget.setAddress(targ.getTargetInfo().getAddress());
|
||||
prxyTarget.setLastTargetQuery(targ.getTargetInfo().getLastTargetQuery());
|
||||
prxyTarget.setInstallationDate(targ.getInstallationDate());
|
||||
prxyTarget.setAddress(targ.getAddress());
|
||||
prxyTarget.setLastTargetQuery(targ.getLastTargetQuery());
|
||||
prxyTarget.setLastModifiedDate(SPDateTimeUtil.getFormattedDate(targ.getLastModifiedAt()));
|
||||
prxyTarget.setCreatedDate(SPDateTimeUtil.getFormattedDate(targ.getCreatedAt()));
|
||||
prxyTarget.setCreatedAt(targ.getCreatedAt());
|
||||
@@ -117,13 +116,8 @@ public class RolloutGroupTargetsBeanQuery extends AbstractBeanQuery<ProxyTarget>
|
||||
if (targetWithActionStatus.getStatus() != null) {
|
||||
prxyTarget.setStatus(targetWithActionStatus.getStatus());
|
||||
}
|
||||
prxyTarget.setLastTargetQuery(targ.getTargetInfo().getLastTargetQuery());
|
||||
prxyTarget.setTargetInfo(targ.getTargetInfo());
|
||||
prxyTarget.setLastTargetQuery(targ.getLastTargetQuery());
|
||||
prxyTarget.setId(targ.getId());
|
||||
if (targ.getAssignedDistributionSet() != null) {
|
||||
prxyTarget.setAssignedDistNameVersion(HawkbitCommonUtil.getFormattedNameVersion(
|
||||
targ.getAssignedDistributionSet().getName(), targ.getAssignedDistributionSet().getVersion()));
|
||||
}
|
||||
return prxyTarget;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user