Entity details are updated after view change, delete and filtering (#486)
* Distribution Set Details are shown correctly. Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Fix Distribution Set details shows the right data Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Show the right Details when deleting target, ds and sm Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Software Module details are shown correctly on view change Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Caption Artifact Details of is updated correctly after software module deletion Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Artifact Details are shown correctly, small css improvements Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Code refactor Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Fix search of softwareModule and DistributionSet in UI Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Fix typos, insert ids for components Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Code Refactor Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Redo add access Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Correct caption Id of new dist. set, remove unnecessary event Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Fix selected entity in SwModuleTable, Code refactor Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Fix error in Upload View concerning selected softwareModule Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Remove Optional, Remove StringUtils, refactor code Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Refactor events when filtering distribution set or software module Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Fix Sonar issues Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Save softwareMmoduleId in ArtifactUploadState, not whole entity Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Refactor event handling for filtering sw and ds; refactor optional handling Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Make selectedSoftwareModule transient Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Remove mysql properties Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Refactor ArtifactDetailsLayout Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Fix comment Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Fix some comments Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Generalize common behavior in selecting entity in a table Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Optional is not set in the getter but in the setter in the UIState classes Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Fix sonar issue Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Change getter visibility to protected Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Refactor publishSelectedEntity Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Refactor Java Docs Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Fix pull request comments Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Fix comments Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Change lastSelectedEntities/selectedEntities to type Long,remove Generic Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Show details captions even when table is empty Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>
This commit is contained in:
committed by
Kai Zimmermann
parent
3da33dd486
commit
7b2e93a727
@@ -730,12 +730,12 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
|||||||
|
|
||||||
Specification<JpaDistributionSet> spec;
|
Specification<JpaDistributionSet> spec;
|
||||||
|
|
||||||
if (null != distributionSetFilter.getIsComplete()) {
|
if (distributionSetFilter.getIsComplete() != null) {
|
||||||
spec = DistributionSetSpecification.isCompleted(distributionSetFilter.getIsComplete());
|
spec = DistributionSetSpecification.isCompleted(distributionSetFilter.getIsComplete());
|
||||||
specList.add(spec);
|
specList.add(spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null != distributionSetFilter.getIsDeleted()) {
|
if (distributionSetFilter.getIsDeleted() != null) {
|
||||||
spec = DistributionSetSpecification.isDeleted(distributionSetFilter.getIsDeleted());
|
spec = DistributionSetSpecification.isDeleted(distributionSetFilter.getIsDeleted());
|
||||||
specList.add(spec);
|
specList.add(spec);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
|
|||||||
if (srcGroup.getTargetFilterQuery() != null) {
|
if (srcGroup.getTargetFilterQuery() != null) {
|
||||||
group.setTargetFilterQuery(srcGroup.getTargetFilterQuery());
|
group.setTargetFilterQuery(srcGroup.getTargetFilterQuery());
|
||||||
} else {
|
} else {
|
||||||
group.setTargetFilterQuery(StringUtils.EMPTY);
|
group.setTargetFilterQuery("");
|
||||||
}
|
}
|
||||||
|
|
||||||
group.setSuccessCondition(srcGroup.getSuccessCondition());
|
group.setSuccessCondition(srcGroup.getSuccessCondition());
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
|||||||
import org.eclipse.hawkbit.ui.artifacts.upload.UploadLayout;
|
import org.eclipse.hawkbit.ui.artifacts.upload.UploadLayout;
|
||||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.dd.criteria.UploadViewClientCriterion;
|
import org.eclipse.hawkbit.ui.dd.criteria.UploadViewClientCriterion;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.vaadin.spring.events.EventBus;
|
import org.vaadin.spring.events.EventBus;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
@@ -57,8 +57,9 @@ import com.vaadin.ui.VerticalLayout;
|
|||||||
@SpringView(name = UploadArtifactView.VIEW_NAME, ui = HawkbitUI.class)
|
@SpringView(name = UploadArtifactView.VIEW_NAME, ui = HawkbitUI.class)
|
||||||
public class UploadArtifactView extends VerticalLayout implements View, BrowserWindowResizeListener {
|
public class UploadArtifactView extends VerticalLayout implements View, BrowserWindowResizeListener {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public static final String VIEW_NAME = "spUpload";
|
public static final String VIEW_NAME = "spUpload";
|
||||||
private static final long serialVersionUID = 8754632011301553682L;
|
|
||||||
|
|
||||||
private final transient EventBus.UIEventBus eventBus;
|
private final transient EventBus.UIEventBus eventBus;
|
||||||
|
|
||||||
@@ -85,6 +86,7 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
|
|||||||
private HorizontalLayout uplaodButtonsLayout;
|
private HorizontalLayout uplaodButtonsLayout;
|
||||||
|
|
||||||
private GridLayout mainLayout;
|
private GridLayout mainLayout;
|
||||||
|
|
||||||
private DragAndDropWrapper dadw;
|
private DragAndDropWrapper dadw;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -103,9 +105,9 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
|
|||||||
this.smTableLayout = new SoftwareModuleTableLayout(i18n, permChecker, artifactUploadState, uiNotification,
|
this.smTableLayout = new SoftwareModuleTableLayout(i18n, permChecker, artifactUploadState, uiNotification,
|
||||||
eventBus, softwareManagement, entityFactory, uploadViewClientCriterion);
|
eventBus, softwareManagement, entityFactory, uploadViewClientCriterion);
|
||||||
this.artifactDetailsLayout = new ArtifactDetailsLayout(i18n, eventBus, artifactUploadState, uiNotification,
|
this.artifactDetailsLayout = new ArtifactDetailsLayout(i18n, eventBus, artifactUploadState, uiNotification,
|
||||||
artifactManagement);
|
artifactManagement, softwareManagement);
|
||||||
this.uploadLayout = new UploadLayout(i18n, uiNotification, eventBus, artifactUploadState,
|
this.uploadLayout = new UploadLayout(i18n, uiNotification, eventBus, artifactUploadState,
|
||||||
multipartConfigElement, artifactManagement);
|
multipartConfigElement, artifactManagement, softwareManagement);
|
||||||
this.deleteActionsLayout = new SMDeleteActionsLayout(i18n, permChecker, eventBus, uiNotification,
|
this.deleteActionsLayout = new SMDeleteActionsLayout(i18n, permChecker, eventBus, uiNotification,
|
||||||
artifactUploadState, softwareManagement, uploadViewClientCriterion);
|
artifactUploadState, softwareManagement, uploadViewClientCriterion);
|
||||||
}
|
}
|
||||||
@@ -163,7 +165,6 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
|
|||||||
|
|
||||||
private VerticalLayout createDetailsAndUploadLayout() {
|
private VerticalLayout createDetailsAndUploadLayout() {
|
||||||
detailAndUploadLayout = new VerticalLayout();
|
detailAndUploadLayout = new VerticalLayout();
|
||||||
|
|
||||||
detailAndUploadLayout.addComponent(artifactDetailsLayout);
|
detailAndUploadLayout.addComponent(artifactDetailsLayout);
|
||||||
detailAndUploadLayout.setComponentAlignment(artifactDetailsLayout, Alignment.MIDDLE_CENTER);
|
detailAndUploadLayout.setComponentAlignment(artifactDetailsLayout, Alignment.MIDDLE_CENTER);
|
||||||
|
|
||||||
@@ -178,7 +179,6 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
|
|||||||
detailAndUploadLayout.addStyleName("group");
|
detailAndUploadLayout.addStyleName("group");
|
||||||
detailAndUploadLayout.setSpacing(true);
|
detailAndUploadLayout.setSpacing(true);
|
||||||
return detailAndUploadLayout;
|
return detailAndUploadLayout;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private GridLayout createMainLayout() {
|
private GridLayout createMainLayout() {
|
||||||
@@ -205,7 +205,6 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
|
|||||||
if (permChecker.hasCreateDistributionPermission()) {
|
if (permChecker.hasCreateDistributionPermission()) {
|
||||||
uplaodButtonsLayout = uploadLayout.getFileUploadLayout();
|
uplaodButtonsLayout = uploadLayout.getFileUploadLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void minimizeSwTable() {
|
private void minimizeSwTable() {
|
||||||
@@ -250,12 +249,10 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
|
|||||||
private void removeOtherComponents() {
|
private void removeOtherComponents() {
|
||||||
mainLayout.removeComponent(deleteActionsLayout);
|
mainLayout.removeComponent(deleteActionsLayout);
|
||||||
mainLayout.removeComponent(uplaodButtonsLayout);
|
mainLayout.removeComponent(uplaodButtonsLayout);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkNoDataAvaialble() {
|
private void checkNoDataAvaialble() {
|
||||||
if (artifactUploadState.isNoDataAvilableSoftwareModule()) {
|
if (artifactUploadState.isNoDataAvilableSoftwareModule()) {
|
||||||
|
|
||||||
uiNotification.displayValidationError(i18n.getMessage("message.no.data"));
|
uiNotification.displayValidationError(i18n.getMessage("message.no.data"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -267,7 +264,6 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
|
|||||||
|
|
||||||
private void showOrHideFilterButtons(final int browserWidth) {
|
private void showOrHideFilterButtons(final int browserWidth) {
|
||||||
if (browserWidth < SPUIDefinitions.REQ_MIN_BROWSER_WIDTH) {
|
if (browserWidth < SPUIDefinitions.REQ_MIN_BROWSER_WIDTH) {
|
||||||
|
|
||||||
filterByTypeLayout.setVisible(false);
|
filterByTypeLayout.setVisible(false);
|
||||||
smTableLayout.setShowFilterButtonVisible(true);
|
smTableLayout.setShowFilterButtonVisible(true);
|
||||||
} else if (!artifactUploadState.isSwTypeFilterClosed()) {
|
} else if (!artifactUploadState.isSwTypeFilterClosed()) {
|
||||||
@@ -278,7 +274,8 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enter(final ViewChangeEvent event) {
|
public void enter(final ViewChangeEvent event) {
|
||||||
// This view is constructed in the init() method()
|
smTableLayout.getSoftwareModuleTable()
|
||||||
|
.selectEntity(artifactUploadState.getSelectedBaseSwModuleId().orElse(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,11 @@ import java.util.Collections;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||||
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.ArtifactDetailsEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.ArtifactDetailsEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
|
||||||
@@ -26,12 +29,12 @@ import org.eclipse.hawkbit.ui.components.SPUIButton;
|
|||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
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.SPDateTimeUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
||||||
@@ -61,7 +64,7 @@ import com.vaadin.ui.themes.ValoTheme;
|
|||||||
*/
|
*/
|
||||||
public class ArtifactDetailsLayout extends VerticalLayout {
|
public class ArtifactDetailsLayout extends VerticalLayout {
|
||||||
|
|
||||||
private static final long serialVersionUID = -5189069028037133891L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private static final String PROVIDED_FILE_NAME = "filename";
|
private static final String PROVIDED_FILE_NAME = "filename";
|
||||||
|
|
||||||
@@ -101,35 +104,65 @@ public class ArtifactDetailsLayout extends VerticalLayout {
|
|||||||
|
|
||||||
private final transient ArtifactManagement artifactManagement;
|
private final transient ArtifactManagement artifactManagement;
|
||||||
|
|
||||||
|
private final transient SoftwareManagement softwareManagement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for ArtifactDetailsLayout
|
||||||
|
*
|
||||||
|
* @param i18n
|
||||||
|
* VaadinMessageSource
|
||||||
|
* @param eventBus
|
||||||
|
* UIEventBus
|
||||||
|
* @param artifactUploadState
|
||||||
|
* ArtifactUploadState
|
||||||
|
* @param uINotification
|
||||||
|
* UINotification
|
||||||
|
* @param artifactManagement
|
||||||
|
* ArtifactManagement
|
||||||
|
* @param softwareManagement
|
||||||
|
* SoftwareManagement
|
||||||
|
*/
|
||||||
public ArtifactDetailsLayout(final VaadinMessageSource i18n, final UIEventBus eventBus,
|
public ArtifactDetailsLayout(final VaadinMessageSource i18n, final UIEventBus eventBus,
|
||||||
final ArtifactUploadState artifactUploadState, final UINotification uINotification,
|
final ArtifactUploadState artifactUploadState, final UINotification uINotification,
|
||||||
final ArtifactManagement artifactManagement) {
|
final ArtifactManagement artifactManagement, final SoftwareManagement softwareManagement) {
|
||||||
this.i18n = i18n;
|
this.i18n = i18n;
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.artifactUploadState = artifactUploadState;
|
this.artifactUploadState = artifactUploadState;
|
||||||
this.uINotification = uINotification;
|
this.uINotification = uINotification;
|
||||||
this.artifactManagement = artifactManagement;
|
this.artifactManagement = artifactManagement;
|
||||||
|
this.softwareManagement = softwareManagement;
|
||||||
|
|
||||||
createComponents();
|
final Optional<SoftwareModule> selectedSoftwareModule = findSelectedSoftwareModule();
|
||||||
|
|
||||||
|
String labelSoftwareModule = "";
|
||||||
|
if (selectedSoftwareModule.isPresent()) {
|
||||||
|
labelSoftwareModule = HawkbitCommonUtil.getFormattedNameVersion(selectedSoftwareModule.get().getName(),
|
||||||
|
selectedSoftwareModule.get().getVersion());
|
||||||
|
}
|
||||||
|
createComponents(labelSoftwareModule);
|
||||||
buildLayout();
|
buildLayout();
|
||||||
eventBus.subscribe(this);
|
eventBus.subscribe(this);
|
||||||
artifactUploadState.getSelectedBaseSoftwareModule()
|
|
||||||
.ifPresent(selectedSoftwareModule -> populateArtifactDetails(selectedSoftwareModule.getId(),
|
if (selectedSoftwareModule.isPresent()) {
|
||||||
HawkbitCommonUtil.getFormattedNameVersion(selectedSoftwareModule.getName(),
|
populateArtifactDetails(selectedSoftwareModule.get().getId(), labelSoftwareModule);
|
||||||
selectedSoftwareModule.getVersion())));
|
}
|
||||||
|
|
||||||
if (isMaximized()) {
|
if (isMaximized()) {
|
||||||
maximizedArtifactDetailsView();
|
maximizedArtifactDetailsView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createComponents() {
|
private Optional<SoftwareModule> findSelectedSoftwareModule() {
|
||||||
final String labelStr = artifactUploadState.getSelectedBaseSoftwareModule()
|
final Optional<Long> selectedBaseSwModuleId = artifactUploadState.getSelectedBaseSwModuleId();
|
||||||
.map(softwareModule -> HawkbitCommonUtil.getFormattedNameVersion(softwareModule.getName(),
|
if (selectedBaseSwModuleId.isPresent()) {
|
||||||
softwareModule.getVersion()))
|
return softwareManagement.findSoftwareModuleById(selectedBaseSwModuleId.get());
|
||||||
.orElse("");
|
}
|
||||||
titleOfArtifactDetails = new LabelBuilder().name(HawkbitCommonUtil.getArtifactoryDetailsLabelId(labelStr))
|
return Optional.empty();
|
||||||
.buildCaptionLabel();
|
}
|
||||||
|
|
||||||
|
private void createComponents(final String labelSoftwareModule) {
|
||||||
|
titleOfArtifactDetails = new LabelBuilder().id(UIComponentIdProvider.ARTIFACT_DETAILS_HEADER_LABEL_ID)
|
||||||
|
.name(HawkbitCommonUtil.getArtifactoryDetailsLabelId(labelSoftwareModule)).buildCaptionLabel();
|
||||||
titleOfArtifactDetails.setContentMode(ContentMode.HTML);
|
titleOfArtifactDetails.setContentMode(ContentMode.HTML);
|
||||||
titleOfArtifactDetails.setSizeFull();
|
titleOfArtifactDetails.setSizeFull();
|
||||||
titleOfArtifactDetails.setImmediate(true);
|
titleOfArtifactDetails.setImmediate(true);
|
||||||
@@ -143,21 +176,17 @@ public class ArtifactDetailsLayout extends VerticalLayout {
|
|||||||
addGeneratedColumnButton(artifactDetailsTable);
|
addGeneratedColumnButton(artifactDetailsTable);
|
||||||
}
|
}
|
||||||
setTableColumnDetails(artifactDetailsTable);
|
setTableColumnDetails(artifactDetailsTable);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private SPUIButton createMaxMinButton() {
|
private SPUIButton createMaxMinButton() {
|
||||||
final SPUIButton button = (SPUIButton) SPUIComponentProvider.getButton(SPUIDefinitions.EXPAND_ACTION_HISTORY,
|
final SPUIButton button = (SPUIButton) SPUIComponentProvider.getButton(SPUIDefinitions.EXPAND_ACTION_HISTORY,
|
||||||
"", "", null, true, FontAwesome.EXPAND, SPUIButtonStyleSmallNoBorder.class);
|
"", "", null, true, FontAwesome.EXPAND, SPUIButtonStyleSmallNoBorder.class);
|
||||||
button.addClickListener(event -> maxArtifactDetails());
|
button.addClickListener(event -> maxArtifactDetails());
|
||||||
return button;
|
return button;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildLayout() {
|
private void buildLayout() {
|
||||||
|
|
||||||
final HorizontalLayout header = new HorizontalLayout();
|
final HorizontalLayout header = new HorizontalLayout();
|
||||||
header.addStyleName("artifact-details-header");
|
header.addStyleName("artifact-details-header");
|
||||||
header.addStyleName("bordered-layout");
|
header.addStyleName("bordered-layout");
|
||||||
@@ -181,7 +210,6 @@ public class ArtifactDetailsLayout extends VerticalLayout {
|
|||||||
addComponent(artifactDetailsTable);
|
addComponent(artifactDetailsTable);
|
||||||
setComponentAlignment(artifactDetailsTable, Alignment.MIDDLE_CENTER);
|
setComponentAlignment(artifactDetailsTable, Alignment.MIDDLE_CENTER);
|
||||||
setExpandRatio(artifactDetailsTable, 1.0F);
|
setExpandRatio(artifactDetailsTable, 1.0F);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Container createArtifactLazyQueryContainer() {
|
private Container createArtifactLazyQueryContainer() {
|
||||||
@@ -210,9 +238,9 @@ public class ArtifactDetailsLayout extends VerticalLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addGeneratedColumn(final Table table) {
|
private static void addGeneratedColumn(final Table table) {
|
||||||
table.addGeneratedColumn(CREATE_MODIFIED_DATE_UPLOAD, new ColumnGenerator() {
|
table.addGeneratedColumn(CREATE_MODIFIED_DATE_UPLOAD, new ColumnGenerator() {
|
||||||
private static final long serialVersionUID = -866800417175863258L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String generateCell(final Table source, final Object itemId, final Object columnId) {
|
public String generateCell(final Table source, final Object itemId, final Object columnId) {
|
||||||
@@ -226,12 +254,11 @@ public class ArtifactDetailsLayout extends VerticalLayout {
|
|||||||
return SPDateTimeUtil.getFormattedDate(createdDate);
|
return SPDateTimeUtil.getFormattedDate(createdDate);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addGeneratedColumnButton(final Table table) {
|
private void addGeneratedColumnButton(final Table table) {
|
||||||
table.addGeneratedColumn(ACTION, new ColumnGenerator() {
|
table.addGeneratedColumn(ACTION, new ColumnGenerator() {
|
||||||
private static final long serialVersionUID = -866800417175863258L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Button generateCell(final Table source, final Object itemId, final Object columnId) {
|
public Button generateCell(final Table source, final Object itemId, final Object columnId) {
|
||||||
@@ -246,21 +273,22 @@ public class ArtifactDetailsLayout extends VerticalLayout {
|
|||||||
return deleteIcon;
|
return deleteIcon;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void confirmAndDeleteArtifact(final Long id, final String fileName) {
|
private void confirmAndDeleteArtifact(final Long id, final String fileName) {
|
||||||
|
final ConfirmationDialog confirmDialog = new ConfirmationDialog(
|
||||||
final ConfirmationDialog confirmDialog = new ConfirmationDialog(i18n.getMessage("caption.delete.artifact.confirmbox"),
|
i18n.getMessage("caption.delete.artifact.confirmbox"),
|
||||||
i18n.getMessage("message.delete.artifact", new Object[] { fileName }), i18n.getMessage("button.ok"),
|
i18n.getMessage("message.delete.artifact", new Object[] { fileName }), i18n.getMessage("button.ok"),
|
||||||
i18n.getMessage("button.cancel"), ok -> {
|
i18n.getMessage("button.cancel"), ok -> {
|
||||||
if (ok) {
|
if (ok) {
|
||||||
artifactManagement.deleteArtifact(id);
|
artifactManagement.deleteArtifact(id);
|
||||||
uINotification.displaySuccess(i18n.getMessage("message.artifact.deleted", fileName));
|
uINotification.displaySuccess(i18n.getMessage("message.artifact.deleted", fileName));
|
||||||
if (artifactUploadState.getSelectedBaseSwModuleId().isPresent()) {
|
final Optional<SoftwareModule> softwareModule = findSelectedSoftwareModule();
|
||||||
populateArtifactDetails(artifactUploadState.getSelectedBaseSwModuleId().get(),
|
if (softwareModule.isPresent()) {
|
||||||
HawkbitCommonUtil.getFormattedNameVersion(
|
populateArtifactDetails(softwareModule.get().getId(),
|
||||||
artifactUploadState.getSelectedBaseSoftwareModule().get().getName(),
|
HawkbitCommonUtil.getFormattedNameVersion(softwareModule.get().getName(),
|
||||||
artifactUploadState.getSelectedBaseSoftwareModule().get().getVersion()));
|
softwareModule.get().getVersion()));
|
||||||
} else {
|
} else {
|
||||||
populateArtifactDetails(null, null);
|
populateArtifactDetails(null, null);
|
||||||
}
|
}
|
||||||
@@ -268,7 +296,6 @@ public class ArtifactDetailsLayout extends VerticalLayout {
|
|||||||
});
|
});
|
||||||
UI.getCurrent().addWindow(confirmDialog.getWindow());
|
UI.getCurrent().addWindow(confirmDialog.getWindow());
|
||||||
confirmDialog.getWindow().bringToFront();
|
confirmDialog.getWindow().bringToFront();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setTableColumnDetails(final Table table) {
|
private void setTableColumnDetails(final Table table) {
|
||||||
@@ -285,7 +312,7 @@ public class ArtifactDetailsLayout extends VerticalLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
table.setColumnExpandRatio(PROVIDED_FILE_NAME, 3.5F);
|
table.setColumnExpandRatio(PROVIDED_FILE_NAME, 3.5F);
|
||||||
table.setColumnExpandRatio(SIZE, 2f);
|
table.setColumnExpandRatio(SIZE, 2F);
|
||||||
if (fullWindowMode) {
|
if (fullWindowMode) {
|
||||||
table.setColumnExpandRatio(SHA1HASH, 2.8F);
|
table.setColumnExpandRatio(SHA1HASH, 2.8F);
|
||||||
table.setColumnExpandRatio(MD5HASH, 2.4F);
|
table.setColumnExpandRatio(MD5HASH, 2.4F);
|
||||||
@@ -313,7 +340,7 @@ public class ArtifactDetailsLayout extends VerticalLayout {
|
|||||||
return visibileColumn;
|
return visibileColumn;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Table createArtifactDetailsTable() {
|
private static Table createArtifactDetailsTable() {
|
||||||
final Table detailsTable = new Table();
|
final Table detailsTable = new Table();
|
||||||
detailsTable.addStyleName("sp-table");
|
detailsTable.addStyleName("sp-table");
|
||||||
|
|
||||||
@@ -417,7 +444,6 @@ public class ArtifactDetailsLayout extends VerticalLayout {
|
|||||||
maxArtifactDetailsTable.setContainerDataSource(artifactContainer);
|
maxArtifactDetailsTable.setContainerDataSource(artifactContainer);
|
||||||
}
|
}
|
||||||
setTableColumnDetails(artifactDetailsTable);
|
setTableColumnDetails(artifactDetailsTable);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -430,18 +456,8 @@ public class ArtifactDetailsLayout extends VerticalLayout {
|
|||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
@EventBusListenerMethod(scope = EventScope.UI)
|
||||||
void onEvent(final SoftwareModuleEvent softwareModuleEvent) {
|
void onEvent(final SoftwareModuleEvent softwareModuleEvent) {
|
||||||
if (BaseEntityEventType.SELECTED_ENTITY == softwareModuleEvent.getEventType()) {
|
if (softwareModuleEvent.getEventType() == BaseEntityEventType.SELECTED_ENTITY
|
||||||
UI.getCurrent().access(() -> {
|
|| softwareModuleEvent.getSoftwareModuleEventType() == SoftwareModuleEventType.ARTIFACTS_CHANGED) {
|
||||||
if (softwareModuleEvent.getEntity() != null) {
|
|
||||||
populateArtifactDetails(softwareModuleEvent.getEntity().getId(),
|
|
||||||
HawkbitCommonUtil.getFormattedNameVersion(softwareModuleEvent.getEntity().getName(),
|
|
||||||
softwareModuleEvent.getEntity().getVersion()));
|
|
||||||
} else {
|
|
||||||
populateArtifactDetails(null, null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (softwareModuleEvent.getSoftwareModuleEventType() == SoftwareModuleEventType.ARTIFACTS_CHANGED) {
|
|
||||||
UI.getCurrent().access(() -> {
|
UI.getCurrent().access(() -> {
|
||||||
if (softwareModuleEvent.getEntity() != null) {
|
if (softwareModuleEvent.getEntity() != null) {
|
||||||
populateArtifactDetails(softwareModuleEvent.getEntity().getId(),
|
populateArtifactDetails(softwareModuleEvent.getEntity().getId(),
|
||||||
|
|||||||
@@ -8,19 +8,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.artifacts.event;
|
package org.eclipse.hawkbit.ui.artifacts.event;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseUIEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Software module filter events.
|
* Software module filter event. Is thrown when there is a filter action on a
|
||||||
*
|
* software module table on the Distribution or Upload View. It is possible to
|
||||||
*
|
* filter by text or type.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public enum SMFilterEvent {
|
public class RefreshSoftwareModuleByFilterEvent extends BaseUIEvent {
|
||||||
|
|
||||||
FILTER_BY_TYPE,
|
|
||||||
|
|
||||||
FILTER_BY_TEXT,
|
|
||||||
|
|
||||||
REMOVER_FILTER_BY_TYPE,
|
|
||||||
|
|
||||||
REMOVER_FILTER_BY_TEXT
|
|
||||||
}
|
}
|
||||||
@@ -17,10 +17,10 @@ import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
|||||||
import org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout;
|
import org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout;
|
||||||
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
||||||
import org.eclipse.hawkbit.ui.dd.criteria.UploadViewClientCriterion;
|
import org.eclipse.hawkbit.ui.dd.criteria.UploadViewClientCriterion;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
import org.vaadin.spring.events.EventScope;
|
import org.vaadin.spring.events.EventScope;
|
||||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||||
@@ -45,8 +45,8 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
|
|
||||||
private final UploadViewClientCriterion uploadViewClientCriterion;
|
private final UploadViewClientCriterion uploadViewClientCriterion;
|
||||||
|
|
||||||
public SMDeleteActionsLayout(final VaadinMessageSource i18n, final SpPermissionChecker permChecker, final UIEventBus eventBus,
|
public SMDeleteActionsLayout(final VaadinMessageSource i18n, final SpPermissionChecker permChecker,
|
||||||
final UINotification notification, final ArtifactUploadState artifactUploadState,
|
final UIEventBus eventBus, final UINotification notification, final ArtifactUploadState artifactUploadState,
|
||||||
final SoftwareManagement softwareManagement, final UploadViewClientCriterion uploadViewClientCriterion) {
|
final SoftwareManagement softwareManagement, final UploadViewClientCriterion uploadViewClientCriterion) {
|
||||||
super(i18n, permChecker, eventBus, notification);
|
super(i18n, permChecker, eventBus, notification);
|
||||||
this.artifactUploadState = artifactUploadState;
|
this.artifactUploadState = artifactUploadState;
|
||||||
@@ -146,8 +146,7 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addToDeleteList(final Table sourceTable, final TableTransferable transferable) {
|
private void addToDeleteList(final Table sourceTable, final TableTransferable transferable) {
|
||||||
@SuppressWarnings("unchecked")
|
final AbstractTable<?> swTable = (AbstractTable<?>) sourceTable;
|
||||||
final AbstractTable<?, Long> swTable = (AbstractTable<?, Long>) sourceTable;
|
|
||||||
final Set<Long> swModuleIdNameSet = swTable.getDeletedEntityByTransferable(transferable);
|
final Set<Long> swModuleIdNameSet = swTable.getDeletedEntityByTransferable(transferable);
|
||||||
|
|
||||||
swModuleIdNameSet.forEach(id -> {
|
swModuleIdNameSet.forEach(id -> {
|
||||||
|
|||||||
@@ -15,16 +15,18 @@ import java.util.Set;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||||
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.state.CustomFile;
|
import org.eclipse.hawkbit.ui.artifacts.state.CustomFile;
|
||||||
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.AbstractConfirmationWindowLayout;
|
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.AbstractConfirmationWindowLayout;
|
||||||
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.ConfirmationTab;
|
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.ConfirmationTab;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
@@ -37,11 +39,11 @@ import com.vaadin.ui.Button.ClickListener;
|
|||||||
import com.vaadin.ui.Table.Align;
|
import com.vaadin.ui.Table.Align;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract layout of confirm actions window.
|
* Layout of confirm actions window on the Upload View.
|
||||||
*/
|
*/
|
||||||
public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWindowLayout {
|
public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWindowLayout {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1804036019105286988L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private static final String SW_MODULE_NAME_MSG = "SW MOdule Name";
|
private static final String SW_MODULE_NAME_MSG = "SW MOdule Name";
|
||||||
|
|
||||||
@@ -63,13 +65,14 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, ConfirmationTab> getConfimrationTabs() {
|
protected Map<String, ConfirmationTab> getConfirmationTabs() {
|
||||||
final Map<String, ConfirmationTab> tabs = Maps.newHashMapWithExpectedSize(2);
|
final Map<String, ConfirmationTab> tabs = Maps.newHashMapWithExpectedSize(2);
|
||||||
if (!artifactUploadState.getDeleteSofwareModules().isEmpty()) {
|
if (!artifactUploadState.getDeleteSofwareModules().isEmpty()) {
|
||||||
tabs.put(i18n.getMessage("caption.delete.swmodule.accordion.tab"), createSMDeleteConfirmationTab());
|
tabs.put(i18n.getMessage("caption.delete.swmodule.accordion.tab"), createSMDeleteConfirmationTab());
|
||||||
}
|
}
|
||||||
if (!artifactUploadState.getSelectedDeleteSWModuleTypes().isEmpty()) {
|
if (!artifactUploadState.getSelectedDeleteSWModuleTypes().isEmpty()) {
|
||||||
tabs.put(i18n.getMessage("caption.delete.sw.module.type.accordion.tab"), createSMtypeDeleteConfirmationTab());
|
tabs.put(i18n.getMessage("caption.delete.sw.module.type.accordion.tab"),
|
||||||
|
createSMtypeDeleteConfirmationTab());
|
||||||
}
|
}
|
||||||
return tabs;
|
return tabs;
|
||||||
}
|
}
|
||||||
@@ -144,6 +147,8 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
|
|||||||
private void deleteSMAll(final ConfirmationTab tab) {
|
private void deleteSMAll(final ConfirmationTab tab) {
|
||||||
final Set<Long> swmoduleIds = artifactUploadState.getDeleteSofwareModules().keySet();
|
final Set<Long> swmoduleIds = artifactUploadState.getDeleteSofwareModules().keySet();
|
||||||
softwareManagement.deleteSoftwareModules(swmoduleIds);
|
softwareManagement.deleteSoftwareModules(swmoduleIds);
|
||||||
|
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.REMOVE_ENTITY, swmoduleIds));
|
||||||
|
|
||||||
addToConsolitatedMsg(FontAwesome.TRASH_O.getHtml() + SPUILabelDefinitions.HTML_SPACE
|
addToConsolitatedMsg(FontAwesome.TRASH_O.getHtml() + SPUILabelDefinitions.HTML_SPACE
|
||||||
+ i18n.getMessage("message.swModule.deleted", artifactUploadState.getDeleteSofwareModules().size()));
|
+ i18n.getMessage("message.swModule.deleted", artifactUploadState.getDeleteSofwareModules().size()));
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -24,18 +24,20 @@ import org.eclipse.hawkbit.ui.common.SoftwareModuleTypeBeanQuery;
|
|||||||
import org.eclipse.hawkbit.ui.common.builder.TextAreaBuilder;
|
import org.eclipse.hawkbit.ui.common.builder.TextAreaBuilder;
|
||||||
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
|
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
|
||||||
import org.eclipse.hawkbit.ui.common.builder.WindowBuilder;
|
import org.eclipse.hawkbit.ui.common.builder.WindowBuilder;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
||||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||||
import org.vaadin.spring.events.EventBus;
|
import org.vaadin.spring.events.EventBus;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
|
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
import com.vaadin.ui.ComboBox;
|
import com.vaadin.ui.ComboBox;
|
||||||
import com.vaadin.ui.CustomComponent;
|
import com.vaadin.ui.CustomComponent;
|
||||||
import com.vaadin.ui.FormLayout;
|
import com.vaadin.ui.FormLayout;
|
||||||
@@ -49,7 +51,7 @@ import com.vaadin.ui.themes.ValoTheme;
|
|||||||
*/
|
*/
|
||||||
public class SoftwareModuleAddUpdateWindow extends CustomComponent {
|
public class SoftwareModuleAddUpdateWindow extends CustomComponent {
|
||||||
|
|
||||||
private static final long serialVersionUID = -5217675246477211483L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final VaadinMessageSource i18n;
|
private final VaadinMessageSource i18n;
|
||||||
|
|
||||||
@@ -77,6 +79,8 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
|
|||||||
|
|
||||||
private FormLayout formLayout;
|
private FormLayout formLayout;
|
||||||
|
|
||||||
|
private final AbstractTable<SoftwareModule> softwareModuleTable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for SoftwareModuleAddUpdateWindow
|
* Constructor for SoftwareModuleAddUpdateWindow
|
||||||
*
|
*
|
||||||
@@ -91,13 +95,15 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
|
|||||||
* @param entityFactory
|
* @param entityFactory
|
||||||
* EntityFactory
|
* EntityFactory
|
||||||
*/
|
*/
|
||||||
public SoftwareModuleAddUpdateWindow(final VaadinMessageSource i18n, final UINotification uiNotifcation, final UIEventBus eventBus,
|
public SoftwareModuleAddUpdateWindow(final VaadinMessageSource i18n, final UINotification uiNotifcation,
|
||||||
final SoftwareManagement softwareManagement, final EntityFactory entityFactory) {
|
final UIEventBus eventBus, final SoftwareManagement softwareManagement, final EntityFactory entityFactory,
|
||||||
|
final AbstractTable<SoftwareModule> softwareModuleTable) {
|
||||||
this.i18n = i18n;
|
this.i18n = i18n;
|
||||||
this.uiNotifcation = uiNotifcation;
|
this.uiNotifcation = uiNotifcation;
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.softwareManagement = softwareManagement;
|
this.softwareManagement = softwareManagement;
|
||||||
this.entityFactory = entityFactory;
|
this.entityFactory = entityFactory;
|
||||||
|
this.softwareModuleTable = softwareModuleTable;
|
||||||
|
|
||||||
createRequiredComponents();
|
createRequiredComponents();
|
||||||
}
|
}
|
||||||
@@ -133,12 +139,10 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
|
|||||||
.type(softwareModuleTypeByName).name(name).version(version).description(description).vendor(vendor);
|
.type(softwareModuleTypeByName).name(name).version(version).description(description).vendor(vendor);
|
||||||
|
|
||||||
final SoftwareModule newSoftwareModule = softwareManagement.createSoftwareModule(softwareModule);
|
final SoftwareModule newSoftwareModule = softwareManagement.createSoftwareModule(softwareModule);
|
||||||
|
|
||||||
if (newSoftwareModule != null) {
|
|
||||||
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.ADD_ENTITY, newSoftwareModule));
|
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.ADD_ENTITY, newSoftwareModule));
|
||||||
uiNotifcation.displaySuccess(i18n.getMessage("message.save.success",
|
uiNotifcation.displaySuccess(i18n.getMessage("message.save.success",
|
||||||
new Object[] { newSoftwareModule.getName() + ":" + newSoftwareModule.getVersion() }));
|
new Object[] { newSoftwareModule.getName() + ":" + newSoftwareModule.getVersion() }));
|
||||||
}
|
softwareModuleTable.setValue(Sets.newHashSet(newSoftwareModule.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isDuplicate() {
|
private boolean isDuplicate() {
|
||||||
@@ -173,7 +177,7 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create window for new software module.
|
* Creates window for new software module.
|
||||||
*
|
*
|
||||||
* @return reference of {@link com.vaadin.ui.Window} to add new software
|
* @return reference of {@link com.vaadin.ui.Window} to add new software
|
||||||
* module.
|
* module.
|
||||||
@@ -183,10 +187,10 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create window for update software module.
|
* Creates window for update software module.
|
||||||
*
|
*
|
||||||
* @param baseSwModuleId
|
* @param baseSwModuleId
|
||||||
* is id of the software module to edit.
|
* id of the software module to edit.
|
||||||
* @return reference of {@link com.vaadin.ui.Window} to update software
|
* @return reference of {@link com.vaadin.ui.Window} to update software
|
||||||
* module.
|
* module.
|
||||||
*/
|
*/
|
||||||
@@ -206,17 +210,18 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
|
|||||||
|
|
||||||
vendorTextField = createTextField("textfield.vendor", UIComponentIdProvider.SOFT_MODULE_VENDOR);
|
vendorTextField = createTextField("textfield.vendor", UIComponentIdProvider.SOFT_MODULE_VENDOR);
|
||||||
vendorTextField.setRequired(false);
|
vendorTextField.setRequired(false);
|
||||||
vendorTextField.setNullRepresentation(StringUtils.EMPTY);
|
vendorTextField.setNullRepresentation("");
|
||||||
|
|
||||||
descTextArea = new TextAreaBuilder().caption(i18n.getMessage("textfield.description")).style("text-area-style")
|
descTextArea = new TextAreaBuilder().caption(i18n.getMessage("textfield.description")).style("text-area-style")
|
||||||
.prompt(i18n.getMessage("textfield.description")).id(UIComponentIdProvider.ADD_SW_MODULE_DESCRIPTION)
|
.prompt(i18n.getMessage("textfield.description")).id(UIComponentIdProvider.ADD_SW_MODULE_DESCRIPTION)
|
||||||
.buildTextComponent();
|
.buildTextComponent();
|
||||||
descTextArea.setNullRepresentation(StringUtils.EMPTY);
|
descTextArea.setNullRepresentation("");
|
||||||
|
|
||||||
typeComboBox = SPUIComponentProvider.getComboBox(i18n.getMessage("upload.swmodule.type"), "", null, null, true, null,
|
typeComboBox = SPUIComponentProvider.getComboBox(i18n.getMessage("upload.swmodule.type"), "", null, null, true,
|
||||||
i18n.getMessage("upload.swmodule.type"));
|
null, i18n.getMessage("upload.swmodule.type"));
|
||||||
typeComboBox.setId(UIComponentIdProvider.SW_MODULE_TYPE);
|
typeComboBox.setId(UIComponentIdProvider.SW_MODULE_TYPE);
|
||||||
typeComboBox.setStyleName(SPUIDefinitions.COMBO_BOX_SPECIFIC_STYLE + " " + ValoTheme.COMBOBOX_TINY);
|
typeComboBox
|
||||||
|
.setStyleName(SPUIDefinitions.COMBO_BOX_SPECIFIC_STYLE + StringUtils.SPACE + ValoTheme.COMBOBOX_TINY);
|
||||||
typeComboBox.setNewItemsAllowed(Boolean.FALSE);
|
typeComboBox.setNewItemsAllowed(Boolean.FALSE);
|
||||||
typeComboBox.setImmediate(Boolean.TRUE);
|
typeComboBox.setImmediate(Boolean.TRUE);
|
||||||
}
|
}
|
||||||
@@ -233,7 +238,6 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void resetComponents() {
|
private void resetComponents() {
|
||||||
|
|
||||||
vendorTextField.clear();
|
vendorTextField.clear();
|
||||||
nameTextField.clear();
|
nameTextField.clear();
|
||||||
versionTextField.clear();
|
versionTextField.clear();
|
||||||
@@ -265,7 +269,6 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
|
|||||||
nameTextField.setEnabled(!editSwModule);
|
nameTextField.setEnabled(!editSwModule);
|
||||||
versionTextField.setEnabled(!editSwModule);
|
versionTextField.setEnabled(!editSwModule);
|
||||||
typeComboBox.setEnabled(!editSwModule);
|
typeComboBox.setEnabled(!editSwModule);
|
||||||
|
|
||||||
typeComboBox.focus();
|
typeComboBox.focus();
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
|
|||||||
@@ -38,11 +38,6 @@ public class SoftwareModuleDetails extends AbstractSoftwareModuleDetails {
|
|||||||
restoreState();
|
restoreState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean onLoadIsTableRowSelected() {
|
|
||||||
return artifactUploadState.getSelectedBaseSoftwareModule().isPresent();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onLoadIsTableMaximized() {
|
protected boolean onLoadIsTableMaximized() {
|
||||||
return artifactUploadState.isSwModuleTableMaximized();
|
return artifactUploadState.isSwModuleTableMaximized();
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import java.util.Optional;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.RefreshSoftwareModuleByFilterEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||||
@@ -26,13 +26,14 @@ import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
|||||||
import org.eclipse.hawkbit.ui.distributions.smtable.SwMetadataPopupLayout;
|
import org.eclipse.hawkbit.ui.distributions.smtable.SwMetadataPopupLayout;
|
||||||
import org.eclipse.hawkbit.ui.push.SoftwareModuleUpdatedEventContainer;
|
import org.eclipse.hawkbit.ui.push.SoftwareModuleUpdatedEventContainer;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.TableColumn;
|
import org.eclipse.hawkbit.ui.utils.TableColumn;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
|
import org.eclipse.hawkbit.ui.view.filter.OnlyEventsFromUploadArtifactViewFilter;
|
||||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
||||||
@@ -53,9 +54,9 @@ import com.vaadin.ui.UI;
|
|||||||
/**
|
/**
|
||||||
* The Software module table.
|
* The Software module table.
|
||||||
*/
|
*/
|
||||||
public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModule, Long> {
|
public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModule> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 6469417305487144809L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final ArtifactUploadState artifactUploadState;
|
private final ArtifactUploadState artifactUploadState;
|
||||||
|
|
||||||
@@ -80,16 +81,9 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
|
|||||||
setDataAvailable(getContainerDataSource().size() != 0);
|
setDataAvailable(getContainerDataSource().size() != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
@EventBusListenerMethod(scope = EventScope.UI, filter = OnlyEventsFromUploadArtifactViewFilter.class)
|
||||||
void onEvent(final SMFilterEvent filterEvent) {
|
void onEvent(final RefreshSoftwareModuleByFilterEvent filterEvent) {
|
||||||
UI.getCurrent().access(() -> {
|
UI.getCurrent().access(this::refreshFilter);
|
||||||
|
|
||||||
if (filterEvent == SMFilterEvent.FILTER_BY_TYPE || filterEvent == SMFilterEvent.FILTER_BY_TEXT
|
|
||||||
|| filterEvent == SMFilterEvent.REMOVER_FILTER_BY_TYPE
|
|
||||||
|| filterEvent == SMFilterEvent.REMOVER_FILTER_BY_TEXT) {
|
|
||||||
refreshFilter();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -140,7 +134,8 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object getItemIdToSelect() {
|
protected Object getItemIdToSelect() {
|
||||||
return artifactUploadState.getSelectedSoftwareModules();
|
return artifactUploadState.getSelectedSoftwareModules().isEmpty() ? null
|
||||||
|
: artifactUploadState.getSelectedSoftwareModules();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -154,13 +149,12 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ArtifactUploadState getManagmentEntityState() {
|
protected ArtifactUploadState getManagementEntityState() {
|
||||||
return artifactUploadState;
|
return artifactUploadState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void publishEntityAfterValueChange(final SoftwareModule lastSoftwareModule) {
|
protected void publishSelectedEntityEvent(final SoftwareModule lastSoftwareModule) {
|
||||||
artifactUploadState.setSelectedBaseSoftwareModule(lastSoftwareModule);
|
|
||||||
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.SELECTED_ENTITY, lastSoftwareModule));
|
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.SELECTED_ENTITY, lastSoftwareModule));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,12 +172,10 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
|
|||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
@EventBusListenerMethod(scope = EventScope.UI)
|
||||||
void onSoftwareModuleUpdateEvents(final SoftwareModuleUpdatedEventContainer eventContainer) {
|
void onSoftwareModuleUpdateEvents(final SoftwareModuleUpdatedEventContainer eventContainer) {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
final List<Long> visibleItemIds = (List<Long>) getVisibleItemIds();
|
final List<Long> visibleItemIds = (List<Long>) getVisibleItemIds();
|
||||||
|
|
||||||
eventContainer.getEvents().stream().filter(event -> visibleItemIds.contains(event.getEntityId()))
|
eventContainer.getEvents().stream().filter(event -> visibleItemIds.contains(event.getEntityId()))
|
||||||
.forEach(event -> updateSoftwareModuleInTable(event.getEntity()));
|
.forEach(event -> updateSoftwareModuleInTable(event.getEntity()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSoftwareModuleInTable(final SoftwareModule editedSm) {
|
private void updateSoftwareModuleInTable(final SoftwareModule editedSm) {
|
||||||
@@ -205,7 +197,8 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
|
|||||||
@Override
|
@Override
|
||||||
protected void addCustomGeneratedColumns() {
|
protected void addCustomGeneratedColumns() {
|
||||||
addGeneratedColumn(SPUILabelDefinitions.METADATA_ICON, new ColumnGenerator() {
|
addGeneratedColumn(SPUILabelDefinitions.METADATA_ICON, new ColumnGenerator() {
|
||||||
private static final long serialVersionUID = 117186282275044399L;
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object generateCell(final Table source, final Object itemId, final Object columnId) {
|
public Object generateCell(final Table source, final Object itemId, final Object columnId) {
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
package org.eclipse.hawkbit.ui.artifacts.smtable;
|
package org.eclipse.hawkbit.ui.artifacts.smtable;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
|
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||||
|
import org.eclipse.hawkbit.ui.artifacts.event.RefreshSoftwareModuleByFilterEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||||
import org.eclipse.hawkbit.ui.common.table.AbstractSoftwareModuleTableHeader;
|
import org.eclipse.hawkbit.ui.common.table.AbstractSoftwareModuleTableHeader;
|
||||||
@@ -42,51 +42,50 @@ public class SoftwareModuleTableHeader extends AbstractSoftwareModuleTableHeader
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String onLoadSearchBoxValue() {
|
protected String onLoadSearchBoxValue() {
|
||||||
return artifactUploadState.getSoftwareModuleFilters().getSearchText().orElse(null);
|
return getArtifactUploadState().getSoftwareModuleFilters().getSearchText().orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void showFilterButtonsLayout() {
|
protected void showFilterButtonsLayout() {
|
||||||
artifactUploadState.setSwTypeFilterClosed(false);
|
getArtifactUploadState().setSwTypeFilterClosed(false);
|
||||||
eventbus.publish(this, UploadArtifactUIEvent.SHOW_FILTER_BY_TYPE);
|
eventbus.publish(this, UploadArtifactUIEvent.SHOW_FILTER_BY_TYPE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void resetSearchText() {
|
protected void resetSearchText() {
|
||||||
if (artifactUploadState.getSoftwareModuleFilters().getSearchText().isPresent()) {
|
if (getArtifactUploadState().getSoftwareModuleFilters().getSearchText().isPresent()) {
|
||||||
artifactUploadState.getSoftwareModuleFilters().setSearchText(null);
|
getArtifactUploadState().getSoftwareModuleFilters().setSearchText(null);
|
||||||
eventbus.publish(this, SMFilterEvent.REMOVER_FILTER_BY_TEXT);
|
eventbus.publish(this, new RefreshSoftwareModuleByFilterEvent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void maximizeTable() {
|
public void maximizeTable() {
|
||||||
artifactUploadState.setSwModuleTableMaximized(Boolean.TRUE);
|
getArtifactUploadState().setSwModuleTableMaximized(Boolean.TRUE);
|
||||||
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MAXIMIZED));
|
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MAXIMIZED));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void minimizeTable() {
|
public void minimizeTable() {
|
||||||
artifactUploadState.setSwModuleTableMaximized(Boolean.FALSE);
|
getArtifactUploadState().setSwModuleTableMaximized(Boolean.FALSE);
|
||||||
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MINIMIZED));
|
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MINIMIZED));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean onLoadIsTableMaximized() {
|
public Boolean onLoadIsTableMaximized() {
|
||||||
return artifactUploadState.isSwModuleTableMaximized();
|
return getArtifactUploadState().isSwModuleTableMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean onLoadIsShowFilterButtonDisplayed() {
|
public Boolean onLoadIsShowFilterButtonDisplayed() {
|
||||||
return artifactUploadState.isSwTypeFilterClosed();
|
return getArtifactUploadState().isSwTypeFilterClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void searchBy(final String newSearchText) {
|
protected void searchBy(final String newSearchText) {
|
||||||
artifactUploadState.getSoftwareModuleFilters().setSearchText(newSearchText);
|
getArtifactUploadState().getSoftwareModuleFilters().setSearchText(newSearchText);
|
||||||
eventbus.publish(this, SMFilterEvent.FILTER_BY_TEXT);
|
eventbus.publish(this, new RefreshSoftwareModuleByFilterEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
|||||||
import org.eclipse.hawkbit.ui.common.table.AbstractTableLayout;
|
import org.eclipse.hawkbit.ui.common.table.AbstractTableLayout;
|
||||||
import org.eclipse.hawkbit.ui.dd.criteria.UploadViewClientCriterion;
|
import org.eclipse.hawkbit.ui.dd.criteria.UploadViewClientCriterion;
|
||||||
import org.eclipse.hawkbit.ui.distributions.smtable.SwMetadataPopupLayout;
|
import org.eclipse.hawkbit.ui.distributions.smtable.SwMetadataPopupLayout;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -24,26 +24,33 @@ import org.vaadin.spring.events.EventBus.UIEventBus;
|
|||||||
*/
|
*/
|
||||||
public class SoftwareModuleTableLayout extends AbstractTableLayout<SoftwareModuleTable> {
|
public class SoftwareModuleTableLayout extends AbstractTableLayout<SoftwareModuleTable> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 6464291374980641235L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private final SoftwareModuleTable softwareModuleTable;
|
||||||
|
|
||||||
public SoftwareModuleTableLayout(final VaadinMessageSource i18n, final SpPermissionChecker permChecker,
|
public SoftwareModuleTableLayout(final VaadinMessageSource i18n, final SpPermissionChecker permChecker,
|
||||||
final ArtifactUploadState artifactUploadState, final UINotification uiNotification,
|
final ArtifactUploadState artifactUploadState, final UINotification uiNotification,
|
||||||
final UIEventBus eventBus, final SoftwareManagement softwareManagement, final EntityFactory entityFactory,
|
final UIEventBus eventBus, final SoftwareManagement softwareManagement, final EntityFactory entityFactory,
|
||||||
final UploadViewClientCriterion uploadViewClientCriterion) {
|
final UploadViewClientCriterion uploadViewClientCriterion) {
|
||||||
|
|
||||||
final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow = new SoftwareModuleAddUpdateWindow(i18n,
|
|
||||||
uiNotification, eventBus, softwareManagement, entityFactory);
|
|
||||||
|
|
||||||
final SwMetadataPopupLayout swMetadataPopupLayout = new SwMetadataPopupLayout(i18n, uiNotification, eventBus,
|
final SwMetadataPopupLayout swMetadataPopupLayout = new SwMetadataPopupLayout(i18n, uiNotification, eventBus,
|
||||||
softwareManagement, entityFactory, permChecker);
|
softwareManagement, entityFactory, permChecker);
|
||||||
|
this.softwareModuleTable = new SoftwareModuleTable(eventBus, i18n, uiNotification, artifactUploadState,
|
||||||
|
softwareManagement, uploadViewClientCriterion, swMetadataPopupLayout);
|
||||||
|
|
||||||
|
final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow = new SoftwareModuleAddUpdateWindow(i18n,
|
||||||
|
uiNotification, eventBus, softwareManagement, entityFactory, softwareModuleTable);
|
||||||
|
|
||||||
super.init(
|
super.init(
|
||||||
new SoftwareModuleTableHeader(i18n, permChecker, eventBus, artifactUploadState,
|
new SoftwareModuleTableHeader(i18n, permChecker, eventBus, artifactUploadState,
|
||||||
softwareModuleAddUpdateWindow),
|
softwareModuleAddUpdateWindow),
|
||||||
new SoftwareModuleTable(eventBus, i18n, uiNotification, artifactUploadState, softwareManagement,
|
softwareModuleTable,
|
||||||
uploadViewClientCriterion, swMetadataPopupLayout),
|
|
||||||
new SoftwareModuleDetails(i18n, eventBus, permChecker, softwareModuleAddUpdateWindow,
|
new SoftwareModuleDetails(i18n, eventBus, permChecker, softwareModuleAddUpdateWindow,
|
||||||
artifactUploadState, softwareManagement, swMetadataPopupLayout, entityFactory));
|
artifactUploadState, softwareManagement, swMetadataPopupLayout, entityFactory));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SoftwareModuleTable getSoftwareModuleTable() {
|
||||||
|
return softwareModuleTable;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.repository.TagManagement;
|
import org.eclipse.hawkbit.repository.TagManagement;
|
||||||
@@ -28,10 +27,10 @@ import org.eclipse.hawkbit.ui.common.builder.TextAreaBuilder;
|
|||||||
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
|
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
|
||||||
import org.eclipse.hawkbit.ui.layouts.CreateUpdateTypeLayout;
|
import org.eclipse.hawkbit.ui.layouts.CreateUpdateTypeLayout;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||||
@@ -110,9 +109,9 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout<Softw
|
|||||||
|
|
||||||
tagDesc = new TextAreaBuilder().caption(i18n.getMessage("textfield.description"))
|
tagDesc = new TextAreaBuilder().caption(i18n.getMessage("textfield.description"))
|
||||||
.styleName(ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TYPE_DESC)
|
.styleName(ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TYPE_DESC)
|
||||||
.prompt(i18n.getMessage("textfield.description")).immediate(true).id(SPUIDefinitions.NEW_SOFTWARE_TYPE_DESC)
|
.prompt(i18n.getMessage("textfield.description")).immediate(true)
|
||||||
.buildTextComponent();
|
.id(SPUIDefinitions.NEW_SOFTWARE_TYPE_DESC).buildTextComponent();
|
||||||
tagDesc.setNullRepresentation(StringUtils.EMPTY);
|
tagDesc.setNullRepresentation("");
|
||||||
|
|
||||||
singleMultiOptionGroup();
|
singleMultiOptionGroup();
|
||||||
}
|
}
|
||||||
@@ -131,8 +130,9 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout<Softw
|
|||||||
}
|
}
|
||||||
|
|
||||||
private TextField createTextField(final String in18Key, final String styleName, final String id) {
|
private TextField createTextField(final String in18Key, final String styleName, final String id) {
|
||||||
return new TextFieldBuilder().caption(i18n.getMessage(in18Key)).styleName(ValoTheme.TEXTFIELD_TINY + " " + styleName)
|
return new TextFieldBuilder().caption(i18n.getMessage(in18Key))
|
||||||
.required(true).prompt(i18n.getMessage(in18Key)).immediate(true).id(id).buildTextComponent();
|
.styleName(ValoTheme.TEXTFIELD_TINY + " " + styleName).required(true).prompt(i18n.getMessage(in18Key))
|
||||||
|
.immediate(true).id(id).buildTextComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -267,7 +267,8 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout<Softw
|
|||||||
final SoftwareModuleType newSWType = swTypeManagementService.createSoftwareModuleType(
|
final SoftwareModuleType newSWType = swTypeManagementService.createSoftwareModuleType(
|
||||||
entityFactory.softwareModuleType().create().key(typeKeyValue).name(typeNameValue)
|
entityFactory.softwareModuleType().create().key(typeKeyValue).name(typeNameValue)
|
||||||
.description(typeDescValue).colour(colorPicked).maxAssignments(assignNumber));
|
.description(typeDescValue).colour(colorPicked).maxAssignments(assignNumber));
|
||||||
uiNotification.displaySuccess(i18n.getMessage("message.save.success", new Object[] { newSWType.getName() }));
|
uiNotification
|
||||||
|
.displaySuccess(i18n.getMessage("message.save.success", new Object[] { newSWType.getName() }));
|
||||||
eventBus.publish(this,
|
eventBus.publish(this,
|
||||||
new SoftwareModuleTypeEvent(SoftwareModuleTypeEnum.ADD_SOFTWARE_MODULE_TYPE, newSWType));
|
new SoftwareModuleTypeEvent(SoftwareModuleTypeEnum.ADD_SOFTWARE_MODULE_TYPE, newSWType));
|
||||||
} else {
|
} else {
|
||||||
@@ -279,7 +280,8 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout<Softw
|
|||||||
swTypeManagementService.updateSoftwareModuleType(
|
swTypeManagementService.updateSoftwareModuleType(
|
||||||
entityFactory.softwareModuleType().update(existingType.getId()).description(tagDesc.getValue())
|
entityFactory.softwareModuleType().update(existingType.getId()).description(tagDesc.getValue())
|
||||||
.colour(ColorPickerHelper.getColorPickedString(getColorPickerLayout().getSelPreview())));
|
.colour(ColorPickerHelper.getColorPickedString(getColorPickerLayout().getSelPreview())));
|
||||||
uiNotification.displaySuccess(i18n.getMessage("message.update.success", new Object[] { existingType.getName() }));
|
uiNotification
|
||||||
|
.displaySuccess(i18n.getMessage("message.update.success", new Object[] { existingType.getName() }));
|
||||||
eventBus.publish(this,
|
eventBus.publish(this,
|
||||||
new SoftwareModuleTypeEvent(SoftwareModuleTypeEnum.UPDATE_SOFTWARE_MODULE_TYPE, existingType));
|
new SoftwareModuleTypeEvent(SoftwareModuleTypeEnum.UPDATE_SOFTWARE_MODULE_TYPE, existingType));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.artifacts.smtype;
|
package org.eclipse.hawkbit.ui.artifacts.smtype;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.RefreshSoftwareModuleByFilterEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterSingleButtonClick;
|
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterSingleButtonClick;
|
||||||
import org.vaadin.spring.events.EventBus;
|
import org.vaadin.spring.events.EventBus;
|
||||||
@@ -20,11 +18,12 @@ import org.vaadin.spring.events.EventBus.UIEventBus;
|
|||||||
import com.vaadin.ui.Button;
|
import com.vaadin.ui.Button;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Single button click behaviour of filter buttons layout.
|
* Single button click behavior of filter buttons layout for software module
|
||||||
|
* table on the Upload view.
|
||||||
*/
|
*/
|
||||||
public class SMTypeFilterButtonClick extends AbstractFilterSingleButtonClick implements Serializable {
|
public class SMTypeFilterButtonClick extends AbstractFilterSingleButtonClick {
|
||||||
|
|
||||||
private static final long serialVersionUID = 3707945900524967887L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final transient EventBus.UIEventBus eventBus;
|
private final transient EventBus.UIEventBus eventBus;
|
||||||
|
|
||||||
@@ -42,7 +41,7 @@ public class SMTypeFilterButtonClick extends AbstractFilterSingleButtonClick imp
|
|||||||
@Override
|
@Override
|
||||||
protected void filterUnClicked(final Button clickedButton) {
|
protected void filterUnClicked(final Button clickedButton) {
|
||||||
artifactUploadState.getSoftwareModuleFilters().setSoftwareModuleType(null);
|
artifactUploadState.getSoftwareModuleFilters().setSoftwareModuleType(null);
|
||||||
eventBus.publish(this, SMFilterEvent.FILTER_BY_TYPE);
|
eventBus.publish(this, new RefreshSoftwareModuleByFilterEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -50,7 +49,7 @@ public class SMTypeFilterButtonClick extends AbstractFilterSingleButtonClick imp
|
|||||||
softwareManagement.findSoftwareModuleTypeByName(clickedButton.getData().toString())
|
softwareManagement.findSoftwareModuleTypeByName(clickedButton.getData().toString())
|
||||||
.ifPresent(softwareModuleType -> {
|
.ifPresent(softwareModuleType -> {
|
||||||
artifactUploadState.getSoftwareModuleFilters().setSoftwareModuleType(softwareModuleType);
|
artifactUploadState.getSoftwareModuleFilters().setSoftwareModuleType(softwareModuleType);
|
||||||
eventBus.publish(this, SMFilterEvent.FILTER_BY_TYPE);
|
eventBus.publish(this, new RefreshSoftwareModuleByFilterEvent());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.upload.UploadStatusObject;
|
import org.eclipse.hawkbit.ui.artifacts.upload.UploadStatusObject;
|
||||||
import org.eclipse.hawkbit.ui.common.ManagmentEntityState;
|
import org.eclipse.hawkbit.ui.common.ManagementEntityState;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import com.vaadin.spring.annotation.SpringComponent;
|
import com.vaadin.spring.annotation.SpringComponent;
|
||||||
@@ -29,14 +29,12 @@ import com.vaadin.spring.annotation.VaadinSessionScope;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* User status of Artifact upload.
|
* User status of Artifact upload.
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@VaadinSessionScope
|
@VaadinSessionScope
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
public class ArtifactUploadState implements ManagmentEntityState<Long>, Serializable {
|
public class ArtifactUploadState implements ManagementEntityState, Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 8273440375917450859L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final SoftwareModuleFilters softwareModuleFilters;
|
private final SoftwareModuleFilters softwareModuleFilters;
|
||||||
|
|
||||||
@@ -44,9 +42,7 @@ public class ArtifactUploadState implements ManagmentEntityState<Long>, Serializ
|
|||||||
|
|
||||||
private final Set<CustomFile> fileSelected = new HashSet<>();
|
private final Set<CustomFile> fileSelected = new HashSet<>();
|
||||||
|
|
||||||
private Long selectedBaseSwModuleId;
|
private transient Optional<Long> selectedBaseSwModuleId = Optional.empty();
|
||||||
|
|
||||||
private SoftwareModule selectedBaseSoftwareModule;
|
|
||||||
|
|
||||||
private final Map<String, SoftwareModule> baseSwModuleList = new HashMap<>();
|
private final Map<String, SoftwareModule> baseSwModuleList = new HashMap<>();
|
||||||
|
|
||||||
@@ -115,54 +111,33 @@ public class ArtifactUploadState implements ManagmentEntityState<Long>, Serializ
|
|||||||
return statusPopupMinimized;
|
return statusPopupMinimized;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set software.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public SoftwareModuleFilters getSoftwareModuleFilters() {
|
public SoftwareModuleFilters getSoftwareModuleFilters() {
|
||||||
return softwareModuleFilters;
|
return softwareModuleFilters;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the selectedSofwareModules
|
|
||||||
*/
|
|
||||||
public Map<Long, String> getDeleteSofwareModules() {
|
public Map<Long, String> getDeleteSofwareModules() {
|
||||||
return deleteSofwareModules;
|
return deleteSofwareModules;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the fileSelected
|
|
||||||
*/
|
|
||||||
public Set<CustomFile> getFileSelected() {
|
public Set<CustomFile> getFileSelected() {
|
||||||
return fileSelected;
|
return fileSelected;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the selectedBaseSwModuleId
|
|
||||||
*/
|
|
||||||
public Optional<Long> getSelectedBaseSwModuleId() {
|
public Optional<Long> getSelectedBaseSwModuleId() {
|
||||||
return Optional.ofNullable(selectedBaseSwModuleId);
|
return selectedBaseSwModuleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the baseSwModuleList
|
|
||||||
*/
|
|
||||||
public Map<String, SoftwareModule> getBaseSwModuleList() {
|
public Map<String, SoftwareModule> getBaseSwModuleList() {
|
||||||
return baseSwModuleList;
|
return baseSwModuleList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the selectedSoftwareModules
|
|
||||||
*/
|
|
||||||
public Set<Long> getSelectedSoftwareModules() {
|
public Set<Long> getSelectedSoftwareModules() {
|
||||||
return selectedSoftwareModules;
|
return selectedSoftwareModules;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLastSelectedEntity(final Long value) {
|
public void setLastSelectedEntityId(final Long value) {
|
||||||
this.selectedBaseSwModuleId = value;
|
this.selectedBaseSwModuleId = Optional.ofNullable(value);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -170,32 +145,18 @@ public class ArtifactUploadState implements ManagmentEntityState<Long>, Serializ
|
|||||||
this.selectedSoftwareModules = values;
|
this.selectedSoftwareModules = values;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the swTypeFilterClosed
|
|
||||||
*/
|
|
||||||
public boolean isSwTypeFilterClosed() {
|
public boolean isSwTypeFilterClosed() {
|
||||||
return swTypeFilterClosed;
|
return swTypeFilterClosed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param swTypeFilterClosed
|
|
||||||
* the swTypeFilterClosed to set
|
|
||||||
*/
|
|
||||||
public void setSwTypeFilterClosed(final boolean swTypeFilterClosed) {
|
public void setSwTypeFilterClosed(final boolean swTypeFilterClosed) {
|
||||||
this.swTypeFilterClosed = swTypeFilterClosed;
|
this.swTypeFilterClosed = swTypeFilterClosed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the isSwModuleTableMaximized
|
|
||||||
*/
|
|
||||||
public boolean isSwModuleTableMaximized() {
|
public boolean isSwModuleTableMaximized() {
|
||||||
return swModuleTableMaximized;
|
return swModuleTableMaximized;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param isSwModuleTableMaximized
|
|
||||||
* the isSwModuleTableMaximized to set
|
|
||||||
*/
|
|
||||||
public void setSwModuleTableMaximized(final boolean swModuleTableMaximized) {
|
public void setSwModuleTableMaximized(final boolean swModuleTableMaximized) {
|
||||||
this.swModuleTableMaximized = swModuleTableMaximized;
|
this.swModuleTableMaximized = swModuleTableMaximized;
|
||||||
}
|
}
|
||||||
@@ -204,41 +165,19 @@ public class ArtifactUploadState implements ManagmentEntityState<Long>, Serializ
|
|||||||
return selectedDeleteSWModuleTypes;
|
return selectedDeleteSWModuleTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the isArtifactDetailsMaximized
|
|
||||||
*/
|
|
||||||
public boolean isArtifactDetailsMaximized() {
|
public boolean isArtifactDetailsMaximized() {
|
||||||
return artifactDetailsMaximized;
|
return artifactDetailsMaximized;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param isArtifactDetailsMaximized
|
|
||||||
* the isArtifactDetailsMaximized to set
|
|
||||||
*/
|
|
||||||
public void setArtifactDetailsMaximized(final boolean artifactDetailsMaximized) {
|
public void setArtifactDetailsMaximized(final boolean artifactDetailsMaximized) {
|
||||||
this.artifactDetailsMaximized = artifactDetailsMaximized;
|
this.artifactDetailsMaximized = artifactDetailsMaximized;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the noDataAvilableSoftwareModule
|
|
||||||
*/
|
|
||||||
public boolean isNoDataAvilableSoftwareModule() {
|
public boolean isNoDataAvilableSoftwareModule() {
|
||||||
return noDataAvilableSoftwareModule;
|
return noDataAvilableSoftwareModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param noDataAvilableSoftwareModule
|
|
||||||
* the noDataAvilableSoftwareModule to set
|
|
||||||
*/
|
|
||||||
public void setNoDataAvilableSoftwareModule(final boolean noDataAvilableSoftwareModule) {
|
public void setNoDataAvilableSoftwareModule(final boolean noDataAvilableSoftwareModule) {
|
||||||
this.noDataAvilableSoftwareModule = noDataAvilableSoftwareModule;
|
this.noDataAvilableSoftwareModule = noDataAvilableSoftwareModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<SoftwareModule> getSelectedBaseSoftwareModule() {
|
|
||||||
return Optional.ofNullable(selectedBaseSoftwareModule);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSelectedBaseSoftwareModule(final SoftwareModule selectedBaseSoftwareModule) {
|
|
||||||
this.selectedBaseSoftwareModule = selectedBaseSoftwareModule;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ import com.vaadin.ui.themes.ValoTheme;
|
|||||||
*/
|
*/
|
||||||
public class UploadConfirmationWindow implements Button.ClickListener {
|
public class UploadConfirmationWindow implements Button.ClickListener {
|
||||||
|
|
||||||
private static final long serialVersionUID = -1679035890140031740L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(UploadConfirmationWindow.class);
|
private static final Logger LOG = LoggerFactory.getLogger(UploadConfirmationWindow.class);
|
||||||
|
|
||||||
@@ -138,8 +138,8 @@ public class UploadConfirmationWindow implements Button.ClickListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkIfArtifactDetailsDisplayed(final Long bSoftwareModuleId) {
|
private boolean checkIfArtifactDetailsDisplayed(final Long bSoftwareModuleId) {
|
||||||
return artifactUploadState.getSelectedBaseSoftwareModule()
|
return artifactUploadState.getSelectedBaseSwModuleId().map(moduleId -> moduleId.equals(bSoftwareModuleId))
|
||||||
.map(module -> module.getId().equals(bSoftwareModuleId)).orElse(false);
|
.orElse(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Boolean preUploadValidation(final List<String> itemIds) {
|
private Boolean preUploadValidation(final List<String> itemIds) {
|
||||||
@@ -344,7 +344,6 @@ public class UploadConfirmationWindow implements Button.ClickListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -354,7 +353,7 @@ public class UploadConfirmationWindow implements Button.ClickListener {
|
|||||||
* label
|
* label
|
||||||
* @return Boolean
|
* @return Boolean
|
||||||
*/
|
*/
|
||||||
private static Boolean isWarningIcon(final Label icon) {
|
private static boolean isWarningIcon(final Label icon) {
|
||||||
return !isErrorIcon(icon);
|
return !isErrorIcon(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,7 +364,7 @@ public class UploadConfirmationWindow implements Button.ClickListener {
|
|||||||
* label
|
* label
|
||||||
* @return Boolean
|
* @return Boolean
|
||||||
*/
|
*/
|
||||||
private static Boolean isErrorIcon(final Label icon) {
|
private static boolean isErrorIcon(final Label icon) {
|
||||||
return icon.isVisible() && icon.getStyleName().contains(SPUIStyleDefinitions.ERROR_LABEL);
|
return icon.isVisible() && icon.getStyleName().contains(SPUIStyleDefinitions.ERROR_LABEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -532,7 +531,7 @@ public class UploadConfirmationWindow implements Button.ClickListener {
|
|||||||
return footer;
|
return footer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Window getUploadConfrimationWindow() {
|
public Window getUploadConfirmationWindow() {
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -568,9 +567,7 @@ public class UploadConfirmationWindow implements Button.ClickListener {
|
|||||||
window.close();
|
window.close();
|
||||||
uploadLayout.clearUploadedFileDetails();
|
uploadLayout.clearUploadedFileDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exception squid:S3655 - Optional access is checked in
|
// Exception squid:S3655 - Optional access is checked in
|
||||||
@@ -598,7 +595,7 @@ public class UploadConfirmationWindow implements Button.ClickListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (refreshArtifactDetailsLayout) {
|
if (refreshArtifactDetailsLayout) {
|
||||||
uploadLayout.refreshArtifactDetailsLayout(artifactUploadState.getSelectedBaseSoftwareModule().get());
|
uploadLayout.refreshArtifactDetailsLayout(artifactUploadState.getSelectedBaseSwModuleId().get());
|
||||||
}
|
}
|
||||||
uploadLayout.clearFileList();
|
uploadLayout.clearFileList();
|
||||||
window.close();
|
window.close();
|
||||||
@@ -612,7 +609,6 @@ public class UploadConfirmationWindow implements Button.ClickListener {
|
|||||||
uploadLayout.getUINotification()
|
uploadLayout.getUINotification()
|
||||||
.displayValidationError(uploadLayout.getI18n().getMessage("message.error.noProvidedName"));
|
.displayValidationError(uploadLayout.getI18n().getMessage("message.error.noProvidedName"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onResultDetailsPopupClose() {
|
private void onResultDetailsPopupClose() {
|
||||||
@@ -661,7 +657,6 @@ public class UploadConfirmationWindow implements Button.ClickListener {
|
|||||||
result.setUploadResult(status);
|
result.setUploadResult(status);
|
||||||
result.setReason(message);
|
result.setReason(message);
|
||||||
uploadResultList.add(result);
|
uploadResultList.add(result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Table getUploadDetailsTable() {
|
public Table getUploadDetailsTable() {
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ package org.eclipse.hawkbit.ui.artifacts.upload;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.repository.exception.ArtifactUploadFailedException;
|
import org.eclipse.hawkbit.repository.exception.ArtifactUploadFailedException;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.UploadFileStatus;
|
import org.eclipse.hawkbit.ui.artifacts.event.UploadFileStatus;
|
||||||
@@ -71,8 +73,11 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
|||||||
private SoftwareModule selectedSwForUpload;
|
private SoftwareModule selectedSwForUpload;
|
||||||
private final ArtifactUploadState artifactUploadState;
|
private final ArtifactUploadState artifactUploadState;
|
||||||
|
|
||||||
|
private final transient SoftwareManagement softwareManagement;
|
||||||
|
|
||||||
UploadHandler(final String fileName, final long fileSize, final UploadLayout view, final long maxSize,
|
UploadHandler(final String fileName, final long fileSize, final UploadLayout view, final long maxSize,
|
||||||
final Upload upload, final String mimeType, final SoftwareModule selectedSw) {
|
final Upload upload, final String mimeType, final SoftwareModule selectedSw,
|
||||||
|
final SoftwareManagement softwareManagement) {
|
||||||
super();
|
super();
|
||||||
this.aborted = false;
|
this.aborted = false;
|
||||||
this.fileName = fileName;
|
this.fileName = fileName;
|
||||||
@@ -85,6 +90,7 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
|||||||
this.i18n = SpringContextHelper.getBean(VaadinMessageSource.class);
|
this.i18n = SpringContextHelper.getBean(VaadinMessageSource.class);
|
||||||
this.eventBus = SpringContextHelper.getBean(EventBus.UIEventBus.class);
|
this.eventBus = SpringContextHelper.getBean(EventBus.UIEventBus.class);
|
||||||
this.artifactUploadState = SpringContextHelper.getBean(ArtifactUploadState.class);
|
this.artifactUploadState = SpringContextHelper.getBean(ArtifactUploadState.class);
|
||||||
|
this.softwareManagement = softwareManagement;
|
||||||
eventBus.subscribe(this);
|
eventBus.subscribe(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,7 +213,12 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
|||||||
@Override
|
@Override
|
||||||
public void uploadStarted(final StartedEvent event) {
|
public void uploadStarted(final StartedEvent event) {
|
||||||
uploadInterrupted = false;
|
uploadInterrupted = false;
|
||||||
selectedSwForUpload = artifactUploadState.getSelectedBaseSoftwareModule().orElse(null);
|
selectedSwForUpload = null;
|
||||||
|
|
||||||
|
final Optional<Long> selectedBaseSwModuleId = artifactUploadState.getSelectedBaseSwModuleId();
|
||||||
|
if (selectedBaseSwModuleId.isPresent()) {
|
||||||
|
selectedSwForUpload = softwareManagement.findSoftwareModuleById(selectedBaseSwModuleId.get()).orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
if (selectedSwForUpload != null && view.checkIfSoftwareModuleIsSelected()
|
if (selectedSwForUpload != null && view.checkIfSoftwareModuleIsSelected()
|
||||||
&& !view.checkIfFileIsDuplicate(event.getFilename(), selectedSwForUpload)) {
|
&& !view.checkIfFileIsDuplicate(event.getFilename(), selectedSwForUpload)) {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import javax.servlet.MultipartConfigElement;
|
|||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||||
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.repository.exception.ArtifactUploadFailedException;
|
import org.eclipse.hawkbit.repository.exception.ArtifactUploadFailedException;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||||
@@ -74,9 +75,10 @@ import com.vaadin.ui.VerticalLayout;
|
|||||||
* Upload files layout.
|
* Upload files layout.
|
||||||
*/
|
*/
|
||||||
public class UploadLayout extends VerticalLayout {
|
public class UploadLayout extends VerticalLayout {
|
||||||
private static final String HTML_DIV = "</div>";
|
|
||||||
|
|
||||||
private static final long serialVersionUID = -566164756606779220L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private static final String HTML_DIV = "</div>";
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(UploadLayout.class);
|
private static final Logger LOG = LoggerFactory.getLogger(UploadLayout.class);
|
||||||
|
|
||||||
@@ -110,6 +112,8 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
|
|
||||||
private Button uploadStatusButton;
|
private Button uploadStatusButton;
|
||||||
|
|
||||||
|
private final transient SoftwareManagement softwareManagement;
|
||||||
|
|
||||||
private static AcceptCriterion acceptAllExceptBlacklisted = new Not(new ServerItemIdClientCriterion(Mode.PREFIX,
|
private static AcceptCriterion acceptAllExceptBlacklisted = new Not(new ServerItemIdClientCriterion(Mode.PREFIX,
|
||||||
UIComponentIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE, UIComponentIdProvider.UPLOAD_TYPE_BUTTON_PREFIX));
|
UIComponentIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE, UIComponentIdProvider.UPLOAD_TYPE_BUTTON_PREFIX));
|
||||||
|
|
||||||
@@ -117,7 +121,7 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
|
|
||||||
public UploadLayout(final VaadinMessageSource i18n, final UINotification uiNotification, final UIEventBus eventBus,
|
public UploadLayout(final VaadinMessageSource i18n, final UINotification uiNotification, final UIEventBus eventBus,
|
||||||
final ArtifactUploadState artifactUploadState, final MultipartConfigElement multipartConfigElement,
|
final ArtifactUploadState artifactUploadState, final MultipartConfigElement multipartConfigElement,
|
||||||
final ArtifactManagement artifactManagement) {
|
final ArtifactManagement artifactManagement, final SoftwareManagement softwareManagement) {
|
||||||
this.uploadInfoWindow = new UploadStatusInfoWindow(eventBus, artifactUploadState, i18n);
|
this.uploadInfoWindow = new UploadStatusInfoWindow(eventBus, artifactUploadState, i18n);
|
||||||
this.i18n = i18n;
|
this.i18n = i18n;
|
||||||
this.uiNotification = uiNotification;
|
this.uiNotification = uiNotification;
|
||||||
@@ -125,6 +129,7 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
this.artifactUploadState = artifactUploadState;
|
this.artifactUploadState = artifactUploadState;
|
||||||
this.multipartConfigElement = multipartConfigElement;
|
this.multipartConfigElement = multipartConfigElement;
|
||||||
this.artifactManagement = artifactManagement;
|
this.artifactManagement = artifactManagement;
|
||||||
|
this.softwareManagement = softwareManagement;
|
||||||
|
|
||||||
createComponents();
|
createComponents();
|
||||||
buildLayout();
|
buildLayout();
|
||||||
@@ -173,7 +178,7 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
|
|
||||||
final Upload upload = new Upload();
|
final Upload upload = new Upload();
|
||||||
final UploadHandler uploadHandler = new UploadHandler(null, 0, this, multipartConfigElement.getMaxFileSize(),
|
final UploadHandler uploadHandler = new UploadHandler(null, 0, this, multipartConfigElement.getMaxFileSize(),
|
||||||
upload, null, null);
|
upload, null, null, softwareManagement);
|
||||||
upload.setButtonCaption(i18n.getMessage("upload.file"));
|
upload.setButtonCaption(i18n.getMessage("upload.file"));
|
||||||
upload.setImmediate(true);
|
upload.setImmediate(true);
|
||||||
upload.setReceiver(uploadHandler);
|
upload.setReceiver(uploadHandler);
|
||||||
@@ -183,6 +188,7 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
upload.addProgressListener(uploadHandler);
|
upload.addProgressListener(uploadHandler);
|
||||||
upload.addStartedListener(uploadHandler);
|
upload.addStartedListener(uploadHandler);
|
||||||
upload.addStyleName(SPUIStyleDefinitions.ACTION_BUTTON);
|
upload.addStyleName(SPUIStyleDefinitions.ACTION_BUTTON);
|
||||||
|
upload.addStyleName("no-border");
|
||||||
|
|
||||||
fileUploadLayout = new HorizontalLayout();
|
fileUploadLayout = new HorizontalLayout();
|
||||||
fileUploadLayout.setSpacing(true);
|
fileUploadLayout.setSpacing(true);
|
||||||
@@ -243,11 +249,13 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
// selected software module at the time of file drop is
|
// selected software module at the time of file drop is
|
||||||
// considered for upload
|
// considered for upload
|
||||||
|
|
||||||
artifactUploadState.getSelectedBaseSoftwareModule().ifPresent(selectedSw -> {
|
artifactUploadState.getSelectedBaseSwModuleId().ifPresent(selectedSwId -> {
|
||||||
// reset the flag
|
// reset the flag
|
||||||
hasDirectory = false;
|
hasDirectory = false;
|
||||||
|
final SoftwareModule softwareModule = softwareManagement.findSoftwareModuleById(selectedSwId)
|
||||||
|
.orElse(null);
|
||||||
for (final Html5File file : files) {
|
for (final Html5File file : files) {
|
||||||
processFile(file, selectedSw);
|
processFile(file, softwareModule);
|
||||||
}
|
}
|
||||||
if (artifactUploadState.getNumberOfFileUploadsExpected().get() > 0) {
|
if (artifactUploadState.getNumberOfFileUploadsExpected().get() > 0) {
|
||||||
processBtn.setEnabled(false);
|
processBtn.setEnabled(false);
|
||||||
@@ -296,7 +304,7 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
|
|
||||||
private StreamVariable createStreamVariable(final Html5File file, final SoftwareModule selectedSw) {
|
private StreamVariable createStreamVariable(final Html5File file, final SoftwareModule selectedSw) {
|
||||||
return new UploadHandler(file.getFileName(), file.getFileSize(), UploadLayout.this,
|
return new UploadHandler(file.getFileName(), file.getFileSize(), UploadLayout.this,
|
||||||
multipartConfigElement.getMaxFileSize(), null, file.getType(), selectedSw);
|
multipartConfigElement.getMaxFileSize(), null, file.getType(), selectedSw, softwareManagement);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isDirectory(final Html5File file) {
|
private boolean isDirectory(final Html5File file) {
|
||||||
@@ -321,7 +329,7 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private VerticalLayout createDropAreaLayout() {
|
private static VerticalLayout createDropAreaLayout() {
|
||||||
final VerticalLayout dropAreaLayout = new VerticalLayout();
|
final VerticalLayout dropAreaLayout = new VerticalLayout();
|
||||||
final Label dropHereLabel = new Label("Drop files to upload");
|
final Label dropHereLabel = new Label("Drop files to upload");
|
||||||
dropHereLabel.setWidth(null);
|
dropHereLabel.setWidth(null);
|
||||||
@@ -413,7 +421,6 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
LOG.error("Upload failed {}", e);
|
LOG.error("Upload failed {}", e);
|
||||||
throw new ArtifactUploadFailedException(i18n.getMessage("message.upload.failed"));
|
throw new ArtifactUploadFailedException(i18n.getMessage("message.upload.failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean checkIfSoftwareModuleIsSelected() {
|
boolean checkIfSoftwareModuleIsSelected() {
|
||||||
@@ -425,13 +432,13 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if file selected is duplicate.i,e already selected for upload for
|
* Check if the selected file is duplicate. i.e. already selected for upload
|
||||||
* same software module.
|
* for same software module.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* file name
|
* file name
|
||||||
* @param selectedSoftwareModule
|
* @param selectedSoftwareModule
|
||||||
* the current selected sm module
|
* the current selected software module
|
||||||
* @return Boolean
|
* @return Boolean
|
||||||
*/
|
*/
|
||||||
Boolean checkIfFileIsDuplicate(final String name, final SoftwareModule selectedSoftwareModule) {
|
Boolean checkIfFileIsDuplicate(final String name, final SoftwareModule selectedSoftwareModule) {
|
||||||
@@ -615,16 +622,13 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
} else {
|
} else {
|
||||||
currentUploadConfirmationwindow = new UploadConfirmationWindow(this, artifactUploadState, eventBus,
|
currentUploadConfirmationwindow = new UploadConfirmationWindow(this, artifactUploadState, eventBus,
|
||||||
artifactManagement);
|
artifactManagement);
|
||||||
UI.getCurrent().addWindow(currentUploadConfirmationwindow.getUploadConfrimationWindow());
|
UI.getCurrent().addWindow(currentUploadConfirmationwindow.getUploadConfirmationWindow());
|
||||||
setConfirmationPopupHeightWidth(Page.getCurrent().getBrowserWindowWidth(),
|
setConfirmationPopupHeightWidth(Page.getCurrent().getBrowserWindowWidth(),
|
||||||
Page.getCurrent().getBrowserWindowHeight());
|
Page.getCurrent().getBrowserWindowHeight());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
VaadinMessageSource getI18n() {
|
VaadinMessageSource getI18n() {
|
||||||
return i18n;
|
return i18n;
|
||||||
}
|
}
|
||||||
@@ -726,17 +730,12 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
void refreshArtifactDetailsLayout(final Long selectedBaseSoftwareModuleId) {
|
||||||
* @param selectedBaseSoftwareModule
|
final SoftwareModule softwareModule = softwareManagement.findSoftwareModuleById(selectedBaseSoftwareModuleId)
|
||||||
*/
|
.orElse(null);
|
||||||
void refreshArtifactDetailsLayout(final SoftwareModule selectedBaseSoftwareModule) {
|
eventBus.publish(this, new SoftwareModuleEvent(SoftwareModuleEventType.ARTIFACTS_CHANGED, softwareModule));
|
||||||
eventBus.publish(this,
|
|
||||||
new SoftwareModuleEvent(SoftwareModuleEventType.ARTIFACTS_CHANGED, selectedBaseSoftwareModule));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the fileUploadLayout
|
|
||||||
*/
|
|
||||||
public HorizontalLayout getFileUploadLayout() {
|
public HorizontalLayout getFileUploadLayout() {
|
||||||
return fileUploadLayout;
|
return fileUploadLayout;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ package org.eclipse.hawkbit.ui.common;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.eclipse.hawkbit.repository.model.MetaData;
|
import org.eclipse.hawkbit.repository.model.MetaData;
|
||||||
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
|
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
|
||||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||||
@@ -24,11 +23,11 @@ import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
|||||||
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlButtonRenderer;
|
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlButtonRenderer;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.spring.events.EventBus;
|
import org.vaadin.spring.events.EventBus;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
|
|
||||||
@@ -231,8 +230,8 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
|
|||||||
|
|
||||||
private TextField createKeyTextField() {
|
private TextField createKeyTextField() {
|
||||||
final TextField keyField = new TextFieldBuilder().caption(i18n.getMessage("textfield.key")).required(true)
|
final TextField keyField = new TextFieldBuilder().caption(i18n.getMessage("textfield.key")).required(true)
|
||||||
.prompt(i18n.getMessage("textfield.key")).immediate(true).id(UIComponentIdProvider.METADATA_KEY_FIELD_ID)
|
.prompt(i18n.getMessage("textfield.key")).immediate(true)
|
||||||
.maxLengthAllowed(128).buildTextComponent();
|
.id(UIComponentIdProvider.METADATA_KEY_FIELD_ID).maxLengthAllowed(128).buildTextComponent();
|
||||||
keyField.addTextChangeListener(this::onKeyChange);
|
keyField.addTextChangeListener(this::onKeyChange);
|
||||||
keyField.setTextChangeEventMode(TextChangeEventMode.EAGER);
|
keyField.setTextChangeEventMode(TextChangeEventMode.EAGER);
|
||||||
keyField.setWidth("100%");
|
keyField.setWidth("100%");
|
||||||
@@ -243,7 +242,7 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
|
|||||||
valueTextArea = new TextAreaBuilder().caption(i18n.getMessage("textfield.value")).required(true)
|
valueTextArea = new TextAreaBuilder().caption(i18n.getMessage("textfield.value")).required(true)
|
||||||
.prompt(i18n.getMessage("textfield.value")).immediate(true).id(UIComponentIdProvider.METADATA_VALUE_ID)
|
.prompt(i18n.getMessage("textfield.value")).immediate(true).id(UIComponentIdProvider.METADATA_VALUE_ID)
|
||||||
.maxLengthAllowed(4000).buildTextComponent();
|
.maxLengthAllowed(4000).buildTextComponent();
|
||||||
valueTextArea.setNullRepresentation(StringUtils.EMPTY);
|
valueTextArea.setNullRepresentation("");
|
||||||
valueTextArea.setSizeFull();
|
valueTextArea.setSizeFull();
|
||||||
valueTextArea.setHeight(100, Unit.PERCENTAGE);
|
valueTextArea.setHeight(100, Unit.PERCENTAGE);
|
||||||
valueTextArea.addTextChangeListener(this::onValueChange);
|
valueTextArea.addTextChangeListener(this::onValueChange);
|
||||||
@@ -278,8 +277,9 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
|
|||||||
final String value = (String) item.getItemProperty(VALUE).getValue();
|
final String value = (String) item.getItemProperty(VALUE).getValue();
|
||||||
|
|
||||||
final ConfirmationDialog confirmDialog = new ConfirmationDialog(
|
final ConfirmationDialog confirmDialog = new ConfirmationDialog(
|
||||||
i18n.getMessage("caption.metadata.delete.action.confirmbox"), i18n.getMessage("message.confirm.delete.metadata", key),
|
i18n.getMessage("caption.metadata.delete.action.confirmbox"),
|
||||||
i18n.getMessage("button.ok"), i18n.getMessage("button.cancel"), ok -> {
|
i18n.getMessage("message.confirm.delete.metadata", key), i18n.getMessage("button.ok"),
|
||||||
|
i18n.getMessage("button.cancel"), ok -> {
|
||||||
if (ok) {
|
if (ok) {
|
||||||
handleOkDeleteMetadata(event, key, value);
|
handleOkDeleteMetadata(event, key, value);
|
||||||
}
|
}
|
||||||
@@ -320,8 +320,9 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Button createAddIcon() {
|
private Button createAddIcon() {
|
||||||
addIcon = SPUIComponentProvider.getButton(UIComponentIdProvider.METADTA_ADD_ICON_ID, i18n.getMessage("button.save"),
|
addIcon = SPUIComponentProvider.getButton(UIComponentIdProvider.METADTA_ADD_ICON_ID,
|
||||||
null, null, false, FontAwesome.PLUS, SPUIButtonStyleSmallNoBorder.class);
|
i18n.getMessage("button.save"), null, null, false, FontAwesome.PLUS,
|
||||||
|
SPUIButtonStyleSmallNoBorder.class);
|
||||||
addIcon.addClickListener(event -> onAdd());
|
addIcon.addClickListener(event -> onAdd());
|
||||||
return addIcon;
|
return addIcon;
|
||||||
}
|
}
|
||||||
@@ -425,7 +426,8 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uiNotification.displayValidationError(i18n.getMessage("message.metadata.duplicate.check", keyTextField.getValue()));
|
uiNotification
|
||||||
|
.displayValidationError(i18n.getMessage("message.metadata.duplicate.check", keyTextField.getValue()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import java.util.Set;
|
|||||||
/**
|
/**
|
||||||
* Interface for all entity states UI to show the details to a entity.
|
* Interface for all entity states UI to show the details to a entity.
|
||||||
*/
|
*/
|
||||||
public interface ManagmentEntityState<T> {
|
public interface ManagementEntityState {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The selected entities for the detail.
|
* The selected entities for the detail.
|
||||||
@@ -22,7 +22,7 @@ public interface ManagmentEntityState<T> {
|
|||||||
* the selected entities.
|
* the selected entities.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void setSelectedEnitities(Set<T> values);
|
void setSelectedEnitities(Set<Long> values);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The last selected value.
|
* The last selected value.
|
||||||
@@ -30,6 +30,6 @@ public interface ManagmentEntityState<T> {
|
|||||||
* @param value
|
* @param value
|
||||||
* the value
|
* the value
|
||||||
*/
|
*/
|
||||||
void setLastSelectedEntity(T value);
|
void setLastSelectedEntityId(Long value);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,7 @@ public final class UserDetailsFormatter {
|
|||||||
*/
|
*/
|
||||||
public static String loadAndFormatCreatedBy(final BaseEntity baseEntity) {
|
public static String loadAndFormatCreatedBy(final BaseEntity baseEntity) {
|
||||||
if (baseEntity == null || baseEntity.getCreatedBy() == null) {
|
if (baseEntity == null || baseEntity.getCreatedBy() == null) {
|
||||||
return StringUtils.EMPTY;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return loadAndFormatUsername(baseEntity.getCreatedBy());
|
return loadAndFormatUsername(baseEntity.getCreatedBy());
|
||||||
@@ -78,7 +78,7 @@ public final class UserDetailsFormatter {
|
|||||||
*/
|
*/
|
||||||
public static String loadAndFormatLastModifiedBy(final BaseEntity baseEntity) {
|
public static String loadAndFormatLastModifiedBy(final BaseEntity baseEntity) {
|
||||||
if (baseEntity == null || baseEntity.getLastModifiedBy() == null) {
|
if (baseEntity == null || baseEntity.getLastModifiedBy() == null) {
|
||||||
return StringUtils.EMPTY;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return loadAndFormatUsername(baseEntity.getLastModifiedBy());
|
return loadAndFormatUsername(baseEntity.getLastModifiedBy());
|
||||||
@@ -123,14 +123,13 @@ public final class UserDetailsFormatter {
|
|||||||
|
|
||||||
final UserPrincipal userPrincipal = (UserPrincipal) userDetails;
|
final UserPrincipal userPrincipal = (UserPrincipal) userDetails;
|
||||||
|
|
||||||
String firstname = StringUtils.defaultIfEmpty(userPrincipal.getFirstname(), StringUtils.EMPTY);
|
String firstname = StringUtils.defaultIfEmpty(userPrincipal.getFirstname(), "");
|
||||||
|
|
||||||
if (!StringUtils.isEmpty(firstname)) {
|
if (!StringUtils.isEmpty(firstname)) {
|
||||||
firstname += DETAIL_SEPERATOR;
|
firstname += DETAIL_SEPERATOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String firstAndLastname = firstname
|
final String firstAndLastname = firstname + StringUtils.defaultIfEmpty(userPrincipal.getLastname(), "");
|
||||||
+ StringUtils.defaultIfEmpty(userPrincipal.getLastname(), StringUtils.EMPTY);
|
|
||||||
|
|
||||||
final String trimmedUsername = trimAndFormatDetail(firstAndLastname, expectedNameLength);
|
final String trimmedUsername = trimAndFormatDetail(firstAndLastname, expectedNameLength);
|
||||||
|
|
||||||
@@ -177,7 +176,7 @@ public final class UserDetailsFormatter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String trimAndFormatDetail(final String formatString, final int expectedDetailLength) {
|
private static String trimAndFormatDetail(final String formatString, final int expectedDetailLength) {
|
||||||
final String detail = StringUtils.defaultIfEmpty(formatString, StringUtils.EMPTY);
|
final String detail = StringUtils.defaultIfEmpty(formatString, "");
|
||||||
final String trimmedDetail = StringUtils.substring(detail, 0, expectedDetailLength);
|
final String trimmedDetail = StringUtils.substring(detail, 0, expectedDetailLength);
|
||||||
if (StringUtils.length(detail) > expectedDetailLength) {
|
if (StringUtils.length(detail) > expectedDetailLength) {
|
||||||
return trimmedDetail + TRIM_APPENDIX;
|
return trimmedDetail + TRIM_APPENDIX;
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ import java.util.Map.Entry;
|
|||||||
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
|
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.spring.events.EventBus;
|
import org.vaadin.spring.events.EventBus;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ import com.vaadin.ui.themes.ValoTheme;
|
|||||||
*/
|
*/
|
||||||
public abstract class AbstractConfirmationWindowLayout extends VerticalLayout {
|
public abstract class AbstractConfirmationWindowLayout extends VerticalLayout {
|
||||||
|
|
||||||
private static final long serialVersionUID = -4042317361561298155L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private Label actionMessage;
|
private Label actionMessage;
|
||||||
|
|
||||||
@@ -53,6 +53,9 @@ public abstract class AbstractConfirmationWindowLayout extends VerticalLayout {
|
|||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the confirmation window layout
|
||||||
|
*/
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
removeAllComponents();
|
removeAllComponents();
|
||||||
consolidatedMessage = "";
|
consolidatedMessage = "";
|
||||||
@@ -76,7 +79,7 @@ public abstract class AbstractConfirmationWindowLayout extends VerticalLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void buildLayout() {
|
private void buildLayout() {
|
||||||
final Map<String, ConfirmationTab> confimrationTabs = getConfimrationTabs();
|
final Map<String, ConfirmationTab> confimrationTabs = getConfirmationTabs();
|
||||||
for (final Entry<String, ConfirmationTab> captionConfirmationTab : confimrationTabs.entrySet()) {
|
for (final Entry<String, ConfirmationTab> captionConfirmationTab : confimrationTabs.entrySet()) {
|
||||||
accordion.addTab(captionConfirmationTab.getValue(), captionConfirmationTab.getKey(), null);
|
accordion.addTab(captionConfirmationTab.getValue(), captionConfirmationTab.getKey(), null);
|
||||||
}
|
}
|
||||||
@@ -129,7 +132,7 @@ public abstract class AbstractConfirmationWindowLayout extends VerticalLayout {
|
|||||||
*
|
*
|
||||||
* @return map of caption and content for each tab.
|
* @return map of caption and content for each tab.
|
||||||
*/
|
*/
|
||||||
protected abstract Map<String, ConfirmationTab> getConfimrationTabs();
|
protected abstract Map<String, ConfirmationTab> getConfirmationTabs();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the consolidatedMessage
|
* @return the consolidatedMessage
|
||||||
|
|||||||
@@ -172,18 +172,22 @@ public abstract class AbstractDistributionSetDetails
|
|||||||
final VerticalLayout detailsTabLayout = getDetailsLayout();
|
final VerticalLayout detailsTabLayout = getDetailsLayout();
|
||||||
detailsTabLayout.removeAllComponents();
|
detailsTabLayout.removeAllComponents();
|
||||||
|
|
||||||
if (type != null) {
|
|
||||||
final Label typeLabel = SPUIComponentProvider
|
final Label typeLabel = SPUIComponentProvider
|
||||||
.createNameValueLabel(getI18n().getMessage("label.dist.details.type"), type);
|
.createNameValueLabel(getI18n().getMessage("label.dist.details.type"), type);
|
||||||
typeLabel.setId(UIComponentIdProvider.DETAILS_TYPE_LABEL_ID);
|
typeLabel.setId(UIComponentIdProvider.DETAILS_TYPE_LABEL_ID);
|
||||||
detailsTabLayout.addComponent(typeLabel);
|
detailsTabLayout.addComponent(typeLabel);
|
||||||
|
|
||||||
|
detailsTabLayout.addComponent(
|
||||||
|
SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("checkbox.dist.migration.required"),
|
||||||
|
getMigrationRequiredValue(isMigrationRequired)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isMigrationRequired != null) {
|
private String getMigrationRequiredValue(final Boolean isMigrationRequired) {
|
||||||
detailsTabLayout.addComponent(SPUIComponentProvider.createNameValueLabel(
|
if (isMigrationRequired == null) {
|
||||||
getI18n().getMessage("checkbox.dist.migration.required"), isMigrationRequired.equals(Boolean.TRUE)
|
return null;
|
||||||
? getI18n().getMessage("label.yes") : getI18n().getMessage("label.no")));
|
|
||||||
}
|
}
|
||||||
|
return isMigrationRequired.equals(Boolean.TRUE) ? getI18n().getMessage("label.yes")
|
||||||
|
: getI18n().getMessage("label.no");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected SoftwareModuleDetailsTable getSoftwareModuleTable() {
|
protected SoftwareModuleDetailsTable getSoftwareModuleTable() {
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.common.detailslayout;
|
package org.eclipse.hawkbit.ui.common.detailslayout;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.repository.model.MetaData;
|
import org.eclipse.hawkbit.repository.model.MetaData;
|
||||||
@@ -130,7 +129,7 @@ public abstract class AbstractSoftwareModuleDetails
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getDetailsHeaderCaptionId() {
|
protected String getDetailsHeaderCaptionId() {
|
||||||
return UIComponentIdProvider.TARGET_DETAILS_HEADER_LABEL_ID;
|
return UIComponentIdProvider.SOFTWARE_MODULE_DETAILS_HEADER_LABEL_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -197,7 +196,7 @@ public abstract class AbstractSoftwareModuleDetails
|
|||||||
updateSoftwareModuleDetailsLayout(getSelectedBaseEntity().getType().getName(),
|
updateSoftwareModuleDetailsLayout(getSelectedBaseEntity().getType().getName(),
|
||||||
getSelectedBaseEntity().getVendor(), maxAssign);
|
getSelectedBaseEntity().getVendor(), maxAssign);
|
||||||
} else {
|
} else {
|
||||||
updateSoftwareModuleDetailsLayout(StringUtils.EMPTY, StringUtils.EMPTY, StringUtils.EMPTY);
|
updateSoftwareModuleDetailsLayout("", "", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ package org.eclipse.hawkbit.ui.common.detailslayout;
|
|||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||||
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
|
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
|
||||||
@@ -40,10 +39,11 @@ import com.vaadin.ui.VerticalLayout;
|
|||||||
/**
|
/**
|
||||||
* Abstract Layout to show the entity details.
|
* Abstract Layout to show the entity details.
|
||||||
*
|
*
|
||||||
|
* @param <T>
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends VerticalLayout {
|
public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends VerticalLayout {
|
||||||
|
|
||||||
private static final long serialVersionUID = 4862529368471627190L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final VaadinMessageSource i18n;
|
private final VaadinMessageSource i18n;
|
||||||
|
|
||||||
@@ -116,7 +116,8 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
|
|||||||
*/
|
*/
|
||||||
protected void onBaseEntityEvent(final BaseUIEntityEvent<T> baseEntityEvent) {
|
protected void onBaseEntityEvent(final BaseUIEntityEvent<T> baseEntityEvent) {
|
||||||
final BaseEntityEventType eventType = baseEntityEvent.getEventType();
|
final BaseEntityEventType eventType = baseEntityEvent.getEventType();
|
||||||
if (BaseEntityEventType.SELECTED_ENTITY == eventType || BaseEntityEventType.UPDATED_ENTITY == eventType) {
|
if (BaseEntityEventType.SELECTED_ENTITY == eventType || BaseEntityEventType.UPDATED_ENTITY == eventType
|
||||||
|
|| BaseEntityEventType.REMOVE_ENTITY == eventType) {
|
||||||
UI.getCurrent().access(() -> populateData(baseEntityEvent.getEntity()));
|
UI.getCurrent().access(() -> populateData(baseEntityEvent.getEntity()));
|
||||||
} else if (BaseEntityEventType.MINIMIZED == eventType) {
|
} else if (BaseEntityEventType.MINIMIZED == eventType) {
|
||||||
UI.getCurrent().access(() -> setVisible(true));
|
UI.getCurrent().access(() -> setVisible(true));
|
||||||
@@ -129,11 +130,12 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
|
|||||||
caption.setValue(HawkbitCommonUtil.getSoftwareModuleName(headerCaption, value));
|
caption.setValue(HawkbitCommonUtil.getSoftwareModuleName(headerCaption, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restores the tables and tabs displayed on the view based on the selected
|
||||||
|
* entity.
|
||||||
|
*/
|
||||||
protected void restoreState() {
|
protected void restoreState() {
|
||||||
if (onLoadIsTableRowSelected()) {
|
populateData(getSelectedBaseEntity());
|
||||||
populateData(null);
|
|
||||||
editButton.setEnabled(true);
|
|
||||||
}
|
|
||||||
if (onLoadIsTableMaximized()) {
|
if (onLoadIsTableMaximized()) {
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
}
|
}
|
||||||
@@ -149,28 +151,21 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
|
|||||||
|
|
||||||
protected void populateLog() {
|
protected void populateLog() {
|
||||||
logLayout.removeAllComponents();
|
logLayout.removeAllComponents();
|
||||||
|
|
||||||
logLayout.addComponent(SPUIComponentProvider.createNameValueLabel(i18n.getMessage("label.created.at"),
|
logLayout.addComponent(SPUIComponentProvider.createNameValueLabel(i18n.getMessage("label.created.at"),
|
||||||
SPDateTimeUtil.formatCreatedAt(selectedBaseEntity)));
|
SPDateTimeUtil.formatCreatedAt(selectedBaseEntity)));
|
||||||
|
|
||||||
logLayout.addComponent(SPUIComponentProvider.createCreatedByLabel(i18n, selectedBaseEntity));
|
logLayout.addComponent(SPUIComponentProvider.createCreatedByLabel(i18n, selectedBaseEntity));
|
||||||
|
|
||||||
if (selectedBaseEntity == null || selectedBaseEntity.getLastModifiedAt() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
logLayout.addComponent(SPUIComponentProvider.createNameValueLabel(i18n.getMessage("label.modified.date"),
|
logLayout.addComponent(SPUIComponentProvider.createNameValueLabel(i18n.getMessage("label.modified.date"),
|
||||||
SPDateTimeUtil.formatLastModifiedAt(selectedBaseEntity)));
|
SPDateTimeUtil.formatLastModifiedAt(selectedBaseEntity)));
|
||||||
|
|
||||||
logLayout.addComponent(SPUIComponentProvider.createLastModifiedByLabel(i18n, selectedBaseEntity));
|
logLayout.addComponent(SPUIComponentProvider.createLastModifiedByLabel(i18n, selectedBaseEntity));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateDescriptionLayout(final String descriptionLabel, final String description) {
|
protected void updateDescriptionLayout(final String description) {
|
||||||
descriptionLayout.removeAllComponents();
|
descriptionLayout.removeAllComponents();
|
||||||
final Label descLabel = SPUIComponentProvider.createNameValueLabel(descriptionLabel,
|
final Label descLabel = SPUIComponentProvider.createNameValueLabel("",
|
||||||
HawkbitCommonUtil.trimAndNullIfEmpty(description) == null ? "" : description);
|
HawkbitCommonUtil.trimAndNullIfEmpty(description) == null ? "" : description);
|
||||||
/**
|
/**
|
||||||
* By default text will be truncated based on layout width .so removing
|
* By default text will be truncated based on layout width. So removing
|
||||||
* it as we need full description.
|
* it as we need full description.
|
||||||
*/
|
*/
|
||||||
descLabel.removeStyleName("label-style");
|
descLabel.removeStyleName("label-style");
|
||||||
@@ -191,7 +186,6 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
|
|||||||
conAttributeLabel.setDescription(entry.getKey().concat(" : ") + entry.getValue());
|
conAttributeLabel.setDescription(entry.getKey().concat(" : ") + entry.getValue());
|
||||||
conAttributeLabel.addStyleName("label-style");
|
conAttributeLabel.addStyleName("label-style");
|
||||||
attributesLayout.addComponent(conAttributeLabel);
|
attributesLayout.addComponent(conAttributeLabel);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -282,15 +276,15 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If no data in table (i,e no row selected),then disable the edit button.
|
* If there is no data in table (i.e. no row selected), then disable the
|
||||||
* If row is selected ,enable edit button.
|
* edit button. If row is selected, enable edit button.
|
||||||
*/
|
*/
|
||||||
private void populateData(final T selectedBaseEntity) {
|
private void populateData(final T selectedBaseEntity) {
|
||||||
this.selectedBaseEntity = selectedBaseEntity;
|
this.selectedBaseEntity = selectedBaseEntity;
|
||||||
editButton.setEnabled(selectedBaseEntity != null);
|
editButton.setEnabled(selectedBaseEntity != null);
|
||||||
manageMetadataBtn.setEnabled(selectedBaseEntity != null);
|
manageMetadataBtn.setEnabled(selectedBaseEntity != null);
|
||||||
if (selectedBaseEntity == null) {
|
if (selectedBaseEntity == null) {
|
||||||
setName(getDefaultCaption(), StringUtils.EMPTY);
|
setName(getDefaultCaption(), "");
|
||||||
} else {
|
} else {
|
||||||
setName(getDefaultCaption(), getName());
|
setName(getDefaultCaption(), getName());
|
||||||
}
|
}
|
||||||
@@ -301,9 +295,9 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
|
|||||||
|
|
||||||
private void populateDescription() {
|
private void populateDescription() {
|
||||||
if (selectedBaseEntity != null) {
|
if (selectedBaseEntity != null) {
|
||||||
updateDescriptionLayout(i18n.getMessage("label.description"), selectedBaseEntity.getDescription());
|
updateDescriptionLayout(selectedBaseEntity.getDescription());
|
||||||
} else {
|
} else {
|
||||||
updateDescriptionLayout(i18n.getMessage("label.description"), null);
|
updateDescriptionLayout(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,8 +326,6 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
|
|||||||
|
|
||||||
protected abstract String getEditButtonId();
|
protected abstract String getEditButtonId();
|
||||||
|
|
||||||
protected abstract boolean onLoadIsTableRowSelected();
|
|
||||||
|
|
||||||
protected abstract boolean onLoadIsTableMaximized();
|
protected abstract boolean onLoadIsTableMaximized();
|
||||||
|
|
||||||
protected abstract String getTabSheetId();
|
protected abstract String getTabSheetId();
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ package org.eclipse.hawkbit.ui.common.detailslayout;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
import org.eclipse.hawkbit.repository.exception.EntityReadOnlyException;
|
import org.eclipse.hawkbit.repository.exception.EntityReadOnlyException;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
@@ -24,9 +23,9 @@ import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
|
|||||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.vaadin.spring.events.EventBus;
|
import org.vaadin.spring.events.EventBus;
|
||||||
@@ -191,12 +190,11 @@ public class SoftwareModuleDetailsTable extends Table {
|
|||||||
} else {
|
} else {
|
||||||
final DistributionSet newDistributionSet = distributionSetManagement
|
final DistributionSet newDistributionSet = distributionSetManagement
|
||||||
.unassignSoftwareModule(distributionSet.getId(), unAssignedSw.getId());
|
.unassignSoftwareModule(distributionSet.getId(), unAssignedSw.getId());
|
||||||
manageDistUIState.setLastSelectedEntity(newDistributionSet.getId());
|
manageDistUIState.setLastSelectedEntityId(newDistributionSet.getId());
|
||||||
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.SELECTED_ENTITY, newDistributionSet));
|
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.SELECTED_ENTITY, newDistributionSet));
|
||||||
eventBus.publish(this, DistributionsUIEvent.ORDER_BY_DISTRIBUTION);
|
eventBus.publish(this, DistributionsUIEvent.ORDER_BY_DISTRIBUTION);
|
||||||
uiNotification.displaySuccess(i18n.getMessage("message.sw.unassigned", unAssignedSw.getName()));
|
uiNotification.displaySuccess(i18n.getMessage("message.sw.unassigned", unAssignedSw.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isSoftModAvaiableForSoftType(final Set<SoftwareModule> swModulesSet,
|
private static boolean isSoftModAvaiableForSoftType(final Set<SoftwareModule> swModulesSet,
|
||||||
@@ -218,7 +216,7 @@ public class SoftwareModuleDetailsTable extends Table {
|
|||||||
if (swModType.getKey().equals(sw.getType().getKey())) {
|
if (swModType.getKey().equals(sw.getType().getKey())) {
|
||||||
final HorizontalLayout horizontalLayout = new HorizontalLayout();
|
final HorizontalLayout horizontalLayout = new HorizontalLayout();
|
||||||
horizontalLayout.setSizeFull();
|
horizontalLayout.setSizeFull();
|
||||||
final Label softwareModule = HawkbitCommonUtil.getFormatedLabel(StringUtils.EMPTY);
|
final Label softwareModule = HawkbitCommonUtil.getFormatedLabel("");
|
||||||
final Button reassignSoftModule = SPUIComponentProvider.getButton(sw.getName(), "", "", "", true,
|
final Button reassignSoftModule = SPUIComponentProvider.getButton(sw.getName(), "", "", "", true,
|
||||||
FontAwesome.TIMES, SPUIButtonStyleSmallNoBorder.class);
|
FontAwesome.TIMES, SPUIButtonStyleSmallNoBorder.class);
|
||||||
reassignSoftModule
|
reassignSoftModule
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ import com.vaadin.ui.Button;
|
|||||||
import com.vaadin.ui.Button.ClickEvent;
|
import com.vaadin.ui.Button.ClickEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Abstract class for button click behavior. It is possible to click multiple
|
||||||
*
|
* buttons.
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractFilterMultiButtonClick extends AbstractFilterButtonClickBehaviour {
|
public abstract class AbstractFilterMultiButtonClick extends AbstractFilterButtonClickBehaviour {
|
||||||
|
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
|||||||
import org.eclipse.hawkbit.ui.common.builder.WindowBuilder;
|
import org.eclipse.hawkbit.ui.common.builder.WindowBuilder;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmall;
|
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmall;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.spring.events.EventBus;
|
import org.vaadin.spring.events.EventBus;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
|
|
||||||
@@ -37,11 +37,10 @@ import com.vaadin.ui.themes.ValoTheme;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Parent class for footer layout.
|
* Parent class for footer layout.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractDeleteActionsLayout extends VerticalLayout implements DropHandler {
|
public abstract class AbstractDeleteActionsLayout extends VerticalLayout implements DropHandler {
|
||||||
|
|
||||||
private static final long serialVersionUID = -6047975388519155509L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
protected VaadinMessageSource i18n;
|
protected VaadinMessageSource i18n;
|
||||||
|
|
||||||
@@ -100,17 +99,18 @@ public abstract class AbstractDeleteActionsLayout extends VerticalLayout impleme
|
|||||||
dropHintLayout.addComponent(getCountMessageLabel());
|
dropHintLayout.addComponent(getCountMessageLabel());
|
||||||
}
|
}
|
||||||
final HorizontalLayout hLayout = new HorizontalLayout();
|
final HorizontalLayout hLayout = new HorizontalLayout();
|
||||||
|
hLayout.setId(UIComponentIdProvider.ACTION_BUTTON_LAYOUT);
|
||||||
hLayout.setSpacing(true);
|
hLayout.setSpacing(true);
|
||||||
hLayout.setSizeUndefined();
|
hLayout.setSizeUndefined();
|
||||||
if (null != deleteWrapper) {
|
if (deleteWrapper != null) {
|
||||||
hLayout.addComponent(deleteWrapper);
|
hLayout.addComponent(deleteWrapper);
|
||||||
hLayout.setComponentAlignment(deleteWrapper, Alignment.BOTTOM_LEFT);
|
hLayout.setComponentAlignment(deleteWrapper, Alignment.BOTTOM_LEFT);
|
||||||
}
|
}
|
||||||
if (null != noActionBtn) {
|
if (noActionBtn != null) {
|
||||||
hLayout.addComponent(noActionBtn);
|
hLayout.addComponent(noActionBtn);
|
||||||
hLayout.setComponentAlignment(noActionBtn, Alignment.BOTTOM_LEFT);
|
hLayout.setComponentAlignment(noActionBtn, Alignment.BOTTOM_LEFT);
|
||||||
}
|
}
|
||||||
if (null != bulkUploadStatusButton) {
|
if (bulkUploadStatusButton != null) {
|
||||||
hLayout.addComponent(bulkUploadStatusButton);
|
hLayout.addComponent(bulkUploadStatusButton);
|
||||||
hLayout.setComponentAlignment(bulkUploadStatusButton, Alignment.BOTTOM_LEFT);
|
hLayout.setComponentAlignment(bulkUploadStatusButton, Alignment.BOTTOM_LEFT);
|
||||||
}
|
}
|
||||||
@@ -127,13 +127,13 @@ public abstract class AbstractDeleteActionsLayout extends VerticalLayout impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
private DragAndDropWrapper createDeleteWrapperLayout() {
|
private DragAndDropWrapper createDeleteWrapperLayout() {
|
||||||
final Button dropToDelete = new Button("Drop here to delete");
|
final Button dropToDelete = new Button(i18n.getMessage("label.components.drop.area"));
|
||||||
dropToDelete.setCaptionAsHtml(true);
|
dropToDelete.setCaptionAsHtml(true);
|
||||||
dropToDelete.setIcon(FontAwesome.TRASH_O);
|
dropToDelete.setIcon(FontAwesome.TRASH_O);
|
||||||
dropToDelete.addStyleName(ValoTheme.BUTTON_BORDERLESS);
|
dropToDelete.addStyleName(ValoTheme.BUTTON_BORDERLESS);
|
||||||
dropToDelete.addStyleName("drop-to-delete-button");
|
dropToDelete.addStyleName("drop-to-delete-button");
|
||||||
dropToDelete.addStyleName(SPUIStyleDefinitions.ACTION_BUTTON);
|
dropToDelete.addStyleName(SPUIStyleDefinitions.ACTION_BUTTON);
|
||||||
dropToDelete.addStyleName("del-action-button");
|
dropToDelete.addStyleName(SPUIStyleDefinitions.DEL_ACTION_BUTTON);
|
||||||
dropToDelete.addStyleName("delete-icon");
|
dropToDelete.addStyleName("delete-icon");
|
||||||
|
|
||||||
final DragAndDropWrapper wrapper = new DragAndDropWrapper(dropToDelete);
|
final DragAndDropWrapper wrapper = new DragAndDropWrapper(dropToDelete);
|
||||||
@@ -148,7 +148,7 @@ public abstract class AbstractDeleteActionsLayout extends VerticalLayout impleme
|
|||||||
final Button button = SPUIComponentProvider.getButton(UIComponentIdProvider.PENDING_ACTION_BUTTON,
|
final Button button = SPUIComponentProvider.getButton(UIComponentIdProvider.PENDING_ACTION_BUTTON,
|
||||||
getNoActionsButtonLabel(), "", "", false, FontAwesome.BELL, SPUIButtonStyleSmall.class);
|
getNoActionsButtonLabel(), "", "", false, FontAwesome.BELL, SPUIButtonStyleSmall.class);
|
||||||
button.setStyleName(SPUIStyleDefinitions.ACTION_BUTTON);
|
button.setStyleName(SPUIStyleDefinitions.ACTION_BUTTON);
|
||||||
button.addStyleName("del-action-button");
|
button.addStyleName(SPUIStyleDefinitions.DEL_ACTION_BUTTON);
|
||||||
|
|
||||||
button.addClickListener(event -> actionButtonClicked());
|
button.addClickListener(event -> actionButtonClicked());
|
||||||
button.setHtmlContentAllowed(true);
|
button.setHtmlContentAllowed(true);
|
||||||
@@ -255,7 +255,7 @@ public abstract class AbstractDeleteActionsLayout extends VerticalLayout impleme
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return true if the count label is displayed false is not displayed
|
* @return true if the count label is displayed; false is not displayed
|
||||||
*/
|
*/
|
||||||
protected boolean hasCountMessage() {
|
protected boolean hasCountMessage() {
|
||||||
return false;
|
return false;
|
||||||
@@ -290,7 +290,7 @@ public abstract class AbstractDeleteActionsLayout extends VerticalLayout impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check user has delete permission.
|
* Check if user has delete permission.
|
||||||
*
|
*
|
||||||
* @return true if user has permission, otherwise return false.
|
* @return true if user has permission, otherwise return false.
|
||||||
*/
|
*/
|
||||||
@@ -379,7 +379,7 @@ public abstract class AbstractDeleteActionsLayout extends VerticalLayout impleme
|
|||||||
/**
|
/**
|
||||||
* Check if any unsaved actions done by the user.
|
* Check if any unsaved actions done by the user.
|
||||||
*
|
*
|
||||||
* @return 'true' if any unsaved actions available, otherwise retrun
|
* @return 'true' if any unsaved actions available, otherwise return
|
||||||
* 'false'.
|
* 'false'.
|
||||||
*/
|
*/
|
||||||
protected abstract boolean hasUnsavedActions();
|
protected abstract boolean hasUnsavedActions();
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.common.grid;
|
package org.eclipse.hawkbit.ui.common.grid;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
|
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIButton;
|
import org.eclipse.hawkbit.ui.components.SPUIButton;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
@@ -42,7 +41,7 @@ public class DefaultGridHeader extends VerticalLayout {
|
|||||||
* @param managementUIState
|
* @param managementUIState
|
||||||
*/
|
*/
|
||||||
public DefaultGridHeader(final ManagementUIState managementUIState) {
|
public DefaultGridHeader(final ManagementUIState managementUIState) {
|
||||||
this(managementUIState, StringUtils.EMPTY);
|
this(managementUIState, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/**
|
||||||
|
* 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.common.table;
|
||||||
|
|
||||||
|
import org.vaadin.spring.events.EventBusListenerMethodFilter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class for filter classes which contains information about the origin
|
||||||
|
* view.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public abstract class AbstractBaseViewFilter implements EventBusListenerMethodFilter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean filter(final Object payload) {
|
||||||
|
|
||||||
|
if (!(payload instanceof BaseUIEvent)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
final BaseUIEvent event = (BaseUIEvent) payload;
|
||||||
|
|
||||||
|
return getOriginView().equals(event.getSource());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract Class<?> getOriginView();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -11,10 +11,10 @@ package org.eclipse.hawkbit.ui.common.table;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
|
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.TableColumn;
|
import org.eclipse.hawkbit.ui.utils.TableColumn;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
|
|
||||||
import com.vaadin.data.Item;
|
import com.vaadin.data.Item;
|
||||||
@@ -26,14 +26,13 @@ import com.vaadin.ui.DragAndDropWrapper;
|
|||||||
*
|
*
|
||||||
* @param <E>
|
* @param <E>
|
||||||
* e is the entity class
|
* e is the entity class
|
||||||
* @param <I>
|
|
||||||
* i is the id of the table
|
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractNamedVersionTable<E extends NamedVersionedEntity, I> extends AbstractTable<E, I> {
|
public abstract class AbstractNamedVersionTable<E extends NamedVersionedEntity> extends AbstractTable<E> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 780050712209750719L;
|
private static final long serialVersionUID = 780050712209750719L;
|
||||||
|
|
||||||
protected AbstractNamedVersionTable(final UIEventBus eventBus, final VaadinMessageSource i18n, final UINotification notification) {
|
protected AbstractNamedVersionTable(final UIEventBus eventBus, final VaadinMessageSource i18n,
|
||||||
|
final UINotification notification) {
|
||||||
super(eventBus, i18n, notification);
|
super(eventBus, i18n, notification);
|
||||||
setMultiSelect(true);
|
setMultiSelect(true);
|
||||||
setSelectable(true);
|
setSelectable(true);
|
||||||
@@ -43,8 +42,8 @@ public abstract class AbstractNamedVersionTable<E extends NamedVersionedEntity,
|
|||||||
protected List<TableColumn> getTableVisibleColumns() {
|
protected List<TableColumn> getTableVisibleColumns() {
|
||||||
final List<TableColumn> columnList = super.getTableVisibleColumns();
|
final List<TableColumn> columnList = super.getTableVisibleColumns();
|
||||||
final float versionColumnSize = isMaximized() ? 0.1F : 0.2F;
|
final float versionColumnSize = isMaximized() ? 0.1F : 0.2F;
|
||||||
columnList
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_VERSION, i18n.getMessage("header.version"),
|
||||||
.add(new TableColumn(SPUILabelDefinitions.VAR_VERSION, i18n.getMessage("header.version"), versionColumnSize));
|
versionColumnSize));
|
||||||
return columnList;
|
return columnList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,15 +19,15 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.common.ManagmentEntityState;
|
import org.eclipse.hawkbit.ui.common.ManagementEntityState;
|
||||||
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||||
import org.eclipse.hawkbit.ui.components.RefreshableContainer;
|
import org.eclipse.hawkbit.ui.components.RefreshableContainer;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.TableColumn;
|
import org.eclipse.hawkbit.ui.utils.TableColumn;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||||
import org.vaadin.spring.events.EventBus;
|
import org.vaadin.spring.events.EventBus;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
@@ -51,15 +51,13 @@ import com.vaadin.ui.themes.ValoTheme;
|
|||||||
*
|
*
|
||||||
* @param <E>
|
* @param <E>
|
||||||
* e is the entity class
|
* e is the entity class
|
||||||
* @param <I>
|
|
||||||
* i is the id of the table
|
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractTable<E extends NamedEntity, I> extends Table implements RefreshableContainer {
|
public abstract class AbstractTable<E extends NamedEntity> extends Table implements RefreshableContainer {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private static final float DEFAULT_COLUMN_NAME_MIN_SIZE = 0.8F;
|
private static final float DEFAULT_COLUMN_NAME_MIN_SIZE = 0.8F;
|
||||||
|
|
||||||
private static final long serialVersionUID = 4856562746502217630L;
|
|
||||||
|
|
||||||
protected static final String ACTION_NOT_ALLOWED_MSG = "message.action.not.allowed";
|
protected static final String ACTION_NOT_ALLOWED_MSG = "message.action.not.allowed";
|
||||||
|
|
||||||
protected transient EventBus.UIEventBus eventBus;
|
protected transient EventBus.UIEventBus eventBus;
|
||||||
@@ -68,7 +66,8 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table impl
|
|||||||
|
|
||||||
protected UINotification notification;
|
protected UINotification notification;
|
||||||
|
|
||||||
protected AbstractTable(final UIEventBus eventBus, final VaadinMessageSource i18n, final UINotification notification) {
|
protected AbstractTable(final UIEventBus eventBus, final VaadinMessageSource i18n,
|
||||||
|
final UINotification notification) {
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.i18n = i18n;
|
this.i18n = i18n;
|
||||||
this.notification = notification;
|
this.notification = notification;
|
||||||
@@ -84,7 +83,6 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table impl
|
|||||||
setDefault();
|
setDefault();
|
||||||
addValueChangeListener(event -> onValueChange());
|
addValueChangeListener(event -> onValueChange());
|
||||||
setPageLength(SPUIDefinitions.PAGE_SIZE);
|
setPageLength(SPUIDefinitions.PAGE_SIZE);
|
||||||
|
|
||||||
eventBus.subscribe(this);
|
eventBus.subscribe(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,26 +105,24 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table impl
|
|||||||
private void onValueChange() {
|
private void onValueChange() {
|
||||||
eventBus.publish(this, UploadArtifactUIEvent.HIDE_DROP_HINTS);
|
eventBus.publish(this, UploadArtifactUIEvent.HIDE_DROP_HINTS);
|
||||||
|
|
||||||
final Set<I> values = getTableValue(this);
|
final Set<Long> values = getTableValue(this);
|
||||||
|
|
||||||
I lastId = null;
|
Long lastId = null;
|
||||||
if (!values.isEmpty()) {
|
if (!values.isEmpty()) {
|
||||||
lastId = Iterables.getLast(values);
|
lastId = Iterables.getLast(values);
|
||||||
}
|
}
|
||||||
setManagementEntitiyStateValues(values, lastId);
|
setManagementEntityStateValues(values, lastId);
|
||||||
|
selectEntity(lastId);
|
||||||
if (lastId != null) {
|
afterEntityIsSelected();
|
||||||
findEntityByTableValue(lastId).ifPresent(this::publishEntityAfterValueChange);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setManagementEntitiyStateValues(final Set<I> values, final I lastId) {
|
protected void setManagementEntityStateValues(final Set<Long> values, final Long lastId) {
|
||||||
final ManagmentEntityState<I> managmentEntityState = getManagmentEntityState();
|
final ManagementEntityState managementEntityState = getManagementEntityState();
|
||||||
if (managmentEntityState == null) {
|
if (managementEntityState == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
managmentEntityState.setLastSelectedEntity(lastId);
|
managementEntityState.setLastSelectedEntityId(lastId);
|
||||||
managmentEntityState.setSelectedEnitities(values);
|
managementEntityState.setSelectedEnitities(values);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDefault() {
|
private void setDefault() {
|
||||||
@@ -241,28 +237,53 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table impl
|
|||||||
* the table transferable
|
* the table transferable
|
||||||
* @return set of entities id which will deleted
|
* @return set of entities id which will deleted
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
public Set<Long> getDeletedEntityByTransferable(final TableTransferable transferable) {
|
||||||
public Set<I> getDeletedEntityByTransferable(final TableTransferable transferable) {
|
final Set<Long> selectedEntities = getTableValue(this);
|
||||||
final Set<I> selectedEntities = (Set<I>) getTableValue(this);
|
final Set<Long> ids = new HashSet<>();
|
||||||
final Set<I> ids = new HashSet<>();
|
final Long tranferableData = (Long) transferable.getData(SPUIDefinitions.ITEMID);
|
||||||
final Object tranferableData = transferable.getData(SPUIDefinitions.ITEMID);
|
|
||||||
if (tranferableData == null) {
|
if (tranferableData == null) {
|
||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!selectedEntities.contains(tranferableData)) {
|
if (!selectedEntities.contains(tranferableData)) {
|
||||||
ids.add((I) tranferableData);
|
ids.add(tranferableData);
|
||||||
} else {
|
} else {
|
||||||
ids.addAll(selectedEntities);
|
ids.addAll(selectedEntities);
|
||||||
}
|
}
|
||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract Optional<E> findEntityByTableValue(I lastSelectedId);
|
/**
|
||||||
|
* Finds the entity object of the given entity ID by performing a database
|
||||||
|
* search
|
||||||
|
*
|
||||||
|
* @param lastSelectedId
|
||||||
|
* ID of the entity
|
||||||
|
* @return entity object as Optional
|
||||||
|
*/
|
||||||
|
protected abstract Optional<E> findEntityByTableValue(Long lastSelectedId);
|
||||||
|
|
||||||
protected abstract void publishEntityAfterValueChange(E selectedLastEntity);
|
/**
|
||||||
|
* This method is performed after selecting the current entity in the table.
|
||||||
|
*/
|
||||||
|
protected void afterEntityIsSelected() {
|
||||||
|
// can be overridden by subclass
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract ManagmentEntityState<I> getManagmentEntityState();
|
/**
|
||||||
|
* Publish the BaseEntityEventType.SELECTED_ENTITY Event with the given
|
||||||
|
* entity.
|
||||||
|
*
|
||||||
|
* @param selectedLastEntity
|
||||||
|
* entity that was selected in the table
|
||||||
|
*/
|
||||||
|
protected abstract void publishSelectedEntityEvent(final E selectedLastEntity);
|
||||||
|
|
||||||
|
protected void setLastSelectedEntityId(final Long selectedLastEntityId) {
|
||||||
|
getManagementEntityState().setLastSelectedEntityId(selectedLastEntityId);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract ManagementEntityState getManagementEntityState();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Id of the table.
|
* Get Id of the table.
|
||||||
@@ -292,14 +313,16 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if first row should be selected by default on load.
|
* Check if the first row should be selected by default on load. (if there
|
||||||
|
* is no other item selected)
|
||||||
*
|
*
|
||||||
* @return true if it should be selected otherwise return false.
|
* @return true if it should be selected otherwise return false, if there is
|
||||||
|
* a different item already selected.
|
||||||
*/
|
*/
|
||||||
protected abstract boolean isFirstRowSelectedOnLoad();
|
protected abstract boolean isFirstRowSelectedOnLoad();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Item Id should be displayed as selected.
|
* Get Item Id which should be displayed as selected.
|
||||||
*
|
*
|
||||||
* @return reference of Item Id of the Row.
|
* @return reference of Item Id of the Row.
|
||||||
*/
|
*/
|
||||||
@@ -326,10 +349,12 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table impl
|
|||||||
}
|
}
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.getMessage("header.name"), 0.2F));
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.getMessage("header.name"), 0.2F));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_BY, i18n.getMessage("header.createdBy"), 0.1F));
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_BY, i18n.getMessage("header.createdBy"), 0.1F));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_DATE, i18n.getMessage("header.createdDate"), 0.1F));
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, i18n.getMessage("header.modifiedBy"), 0.1F));
|
|
||||||
columnList.add(
|
columnList.add(
|
||||||
new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, i18n.getMessage("header.modifiedDate"), 0.1F));
|
new TableColumn(SPUILabelDefinitions.VAR_CREATED_DATE, i18n.getMessage("header.createdDate"), 0.1F));
|
||||||
|
columnList.add(
|
||||||
|
new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, i18n.getMessage("header.modifiedBy"), 0.1F));
|
||||||
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE,
|
||||||
|
i18n.getMessage("header.modifiedDate"), 0.1F));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_DESC, i18n.getMessage("header.description"), 0.2F));
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_DESC, i18n.getMessage("header.description"), 0.2F));
|
||||||
setItemDescriptionGenerator((source, itemId, propertyId) -> {
|
setItemDescriptionGenerator((source, itemId, propertyId) -> {
|
||||||
|
|
||||||
@@ -372,24 +397,24 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table impl
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Set<I> getDraggedTargetList(final DragAndDropEvent event) {
|
protected Set<Long> getDraggedTargetList(final DragAndDropEvent event) {
|
||||||
final com.vaadin.event.dd.TargetDetails targetDet = event.getTargetDetails();
|
final com.vaadin.event.dd.TargetDetails targetDet = event.getTargetDetails();
|
||||||
final Table targetTable = (Table) targetDet.getTarget();
|
final Table targetTable = (Table) targetDet.getTarget();
|
||||||
final Set<I> targetSelected = getTableValue(targetTable);
|
final Set<Long> targetSelected = getTableValue(targetTable);
|
||||||
|
|
||||||
final AbstractSelectTargetDetails dropData = (AbstractSelectTargetDetails) event.getTargetDetails();
|
final AbstractSelectTargetDetails dropData = (AbstractSelectTargetDetails) event.getTargetDetails();
|
||||||
final Object targetItemId = dropData.getItemIdOver();
|
final Long targetItemId = (Long) dropData.getItemIdOver();
|
||||||
|
|
||||||
if (!targetSelected.contains(targetItemId)) {
|
if (!targetSelected.contains(targetItemId)) {
|
||||||
return Sets.newHashSet((I) targetItemId);
|
return Sets.newHashSet(targetItemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return targetSelected;
|
return targetSelected;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<Object> getDraggedTargetList(final TableTransferable transferable, final Table source) {
|
private Set<Long> getDraggedTargetList(final TableTransferable transferable, final Table source) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
final AbstractTable<NamedEntity, Object> table = (AbstractTable<NamedEntity, Object>) source;
|
final AbstractTable<NamedEntity> table = (AbstractTable<NamedEntity>) source;
|
||||||
return table.getDeletedEntityByTransferable(transferable);
|
return table.getDeletedEntityByTransferable(transferable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -432,9 +457,6 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table impl
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Refresh the container.
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void refreshContainer() {
|
public void refreshContainer() {
|
||||||
final Container container = getContainerDataSource();
|
final Container container = getContainerDataSource();
|
||||||
@@ -448,6 +470,23 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table impl
|
|||||||
return notification;
|
return notification;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the entity object of the given entity ID and performs the
|
||||||
|
* publishing of the BaseEntityEventType.SELECTED_ENTITY event
|
||||||
|
*
|
||||||
|
* @param entityId
|
||||||
|
* ID of the current entity
|
||||||
|
*/
|
||||||
|
public void selectEntity(final Long entityId) {
|
||||||
|
E entity = null;
|
||||||
|
if (entityId != null) {
|
||||||
|
entity = findEntityByTableValue(entityId).orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
setLastSelectedEntityId(entityId);
|
||||||
|
publishSelectedEntityEvent(entity);
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract boolean hasDropPermission();
|
protected abstract boolean hasDropPermission();
|
||||||
|
|
||||||
protected abstract boolean validateDragAndDropWrapper(final DragAndDropWrapper wrapperSource);
|
protected abstract boolean validateDragAndDropWrapper(final DragAndDropWrapper wrapperSource);
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
|||||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.spring.events.EventBus;
|
import org.vaadin.spring.events.EventBus;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ import com.vaadin.ui.VerticalLayout;
|
|||||||
*/
|
*/
|
||||||
public abstract class AbstractTableHeader extends VerticalLayout {
|
public abstract class AbstractTableHeader extends VerticalLayout {
|
||||||
|
|
||||||
private static final long serialVersionUID = 4881626370291837175L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
protected VaadinMessageSource i18n;
|
protected VaadinMessageSource i18n;
|
||||||
|
|
||||||
@@ -64,13 +64,15 @@ public abstract class AbstractTableHeader extends VerticalLayout {
|
|||||||
|
|
||||||
private Button bulkUploadIcon;
|
private Button bulkUploadIcon;
|
||||||
|
|
||||||
protected final ManagementUIState managementUIState;
|
private final ManagementUIState managementUIState;
|
||||||
protected final ManageDistUIState manageDistUIstate;
|
|
||||||
protected final ArtifactUploadState artifactUploadState;
|
|
||||||
|
|
||||||
protected AbstractTableHeader(final VaadinMessageSource i18n, final SpPermissionChecker permChecker, final UIEventBus eventbus,
|
private final ManageDistUIState manageDistUIstate;
|
||||||
final ManagementUIState managementUIState, final ManageDistUIState manageDistUIstate,
|
|
||||||
final ArtifactUploadState artifactUploadState) {
|
private final ArtifactUploadState artifactUploadState;
|
||||||
|
|
||||||
|
protected AbstractTableHeader(final VaadinMessageSource i18n, final SpPermissionChecker permChecker,
|
||||||
|
final UIEventBus eventbus, final ManagementUIState managementUIState,
|
||||||
|
final ManageDistUIState manageDistUIstate, final ArtifactUploadState artifactUploadState) {
|
||||||
this.i18n = i18n;
|
this.i18n = i18n;
|
||||||
this.permChecker = permChecker;
|
this.permChecker = permChecker;
|
||||||
this.eventbus = eventbus;
|
this.eventbus = eventbus;
|
||||||
@@ -535,4 +537,16 @@ public abstract class AbstractTableHeader extends VerticalLayout {
|
|||||||
|
|
||||||
protected abstract void addNewItem(final Button.ClickEvent event);
|
protected abstract void addNewItem(final Button.ClickEvent event);
|
||||||
|
|
||||||
|
protected ManagementUIState getManagementUIState() {
|
||||||
|
return managementUIState;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ManageDistUIState getManageDistUIstate() {
|
||||||
|
return manageDistUIstate;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ArtifactUploadState getArtifactUploadState() {
|
||||||
|
return artifactUploadState;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import com.vaadin.ui.themes.ValoTheme;
|
|||||||
* @param <T>
|
* @param <T>
|
||||||
* type of the concrete table
|
* type of the concrete table
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractTableLayout<T extends AbstractTable<?, ?>> extends VerticalLayout {
|
public abstract class AbstractTableLayout<T extends AbstractTable<?>> extends VerticalLayout {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/**
|
||||||
|
* 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.common.table;
|
||||||
|
|
||||||
|
import com.vaadin.ui.UI;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class which every UI event should inherit from. The class provides
|
||||||
|
* information about the view the event was published from.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class BaseUIEvent {
|
||||||
|
|
||||||
|
private final Class<?> source;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for BaseUIEvent
|
||||||
|
*/
|
||||||
|
public BaseUIEvent() {
|
||||||
|
this.source = UI.getCurrent().getNavigator().getCurrentView().getClass();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Class<?> getSource() {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -8,6 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.common.tagdetails;
|
package org.eclipse.hawkbit.ui.common.tagdetails;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.TagManagement;
|
import org.eclipse.hawkbit.repository.TagManagement;
|
||||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
@@ -18,8 +20,8 @@ import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
|||||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
import org.vaadin.spring.events.EventScope;
|
import org.vaadin.spring.events.EventScope;
|
||||||
@@ -43,9 +45,9 @@ public class TargetTagToken extends AbstractTargetTagToken<Target> {
|
|||||||
|
|
||||||
private final transient TargetManagement targetManagement;
|
private final transient TargetManagement targetManagement;
|
||||||
|
|
||||||
public TargetTagToken(final SpPermissionChecker checker, final VaadinMessageSource i18n, final UINotification uinotification,
|
public TargetTagToken(final SpPermissionChecker checker, final VaadinMessageSource i18n,
|
||||||
final UIEventBus eventBus, final ManagementUIState managementUIState, final TagManagement tagManagement,
|
final UINotification uinotification, final UIEventBus eventBus, final ManagementUIState managementUIState,
|
||||||
final TargetManagement targetManagement) {
|
final TagManagement tagManagement, final TargetManagement targetManagement) {
|
||||||
super(checker, i18n, uinotification, eventBus, managementUIState, tagManagement);
|
super(checker, i18n, uinotification, eventBus, managementUIState, tagManagement);
|
||||||
this.targetManagement = targetManagement;
|
this.targetManagement = targetManagement;
|
||||||
}
|
}
|
||||||
@@ -123,17 +125,19 @@ public class TargetTagToken extends AbstractTargetTagToken<Target> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isAssign(final TargetTagAssignmentResult assignmentResult) {
|
protected boolean isAssign(final TargetTagAssignmentResult assignmentResult) {
|
||||||
if (assignmentResult.getAssigned() > 0 && managementUIState.getLastSelectedTargetId() != null) {
|
final Optional<Long> targetId = managementUIState.getLastSelectedTargetId();
|
||||||
|
if (assignmentResult.getAssigned() > 0 && targetId.isPresent()) {
|
||||||
return assignmentResult.getAssignedEntity().stream().map(Target::getId)
|
return assignmentResult.getAssignedEntity().stream().map(Target::getId)
|
||||||
.anyMatch(controllerId -> controllerId.equals(managementUIState.getLastSelectedTargetId()));
|
.anyMatch(controllerId -> controllerId.equals(targetId.get()));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isUnassign(final TargetTagAssignmentResult assignmentResult) {
|
protected boolean isUnassign(final TargetTagAssignmentResult assignmentResult) {
|
||||||
if (assignmentResult.getUnassigned() > 0 && managementUIState.getLastSelectedTargetId() != null) {
|
final Optional<Long> targetId = managementUIState.getLastSelectedTargetId();
|
||||||
|
if (assignmentResult.getUnassigned() > 0 && targetId.isPresent()) {
|
||||||
return assignmentResult.getUnassignedEntity().stream().map(Target::getId)
|
return assignmentResult.getUnassignedEntity().stream().map(Target::getId)
|
||||||
.anyMatch(controllerId -> controllerId.equals(managementUIState.getLastSelectedTargetId()));
|
.anyMatch(controllerId -> controllerId.equals(targetId.get()));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import com.vaadin.ui.VerticalLayout;
|
|||||||
public abstract class AbstractNotificationView extends VerticalLayout implements View {
|
public abstract class AbstractNotificationView extends VerticalLayout implements View {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final transient Cache<BaseUIEntityEvent<?>, Object> skipUiEventsCache;
|
private final transient Cache<BaseUIEntityEvent<?>, Object> skipUiEventsCache;
|
||||||
|
|
||||||
private final transient EventBus.UIEventBus eventBus;
|
private final transient EventBus.UIEventBus eventBus;
|
||||||
@@ -116,8 +117,6 @@ public abstract class AbstractNotificationView extends VerticalLayout implements
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh the view by event container changes.
|
* Refresh the view by event container changes.
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public void refreshView() {
|
public void refreshView() {
|
||||||
if (viewUnreadNotifcations.get() <= 0) {
|
if (viewUnreadNotifcations.get() <= 0) {
|
||||||
@@ -163,7 +162,6 @@ public abstract class AbstractNotificationView extends VerticalLayout implements
|
|||||||
protected abstract Map<Class<?>, RefreshableContainer> getSupportedPushEvents();
|
protected abstract Map<Class<?>, RefreshableContainer> getSupportedPushEvents();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @return the related dashboard menu item for this view.
|
* @return the related dashboard menu item for this view.
|
||||||
*/
|
*/
|
||||||
protected abstract DashboardMenuItem getDashboardMenuItem();
|
protected abstract DashboardMenuItem getDashboardMenuItem();
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
|
|||||||
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonDecorator;
|
import org.eclipse.hawkbit.ui.decorators.SPUIButtonDecorator;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIComboBoxDecorator;
|
import org.eclipse.hawkbit.ui.decorators.SPUIComboBoxDecorator;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@ public final class SPUIComponentProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Label createUsernameLabel(final String label, final String username) {
|
private static Label createUsernameLabel(final String label, final String username) {
|
||||||
String loadAndFormatUsername = StringUtils.EMPTY;
|
String loadAndFormatUsername = "";
|
||||||
if (!StringUtils.isEmpty(username)) {
|
if (!StringUtils.isEmpty(username)) {
|
||||||
loadAndFormatUsername = UserDetailsFormatter.loadAndFormatUsername(username);
|
loadAndFormatUsername = UserDetailsFormatter.loadAndFormatUsername(username);
|
||||||
}
|
}
|
||||||
@@ -233,7 +233,7 @@ public final class SPUIComponentProvider {
|
|||||||
*/
|
*/
|
||||||
public static Label createCreatedByLabel(final VaadinMessageSource i18n, final BaseEntity baseEntity) {
|
public static Label createCreatedByLabel(final VaadinMessageSource i18n, final BaseEntity baseEntity) {
|
||||||
return createUsernameLabel(i18n.getMessage("label.created.by"),
|
return createUsernameLabel(i18n.getMessage("label.created.by"),
|
||||||
baseEntity == null ? StringUtils.EMPTY : baseEntity.getCreatedBy());
|
baseEntity == null ? "" : baseEntity.getCreatedBy());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -248,7 +248,7 @@ public final class SPUIComponentProvider {
|
|||||||
*/
|
*/
|
||||||
public static Label createLastModifiedByLabel(final VaadinMessageSource i18n, final BaseEntity baseEntity) {
|
public static Label createLastModifiedByLabel(final VaadinMessageSource i18n, final BaseEntity baseEntity) {
|
||||||
return createUsernameLabel(i18n.getMessage("label.modified.by"),
|
return createUsernameLabel(i18n.getMessage("label.modified.by"),
|
||||||
baseEntity == null ? StringUtils.EMPTY : baseEntity.getLastModifiedBy());
|
baseEntity == null ? "" : baseEntity.getLastModifiedBy());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -40,15 +40,16 @@ import org.eclipse.hawkbit.ui.push.DistributionCreatedEventContainer;
|
|||||||
import org.eclipse.hawkbit.ui.push.DistributionDeletedEventContainer;
|
import org.eclipse.hawkbit.ui.push.DistributionDeletedEventContainer;
|
||||||
import org.eclipse.hawkbit.ui.push.SoftwareModuleCreatedEventContainer;
|
import org.eclipse.hawkbit.ui.push.SoftwareModuleCreatedEventContainer;
|
||||||
import org.eclipse.hawkbit.ui.push.SoftwareModuleDeletedEventContainer;
|
import org.eclipse.hawkbit.ui.push.SoftwareModuleDeletedEventContainer;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
import org.vaadin.spring.events.EventScope;
|
import org.vaadin.spring.events.EventScope;
|
||||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
|
||||||
import com.vaadin.server.Page;
|
import com.vaadin.server.Page;
|
||||||
import com.vaadin.server.Page.BrowserWindowResizeEvent;
|
import com.vaadin.server.Page.BrowserWindowResizeEvent;
|
||||||
import com.vaadin.server.Page.BrowserWindowResizeListener;
|
import com.vaadin.server.Page.BrowserWindowResizeListener;
|
||||||
@@ -64,8 +65,9 @@ import com.vaadin.ui.GridLayout;
|
|||||||
@SpringView(name = DistributionsView.VIEW_NAME, ui = HawkbitUI.class)
|
@SpringView(name = DistributionsView.VIEW_NAME, ui = HawkbitUI.class)
|
||||||
public class DistributionsView extends AbstractNotificationView implements BrowserWindowResizeListener {
|
public class DistributionsView extends AbstractNotificationView implements BrowserWindowResizeListener {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public static final String VIEW_NAME = "distributions";
|
public static final String VIEW_NAME = "distributions";
|
||||||
private static final long serialVersionUID = 3887435076372276300L;
|
|
||||||
|
|
||||||
private final SpPermissionChecker permChecker;
|
private final SpPermissionChecker permChecker;
|
||||||
|
|
||||||
@@ -122,7 +124,6 @@ public class DistributionsView extends AbstractNotificationView implements Brows
|
|||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
void init() {
|
void init() {
|
||||||
// Build the Distributions view layout with all the required components.
|
|
||||||
buildLayout();
|
buildLayout();
|
||||||
restoreState();
|
restoreState();
|
||||||
checkNoDataAvaialble();
|
checkNoDataAvaialble();
|
||||||
@@ -130,6 +131,15 @@ public class DistributionsView extends AbstractNotificationView implements Brows
|
|||||||
showOrHideFilterButtons(Page.getCurrent().getBrowserWindowWidth());
|
showOrHideFilterButtons(Page.getCurrent().getBrowserWindowWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter(final ViewChangeEvent event) {
|
||||||
|
softwareModuleTableLayout.getSwModuleTable()
|
||||||
|
.selectEntity(manageDistUIState.getLastSelectedSoftwareModule().orElse(null));
|
||||||
|
|
||||||
|
distributionTableLayout.getDistributionSetTable()
|
||||||
|
.selectEntity(manageDistUIState.getLastSelectedDistribution().orElse(null));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DashboardMenuItem getDashboardMenuItem() {
|
protected DashboardMenuItem getDashboardMenuItem() {
|
||||||
return distributionsViewMenuItem;
|
return distributionsViewMenuItem;
|
||||||
@@ -145,15 +155,19 @@ public class DistributionsView extends AbstractNotificationView implements Brows
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void buildLayout() {
|
private void buildLayout() {
|
||||||
// Check if user has permissions
|
if (!hasUserPermission()) {
|
||||||
if (permChecker.hasUpdateDistributionPermission() || permChecker.hasCreateDistributionPermission()
|
return;
|
||||||
|| permChecker.hasReadDistributionPermission()) {
|
}
|
||||||
setSizeFull();
|
setSizeFull();
|
||||||
setStyleName("rootLayout");
|
setStyleName("rootLayout");
|
||||||
createMainLayout();
|
createMainLayout();
|
||||||
addComponents(mainLayout);
|
addComponents(mainLayout);
|
||||||
setExpandRatio(mainLayout, 1);
|
setExpandRatio(mainLayout, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean hasUserPermission() {
|
||||||
|
return permChecker.hasUpdateDistributionPermission() || permChecker.hasCreateDistributionPermission()
|
||||||
|
|| permChecker.hasReadDistributionPermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createMainLayout() {
|
private void createMainLayout() {
|
||||||
@@ -227,7 +241,6 @@ public class DistributionsView extends AbstractNotificationView implements Brows
|
|||||||
|
|
||||||
private void checkNoDataAvaialble() {
|
private void checkNoDataAvaialble() {
|
||||||
if (manageDistUIState.isNoDataAvilableSwModule() && manageDistUIState.isNoDataAvailableDist()) {
|
if (manageDistUIState.isNoDataAvilableSwModule() && manageDistUIState.isNoDataAvailableDist()) {
|
||||||
|
|
||||||
uiNotification.displayValidationError(i18n.getMessage("message.no.data"));
|
uiNotification.displayValidationError(i18n.getMessage("message.no.data"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -239,7 +252,6 @@ public class DistributionsView extends AbstractNotificationView implements Brows
|
|||||||
|
|
||||||
private void showOrHideFilterButtons(final int browserWidth) {
|
private void showOrHideFilterButtons(final int browserWidth) {
|
||||||
if (browserWidth < SPUIDefinitions.REQ_MIN_BROWSER_WIDTH) {
|
if (browserWidth < SPUIDefinitions.REQ_MIN_BROWSER_WIDTH) {
|
||||||
|
|
||||||
filterByDSTypeLayout.setVisible(false);
|
filterByDSTypeLayout.setVisible(false);
|
||||||
distributionTableLayout.setShowFilterButtonVisible(true);
|
distributionTableLayout.setShowFilterButtonVisible(true);
|
||||||
filterBySMTypeLayout.setVisible(false);
|
filterBySMTypeLayout.setVisible(false);
|
||||||
@@ -248,7 +260,6 @@ public class DistributionsView extends AbstractNotificationView implements Brows
|
|||||||
if (!manageDistUIState.isDistTypeFilterClosed()) {
|
if (!manageDistUIState.isDistTypeFilterClosed()) {
|
||||||
filterByDSTypeLayout.setVisible(true);
|
filterByDSTypeLayout.setVisible(true);
|
||||||
distributionTableLayout.setShowFilterButtonVisible(false);
|
distributionTableLayout.setShowFilterButtonVisible(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!manageDistUIState.isSwTypeFilterClosed()) {
|
if (!manageDistUIState.isSwTypeFilterClosed()) {
|
||||||
filterBySMTypeLayout.setVisible(true);
|
filterBySMTypeLayout.setVisible(true);
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import java.util.Optional;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
@@ -33,11 +32,11 @@ import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTypeEvent;
|
|||||||
import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTypeEvent.DistributionSetTypeEnum;
|
import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTypeEvent.DistributionSetTypeEnum;
|
||||||
import org.eclipse.hawkbit.ui.layouts.CreateUpdateTypeLayout;
|
import org.eclipse.hawkbit.ui.layouts.CreateUpdateTypeLayout;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||||
@@ -127,12 +126,13 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
|
|||||||
.styleName(ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.DIST_SET_TYPE_DESC)
|
.styleName(ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.DIST_SET_TYPE_DESC)
|
||||||
.prompt(i18n.getMessage("textfield.description")).immediate(true)
|
.prompt(i18n.getMessage("textfield.description")).immediate(true)
|
||||||
.id(SPUIDefinitions.NEW_DISTRIBUTION_TYPE_DESC).buildTextComponent();
|
.id(SPUIDefinitions.NEW_DISTRIBUTION_TYPE_DESC).buildTextComponent();
|
||||||
tagDesc.setNullRepresentation(StringUtils.EMPTY);
|
tagDesc.setNullRepresentation("");
|
||||||
}
|
}
|
||||||
|
|
||||||
private TextField createTextField(final String in18Key, final String styleName, final String id) {
|
private TextField createTextField(final String in18Key, final String styleName, final String id) {
|
||||||
return new TextFieldBuilder().caption(i18n.getMessage(in18Key)).styleName(ValoTheme.TEXTFIELD_TINY + " " + styleName)
|
return new TextFieldBuilder().caption(i18n.getMessage(in18Key))
|
||||||
.required(true).prompt(i18n.getMessage(in18Key)).immediate(true).id(id).buildTextComponent();
|
.styleName(ValoTheme.TEXTFIELD_TINY + " " + styleName).required(true).prompt(i18n.getMessage(in18Key))
|
||||||
|
.immediate(true).id(id).buildTextComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -400,7 +400,8 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
|
|||||||
final DistributionSetType newDistType = distributionSetManagement.createDistributionSetType(
|
final DistributionSetType newDistType = distributionSetManagement.createDistributionSetType(
|
||||||
entityFactory.distributionSetType().create().key(typeKeyValue).name(typeNameValue)
|
entityFactory.distributionSetType().create().key(typeKeyValue).name(typeNameValue)
|
||||||
.description(typeDescValue).colour(colorPicked).mandatory(mandatory).optional(optional));
|
.description(typeDescValue).colour(colorPicked).mandatory(mandatory).optional(optional));
|
||||||
uiNotification.displaySuccess(i18n.getMessage("message.save.success", new Object[] { newDistType.getName() }));
|
uiNotification
|
||||||
|
.displaySuccess(i18n.getMessage("message.save.success", new Object[] { newDistType.getName() }));
|
||||||
eventBus.publish(this,
|
eventBus.publish(this,
|
||||||
new DistributionSetTypeEvent(DistributionSetTypeEnum.ADD_DIST_SET_TYPE, newDistType));
|
new DistributionSetTypeEvent(DistributionSetTypeEnum.ADD_DIST_SET_TYPE, newDistType));
|
||||||
} else {
|
} else {
|
||||||
@@ -439,7 +440,8 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
|
|||||||
|
|
||||||
final DistributionSetType updateDistSetType = distributionSetManagement.updateDistributionSetType(update);
|
final DistributionSetType updateDistSetType = distributionSetManagement.updateDistributionSetType(update);
|
||||||
|
|
||||||
uiNotification.displaySuccess(i18n.getMessage("message.update.success", new Object[] { updateDistSetType.getName() }));
|
uiNotification.displaySuccess(
|
||||||
|
i18n.getMessage("message.update.success", new Object[] { updateDistSetType.getName() }));
|
||||||
eventBus.publish(this,
|
eventBus.publish(this,
|
||||||
new DistributionSetTypeEvent(DistributionSetTypeEnum.UPDATE_DIST_SET_TYPE, updateDistSetType));
|
new DistributionSetTypeEvent(DistributionSetTypeEnum.UPDATE_DIST_SET_TYPE, updateDistSetType));
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import java.io.Serializable;
|
|||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterSingleButtonClick;
|
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterSingleButtonClick;
|
||||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableFilterEvent;
|
import org.eclipse.hawkbit.ui.management.event.RefreshDistributionTableByFilterEvent;
|
||||||
import org.vaadin.spring.events.EventBus;
|
import org.vaadin.spring.events.EventBus;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ import com.vaadin.ui.Button;
|
|||||||
*/
|
*/
|
||||||
public class DSTypeFilterButtonClick extends AbstractFilterSingleButtonClick implements Serializable {
|
public class DSTypeFilterButtonClick extends AbstractFilterSingleButtonClick implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -584783755917528648L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final transient EventBus.UIEventBus eventBus;
|
private final transient EventBus.UIEventBus eventBus;
|
||||||
|
|
||||||
@@ -42,16 +42,14 @@ public class DSTypeFilterButtonClick extends AbstractFilterSingleButtonClick imp
|
|||||||
@Override
|
@Override
|
||||||
protected void filterUnClicked(final Button clickedButton) {
|
protected void filterUnClicked(final Button clickedButton) {
|
||||||
manageDistUIState.getManageDistFilters().setClickedDistSetType(null);
|
manageDistUIState.getManageDistFilters().setClickedDistSetType(null);
|
||||||
eventBus.publish(this, DistributionTableFilterEvent.FILTER_BY_TAG);
|
eventBus.publish(this, new RefreshDistributionTableByFilterEvent());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void filterClicked(final Button clickedButton) {
|
protected void filterClicked(final Button clickedButton) {
|
||||||
distributionSetManagement.findDistributionSetTypeByName(clickedButton.getData().toString())
|
distributionSetManagement.findDistributionSetTypeByName(clickedButton.getData().toString())
|
||||||
.ifPresent(manageDistUIState.getManageDistFilters()::setClickedDistSetType);
|
.ifPresent(manageDistUIState.getManageDistFilters()::setClickedDistSetType);
|
||||||
eventBus.publish(this, DistributionTableFilterEvent.FILTER_BY_TAG);
|
eventBus.publish(this, new RefreshDistributionTableByFilterEvent());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
@@ -218,7 +217,7 @@ public class DistributionSetDetails extends AbstractDistributionSetDetails {
|
|||||||
final VerticalLayout verticalLayout = new VerticalLayout();
|
final VerticalLayout verticalLayout = new VerticalLayout();
|
||||||
final HorizontalLayout horizontalLayout = new HorizontalLayout();
|
final HorizontalLayout horizontalLayout = new HorizontalLayout();
|
||||||
horizontalLayout.setSizeFull();
|
horizontalLayout.setSizeFull();
|
||||||
final Label softwareModule = HawkbitCommonUtil.getFormatedLabel(StringUtils.EMPTY);
|
final Label softwareModule = HawkbitCommonUtil.getFormatedLabel("");
|
||||||
final Button reassignSoftModule = assignSoftModuleButton(softwareModuleName);
|
final Button reassignSoftModule = assignSoftModuleButton(softwareModuleName);
|
||||||
softwareModule.setValue(softwareModuleName);
|
softwareModule.setValue(softwareModuleName);
|
||||||
softwareModule.setDescription(softwareModuleName);
|
softwareModule.setDescription(softwareModuleName);
|
||||||
@@ -234,11 +233,6 @@ public class DistributionSetDetails extends AbstractDistributionSetDetails {
|
|||||||
tfqDetailsTable.populateTableByDistributionSet(getSelectedBaseEntity());
|
tfqDetailsTable.populateTableByDistributionSet(getSelectedBaseEntity());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean onLoadIsTableRowSelected() {
|
|
||||||
return manageDistUIState.getSelectedDistributions().map(selected -> !selected.isEmpty()).orElse(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onLoadIsTableMaximized() {
|
protected boolean onLoadIsTableMaximized() {
|
||||||
return manageDistUIState.isDsTableMaximized();
|
return manageDistUIState.isDsTableMaximized();
|
||||||
|
|||||||
@@ -37,16 +37,17 @@ import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
|
|||||||
import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
|
import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
|
||||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableFilterEvent;
|
import org.eclipse.hawkbit.ui.management.event.RefreshDistributionTableByFilterEvent;
|
||||||
import org.eclipse.hawkbit.ui.push.DistributionSetUpdatedEventContainer;
|
import org.eclipse.hawkbit.ui.push.DistributionSetUpdatedEventContainer;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.TableColumn;
|
import org.eclipse.hawkbit.ui.utils.TableColumn;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
|
import org.eclipse.hawkbit.ui.view.filter.OnlyEventsFromDistributionsViewFilter;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||||
@@ -70,9 +71,9 @@ import com.vaadin.ui.UI;
|
|||||||
/**
|
/**
|
||||||
* Distribution set table.
|
* Distribution set table.
|
||||||
*/
|
*/
|
||||||
public class DistributionSetTable extends AbstractNamedVersionTable<DistributionSet, Long> {
|
public class DistributionSetTable extends AbstractNamedVersionTable<DistributionSet> {
|
||||||
|
|
||||||
private static final long serialVersionUID = -7731776093470487988L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(DistributionSetTable.class);
|
private static final Logger LOG = LoggerFactory.getLogger(DistributionSetTable.class);
|
||||||
|
|
||||||
@@ -104,7 +105,6 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
|
|||||||
this.targetManagement = targetManagement;
|
this.targetManagement = targetManagement;
|
||||||
this.dsMetadataPopupLayout = dsMetadataPopupLayout;
|
this.dsMetadataPopupLayout = dsMetadataPopupLayout;
|
||||||
addTableStyleGenerator();
|
addTableStyleGenerator();
|
||||||
|
|
||||||
addNewContainerDS();
|
addNewContainerDS();
|
||||||
setColumnProperties();
|
setColumnProperties();
|
||||||
setDataAvailable(getContainerDataSource().size() != 0);
|
setDataAvailable(getContainerDataSource().size() != 0);
|
||||||
@@ -112,11 +112,10 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
|
|||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
@EventBusListenerMethod(scope = EventScope.UI)
|
||||||
void onDistributionSetUpdateEvents(final DistributionSetUpdatedEventContainer eventContainer) {
|
void onDistributionSetUpdateEvents(final DistributionSetUpdatedEventContainer eventContainer) {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
final List<Long> visibleItemIds = (List<Long>) getVisibleItemIds();
|
final List<Long> visibleItemIds = (List<Long>) getVisibleItemIds();
|
||||||
updateVisableTableEntries(eventContainer.getEvents(), visibleItemIds);
|
updateVisableTableEntries(eventContainer.getEvents(), visibleItemIds);
|
||||||
handleSelectedAndUpdatedDs(eventContainer.getEvents());
|
handleSelectedAndUpdatedDs(eventContainer.getEvents());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleSelectedAndUpdatedDs(final List<DistributionSetUpdateEvent> events) {
|
private void handleSelectedAndUpdatedDs(final List<DistributionSetUpdateEvent> events) {
|
||||||
@@ -141,7 +140,6 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Container createContainer() {
|
protected Container createContainer() {
|
||||||
|
|
||||||
final Map<String, Object> queryConfiguration = prepareQueryConfigFilters();
|
final Map<String, Object> queryConfiguration = prepareQueryConfigFilters();
|
||||||
final BeanQueryFactory<ManageDistBeanQuery> distributionQF = new BeanQueryFactory<>(ManageDistBeanQuery.class);
|
final BeanQueryFactory<ManageDistBeanQuery> distributionQF = new BeanQueryFactory<>(ManageDistBeanQuery.class);
|
||||||
|
|
||||||
@@ -155,7 +153,7 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
|
|||||||
manageDistUIState.getManageDistFilters().getSearchText()
|
manageDistUIState.getManageDistFilters().getSearchText()
|
||||||
.ifPresent(value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
.ifPresent(value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
||||||
|
|
||||||
if (null != manageDistUIState.getManageDistFilters().getClickedDistSetType()) {
|
if (manageDistUIState.getManageDistFilters().getClickedDistSetType() != null) {
|
||||||
queryConfig.put(SPUIDefinitions.FILTER_BY_DISTRIBUTION_SET_TYPE,
|
queryConfig.put(SPUIDefinitions.FILTER_BY_DISTRIBUTION_SET_TYPE,
|
||||||
manageDistUIState.getManageDistFilters().getClickedDistSetType());
|
manageDistUIState.getManageDistFilters().getClickedDistSetType());
|
||||||
}
|
}
|
||||||
@@ -172,12 +170,12 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isFirstRowSelectedOnLoad() {
|
protected boolean isFirstRowSelectedOnLoad() {
|
||||||
return manageDistUIState.getSelectedDistributions().map(Set::isEmpty).orElse(true);
|
return manageDistUIState.getSelectedDistributions().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object getItemIdToSelect() {
|
protected Object getItemIdToSelect() {
|
||||||
return manageDistUIState.getSelectedDistributions().orElse(null);
|
return isFirstRowSelectedOnLoad() ? null : manageDistUIState.getSelectedDistributions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -186,17 +184,18 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ManageDistUIState getManagmentEntityState() {
|
protected ManageDistUIState getManagementEntityState() {
|
||||||
return manageDistUIState;
|
return manageDistUIState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void publishEntityAfterValueChange(final DistributionSet distributionSet) {
|
protected void afterEntityIsSelected() {
|
||||||
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.SELECTED_ENTITY, distributionSet));
|
|
||||||
eventBus.publish(this, DistributionsUIEvent.ORDER_BY_DISTRIBUTION);
|
eventBus.publish(this, DistributionsUIEvent.ORDER_BY_DISTRIBUTION);
|
||||||
if (distributionSet != null) {
|
|
||||||
manageDistUIState.setLastSelectedEntity(distributionSet.getId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void publishSelectedEntityEvent(final DistributionSet distributionSet) {
|
||||||
|
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.SELECTED_ENTITY, distributionSet));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -212,15 +211,13 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
|
|||||||
@Override
|
@Override
|
||||||
protected void onDropEventFromTable(final DragAndDropEvent event) {
|
protected void onDropEventFromTable(final DragAndDropEvent event) {
|
||||||
final TableTransferable transferable = (TableTransferable) event.getTransferable();
|
final TableTransferable transferable = (TableTransferable) event.getTransferable();
|
||||||
@SuppressWarnings("unchecked")
|
final AbstractTable<?> source = (AbstractTable<?>) transferable.getSourceComponent();
|
||||||
final AbstractTable<?, Long> source = (AbstractTable<?, Long>) transferable.getSourceComponent();
|
|
||||||
final Set<Long> softwareModulesIdList = source.getDeletedEntityByTransferable(transferable);
|
final Set<Long> softwareModulesIdList = source.getDeletedEntityByTransferable(transferable);
|
||||||
|
|
||||||
final AbstractSelectTargetDetails dropData = (AbstractSelectTargetDetails) event.getTargetDetails();
|
final AbstractSelectTargetDetails dropData = (AbstractSelectTargetDetails) event.getTargetDetails();
|
||||||
|
|
||||||
final Object distItemId = dropData.getItemIdOver();
|
final Object distItemId = dropData.getItemIdOver();
|
||||||
handleDropEvent(source, softwareModulesIdList, distItemId);
|
handleDropEvent(source, softwareModulesIdList, distItemId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -284,26 +281,23 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
|
|||||||
|
|
||||||
private void publishAssignEvent(final Long distId, final SoftwareModule softwareModule) {
|
private void publishAssignEvent(final Long distId, final SoftwareModule softwareModule) {
|
||||||
if (manageDistUIState.getLastSelectedDistribution().map(distId::equals).orElse(false)) {
|
if (manageDistUIState.getLastSelectedDistribution().map(distId::equals).orElse(false)) {
|
||||||
|
|
||||||
eventBus.publish(this,
|
eventBus.publish(this,
|
||||||
new SoftwareModuleEvent(SoftwareModuleEventType.ASSIGN_SOFTWARE_MODULE, softwareModule));
|
new SoftwareModuleEvent(SoftwareModuleEventType.ASSIGN_SOFTWARE_MODULE, softwareModule));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleFirmwareCase(final Map<Long, HashSet<SoftwareModuleIdName>> map,
|
private static void handleFirmwareCase(final Map<Long, HashSet<SoftwareModuleIdName>> map,
|
||||||
final SoftwareModule softwareModule, final SoftwareModuleIdName softwareModuleIdName) {
|
final SoftwareModule softwareModule, final SoftwareModuleIdName softwareModuleIdName) {
|
||||||
if (softwareModule.getType().getMaxAssignments() == 1) {
|
if (softwareModule.getType().getMaxAssignments() == 1) {
|
||||||
if (!map.containsKey(softwareModule.getType().getId())) {
|
if (!map.containsKey(softwareModule.getType().getId())) {
|
||||||
map.put(softwareModule.getType().getId(), new HashSet<SoftwareModuleIdName>());
|
map.put(softwareModule.getType().getId(), new HashSet<SoftwareModuleIdName>());
|
||||||
|
|
||||||
}
|
}
|
||||||
map.get(softwareModule.getType().getId()).clear();
|
map.get(softwareModule.getType().getId()).clear();
|
||||||
map.get(softwareModule.getType().getId()).add(softwareModuleIdName);
|
map.get(softwareModule.getType().getId()).add(softwareModuleIdName);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleSoftwareCase(final Map<Long, HashSet<SoftwareModuleIdName>> map,
|
private static void handleSoftwareCase(final Map<Long, HashSet<SoftwareModuleIdName>> map,
|
||||||
final SoftwareModule softwareModule, final SoftwareModuleIdName softwareModuleIdName) {
|
final SoftwareModule softwareModule, final SoftwareModuleIdName softwareModuleIdName) {
|
||||||
if (softwareModule.getType().getMaxAssignments() > 1) {
|
if (softwareModule.getType().getMaxAssignments() > 1) {
|
||||||
if (!map.containsKey(softwareModule.getType().getId())) {
|
if (!map.containsKey(softwareModule.getType().getId())) {
|
||||||
@@ -317,7 +311,6 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
|
|||||||
final HashSet<SoftwareModuleIdName> softwareModules) {
|
final HashSet<SoftwareModuleIdName> softwareModules) {
|
||||||
LOG.debug("Adding a log to check if distributionSetIdName is null : {} ", distributionSetIdName);
|
LOG.debug("Adding a log to check if distributionSetIdName is null : {} ", distributionSetIdName);
|
||||||
manageDistUIState.getAssignedList().put(distributionSetIdName, softwareModules);
|
manageDistUIState.getAssignedList().put(distributionSetIdName, softwareModules);
|
||||||
|
|
||||||
eventBus.publish(this, DistributionsUIEvent.UPDATE_COUNT);
|
eventBus.publish(this, DistributionsUIEvent.UPDATE_COUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,7 +371,6 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -429,17 +421,13 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
|
|||||||
/**
|
/**
|
||||||
* DistributionTableFilterEvent.
|
* DistributionTableFilterEvent.
|
||||||
*
|
*
|
||||||
* @param event
|
* @param filterEvent
|
||||||
* as instance of {@link DistributionTableFilterEvent}
|
* as instance of {@link RefreshDistributionTableByFilterEvent}
|
||||||
*/
|
*/
|
||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
@EventBusListenerMethod(scope = EventScope.UI, filter = OnlyEventsFromDistributionsViewFilter.class)
|
||||||
public void onEvent(final DistributionTableFilterEvent event) {
|
public void onEvent(final RefreshDistributionTableByFilterEvent filterEvent) {
|
||||||
if (event == DistributionTableFilterEvent.FILTER_BY_TEXT
|
|
||||||
|| event == DistributionTableFilterEvent.REMOVE_FILTER_BY_TEXT
|
|
||||||
|| event == DistributionTableFilterEvent.FILTER_BY_TAG) {
|
|
||||||
UI.getCurrent().access(this::refreshFilter);
|
UI.getCurrent().access(this::refreshFilter);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@@ -452,13 +440,12 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
|
|||||||
@Override
|
@Override
|
||||||
protected void setDataAvailable(final boolean available) {
|
protected void setDataAvailable(final boolean available) {
|
||||||
manageDistUIState.setNoDataAvailableDist(!available);
|
manageDistUIState.setNoDataAvailableDist(!available);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addCustomGeneratedColumns() {
|
protected void addCustomGeneratedColumns() {
|
||||||
addGeneratedColumn(SPUILabelDefinitions.METADATA_ICON, new ColumnGenerator() {
|
addGeneratedColumn(SPUILabelDefinitions.METADATA_ICON, new ColumnGenerator() {
|
||||||
private static final long serialVersionUID = 117186282275065399L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object generateCell(final Table source, final Object itemId, final Object columnId) {
|
public Object generateCell(final Table source, final Object itemId, final Object columnId) {
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
|
|||||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
import org.eclipse.hawkbit.ui.management.dstable.DistributionAddUpdateWindowLayout;
|
import org.eclipse.hawkbit.ui.management.dstable.DistributionAddUpdateWindowLayout;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableFilterEvent;
|
import org.eclipse.hawkbit.ui.management.event.RefreshDistributionTableByFilterEvent;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
import org.vaadin.spring.events.EventScope;
|
import org.vaadin.spring.events.EventScope;
|
||||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||||
@@ -35,8 +35,9 @@ public class DistributionSetTableHeader extends AbstractDistributionSetTableHead
|
|||||||
|
|
||||||
private final DistributionAddUpdateWindowLayout addUpdateWindowLayout;
|
private final DistributionAddUpdateWindowLayout addUpdateWindowLayout;
|
||||||
|
|
||||||
DistributionSetTableHeader(final VaadinMessageSource i18n, final SpPermissionChecker permChecker, final UIEventBus eventbus,
|
DistributionSetTableHeader(final VaadinMessageSource i18n, final SpPermissionChecker permChecker,
|
||||||
final ManageDistUIState manageDistUIstate, final DistributionAddUpdateWindowLayout addUpdateWindowLayout) {
|
final UIEventBus eventbus, final ManageDistUIState manageDistUIstate,
|
||||||
|
final DistributionAddUpdateWindowLayout addUpdateWindowLayout) {
|
||||||
super(i18n, permChecker, eventbus, null, manageDistUIstate, null);
|
super(i18n, permChecker, eventbus, null, manageDistUIstate, null);
|
||||||
this.addUpdateWindowLayout = addUpdateWindowLayout;
|
this.addUpdateWindowLayout = addUpdateWindowLayout;
|
||||||
}
|
}
|
||||||
@@ -50,49 +51,49 @@ public class DistributionSetTableHeader extends AbstractDistributionSetTableHead
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String onLoadSearchBoxValue() {
|
protected String onLoadSearchBoxValue() {
|
||||||
return manageDistUIstate.getManageDistFilters().getSearchText().orElse(null);
|
return getManageDistUIstate().getManageDistFilters().getSearchText().orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void showFilterButtonsLayout() {
|
protected void showFilterButtonsLayout() {
|
||||||
manageDistUIstate.setDistTypeFilterClosed(false);
|
getManageDistUIstate().setDistTypeFilterClosed(false);
|
||||||
eventbus.publish(this, DistributionsUIEvent.SHOW_DIST_FILTER_BY_TYPE);
|
eventbus.publish(this, DistributionsUIEvent.SHOW_DIST_FILTER_BY_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void resetSearchText() {
|
protected void resetSearchText() {
|
||||||
if (manageDistUIstate.getManageDistFilters().getSearchText().isPresent()) {
|
if (getManageDistUIstate().getManageDistFilters().getSearchText().isPresent()) {
|
||||||
manageDistUIstate.getManageDistFilters().setSearchText(null);
|
getManageDistUIstate().getManageDistFilters().setSearchText(null);
|
||||||
eventbus.publish(this, DistributionTableFilterEvent.REMOVE_FILTER_BY_TEXT);
|
eventbus.publish(this, new RefreshDistributionTableByFilterEvent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void maximizeTable() {
|
public void maximizeTable() {
|
||||||
manageDistUIstate.setDsTableMaximized(Boolean.TRUE);
|
getManageDistUIstate().setDsTableMaximized(Boolean.TRUE);
|
||||||
eventbus.publish(this, new DistributionTableEvent(BaseEntityEventType.MAXIMIZED));
|
eventbus.publish(this, new DistributionTableEvent(BaseEntityEventType.MAXIMIZED));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void minimizeTable() {
|
public void minimizeTable() {
|
||||||
manageDistUIstate.setDsTableMaximized(Boolean.FALSE);
|
getManageDistUIstate().setDsTableMaximized(Boolean.FALSE);
|
||||||
eventbus.publish(this, new DistributionTableEvent(BaseEntityEventType.MINIMIZED));
|
eventbus.publish(this, new DistributionTableEvent(BaseEntityEventType.MINIMIZED));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean onLoadIsTableMaximized() {
|
public Boolean onLoadIsTableMaximized() {
|
||||||
return manageDistUIstate.isDsTableMaximized();
|
return getManageDistUIstate().isDsTableMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean onLoadIsShowFilterButtonDisplayed() {
|
public Boolean onLoadIsShowFilterButtonDisplayed() {
|
||||||
return manageDistUIstate.isDistTypeFilterClosed();
|
return getManageDistUIstate().isDistTypeFilterClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void searchBy(final String newSearchText) {
|
protected void searchBy(final String newSearchText) {
|
||||||
manageDistUIstate.getManageDistFilters().setSearchText(newSearchText);
|
getManageDistUIstate().getManageDistFilters().setSearchText(newSearchText);
|
||||||
eventbus.publish(this, DistributionTableFilterEvent.FILTER_BY_TEXT);
|
eventbus.publish(this, new RefreshDistributionTableByFilterEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,16 +19,18 @@ import org.eclipse.hawkbit.ui.common.table.AbstractTableLayout;
|
|||||||
import org.eclipse.hawkbit.ui.dd.criteria.DistributionsViewClientCriterion;
|
import org.eclipse.hawkbit.ui.dd.criteria.DistributionsViewClientCriterion;
|
||||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
import org.eclipse.hawkbit.ui.management.dstable.DistributionAddUpdateWindowLayout;
|
import org.eclipse.hawkbit.ui.management.dstable.DistributionAddUpdateWindowLayout;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DistributionSet table layout
|
* DistributionSet table layout.
|
||||||
*/
|
*/
|
||||||
public class DistributionSetTableLayout extends AbstractTableLayout<DistributionSetTable> {
|
public class DistributionSetTableLayout extends AbstractTableLayout<DistributionSetTable> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 6464291374980641235L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private final DistributionSetTable distributionSetTable;
|
||||||
|
|
||||||
public DistributionSetTableLayout(final VaadinMessageSource i18n, final UIEventBus eventBus,
|
public DistributionSetTableLayout(final VaadinMessageSource i18n, final UIEventBus eventBus,
|
||||||
final SpPermissionChecker permissionChecker, final ManageDistUIState manageDistUIState,
|
final SpPermissionChecker permissionChecker, final ManageDistUIState manageDistUIState,
|
||||||
@@ -41,9 +43,9 @@ public class DistributionSetTableLayout extends AbstractTableLayout<Distribution
|
|||||||
final DsMetadataPopupLayout popupLayout = new DsMetadataPopupLayout(i18n, uiNotification, eventBus,
|
final DsMetadataPopupLayout popupLayout = new DsMetadataPopupLayout(i18n, uiNotification, eventBus,
|
||||||
distributionSetManagement, entityFactory, permissionChecker);
|
distributionSetManagement, entityFactory, permissionChecker);
|
||||||
|
|
||||||
final DistributionSetTable distributionSetTable = new DistributionSetTable(eventBus, i18n, uiNotification,
|
this.distributionSetTable = new DistributionSetTable(eventBus, i18n, uiNotification, permissionChecker,
|
||||||
permissionChecker, manageDistUIState, distributionSetManagement, softwareManagement,
|
manageDistUIState, distributionSetManagement, softwareManagement, distributionsViewClientCriterion,
|
||||||
distributionsViewClientCriterion, targetManagement, popupLayout);
|
targetManagement, popupLayout);
|
||||||
|
|
||||||
final DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout = new DistributionAddUpdateWindowLayout(
|
final DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout = new DistributionAddUpdateWindowLayout(
|
||||||
i18n, uiNotification, eventBus, distributionSetManagement, systemManagement, entityFactory,
|
i18n, uiNotification, eventBus, distributionSetManagement, systemManagement, entityFactory,
|
||||||
@@ -58,4 +60,8 @@ public class DistributionSetTableLayout extends AbstractTableLayout<Distribution
|
|||||||
targetManagement, entityFactory, uiNotification, tagManagement, popupLayout));
|
targetManagement, entityFactory, uiNotification, tagManagement, popupLayout));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DistributionSetTable getDistributionSetTable() {
|
||||||
|
return distributionSetTable;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,11 +29,11 @@ import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
|
|||||||
import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
|
import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
|
||||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
import org.vaadin.spring.events.EventScope;
|
import org.vaadin.spring.events.EventScope;
|
||||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||||
@@ -61,8 +61,8 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
|
|
||||||
private final DistributionsViewClientCriterion distributionsViewClientCriterion;
|
private final DistributionsViewClientCriterion distributionsViewClientCriterion;
|
||||||
|
|
||||||
public DSDeleteActionsLayout(final VaadinMessageSource i18n, final SpPermissionChecker permChecker, final UIEventBus eventBus,
|
public DSDeleteActionsLayout(final VaadinMessageSource i18n, final SpPermissionChecker permChecker,
|
||||||
final UINotification notification, final SystemManagement systemManagement,
|
final UIEventBus eventBus, final UINotification notification, final SystemManagement systemManagement,
|
||||||
final ManageDistUIState manageDistUIState,
|
final ManageDistUIState manageDistUIState,
|
||||||
final DistributionsViewClientCriterion distributionsViewClientCriterion,
|
final DistributionsViewClientCriterion distributionsViewClientCriterion,
|
||||||
final DistributionSetManagement dsManagement, final SoftwareManagement softwareManagement) {
|
final DistributionSetManagement dsManagement, final SoftwareManagement softwareManagement) {
|
||||||
@@ -145,8 +145,8 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
final String distTypeName = HawkbitCommonUtil.removePrefix(distTypeId,
|
final String distTypeName = HawkbitCommonUtil.removePrefix(distTypeId,
|
||||||
SPUIDefinitions.DISTRIBUTION_SET_TYPE_ID_PREFIXS);
|
SPUIDefinitions.DISTRIBUTION_SET_TYPE_ID_PREFIXS);
|
||||||
if (isDsTypeSelected(distTypeName)) {
|
if (isDsTypeSelected(distTypeName)) {
|
||||||
notification
|
notification.displayValidationError(
|
||||||
.displayValidationError(i18n.getMessage("message.dist.type.check.delete", new Object[] { distTypeName }));
|
i18n.getMessage("message.dist.type.check.delete", new Object[] { distTypeName }));
|
||||||
} else if (isDefaultDsType(distTypeName)) {
|
} else if (isDefaultDsType(distTypeName)) {
|
||||||
notification.displayValidationError(i18n.getMessage("message.cannot.delete.default.dstype"));
|
notification.displayValidationError(i18n.getMessage("message.cannot.delete.default.dstype"));
|
||||||
} else {
|
} else {
|
||||||
@@ -182,7 +182,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addInDeleteDistributionList(final Table sourceTable, final TableTransferable transferable) {
|
private void addInDeleteDistributionList(final Table sourceTable, final TableTransferable transferable) {
|
||||||
final AbstractTable<?, Long> table = (AbstractTable<?, Long>) sourceTable;
|
final AbstractTable<?> table = (AbstractTable<?>) sourceTable;
|
||||||
final Set<Long> ids = table.getDeletedEntityByTransferable(transferable);
|
final Set<Long> ids = table.getDeletedEntityByTransferable(transferable);
|
||||||
final List<DistributionSet> findDistributionSetAllById = distributionSetManagement
|
final List<DistributionSet> findDistributionSetAllById = distributionSetManagement
|
||||||
.findDistributionSetAllById(ids);
|
.findDistributionSetAllById(ids);
|
||||||
@@ -207,8 +207,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addToSWDeleteList(final Table sourceTable, final TableTransferable transferable) {
|
private void addToSWDeleteList(final Table sourceTable, final TableTransferable transferable) {
|
||||||
@SuppressWarnings("unchecked")
|
final AbstractTable<?> swTable = (AbstractTable<?>) sourceTable;
|
||||||
final AbstractTable<?, Long> swTable = (AbstractTable<?, Long>) sourceTable;
|
|
||||||
final Set<Long> swModuleIdNameSet = swTable.getDeletedEntityByTransferable(transferable);
|
final Set<Long> swModuleIdNameSet = swTable.getDeletedEntityByTransferable(transferable);
|
||||||
|
|
||||||
swModuleIdNameSet.forEach(id -> {
|
swModuleIdNameSet.forEach(id -> {
|
||||||
|
|||||||
@@ -28,12 +28,13 @@ import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
|||||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||||
import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
|
import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
|
||||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
|
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
import org.vaadin.spring.events.EventScope;
|
import org.vaadin.spring.events.EventScope;
|
||||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||||
@@ -93,7 +94,7 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, ConfirmationTab> getConfimrationTabs() {
|
protected Map<String, ConfirmationTab> getConfirmationTabs() {
|
||||||
final Map<String, ConfirmationTab> tabs = Maps.newHashMapWithExpectedSize(5);
|
final Map<String, ConfirmationTab> tabs = Maps.newHashMapWithExpectedSize(5);
|
||||||
/* Create tab for SW Modules delete */
|
/* Create tab for SW Modules delete */
|
||||||
if (!manageDistUIState.getDeleteSofwareModulesList().isEmpty()) {
|
if (!manageDistUIState.getDeleteSofwareModulesList().isEmpty()) {
|
||||||
@@ -102,7 +103,8 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
|
|||||||
|
|
||||||
/* Create tab for SW Module Type delete */
|
/* Create tab for SW Module Type delete */
|
||||||
if (!manageDistUIState.getSelectedDeleteSWModuleTypes().isEmpty()) {
|
if (!manageDistUIState.getSelectedDeleteSWModuleTypes().isEmpty()) {
|
||||||
tabs.put(i18n.getMessage("caption.delete.sw.module.type.accordion.tab"), createSMtypeDeleteConfirmationTab());
|
tabs.put(i18n.getMessage("caption.delete.sw.module.type.accordion.tab"),
|
||||||
|
createSMtypeDeleteConfirmationTab());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create tab for Distributions delete */
|
/* Create tab for Distributions delete */
|
||||||
@@ -112,7 +114,8 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
|
|||||||
|
|
||||||
/* Create tab for Distribution Set Types delete */
|
/* Create tab for Distribution Set Types delete */
|
||||||
if (!manageDistUIState.getSelectedDeleteDistSetTypes().isEmpty()) {
|
if (!manageDistUIState.getSelectedDeleteDistSetTypes().isEmpty()) {
|
||||||
tabs.put(i18n.getMessage("caption.delete.dist.set.type.accordion.tab"), createDistSetTypeDeleteConfirmationTab());
|
tabs.put(i18n.getMessage("caption.delete.dist.set.type.accordion.tab"),
|
||||||
|
createDistSetTypeDeleteConfirmationTab());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create tab for Assign Software Module */
|
/* Create tab for Assign Software Module */
|
||||||
@@ -361,18 +364,17 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
|
|||||||
private void deleteDistAll(final ConfirmationTab tab) {
|
private void deleteDistAll(final ConfirmationTab tab) {
|
||||||
final Long[] deletedIds = manageDistUIState.getDeletedDistributionList().stream().map(idName -> idName.getId())
|
final Long[] deletedIds = manageDistUIState.getDeletedDistributionList().stream().map(idName -> idName.getId())
|
||||||
.toArray(Long[]::new);
|
.toArray(Long[]::new);
|
||||||
if (null != manageDistUIState.getAssignedList() && !manageDistUIState.getAssignedList().isEmpty()) {
|
if (manageDistUIState.getAssignedList() != null && !manageDistUIState.getAssignedList().isEmpty()) {
|
||||||
manageDistUIState.getDeletedDistributionList().forEach(distSetName -> {
|
manageDistUIState.getDeletedDistributionList().forEach(distSetName -> {
|
||||||
if (manageDistUIState.getAssignedList().containsKey(distSetName)) {
|
if (manageDistUIState.getAssignedList().containsKey(distSetName)) {
|
||||||
manageDistUIState.getAssignedList().remove(distSetName);
|
manageDistUIState.getAssignedList().remove(distSetName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dsManagement.deleteDistributionSet(Lists.newArrayList(deletedIds));
|
dsManagement.deleteDistributionSet(Lists.newArrayList(deletedIds));
|
||||||
|
eventBus.publish(this,
|
||||||
|
new DistributionTableEvent(BaseEntityEventType.REMOVE_ENTITY, Lists.newArrayList(deletedIds)));
|
||||||
|
|
||||||
addToConsolitatedMsg(FontAwesome.TRASH_O.getHtml() + SPUILabelDefinitions.HTML_SPACE
|
addToConsolitatedMsg(FontAwesome.TRASH_O.getHtml() + SPUILabelDefinitions.HTML_SPACE
|
||||||
+ i18n.getMessage("message.dist.deleted", deletedIds.length));
|
+ i18n.getMessage("message.dist.deleted", deletedIds.length));
|
||||||
@@ -543,7 +545,8 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
|
|||||||
|
|
||||||
assignmnetTab.getTable().setVisibleColumns(DIST_NAME, SOFTWARE_MODULE_NAME, DISCARD);
|
assignmnetTab.getTable().setVisibleColumns(DIST_NAME, SOFTWARE_MODULE_NAME, DISCARD);
|
||||||
assignmnetTab.getTable().setColumnHeaders(i18n.getMessage("header.dist.first.assignment.table"),
|
assignmnetTab.getTable().setColumnHeaders(i18n.getMessage("header.dist.first.assignment.table"),
|
||||||
i18n.getMessage("header.dist.second.assignment.table"), i18n.getMessage("header.third.assignment.table"));
|
i18n.getMessage("header.dist.second.assignment.table"),
|
||||||
|
i18n.getMessage("header.third.assignment.table"));
|
||||||
|
|
||||||
assignmnetTab.getTable().setColumnExpandRatio(DIST_NAME, 2);
|
assignmnetTab.getTable().setColumnExpandRatio(DIST_NAME, 2);
|
||||||
assignmnetTab.getTable().setColumnExpandRatio(SOFTWARE_MODULE_NAME, 2);
|
assignmnetTab.getTable().setColumnExpandRatio(SOFTWARE_MODULE_NAME, 2);
|
||||||
|
|||||||
@@ -40,11 +40,6 @@ public class SwModuleDetails extends AbstractSoftwareModuleDetails {
|
|||||||
restoreState();
|
restoreState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean onLoadIsTableRowSelected() {
|
|
||||||
return !manageDistUIState.getSelectedSoftwareModules().isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onLoadIsTableMaximized() {
|
protected boolean onLoadIsTableMaximized() {
|
||||||
return manageDistUIState.isSwModuleTableMaximized();
|
return manageDistUIState.isSwModuleTableMaximized();
|
||||||
@@ -57,7 +52,8 @@ public class SwModuleDetails extends AbstractSoftwareModuleDetails {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isSoftwareModuleSelected(final SoftwareModule softwareModule) {
|
protected boolean isSoftwareModuleSelected(final SoftwareModule softwareModule) {
|
||||||
return compareSoftwareModulesById(softwareModule, manageDistUIState.getSelectedBaseSwModuleId().orElse(null));
|
return compareSoftwareModulesById(softwareModule,
|
||||||
|
manageDistUIState.getLastSelectedSoftwareModule().orElse(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ import org.eclipse.hawkbit.repository.SoftwareManagement;
|
|||||||
import org.eclipse.hawkbit.repository.event.remote.entity.SoftwareModuleUpdatedEvent;
|
import org.eclipse.hawkbit.repository.event.remote.entity.SoftwareModuleUpdatedEvent;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.details.ArtifactDetailsLayout;
|
import org.eclipse.hawkbit.ui.artifacts.details.ArtifactDetailsLayout;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.RefreshSoftwareModuleByFilterEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||||
import org.eclipse.hawkbit.ui.common.ManagmentEntityState;
|
import org.eclipse.hawkbit.ui.common.ManagementEntityState;
|
||||||
import org.eclipse.hawkbit.ui.common.table.AbstractNamedVersionTable;
|
import org.eclipse.hawkbit.ui.common.table.AbstractNamedVersionTable;
|
||||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
@@ -32,13 +32,14 @@ import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
|
|||||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
import org.eclipse.hawkbit.ui.push.SoftwareModuleUpdatedEventContainer;
|
import org.eclipse.hawkbit.ui.push.SoftwareModuleUpdatedEventContainer;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.TableColumn;
|
import org.eclipse.hawkbit.ui.utils.TableColumn;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
|
import org.eclipse.hawkbit.ui.view.filter.OnlyEventsFromDistributionsViewFilter;
|
||||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
||||||
@@ -63,11 +64,10 @@ import com.vaadin.ui.Window;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of software module table using generic abstract table styles .
|
* Implementation of software module table using generic abstract table styles .
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Long> {
|
public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 6785314784507424750L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final ManageDistUIState manageDistUIState;
|
private final ManageDistUIState manageDistUIState;
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
|
|||||||
this.softwareManagement = softwareManagement;
|
this.softwareManagement = softwareManagement;
|
||||||
this.distributionsViewClientCriterion = distributionsViewClientCriterion;
|
this.distributionsViewClientCriterion = distributionsViewClientCriterion;
|
||||||
this.artifactDetailsLayout = new ArtifactDetailsLayout(i18n, eventBus, artifactUploadState, uiNotification,
|
this.artifactDetailsLayout = new ArtifactDetailsLayout(i18n, eventBus, artifactUploadState, uiNotification,
|
||||||
artifactManagement);
|
artifactManagement, softwareManagement);
|
||||||
this.swMetadataPopupLayout = swMetadataPopupLayout;
|
this.swMetadataPopupLayout = swMetadataPopupLayout;
|
||||||
|
|
||||||
addNewContainerDS();
|
addNewContainerDS();
|
||||||
@@ -98,16 +98,11 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
|
|||||||
styleTableOnDistSelection();
|
styleTableOnDistSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
@EventBusListenerMethod(scope = EventScope.UI, filter = OnlyEventsFromDistributionsViewFilter.class)
|
||||||
void onEvent(final SMFilterEvent filterEvent) {
|
void onEvent(final RefreshSoftwareModuleByFilterEvent filterEvent) {
|
||||||
UI.getCurrent().access(() -> {
|
UI.getCurrent().access(() -> {
|
||||||
|
|
||||||
if (filterEvent == SMFilterEvent.FILTER_BY_TYPE || filterEvent == SMFilterEvent.FILTER_BY_TEXT
|
|
||||||
|| filterEvent == SMFilterEvent.REMOVER_FILTER_BY_TYPE
|
|
||||||
|| filterEvent == SMFilterEvent.REMOVER_FILTER_BY_TEXT) {
|
|
||||||
refreshFilter();
|
refreshFilter();
|
||||||
styleTableOnDistSelection();
|
styleTableOnDistSelection();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,19 +130,15 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
|
|||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
@EventBusListenerMethod(scope = EventScope.UI)
|
||||||
void onSoftwareModuleUpdateEvents(final SoftwareModuleUpdatedEventContainer eventContainer) {
|
void onSoftwareModuleUpdateEvents(final SoftwareModuleUpdatedEventContainer eventContainer) {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
final List<Long> visibleItemIds = (List<Long>) getVisibleItemIds();
|
final List<Long> visibleItemIds = (List<Long>) getVisibleItemIds();
|
||||||
|
|
||||||
handleSelectedAndUpdatedSoftwareModules(eventContainer.getEvents());
|
handleSelectedAndUpdatedSoftwareModules(eventContainer.getEvents());
|
||||||
|
|
||||||
eventContainer.getEvents().stream().filter(event -> visibleItemIds.contains(event.getEntityId()))
|
eventContainer.getEvents().stream().filter(event -> visibleItemIds.contains(event.getEntityId()))
|
||||||
.forEach(event -> updateSoftwareModuleInTable(event.getEntity()));
|
.forEach(event -> updateSoftwareModuleInTable(event.getEntity()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleSelectedAndUpdatedSoftwareModules(final List<SoftwareModuleUpdatedEvent> events) {
|
private void handleSelectedAndUpdatedSoftwareModules(final List<SoftwareModuleUpdatedEvent> events) {
|
||||||
manageDistUIState.getSelectedBaseSwModuleId()
|
manageDistUIState.getLastSelectedSoftwareModule()
|
||||||
.ifPresent(lastSelectedModuleId -> events.stream()
|
.ifPresent(lastSelectedModuleId -> events.stream()
|
||||||
.filter(event -> lastSelectedModuleId.equals(event.getEntityId())).findAny()
|
.filter(event -> lastSelectedModuleId.equals(event.getEntityId())).findAny()
|
||||||
.ifPresent(lastEvent -> eventBus.publish(this,
|
.ifPresent(lastEvent -> eventBus.publish(this,
|
||||||
@@ -178,14 +169,12 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
|
|||||||
final Map<String, Object> queryConfig = Maps.newHashMapWithExpectedSize(3);
|
final Map<String, Object> queryConfig = Maps.newHashMapWithExpectedSize(3);
|
||||||
manageDistUIState.getSoftwareModuleFilters().getSearchText()
|
manageDistUIState.getSoftwareModuleFilters().getSearchText()
|
||||||
.ifPresent(value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
.ifPresent(value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
||||||
|
|
||||||
manageDistUIState.getSoftwareModuleFilters().getSoftwareModuleType()
|
manageDistUIState.getSoftwareModuleFilters().getSoftwareModuleType()
|
||||||
.ifPresent(type -> queryConfig.put(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE, type));
|
.ifPresent(type -> queryConfig.put(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE, type));
|
||||||
|
|
||||||
manageDistUIState.getLastSelectedDistribution()
|
manageDistUIState.getLastSelectedDistribution()
|
||||||
.ifPresent(id -> queryConfig.put(SPUIDefinitions.ORDER_BY_DISTRIBUTION, id));
|
.ifPresent(id -> queryConfig.put(SPUIDefinitions.ORDER_BY_DISTRIBUTION, id));
|
||||||
|
|
||||||
return queryConfig;
|
return queryConfig;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -208,9 +197,9 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addCustomGeneratedColumns() {
|
protected void addCustomGeneratedColumns() {
|
||||||
|
|
||||||
addGeneratedColumn(SPUILabelDefinitions.ARTIFACT_ICON, new ColumnGenerator() {
|
addGeneratedColumn(SPUILabelDefinitions.ARTIFACT_ICON, new ColumnGenerator() {
|
||||||
private static final long serialVersionUID = -5982361782989980277L;
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object generateCell(final Table source, final Object itemId, final Object columnId) {
|
public Object generateCell(final Table source, final Object itemId, final Object columnId) {
|
||||||
@@ -226,6 +215,7 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
|
|||||||
return iconLayout;
|
return iconLayout;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -235,7 +225,8 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object getItemIdToSelect() {
|
protected Object getItemIdToSelect() {
|
||||||
return manageDistUIState.getSelectedSoftwareModules();
|
return manageDistUIState.getSelectedSoftwareModules().isEmpty() ? null
|
||||||
|
: manageDistUIState.getSelectedSoftwareModules();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -244,16 +235,18 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void publishEntityAfterValueChange(final SoftwareModule selectedLastEntity) {
|
protected void publishSelectedEntityEvent(final SoftwareModule selectedLastEntity) {
|
||||||
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.SELECTED_ENTITY, selectedLastEntity));
|
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.SELECTED_ENTITY, selectedLastEntity));
|
||||||
if (selectedLastEntity != null) {
|
|
||||||
manageDistUIState.setSelectedBaseSwModuleId(selectedLastEntity.getId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setManagementEntitiyStateValues(final Set<Long> values, final Long lastId) {
|
protected void setLastSelectedEntityId(final Long selectedLastEntityId) {
|
||||||
manageDistUIState.setSelectedBaseSwModuleId(lastId);
|
manageDistUIState.setLastSelectedSoftwareModule(selectedLastEntityId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setManagementEntityStateValues(final Set<Long> values, final Long lastId) {
|
||||||
|
manageDistUIState.setLastSelectedSoftwareModule(lastId);
|
||||||
manageDistUIState.setSelectedSoftwareModules(values);
|
manageDistUIState.setSelectedSoftwareModules(values);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,7 +256,7 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ManagmentEntityState<Long> getManagmentEntityState() {
|
protected ManagementEntityState getManagementEntityState() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,8 +286,6 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* All Private Methods */
|
|
||||||
|
|
||||||
private void styleTableOnDistSelection() {
|
private void styleTableOnDistSelection() {
|
||||||
Page.getCurrent().getJavaScript().execute(HawkbitCommonUtil.getScriptSMHighlightReset());
|
Page.getCurrent().getJavaScript().execute(HawkbitCommonUtil.getScriptSMHighlightReset());
|
||||||
setCellStyleGenerator(new Table.CellStyleGenerator() {
|
setCellStyleGenerator(new Table.CellStyleGenerator() {
|
||||||
@@ -305,7 +296,6 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
|
|||||||
return createTableStyle(itemId, propertyId);
|
return createTableStyle(itemId, propertyId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getTableStyle(final Long typeId, final boolean isAssigned, final String color) {
|
private static String getTableStyle(final Long typeId, final boolean isAssigned, final String color) {
|
||||||
@@ -379,39 +369,42 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showArtifactDetailsWindow(final Long itemId, final String nameVersionStr) {
|
private void showArtifactDetailsWindow(final Long itemId, final String nameVersionStr) {
|
||||||
final Window atrifactDtlsWindow = new Window();
|
final Window artifactDtlsWindow = new Window();
|
||||||
atrifactDtlsWindow.setCaption(HawkbitCommonUtil.getArtifactoryDetailsLabelId(nameVersionStr));
|
artifactDtlsWindow.setCaption(HawkbitCommonUtil.getArtifactoryDetailsLabelId(nameVersionStr));
|
||||||
atrifactDtlsWindow.setCaptionAsHtml(true);
|
artifactDtlsWindow.setCaptionAsHtml(true);
|
||||||
atrifactDtlsWindow.setClosable(true);
|
artifactDtlsWindow.setClosable(true);
|
||||||
atrifactDtlsWindow.setResizable(true);
|
artifactDtlsWindow.setResizable(true);
|
||||||
atrifactDtlsWindow.setImmediate(true);
|
artifactDtlsWindow.setImmediate(true);
|
||||||
atrifactDtlsWindow.setWindowMode(WindowMode.NORMAL);
|
artifactDtlsWindow.setWindowMode(WindowMode.NORMAL);
|
||||||
atrifactDtlsWindow.setModal(true);
|
artifactDtlsWindow.setModal(true);
|
||||||
atrifactDtlsWindow.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);
|
artifactDtlsWindow.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);
|
||||||
|
|
||||||
artifactDetailsLayout.setFullWindowMode(false);
|
artifactDetailsLayout.setFullWindowMode(false);
|
||||||
artifactDetailsLayout.populateArtifactDetails(itemId, nameVersionStr);
|
artifactDetailsLayout.populateArtifactDetails(itemId, nameVersionStr);
|
||||||
/* Now add table to the window */
|
/* Now add table to the window */
|
||||||
artifactDetailsLayout.getArtifactDetailsTable().setWidth(700, Unit.PIXELS);
|
artifactDetailsLayout.getArtifactDetailsTable().setWidth(700, Unit.PIXELS);
|
||||||
artifactDetailsLayout.getArtifactDetailsTable().setHeight(500, Unit.PIXELS);
|
artifactDetailsLayout.getArtifactDetailsTable().setHeight(500, Unit.PIXELS);
|
||||||
atrifactDtlsWindow.setContent(artifactDetailsLayout.getArtifactDetailsTable());
|
artifactDtlsWindow.setContent(artifactDetailsLayout.getArtifactDetailsTable());
|
||||||
|
|
||||||
/* Create maximized view of the table */
|
/* Create maximized view of the table */
|
||||||
atrifactDtlsWindow.addWindowModeChangeListener(event -> {
|
artifactDtlsWindow.addWindowModeChangeListener(
|
||||||
|
|
||||||
|
event -> {
|
||||||
if (event.getWindowMode() == WindowMode.MAXIMIZED) {
|
if (event.getWindowMode() == WindowMode.MAXIMIZED) {
|
||||||
atrifactDtlsWindow.setSizeFull();
|
artifactDtlsWindow.setSizeFull();
|
||||||
artifactDetailsLayout.setFullWindowMode(true);
|
artifactDetailsLayout.setFullWindowMode(true);
|
||||||
artifactDetailsLayout.createMaxArtifactDetailsTable();
|
artifactDetailsLayout.createMaxArtifactDetailsTable();
|
||||||
artifactDetailsLayout.getMaxArtifactDetailsTable().setWidth(100, Unit.PERCENTAGE);
|
artifactDetailsLayout.getMaxArtifactDetailsTable().setWidth(100, Unit.PERCENTAGE);
|
||||||
artifactDetailsLayout.getMaxArtifactDetailsTable().setHeight(100, Unit.PERCENTAGE);
|
artifactDetailsLayout.getMaxArtifactDetailsTable().setHeight(100, Unit.PERCENTAGE);
|
||||||
atrifactDtlsWindow.setContent(artifactDetailsLayout.getMaxArtifactDetailsTable());
|
artifactDtlsWindow.setContent(artifactDetailsLayout.getMaxArtifactDetailsTable());
|
||||||
} else {
|
} else {
|
||||||
atrifactDtlsWindow.setSizeUndefined();
|
artifactDtlsWindow.setSizeUndefined();
|
||||||
atrifactDtlsWindow.setContent(artifactDetailsLayout.getArtifactDetailsTable());
|
artifactDtlsWindow.setContent(artifactDetailsLayout.getArtifactDetailsTable());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
/* display the window */
|
/* display the window */
|
||||||
UI.getCurrent().addWindow(atrifactDtlsWindow);
|
UI.getCurrent().addWindow(artifactDtlsWindow);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
package org.eclipse.hawkbit.ui.distributions.smtable;
|
package org.eclipse.hawkbit.ui.distributions.smtable;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
|
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||||
|
import org.eclipse.hawkbit.ui.artifacts.event.RefreshSoftwareModuleByFilterEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleAddUpdateWindow;
|
import org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleAddUpdateWindow;
|
||||||
import org.eclipse.hawkbit.ui.common.table.AbstractSoftwareModuleTableHeader;
|
import org.eclipse.hawkbit.ui.common.table.AbstractSoftwareModuleTableHeader;
|
||||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
@@ -44,50 +44,50 @@ public class SwModuleTableHeader extends AbstractSoftwareModuleTableHeader {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String onLoadSearchBoxValue() {
|
protected String onLoadSearchBoxValue() {
|
||||||
return manageDistUIstate.getSoftwareModuleFilters().getSearchText().orElse(null);
|
return getManageDistUIstate().getSoftwareModuleFilters().getSearchText().orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void showFilterButtonsLayout() {
|
protected void showFilterButtonsLayout() {
|
||||||
manageDistUIstate.setSwTypeFilterClosed(false);
|
getManageDistUIstate().setSwTypeFilterClosed(false);
|
||||||
eventbus.publish(this, DistributionsUIEvent.SHOW_SM_FILTER_BY_TYPE);
|
eventbus.publish(this, DistributionsUIEvent.SHOW_SM_FILTER_BY_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void resetSearchText() {
|
protected void resetSearchText() {
|
||||||
if (manageDistUIstate.getSoftwareModuleFilters().getSearchText().isPresent()) {
|
if (getManageDistUIstate().getSoftwareModuleFilters().getSearchText().isPresent()) {
|
||||||
manageDistUIstate.getSoftwareModuleFilters().setSearchText(null);
|
getManageDistUIstate().getSoftwareModuleFilters().setSearchText(null);
|
||||||
eventbus.publish(this, SMFilterEvent.REMOVER_FILTER_BY_TEXT);
|
eventbus.publish(this, new RefreshSoftwareModuleByFilterEvent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void maximizeTable() {
|
public void maximizeTable() {
|
||||||
manageDistUIstate.setSwModuleTableMaximized(Boolean.TRUE);
|
getManageDistUIstate().setSwModuleTableMaximized(Boolean.TRUE);
|
||||||
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MAXIMIZED));
|
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MAXIMIZED));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void minimizeTable() {
|
public void minimizeTable() {
|
||||||
manageDistUIstate.setSwModuleTableMaximized(Boolean.FALSE);
|
getManageDistUIstate().setSwModuleTableMaximized(Boolean.FALSE);
|
||||||
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MINIMIZED));
|
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MINIMIZED));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean onLoadIsTableMaximized() {
|
public Boolean onLoadIsTableMaximized() {
|
||||||
return manageDistUIstate.isSwModuleTableMaximized();
|
return getManageDistUIstate().isSwModuleTableMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean onLoadIsShowFilterButtonDisplayed() {
|
public Boolean onLoadIsShowFilterButtonDisplayed() {
|
||||||
return manageDistUIstate.isSwTypeFilterClosed();
|
return getManageDistUIstate().isSwTypeFilterClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void searchBy(final String newSearchText) {
|
protected void searchBy(final String newSearchText) {
|
||||||
manageDistUIstate.getSoftwareModuleFilters().setSearchText(newSearchText);
|
getManageDistUIstate().getSoftwareModuleFilters().setSearchText(newSearchText);
|
||||||
eventbus.publish(this, SMFilterEvent.FILTER_BY_TEXT);
|
eventbus.publish(this, new RefreshSoftwareModuleByFilterEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,35 +17,41 @@ import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
|||||||
import org.eclipse.hawkbit.ui.common.table.AbstractTableLayout;
|
import org.eclipse.hawkbit.ui.common.table.AbstractTableLayout;
|
||||||
import org.eclipse.hawkbit.ui.dd.criteria.DistributionsViewClientCriterion;
|
import org.eclipse.hawkbit.ui.dd.criteria.DistributionsViewClientCriterion;
|
||||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of software module Layout
|
* Implementation of software module Layout on the Distribution View
|
||||||
*/
|
*/
|
||||||
public class SwModuleTableLayout extends AbstractTableLayout<SwModuleTable> {
|
public class SwModuleTableLayout extends AbstractTableLayout<SwModuleTable> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 6464291374980641235L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public SwModuleTableLayout(final VaadinMessageSource i18n, final UINotification uiNotification, final UIEventBus eventBus,
|
private final SwModuleTable swModuleTable;
|
||||||
final SoftwareManagement softwareManagement, final EntityFactory entityFactory,
|
|
||||||
|
public SwModuleTableLayout(final VaadinMessageSource i18n, final UINotification uiNotification,
|
||||||
|
final UIEventBus eventBus, final SoftwareManagement softwareManagement, final EntityFactory entityFactory,
|
||||||
final ManageDistUIState manageDistUIState, final SpPermissionChecker permChecker,
|
final ManageDistUIState manageDistUIState, final SpPermissionChecker permChecker,
|
||||||
final DistributionsViewClientCriterion distributionsViewClientCriterion,
|
final DistributionsViewClientCriterion distributionsViewClientCriterion,
|
||||||
final ArtifactUploadState artifactUploadState, final ArtifactManagement artifactManagement) {
|
final ArtifactUploadState artifactUploadState, final ArtifactManagement artifactManagement) {
|
||||||
|
|
||||||
final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow = new SoftwareModuleAddUpdateWindow(i18n,
|
|
||||||
uiNotification, eventBus, softwareManagement, entityFactory);
|
|
||||||
|
|
||||||
final SwMetadataPopupLayout swMetadataPopupLayout = new SwMetadataPopupLayout(i18n, uiNotification, eventBus,
|
final SwMetadataPopupLayout swMetadataPopupLayout = new SwMetadataPopupLayout(i18n, uiNotification, eventBus,
|
||||||
softwareManagement, entityFactory, permChecker);
|
softwareManagement, entityFactory, permChecker);
|
||||||
|
|
||||||
|
this.swModuleTable = new SwModuleTable(eventBus, i18n, uiNotification, manageDistUIState, softwareManagement,
|
||||||
|
distributionsViewClientCriterion, artifactManagement, swMetadataPopupLayout, artifactUploadState);
|
||||||
|
|
||||||
|
final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow = new SoftwareModuleAddUpdateWindow(i18n,
|
||||||
|
uiNotification, eventBus, softwareManagement, entityFactory, swModuleTable);
|
||||||
super.init(
|
super.init(
|
||||||
new SwModuleTableHeader(i18n, permChecker, eventBus, manageDistUIState, softwareModuleAddUpdateWindow),
|
new SwModuleTableHeader(i18n, permChecker, eventBus, manageDistUIState, softwareModuleAddUpdateWindow),
|
||||||
new SwModuleTable(eventBus, i18n, uiNotification, manageDistUIState, softwareManagement,
|
swModuleTable, new SwModuleDetails(i18n, eventBus, permChecker, softwareModuleAddUpdateWindow,
|
||||||
distributionsViewClientCriterion, artifactManagement, swMetadataPopupLayout,
|
manageDistUIState, softwareManagement, swMetadataPopupLayout, entityFactory));
|
||||||
artifactUploadState),
|
|
||||||
new SwModuleDetails(i18n, eventBus, permChecker, softwareModuleAddUpdateWindow, manageDistUIState,
|
|
||||||
softwareManagement, swMetadataPopupLayout, entityFactory));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SwModuleTable getSwModuleTable() {
|
||||||
|
return swModuleTable;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.distributions.smtype;
|
package org.eclipse.hawkbit.ui.distributions.smtype;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.RefreshSoftwareModuleByFilterEvent;
|
||||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterSingleButtonClick;
|
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterSingleButtonClick;
|
||||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
import org.vaadin.spring.events.EventBus;
|
import org.vaadin.spring.events.EventBus;
|
||||||
@@ -22,7 +20,7 @@ import com.vaadin.ui.Button;
|
|||||||
/**
|
/**
|
||||||
* Single button click behaviour of filter buttons layout.
|
* Single button click behaviour of filter buttons layout.
|
||||||
*/
|
*/
|
||||||
public class DistSMTypeFilterButtonClick extends AbstractFilterSingleButtonClick implements Serializable {
|
public class DistSMTypeFilterButtonClick extends AbstractFilterSingleButtonClick {
|
||||||
|
|
||||||
private static final long serialVersionUID = -4166632002904286983L;
|
private static final long serialVersionUID = -4166632002904286983L;
|
||||||
|
|
||||||
@@ -42,14 +40,14 @@ public class DistSMTypeFilterButtonClick extends AbstractFilterSingleButtonClick
|
|||||||
@Override
|
@Override
|
||||||
protected void filterUnClicked(final Button clickedButton) {
|
protected void filterUnClicked(final Button clickedButton) {
|
||||||
manageDistUIState.getSoftwareModuleFilters().setSoftwareModuleType(null);
|
manageDistUIState.getSoftwareModuleFilters().setSoftwareModuleType(null);
|
||||||
eventBus.publish(this, SMFilterEvent.FILTER_BY_TYPE);
|
eventBus.publish(this, new RefreshSoftwareModuleByFilterEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void filterClicked(final Button clickedButton) {
|
protected void filterClicked(final Button clickedButton) {
|
||||||
softwareManagement.findSoftwareModuleTypeByName(clickedButton.getData().toString()).ifPresent(smType -> {
|
softwareManagement.findSoftwareModuleTypeByName(clickedButton.getData().toString()).ifPresent(smType -> {
|
||||||
manageDistUIState.getSoftwareModuleFilters().setSoftwareModuleType(smType);
|
manageDistUIState.getSoftwareModuleFilters().setSoftwareModuleType(smType);
|
||||||
eventBus.publish(this, SMFilterEvent.FILTER_BY_TYPE);
|
eventBus.publish(this, new RefreshSoftwareModuleByFilterEvent());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,16 +8,15 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.distributions.state;
|
package org.eclipse.hawkbit.ui.distributions.state;
|
||||||
|
|
||||||
import static java.util.Collections.emptySet;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.ui.common.ManagmentEntityState;
|
import org.eclipse.hawkbit.ui.common.ManagementEntityState;
|
||||||
import org.eclipse.hawkbit.ui.common.entity.DistributionSetIdName;
|
import org.eclipse.hawkbit.ui.common.entity.DistributionSetIdName;
|
||||||
import org.eclipse.hawkbit.ui.common.entity.SoftwareModuleIdName;
|
import org.eclipse.hawkbit.ui.common.entity.SoftwareModuleIdName;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -27,14 +26,12 @@ import com.vaadin.spring.annotation.VaadinSessionScope;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Manage Distributions user state.
|
* Manage Distributions user state.
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@VaadinSessionScope
|
@VaadinSessionScope
|
||||||
public class ManageDistUIState implements ManagmentEntityState<Long>, Serializable {
|
public class ManageDistUIState implements ManagementEntityState, Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -7569047247017742928L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final ManageDistFilters manageDistFilters;
|
private final ManageDistFilters manageDistFilters;
|
||||||
|
|
||||||
@@ -46,16 +43,16 @@ public class ManageDistUIState implements ManagmentEntityState<Long>, Serializab
|
|||||||
|
|
||||||
private Set<Long> selectedDistributions = new HashSet<>();
|
private Set<Long> selectedDistributions = new HashSet<>();
|
||||||
|
|
||||||
private Long lastSelectedDistribution;
|
private transient Optional<Long> lastSelectedDistribution = Optional.empty();
|
||||||
|
|
||||||
private Set<Long> selectedSoftwareModules = emptySet();
|
private transient Optional<Long> lastSelectedSoftwareModule = Optional.empty();
|
||||||
|
|
||||||
|
private Set<Long> selectedSoftwareModules = Collections.emptySet();
|
||||||
|
|
||||||
private final Set<String> selectedDeleteDistSetTypes = new HashSet<>();
|
private final Set<String> selectedDeleteDistSetTypes = new HashSet<>();
|
||||||
|
|
||||||
private Set<String> selectedDeleteSWModuleTypes = new HashSet<>();
|
private Set<String> selectedDeleteSWModuleTypes = new HashSet<>();
|
||||||
|
|
||||||
private Long selectedBaseSwModuleId;
|
|
||||||
|
|
||||||
private boolean distTypeFilterClosed;
|
private boolean distTypeFilterClosed;
|
||||||
|
|
||||||
private boolean swTypeFilterClosed;
|
private boolean swTypeFilterClosed;
|
||||||
@@ -81,16 +78,10 @@ public class ManageDistUIState implements ManagmentEntityState<Long>, Serializab
|
|||||||
this.softwareModuleFilters = softwareModuleFilters;
|
this.softwareModuleFilters = softwareModuleFilters;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the manageDistFilters
|
|
||||||
*/
|
|
||||||
public ManageDistFilters getManageDistFilters() {
|
public ManageDistFilters getManageDistFilters() {
|
||||||
return manageDistFilters;
|
return manageDistFilters;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the deletedDistributionList
|
|
||||||
*/
|
|
||||||
public Set<DistributionSetIdName> getDeletedDistributionList() {
|
public Set<DistributionSetIdName> getDeletedDistributionList() {
|
||||||
return deletedDistributionList;
|
return deletedDistributionList;
|
||||||
}
|
}
|
||||||
@@ -104,23 +95,17 @@ public class ManageDistUIState implements ManagmentEntityState<Long>, Serializab
|
|||||||
return assignedList;
|
return assignedList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public Set<Long> getSelectedDistributions() {
|
||||||
* @return the slectedDistributions
|
return selectedDistributions;
|
||||||
*/
|
|
||||||
public Optional<Set<Long>> getSelectedDistributions() {
|
|
||||||
return Optional.ofNullable(selectedDistributions);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the lastSelectedDistribution
|
|
||||||
*/
|
|
||||||
public Optional<Long> getLastSelectedDistribution() {
|
public Optional<Long> getLastSelectedDistribution() {
|
||||||
return Optional.ofNullable(lastSelectedDistribution);
|
return lastSelectedDistribution;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLastSelectedEntity(final Long value) {
|
public void setLastSelectedEntityId(final Long value) {
|
||||||
this.lastSelectedDistribution = value;
|
this.lastSelectedDistribution = Optional.ofNullable(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -128,76 +113,42 @@ public class ManageDistUIState implements ManagmentEntityState<Long>, Serializab
|
|||||||
selectedDistributions = values;
|
selectedDistributions = values;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the softwareModuleFilters
|
|
||||||
*/
|
|
||||||
public ManageSoftwareModuleFilters getSoftwareModuleFilters() {
|
public ManageSoftwareModuleFilters getSoftwareModuleFilters() {
|
||||||
return softwareModuleFilters;
|
return softwareModuleFilters;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public Optional<Long> getLastSelectedSoftwareModule() {
|
||||||
* @return the selectedSoftwareModules
|
return lastSelectedSoftwareModule;
|
||||||
*/
|
}
|
||||||
|
|
||||||
|
public void setLastSelectedSoftwareModule(final Long value) {
|
||||||
|
this.lastSelectedSoftwareModule = Optional.ofNullable(value);
|
||||||
|
}
|
||||||
|
|
||||||
public Set<Long> getSelectedSoftwareModules() {
|
public Set<Long> getSelectedSoftwareModules() {
|
||||||
return selectedSoftwareModules;
|
return selectedSoftwareModules;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the selectedBaseSwModuleId
|
|
||||||
*/
|
|
||||||
public Optional<Long> getSelectedBaseSwModuleId() {
|
|
||||||
return Optional.ofNullable(selectedBaseSwModuleId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param selectedBaseSwModuleId
|
|
||||||
* the selectedBaseSwModuleId to set
|
|
||||||
*/
|
|
||||||
public void setSelectedBaseSwModuleId(final Long selectedBaseSwModuleId) {
|
|
||||||
this.selectedBaseSwModuleId = selectedBaseSwModuleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param selectedSoftwareModules
|
|
||||||
* the selectedSoftwareModules to set
|
|
||||||
*/
|
|
||||||
public void setSelectedSoftwareModules(final Set<Long> selectedSoftwareModules) {
|
public void setSelectedSoftwareModules(final Set<Long> selectedSoftwareModules) {
|
||||||
this.selectedSoftwareModules = selectedSoftwareModules;
|
this.selectedSoftwareModules = selectedSoftwareModules;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the distTypeFilterClosed
|
|
||||||
*/
|
|
||||||
public boolean isDistTypeFilterClosed() {
|
public boolean isDistTypeFilterClosed() {
|
||||||
return distTypeFilterClosed;
|
return distTypeFilterClosed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param distTypeFilterClosed
|
|
||||||
* the distTypeFilterClosed to set
|
|
||||||
*/
|
|
||||||
public void setDistTypeFilterClosed(final boolean distTypeFilterClosed) {
|
public void setDistTypeFilterClosed(final boolean distTypeFilterClosed) {
|
||||||
this.distTypeFilterClosed = distTypeFilterClosed;
|
this.distTypeFilterClosed = distTypeFilterClosed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the swTypeFilterClosed
|
|
||||||
*/
|
|
||||||
public boolean isSwTypeFilterClosed() {
|
public boolean isSwTypeFilterClosed() {
|
||||||
return swTypeFilterClosed;
|
return swTypeFilterClosed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param swTypeFilterClosed
|
|
||||||
* the swTypeFilterClosed to set
|
|
||||||
*/
|
|
||||||
public void setSwTypeFilterClosed(final boolean swTypeFilterClosed) {
|
public void setSwTypeFilterClosed(final boolean swTypeFilterClosed) {
|
||||||
this.swTypeFilterClosed = swTypeFilterClosed;
|
this.swTypeFilterClosed = swTypeFilterClosed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the deleteSofwareModulesList
|
|
||||||
*/
|
|
||||||
public Map<Long, String> getDeleteSofwareModulesList() {
|
public Map<Long, String> getDeleteSofwareModulesList() {
|
||||||
return deleteSofwareModulesList;
|
return deleteSofwareModulesList;
|
||||||
}
|
}
|
||||||
@@ -214,20 +165,10 @@ public class ManageDistUIState implements ManagmentEntityState<Long>, Serializab
|
|||||||
this.selectedDeleteSWModuleTypes = selectedDeleteSWModuleTypes;
|
this.selectedDeleteSWModuleTypes = selectedDeleteSWModuleTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get isSwModuleTableMaximized.
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public boolean isDsTableMaximized() {
|
public boolean isDsTableMaximized() {
|
||||||
return dsTableMaximized;
|
return dsTableMaximized;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
|
||||||
* Set isDsModuleTableMaximized.
|
|
||||||
*
|
|
||||||
* @param dsModuleTableMaximized
|
|
||||||
*/
|
|
||||||
public void setDsTableMaximized(final boolean dsModuleTableMaximized) {
|
public void setDsTableMaximized(final boolean dsModuleTableMaximized) {
|
||||||
dsTableMaximized = dsModuleTableMaximized;
|
dsTableMaximized = dsModuleTableMaximized;
|
||||||
}
|
}
|
||||||
@@ -236,56 +177,30 @@ public class ManageDistUIState implements ManagmentEntityState<Long>, Serializab
|
|||||||
return assignedSoftwareModuleDetails;
|
return assignedSoftwareModuleDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the isSwModuleTableMaximized
|
|
||||||
*/
|
|
||||||
public boolean isSwModuleTableMaximized() {
|
public boolean isSwModuleTableMaximized() {
|
||||||
return swModuleTableMaximized;
|
return swModuleTableMaximized;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param swModuleTableMaximized
|
|
||||||
* the isSwModuleTableMaximized to set
|
|
||||||
*/
|
|
||||||
public void setSwModuleTableMaximized(final boolean swModuleTableMaximized) {
|
public void setSwModuleTableMaximized(final boolean swModuleTableMaximized) {
|
||||||
this.swModuleTableMaximized = swModuleTableMaximized;
|
this.swModuleTableMaximized = swModuleTableMaximized;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the noDataAvilableSwModule
|
|
||||||
*/
|
|
||||||
public boolean isNoDataAvilableSwModule() {
|
public boolean isNoDataAvilableSwModule() {
|
||||||
return noDataAvilableSwModule;
|
return noDataAvilableSwModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param noDataAvilableSwModule
|
|
||||||
* the noDataAvilableSwModule to set
|
|
||||||
*/
|
|
||||||
public void setNoDataAvilableSwModule(final boolean noDataAvilableSwModule) {
|
public void setNoDataAvilableSwModule(final boolean noDataAvilableSwModule) {
|
||||||
this.noDataAvilableSwModule = noDataAvilableSwModule;
|
this.noDataAvilableSwModule = noDataAvilableSwModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the noDataAvailableDist
|
|
||||||
*/
|
|
||||||
public boolean isNoDataAvailableDist() {
|
public boolean isNoDataAvailableDist() {
|
||||||
return noDataAvailableDist;
|
return noDataAvailableDist;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param noDataAvailableDist
|
|
||||||
* the isNoDataAvailableDist to set
|
|
||||||
*/
|
|
||||||
public void setNoDataAvailableDist(final boolean noDataAvailableDist) {
|
public void setNoDataAvailableDist(final boolean noDataAvailableDist) {
|
||||||
this.noDataAvailableDist = noDataAvailableDist;
|
this.noDataAvailableDist = noDataAvailableDist;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Need HashSet because the Set have to be serializable
|
|
||||||
*
|
|
||||||
* @return map
|
|
||||||
*/
|
|
||||||
public Map<DistributionSetIdName, HashMap<Long, HashSet<SoftwareModuleIdName>>> getConsolidatedDistSoftwarewList() {
|
public Map<DistributionSetIdName, HashMap<Long, HashSet<SoftwareModuleIdName>>> getConsolidatedDistSoftwarewList() {
|
||||||
return consolidatedDistSoftwarewList;
|
return consolidatedDistSoftwarewList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ import org.eclipse.hawkbit.repository.event.remote.DistributionSetDeletedEvent;
|
|||||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetCreatedEvent;
|
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetCreatedEvent;
|
||||||
import org.eclipse.hawkbit.ui.distributions.dstable.ManageDistBeanQuery;
|
import org.eclipse.hawkbit.ui.distributions.dstable.ManageDistBeanQuery;
|
||||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.TableColumn;
|
import org.eclipse.hawkbit.ui.utils.TableColumn;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
||||||
@@ -46,7 +46,8 @@ public class DistributionSetSelectTable extends Table {
|
|||||||
|
|
||||||
private Container container;
|
private Container container;
|
||||||
|
|
||||||
DistributionSetSelectTable(final VaadinMessageSource i18n, final UIEventBus eventBus, final ManageDistUIState manageDistUIState) {
|
DistributionSetSelectTable(final VaadinMessageSource i18n, final UIEventBus eventBus,
|
||||||
|
final ManageDistUIState manageDistUIState) {
|
||||||
this.i18n = i18n;
|
this.i18n = i18n;
|
||||||
this.manageDistUIState = manageDistUIState;
|
this.manageDistUIState = manageDistUIState;
|
||||||
setStyleName("sp-table");
|
setStyleName("sp-table");
|
||||||
@@ -139,7 +140,8 @@ public class DistributionSetSelectTable extends Table {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Object getItemIdToSelect() {
|
private Object getItemIdToSelect() {
|
||||||
return manageDistUIState.getSelectedDistributions().orElse(null);
|
return manageDistUIState.getSelectedDistributions().isEmpty() ? null
|
||||||
|
: manageDistUIState.getSelectedDistributions();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectRow() {
|
private void selectRow() {
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ package org.eclipse.hawkbit.ui.layouts;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.TagManagement;
|
import org.eclipse.hawkbit.repository.TagManagement;
|
||||||
import org.eclipse.hawkbit.repository.builder.TagUpdate;
|
import org.eclipse.hawkbit.repository.builder.TagUpdate;
|
||||||
@@ -34,10 +33,10 @@ import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
|||||||
import org.eclipse.hawkbit.ui.management.event.DistributionSetTagTableEvent;
|
import org.eclipse.hawkbit.ui.management.event.DistributionSetTagTableEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.TargetTagTableEvent;
|
import org.eclipse.hawkbit.ui.management.event.TargetTagTableEvent;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.spring.events.EventBus;
|
import org.vaadin.spring.events.EventBus;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
|
|
||||||
@@ -209,10 +208,10 @@ public abstract class AbstractCreateUpdateTagLayout<E extends NamedEntity> exten
|
|||||||
|
|
||||||
tagDesc = new TextAreaBuilder().caption(i18n.getMessage("textfield.description"))
|
tagDesc = new TextAreaBuilder().caption(i18n.getMessage("textfield.description"))
|
||||||
.styleName(ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TAG_DESC)
|
.styleName(ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TAG_DESC)
|
||||||
.prompt(i18n.getMessage("textfield.description")).immediate(true).id(SPUIDefinitions.NEW_TARGET_TAG_DESC)
|
.prompt(i18n.getMessage("textfield.description")).immediate(true)
|
||||||
.buildTextComponent();
|
.id(SPUIDefinitions.NEW_TARGET_TAG_DESC).buildTextComponent();
|
||||||
|
|
||||||
tagDesc.setNullRepresentation(StringUtils.EMPTY);
|
tagDesc.setNullRepresentation("");
|
||||||
|
|
||||||
tagNameComboBox = SPUIComponentProvider.getComboBox(null, "", null, null, false, "",
|
tagNameComboBox = SPUIComponentProvider.getComboBox(null, "", null, null, false, "",
|
||||||
i18n.getMessage("label.combobox.tag"));
|
i18n.getMessage("label.combobox.tag"));
|
||||||
@@ -609,8 +608,8 @@ public abstract class AbstractCreateUpdateTagLayout<E extends NamedEntity> exten
|
|||||||
|
|
||||||
private boolean isDuplicateByName() {
|
private boolean isDuplicateByName() {
|
||||||
final Optional<E> existingType = findEntityByName();
|
final Optional<E> existingType = findEntityByName();
|
||||||
existingType.ifPresent(type -> uiNotification
|
existingType.ifPresent(type -> uiNotification.displayValidationError(
|
||||||
.displayValidationError(i18n.getMessage("message.tag.duplicate.check", new Object[] { type.getName() })));
|
i18n.getMessage("message.tag.duplicate.check", new Object[] { type.getName() })));
|
||||||
|
|
||||||
return existingType.isPresent();
|
return existingType.isPresent();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,9 +56,9 @@ import org.eclipse.hawkbit.ui.push.TargetDeletedEventContainer;
|
|||||||
import org.eclipse.hawkbit.ui.push.TargetTagCreatedEventContainer;
|
import org.eclipse.hawkbit.ui.push.TargetTagCreatedEventContainer;
|
||||||
import org.eclipse.hawkbit.ui.push.TargetTagDeletedEventContainer;
|
import org.eclipse.hawkbit.ui.push.TargetTagDeletedEventContainer;
|
||||||
import org.eclipse.hawkbit.ui.push.TargetTagUpdatedEventContainer;
|
import org.eclipse.hawkbit.ui.push.TargetTagUpdatedEventContainer;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
@@ -66,6 +66,7 @@ import org.vaadin.spring.events.EventScope;
|
|||||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
|
||||||
import com.vaadin.server.Page;
|
import com.vaadin.server.Page;
|
||||||
import com.vaadin.server.Page.BrowserWindowResizeEvent;
|
import com.vaadin.server.Page.BrowserWindowResizeEvent;
|
||||||
import com.vaadin.server.Page.BrowserWindowResizeListener;
|
import com.vaadin.server.Page.BrowserWindowResizeListener;
|
||||||
@@ -82,8 +83,9 @@ import com.vaadin.ui.UI;
|
|||||||
@SpringView(name = DeploymentView.VIEW_NAME, ui = HawkbitUI.class)
|
@SpringView(name = DeploymentView.VIEW_NAME, ui = HawkbitUI.class)
|
||||||
public class DeploymentView extends AbstractNotificationView implements BrowserWindowResizeListener {
|
public class DeploymentView extends AbstractNotificationView implements BrowserWindowResizeListener {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public static final String VIEW_NAME = "deployment";
|
public static final String VIEW_NAME = "deployment";
|
||||||
private static final long serialVersionUID = 1847434723456644998L;
|
|
||||||
|
|
||||||
private final SpPermissionChecker permChecker;
|
private final SpPermissionChecker permChecker;
|
||||||
|
|
||||||
@@ -172,6 +174,11 @@ public class DeploymentView extends AbstractNotificationView implements BrowserW
|
|||||||
getEventBus().publish(this, ManagementUIEvent.SHOW_COUNT_MESSAGE);
|
getEventBus().publish(this, ManagementUIEvent.SHOW_COUNT_MESSAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter(final ViewChangeEvent event) {
|
||||||
|
distributionTableLayout.getDistributionTable().selectEntity(managementUIState.getLastSelectedDsIdName());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DashboardMenuItem getDashboardMenuItem() {
|
protected DashboardMenuItem getDashboardMenuItem() {
|
||||||
return deploymentViewMenuItem;
|
return deploymentViewMenuItem;
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.management.actionhistory;
|
package org.eclipse.hawkbit.ui.management.actionhistory;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.ui.common.grid.AbstractGrid;
|
import org.eclipse.hawkbit.ui.common.grid.AbstractGrid;
|
||||||
@@ -71,11 +73,12 @@ public class ActionHistoryLayout extends AbstractGridComponentLayout {
|
|||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
@EventBusListenerMethod(scope = EventScope.UI)
|
||||||
void onEvent(final TargetTableEvent targetUIEvent) {
|
void onEvent(final TargetTableEvent targetUIEvent) {
|
||||||
|
final Optional<Long> targetId = managementUIState.getLastSelectedTargetId();
|
||||||
if (BaseEntityEventType.SELECTED_ENTITY == targetUIEvent.getEventType()) {
|
if (BaseEntityEventType.SELECTED_ENTITY == targetUIEvent.getEventType()) {
|
||||||
setData(SPUIDefinitions.DATA_AVAILABLE);
|
setData(SPUIDefinitions.DATA_AVAILABLE);
|
||||||
UI.getCurrent().access(() -> populateActionHistoryDetails(targetUIEvent.getEntity()));
|
UI.getCurrent().access(() -> populateActionHistoryDetails(targetUIEvent.getEntity()));
|
||||||
} else if (BaseEntityEventType.REMOVE_ENTITY == targetUIEvent.getEventType()
|
} else if (BaseEntityEventType.REMOVE_ENTITY == targetUIEvent.getEventType() && targetId.isPresent()
|
||||||
&& targetUIEvent.getEntityIds().contains(managementUIState.getLastSelectedTargetId())) {
|
&& targetUIEvent.getEntityIds().contains(targetId.get())) {
|
||||||
setData(SPUIDefinitions.NO_DATA);
|
setData(SPUIDefinitions.NO_DATA);
|
||||||
UI.getCurrent().access(this::populateActionHistoryDetails);
|
UI.getCurrent().access(this::populateActionHistoryDetails);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ package org.eclipse.hawkbit.ui.management.dstable;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.SystemManagement;
|
import org.eclipse.hawkbit.repository.SystemManagement;
|
||||||
@@ -30,12 +29,12 @@ import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
|||||||
import org.eclipse.hawkbit.ui.distributions.dstable.DistributionSetTable;
|
import org.eclipse.hawkbit.ui.distributions.dstable.DistributionSetTable;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
||||||
@@ -169,10 +168,8 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
|
|||||||
.description(desc).type(distributionSetType).requiredMigrationStep(isMigStepReq));
|
.description(desc).type(distributionSetType).requiredMigrationStep(isMigStepReq));
|
||||||
|
|
||||||
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.ADD_ENTITY, newDist));
|
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.ADD_ENTITY, newDist));
|
||||||
|
|
||||||
notificationMessage.displaySuccess(i18n.getMessage("message.new.dist.save.success",
|
notificationMessage.displaySuccess(i18n.getMessage("message.new.dist.save.success",
|
||||||
new Object[] { newDist.getName(), newDist.getVersion() }));
|
new Object[] { newDist.getName(), newDist.getVersion() }));
|
||||||
|
|
||||||
distributionSetTable.setValue(Sets.newHashSet(newDist.getId()));
|
distributionSetTable.setValue(Sets.newHashSet(newDist.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,16 +223,16 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
|
|||||||
distNameTextField = createTextField("textfield.name", UIComponentIdProvider.DIST_ADD_NAME);
|
distNameTextField = createTextField("textfield.name", UIComponentIdProvider.DIST_ADD_NAME);
|
||||||
distVersionTextField = createTextField("textfield.version", UIComponentIdProvider.DIST_ADD_VERSION);
|
distVersionTextField = createTextField("textfield.version", UIComponentIdProvider.DIST_ADD_VERSION);
|
||||||
|
|
||||||
distsetTypeNameComboBox = SPUIComponentProvider.getComboBox(i18n.getMessage("label.combobox.type"), "", null, "",
|
distsetTypeNameComboBox = SPUIComponentProvider.getComboBox(i18n.getMessage("label.combobox.type"), "", null,
|
||||||
false, "", i18n.getMessage("label.combobox.type"));
|
"", false, "", i18n.getMessage("label.combobox.type"));
|
||||||
distsetTypeNameComboBox.setImmediate(true);
|
distsetTypeNameComboBox.setImmediate(true);
|
||||||
distsetTypeNameComboBox.setNullSelectionAllowed(false);
|
distsetTypeNameComboBox.setNullSelectionAllowed(false);
|
||||||
distsetTypeNameComboBox.setId(UIComponentIdProvider.DIST_ADD_DISTSETTYPE);
|
distsetTypeNameComboBox.setId(UIComponentIdProvider.DIST_ADD_DISTSETTYPE);
|
||||||
|
|
||||||
descTextArea = new TextAreaBuilder().caption(i18n.getMessage("textfield.description")).style("text-area-style")
|
descTextArea = new TextAreaBuilder().caption(i18n.getMessage("textfield.description")).style("text-area-style")
|
||||||
.prompt(i18n.getMessage("textfield.description")).immediate(true).id(UIComponentIdProvider.DIST_ADD_DESC)
|
.prompt(i18n.getMessage("textfield.description")).immediate(true)
|
||||||
.buildTextComponent();
|
.id(UIComponentIdProvider.DIST_ADD_DESC).buildTextComponent();
|
||||||
descTextArea.setNullRepresentation(StringUtils.EMPTY);
|
descTextArea.setNullRepresentation("");
|
||||||
|
|
||||||
reqMigStepCheckbox = SPUIComponentProvider.getCheckBox(i18n.getMessage("checkbox.dist.required.migration.step"),
|
reqMigStepCheckbox = SPUIComponentProvider.getCheckBox(i18n.getMessage("checkbox.dist.required.migration.step"),
|
||||||
"dist-checkbox-style", null, false, "");
|
"dist-checkbox-style", null, false, "");
|
||||||
@@ -246,7 +243,7 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
|
|||||||
private TextField createTextField(final String in18Key, final String id) {
|
private TextField createTextField(final String in18Key, final String id) {
|
||||||
final TextField buildTextField = new TextFieldBuilder().caption(i18n.getMessage(in18Key)).required(true)
|
final TextField buildTextField = new TextFieldBuilder().caption(i18n.getMessage(in18Key)).required(true)
|
||||||
.prompt(i18n.getMessage(in18Key)).immediate(true).id(id).buildTextComponent();
|
.prompt(i18n.getMessage(in18Key)).immediate(true).id(id).buildTextComponent();
|
||||||
buildTextField.setNullRepresentation(StringUtils.EMPTY);
|
buildTextField.setNullRepresentation("");
|
||||||
return buildTextField;
|
return buildTextField;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,8 +320,8 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
|
|||||||
populateDistSetTypeNameCombo();
|
populateDistSetTypeNameCombo();
|
||||||
populateValuesOfDistribution(editDistId);
|
populateValuesOfDistribution(editDistId);
|
||||||
return new WindowBuilder(SPUIDefinitions.CREATE_UPDATE_WINDOW)
|
return new WindowBuilder(SPUIDefinitions.CREATE_UPDATE_WINDOW)
|
||||||
.caption(i18n.getMessage(UIComponentIdProvider.DIST_ADD_CAPTION)).content(this).layout(formLayout).i18n(i18n)
|
.caption(i18n.getMessage(UIComponentIdProvider.DIST_ADD_CAPTION)).content(this).layout(formLayout)
|
||||||
.saveDialogCloseListener(new SaveOnCloseDialogListener()).buildCommonDialogWindow();
|
.i18n(i18n).saveDialogCloseListener(new SaveOnCloseDialogListener()).buildCommonDialogWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,8 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.management.dstable;
|
package org.eclipse.hawkbit.ui.management.dstable;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.TagManagement;
|
import org.eclipse.hawkbit.repository.TagManagement;
|
||||||
@@ -46,11 +44,6 @@ public class DistributionDetails extends AbstractDistributionSetDetails {
|
|||||||
return new SoftwareModuleDetailsTable(i18n, false, permissionChecker, null, null, null, uiNotification);
|
return new SoftwareModuleDetailsTable(i18n, false, permissionChecker, null, null, null, uiNotification);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean onLoadIsTableRowSelected() {
|
|
||||||
return getManagementUIState().getSelectedDsIdName().map(Set::isEmpty).orElse(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onLoadIsTableMaximized() {
|
protected boolean onLoadIsTableMaximized() {
|
||||||
return getManagementUIState().isDsTableMaximized();
|
return getManagementUIState().isDsTableMaximized();
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import java.util.Optional;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||||
@@ -35,10 +34,9 @@ import org.eclipse.hawkbit.ui.dd.criteria.ManagementViewClientCriterion;
|
|||||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||||
import org.eclipse.hawkbit.ui.distributions.dstable.DsMetadataPopupLayout;
|
import org.eclipse.hawkbit.ui.distributions.dstable.DsMetadataPopupLayout;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableFilterEvent;
|
|
||||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.PinUnpinEvent;
|
import org.eclipse.hawkbit.ui.management.event.PinUnpinEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.SaveActionWindowEvent;
|
import org.eclipse.hawkbit.ui.management.event.RefreshDistributionTableByFilterEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||||
import org.eclipse.hawkbit.ui.management.targettable.TargetTable;
|
import org.eclipse.hawkbit.ui.management.targettable.TargetTable;
|
||||||
import org.eclipse.hawkbit.ui.push.DistributionSetUpdatedEventContainer;
|
import org.eclipse.hawkbit.ui.push.DistributionSetUpdatedEventContainer;
|
||||||
@@ -50,6 +48,7 @@ import org.eclipse.hawkbit.ui.utils.TableColumn;
|
|||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
|
import org.eclipse.hawkbit.ui.view.filter.OnlyEventsFromDeploymentViewFilter;
|
||||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
||||||
@@ -71,23 +70,31 @@ import com.vaadin.ui.Table;
|
|||||||
import com.vaadin.ui.UI;
|
import com.vaadin.ui.UI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Distribution set table.
|
* Distribution set table which is shown on the Deployment View.
|
||||||
*/
|
*/
|
||||||
public class DistributionTable extends AbstractNamedVersionTable<DistributionSet, Long> {
|
public class DistributionTable extends AbstractNamedVersionTable<DistributionSet> {
|
||||||
|
|
||||||
private static final long serialVersionUID = -1928335256399519494L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final SpPermissionChecker permissionChecker;
|
private final SpPermissionChecker permissionChecker;
|
||||||
|
|
||||||
private final ManagementUIState managementUIState;
|
private final ManagementUIState managementUIState;
|
||||||
|
|
||||||
private final ManagementViewClientCriterion managementViewClientCriterion;
|
private final ManagementViewClientCriterion managementViewClientCriterion;
|
||||||
|
|
||||||
private final transient TargetManagement targetManagement;
|
private final transient TargetManagement targetManagement;
|
||||||
|
|
||||||
private final DsMetadataPopupLayout dsMetadataPopupLayout;
|
private final DsMetadataPopupLayout dsMetadataPopupLayout;
|
||||||
|
|
||||||
private final transient DistributionSetManagement distributionSetManagement;
|
private final transient DistributionSetManagement distributionSetManagement;
|
||||||
|
|
||||||
private final transient DeploymentManagement deploymentManagement;
|
private final transient DeploymentManagement deploymentManagement;
|
||||||
|
|
||||||
private final String notAllowedMsg;
|
private final String notAllowedMsg;
|
||||||
private boolean isDistPinned;
|
|
||||||
private Button distributinPinnedBtn;
|
private boolean distPinned;
|
||||||
|
|
||||||
|
private Button distributionPinnedBtn;
|
||||||
|
|
||||||
DistributionTable(final UIEventBus eventBus, final VaadinMessageSource i18n,
|
DistributionTable(final UIEventBus eventBus, final VaadinMessageSource i18n,
|
||||||
final SpPermissionChecker permissionChecker, final UINotification notification,
|
final SpPermissionChecker permissionChecker, final UINotification notification,
|
||||||
@@ -153,7 +160,7 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
|||||||
refreshContainer();
|
refreshContainer();
|
||||||
if (setsThatAreVisibleButNotCompleteAnymore.stream()
|
if (setsThatAreVisibleButNotCompleteAnymore.stream()
|
||||||
.anyMatch(id -> id.equals(managementUIState.getLastSelectedDsIdName()))) {
|
.anyMatch(id -> id.equals(managementUIState.getLastSelectedDsIdName()))) {
|
||||||
managementUIState.setLastSelectedEntity(null);
|
managementUIState.setLastSelectedEntityId(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -165,17 +172,13 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
|||||||
/**
|
/**
|
||||||
* DistributionTableFilterEvent.
|
* DistributionTableFilterEvent.
|
||||||
*
|
*
|
||||||
* @param event
|
* @param filterEvent
|
||||||
* as instance of {@link DistributionTableFilterEvent}
|
* as instance of {@link RefreshDistributionTableByFilterEvent}
|
||||||
*/
|
*/
|
||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
@EventBusListenerMethod(scope = EventScope.UI, filter = OnlyEventsFromDeploymentViewFilter.class)
|
||||||
void onEvent(final DistributionTableFilterEvent event) {
|
void onEvent(final RefreshDistributionTableByFilterEvent filterEvent) {
|
||||||
if (event == DistributionTableFilterEvent.FILTER_BY_TEXT
|
|
||||||
|| event == DistributionTableFilterEvent.REMOVE_FILTER_BY_TEXT
|
|
||||||
|| event == DistributionTableFilterEvent.FILTER_BY_TAG) {
|
|
||||||
UI.getCurrent().access(this::refreshFilter);
|
UI.getCurrent().access(this::refreshFilter);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
@EventBusListenerMethod(scope = EventScope.UI)
|
||||||
void onEvent(final DistributionTableEvent event) {
|
void onEvent(final DistributionTableEvent event) {
|
||||||
@@ -184,7 +187,6 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UI.getCurrent().access(() -> updateDistributionInTable(event.getEntity()));
|
UI.getCurrent().access(() -> updateDistributionInTable(event.getEntity()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
@EventBusListenerMethod(scope = EventScope.UI)
|
||||||
@@ -194,8 +196,8 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
|||||||
refreshFilter();
|
refreshFilter();
|
||||||
styleDistributionTableOnPinning();
|
styleDistributionTableOnPinning();
|
||||||
// unstyleDistPin
|
// unstyleDistPin
|
||||||
if (distributinPinnedBtn != null) {
|
if (distributionPinnedBtn != null) {
|
||||||
distributinPinnedBtn.setStyleName(getPinStyle());
|
distributionPinnedBtn.setStyleName(getPinStyle());
|
||||||
}
|
}
|
||||||
} else if (pinUnpinEvent == PinUnpinEvent.UNPIN_TARGET) {
|
} else if (pinUnpinEvent == PinUnpinEvent.UNPIN_TARGET) {
|
||||||
refreshFilter();
|
refreshFilter();
|
||||||
@@ -204,13 +206,6 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
|
||||||
void onEvent(final SaveActionWindowEvent event) {
|
|
||||||
if (event == SaveActionWindowEvent.DELETED_DISTRIBUTIONS) {
|
|
||||||
refreshFilter();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
@EventBusListenerMethod(scope = EventScope.UI)
|
||||||
void onEvent(final ManagementUIEvent managementUIEvent) {
|
void onEvent(final ManagementUIEvent managementUIEvent) {
|
||||||
UI.getCurrent().access(() -> {
|
UI.getCurrent().access(() -> {
|
||||||
@@ -273,7 +268,6 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
|||||||
iconLayout.addComponent(manageMetaDataBtn);
|
iconLayout.addComponent(manageMetaDataBtn);
|
||||||
return iconLayout;
|
return iconLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,12 +290,12 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isFirstRowSelectedOnLoad() {
|
protected boolean isFirstRowSelectedOnLoad() {
|
||||||
return managementUIState.getSelectedDsIdName().map(Set::isEmpty).orElse(true);
|
return managementUIState.getSelectedDsIdName().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object getItemIdToSelect() {
|
protected Object getItemIdToSelect() {
|
||||||
return managementUIState.getSelectedDsIdName().orElse(null);
|
return managementUIState.getSelectedDsIdName().isEmpty() ? null : managementUIState.getSelectedDsIdName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -310,15 +304,12 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void publishEntityAfterValueChange(final DistributionSet selectedLastEntity) {
|
protected void publishSelectedEntityEvent(final DistributionSet selectedLastEntity) {
|
||||||
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.SELECTED_ENTITY, selectedLastEntity));
|
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.SELECTED_ENTITY, selectedLastEntity));
|
||||||
if (selectedLastEntity != null) {
|
|
||||||
managementUIState.setLastSelectedEntity(selectedLastEntity.getId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ManagementUIState getManagmentEntityState() {
|
protected ManagementUIState getManagementEntityState() {
|
||||||
return managementUIState;
|
return managementUIState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,7 +324,7 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
|||||||
if (isMaximized()) {
|
if (isMaximized()) {
|
||||||
return columnList;
|
return columnList;
|
||||||
}
|
}
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.PIN_COLUMN, StringUtils.EMPTY, 0.2F));
|
columnList.add(new TableColumn(SPUILabelDefinitions.PIN_COLUMN, "", 0.2F));
|
||||||
return columnList;
|
return columnList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -460,7 +451,7 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Boolean isNoTagButton(final String tagData, final String targetNoTagData) {
|
private boolean isNoTagButton(final String tagData, final String targetNoTagData) {
|
||||||
if (tagData.equals(targetNoTagData)) {
|
if (tagData.equals(targetNoTagData)) {
|
||||||
notification.displayValidationError(i18n.getMessage("message.tag.cannot.be.assigned",
|
notification.displayValidationError(i18n.getMessage("message.tag.cannot.be.assigned",
|
||||||
new Object[] { i18n.getMessage("label.no.tag.assigned") }));
|
new Object[] { i18n.getMessage("label.no.tag.assigned") }));
|
||||||
@@ -530,12 +521,10 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
|||||||
|
|
||||||
managementUIState.getDistributionTableFilters().getPinnedTarget().map(TargetIdName::getControllerId)
|
managementUIState.getDistributionTableFilters().getPinnedTarget().map(TargetIdName::getControllerId)
|
||||||
.ifPresent(controllerId -> {
|
.ifPresent(controllerId -> {
|
||||||
|
|
||||||
final Long installedDistId = deploymentManagement.getInstalledDistributionSet(controllerId)
|
final Long installedDistId = deploymentManagement.getInstalledDistributionSet(controllerId)
|
||||||
.map(DistributionSet::getId).orElse(null);
|
.map(DistributionSet::getId).orElse(null);
|
||||||
final Long assignedDistId = deploymentManagement.getAssignedDistributionSet(controllerId)
|
final Long assignedDistId = deploymentManagement.getAssignedDistributionSet(controllerId)
|
||||||
.map(DistributionSet::getId).orElse(null);
|
.map(DistributionSet::getId).orElse(null);
|
||||||
|
|
||||||
styleDistributionSetTable(installedDistId, assignedDistId);
|
styleDistributionSetTable(installedDistId, assignedDistId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -574,13 +563,13 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
|||||||
final Long pinnedId = ((DistributionSetIdName) pinBtn.getData()).getId();
|
final Long pinnedId = ((DistributionSetIdName) pinBtn.getData()).getId();
|
||||||
|
|
||||||
if (managementUIState.getTargetTableFilters().getPinnedDistId().map(pinnedId::equals).orElse(false)) {
|
if (managementUIState.getTargetTableFilters().getPinnedDistId().map(pinnedId::equals).orElse(false)) {
|
||||||
setDistributinPinnedBtn(pinBtn);
|
setDistributionPinnedBtn(pinBtn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPinClickListener(final ClickEvent event) {
|
private void addPinClickListener(final ClickEvent event) {
|
||||||
checkifAlreadyPinned(event.getButton());
|
checkifAlreadyPinned(event.getButton());
|
||||||
if (isDistPinned) {
|
if (distPinned) {
|
||||||
pinDitribution(event.getButton());
|
pinDitribution(event.getButton());
|
||||||
} else {
|
} else {
|
||||||
unPinDistribution(event.getButton());
|
unPinDistribution(event.getButton());
|
||||||
@@ -593,17 +582,17 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
|||||||
final Long pinnedDistId = managementUIState.getTargetTableFilters().getPinnedDistId().orElse(null);
|
final Long pinnedDistId = managementUIState.getTargetTableFilters().getPinnedDistId().orElse(null);
|
||||||
|
|
||||||
if (pinnedDistId == null) {
|
if (pinnedDistId == null) {
|
||||||
isDistPinned = !isDistPinned;
|
distPinned = !distPinned;
|
||||||
managementUIState.getTargetTableFilters().setPinnedDistId(newPinnedDistItemId);
|
managementUIState.getTargetTableFilters().setPinnedDistId(newPinnedDistItemId);
|
||||||
} else if (newPinnedDistItemId.equals(pinnedDistId)) {
|
} else if (newPinnedDistItemId.equals(pinnedDistId)) {
|
||||||
isDistPinned = false;
|
distPinned = false;
|
||||||
} else {
|
} else {
|
||||||
isDistPinned = true;
|
distPinned = true;
|
||||||
managementUIState.getTargetTableFilters().setPinnedDistId(newPinnedDistItemId);
|
managementUIState.getTargetTableFilters().setPinnedDistId(newPinnedDistItemId);
|
||||||
distributinPinnedBtn.setStyleName(getPinStyle());
|
distributionPinnedBtn.setStyleName(getPinStyle());
|
||||||
}
|
}
|
||||||
|
|
||||||
distributinPinnedBtn = eventBtn;
|
distributionPinnedBtn = eventBtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void unPinDistribution(final Button eventBtn) {
|
private void unPinDistribution(final Button eventBtn) {
|
||||||
@@ -624,14 +613,14 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
|||||||
eventBus.publish(this, PinUnpinEvent.PIN_DISTRIBUTION);
|
eventBus.publish(this, PinUnpinEvent.PIN_DISTRIBUTION);
|
||||||
applyPinStyle(eventBtn);
|
applyPinStyle(eventBtn);
|
||||||
styleDistributionSetTable();
|
styleDistributionSetTable();
|
||||||
isDistPinned = Boolean.FALSE;
|
distPinned = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void rePinDistribution(final Button pinBtn, final Long distID) {
|
private void rePinDistribution(final Button pinBtn, final Long distID) {
|
||||||
if (managementUIState.getTargetTableFilters().getPinnedDistId().map(distID::equals).orElse(false)) {
|
if (managementUIState.getTargetTableFilters().getPinnedDistId().map(distID::equals).orElse(false)) {
|
||||||
applyPinStyle(pinBtn);
|
applyPinStyle(pinBtn);
|
||||||
isDistPinned = Boolean.TRUE;
|
distPinned = true;
|
||||||
distributinPinnedBtn = pinBtn;
|
distributionPinnedBtn = pinBtn;
|
||||||
eventBus.publish(this, PinUnpinEvent.PIN_DISTRIBUTION);
|
eventBus.publish(this, PinUnpinEvent.PIN_DISTRIBUTION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -703,8 +692,8 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
|||||||
assignedDistTableItemId, itemId));
|
assignedDistTableItemId, itemId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDistributinPinnedBtn(final Button distributinPinnedBtn) {
|
public void setDistributionPinnedBtn(final Button distributionPinnedBtn) {
|
||||||
this.distributinPinnedBtn = distributinPinnedBtn;
|
this.distributionPinnedBtn = distributionPinnedBtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
|||||||
import org.eclipse.hawkbit.ui.common.table.AbstractDistributionSetTableHeader;
|
import org.eclipse.hawkbit.ui.common.table.AbstractDistributionSetTableHeader;
|
||||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableFilterEvent;
|
import org.eclipse.hawkbit.ui.management.event.RefreshDistributionTableByFilterEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
@@ -46,49 +46,49 @@ public class DistributionTableHeader extends AbstractDistributionSetTableHeader
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String onLoadSearchBoxValue() {
|
protected String onLoadSearchBoxValue() {
|
||||||
return managementUIState.getDistributionTableFilters().getSearchText().orElse(null);
|
return getManagementUIState().getDistributionTableFilters().getSearchText().orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void showFilterButtonsLayout() {
|
protected void showFilterButtonsLayout() {
|
||||||
managementUIState.setDistTagFilterClosed(false);
|
getManagementUIState().setDistTagFilterClosed(false);
|
||||||
eventbus.publish(this, ManagementUIEvent.SHOW_DISTRIBUTION_TAG_LAYOUT);
|
eventbus.publish(this, ManagementUIEvent.SHOW_DISTRIBUTION_TAG_LAYOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void resetSearchText() {
|
protected void resetSearchText() {
|
||||||
if (managementUIState.getDistributionTableFilters().getSearchText().isPresent()) {
|
if (getManagementUIState().getDistributionTableFilters().getSearchText().isPresent()) {
|
||||||
managementUIState.getDistributionTableFilters().setSearchText(null);
|
getManagementUIState().getDistributionTableFilters().setSearchText(null);
|
||||||
eventbus.publish(this, DistributionTableFilterEvent.REMOVE_FILTER_BY_TEXT);
|
eventbus.publish(this, new RefreshDistributionTableByFilterEvent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void maximizeTable() {
|
public void maximizeTable() {
|
||||||
managementUIState.setDsTableMaximized(Boolean.TRUE);
|
getManagementUIState().setDsTableMaximized(Boolean.TRUE);
|
||||||
eventbus.publish(this, new DistributionTableEvent(BaseEntityEventType.MAXIMIZED));
|
eventbus.publish(this, new DistributionTableEvent(BaseEntityEventType.MAXIMIZED));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void minimizeTable() {
|
public void minimizeTable() {
|
||||||
managementUIState.setDsTableMaximized(Boolean.FALSE);
|
getManagementUIState().setDsTableMaximized(Boolean.FALSE);
|
||||||
eventbus.publish(this, new DistributionTableEvent(BaseEntityEventType.MINIMIZED));
|
eventbus.publish(this, new DistributionTableEvent(BaseEntityEventType.MINIMIZED));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean onLoadIsTableMaximized() {
|
public Boolean onLoadIsTableMaximized() {
|
||||||
return managementUIState.isDsTableMaximized();
|
return getManagementUIState().isDsTableMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean onLoadIsShowFilterButtonDisplayed() {
|
public Boolean onLoadIsShowFilterButtonDisplayed() {
|
||||||
return managementUIState.isDistTagFilterClosed();
|
return getManagementUIState().isDistTagFilterClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void searchBy(final String newSearchText) {
|
protected void searchBy(final String newSearchText) {
|
||||||
managementUIState.getDistributionTableFilters().setSearchText(newSearchText);
|
getManagementUIState().getDistributionTableFilters().setSearchText(newSearchText);
|
||||||
eventbus.publish(this, DistributionTableFilterEvent.FILTER_BY_TEXT);
|
eventbus.publish(this, new RefreshDistributionTableByFilterEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,16 +19,18 @@ import org.eclipse.hawkbit.ui.common.table.AbstractTableLayout;
|
|||||||
import org.eclipse.hawkbit.ui.dd.criteria.ManagementViewClientCriterion;
|
import org.eclipse.hawkbit.ui.dd.criteria.ManagementViewClientCriterion;
|
||||||
import org.eclipse.hawkbit.ui.distributions.dstable.DsMetadataPopupLayout;
|
import org.eclipse.hawkbit.ui.distributions.dstable.DsMetadataPopupLayout;
|
||||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Software module table layout.
|
* Distribution Set table layout which is shown on the Distribution View
|
||||||
*/
|
*/
|
||||||
public class DistributionTableLayout extends AbstractTableLayout<DistributionTable> {
|
public class DistributionTableLayout extends AbstractTableLayout<DistributionTable> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 6464291374980641235L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private final DistributionTable distributionTable;
|
||||||
|
|
||||||
public DistributionTableLayout(final VaadinMessageSource i18n, final UIEventBus eventBus,
|
public DistributionTableLayout(final VaadinMessageSource i18n, final UIEventBus eventBus,
|
||||||
final SpPermissionChecker permissionChecker, final ManagementUIState managementUIState,
|
final SpPermissionChecker permissionChecker, final ManagementUIState managementUIState,
|
||||||
@@ -44,8 +46,8 @@ public class DistributionTableLayout extends AbstractTableLayout<DistributionTab
|
|||||||
final DsMetadataPopupLayout dsMetadataPopupLayout = new DsMetadataPopupLayout(i18n, notification, eventBus,
|
final DsMetadataPopupLayout dsMetadataPopupLayout = new DsMetadataPopupLayout(i18n, notification, eventBus,
|
||||||
distributionSetManagement, entityFactory, permissionChecker);
|
distributionSetManagement, entityFactory, permissionChecker);
|
||||||
|
|
||||||
final DistributionTable distributionTable = new DistributionTable(eventBus, i18n, permissionChecker,
|
this.distributionTable = new DistributionTable(eventBus, i18n, permissionChecker, notification,
|
||||||
notification, managementUIState, managementViewClientCriterion, targetManagement, dsMetadataPopupLayout,
|
managementUIState, managementViewClientCriterion, targetManagement, dsMetadataPopupLayout,
|
||||||
distributionSetManagement, deploymentManagement);
|
distributionSetManagement, deploymentManagement);
|
||||||
|
|
||||||
super.init(new DistributionTableHeader(i18n, permissionChecker, eventBus, managementUIState), distributionTable,
|
super.init(new DistributionTableHeader(i18n, permissionChecker, eventBus, managementUIState), distributionTable,
|
||||||
@@ -54,4 +56,8 @@ public class DistributionTableLayout extends AbstractTableLayout<DistributionTab
|
|||||||
distributionAddUpdateWindowLayout));
|
distributionAddUpdateWindowLayout));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DistributionTable getDistributionTable() {
|
||||||
|
return distributionTable;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
package org.eclipse.hawkbit.ui.management.dstag;
|
package org.eclipse.hawkbit.ui.management.dstag;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterMultiButtonClick;
|
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterMultiButtonClick;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableFilterEvent;
|
import org.eclipse.hawkbit.ui.management.event.RefreshDistributionTableByFilterEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.vaadin.spring.events.EventBus;
|
import org.vaadin.spring.events.EventBus;
|
||||||
@@ -18,13 +18,15 @@ import org.vaadin.spring.events.EventBus.UIEventBus;
|
|||||||
import com.vaadin.ui.Button;
|
import com.vaadin.ui.Button;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Abstract class for button click behavior of the distribution set's tag
|
||||||
*
|
* buttons. Filters the distribution sets according to the active tags.
|
||||||
*/
|
*/
|
||||||
public class DistributionTagButtonClick extends AbstractFilterMultiButtonClick {
|
public class DistributionTagButtonClick extends AbstractFilterMultiButtonClick {
|
||||||
private static final long serialVersionUID = 4120296456125178019L;
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final transient EventBus.UIEventBus eventBus;
|
private final transient EventBus.UIEventBus eventBus;
|
||||||
|
|
||||||
private final ManagementUIState managementUIState;
|
private final ManagementUIState managementUIState;
|
||||||
|
|
||||||
DistributionTagButtonClick(final UIEventBus eventBus, final ManagementUIState managementUIState) {
|
DistributionTagButtonClick(final UIEventBus eventBus, final ManagementUIState managementUIState) {
|
||||||
@@ -39,7 +41,7 @@ public class DistributionTagButtonClick extends AbstractFilterMultiButtonClick {
|
|||||||
} else {
|
} else {
|
||||||
managementUIState.getDistributionTableFilters().getDistSetTags().remove(clickedButton.getId());
|
managementUIState.getDistributionTableFilters().getDistSetTags().remove(clickedButton.getId());
|
||||||
}
|
}
|
||||||
eventBus.publish(this, DistributionTableFilterEvent.FILTER_BY_TAG);
|
eventBus.publish(this, new RefreshDistributionTableByFilterEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -49,8 +51,7 @@ public class DistributionTagButtonClick extends AbstractFilterMultiButtonClick {
|
|||||||
} else {
|
} else {
|
||||||
managementUIState.getDistributionTableFilters().getDistSetTags().add(clickedButton.getId());
|
managementUIState.getDistributionTableFilters().getDistSetTags().add(clickedButton.getId());
|
||||||
}
|
}
|
||||||
|
eventBus.publish(this, new RefreshDistributionTableByFilterEvent());
|
||||||
eventBus.publish(this, DistributionTableFilterEvent.FILTER_BY_TAG);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,11 +22,11 @@ import org.eclipse.hawkbit.ui.management.state.DistributionTableFilters;
|
|||||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||||
import org.eclipse.hawkbit.ui.management.tag.TagIdName;
|
import org.eclipse.hawkbit.ui.management.tag.TagIdName;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
@@ -35,16 +35,19 @@ import com.vaadin.data.Item;
|
|||||||
import com.vaadin.event.dd.DropHandler;
|
import com.vaadin.event.dd.DropHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Class for defining the tag buttons of the distribution sets on the Deployment
|
||||||
*
|
* View.
|
||||||
*/
|
*/
|
||||||
public class DistributionTagButtons extends AbstractFilterButtons implements RefreshableContainer {
|
public class DistributionTagButtons extends AbstractFilterButtons implements RefreshableContainer {
|
||||||
|
|
||||||
private static final String NO_TAG = "NO TAG";
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private static final String NO_TAG = "NO TAG";
|
||||||
|
|
||||||
private final DistributionTagDropEvent spDistTagDropEvent;
|
private final DistributionTagDropEvent spDistTagDropEvent;
|
||||||
|
|
||||||
private final ManagementUIState managementUIState;
|
private final ManagementUIState managementUIState;
|
||||||
|
|
||||||
private final transient EntityFactory entityFactory;
|
private final transient EntityFactory entityFactory;
|
||||||
|
|
||||||
DistributionTagButtons(final UIEventBus eventBus, final ManagementUIState managementUIState,
|
DistributionTagButtons(final UIEventBus eventBus, final ManagementUIState managementUIState,
|
||||||
@@ -71,7 +74,6 @@ public class DistributionTagButtons extends AbstractFilterButtons implements Ref
|
|||||||
final BeanQueryFactory<DistributionTagBeanQuery> tagQF = new BeanQueryFactory<>(DistributionTagBeanQuery.class);
|
final BeanQueryFactory<DistributionTagBeanQuery> tagQF = new BeanQueryFactory<>(DistributionTagBeanQuery.class);
|
||||||
tagQF.setQueryConfiguration(Collections.emptyMap());
|
tagQF.setQueryConfiguration(Collections.emptyMap());
|
||||||
return HawkbitCommonUtil.createDSLazyQueryContainer(new BeanQueryFactory<>(DistributionTagBeanQuery.class));
|
return HawkbitCommonUtil.createDSLazyQueryContainer(new BeanQueryFactory<>(DistributionTagBeanQuery.class));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
|||||||
import org.eclipse.hawkbit.ui.dd.criteria.ManagementViewClientCriterion;
|
import org.eclipse.hawkbit.ui.dd.criteria.ManagementViewClientCriterion;
|
||||||
import org.eclipse.hawkbit.ui.management.state.DistributionTableFilters;
|
import org.eclipse.hawkbit.ui.management.state.DistributionTableFilters;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.spring.events.EventBus;
|
import org.vaadin.spring.events.EventBus;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
|
|
||||||
@@ -85,8 +85,8 @@ public class DistributionTagDropEvent implements DropHandler {
|
|||||||
private Boolean isNoTagAssigned(final DragAndDropEvent event) {
|
private Boolean isNoTagAssigned(final DragAndDropEvent event) {
|
||||||
final String tagName = ((DragAndDropWrapper) (event.getTargetDetails().getTarget())).getData().toString();
|
final String tagName = ((DragAndDropWrapper) (event.getTargetDetails().getTarget())).getData().toString();
|
||||||
if (tagName.equals(SPUIDefinitions.DISTRIBUTION_TAG_BUTTON)) {
|
if (tagName.equals(SPUIDefinitions.DISTRIBUTION_TAG_BUTTON)) {
|
||||||
notification.displayValidationError(
|
notification.displayValidationError(i18n.getMessage("message.tag.cannot.be.assigned",
|
||||||
i18n.getMessage("message.tag.cannot.be.assigned", new Object[] { i18n.getMessage("label.no.tag.assigned") }));
|
new Object[] { i18n.getMessage("label.no.tag.assigned") }));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -131,8 +131,7 @@ public class DistributionTagDropEvent implements DropHandler {
|
|||||||
final com.vaadin.event.dd.TargetDetails targetDetails = event.getTargetDetails();
|
final com.vaadin.event.dd.TargetDetails targetDetails = event.getTargetDetails();
|
||||||
|
|
||||||
final TableTransferable transferable = (TableTransferable) event.getTransferable();
|
final TableTransferable transferable = (TableTransferable) event.getTransferable();
|
||||||
@SuppressWarnings("unchecked")
|
final AbstractTable<?> source = (AbstractTable<?>) transferable.getSourceComponent();
|
||||||
final AbstractTable<?, Long> source = (AbstractTable<?, Long>) transferable.getSourceComponent();
|
|
||||||
|
|
||||||
final Set<Long> distSelected = source.getDeletedEntityByTransferable(transferable);
|
final Set<Long> distSelected = source.getDeletedEntityByTransferable(transferable);
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.management.event;
|
package org.eclipse.hawkbit.ui.management.event;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseUIEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Distribution Set Filter Event. Is published when there is a filter action on
|
||||||
*
|
* a distribution set table on the Deployment or Distribution View. It is
|
||||||
|
* possible to filter by text or tag.
|
||||||
*/
|
*/
|
||||||
public enum DistributionTableFilterEvent {
|
public class RefreshDistributionTableByFilterEvent extends BaseUIEvent {
|
||||||
FILTER_BY_TEXT, FILTER_BY_TAG, REMOVE_FILTER_BY_TEXT, REMOVE_FILTER_BY_TAG
|
|
||||||
}
|
}
|
||||||
@@ -9,12 +9,11 @@
|
|||||||
package org.eclipse.hawkbit.ui.management.event;
|
package org.eclipse.hawkbit.ui.management.event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Enum for events of type SaveAction which are thrown when pending actions are
|
||||||
*
|
* performed
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public enum SaveActionWindowEvent {
|
public enum SaveActionWindowEvent {
|
||||||
|
|
||||||
SAVED_ASSIGNMENTS, DISCARD_ALL_ASSIGNMENTS, DISCARD_ASSIGNMENTS, DELETED_DISTRIBUTIONS, DISCARD_ALL_DISTRIBUTIONS, SHOW_HIDE_TAB, DISCARD_ALL_TARGETS, DISCARD_ASSIGNMENT, DISCARD_DELETE_TARGET, DISCARD_DELETE_DS
|
SAVED_ASSIGNMENTS, DISCARD_ALL_ASSIGNMENTS, DISCARD_ASSIGNMENTS, DISCARD_ALL_DISTRIBUTIONS, SHOW_HIDE_TAB, DISCARD_ALL_TARGETS, DISCARD_ASSIGNMENT, DISCARD_DELETE_TARGET, DISCARD_DELETE_DS
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,10 +38,10 @@ import org.eclipse.hawkbit.ui.management.event.TargetTagTableEvent;
|
|||||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||||
import org.eclipse.hawkbit.ui.management.targettable.TargetTable;
|
import org.eclipse.hawkbit.ui.management.targettable.TargetTable;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
import org.vaadin.spring.events.EventScope;
|
import org.vaadin.spring.events.EventScope;
|
||||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||||
@@ -56,12 +56,11 @@ import com.vaadin.ui.Table.TableTransferable;
|
|||||||
import com.vaadin.ui.UI;
|
import com.vaadin.ui.UI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Layout for the action button footer on the Deployment View.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||||
|
|
||||||
private static final long serialVersionUID = -8112907467821886253L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final transient TagManagement tagManagementService;
|
private final transient TagManagement tagManagementService;
|
||||||
|
|
||||||
@@ -77,8 +76,8 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
|
|
||||||
private final transient DistributionSetManagement distributionSetManagement;
|
private final transient DistributionSetManagement distributionSetManagement;
|
||||||
|
|
||||||
public DeleteActionsLayout(final VaadinMessageSource i18n, final SpPermissionChecker permChecker, final UIEventBus eventBus,
|
public DeleteActionsLayout(final VaadinMessageSource i18n, final SpPermissionChecker permChecker,
|
||||||
final UINotification notification, final TagManagement tagManagementService,
|
final UIEventBus eventBus, final UINotification notification, final TagManagement tagManagementService,
|
||||||
final ManagementViewClientCriterion managementViewClientCriterion,
|
final ManagementViewClientCriterion managementViewClientCriterion,
|
||||||
final ManagementUIState managementUIState, final TargetManagement targetManagement,
|
final ManagementUIState managementUIState, final TargetManagement targetManagement,
|
||||||
final TargetTable targetTable, final DeploymentManagement deploymentManagement,
|
final TargetTable targetTable, final DeploymentManagement deploymentManagement,
|
||||||
@@ -122,9 +121,9 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
@EventBusListenerMethod(scope = EventScope.UI)
|
||||||
void onEvent(final BulkUploadPopupEvent event) {
|
void onEvent(final BulkUploadPopupEvent event) {
|
||||||
if (BulkUploadPopupEvent.MINIMIZED == event) {
|
if (BulkUploadPopupEvent.MINIMIZED == event) {
|
||||||
UI.getCurrent().access(() -> enableBulkUploadStatusButton());
|
UI.getCurrent().access(this::enableBulkUploadStatusButton);
|
||||||
} else if (BulkUploadPopupEvent.CLOSED == event) {
|
} else if (BulkUploadPopupEvent.CLOSED == event) {
|
||||||
UI.getCurrent().access(() -> hideBulkUploadStatusButton());
|
UI.getCurrent().access(this::hideBulkUploadStatusButton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,9 +136,9 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
.getBulkUpload().getFailedUploadCount()
|
.getBulkUpload().getFailedUploadCount()
|
||||||
+ managementUIState.getTargetTableFilters().getBulkUpload().getSucessfulUploadCount()));
|
+ managementUIState.getTargetTableFilters().getBulkUpload().getSucessfulUploadCount()));
|
||||||
} else if (TargetComponentEvent.BULK_UPLOAD_COMPLETED == event.getTargetComponentEvent()) {
|
} else if (TargetComponentEvent.BULK_UPLOAD_COMPLETED == event.getTargetComponentEvent()) {
|
||||||
this.getUI().access(() -> updateUploadBtnIconToComplete());
|
this.getUI().access(this::updateUploadBtnIconToComplete);
|
||||||
} else if (TargetComponentEvent.BULK_TARGET_UPLOAD_STARTED == event.getTargetComponentEvent()) {
|
} else if (TargetComponentEvent.BULK_TARGET_UPLOAD_STARTED == event.getTargetComponentEvent()) {
|
||||||
this.getUI().access(() -> updateUploadBtnIconToProgressIndicator());
|
this.getUI().access(this::updateUploadBtnIconToProgressIndicator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -274,8 +273,7 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addInDeleteDistributionList(final Table sourceTable, final TableTransferable transferable) {
|
private void addInDeleteDistributionList(final Table sourceTable, final TableTransferable transferable) {
|
||||||
@SuppressWarnings("unchecked")
|
final AbstractTable<?> distTable = (AbstractTable<?>) sourceTable;
|
||||||
final AbstractTable<?, Long> distTable = (AbstractTable<?, Long>) sourceTable;
|
|
||||||
final Set<Long> ids = distTable.getDeletedEntityByTransferable(transferable);
|
final Set<Long> ids = distTable.getDeletedEntityByTransferable(transferable);
|
||||||
|
|
||||||
final Long dsInBulkUpload = managementUIState.getTargetTableFilters().getBulkUpload().getDsNameAndVersion();
|
final Long dsInBulkUpload = managementUIState.getTargetTableFilters().getBulkUpload().getDsNameAndVersion();
|
||||||
@@ -345,7 +343,6 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addInDeleteTargetList(final Table sourceTable, final TableTransferable transferable) {
|
private void addInDeleteTargetList(final Table sourceTable, final TableTransferable transferable) {
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
final TargetTable targetTable = (TargetTable) sourceTable;
|
final TargetTable targetTable = (TargetTable) sourceTable;
|
||||||
final Set<Long> targetIdSet = targetTable.getDeletedEntityByTransferable(transferable);
|
final Set<Long> targetIdSet = targetTable.getDeletedEntityByTransferable(transferable);
|
||||||
final Collection<Target> findTargetAllById = targetManagement.findTargetAllById(targetIdSet);
|
final Collection<Target> findTargetAllById = targetManagement.findTargetAllById(targetIdSet);
|
||||||
|
|||||||
@@ -37,10 +37,10 @@ import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
|||||||
import org.eclipse.hawkbit.ui.management.footer.ActionTypeOptionGroupLayout.ActionTypeOption;
|
import org.eclipse.hawkbit.ui.management.footer.ActionTypeOptionGroupLayout.ActionTypeOption;
|
||||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
@@ -51,13 +51,12 @@ import com.vaadin.ui.Button.ClickListener;
|
|||||||
import com.vaadin.ui.Table.Align;
|
import com.vaadin.ui.Table.Align;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Confirmation window for target/ds delete and assignment.
|
* Confirmation window for target/distributionSet delete and assignment
|
||||||
*
|
* operations on the Deployment View.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class ManangementConfirmationWindowLayout extends AbstractConfirmationWindowLayout {
|
public class ManangementConfirmationWindowLayout extends AbstractConfirmationWindowLayout {
|
||||||
|
|
||||||
private static final long serialVersionUID = 2114943830055679554L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private static final String DISCARD_CHANGES = "DiscardChanges";
|
private static final String DISCARD_CHANGES = "DiscardChanges";
|
||||||
|
|
||||||
@@ -79,7 +78,7 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
|||||||
|
|
||||||
private final ActionTypeOptionGroupLayout actionTypeOptionGroupLayout;
|
private final ActionTypeOptionGroupLayout actionTypeOptionGroupLayout;
|
||||||
|
|
||||||
private ConfirmationTab assignmnetTab;
|
private ConfirmationTab assignmentTab;
|
||||||
|
|
||||||
public ManangementConfirmationWindowLayout(final VaadinMessageSource i18n, final UIEventBus eventBus,
|
public ManangementConfirmationWindowLayout(final VaadinMessageSource i18n, final UIEventBus eventBus,
|
||||||
final ManagementUIState managementUIState, final TargetManagement targetManagement,
|
final ManagementUIState managementUIState, final TargetManagement targetManagement,
|
||||||
@@ -94,7 +93,7 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, ConfirmationTab> getConfimrationTabs() {
|
protected Map<String, ConfirmationTab> getConfirmationTabs() {
|
||||||
final Map<String, ConfirmationTab> tabs = Maps.newHashMapWithExpectedSize(3);
|
final Map<String, ConfirmationTab> tabs = Maps.newHashMapWithExpectedSize(3);
|
||||||
if (!managementUIState.getDeletedDistributionList().isEmpty()) {
|
if (!managementUIState.getDeletedDistributionList().isEmpty()) {
|
||||||
tabs.put(i18n.getMessage("caption.delete.dist.accordion.tab"), createDeletedDistributionTab());
|
tabs.put(i18n.getMessage("caption.delete.dist.accordion.tab"), createDeletedDistributionTab());
|
||||||
@@ -105,42 +104,41 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
|||||||
if (!managementUIState.getAssignedList().isEmpty()) {
|
if (!managementUIState.getAssignedList().isEmpty()) {
|
||||||
tabs.put(i18n.getMessage("caption.assign.dist.accordion.tab"), createAssignmentTab());
|
tabs.put(i18n.getMessage("caption.assign.dist.accordion.tab"), createAssignmentTab());
|
||||||
}
|
}
|
||||||
|
|
||||||
return tabs;
|
return tabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ConfirmationTab createAssignmentTab() {
|
private ConfirmationTab createAssignmentTab() {
|
||||||
|
|
||||||
assignmnetTab = new ConfirmationTab();
|
assignmentTab = new ConfirmationTab();
|
||||||
assignmnetTab.getConfirmAll().setId(UIComponentIdProvider.SAVE_ASSIGNMENT);
|
assignmentTab.getConfirmAll().setId(UIComponentIdProvider.SAVE_ASSIGNMENT);
|
||||||
assignmnetTab.getConfirmAll().setIcon(FontAwesome.SAVE);
|
assignmentTab.getConfirmAll().setIcon(FontAwesome.SAVE);
|
||||||
assignmnetTab.getConfirmAll().setCaption(i18n.getMessage("button.assign.all"));
|
assignmentTab.getConfirmAll().setCaption(i18n.getMessage("button.assign.all"));
|
||||||
assignmnetTab.getConfirmAll().addClickListener(event -> saveAllAssignments(assignmnetTab));
|
assignmentTab.getConfirmAll().addClickListener(event -> saveAllAssignments(assignmentTab));
|
||||||
|
|
||||||
assignmnetTab.getDiscardAll().setCaption(i18n.getMessage(SPUILabelDefinitions.BUTTON_DISCARD_ALL));
|
assignmentTab.getDiscardAll().setCaption(i18n.getMessage(SPUILabelDefinitions.BUTTON_DISCARD_ALL));
|
||||||
assignmnetTab.getDiscardAll().setId(UIComponentIdProvider.DISCARD_ASSIGNMENT);
|
assignmentTab.getDiscardAll().setId(UIComponentIdProvider.DISCARD_ASSIGNMENT);
|
||||||
assignmnetTab.getDiscardAll().addClickListener(event -> discardAllAssignments(assignmnetTab));
|
assignmentTab.getDiscardAll().addClickListener(event -> discardAllAssignments(assignmentTab));
|
||||||
|
|
||||||
// Add items container to the table.
|
// Add items container to the table.
|
||||||
assignmnetTab.getTable().setContainerDataSource(getAssignmentsTableContainer());
|
assignmentTab.getTable().setContainerDataSource(getAssignmentsTableContainer());
|
||||||
|
|
||||||
// Add the discard action column
|
// Add the discard action column
|
||||||
assignmnetTab.getTable().addGeneratedColumn(DISCARD_CHANGES, (source, itemId, columnId) -> {
|
assignmentTab.getTable().addGeneratedColumn(DISCARD_CHANGES, (source, itemId, columnId) -> {
|
||||||
final ClickListener clickListener = event -> discardAssignment((TargetIdName) itemId, assignmnetTab);
|
final ClickListener clickListener = event -> discardAssignment((TargetIdName) itemId, assignmentTab);
|
||||||
return createDiscardButton(itemId, clickListener);
|
return createDiscardButton(itemId, clickListener);
|
||||||
});
|
});
|
||||||
|
|
||||||
assignmnetTab.getTable().setColumnExpandRatio(TARGET_NAME, 2);
|
assignmentTab.getTable().setColumnExpandRatio(TARGET_NAME, 2);
|
||||||
assignmnetTab.getTable().setColumnExpandRatio(DISTRIBUTION_NAME, 2);
|
assignmentTab.getTable().setColumnExpandRatio(DISTRIBUTION_NAME, 2);
|
||||||
assignmnetTab.getTable().setColumnExpandRatio(DISCARD_CHANGES, 1);
|
assignmentTab.getTable().setColumnExpandRatio(DISCARD_CHANGES, 1);
|
||||||
assignmnetTab.getTable().setVisibleColumns(TARGET_NAME, DISTRIBUTION_NAME, DISCARD_CHANGES);
|
assignmentTab.getTable().setVisibleColumns(TARGET_NAME, DISTRIBUTION_NAME, DISCARD_CHANGES);
|
||||||
assignmnetTab.getTable().setColumnHeaders(i18n.getMessage("header.first.assignment.table"),
|
assignmentTab.getTable().setColumnHeaders(i18n.getMessage("header.first.assignment.table"),
|
||||||
i18n.getMessage("header.second.assignment.table"), i18n.getMessage("header.third.assignment.table"));
|
i18n.getMessage("header.second.assignment.table"), i18n.getMessage("header.third.assignment.table"));
|
||||||
assignmnetTab.getTable().setColumnAlignment(DISCARD_CHANGES, Align.CENTER);
|
assignmentTab.getTable().setColumnAlignment(DISCARD_CHANGES, Align.CENTER);
|
||||||
|
|
||||||
actionTypeOptionGroupLayout.selectDefaultOption();
|
actionTypeOptionGroupLayout.selectDefaultOption();
|
||||||
assignmnetTab.addComponent(actionTypeOptionGroupLayout, 1);
|
assignmentTab.addComponent(actionTypeOptionGroupLayout, 1);
|
||||||
return assignmnetTab;
|
return assignmentTab;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -372,7 +370,6 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void deleteAllDistributions(final ConfirmationTab tab) {
|
private void deleteAllDistributions(final ConfirmationTab tab) {
|
||||||
|
|
||||||
final Collection<Long> deletedIds = managementUIState.getDeletedDistributionList().stream()
|
final Collection<Long> deletedIds = managementUIState.getDeletedDistributionList().stream()
|
||||||
.map(DistributionSetIdName::getId).collect(Collectors.toList());
|
.map(DistributionSetIdName::getId).collect(Collectors.toList());
|
||||||
|
|
||||||
@@ -388,9 +385,7 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
|||||||
|
|
||||||
managementUIState.getTargetTableFilters().getPinnedDistId()
|
managementUIState.getTargetTableFilters().getPinnedDistId()
|
||||||
.ifPresent(distId -> unPinDeletedDS(deletedIds, distId));
|
.ifPresent(distId -> unPinDeletedDS(deletedIds, distId));
|
||||||
|
|
||||||
managementUIState.getDeletedDistributionList().clear();
|
managementUIState.getDeletedDistributionList().clear();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void unPinDeletedTarget(final TargetIdName pinnedTarget) {
|
private void unPinDeletedTarget(final TargetIdName pinnedTarget) {
|
||||||
@@ -426,7 +421,7 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
|||||||
private void removeFromAssignmentTab(final Entry<TargetIdName, DistributionSetIdName> entry,
|
private void removeFromAssignmentTab(final Entry<TargetIdName, DistributionSetIdName> entry,
|
||||||
final DistributionSetIdName value) {
|
final DistributionSetIdName value) {
|
||||||
if (Objects.equals(entry.getValue(), value)) {
|
if (Objects.equals(entry.getValue(), value)) {
|
||||||
assignmnetTab.getTable().removeItem(entry.getKey().getTargetId());
|
assignmentTab.getTable().removeItem(entry.getKey().getTargetId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,7 +449,6 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
|||||||
} else {
|
} else {
|
||||||
eventBus.publish(this, SaveActionWindowEvent.DISCARD_DELETE_TARGET);
|
eventBus.publish(this, SaveActionWindowEvent.DISCARD_DELETE_TARGET);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void discardAllTargets(final ConfirmationTab tab) {
|
private void discardAllTargets(final ConfirmationTab tab) {
|
||||||
@@ -482,14 +476,13 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
|||||||
managementUIState.getDistributionTableFilters().getPinnedTarget().ifPresent(this::unPinDeletedTarget);
|
managementUIState.getDistributionTableFilters().getPinnedTarget().ifPresent(this::unPinDeletedTarget);
|
||||||
eventBus.publish(this, SaveActionWindowEvent.SHOW_HIDE_TAB);
|
eventBus.publish(this, SaveActionWindowEvent.SHOW_HIDE_TAB);
|
||||||
managementUIState.getDeletedTargetList().clear();
|
managementUIState.getDeletedTargetList().clear();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeDeletedTargetsFromAssignmentTab() {
|
private void removeDeletedTargetsFromAssignmentTab() {
|
||||||
for (final TargetIdName targetNameId : managementUIState.getDeletedTargetList()) {
|
for (final TargetIdName targetNameId : managementUIState.getDeletedTargetList()) {
|
||||||
if (managementUIState.getAssignedList().containsKey(targetNameId)) {
|
if (managementUIState.getAssignedList().containsKey(targetNameId)) {
|
||||||
managementUIState.getAssignedList().remove(targetNameId);
|
managementUIState.getAssignedList().remove(targetNameId);
|
||||||
assignmnetTab.getTable().removeItem(targetNameId.getTargetId());
|
assignmentTab.getTable().removeItem(targetNameId.getTargetId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import java.util.Optional;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.ui.common.ManagmentEntityState;
|
import org.eclipse.hawkbit.ui.common.ManagementEntityState;
|
||||||
import org.eclipse.hawkbit.ui.common.entity.DistributionSetIdName;
|
import org.eclipse.hawkbit.ui.common.entity.DistributionSetIdName;
|
||||||
import org.eclipse.hawkbit.ui.common.entity.TargetIdName;
|
import org.eclipse.hawkbit.ui.common.entity.TargetIdName;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -27,14 +27,12 @@ import com.vaadin.spring.annotation.VaadinSessionScope;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* User action on management UI.
|
* User action on management UI.
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@VaadinSessionScope
|
@VaadinSessionScope
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
public class ManagementUIState implements ManagmentEntityState<Long>, Serializable {
|
public class ManagementUIState implements ManagementEntityState, Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 7301409196969723794L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final transient Set<Object> expandParentActionRowId = new HashSet<>();
|
private final transient Set<Object> expandParentActionRowId = new HashSet<>();
|
||||||
|
|
||||||
@@ -52,7 +50,8 @@ public class ManagementUIState implements ManagmentEntityState<Long>, Serializab
|
|||||||
|
|
||||||
private Boolean distTagLayoutVisible = Boolean.FALSE;
|
private Boolean distTagLayoutVisible = Boolean.FALSE;
|
||||||
|
|
||||||
private Long lastSelectedTargetId;
|
private transient Optional<Long> lastSelectedTargetId = Optional.empty();
|
||||||
|
|
||||||
private Set<Long> selectedTargetId = Collections.emptySet();
|
private Set<Long> selectedTargetId = Collections.emptySet();
|
||||||
|
|
||||||
private boolean targetTagFilterClosed;
|
private boolean targetTagFilterClosed;
|
||||||
@@ -90,32 +89,18 @@ public class ManagementUIState implements ManagmentEntityState<Long>, Serializab
|
|||||||
this.targetTableFilters = targetTableFilters;
|
this.targetTableFilters = targetTableFilters;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the bulkUploadWindowMinimised
|
|
||||||
*/
|
|
||||||
public boolean isBulkUploadWindowMinimised() {
|
public boolean isBulkUploadWindowMinimised() {
|
||||||
return bulkUploadWindowMinimised;
|
return bulkUploadWindowMinimised;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param bulkUploadWindowMinimised
|
|
||||||
* the bulkUploadWindowMinimised to set
|
|
||||||
*/
|
|
||||||
public void setBulkUploadWindowMinimised(final boolean bulkUploadWindowMinimised) {
|
public void setBulkUploadWindowMinimised(final boolean bulkUploadWindowMinimised) {
|
||||||
this.bulkUploadWindowMinimised = bulkUploadWindowMinimised;
|
this.bulkUploadWindowMinimised = bulkUploadWindowMinimised;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the isCustomFilterSelected
|
|
||||||
*/
|
|
||||||
public boolean isCustomFilterSelected() {
|
public boolean isCustomFilterSelected() {
|
||||||
return customFilterSelected;
|
return customFilterSelected;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param isCustomFilterSelected
|
|
||||||
* the isCustomFilterSelected to set
|
|
||||||
*/
|
|
||||||
public void setCustomFilterSelected(final boolean isCustomFilterSelected) {
|
public void setCustomFilterSelected(final boolean isCustomFilterSelected) {
|
||||||
customFilterSelected = isCustomFilterSelected;
|
customFilterSelected = isCustomFilterSelected;
|
||||||
}
|
}
|
||||||
@@ -164,78 +149,50 @@ public class ManagementUIState implements ManagmentEntityState<Long>, Serializab
|
|||||||
return deletedTargetList;
|
return deletedTargetList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getLastSelectedTargetId() {
|
public Optional<Long> getLastSelectedTargetId() {
|
||||||
return lastSelectedTargetId;
|
return lastSelectedTargetId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLastSelectedTargetId(final Long lastSelectedTargetId) {
|
public void setLastSelectedTargetId(final Long lastSelectedTargetId) {
|
||||||
this.lastSelectedTargetId = lastSelectedTargetId;
|
this.lastSelectedTargetId = Optional.ofNullable(lastSelectedTargetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<Set<Long>> getSelectedTargetId() {
|
public Set<Long> getSelectedTargetId() {
|
||||||
return Optional.ofNullable(selectedTargetId);
|
return selectedTargetId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSelectedTargetId(final Set<Long> selectedTargetId) {
|
public void setSelectedTargetId(final Set<Long> selectedTargetId) {
|
||||||
this.selectedTargetId = selectedTargetId;
|
this.selectedTargetId = selectedTargetId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the targetTagFilterClosed
|
|
||||||
*/
|
|
||||||
public boolean isTargetTagFilterClosed() {
|
public boolean isTargetTagFilterClosed() {
|
||||||
return targetTagFilterClosed;
|
return targetTagFilterClosed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param targetTagFilterClosed
|
|
||||||
* the targetTagFilterClosed to set
|
|
||||||
*/
|
|
||||||
public void setTargetTagFilterClosed(final boolean targetTagFilterClosed) {
|
public void setTargetTagFilterClosed(final boolean targetTagFilterClosed) {
|
||||||
this.targetTagFilterClosed = targetTagFilterClosed;
|
this.targetTagFilterClosed = targetTagFilterClosed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the distTagFilterClosed
|
|
||||||
*/
|
|
||||||
public boolean isDistTagFilterClosed() {
|
public boolean isDistTagFilterClosed() {
|
||||||
return distTagFilterClosed;
|
return distTagFilterClosed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param distTagFilterClosed
|
|
||||||
* the distTagFilterClosed to set
|
|
||||||
*/
|
|
||||||
public void setDistTagFilterClosed(final boolean distTagFilterClosed) {
|
public void setDistTagFilterClosed(final boolean distTagFilterClosed) {
|
||||||
this.distTagFilterClosed = distTagFilterClosed;
|
this.distTagFilterClosed = distTagFilterClosed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the targetsTruncated
|
|
||||||
*/
|
|
||||||
public Long getTargetsTruncated() {
|
public Long getTargetsTruncated() {
|
||||||
return targetsTruncated;
|
return targetsTruncated;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param targetsTruncated
|
|
||||||
* the targetsTruncated to set
|
|
||||||
*/
|
|
||||||
public void setTargetsTruncated(final Long targetsTruncated) {
|
public void setTargetsTruncated(final Long targetsTruncated) {
|
||||||
this.targetsTruncated = targetsTruncated;
|
this.targetsTruncated = targetsTruncated;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the targetsCountAll
|
|
||||||
*/
|
|
||||||
public long getTargetsCountAll() {
|
public long getTargetsCountAll() {
|
||||||
return targetsCountAll.get();
|
return targetsCountAll.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param targetsCountAll
|
|
||||||
* the targetsCountAll to set
|
|
||||||
*/
|
|
||||||
public void setTargetsCountAll(final long targetsCountAll) {
|
public void setTargetsCountAll(final long targetsCountAll) {
|
||||||
this.targetsCountAll.set(targetsCountAll);
|
this.targetsCountAll.set(targetsCountAll);
|
||||||
}
|
}
|
||||||
@@ -253,76 +210,47 @@ public class ManagementUIState implements ManagmentEntityState<Long>, Serializab
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLastSelectedEntity(final Long value) {
|
public void setLastSelectedEntityId(final Long value) {
|
||||||
this.lastSelectedDsIdName = value;
|
this.lastSelectedDsIdName = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSelectedEnitities(final Set<Long> values) {
|
public void setSelectedEnitities(final Set<Long> values) {
|
||||||
this.selectedDsIdName = values;
|
this.selectedDsIdName = values;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<Set<Long>> getSelectedDsIdName() {
|
public Set<Long> getSelectedDsIdName() {
|
||||||
return Optional.ofNullable(selectedDsIdName);
|
return selectedDsIdName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the isTargetTableMaximized
|
|
||||||
*/
|
|
||||||
public boolean isTargetTableMaximized() {
|
public boolean isTargetTableMaximized() {
|
||||||
return targetTableMaximized;
|
return targetTableMaximized;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param isTargetTableMaximized
|
|
||||||
* the isTargetTableMaximized to set
|
|
||||||
*/
|
|
||||||
public void setTargetTableMaximized(final boolean isTargetTableMaximized) {
|
public void setTargetTableMaximized(final boolean isTargetTableMaximized) {
|
||||||
this.targetTableMaximized = isTargetTableMaximized;
|
this.targetTableMaximized = isTargetTableMaximized;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the isActionHistoryMaximized
|
|
||||||
*/
|
|
||||||
public boolean isActionHistoryMaximized() {
|
public boolean isActionHistoryMaximized() {
|
||||||
return actionHistoryMaximized;
|
return actionHistoryMaximized;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param isActionHistoryMaximized
|
|
||||||
* the isActionHistoryMaximized to set
|
|
||||||
*/
|
|
||||||
public void setActionHistoryMaximized(final boolean isActionHistoryMaximized) {
|
public void setActionHistoryMaximized(final boolean isActionHistoryMaximized) {
|
||||||
this.actionHistoryMaximized = isActionHistoryMaximized;
|
this.actionHistoryMaximized = isActionHistoryMaximized;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the noDataAvilableTarget
|
|
||||||
*/
|
|
||||||
public boolean isNoDataAvilableTarget() {
|
public boolean isNoDataAvilableTarget() {
|
||||||
return noDataAvilableTarget;
|
return noDataAvilableTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param noDataAvilableTarget
|
|
||||||
* the noDataAvilableTarget to set
|
|
||||||
*/
|
|
||||||
public void setNoDataAvilableTarget(final boolean noDataAvilableTarget) {
|
public void setNoDataAvilableTarget(final boolean noDataAvilableTarget) {
|
||||||
this.noDataAvilableTarget = noDataAvilableTarget;
|
this.noDataAvilableTarget = noDataAvilableTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the noDataAvailableDistribution
|
|
||||||
*/
|
|
||||||
public boolean isNoDataAvailableDistribution() {
|
public boolean isNoDataAvailableDistribution() {
|
||||||
return noDataAvailableDistribution;
|
return noDataAvailableDistribution;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param noDataAvailableDistribution
|
|
||||||
* the noDataAvailableDistribution to set
|
|
||||||
*/
|
|
||||||
public void setNoDataAvailableDistribution(final boolean noDataAvailableDistribution) {
|
public void setNoDataAvailableDistribution(final boolean noDataAvailableDistribution) {
|
||||||
this.noDataAvailableDistribution = noDataAvailableDistribution;
|
this.noDataAvailableDistribution = noDataAvailableDistribution;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,11 +14,10 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Hold details for target bulk upload window.
|
* Hold details for target bulk upload window.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class TargetBulkUpload implements Serializable {
|
public class TargetBulkUpload implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -7697723122460382323L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private Long dsNameAndVersion;
|
private Long dsNameAndVersion;
|
||||||
|
|
||||||
@@ -34,91 +33,50 @@ public class TargetBulkUpload implements Serializable {
|
|||||||
|
|
||||||
private final List<String> targetsCreated = new ArrayList<>();
|
private final List<String> targetsCreated = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the targetsCreated
|
|
||||||
*/
|
|
||||||
public List<String> getTargetsCreated() {
|
public List<String> getTargetsCreated() {
|
||||||
return targetsCreated;
|
return targetsCreated;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the assignedTagIds
|
|
||||||
*/
|
|
||||||
public List<String> getAssignedTagNames() {
|
public List<String> getAssignedTagNames() {
|
||||||
return assignedTagNames;
|
return assignedTagNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the dsNameAndVersion
|
|
||||||
*/
|
|
||||||
public Long getDsNameAndVersion() {
|
public Long getDsNameAndVersion() {
|
||||||
return dsNameAndVersion;
|
return dsNameAndVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the progressBarCurrentValue
|
|
||||||
*/
|
|
||||||
public float getProgressBarCurrentValue() {
|
public float getProgressBarCurrentValue() {
|
||||||
return progressBarCurrentValue;
|
return progressBarCurrentValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param progressBarCurrentValue
|
|
||||||
* the progressBarCurrentValue to set
|
|
||||||
*/
|
|
||||||
public void setProgressBarCurrentValue(final float progressBarCurrentValue) {
|
public void setProgressBarCurrentValue(final float progressBarCurrentValue) {
|
||||||
this.progressBarCurrentValue = progressBarCurrentValue;
|
this.progressBarCurrentValue = progressBarCurrentValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param dsNameAndVersion
|
|
||||||
* the dsNameAndVersion to set
|
|
||||||
*/
|
|
||||||
public void setDsNameAndVersion(final Long dsNameAndVersion) {
|
public void setDsNameAndVersion(final Long dsNameAndVersion) {
|
||||||
this.dsNameAndVersion = dsNameAndVersion;
|
this.dsNameAndVersion = dsNameAndVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the description
|
|
||||||
*/
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param description
|
|
||||||
* the description to set
|
|
||||||
*/
|
|
||||||
public void setDescription(final String description) {
|
public void setDescription(final String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the sucessfulUploadCount
|
|
||||||
*/
|
|
||||||
public int getSucessfulUploadCount() {
|
public int getSucessfulUploadCount() {
|
||||||
return sucessfulUploadCount;
|
return sucessfulUploadCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param sucessfulUploadCount
|
|
||||||
* the sucessfulUploadCount to set
|
|
||||||
*/
|
|
||||||
public void setSucessfulUploadCount(final int sucessfulUploadCount) {
|
public void setSucessfulUploadCount(final int sucessfulUploadCount) {
|
||||||
this.sucessfulUploadCount = sucessfulUploadCount;
|
this.sucessfulUploadCount = sucessfulUploadCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the failedUploadCount
|
|
||||||
*/
|
|
||||||
public int getFailedUploadCount() {
|
public int getFailedUploadCount() {
|
||||||
return failedUploadCount;
|
return failedUploadCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param failedUploadCount
|
|
||||||
* the failedUploadCount to set
|
|
||||||
*/
|
|
||||||
public void setFailedUploadCount(final int failedUploadCount) {
|
public void setFailedUploadCount(final int failedUploadCount) {
|
||||||
this.failedUploadCount = failedUploadCount;
|
this.failedUploadCount = failedUploadCount;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ package org.eclipse.hawkbit.ui.management.targettable;
|
|||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
@@ -22,14 +21,15 @@ import org.eclipse.hawkbit.ui.common.builder.WindowBuilder;
|
|||||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.spring.events.EventBus;
|
import org.vaadin.spring.events.EventBus;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
|
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
import com.vaadin.data.validator.RegexpValidator;
|
import com.vaadin.data.validator.RegexpValidator;
|
||||||
import com.vaadin.ui.CustomComponent;
|
import com.vaadin.ui.CustomComponent;
|
||||||
import com.vaadin.ui.FormLayout;
|
import com.vaadin.ui.FormLayout;
|
||||||
@@ -62,13 +62,17 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
|
|||||||
private FormLayout formLayout;
|
private FormLayout formLayout;
|
||||||
private CommonDialogWindow window;
|
private CommonDialogWindow window;
|
||||||
|
|
||||||
TargetAddUpdateWindowLayout(final VaadinMessageSource i18n, final TargetManagement targetManagement, final UIEventBus eventBus,
|
private final TargetTable targetTable;
|
||||||
final UINotification uINotification, final EntityFactory entityFactory) {
|
|
||||||
|
TargetAddUpdateWindowLayout(final VaadinMessageSource i18n, final TargetManagement targetManagement,
|
||||||
|
final UIEventBus eventBus, final UINotification uINotification, final EntityFactory entityFactory,
|
||||||
|
final TargetTable targetTable) {
|
||||||
this.i18n = i18n;
|
this.i18n = i18n;
|
||||||
this.targetManagement = targetManagement;
|
this.targetManagement = targetManagement;
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.uINotification = uINotification;
|
this.uINotification = uINotification;
|
||||||
this.entityFactory = entityFactory;
|
this.entityFactory = entityFactory;
|
||||||
|
this.targetTable = targetTable;
|
||||||
createRequiredComponents();
|
createRequiredComponents();
|
||||||
buildLayout();
|
buildLayout();
|
||||||
setCompositionRoot(formLayout);
|
setCompositionRoot(formLayout);
|
||||||
@@ -96,14 +100,15 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
|
|||||||
|
|
||||||
private void createRequiredComponents() {
|
private void createRequiredComponents() {
|
||||||
controllerIDTextField = createTextField("prompt.target.id", UIComponentIdProvider.TARGET_ADD_CONTROLLER_ID);
|
controllerIDTextField = createTextField("prompt.target.id", UIComponentIdProvider.TARGET_ADD_CONTROLLER_ID);
|
||||||
controllerIDTextField.addValidator(new RegexpValidator("[.\\S]*", i18n.getMessage("message.target.whitespace.check")));
|
controllerIDTextField
|
||||||
|
.addValidator(new RegexpValidator("[.\\S]*", i18n.getMessage("message.target.whitespace.check")));
|
||||||
nameTextField = createTextField("textfield.name", UIComponentIdProvider.TARGET_ADD_NAME);
|
nameTextField = createTextField("textfield.name", UIComponentIdProvider.TARGET_ADD_NAME);
|
||||||
nameTextField.setRequired(false);
|
nameTextField.setRequired(false);
|
||||||
|
|
||||||
descTextArea = new TextAreaBuilder().caption(i18n.getMessage("textfield.description")).style("text-area-style")
|
descTextArea = new TextAreaBuilder().caption(i18n.getMessage("textfield.description")).style("text-area-style")
|
||||||
.prompt(i18n.getMessage("textfield.description")).immediate(true).id(UIComponentIdProvider.TARGET_ADD_DESC)
|
.prompt(i18n.getMessage("textfield.description")).immediate(true)
|
||||||
.buildTextComponent();
|
.id(UIComponentIdProvider.TARGET_ADD_DESC).buildTextComponent();
|
||||||
descTextArea.setNullRepresentation(StringUtils.EMPTY);
|
descTextArea.setNullRepresentation("");
|
||||||
}
|
}
|
||||||
|
|
||||||
private TextField createTextField(final String in18Key, final String id) {
|
private TextField createTextField(final String in18Key, final String id) {
|
||||||
@@ -143,14 +148,14 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
|
|||||||
entityFactory.target().create().controllerId(newControllerId).name(newName).description(newDesc));
|
entityFactory.target().create().controllerId(newControllerId).name(newName).description(newDesc));
|
||||||
|
|
||||||
eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.ADD_ENTITY, newTarget));
|
eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.ADD_ENTITY, newTarget));
|
||||||
|
|
||||||
uINotification.displaySuccess(i18n.getMessage("message.save.success", new Object[] { newTarget.getName() }));
|
uINotification.displaySuccess(i18n.getMessage("message.save.success", new Object[] { newTarget.getName() }));
|
||||||
|
targetTable.setValue(Sets.newHashSet(newTarget.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Window createNewWindow() {
|
public Window createNewWindow() {
|
||||||
window = new WindowBuilder(SPUIDefinitions.CREATE_UPDATE_WINDOW)
|
window = new WindowBuilder(SPUIDefinitions.CREATE_UPDATE_WINDOW)
|
||||||
.caption(i18n.getMessage(UIComponentIdProvider.TARGET_ADD_CAPTION)).content(this).layout(formLayout).i18n(i18n)
|
.caption(i18n.getMessage(UIComponentIdProvider.TARGET_ADD_CAPTION)).content(this).layout(formLayout)
|
||||||
.saveDialogCloseListener(new SaveOnDialogCloseListener()).buildCommonDialogWindow();
|
.i18n(i18n).saveDialogCloseListener(new SaveOnDialogCloseListener()).buildCommonDialogWindow();
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ package org.eclipse.hawkbit.ui.management.targettable;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
@@ -27,12 +26,12 @@ import org.eclipse.hawkbit.ui.management.dstable.DistributionBeanQuery;
|
|||||||
import org.eclipse.hawkbit.ui.management.event.BulkUploadPopupEvent;
|
import org.eclipse.hawkbit.ui.management.event.BulkUploadPopupEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||||
import org.eclipse.hawkbit.ui.management.state.TargetBulkUpload;
|
import org.eclipse.hawkbit.ui.management.state.TargetBulkUpload;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
||||||
@@ -96,11 +95,12 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
|
|||||||
private Button minimizeButton;
|
private Button minimizeButton;
|
||||||
private Button closeButton;
|
private Button closeButton;
|
||||||
|
|
||||||
TargetBulkUpdateWindowLayout(final VaadinMessageSource i18n, final TargetManagement targetManagement, final UIEventBus eventBus,
|
TargetBulkUpdateWindowLayout(final VaadinMessageSource i18n, final TargetManagement targetManagement,
|
||||||
final ManagementUIState managementUIState, final DeploymentManagement deploymentManagement,
|
final UIEventBus eventBus, final ManagementUIState managementUIState,
|
||||||
final UiProperties uiproperties, final SpPermissionChecker checker, final UINotification uinotification,
|
final DeploymentManagement deploymentManagement, final UiProperties uiproperties,
|
||||||
final TagManagement tagManagement, final DistributionSetManagement distributionSetManagement,
|
final SpPermissionChecker checker, final UINotification uinotification, final TagManagement tagManagement,
|
||||||
final EntityFactory entityFactory, final Executor uiExecutor) {
|
final DistributionSetManagement distributionSetManagement, final EntityFactory entityFactory,
|
||||||
|
final Executor uiExecutor) {
|
||||||
this.i18n = i18n;
|
this.i18n = i18n;
|
||||||
this.targetManagement = targetManagement;
|
this.targetManagement = targetManagement;
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
@@ -197,15 +197,15 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
|
|||||||
final TextArea description = new TextAreaBuilder().caption(i18n.getMessage("textfield.description"))
|
final TextArea description = new TextAreaBuilder().caption(i18n.getMessage("textfield.description"))
|
||||||
.style("text-area-style").prompt(i18n.getMessage("textfield.description")).immediate(true)
|
.style("text-area-style").prompt(i18n.getMessage("textfield.description")).immediate(true)
|
||||||
.id(UIComponentIdProvider.BULK_UPLOAD_DESC).buildTextComponent();
|
.id(UIComponentIdProvider.BULK_UPLOAD_DESC).buildTextComponent();
|
||||||
description.setNullRepresentation(StringUtils.EMPTY);
|
description.setNullRepresentation("");
|
||||||
description.setWidth("100%");
|
description.setWidth("100%");
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ComboBox getDsComboField() {
|
private ComboBox getDsComboField() {
|
||||||
final Container container = createContainer();
|
final Container container = createContainer();
|
||||||
final ComboBox dsComboBox = SPUIComponentProvider.getComboBox(i18n.getMessage("bulkupload.ds.name"), "", null, null,
|
final ComboBox dsComboBox = SPUIComponentProvider.getComboBox(i18n.getMessage("bulkupload.ds.name"), "", null,
|
||||||
false, "", i18n.getMessage("bulkupload.ds.name"));
|
null, false, "", i18n.getMessage("bulkupload.ds.name"));
|
||||||
dsComboBox.setSizeUndefined();
|
dsComboBox.setSizeUndefined();
|
||||||
dsComboBox.addStyleName(SPUIDefinitions.BULK_UPLOD_DS_COMBO_STYLE);
|
dsComboBox.addStyleName(SPUIDefinitions.BULK_UPLOD_DS_COMBO_STYLE);
|
||||||
dsComboBox.setImmediate(true);
|
dsComboBox.setImmediate(true);
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ package org.eclipse.hawkbit.ui.management.targettable;
|
|||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.TagManagement;
|
import org.eclipse.hawkbit.repository.TagManagement;
|
||||||
@@ -39,7 +38,6 @@ import com.vaadin.ui.Button.ClickEvent;
|
|||||||
import com.vaadin.ui.Component;
|
import com.vaadin.ui.Component;
|
||||||
import com.vaadin.ui.HorizontalLayout;
|
import com.vaadin.ui.HorizontalLayout;
|
||||||
import com.vaadin.ui.Label;
|
import com.vaadin.ui.Label;
|
||||||
import com.vaadin.ui.TabSheet;
|
|
||||||
import com.vaadin.ui.TextField;
|
import com.vaadin.ui.TextField;
|
||||||
import com.vaadin.ui.UI;
|
import com.vaadin.ui.UI;
|
||||||
import com.vaadin.ui.VerticalLayout;
|
import com.vaadin.ui.VerticalLayout;
|
||||||
@@ -47,11 +45,11 @@ import com.vaadin.ui.Window;
|
|||||||
import com.vaadin.ui.themes.ValoTheme;
|
import com.vaadin.ui.themes.ValoTheme;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Target details layout.
|
* Target details layout which is shown on the Deployment View.
|
||||||
*/
|
*/
|
||||||
public class TargetDetails extends AbstractTableDetailsLayout<Target> {
|
public class TargetDetails extends AbstractTableDetailsLayout<Target> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 4571732743399605843L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final TargetTagToken targetTagToken;
|
private final TargetTagToken targetTagToken;
|
||||||
|
|
||||||
@@ -62,18 +60,19 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
|
|||||||
private final transient DeploymentManagement deploymentManagement;
|
private final transient DeploymentManagement deploymentManagement;
|
||||||
|
|
||||||
private VerticalLayout assignedDistLayout;
|
private VerticalLayout assignedDistLayout;
|
||||||
|
|
||||||
private VerticalLayout installedDistLayout;
|
private VerticalLayout installedDistLayout;
|
||||||
|
|
||||||
TargetDetails(final VaadinMessageSource i18n, final UIEventBus eventBus,
|
TargetDetails(final VaadinMessageSource i18n, final UIEventBus eventBus,
|
||||||
final SpPermissionChecker permissionChecker, final ManagementUIState managementUIState,
|
final SpPermissionChecker permissionChecker, final ManagementUIState managementUIState,
|
||||||
final UINotification uiNotification, final TagManagement tagManagement,
|
final UINotification uiNotification, final TagManagement tagManagement,
|
||||||
final TargetManagement targetManagement, final DeploymentManagement deploymentManagement,
|
final TargetManagement targetManagement, final DeploymentManagement deploymentManagement,
|
||||||
final EntityFactory entityFactory) {
|
final EntityFactory entityFactory, final TargetTable targetTable) {
|
||||||
super(i18n, eventBus, permissionChecker, managementUIState);
|
super(i18n, eventBus, permissionChecker, managementUIState);
|
||||||
this.targetTagToken = new TargetTagToken(permissionChecker, i18n, uiNotification, eventBus, managementUIState,
|
this.targetTagToken = new TargetTagToken(permissionChecker, i18n, uiNotification, eventBus, managementUIState,
|
||||||
tagManagement, targetManagement);
|
tagManagement, targetManagement);
|
||||||
targetAddUpdateWindowLayout = new TargetAddUpdateWindowLayout(i18n, targetManagement, eventBus, uiNotification,
|
targetAddUpdateWindowLayout = new TargetAddUpdateWindowLayout(i18n, targetManagement, eventBus, uiNotification,
|
||||||
entityFactory);
|
entityFactory, targetTable);
|
||||||
this.targetManagement = targetManagement;
|
this.targetManagement = targetManagement;
|
||||||
this.deploymentManagement = deploymentManagement;
|
this.deploymentManagement = deploymentManagement;
|
||||||
addDetailsTab();
|
addDetailsTab();
|
||||||
@@ -128,11 +127,6 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
|
|||||||
return UIComponentIdProvider.TARGET_EDIT_ICON;
|
return UIComponentIdProvider.TARGET_EDIT_ICON;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean onLoadIsTableRowSelected() {
|
|
||||||
return getManagementUIState().getLastSelectedTargetId() != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onLoadIsTableMaximized() {
|
protected boolean onLoadIsTableMaximized() {
|
||||||
return getManagementUIState().isTargetTableMaximized();
|
return getManagementUIState().isTargetTableMaximized();
|
||||||
@@ -182,16 +176,14 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
|
|||||||
detailsTabLayout.addComponent(lastPollDtLabel);
|
detailsTabLayout.addComponent(lastPollDtLabel);
|
||||||
|
|
||||||
final Label typeLabel = SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.ip"),
|
final Label typeLabel = SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.ip"),
|
||||||
address == null ? StringUtils.EMPTY : address.toString());
|
address == null ? "" : address.toString());
|
||||||
typeLabel.setId(UIComponentIdProvider.TARGET_IP_ADDRESS);
|
typeLabel.setId(UIComponentIdProvider.TARGET_IP_ADDRESS);
|
||||||
detailsTabLayout.addComponent(typeLabel);
|
detailsTabLayout.addComponent(typeLabel);
|
||||||
|
|
||||||
if (securityToken != null) {
|
|
||||||
final HorizontalLayout securityTokenLayout = getSecurityTokenLayout(securityToken);
|
final HorizontalLayout securityTokenLayout = getSecurityTokenLayout(securityToken);
|
||||||
controllerLabel.setId(UIComponentIdProvider.TARGET_SECURITY_TOKEN);
|
controllerLabel.setId(UIComponentIdProvider.TARGET_SECURITY_TOKEN);
|
||||||
detailsTabLayout.addComponent(securityTokenLayout);
|
detailsTabLayout.addComponent(securityTokenLayout);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private HorizontalLayout getSecurityTokenLayout(final String securityToken) {
|
private HorizontalLayout getSecurityTokenLayout(final String securityToken) {
|
||||||
final HorizontalLayout securityTokenLayout = new HorizontalLayout();
|
final HorizontalLayout securityTokenLayout = new HorizontalLayout();
|
||||||
@@ -208,6 +200,7 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
|
|||||||
securityTokentxt.addStyleName("targetDtls-securityToken");
|
securityTokentxt.addStyleName("targetDtls-securityToken");
|
||||||
securityTokentxt.addStyleName(SPUIDefinitions.TEXT_STYLE);
|
securityTokentxt.addStyleName(SPUIDefinitions.TEXT_STYLE);
|
||||||
securityTokentxt.setCaption(null);
|
securityTokentxt.setCaption(null);
|
||||||
|
securityTokentxt.setNullRepresentation("");
|
||||||
securityTokentxt.setValue(securityToken);
|
securityTokentxt.setValue(securityToken);
|
||||||
securityTokentxt.setReadOnly(true);
|
securityTokentxt.setReadOnly(true);
|
||||||
|
|
||||||
@@ -218,15 +211,16 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
|
|||||||
|
|
||||||
private void populateDistributionDtls(final VerticalLayout layout, final DistributionSet distributionSet) {
|
private void populateDistributionDtls(final VerticalLayout layout, final DistributionSet distributionSet) {
|
||||||
layout.removeAllComponents();
|
layout.removeAllComponents();
|
||||||
|
layout.addComponent(SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.dist.details.name"),
|
||||||
|
distributionSet == null ? "" : distributionSet.getName()));
|
||||||
|
|
||||||
|
layout.addComponent(
|
||||||
|
SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.dist.details.version"),
|
||||||
|
distributionSet == null ? "" : distributionSet.getVersion()));
|
||||||
|
|
||||||
if (distributionSet == null) {
|
if (distributionSet == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
layout.addComponent(SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.dist.details.name"),
|
|
||||||
distributionSet.getName()));
|
|
||||||
|
|
||||||
layout.addComponent(SPUIComponentProvider.createNameValueLabel(
|
|
||||||
getI18n().getMessage("label.dist.details.version"), distributionSet.getVersion()));
|
|
||||||
|
|
||||||
distributionSet.getModules()
|
distributionSet.getModules()
|
||||||
.forEach(module -> layout.addComponent(getSWModlabel(module.getType().getName(), module)));
|
.forEach(module -> layout.addComponent(getSWModlabel(module.getType().getName(), module)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import org.eclipse.hawkbit.repository.model.TargetTag;
|
|||||||
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
|
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||||
import org.eclipse.hawkbit.ui.common.ManagmentEntityState;
|
import org.eclipse.hawkbit.ui.common.ManagementEntityState;
|
||||||
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||||
import org.eclipse.hawkbit.ui.common.entity.DistributionSetIdName;
|
import org.eclipse.hawkbit.ui.common.entity.DistributionSetIdName;
|
||||||
import org.eclipse.hawkbit.ui.common.entity.TargetIdName;
|
import org.eclipse.hawkbit.ui.common.entity.TargetIdName;
|
||||||
@@ -51,7 +51,6 @@ import org.eclipse.hawkbit.ui.push.CancelTargetAssignmentEventContainer;
|
|||||||
import org.eclipse.hawkbit.ui.push.TargetUpdatedEventContainer;
|
import org.eclipse.hawkbit.ui.push.TargetUpdatedEventContainer;
|
||||||
import org.eclipse.hawkbit.ui.utils.AssignInstalledDSTooltipGenerator;
|
import org.eclipse.hawkbit.ui.utils.AssignInstalledDSTooltipGenerator;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
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.SPDateTimeUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
@@ -59,6 +58,7 @@ import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
|||||||
import org.eclipse.hawkbit.ui.utils.TableColumn;
|
import org.eclipse.hawkbit.ui.utils.TableColumn;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
@@ -87,17 +87,23 @@ import com.vaadin.ui.UI;
|
|||||||
import com.vaadin.ui.themes.ValoTheme;
|
import com.vaadin.ui.themes.ValoTheme;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Concrete implementation of Target table.
|
* Concrete implementation of Target table which is displayed on the Deployment
|
||||||
|
* View.
|
||||||
*/
|
*/
|
||||||
public class TargetTable extends AbstractTable<Target, Long> {
|
public class TargetTable extends AbstractTable<Target> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(TargetTable.class);
|
private static final Logger LOG = LoggerFactory.getLogger(TargetTable.class);
|
||||||
|
|
||||||
private static final String TARGET_PINNED = "targetPinned";
|
private static final String TARGET_PINNED = "targetPinned";
|
||||||
private static final long serialVersionUID = -2300392868806614568L;
|
|
||||||
private static final int PROPERTY_DEPT = 3;
|
private static final int PROPERTY_DEPT = 3;
|
||||||
|
|
||||||
private final transient TargetManagement targetManagement;
|
private final transient TargetManagement targetManagement;
|
||||||
|
|
||||||
private final transient DistributionSetManagement distributionSetManagement;
|
private final transient DistributionSetManagement distributionSetManagement;
|
||||||
|
|
||||||
private final transient TagManagement tagManagement;
|
private final transient TagManagement tagManagement;
|
||||||
|
|
||||||
private final SpPermissionChecker permChecker;
|
private final SpPermissionChecker permChecker;
|
||||||
@@ -107,7 +113,8 @@ public class TargetTable extends AbstractTable<Target, Long> {
|
|||||||
private final ManagementUIState managementUIState;
|
private final ManagementUIState managementUIState;
|
||||||
|
|
||||||
private Button targetPinnedBtn;
|
private Button targetPinnedBtn;
|
||||||
private boolean isTargetPinned;
|
|
||||||
|
private boolean targetPinned;
|
||||||
|
|
||||||
public TargetTable(final UIEventBus eventBus, final VaadinMessageSource i18n, final UINotification notification,
|
public TargetTable(final UIEventBus eventBus, final VaadinMessageSource i18n, final UINotification notification,
|
||||||
final TargetManagement targetManagement, final ManagementUIState managementUIState,
|
final TargetManagement targetManagement, final ManagementUIState managementUIState,
|
||||||
@@ -122,7 +129,6 @@ public class TargetTable extends AbstractTable<Target, Long> {
|
|||||||
this.tagManagement = tagManagement;
|
this.tagManagement = tagManagement;
|
||||||
|
|
||||||
setItemDescriptionGenerator(new AssignInstalledDSTooltipGenerator());
|
setItemDescriptionGenerator(new AssignInstalledDSTooltipGenerator());
|
||||||
|
|
||||||
addNewContainerDS();
|
addNewContainerDS();
|
||||||
setColumnProperties();
|
setColumnProperties();
|
||||||
setDataAvailable(getContainerDataSource().size() != 0);
|
setDataAvailable(getContainerDataSource().size() != 0);
|
||||||
@@ -139,7 +145,8 @@ public class TargetTable extends AbstractTable<Target, Long> {
|
|||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
@EventBusListenerMethod(scope = EventScope.UI)
|
||||||
void onTargetUpdatedEvents(final TargetUpdatedEventContainer eventContainer) {
|
void onTargetUpdatedEvents(final TargetUpdatedEventContainer eventContainer) {
|
||||||
final List<Object> visibleItemIds = (List<Object>) getVisibleItemIds();
|
@SuppressWarnings("unchecked")
|
||||||
|
final List<Long> visibleItemIds = (List<Long>) getVisibleItemIds();
|
||||||
|
|
||||||
if (isFilterEnabled()) {
|
if (isFilterEnabled()) {
|
||||||
refreshTargets();
|
refreshTargets();
|
||||||
@@ -256,7 +263,6 @@ public class TargetTable extends AbstractTable<Target, Long> {
|
|||||||
targetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_POLL_STATUS_TOOL_TIP, String.class, null,
|
targetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_POLL_STATUS_TOOL_TIP, String.class, null,
|
||||||
false, true);
|
false, true);
|
||||||
targetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, "", false, true);
|
targetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, "", false, true);
|
||||||
|
|
||||||
targetTableContainer.addContainerProperty(SPUILabelDefinitions.ASSIGN_DIST_SET, DistributionSet.class, null,
|
targetTableContainer.addContainerProperty(SPUILabelDefinitions.ASSIGN_DIST_SET, DistributionSet.class, null,
|
||||||
false, true);
|
false, true);
|
||||||
targetTableContainer.addContainerProperty(SPUILabelDefinitions.INSTALL_DIST_SET, DistributionSet.class, null,
|
targetTableContainer.addContainerProperty(SPUILabelDefinitions.INSTALL_DIST_SET, DistributionSet.class, null,
|
||||||
@@ -273,32 +279,37 @@ public class TargetTable extends AbstractTable<Target, Long> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isFirstRowSelectedOnLoad() {
|
protected boolean isFirstRowSelectedOnLoad() {
|
||||||
return managementUIState.getSelectedTargetId().map(Set::isEmpty).orElse(true);
|
return managementUIState.getSelectedTargetId().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object getItemIdToSelect() {
|
protected Object getItemIdToSelect() {
|
||||||
return managementUIState.getSelectedTargetId().orElse(null);
|
return managementUIState.getSelectedTargetId().isEmpty() ? null : managementUIState.getSelectedTargetId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void publishEntityAfterValueChange(final Target selectedLastEntity) {
|
protected void publishSelectedEntityEvent(final Target selectedLastEntity) {
|
||||||
eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.SELECTED_ENTITY, selectedLastEntity));
|
eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.SELECTED_ENTITY, selectedLastEntity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setLastSelectedEntityId(final Long selectedLastEntityId) {
|
||||||
|
managementUIState.setLastSelectedTargetId(selectedLastEntityId);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Optional<Target> findEntityByTableValue(final Long lastSelectedId) {
|
protected Optional<Target> findEntityByTableValue(final Long lastSelectedId) {
|
||||||
return targetManagement.findTargetById(lastSelectedId);
|
return targetManagement.findTargetById(lastSelectedId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setManagementEntitiyStateValues(final Set<Long> values, final Long lastId) {
|
protected void setManagementEntityStateValues(final Set<Long> values, final Long lastId) {
|
||||||
managementUIState.setSelectedTargetId(values);
|
managementUIState.setSelectedTargetId(values);
|
||||||
managementUIState.setLastSelectedTargetId(lastId);
|
managementUIState.setLastSelectedTargetId(lastId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ManagmentEntityState<Long> getManagmentEntityState() {
|
protected ManagementEntityState getManagementEntityState() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,7 +394,7 @@ public class TargetTable extends AbstractTable<Target, Long> {
|
|||||||
pinBtn.addClickListener(this::addPinClickListener);
|
pinBtn.addClickListener(this::addPinClickListener);
|
||||||
if (isPinned(pinnedTarget)) {
|
if (isPinned(pinnedTarget)) {
|
||||||
pinBtn.addStyleName(TARGET_PINNED);
|
pinBtn.addStyleName(TARGET_PINNED);
|
||||||
isTargetPinned = Boolean.TRUE;
|
targetPinned = Boolean.TRUE;
|
||||||
targetPinnedBtn = pinBtn;
|
targetPinnedBtn = pinBtn;
|
||||||
eventBus.publish(this, PinUnpinEvent.PIN_TARGET);
|
eventBus.publish(this, PinUnpinEvent.PIN_TARGET);
|
||||||
}
|
}
|
||||||
@@ -397,38 +408,26 @@ public class TargetTable extends AbstractTable<Target, Long> {
|
|||||||
.map(pinnedTarget -> pinnedTarget.equals(target)).orElse(false);
|
.map(pinnedTarget -> pinnedTarget.equals(target)).orElse(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Add listener to pin.
|
|
||||||
*
|
|
||||||
* @param event
|
|
||||||
* as event
|
|
||||||
*/
|
|
||||||
private void addPinClickListener(final ClickEvent event) {
|
private void addPinClickListener(final ClickEvent event) {
|
||||||
checkifAlreadyPinned(event.getButton());
|
checkifAlreadyPinned(event.getButton());
|
||||||
if (isTargetPinned) {
|
if (targetPinned) {
|
||||||
pinTarget(event.getButton());
|
pinTarget(event.getButton());
|
||||||
} else {
|
} else {
|
||||||
unPinTarget(event.getButton());
|
unPinTarget(event.getButton());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check already pinned.
|
|
||||||
*
|
|
||||||
* @param eventBtn
|
|
||||||
* as button
|
|
||||||
*/
|
|
||||||
private void checkifAlreadyPinned(final Button eventBtn) {
|
private void checkifAlreadyPinned(final Button eventBtn) {
|
||||||
final TargetIdName newPinnedTargetItemId = (TargetIdName) eventBtn.getData();
|
final TargetIdName newPinnedTargetItemId = (TargetIdName) eventBtn.getData();
|
||||||
final TargetIdName targetId = managementUIState.getDistributionTableFilters().getPinnedTarget().orElse(null);
|
final TargetIdName targetId = managementUIState.getDistributionTableFilters().getPinnedTarget().orElse(null);
|
||||||
|
|
||||||
if (targetId == null) {
|
if (targetId == null) {
|
||||||
isTargetPinned = !isTargetPinned;
|
targetPinned = !targetPinned;
|
||||||
managementUIState.getDistributionTableFilters().setPinnedTarget(newPinnedTargetItemId);
|
managementUIState.getDistributionTableFilters().setPinnedTarget(newPinnedTargetItemId);
|
||||||
} else if (targetId.equals(newPinnedTargetItemId)) {
|
} else if (targetId.equals(newPinnedTargetItemId)) {
|
||||||
isTargetPinned = Boolean.FALSE;
|
targetPinned = Boolean.FALSE;
|
||||||
} else {
|
} else {
|
||||||
isTargetPinned = true;
|
targetPinned = true;
|
||||||
managementUIState.getDistributionTableFilters().setPinnedTarget(newPinnedTargetItemId);
|
managementUIState.getDistributionTableFilters().setPinnedTarget(newPinnedTargetItemId);
|
||||||
if (null != targetPinnedBtn) {
|
if (null != targetPinnedBtn) {
|
||||||
resetPinStyle(targetPinnedBtn);
|
resetPinStyle(targetPinnedBtn);
|
||||||
@@ -445,7 +444,7 @@ public class TargetTable extends AbstractTable<Target, Long> {
|
|||||||
/* change target table styling */
|
/* change target table styling */
|
||||||
styleTargetTable();
|
styleTargetTable();
|
||||||
eventBtn.addStyleName(TARGET_PINNED);
|
eventBtn.addStyleName(TARGET_PINNED);
|
||||||
isTargetPinned = Boolean.FALSE;
|
targetPinned = Boolean.FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void unPinTarget(final Button eventBtn) {
|
private void unPinTarget(final Button eventBtn) {
|
||||||
@@ -458,13 +457,9 @@ public class TargetTable extends AbstractTable<Target, Long> {
|
|||||||
pinBtn.removeStyleName(TARGET_PINNED);
|
pinBtn.removeStyleName(TARGET_PINNED);
|
||||||
pinBtn.addStyleName(SPUIStyleDefinitions.TARGET_STATUS_PIN_TOGGLE);
|
pinBtn.addStyleName(SPUIStyleDefinitions.TARGET_STATUS_PIN_TOGGLE);
|
||||||
final TargetIdName targetIdname = (TargetIdName) pinBtn.getData();
|
final TargetIdName targetIdname = (TargetIdName) pinBtn.getData();
|
||||||
|
|
||||||
HawkbitCommonUtil.applyStatusLblStyle(this, pinBtn, targetIdname.getTargetId());
|
HawkbitCommonUtil.applyStatusLblStyle(this, pinBtn, targetIdname.getTargetId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set style of target table.
|
|
||||||
*/
|
|
||||||
private void styleTargetTable() {
|
private void styleTargetTable() {
|
||||||
setCellStyleGenerator((source, itemId, propertyId) -> null);
|
setCellStyleGenerator((source, itemId, propertyId) -> null);
|
||||||
}
|
}
|
||||||
@@ -485,8 +480,8 @@ public class TargetTable extends AbstractTable<Target, Long> {
|
|||||||
final String tagName = ((DragAndDropWrapper) (event.getTransferable().getSourceComponent())).getData()
|
final String tagName = ((DragAndDropWrapper) (event.getTransferable().getSourceComponent())).getData()
|
||||||
.toString();
|
.toString();
|
||||||
if (tagName.equals(SPUIDefinitions.TARGET_TAG_BUTTON)) {
|
if (tagName.equals(SPUIDefinitions.TARGET_TAG_BUTTON)) {
|
||||||
notification.displayValidationError(
|
notification.displayValidationError(i18n.getMessage("message.tag.cannot.be.assigned",
|
||||||
i18n.getMessage("message.tag.cannot.be.assigned", new Object[] { i18n.getMessage("label.no.tag.assigned") }));
|
new Object[] { i18n.getMessage("label.no.tag.assigned") }));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -575,8 +570,7 @@ public class TargetTable extends AbstractTable<Target, Long> {
|
|||||||
|
|
||||||
private void dsToTargetAssignment(final DragAndDropEvent event) {
|
private void dsToTargetAssignment(final DragAndDropEvent event) {
|
||||||
final TableTransferable transferable = (TableTransferable) event.getTransferable();
|
final TableTransferable transferable = (TableTransferable) event.getTransferable();
|
||||||
@SuppressWarnings("unchecked")
|
final AbstractTable<?> source = (AbstractTable<?>) transferable.getSourceComponent();
|
||||||
final AbstractTable<?, Long> source = (AbstractTable<?, Long>) transferable.getSourceComponent();
|
|
||||||
final Set<Long> ids = source.getDeletedEntityByTransferable(transferable);
|
final Set<Long> ids = source.getDeletedEntityByTransferable(transferable);
|
||||||
final AbstractSelectTargetDetails dropData = (AbstractSelectTargetDetails) event.getTargetDetails();
|
final AbstractSelectTargetDetails dropData = (AbstractSelectTargetDetails) event.getTargetDetails();
|
||||||
final Object targetItemId = dropData.getItemIdOver();
|
final Object targetItemId = dropData.getItemIdOver();
|
||||||
@@ -794,8 +788,8 @@ public class TargetTable extends AbstractTable<Target, Long> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isLastSelectedTarget(final Long targetId) {
|
private boolean isLastSelectedTarget(final Long targetId) {
|
||||||
return managementUIState.getLastSelectedTargetId() != null
|
final Optional<Long> currentTargetId = managementUIState.getLastSelectedTargetId();
|
||||||
&& managementUIState.getLastSelectedTargetId().equals(targetId);
|
return currentTargetId.isPresent() && currentTargetId.get().equals(targetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isFilterEnabled() {
|
private boolean isFilterEnabled() {
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
|||||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentEvent;
|
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUITargetDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUITargetDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
import org.vaadin.spring.events.EventScope;
|
import org.vaadin.spring.events.EventScope;
|
||||||
@@ -82,12 +82,13 @@ public class TargetTableHeader extends AbstractTableHeader {
|
|||||||
final ManagementViewClientCriterion managementViewClientCriterion, final TargetManagement targetManagement,
|
final ManagementViewClientCriterion managementViewClientCriterion, final TargetManagement targetManagement,
|
||||||
final DeploymentManagement deploymentManagement, final UiProperties uiproperties, final UIEventBus eventBus,
|
final DeploymentManagement deploymentManagement, final UiProperties uiproperties, final UIEventBus eventBus,
|
||||||
final EntityFactory entityFactory, final UINotification uinotification, final TagManagement tagManagement,
|
final EntityFactory entityFactory, final UINotification uinotification, final TagManagement tagManagement,
|
||||||
final DistributionSetManagement distributionSetManagement, final Executor uiExecutor) {
|
final DistributionSetManagement distributionSetManagement, final Executor uiExecutor,
|
||||||
|
final TargetTable targetTable) {
|
||||||
super(i18n, permChecker, eventbus, managementUIState, null, null);
|
super(i18n, permChecker, eventbus, managementUIState, null, null);
|
||||||
this.notification = notification;
|
this.notification = notification;
|
||||||
this.managementViewClientCriterion = managementViewClientCriterion;
|
this.managementViewClientCriterion = managementViewClientCriterion;
|
||||||
this.targetAddUpdateWindow = new TargetAddUpdateWindowLayout(i18n, targetManagement, eventBus, uinotification,
|
this.targetAddUpdateWindow = new TargetAddUpdateWindowLayout(i18n, targetManagement, eventBus, uinotification,
|
||||||
entityFactory);
|
entityFactory, targetTable);
|
||||||
this.targetBulkUpdateWindow = new TargetBulkUpdateWindowLayout(i18n, targetManagement, eventBus,
|
this.targetBulkUpdateWindow = new TargetBulkUpdateWindowLayout(i18n, targetManagement, eventBus,
|
||||||
managementUIState, deploymentManagement, uiproperties, permChecker, uinotification, tagManagement,
|
managementUIState, deploymentManagement, uiproperties, permChecker, uinotification, tagManagement,
|
||||||
distributionSetManagement, entityFactory, uiExecutor);
|
distributionSetManagement, entityFactory, uiExecutor);
|
||||||
@@ -114,7 +115,7 @@ public class TargetTableHeader extends AbstractTableHeader {
|
|||||||
targetBulkUpdateWindow.restoreComponentsValue();
|
targetBulkUpdateWindow.restoreComponentsValue();
|
||||||
openBulkUploadWindow();
|
openBulkUploadWindow();
|
||||||
} else if (BulkUploadPopupEvent.CLOSED == event) {
|
} else if (BulkUploadPopupEvent.CLOSED == event) {
|
||||||
UI.getCurrent().access(() -> enableBulkUpload());
|
UI.getCurrent().access(this::enableBulkUpload);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,11 +128,11 @@ public class TargetTableHeader extends AbstractTableHeader {
|
|||||||
void onEvent(final TargetTableEvent event) {
|
void onEvent(final TargetTableEvent event) {
|
||||||
if (TargetComponentEvent.BULK_TARGET_CREATED == event.getTargetComponentEvent()) {
|
if (TargetComponentEvent.BULK_TARGET_CREATED == event.getTargetComponentEvent()) {
|
||||||
this.getUI().access(() -> targetBulkUpdateWindow.setProgressBarValue(
|
this.getUI().access(() -> targetBulkUpdateWindow.setProgressBarValue(
|
||||||
managementUIState.getTargetTableFilters().getBulkUpload().getProgressBarCurrentValue()));
|
getManagementUIState().getTargetTableFilters().getBulkUpload().getProgressBarCurrentValue()));
|
||||||
} else if (TargetComponentEvent.BULK_UPLOAD_COMPLETED == event.getTargetComponentEvent()) {
|
} else if (TargetComponentEvent.BULK_UPLOAD_COMPLETED == event.getTargetComponentEvent()) {
|
||||||
this.getUI().access(() -> targetBulkUpdateWindow.onUploadCompletion());
|
this.getUI().access(targetBulkUpdateWindow::onUploadCompletion);
|
||||||
} else if (TargetComponentEvent.BULK_TARGET_UPLOAD_STARTED == event.getTargetComponentEvent()) {
|
} else if (TargetComponentEvent.BULK_TARGET_UPLOAD_STARTED == event.getTargetComponentEvent()) {
|
||||||
this.getUI().access(() -> onStartOfBulkUpload());
|
this.getUI().access(this::onStartOfBulkUpload);
|
||||||
} else if (TargetComponentEvent.BULK_UPLOAD_PROCESS_STARTED == event.getTargetComponentEvent()) {
|
} else if (TargetComponentEvent.BULK_UPLOAD_PROCESS_STARTED == event.getTargetComponentEvent()) {
|
||||||
this.getUI().access(() -> targetBulkUpdateWindow.getBulkUploader().getUpload().setEnabled(false));
|
this.getUI().access(() -> targetBulkUpdateWindow.getBulkUploader().getUpload().setEnabled(false));
|
||||||
}
|
}
|
||||||
@@ -148,7 +149,7 @@ public class TargetTableHeader extends AbstractTableHeader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onLoadRestoreState() {
|
private void onLoadRestoreState() {
|
||||||
if (managementUIState.isCustomFilterSelected()) {
|
if (getManagementUIState().isCustomFilterSelected()) {
|
||||||
onSimpleFilterReset();
|
onSimpleFilterReset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,7 +160,7 @@ public class TargetTableHeader extends AbstractTableHeader {
|
|||||||
if (isSearchFieldOpen()) {
|
if (isSearchFieldOpen()) {
|
||||||
resetSearch();
|
resetSearch();
|
||||||
}
|
}
|
||||||
if (managementUIState.getTargetTableFilters().getDistributionSet().isPresent()) {
|
if (getManagementUIState().getTargetTableFilters().getDistributionSet().isPresent()) {
|
||||||
closeFilterByDistribution();
|
closeFilterByDistribution();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -226,20 +227,20 @@ public class TargetTableHeader extends AbstractTableHeader {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void showFilterButtonsLayout() {
|
protected void showFilterButtonsLayout() {
|
||||||
managementUIState.setTargetTagFilterClosed(false);
|
getManagementUIState().setTargetTagFilterClosed(false);
|
||||||
eventbus.publish(this, ManagementUIEvent.SHOW_TARGET_TAG_LAYOUT);
|
eventbus.publish(this, ManagementUIEvent.SHOW_TARGET_TAG_LAYOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void resetSearchText() {
|
protected void resetSearchText() {
|
||||||
if (managementUIState.getTargetTableFilters().getSearchText().isPresent()) {
|
if (getManagementUIState().getTargetTableFilters().getSearchText().isPresent()) {
|
||||||
managementUIState.getTargetTableFilters().setSearchText(null);
|
getManagementUIState().getTargetTableFilters().setSearchText(null);
|
||||||
eventbus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_TEXT);
|
eventbus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_TEXT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSearchText() {
|
private String getSearchText() {
|
||||||
return managementUIState.getTargetTableFilters().getSearchText().orElse(null);
|
return getManagementUIState().getTargetTableFilters().getSearchText().orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -249,29 +250,29 @@ public class TargetTableHeader extends AbstractTableHeader {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void maximizeTable() {
|
public void maximizeTable() {
|
||||||
managementUIState.setTargetTableMaximized(Boolean.TRUE);
|
getManagementUIState().setTargetTableMaximized(Boolean.TRUE);
|
||||||
eventbus.publish(this, new TargetTableEvent(BaseEntityEventType.MAXIMIZED));
|
eventbus.publish(this, new TargetTableEvent(BaseEntityEventType.MAXIMIZED));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void minimizeTable() {
|
public void minimizeTable() {
|
||||||
managementUIState.setTargetTableMaximized(Boolean.FALSE);
|
getManagementUIState().setTargetTableMaximized(Boolean.FALSE);
|
||||||
eventbus.publish(this, new TargetTableEvent(BaseEntityEventType.MINIMIZED));
|
eventbus.publish(this, new TargetTableEvent(BaseEntityEventType.MINIMIZED));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean onLoadIsTableMaximized() {
|
public Boolean onLoadIsTableMaximized() {
|
||||||
return managementUIState.isTargetTableMaximized();
|
return getManagementUIState().isTargetTableMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean onLoadIsShowFilterButtonDisplayed() {
|
public Boolean onLoadIsShowFilterButtonDisplayed() {
|
||||||
return managementUIState.isTargetTagFilterClosed();
|
return getManagementUIState().isTargetTagFilterClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void searchBy(final String newSearchText) {
|
protected void searchBy(final String newSearchText) {
|
||||||
managementUIState.getTargetTableFilters().setSearchText(newSearchText);
|
getManagementUIState().getTargetTableFilters().setSearchText(newSearchText);
|
||||||
eventbus.publish(this, TargetFilterEvent.FILTER_BY_TEXT);
|
eventbus.publish(this, TargetFilterEvent.FILTER_BY_TEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,7 +342,7 @@ public class TargetTableHeader extends AbstractTableHeader {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final DistributionSetIdName distributionSetIdName = new DistributionSetIdName(distributionSet.get());
|
final DistributionSetIdName distributionSetIdName = new DistributionSetIdName(distributionSet.get());
|
||||||
managementUIState.getTargetTableFilters().setDistributionSet(distributionSetIdName);
|
getManagementUIState().getTargetTableFilters().setDistributionSet(distributionSetIdName);
|
||||||
addFilterTextField(distributionSetIdName);
|
addFilterTextField(distributionSetIdName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -376,8 +377,7 @@ public class TargetTableHeader extends AbstractTableHeader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Set<Long> getDropppedDistributionDetails(final TableTransferable transferable) {
|
private static Set<Long> getDropppedDistributionDetails(final TableTransferable transferable) {
|
||||||
@SuppressWarnings("unchecked")
|
final AbstractTable<?> distTable = (AbstractTable<?>) transferable.getSourceComponent();
|
||||||
final AbstractTable<?, Long> distTable = (AbstractTable<?, Long>) transferable.getSourceComponent();
|
|
||||||
return distTable.getDeletedEntityByTransferable(transferable);
|
return distTable.getDeletedEntityByTransferable(transferable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -409,7 +409,7 @@ public class TargetTableHeader extends AbstractTableHeader {
|
|||||||
getFilterDroppedInfo().removeAllComponents();
|
getFilterDroppedInfo().removeAllComponents();
|
||||||
getFilterDroppedInfo().setSizeUndefined();
|
getFilterDroppedInfo().setSizeUndefined();
|
||||||
/* Remove distribution Id from target filter parameters */
|
/* Remove distribution Id from target filter parameters */
|
||||||
managementUIState.getTargetTableFilters().setDistributionSet(null);
|
getManagementUIState().getTargetTableFilters().setDistributionSet(null);
|
||||||
|
|
||||||
/* Reload the table */
|
/* Reload the table */
|
||||||
eventbus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_DISTRIBUTION);
|
eventbus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_DISTRIBUTION);
|
||||||
@@ -417,13 +417,13 @@ public class TargetTableHeader extends AbstractTableHeader {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void displayFilterDropedInfoOnLoad() {
|
protected void displayFilterDropedInfoOnLoad() {
|
||||||
managementUIState.getTargetTableFilters().getDistributionSet().ifPresent(this::addFilterTextField);
|
getManagementUIState().getTargetTableFilters().getDistributionSet().ifPresent(this::addFilterTextField);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isBulkUploadInProgress() {
|
protected boolean isBulkUploadInProgress() {
|
||||||
return managementUIState.getTargetTableFilters().getBulkUpload().getSucessfulUploadCount() != 0
|
return getManagementUIState().getTargetTableFilters().getBulkUpload().getSucessfulUploadCount() != 0
|
||||||
|| managementUIState.getTargetTableFilters().getBulkUpload().getFailedUploadCount() != 0;
|
|| getManagementUIState().getTargetTableFilters().getBulkUpload().getFailedUploadCount() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ import org.eclipse.hawkbit.ui.dd.criteria.ManagementViewClientCriterion;
|
|||||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentEvent;
|
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.spring.events.EventBus;
|
import org.vaadin.spring.events.EventBus;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
|
|
||||||
@@ -50,10 +50,11 @@ public class TargetTableLayout extends AbstractTableLayout<TargetTable> {
|
|||||||
final Executor uiExecutor) {
|
final Executor uiExecutor) {
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.targetDetails = new TargetDetails(i18n, eventbus, permissionChecker, managementUIState, uinotification,
|
this.targetDetails = new TargetDetails(i18n, eventbus, permissionChecker, managementUIState, uinotification,
|
||||||
tagManagement, targetManagement, deploymentManagement, entityFactory);
|
tagManagement, targetManagement, deploymentManagement, entityFactory, targetTable);
|
||||||
this.targetTableHeader = new TargetTableHeader(i18n, permissionChecker, eventBus, notification,
|
this.targetTableHeader = new TargetTableHeader(i18n, permissionChecker, eventBus, notification,
|
||||||
managementUIState, managementViewClientCriterion, targetManagement, deploymentManagement, uiproperties,
|
managementUIState, managementViewClientCriterion, targetManagement, deploymentManagement, uiproperties,
|
||||||
eventbus, entityFactory, uinotification, tagManagement, distributionSetManagement, uiExecutor);
|
eventbus, entityFactory, uinotification, tagManagement, distributionSetManagement, uiExecutor,
|
||||||
|
targetTable);
|
||||||
|
|
||||||
super.init(targetTableHeader, targetTable, targetDetails);
|
super.init(targetTableHeader, targetTable, targetDetails);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,11 +24,11 @@ import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
|||||||
import org.eclipse.hawkbit.ui.management.tag.TagIdName;
|
import org.eclipse.hawkbit.ui.management.tag.TagIdName;
|
||||||
import org.eclipse.hawkbit.ui.management.targettable.TargetTable;
|
import org.eclipse.hawkbit.ui.management.targettable.TargetTable;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
@@ -135,8 +135,8 @@ public class TargetTagFilterButtons extends AbstractFilterButtons implements Ref
|
|||||||
private Boolean isNoTagAssigned(final DragAndDropEvent event) {
|
private Boolean isNoTagAssigned(final DragAndDropEvent event) {
|
||||||
final String tagName = ((DragAndDropWrapper) (event.getTargetDetails().getTarget())).getData().toString();
|
final String tagName = ((DragAndDropWrapper) (event.getTargetDetails().getTarget())).getData().toString();
|
||||||
if (tagName.equals(SPUIDefinitions.TARGET_TAG_BUTTON)) {
|
if (tagName.equals(SPUIDefinitions.TARGET_TAG_BUTTON)) {
|
||||||
notification.displayValidationError(
|
notification.displayValidationError(i18n.getMessage("message.tag.cannot.be.assigned",
|
||||||
i18n.getMessage("message.tag.cannot.be.assigned", new Object[] { i18n.getMessage("label.no.tag.assigned") }));
|
new Object[] { i18n.getMessage("label.no.tag.assigned") }));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -159,13 +159,13 @@ public class TargetTagFilterButtons extends AbstractFilterButtons implements Ref
|
|||||||
|
|
||||||
final TableTransferable tabletransferable = (TableTransferable) transferable;
|
final TableTransferable tabletransferable = (TableTransferable) transferable;
|
||||||
|
|
||||||
final AbstractTable<?, ?> source = (AbstractTable<?, ?>) tabletransferable.getSourceComponent();
|
final AbstractTable<?> source = (AbstractTable<?>) tabletransferable.getSourceComponent();
|
||||||
|
|
||||||
if (!validateIfSourceisTargetTable(source) && !checkForTargetUpdatePermission()) {
|
if (!validateIfSourceisTargetTable(source) && !checkForTargetUpdatePermission()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Set<?> deletedEntityByTransferable = source.getDeletedEntityByTransferable(tabletransferable);
|
final Set<Long> deletedEntityByTransferable = source.getDeletedEntityByTransferable(tabletransferable);
|
||||||
if (deletedEntityByTransferable.isEmpty()) {
|
if (deletedEntityByTransferable.isEmpty()) {
|
||||||
final String actionDidNotWork = i18n.getMessage("message.action.did.not.work", new Object[] {});
|
final String actionDidNotWork = i18n.getMessage("message.action.did.not.work", new Object[] {});
|
||||||
notification.displayValidationError(actionDidNotWork);
|
notification.displayValidationError(actionDidNotWork);
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import java.util.List;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||||
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
||||||
@@ -471,7 +470,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
|||||||
|
|
||||||
private TextField createIntegerTextField(final String in18Key, final String id) {
|
private TextField createIntegerTextField(final String in18Key, final String id) {
|
||||||
final TextField textField = createTextField(in18Key, id);
|
final TextField textField = createTextField(in18Key, id);
|
||||||
textField.setNullRepresentation(StringUtils.EMPTY);
|
textField.setNullRepresentation("");
|
||||||
textField.setConverter(new StringToIntegerConverter());
|
textField.setConverter(new StringToIntegerConverter());
|
||||||
textField.setConversionError(i18n.getMessage(MESSAGE_ENTER_NUMBER));
|
textField.setConversionError(i18n.getMessage(MESSAGE_ENTER_NUMBER));
|
||||||
textField.setSizeUndefined();
|
textField.setSizeUndefined();
|
||||||
@@ -599,7 +598,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
|||||||
.maxLengthAllowed(SPUILabelDefinitions.TARGET_FILTER_QUERY_TEXT_FIELD_LENGTH).buildTextComponent();
|
.maxLengthAllowed(SPUILabelDefinitions.TARGET_FILTER_QUERY_TEXT_FIELD_LENGTH).buildTextComponent();
|
||||||
|
|
||||||
filterField.setId(UIComponentIdProvider.ROLLOUT_TARGET_FILTER_QUERY_FIELD);
|
filterField.setId(UIComponentIdProvider.ROLLOUT_TARGET_FILTER_QUERY_FIELD);
|
||||||
filterField.setNullRepresentation(StringUtils.EMPTY);
|
filterField.setNullRepresentation("");
|
||||||
filterField.setEnabled(false);
|
filterField.setEnabled(false);
|
||||||
filterField.setSizeUndefined();
|
filterField.setSizeUndefined();
|
||||||
return filterField;
|
return filterField;
|
||||||
@@ -760,7 +759,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
|||||||
final TextArea descriptionField = new TextAreaBuilder().style("text-area-style")
|
final TextArea descriptionField = new TextAreaBuilder().style("text-area-style")
|
||||||
.prompt(i18n.getMessage("textfield.description")).id(UIComponentIdProvider.ROLLOUT_DESCRIPTION_ID)
|
.prompt(i18n.getMessage("textfield.description")).id(UIComponentIdProvider.ROLLOUT_DESCRIPTION_ID)
|
||||||
.buildTextComponent();
|
.buildTextComponent();
|
||||||
descriptionField.setNullRepresentation(StringUtils.EMPTY);
|
descriptionField.setNullRepresentation("");
|
||||||
descriptionField.setSizeUndefined();
|
descriptionField.setSizeUndefined();
|
||||||
return descriptionField;
|
return descriptionField;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,8 +97,8 @@ public class DefineGroupsLayout extends GridLayout {
|
|||||||
|
|
||||||
private final AtomicInteger runningValidationsCounter;
|
private final AtomicInteger runningValidationsCounter;
|
||||||
|
|
||||||
DefineGroupsLayout(VaadinMessageSource i18n, EntityFactory entityFactory, RolloutManagement rolloutManagement,
|
DefineGroupsLayout(final VaadinMessageSource i18n, final EntityFactory entityFactory,
|
||||||
TargetFilterQueryManagement targetFilterQueryManagement) {
|
final RolloutManagement rolloutManagement, final TargetFilterQueryManagement targetFilterQueryManagement) {
|
||||||
this.i18n = i18n;
|
this.i18n = i18n;
|
||||||
this.entityFactory = entityFactory;
|
this.entityFactory = entityFactory;
|
||||||
this.rolloutManagement = rolloutManagement;
|
this.rolloutManagement = rolloutManagement;
|
||||||
@@ -467,7 +467,7 @@ public class DefineGroupsLayout extends GridLayout {
|
|||||||
.id(UIComponentIdProvider.ROLLOUT_TARGET_FILTER_QUERY_FIELD)
|
.id(UIComponentIdProvider.ROLLOUT_TARGET_FILTER_QUERY_FIELD)
|
||||||
.maxLengthAllowed(SPUILabelDefinitions.TARGET_FILTER_QUERY_TEXT_FIELD_LENGTH).buildTextComponent();
|
.maxLengthAllowed(SPUILabelDefinitions.TARGET_FILTER_QUERY_TEXT_FIELD_LENGTH).buildTextComponent();
|
||||||
|
|
||||||
filterField.setNullRepresentation(StringUtils.EMPTY);
|
filterField.setNullRepresentation("");
|
||||||
filterField.setEnabled(false);
|
filterField.setEnabled(false);
|
||||||
filterField.setSizeUndefined();
|
filterField.setSizeUndefined();
|
||||||
return filterField;
|
return filterField;
|
||||||
@@ -547,7 +547,7 @@ public class DefineGroupsLayout extends GridLayout {
|
|||||||
* @param rowIndex
|
* @param rowIndex
|
||||||
* the row of the grid layout
|
* the row of the grid layout
|
||||||
*/
|
*/
|
||||||
public void addToGridRow(GridLayout layout, int rowIndex) {
|
public void addToGridRow(final GridLayout layout, final int rowIndex) {
|
||||||
layout.addComponent(groupName, 0, rowIndex);
|
layout.addComponent(groupName, 0, rowIndex);
|
||||||
if (populated) {
|
if (populated) {
|
||||||
layout.addComponent(targetFilterQuery, 1, rowIndex);
|
layout.addComponent(targetFilterQuery, 1, rowIndex);
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import java.util.Locale;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||||
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
||||||
@@ -519,7 +518,7 @@ public class RolloutListGrid extends AbstractGrid<LazyQueryContainer> {
|
|||||||
scheduledActions = 0L;
|
scheduledActions = 0L;
|
||||||
}
|
}
|
||||||
final Long runningActions = statusTotalCount.get(Status.RUNNING);
|
final Long runningActions = statusTotalCount.get(Status.RUNNING);
|
||||||
String rolloutDetailsMessage = StringUtils.EMPTY;
|
String rolloutDetailsMessage = "";
|
||||||
if ((scheduledActions > 0) || (runningActions > 0)) {
|
if ((scheduledActions > 0) || (runningActions > 0)) {
|
||||||
rolloutDetailsMessage = i18n.getMessage("message.delete.rollout.details", runningActions, scheduledActions);
|
rolloutDetailsMessage = i18n.getMessage("message.delete.rollout.details", runningActions, scheduledActions);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import java.util.Locale;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.eclipse.hawkbit.repository.model.AssignmentResult;
|
import org.eclipse.hawkbit.repository.model.AssignmentResult;
|
||||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||||
import org.eclipse.hawkbit.repository.model.PollStatus;
|
import org.eclipse.hawkbit.repository.model.PollStatus;
|
||||||
@@ -108,7 +107,7 @@ public final class HawkbitCommonUtil {
|
|||||||
* null.
|
* null.
|
||||||
*/
|
*/
|
||||||
public static String concatStrings(final String delimiter, final String... texts) {
|
public static String concatStrings(final String delimiter, final String... texts) {
|
||||||
final String delim = delimiter == null ? StringUtils.EMPTY : delimiter;
|
final String delim = delimiter == null ? "" : delimiter;
|
||||||
final StringBuilder conCatStrBldr = new StringBuilder();
|
final StringBuilder conCatStrBldr = new StringBuilder();
|
||||||
if (null != texts) {
|
if (null != texts) {
|
||||||
for (final String text : texts) {
|
for (final String text : texts) {
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import java.util.Date;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.apache.commons.lang3.time.DurationFormatUtils;
|
import org.apache.commons.lang3.time.DurationFormatUtils;
|
||||||
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||||
|
|
||||||
@@ -102,9 +101,9 @@ public final class SPDateTimeUtil {
|
|||||||
*/
|
*/
|
||||||
public static String formatCreatedAt(final BaseEntity baseEntity) {
|
public static String formatCreatedAt(final BaseEntity baseEntity) {
|
||||||
if (baseEntity == null) {
|
if (baseEntity == null) {
|
||||||
return StringUtils.EMPTY;
|
return "";
|
||||||
}
|
}
|
||||||
return formatDate(baseEntity.getCreatedAt(), StringUtils.EMPTY);
|
return formatDate(baseEntity.getCreatedAt(), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -116,9 +115,9 @@ public final class SPDateTimeUtil {
|
|||||||
*/
|
*/
|
||||||
public static String formatLastModifiedAt(final BaseEntity baseEntity) {
|
public static String formatLastModifiedAt(final BaseEntity baseEntity) {
|
||||||
if (baseEntity == null) {
|
if (baseEntity == null) {
|
||||||
return StringUtils.EMPTY;
|
return "";
|
||||||
}
|
}
|
||||||
return formatDate(baseEntity.getLastModifiedAt(), StringUtils.EMPTY);
|
return formatDate(baseEntity.getLastModifiedAt(), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -132,9 +131,9 @@ public final class SPDateTimeUtil {
|
|||||||
*/
|
*/
|
||||||
public static String formatLastModifiedAt(final BaseEntity baseEntity, final String datePattern) {
|
public static String formatLastModifiedAt(final BaseEntity baseEntity, final String datePattern) {
|
||||||
if (baseEntity == null) {
|
if (baseEntity == null) {
|
||||||
return StringUtils.EMPTY;
|
return "";
|
||||||
}
|
}
|
||||||
return formatDate(baseEntity.getLastModifiedAt(), StringUtils.EMPTY, datePattern);
|
return formatDate(baseEntity.getLastModifiedAt(), "", datePattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String formatDate(final Long lastQueryDate, final String defaultString, final String datePattern) {
|
private static String formatDate(final Long lastQueryDate, final String defaultString, final String datePattern) {
|
||||||
|
|||||||
@@ -108,6 +108,11 @@ public final class SPUIStyleDefinitions {
|
|||||||
*/
|
*/
|
||||||
public static final String ACTION_BUTTON = "action-button";
|
public static final String ACTION_BUTTON = "action-button";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Width of 'drop to delete' layout and 'no actions' button
|
||||||
|
*/
|
||||||
|
public static final String DEL_ACTION_BUTTON = "del-action-button";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Confirmation window caption stle.
|
* Confirmation window caption stle.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public final class UIComponentIdProvider {
|
|||||||
public static final String TARGET_FILTER_ADD_ICON_ID = "target.filter.add.id";
|
public static final String TARGET_FILTER_ADD_ICON_ID = "target.filter.add.id";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID-Dist.
|
* ID-Dist. on deployment and distribution view
|
||||||
*/
|
*/
|
||||||
public static final String DIST_TABLE_ID = "dist.tableId";
|
public static final String DIST_TABLE_ID = "dist.tableId";
|
||||||
|
|
||||||
@@ -278,6 +278,11 @@ public final class UIComponentIdProvider {
|
|||||||
*/
|
*/
|
||||||
public static final String TARGET_FILTER_WRAPPER_ID = "target-drop-filter";
|
public static final String TARGET_FILTER_WRAPPER_ID = "target-drop-filter";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID for HorizontalLayout containing Action Buttons (delete, action)
|
||||||
|
*/
|
||||||
|
public static final String ACTION_BUTTON_LAYOUT = "ActionButtonLayout";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete button wrapper id.
|
* Delete button wrapper id.
|
||||||
*/
|
*/
|
||||||
@@ -501,7 +506,7 @@ public final class UIComponentIdProvider {
|
|||||||
public static final String SM_TYPE_FILTER_BTN_ID = "sm.type.filter.btn.";
|
public static final String SM_TYPE_FILTER_BTN_ID = "sm.type.filter.btn.";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Software module table details header caption id.
|
* Target table details header caption id.
|
||||||
*/
|
*/
|
||||||
public static final String TARGET_DETAILS_HEADER_LABEL_ID = "target.details.header.caption";
|
public static final String TARGET_DETAILS_HEADER_LABEL_ID = "target.details.header.caption";
|
||||||
|
|
||||||
@@ -510,6 +515,11 @@ public final class UIComponentIdProvider {
|
|||||||
*/
|
*/
|
||||||
public static final String DISTRIBUTION_DETAILS_HEADER_LABEL_ID = "distribution.details.header.caption";
|
public static final String DISTRIBUTION_DETAILS_HEADER_LABEL_ID = "distribution.details.header.caption";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Software Module table details header caption id.
|
||||||
|
*/
|
||||||
|
public static final String SOFTWARE_MODULE_DETAILS_HEADER_LABEL_ID = "software.module.details.header.caption";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Software module table details vendor label id.
|
* Software module table details vendor label id.
|
||||||
*/
|
*/
|
||||||
@@ -1015,6 +1025,11 @@ public final class UIComponentIdProvider {
|
|||||||
*/
|
*/
|
||||||
public static final String ROLLOUT_DELETE_CONFIRMATION_DIALOG = "rollout.delete.confirmation.window";
|
public static final String ROLLOUT_DELETE_CONFIRMATION_DIALOG = "rollout.delete.confirmation.window";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Details header caption id of the Artifacts Table
|
||||||
|
*/
|
||||||
|
public static final String ARTIFACT_DETAILS_HEADER_LABEL_ID = "artifact.details.header.caption";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* /* Private Constructor.
|
* /* Private Constructor.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* 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.view.filter;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.AbstractBaseViewFilter;
|
||||||
|
import org.eclipse.hawkbit.ui.management.DeploymentView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View Filter class which holds the information about the Deployment View
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class OnlyEventsFromDeploymentViewFilter extends AbstractBaseViewFilter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<?> getOriginView() {
|
||||||
|
return DeploymentView.class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* 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.view.filter;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.AbstractBaseViewFilter;
|
||||||
|
import org.eclipse.hawkbit.ui.distributions.DistributionsView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View Filter class which holds the information about the Distributions View
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class OnlyEventsFromDistributionsViewFilter extends AbstractBaseViewFilter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<?> getOriginView() {
|
||||||
|
return DistributionsView.class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* 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.view.filter;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.ui.artifacts.UploadArtifactView;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.AbstractBaseViewFilter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View Filter class which holds the information about the Upload View
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class OnlyEventsFromUploadArtifactViewFilter extends AbstractBaseViewFilter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<?> getOriginView() {
|
||||||
|
return UploadArtifactView.class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,6 +17,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.no-border {
|
||||||
|
border: 0px !important;
|
||||||
|
}
|
||||||
|
|
||||||
//Style applied on all buttons of footer layout.Width and height of buttons can be configured
|
//Style applied on all buttons of footer layout.Width and height of buttons can be configured
|
||||||
.action-button {
|
.action-button {
|
||||||
@include valo-gradient($color: $footer-button-background-color);
|
@include valo-gradient($color: $footer-button-background-color);
|
||||||
|
|||||||
@@ -89,8 +89,7 @@ caption.filter.custom = Custom Filter
|
|||||||
caption.metadata = Metadata
|
caption.metadata = Metadata
|
||||||
|
|
||||||
caption.select.auto.assign.dist = Select auto assignment distribution set
|
caption.select.auto.assign.dist = Select auto assignment distribution set
|
||||||
caption.add.softwaremodule = Configure Software Module
|
caption.add.dist = Configure New Distribution
|
||||||
caption.add.new.dist = Configure New Distribution
|
|
||||||
caption.update.dist = Configure Update Distribution
|
caption.update.dist = Configure Update Distribution
|
||||||
caption.add.tag = Configure Tag
|
caption.add.tag = Configure Tag
|
||||||
caption.add.type = Configure Type
|
caption.add.type = Configure Type
|
||||||
|
|||||||
Reference in New Issue
Block a user