Reduce duplicate code in the UI package (#448)
* Insert abstract class for SoftwareModule and DistributinSet TableHeader Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Insert abstract class for common code of Software Module Details Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Insert new abstract class which contains common code for DistSetDetails Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Refactor DistributionSet Details Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Remove unused parameter Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Remove unused method call Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Correct creation of SoftwareModuleDetailsTable Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Code refactoring Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Code refactor Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Refactor creation of the softwareModuleDetailsTable Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Avoid creation of softwareModuleTab each time it is used Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Add final to overriden methods used in constructor Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Don't use Optional as method parameter Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Little code refactor Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Code refactor Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Code refactor Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>
This commit is contained in:
committed by
Michael Hirsch
parent
9283c9214e
commit
85212576c8
@@ -8,150 +8,36 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.artifacts.smtable;
|
package org.eclipse.hawkbit.ui.artifacts.smtable;
|
||||||
|
|
||||||
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.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||||
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.detailslayout.AbstractNamedVersionedEntityTableDetailsLayout;
|
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractSoftwareModuleDetails;
|
||||||
import org.eclipse.hawkbit.ui.common.detailslayout.SoftwareModuleMetadatadetailslayout;
|
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
|
||||||
import org.eclipse.hawkbit.ui.distributions.event.MetadataEvent;
|
|
||||||
import org.eclipse.hawkbit.ui.distributions.smtable.SwMetadataPopupLayout;
|
import org.eclipse.hawkbit.ui.distributions.smtable.SwMetadataPopupLayout;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
|
||||||
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.annotation.EventBusListenerMethod;
|
|
||||||
|
|
||||||
import com.vaadin.ui.Button.ClickEvent;
|
|
||||||
import com.vaadin.ui.Label;
|
|
||||||
import com.vaadin.ui.TabSheet;
|
|
||||||
import com.vaadin.ui.UI;
|
|
||||||
import com.vaadin.ui.VerticalLayout;
|
|
||||||
import com.vaadin.ui.Window;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Software module details.
|
* Software module details.
|
||||||
*/
|
*/
|
||||||
public class SoftwareModuleDetails extends AbstractNamedVersionedEntityTableDetailsLayout<SoftwareModule> {
|
public class SoftwareModuleDetails extends AbstractSoftwareModuleDetails {
|
||||||
|
|
||||||
private static final long serialVersionUID = -4900381301076646366L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow;
|
|
||||||
|
|
||||||
private final ArtifactUploadState artifactUploadState;
|
private final ArtifactUploadState artifactUploadState;
|
||||||
|
|
||||||
private final transient SoftwareManagement softwareManagement;
|
SoftwareModuleDetails(final VaadinMessageSource i18n, final UIEventBus eventBus,
|
||||||
|
final SpPermissionChecker permissionChecker,
|
||||||
private final SwMetadataPopupLayout swMetadataPopupLayout;
|
|
||||||
|
|
||||||
private final SoftwareModuleMetadatadetailslayout swmMetadataTable;
|
|
||||||
|
|
||||||
SoftwareModuleDetails(final VaadinMessageSource i18n, final UIEventBus eventBus, final SpPermissionChecker permissionChecker,
|
|
||||||
final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow,
|
final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow,
|
||||||
final ArtifactUploadState artifactUploadState, final SoftwareManagement softwareManagement,
|
final ArtifactUploadState artifactUploadState, final SoftwareManagement softwareManagement,
|
||||||
final SwMetadataPopupLayout swMetadataPopupLayout, final EntityFactory entityFactory) {
|
final SwMetadataPopupLayout swMetadataPopupLayout, final EntityFactory entityFactory) {
|
||||||
super(i18n, eventBus, permissionChecker, null);
|
super(i18n, eventBus, permissionChecker, null, softwareManagement, swMetadataPopupLayout, entityFactory,
|
||||||
this.softwareModuleAddUpdateWindow = softwareModuleAddUpdateWindow;
|
softwareModuleAddUpdateWindow);
|
||||||
this.artifactUploadState = artifactUploadState;
|
this.artifactUploadState = artifactUploadState;
|
||||||
this.softwareManagement = softwareManagement;
|
|
||||||
this.swMetadataPopupLayout = swMetadataPopupLayout;
|
|
||||||
|
|
||||||
swmMetadataTable = new SoftwareModuleMetadatadetailslayout();
|
|
||||||
swmMetadataTable.init(getI18n(), getPermissionChecker(), softwareManagement, swMetadataPopupLayout,
|
|
||||||
entityFactory);
|
|
||||||
addTabs(detailsTab);
|
|
||||||
restoreState();
|
restoreState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
|
||||||
void onEvent(final MetadataEvent event) {
|
|
||||||
UI.getCurrent().access(() -> {
|
|
||||||
final MetaData softwareModuleMetadata = event.getMetaData();
|
|
||||||
if (softwareModuleMetadata != null && isSoftwareModuleSelected(event.getModule())) {
|
|
||||||
if (event.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.CREATE_SOFTWARE_MODULE_METADATA) {
|
|
||||||
swmMetadataTable.createMetadata(event.getMetaData().getKey());
|
|
||||||
} else if (event
|
|
||||||
.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.DELETE_SOFTWARE_MODULE_METADATA) {
|
|
||||||
swmMetadataTable.deleteMetadata(event.getMetaData().getKey());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getEditButtonId() {
|
|
||||||
return UIComponentIdProvider.UPLOAD_SW_MODULE_EDIT_BUTTON;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addTabs(final TabSheet detailsTab) {
|
|
||||||
detailsTab.addTab(createDetailsLayout(), getI18n().getMessage("caption.tab.details"), null);
|
|
||||||
detailsTab.addTab(createDescriptionLayout(), getI18n().getMessage("caption.tab.description"), null);
|
|
||||||
detailsTab.addTab(createLogLayout(), getI18n().getMessage("caption.logs.tab"), null);
|
|
||||||
detailsTab.addTab(swmMetadataTable, getI18n().getMessage("caption.metadata"), null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onEdit(final ClickEvent event) {
|
|
||||||
final Window addSoftwareModule = softwareModuleAddUpdateWindow
|
|
||||||
.createUpdateSoftwareModuleWindow(getSelectedBaseEntityId());
|
|
||||||
addSoftwareModule.setCaption(getI18n().getMessage("upload.caption.update.swmodule"));
|
|
||||||
UI.getCurrent().addWindow(addSoftwareModule);
|
|
||||||
addSoftwareModule.setVisible(Boolean.TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void populateDetailsWidget() {
|
|
||||||
if (getSelectedBaseEntity() != null) {
|
|
||||||
String maxAssign;
|
|
||||||
if (getSelectedBaseEntity().getType().getMaxAssignments() == 1) {
|
|
||||||
maxAssign = getI18n().getMessage("label.singleAssign.type");
|
|
||||||
} else {
|
|
||||||
maxAssign = getI18n().getMessage("label.multiAssign.type");
|
|
||||||
}
|
|
||||||
updateSoftwareModuleDetailsLayout(getSelectedBaseEntity().getType().getName(),
|
|
||||||
getSelectedBaseEntity().getVendor(), maxAssign);
|
|
||||||
} else {
|
|
||||||
updateSoftwareModuleDetailsLayout(StringUtils.EMPTY, StringUtils.EMPTY, StringUtils.EMPTY);
|
|
||||||
}
|
|
||||||
populateMetadataDetails();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateSoftwareModuleDetailsLayout(final String type, final String vendor, final String maxAssign) {
|
|
||||||
final VerticalLayout detailsTabLayout = getDetailsLayout();
|
|
||||||
|
|
||||||
detailsTabLayout.removeAllComponents();
|
|
||||||
|
|
||||||
final Label vendorLabel = SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.dist.details.vendor"),
|
|
||||||
HawkbitCommonUtil.trimAndNullIfEmpty(vendor) == null ? "" : vendor);
|
|
||||||
vendorLabel.setId(UIComponentIdProvider.DETAILS_VENDOR_LABEL_ID);
|
|
||||||
detailsTabLayout.addComponent(vendorLabel);
|
|
||||||
|
|
||||||
if (type != null) {
|
|
||||||
final Label typeLabel = SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.dist.details.type"),
|
|
||||||
type);
|
|
||||||
typeLabel.setId(UIComponentIdProvider.DETAILS_TYPE_LABEL_ID);
|
|
||||||
detailsTabLayout.addComponent(typeLabel);
|
|
||||||
}
|
|
||||||
|
|
||||||
final Label assignLabel = SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.assigned.type"),
|
|
||||||
HawkbitCommonUtil.trimAndNullIfEmpty(maxAssign) == null ? "" : maxAssign);
|
|
||||||
assignLabel.setId(UIComponentIdProvider.SWM_DTLS_MAX_ASSIGN);
|
|
||||||
detailsTabLayout.addComponent(assignLabel);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getDefaultCaption() {
|
|
||||||
return getI18n().getMessage("upload.swModuleTable.header");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onLoadIsTableRowSelected() {
|
protected boolean onLoadIsTableRowSelected() {
|
||||||
return artifactUploadState.getSelectedBaseSoftwareModule().isPresent();
|
return artifactUploadState.getSelectedBaseSoftwareModule().isPresent();
|
||||||
@@ -162,47 +48,14 @@ public class SoftwareModuleDetails extends AbstractNamedVersionedEntityTableDeta
|
|||||||
return artifactUploadState.isSwModuleTableMaximized();
|
return artifactUploadState.isSwModuleTableMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
|
||||||
void onEvent(final SoftwareModuleEvent softwareModuleEvent) {
|
|
||||||
onBaseEntityEvent(softwareModuleEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean hasEditPermission() {
|
|
||||||
return getPermissionChecker().hasUpdateDistributionPermission();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTabSheetId() {
|
protected String getTabSheetId() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getDetailsHeaderCaptionId() {
|
protected boolean isSoftwareModuleSelected(final SoftwareModule softwareModule) {
|
||||||
return UIComponentIdProvider.TARGET_DETAILS_HEADER_LABEL_ID;
|
return compareSoftwareModulesById(softwareModule, artifactUploadState.getSelectedBaseSwModuleId().orElse(null));
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void populateMetadataDetails() {
|
|
||||||
swmMetadataTable.populateSMMetadata(getSelectedBaseEntity());
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isSoftwareModuleSelected(final SoftwareModule softwareModule) {
|
|
||||||
final SoftwareModule selectedUploadSWModule = artifactUploadState.getSelectedBaseSoftwareModule().orElse(null);
|
|
||||||
return softwareModule != null && selectedUploadSWModule != null
|
|
||||||
&& selectedUploadSWModule.getName().equals(softwareModule.getName())
|
|
||||||
&& selectedUploadSWModule.getVersion().equals(softwareModule.getVersion());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isMetadataIconToBeDisplayed() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void showMetadata(final ClickEvent event) {
|
|
||||||
softwareManagement.findSoftwareModuleById(getSelectedBaseEntityId())
|
|
||||||
.ifPresent(swmodule -> UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,33 +13,24 @@ 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.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.AbstractTableHeader;
|
import org.eclipse.hawkbit.ui.common.table.AbstractSoftwareModuleTableHeader;
|
||||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
|
||||||
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.vaadin.event.dd.DropHandler;
|
|
||||||
import com.vaadin.ui.Button.ClickEvent;
|
|
||||||
import com.vaadin.ui.UI;
|
|
||||||
import com.vaadin.ui.Window;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Header of Software module table.
|
* Header of Software module table.
|
||||||
*/
|
*/
|
||||||
public class SoftwareModuleTableHeader extends AbstractTableHeader {
|
public class SoftwareModuleTableHeader extends AbstractSoftwareModuleTableHeader {
|
||||||
|
|
||||||
private static final long serialVersionUID = 242961845006626297L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow;
|
SoftwareModuleTableHeader(final VaadinMessageSource i18n, final SpPermissionChecker permChecker,
|
||||||
|
final UIEventBus eventbus, final ArtifactUploadState artifactUploadState,
|
||||||
SoftwareModuleTableHeader(final VaadinMessageSource i18n, final SpPermissionChecker permChecker, final UIEventBus eventbus,
|
|
||||||
final ArtifactUploadState artifactUploadState,
|
|
||||||
final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow) {
|
final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow) {
|
||||||
super(i18n, permChecker, eventbus, null, null, artifactUploadState);
|
super(i18n, permChecker, eventbus, null, null, artifactUploadState, softwareModuleAddUpdateWindow);
|
||||||
this.softwareModuleAddUpdateWindow = softwareModuleAddUpdateWindow;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
@EventBusListenerMethod(scope = EventScope.UI)
|
||||||
@@ -49,59 +40,11 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getHeaderCaption() {
|
|
||||||
return i18n.getMessage("upload.swModuleTable.header");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getSearchBoxId() {
|
|
||||||
return UIComponentIdProvider.SW_MODULE_SEARCH_TEXT_FIELD;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getSearchRestIconId() {
|
|
||||||
return UIComponentIdProvider.SW_MODULE_SEARCH_RESET_ICON;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getAddIconId() {
|
|
||||||
return UIComponentIdProvider.SW_MODULE_ADD_BUTTON;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String onLoadSearchBoxValue() {
|
protected String onLoadSearchBoxValue() {
|
||||||
return artifactUploadState.getSoftwareModuleFilters().getSearchText().orElse(null);
|
return artifactUploadState.getSoftwareModuleFilters().getSearchText().orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getDropFilterId() {
|
|
||||||
/* No dropping on software module table header in Upload View */
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean hasCreatePermission() {
|
|
||||||
return permChecker.hasCreateDistributionPermission();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isDropHintRequired() {
|
|
||||||
/* No dropping on software module table header in Upload View */
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isDropFilterRequired() {
|
|
||||||
/* No dropping on software module table header in Upload View */
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getShowFilterButtonLayoutId() {
|
|
||||||
return "show.type.icon";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void showFilterButtonsLayout() {
|
protected void showFilterButtonsLayout() {
|
||||||
artifactUploadState.setSwTypeFilterClosed(false);
|
artifactUploadState.setSwTypeFilterClosed(false);
|
||||||
@@ -117,11 +60,6 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getMaxMinIconId() {
|
|
||||||
return UIComponentIdProvider.SW_MAX_MIN_TABLE_ICON;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void maximizeTable() {
|
public void maximizeTable() {
|
||||||
artifactUploadState.setSwModuleTableMaximized(Boolean.TRUE);
|
artifactUploadState.setSwModuleTableMaximized(Boolean.TRUE);
|
||||||
@@ -152,50 +90,8 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addNewItem(final ClickEvent event) {
|
protected boolean isDropHintRequired() {
|
||||||
final Window addSoftwareModule = softwareModuleAddUpdateWindow.createAddSoftwareModuleWindow();
|
/* No dropping on software module table header in Upload View */
|
||||||
addSoftwareModule.setCaption(i18n.getMessage("upload.caption.add.new.swmodule"));
|
|
||||||
UI.getCurrent().addWindow(addSoftwareModule);
|
|
||||||
addSoftwareModule.setVisible(Boolean.TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Boolean isAddNewItemAllowed() {
|
|
||||||
return Boolean.TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getFilterIconStyle() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getDropFilterWrapperId() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected DropHandler getDropFilterHandler() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getBulkUploadIconId() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void bulkUpload(final ClickEvent event) {
|
|
||||||
// No implementation as no bulk upload is supported.
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Boolean isBulkUploadAllowed() {
|
|
||||||
return Boolean.FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isBulkUploadInProgress() {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,213 @@
|
|||||||
|
/**
|
||||||
|
* 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.detailslayout;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
|
import org.eclipse.hawkbit.repository.TagManagement;
|
||||||
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
|
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||||
|
import org.eclipse.hawkbit.ui.common.tagdetails.DistributionTagToken;
|
||||||
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
|
import org.eclipse.hawkbit.ui.distributions.dstable.DsMetadataPopupLayout;
|
||||||
|
import org.eclipse.hawkbit.ui.management.dstable.DistributionAddUpdateWindowLayout;
|
||||||
|
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||||
|
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
|
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.EventScope;
|
||||||
|
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||||
|
|
||||||
|
import com.vaadin.ui.Button.ClickEvent;
|
||||||
|
import com.vaadin.ui.Label;
|
||||||
|
import com.vaadin.ui.UI;
|
||||||
|
import com.vaadin.ui.VerticalLayout;
|
||||||
|
import com.vaadin.ui.Window;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class which contains common code for Distribution Set Details
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public abstract class AbstractDistributionSetDetails
|
||||||
|
extends AbstractNamedVersionedEntityTableDetailsLayout<DistributionSet> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private final DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout;
|
||||||
|
|
||||||
|
private final DistributionSetMetadatadetailsLayout dsMetadataTable;
|
||||||
|
|
||||||
|
private final UINotification uiNotification;
|
||||||
|
|
||||||
|
private final transient DistributionSetManagement distributionSetManagement;
|
||||||
|
|
||||||
|
private final DsMetadataPopupLayout dsMetadataPopupLayout;
|
||||||
|
|
||||||
|
private final DistributionTagToken distributionTagToken;
|
||||||
|
|
||||||
|
private final SoftwareModuleDetailsTable softwareModuleDetailsTable;
|
||||||
|
|
||||||
|
private VerticalLayout softwareModuleTab;
|
||||||
|
|
||||||
|
protected AbstractDistributionSetDetails(final VaadinMessageSource i18n, final UIEventBus eventBus,
|
||||||
|
final SpPermissionChecker permissionChecker, final ManagementUIState managementUIState,
|
||||||
|
final DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout,
|
||||||
|
final DistributionSetManagement distributionSetManagement,
|
||||||
|
final DsMetadataPopupLayout dsMetadataPopupLayout, final EntityFactory entityFactory,
|
||||||
|
final UINotification uiNotification, final TagManagement tagManagement,
|
||||||
|
final SoftwareModuleDetailsTable softwareModuleDetailsTable) {
|
||||||
|
super(i18n, eventBus, permissionChecker, managementUIState);
|
||||||
|
this.distributionAddUpdateWindowLayout = distributionAddUpdateWindowLayout;
|
||||||
|
this.uiNotification = uiNotification;
|
||||||
|
this.distributionSetManagement = distributionSetManagement;
|
||||||
|
this.dsMetadataPopupLayout = dsMetadataPopupLayout;
|
||||||
|
this.distributionTagToken = new DistributionTagToken(permissionChecker, i18n, uiNotification, eventBus,
|
||||||
|
managementUIState, tagManagement, distributionSetManagement);
|
||||||
|
this.softwareModuleDetailsTable = softwareModuleDetailsTable;
|
||||||
|
|
||||||
|
dsMetadataTable = new DistributionSetMetadatadetailsLayout(i18n, permissionChecker, distributionSetManagement,
|
||||||
|
dsMetadataPopupLayout, entityFactory, uiNotification);
|
||||||
|
createSoftwareModuleTab();
|
||||||
|
addDetailsTab();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onEdit(final ClickEvent event) {
|
||||||
|
final Window newDistWindow = distributionAddUpdateWindowLayout.getWindow(getSelectedBaseEntityId());
|
||||||
|
newDistWindow.setCaption(getI18n().getMessage(UIComponentIdProvider.DIST_UPDATE_CAPTION));
|
||||||
|
UI.getCurrent().addWindow(newDistWindow);
|
||||||
|
newDistWindow.setVisible(Boolean.TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventBusListenerMethod(scope = EventScope.UI)
|
||||||
|
void onEvent(final DistributionTableEvent distributionTableEvent) {
|
||||||
|
onBaseEntityEvent(distributionTableEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getDefaultCaption() {
|
||||||
|
return getI18n().getMessage("distribution.details.header");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getEditButtonId() {
|
||||||
|
return UIComponentIdProvider.DS_EDIT_BUTTON;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean hasEditPermission() {
|
||||||
|
return getPermissionChecker().hasUpdateDistributionPermission();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTabSheetId() {
|
||||||
|
return UIComponentIdProvider.DISTRIBUTIONSET_DETAILS_TABSHEET_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void populateMetadataDetails() {
|
||||||
|
dsMetadataTable.populateDSMetadata(getSelectedBaseEntity());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getDetailsHeaderCaptionId() {
|
||||||
|
return UIComponentIdProvider.DISTRIBUTION_DETAILS_HEADER_LABEL_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isMetadataIconToBeDisplayed() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void showMetadata(final ClickEvent event) {
|
||||||
|
final Optional<DistributionSet> ds = distributionSetManagement
|
||||||
|
.findDistributionSetById(getSelectedBaseEntityId());
|
||||||
|
if (!ds.isPresent()) {
|
||||||
|
uiNotification.displayWarning(getI18n().getMessage("distributionset.not.exists"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
UI.getCurrent().addWindow(dsMetadataPopupLayout.getWindow(ds.get(), null));
|
||||||
|
}
|
||||||
|
|
||||||
|
private final void addDetailsTab() {
|
||||||
|
getDetailsTab().addTab(getDetailsLayout(), getI18n().getMessage("caption.tab.details"), null);
|
||||||
|
getDetailsTab().addTab(getDescriptionLayout(), getI18n().getMessage("caption.tab.description"), null);
|
||||||
|
getDetailsTab().addTab(softwareModuleTab, getI18n().getMessage("caption.softwares.distdetail.tab"), null);
|
||||||
|
getDetailsTab().addTab(getTagsLayout(), getI18n().getMessage("caption.tags.tab"), null);
|
||||||
|
getDetailsTab().addTab(getLogLayout(), getI18n().getMessage("caption.logs.tab"), null);
|
||||||
|
getDetailsTab().addTab(dsMetadataTable, getI18n().getMessage("caption.metadata"), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void populateDetails() {
|
||||||
|
if (getSelectedBaseEntity() != null) {
|
||||||
|
updateDistributionSetDetailsLayout(getSelectedBaseEntity().getType().getName(),
|
||||||
|
getSelectedBaseEntity().isRequiredMigrationStep());
|
||||||
|
} else {
|
||||||
|
updateDistributionSetDetailsLayout(null, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void populateModule() {
|
||||||
|
softwareModuleDetailsTable.populateModule(getSelectedBaseEntity());
|
||||||
|
}
|
||||||
|
|
||||||
|
private final void createSoftwareModuleTab() {
|
||||||
|
this.softwareModuleTab = createTabLayout();
|
||||||
|
softwareModuleTab.setSizeFull();
|
||||||
|
softwareModuleTab.addComponent(softwareModuleDetailsTable);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateDistributionSetDetailsLayout(final String type, final Boolean isMigrationRequired) {
|
||||||
|
final VerticalLayout detailsTabLayout = getDetailsLayout();
|
||||||
|
detailsTabLayout.removeAllComponents();
|
||||||
|
|
||||||
|
if (type != null) {
|
||||||
|
final Label typeLabel = SPUIComponentProvider
|
||||||
|
.createNameValueLabel(getI18n().getMessage("label.dist.details.type"), type);
|
||||||
|
typeLabel.setId(UIComponentIdProvider.DETAILS_TYPE_LABEL_ID);
|
||||||
|
detailsTabLayout.addComponent(typeLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isMigrationRequired != null) {
|
||||||
|
detailsTabLayout.addComponent(SPUIComponentProvider.createNameValueLabel(
|
||||||
|
getI18n().getMessage("checkbox.dist.migration.required"), isMigrationRequired.equals(Boolean.TRUE)
|
||||||
|
? getI18n().getMessage("label.yes") : getI18n().getMessage("label.no")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected SoftwareModuleDetailsTable getSoftwareModuleTable() {
|
||||||
|
return softwareModuleDetailsTable;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected DistributionAddUpdateWindowLayout getDistributionAddUpdateWindowLayout() {
|
||||||
|
return distributionAddUpdateWindowLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected UINotification getUiNotification() {
|
||||||
|
return uiNotification;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected DistributionSetManagement getDistributionSetManagement() {
|
||||||
|
return distributionSetManagement;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected DsMetadataPopupLayout getDsMetadataPopupLayout() {
|
||||||
|
return dsMetadataPopupLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected DistributionTagToken getDistributionTagToken() {
|
||||||
|
return distributionTagToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,204 @@
|
|||||||
|
/**
|
||||||
|
* 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.detailslayout;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
|
import org.eclipse.hawkbit.repository.model.MetaData;
|
||||||
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
|
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||||
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||||
|
import org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleAddUpdateWindow;
|
||||||
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
|
import org.eclipse.hawkbit.ui.distributions.event.MetadataEvent;
|
||||||
|
import org.eclipse.hawkbit.ui.distributions.smtable.SwMetadataPopupLayout;
|
||||||
|
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
|
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.EventScope;
|
||||||
|
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||||
|
|
||||||
|
import com.vaadin.ui.Button.ClickEvent;
|
||||||
|
import com.vaadin.ui.Label;
|
||||||
|
import com.vaadin.ui.UI;
|
||||||
|
import com.vaadin.ui.VerticalLayout;
|
||||||
|
import com.vaadin.ui.Window;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class which contains common code for Software Module Details
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public abstract class AbstractSoftwareModuleDetails
|
||||||
|
extends AbstractNamedVersionedEntityTableDetailsLayout<SoftwareModule> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private final SoftwareModuleMetadatadetailslayout swmMetadataTable;
|
||||||
|
|
||||||
|
private final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow;
|
||||||
|
|
||||||
|
private final transient SoftwareManagement softwareManagement;
|
||||||
|
|
||||||
|
private final SwMetadataPopupLayout swMetadataPopupLayout;
|
||||||
|
|
||||||
|
protected AbstractSoftwareModuleDetails(final VaadinMessageSource i18n, final UIEventBus eventBus,
|
||||||
|
final SpPermissionChecker permissionChecker, final ManagementUIState managementUIState,
|
||||||
|
final SoftwareManagement softwareManagement, final SwMetadataPopupLayout swMetadataPopupLayout,
|
||||||
|
final EntityFactory entityFactory, final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow) {
|
||||||
|
super(i18n, eventBus, permissionChecker, managementUIState);
|
||||||
|
this.softwareModuleAddUpdateWindow = softwareModuleAddUpdateWindow;
|
||||||
|
this.softwareManagement = softwareManagement;
|
||||||
|
this.swMetadataPopupLayout = swMetadataPopupLayout;
|
||||||
|
|
||||||
|
swmMetadataTable = new SoftwareModuleMetadatadetailslayout();
|
||||||
|
swmMetadataTable.init(getI18n(), getPermissionChecker(), softwareManagement, swMetadataPopupLayout,
|
||||||
|
entityFactory);
|
||||||
|
|
||||||
|
addDetailsTab();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MetadataEvent.
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
* as instance of {@link MetadataEvent}
|
||||||
|
*/
|
||||||
|
@EventBusListenerMethod(scope = EventScope.UI)
|
||||||
|
void onEvent(final MetadataEvent event) {
|
||||||
|
UI.getCurrent().access(() -> {
|
||||||
|
final MetaData softwareModuleMetadata = event.getMetaData();
|
||||||
|
if (softwareModuleMetadata == null || !isSoftwareModuleSelected(event.getModule())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (event.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.CREATE_SOFTWARE_MODULE_METADATA) {
|
||||||
|
swmMetadataTable.createMetadata(event.getMetaData().getKey());
|
||||||
|
} else if (event.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.DELETE_SOFTWARE_MODULE_METADATA) {
|
||||||
|
swmMetadataTable.deleteMetadata(event.getMetaData().getKey());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventBusListenerMethod(scope = EventScope.UI)
|
||||||
|
void onEvent(final SoftwareModuleEvent softwareModuleEvent) {
|
||||||
|
onBaseEntityEvent(softwareModuleEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final void addDetailsTab() {
|
||||||
|
getDetailsTab().addTab(getDetailsLayout(), getI18n().getMessage("caption.tab.details"), null);
|
||||||
|
getDetailsTab().addTab(getDescriptionLayout(), getI18n().getMessage("caption.tab.description"), null);
|
||||||
|
getDetailsTab().addTab(getLogLayout(), getI18n().getMessage("caption.logs.tab"), null);
|
||||||
|
getDetailsTab().addTab(swmMetadataTable, getI18n().getMessage("caption.metadata"), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void populateMetadataDetails() {
|
||||||
|
swmMetadataTable.populateSMMetadata(getSelectedBaseEntity());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onEdit(final ClickEvent event) {
|
||||||
|
final Window addSoftwareModule = softwareModuleAddUpdateWindow
|
||||||
|
.createUpdateSoftwareModuleWindow(getSelectedBaseEntityId());
|
||||||
|
addSoftwareModule.setCaption(getI18n().getMessage("upload.caption.update.swmodule"));
|
||||||
|
UI.getCurrent().addWindow(addSoftwareModule);
|
||||||
|
addSoftwareModule.setVisible(Boolean.TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getEditButtonId() {
|
||||||
|
return UIComponentIdProvider.UPLOAD_SW_MODULE_EDIT_BUTTON;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getDefaultCaption() {
|
||||||
|
return getI18n().getMessage("upload.swModuleTable.header");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean hasEditPermission() {
|
||||||
|
return getPermissionChecker().hasUpdateDistributionPermission();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getDetailsHeaderCaptionId() {
|
||||||
|
return UIComponentIdProvider.TARGET_DETAILS_HEADER_LABEL_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isMetadataIconToBeDisplayed() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void showMetadata(final ClickEvent event) {
|
||||||
|
softwareManagement.findSoftwareModuleById(getSelectedBaseEntityId())
|
||||||
|
.ifPresent(swmodule -> UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null)));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void updateSoftwareModuleDetailsLayout(final String type, final String vendor, final String maxAssign) {
|
||||||
|
final VerticalLayout detailsTabLayout = getDetailsLayout();
|
||||||
|
|
||||||
|
detailsTabLayout.removeAllComponents();
|
||||||
|
|
||||||
|
final Label vendorLabel = SPUIComponentProvider.createNameValueLabel(
|
||||||
|
getI18n().getMessage("label.dist.details.vendor"),
|
||||||
|
HawkbitCommonUtil.trimAndNullIfEmpty(vendor) == null ? "" : vendor);
|
||||||
|
vendorLabel.setId(UIComponentIdProvider.DETAILS_VENDOR_LABEL_ID);
|
||||||
|
detailsTabLayout.addComponent(vendorLabel);
|
||||||
|
|
||||||
|
if (type != null) {
|
||||||
|
final Label typeLabel = SPUIComponentProvider
|
||||||
|
.createNameValueLabel(getI18n().getMessage("label.dist.details.type"), type);
|
||||||
|
typeLabel.setId(UIComponentIdProvider.DETAILS_TYPE_LABEL_ID);
|
||||||
|
detailsTabLayout.addComponent(typeLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
final Label assignLabel = SPUIComponentProvider.createNameValueLabel(
|
||||||
|
getI18n().getMessage("label.assigned.type"),
|
||||||
|
HawkbitCommonUtil.trimAndNullIfEmpty(maxAssign) == null ? "" : maxAssign);
|
||||||
|
assignLabel.setId(UIComponentIdProvider.SWM_DTLS_MAX_ASSIGN);
|
||||||
|
detailsTabLayout.addComponent(assignLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void populateDetailsWidget() {
|
||||||
|
populateDetails();
|
||||||
|
populateMetadataDetails();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean compareSoftwareModulesById(final SoftwareModule softwareModule,
|
||||||
|
final Long selectedBaseSwModuleId) {
|
||||||
|
if (softwareModule == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return softwareModule.getId().equals(selectedBaseSwModuleId);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract boolean isSoftwareModuleSelected(SoftwareModule softwareModule);
|
||||||
|
|
||||||
|
private void populateDetails() {
|
||||||
|
if (getSelectedBaseEntity() != null) {
|
||||||
|
String maxAssign;
|
||||||
|
if (getSelectedBaseEntity().getType().getMaxAssignments() == 1) {
|
||||||
|
maxAssign = getI18n().getMessage("label.singleAssign.type");
|
||||||
|
} else {
|
||||||
|
maxAssign = getI18n().getMessage("label.multiAssign.type");
|
||||||
|
}
|
||||||
|
updateSoftwareModuleDetailsLayout(getSelectedBaseEntity().getType().getName(),
|
||||||
|
getSelectedBaseEntity().getVendor(), maxAssign);
|
||||||
|
} else {
|
||||||
|
updateSoftwareModuleDetailsLayout(StringUtils.EMPTY, StringUtils.EMPTY, StringUtils.EMPTY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -16,14 +16,15 @@ import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
|||||||
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
|
import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
|
||||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.common.table.BaseUIEntityEvent;
|
import org.eclipse.hawkbit.ui.common.table.BaseUIEntityEvent;
|
||||||
|
import org.eclipse.hawkbit.ui.common.tagdetails.AbstractTagToken;
|
||||||
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.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.SPDateTimeUtil;
|
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||||
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 com.vaadin.server.FontAwesome;
|
import com.vaadin.server.FontAwesome;
|
||||||
@@ -56,7 +57,7 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
|
|||||||
|
|
||||||
private Button manageMetadataBtn;
|
private Button manageMetadataBtn;
|
||||||
|
|
||||||
protected TabSheet detailsTab;
|
private TabSheet detailsTab;
|
||||||
|
|
||||||
private final VerticalLayout detailsLayout;
|
private final VerticalLayout detailsLayout;
|
||||||
|
|
||||||
@@ -66,22 +67,35 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
|
|||||||
|
|
||||||
private final VerticalLayout attributesLayout;
|
private final VerticalLayout attributesLayout;
|
||||||
|
|
||||||
protected final ManagementUIState managementUIState;
|
private final VerticalLayout tagsLayout;
|
||||||
|
|
||||||
|
private final ManagementUIState managementUIState;
|
||||||
|
|
||||||
protected AbstractTableDetailsLayout(final VaadinMessageSource i18n, final UIEventBus eventBus,
|
protected AbstractTableDetailsLayout(final VaadinMessageSource i18n, final UIEventBus eventBus,
|
||||||
final SpPermissionChecker permissionChecker, final ManagementUIState managementUIState) {
|
final SpPermissionChecker permissionChecker, final ManagementUIState managementUIState) {
|
||||||
this.i18n = i18n;
|
this.i18n = i18n;
|
||||||
this.permissionChecker = permissionChecker;
|
this.permissionChecker = permissionChecker;
|
||||||
this.managementUIState = managementUIState;
|
this.managementUIState = managementUIState;
|
||||||
detailsLayout = getTabLayout();
|
detailsLayout = createTabLayout();
|
||||||
descriptionLayout = getTabLayout();
|
descriptionLayout = createTabLayout();
|
||||||
logLayout = getTabLayout();
|
logLayout = createTabLayout();
|
||||||
attributesLayout = getTabLayout();
|
attributesLayout = createTabLayout();
|
||||||
|
tagsLayout = createTabLayout();
|
||||||
createComponents();
|
createComponents();
|
||||||
buildLayout();
|
buildLayout();
|
||||||
eventBus.subscribe(this);
|
eventBus.subscribe(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSelectedBaseEntity(final T selectedBaseEntity) {
|
||||||
|
this.selectedBaseEntity = selectedBaseEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final VerticalLayout createTabLayout() {
|
||||||
|
final VerticalLayout tabLayout = SPUIComponentProvider.getDetailTabLayout();
|
||||||
|
tabLayout.addStyleName("details-layout");
|
||||||
|
return tabLayout;
|
||||||
|
}
|
||||||
|
|
||||||
protected SpPermissionChecker getPermissionChecker() {
|
protected SpPermissionChecker getPermissionChecker() {
|
||||||
return permissionChecker;
|
return permissionChecker;
|
||||||
}
|
}
|
||||||
@@ -94,10 +108,6 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
|
|||||||
return selectedBaseEntity;
|
return selectedBaseEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSelectedBaseEntity(final T selectedBaseEntity) {
|
|
||||||
this.selectedBaseEntity = selectedBaseEntity;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default implementation to handle an entity event.
|
* Default implementation to handle an entity event.
|
||||||
*
|
*
|
||||||
@@ -115,6 +125,105 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void setName(final String headerCaption, final String value) {
|
||||||
|
caption.setValue(HawkbitCommonUtil.getSoftwareModuleName(headerCaption, value));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void restoreState() {
|
||||||
|
if (onLoadIsTableRowSelected()) {
|
||||||
|
populateData(null);
|
||||||
|
editButton.setEnabled(true);
|
||||||
|
}
|
||||||
|
if (onLoadIsTableMaximized()) {
|
||||||
|
setVisible(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void populateTags(final AbstractTagToken<?> tagToken) {
|
||||||
|
getTagsLayout().removeAllComponents();
|
||||||
|
if (getSelectedBaseEntity() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
getTagsLayout().addComponent(tagToken.getTokenField());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void populateLog() {
|
||||||
|
logLayout.removeAllComponents();
|
||||||
|
|
||||||
|
logLayout.addComponent(SPUIComponentProvider.createNameValueLabel(i18n.getMessage("label.created.at"),
|
||||||
|
SPDateTimeUtil.formatCreatedAt(selectedBaseEntity)));
|
||||||
|
|
||||||
|
logLayout.addComponent(SPUIComponentProvider.createCreatedByLabel(i18n, selectedBaseEntity));
|
||||||
|
|
||||||
|
if (selectedBaseEntity == null || selectedBaseEntity.getLastModifiedAt() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
logLayout.addComponent(SPUIComponentProvider.createNameValueLabel(i18n.getMessage("label.modified.date"),
|
||||||
|
SPDateTimeUtil.formatLastModifiedAt(selectedBaseEntity)));
|
||||||
|
|
||||||
|
logLayout.addComponent(SPUIComponentProvider.createLastModifiedByLabel(i18n, selectedBaseEntity));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void updateDescriptionLayout(final String descriptionLabel, final String description) {
|
||||||
|
descriptionLayout.removeAllComponents();
|
||||||
|
final Label descLabel = SPUIComponentProvider.createNameValueLabel(descriptionLabel,
|
||||||
|
HawkbitCommonUtil.trimAndNullIfEmpty(description) == null ? "" : description);
|
||||||
|
/**
|
||||||
|
* By default text will be truncated based on layout width .so removing
|
||||||
|
* it as we need full description.
|
||||||
|
*/
|
||||||
|
descLabel.removeStyleName("label-style");
|
||||||
|
descLabel.setId(UIComponentIdProvider.DETAILS_DESCRIPTION_LABEL_ID);
|
||||||
|
descriptionLayout.addComponent(descLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* display Attributes details in Target details.
|
||||||
|
*/
|
||||||
|
protected void updateAttributesLayout(final Map<String, String> attributes) {
|
||||||
|
if (null != attributes) {
|
||||||
|
attributesLayout.removeAllComponents();
|
||||||
|
for (final Map.Entry<String, String> entry : attributes.entrySet()) {
|
||||||
|
final Label conAttributeLabel = SPUIComponentProvider.createNameValueLabel(
|
||||||
|
entry.getKey().concat(" : "),
|
||||||
|
HawkbitCommonUtil.trimAndNullIfEmpty(entry.getValue()) == null ? "" : entry.getValue());
|
||||||
|
conAttributeLabel.setDescription(entry.getKey().concat(" : ") + entry.getValue());
|
||||||
|
conAttributeLabel.addStyleName("label-style");
|
||||||
|
attributesLayout.addComponent(conAttributeLabel);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected VerticalLayout getLogLayout() {
|
||||||
|
return logLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected VerticalLayout getAttributesLayout() {
|
||||||
|
return attributesLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected VerticalLayout getDescriptionLayout() {
|
||||||
|
return descriptionLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected VerticalLayout getDetailsLayout() {
|
||||||
|
return detailsLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected VerticalLayout getTagsLayout() {
|
||||||
|
return tagsLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected TabSheet getDetailsTab() {
|
||||||
|
return detailsTab;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ManagementUIState getManagementUIState() {
|
||||||
|
return managementUIState;
|
||||||
|
}
|
||||||
|
|
||||||
private void createComponents() {
|
private void createComponents() {
|
||||||
caption = createHeaderCaption();
|
caption = createHeaderCaption();
|
||||||
caption.setImmediate(true);
|
caption.setImmediate(true);
|
||||||
@@ -172,26 +281,6 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
|
|||||||
return new LabelBuilder().name(getDefaultCaption()).buildCaptionLabel();
|
return new LabelBuilder().name(getDefaultCaption()).buildCaptionLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected VerticalLayout getTabLayout() {
|
|
||||||
final VerticalLayout tabLayout = SPUIComponentProvider.getDetailTabLayout();
|
|
||||||
tabLayout.addStyleName("details-layout");
|
|
||||||
return tabLayout;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setName(final String headerCaption, final String value) {
|
|
||||||
caption.setValue(HawkbitCommonUtil.getSoftwareModuleName(headerCaption, value));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void restoreState() {
|
|
||||||
if (onLoadIsTableRowSelected()) {
|
|
||||||
populateData(null);
|
|
||||||
editButton.setEnabled(true);
|
|
||||||
}
|
|
||||||
if (onLoadIsTableMaximized()) {
|
|
||||||
setVisible(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If no data in table (i,e no row selected),then disable the edit button.
|
* If no data in table (i,e no row selected),then disable the edit button.
|
||||||
* If row is selected ,enable edit button.
|
* If row is selected ,enable edit button.
|
||||||
@@ -210,70 +299,21 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
|
|||||||
populateDetailsWidget();
|
populateDetailsWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void populateLog() {
|
private void populateDescription() {
|
||||||
logLayout.removeAllComponents();
|
if (selectedBaseEntity != null) {
|
||||||
|
updateDescriptionLayout(i18n.getMessage("label.description"), selectedBaseEntity.getDescription());
|
||||||
logLayout.addComponent(SPUIComponentProvider.createNameValueLabel(i18n.getMessage("label.created.at"),
|
} else {
|
||||||
SPDateTimeUtil.formatCreatedAt(selectedBaseEntity)));
|
updateDescriptionLayout(i18n.getMessage("label.description"), null);
|
||||||
|
|
||||||
logLayout.addComponent(SPUIComponentProvider.createCreatedByLabel(i18n, selectedBaseEntity));
|
|
||||||
|
|
||||||
if (selectedBaseEntity == null || selectedBaseEntity.getLastModifiedAt() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
logLayout.addComponent(SPUIComponentProvider.createNameValueLabel(i18n.getMessage("label.modified.date"),
|
|
||||||
SPDateTimeUtil.formatLastModifiedAt(selectedBaseEntity)));
|
|
||||||
|
|
||||||
logLayout.addComponent(SPUIComponentProvider.createLastModifiedByLabel(i18n, selectedBaseEntity));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void updateDescriptionLayout(final String descriptionLabel, final String description) {
|
|
||||||
descriptionLayout.removeAllComponents();
|
|
||||||
final Label descLabel = SPUIComponentProvider.createNameValueLabel(descriptionLabel,
|
|
||||||
HawkbitCommonUtil.trimAndNullIfEmpty(description) == null ? "" : description);
|
|
||||||
/**
|
|
||||||
* By default text will be truncated based on layout width .so removing
|
|
||||||
* it as we need full description.
|
|
||||||
*/
|
|
||||||
descLabel.removeStyleName("label-style");
|
|
||||||
descLabel.setId(UIComponentIdProvider.DETAILS_DESCRIPTION_LABEL_ID);
|
|
||||||
descriptionLayout.addComponent(descLabel);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* display Attributes details in Target details.
|
|
||||||
*/
|
|
||||||
protected void updateAttributesLayout(final Map<String, String> attributes) {
|
|
||||||
if (null != attributes) {
|
|
||||||
attributesLayout.removeAllComponents();
|
|
||||||
for (final Map.Entry<String, String> entry : attributes.entrySet()) {
|
|
||||||
final Label conAttributeLabel = SPUIComponentProvider.createNameValueLabel(
|
|
||||||
entry.getKey().concat(" : "),
|
|
||||||
HawkbitCommonUtil.trimAndNullIfEmpty(entry.getValue()) == null ? "" : entry.getValue());
|
|
||||||
conAttributeLabel.setDescription(entry.getKey().concat(" : ") + entry.getValue());
|
|
||||||
conAttributeLabel.addStyleName("label-style");
|
|
||||||
attributesLayout.addComponent(conAttributeLabel);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected VerticalLayout createLogLayout() {
|
protected Long getSelectedBaseEntityId() {
|
||||||
return logLayout;
|
return selectedBaseEntity == null ? null : selectedBaseEntity.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected VerticalLayout createAttributesLayout() {
|
protected abstract void populateDetailsWidget();
|
||||||
return attributesLayout;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected VerticalLayout createDetailsLayout() {
|
protected abstract void populateMetadataDetails();
|
||||||
return detailsLayout;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected VerticalLayout createDescriptionLayout() {
|
|
||||||
return descriptionLayout;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default caption of header to be displayed when no data row selected in
|
* Default caption of header to be displayed when no data row selected in
|
||||||
@@ -283,13 +323,6 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
|
|||||||
*/
|
*/
|
||||||
protected abstract String getDefaultCaption();
|
protected abstract String getDefaultCaption();
|
||||||
|
|
||||||
/**
|
|
||||||
* Add tabs.
|
|
||||||
*
|
|
||||||
* @param detailsTab
|
|
||||||
*/
|
|
||||||
protected abstract void addTabs(final TabSheet detailsTab);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Click listener for edit button.
|
* Click listener for edit button.
|
||||||
*
|
*
|
||||||
@@ -307,26 +340,6 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
|
|||||||
|
|
||||||
protected abstract boolean hasEditPermission();
|
protected abstract boolean hasEditPermission();
|
||||||
|
|
||||||
public VerticalLayout getDetailsLayout() {
|
|
||||||
return detailsLayout;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void populateDescription() {
|
|
||||||
if (selectedBaseEntity != null) {
|
|
||||||
updateDescriptionLayout(i18n.getMessage("label.description"), selectedBaseEntity.getDescription());
|
|
||||||
} else {
|
|
||||||
updateDescriptionLayout(i18n.getMessage("label.description"), null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract void populateDetailsWidget();
|
|
||||||
|
|
||||||
protected abstract void populateMetadataDetails();
|
|
||||||
|
|
||||||
protected Long getSelectedBaseEntityId() {
|
|
||||||
return selectedBaseEntity == null ? null : selectedBaseEntity.getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract String getDetailsHeaderCaptionId();
|
protected abstract String getDetailsHeaderCaptionId();
|
||||||
|
|
||||||
protected abstract String getName();
|
protected abstract String getName();
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||||
*
|
*
|
||||||
@@ -19,10 +20,10 @@ import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
|||||||
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.distributions.dstable.DsMetadataPopupLayout;
|
import org.eclipse.hawkbit.ui.distributions.dstable.DsMetadataPopupLayout;
|
||||||
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.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 com.vaadin.data.Item;
|
import com.vaadin.data.Item;
|
||||||
@@ -37,7 +38,7 @@ import com.vaadin.ui.themes.ValoTheme;
|
|||||||
* DistributionSet Metadata details layout.
|
* DistributionSet Metadata details layout.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DistributionSetMetadatadetailslayout extends Table {
|
public class DistributionSetMetadatadetailsLayout extends Table {
|
||||||
|
|
||||||
private static final long serialVersionUID = 2913758299611837718L;
|
private static final long serialVersionUID = 2913758299611837718L;
|
||||||
|
|
||||||
@@ -59,8 +60,8 @@ public class DistributionSetMetadatadetailslayout extends Table {
|
|||||||
|
|
||||||
private final UINotification notification;
|
private final UINotification notification;
|
||||||
|
|
||||||
public DistributionSetMetadatadetailslayout(final VaadinMessageSource i18n, final SpPermissionChecker permissionChecker,
|
public DistributionSetMetadatadetailsLayout(final VaadinMessageSource i18n,
|
||||||
final DistributionSetManagement distributionSetManagement,
|
final SpPermissionChecker permissionChecker, final DistributionSetManagement distributionSetManagement,
|
||||||
final DsMetadataPopupLayout dsMetadataPopupLayout, final EntityFactory entityFactory,
|
final DsMetadataPopupLayout dsMetadataPopupLayout, final EntityFactory entityFactory,
|
||||||
final UINotification notification) {
|
final UINotification notification) {
|
||||||
this.i18n = i18n;
|
this.i18n = i18n;
|
||||||
@@ -144,7 +144,7 @@ public class SoftwareModuleDetailsTable extends Table {
|
|||||||
*/
|
*/
|
||||||
public void populateModule(final DistributionSet distributionSet) {
|
public void populateModule(final DistributionSet distributionSet) {
|
||||||
removeAllItems();
|
removeAllItems();
|
||||||
if (null != distributionSet) {
|
if (distributionSet != null) {
|
||||||
if (isUnassignSoftModAllowed && permissionChecker.hasUpdateDistributionPermission()) {
|
if (isUnassignSoftModAllowed && permissionChecker.hasUpdateDistributionPermission()) {
|
||||||
try {
|
try {
|
||||||
isTargetAssigned = false;
|
isTargetAssigned = false;
|
||||||
@@ -157,10 +157,10 @@ public class SoftwareModuleDetailsTable extends Table {
|
|||||||
final Set<SoftwareModuleType> swModuleMandatoryTypes = distributionSet.getType().getMandatoryModuleTypes();
|
final Set<SoftwareModuleType> swModuleMandatoryTypes = distributionSet.getType().getMandatoryModuleTypes();
|
||||||
final Set<SoftwareModuleType> swModuleOptionalTypes = distributionSet.getType().getOptionalModuleTypes();
|
final Set<SoftwareModuleType> swModuleOptionalTypes = distributionSet.getType().getOptionalModuleTypes();
|
||||||
|
|
||||||
if (null != swModuleMandatoryTypes && !swModuleMandatoryTypes.isEmpty()) {
|
if (swModuleMandatoryTypes != null && !swModuleMandatoryTypes.isEmpty()) {
|
||||||
swModuleMandatoryTypes.forEach(swModule -> setSwModuleProperties(swModule, true, distributionSet));
|
swModuleMandatoryTypes.forEach(swModule -> setSwModuleProperties(swModule, true, distributionSet));
|
||||||
}
|
}
|
||||||
if (null != swModuleOptionalTypes && !swModuleOptionalTypes.isEmpty()) {
|
if (swModuleOptionalTypes != null && !swModuleOptionalTypes.isEmpty()) {
|
||||||
swModuleOptionalTypes.forEach(swModule -> setSwModuleProperties(swModule, false, distributionSet));
|
swModuleOptionalTypes.forEach(swModule -> setSwModuleProperties(swModule, false, distributionSet));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,123 @@
|
|||||||
|
/**
|
||||||
|
* 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.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||||
|
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||||
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
|
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
|
|
||||||
|
import com.vaadin.event.dd.DropHandler;
|
||||||
|
import com.vaadin.ui.Button.ClickEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class which contains common method implementations for the header of
|
||||||
|
* Distribution Set Table elements
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public abstract class AbstractDistributionSetTableHeader extends AbstractTableHeader {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
protected AbstractDistributionSetTableHeader(final VaadinMessageSource i18n, final SpPermissionChecker permChecker,
|
||||||
|
final UIEventBus eventbus, final ManagementUIState managementUIState,
|
||||||
|
final ManageDistUIState manageDistUIstate, final ArtifactUploadState artifactUploadState) {
|
||||||
|
super(i18n, permChecker, eventbus, managementUIState, manageDistUIstate, artifactUploadState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getHeaderCaption() {
|
||||||
|
return i18n.getMessage("header.dist.table");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getSearchBoxId() {
|
||||||
|
return UIComponentIdProvider.DIST_SEARCH_TEXTFIELD;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getSearchRestIconId() {
|
||||||
|
return UIComponentIdProvider.DIST_SEARCH_ICON;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getAddIconId() {
|
||||||
|
return UIComponentIdProvider.DIST_ADD_ICON;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isDropHintRequired() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean hasCreatePermission() {
|
||||||
|
return permChecker.hasCreateDistributionPermission();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getShowFilterButtonLayoutId() {
|
||||||
|
return UIComponentIdProvider.SHOW_DIST_TAG_ICON;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMaxMinIconId() {
|
||||||
|
return UIComponentIdProvider.DS_MAX_MIN_TABLE_ICON;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getBulkUploadIconId() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Boolean isBulkUploadAllowed() {
|
||||||
|
return Boolean.FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void bulkUpload(final ClickEvent event) {
|
||||||
|
// No implementation as no bulk upload is supported except for
|
||||||
|
// targetTable.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isBulkUploadInProgress() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getDropFilterId() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getFilterIconStyle() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getDropFilterWrapperId() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected DropHandler getDropFilterHandler() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isDropFilterRequired() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,143 @@
|
|||||||
|
/**
|
||||||
|
* 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.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||||
|
import org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleAddUpdateWindow;
|
||||||
|
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||||
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
|
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
|
|
||||||
|
import com.vaadin.event.dd.DropHandler;
|
||||||
|
import com.vaadin.ui.Button.ClickEvent;
|
||||||
|
import com.vaadin.ui.UI;
|
||||||
|
import com.vaadin.ui.Window;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class which contains common method implementations for the header of
|
||||||
|
* Software Module Table elements
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public abstract class AbstractSoftwareModuleTableHeader extends AbstractTableHeader {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow;
|
||||||
|
|
||||||
|
protected AbstractSoftwareModuleTableHeader(final VaadinMessageSource i18n, final SpPermissionChecker permChecker,
|
||||||
|
final UIEventBus eventbus, final ManagementUIState managementUIState,
|
||||||
|
final ManageDistUIState manageDistUIstate, final ArtifactUploadState artifactUploadState,
|
||||||
|
final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow) {
|
||||||
|
super(i18n, permChecker, eventbus, managementUIState, manageDistUIstate, artifactUploadState);
|
||||||
|
this.softwareModuleAddUpdateWindow = softwareModuleAddUpdateWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getHeaderCaption() {
|
||||||
|
return i18n.getMessage("upload.swModuleTable.header");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getSearchBoxId() {
|
||||||
|
return UIComponentIdProvider.SW_MODULE_SEARCH_TEXT_FIELD;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getSearchRestIconId() {
|
||||||
|
return UIComponentIdProvider.SW_MODULE_SEARCH_RESET_ICON;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getAddIconId() {
|
||||||
|
return UIComponentIdProvider.SW_MODULE_ADD_BUTTON;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getShowFilterButtonLayoutId() {
|
||||||
|
return "show.type.icon";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMaxMinIconId() {
|
||||||
|
return UIComponentIdProvider.SW_MAX_MIN_TABLE_ICON;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Boolean isAddNewItemAllowed() {
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addNewItem(final ClickEvent event) {
|
||||||
|
final Window addSoftwareModule = softwareModuleAddUpdateWindow.createAddSoftwareModuleWindow();
|
||||||
|
addSoftwareModule.setCaption(i18n.getMessage("upload.caption.add.new.swmodule"));
|
||||||
|
UI.getCurrent().addWindow(addSoftwareModule);
|
||||||
|
addSoftwareModule.setVisible(Boolean.TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean hasCreatePermission() {
|
||||||
|
return permChecker.hasCreateDistributionPermission();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getBulkUploadIconId() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Boolean isBulkUploadAllowed() {
|
||||||
|
return Boolean.FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void bulkUpload(final ClickEvent event) {
|
||||||
|
// No implementation as no bulk upload is supported except for
|
||||||
|
// targetTable.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isBulkUploadInProgress() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getDropFilterId() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getFilterIconStyle() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getDropFilterWrapperId() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected DropHandler getDropFilterHandler() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isDropFilterRequired() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isDropHintRequired() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -28,6 +28,7 @@ import com.vaadin.event.dd.DropHandler;
|
|||||||
import com.vaadin.server.FontAwesome;
|
import com.vaadin.server.FontAwesome;
|
||||||
import com.vaadin.ui.Alignment;
|
import com.vaadin.ui.Alignment;
|
||||||
import com.vaadin.ui.Button;
|
import com.vaadin.ui.Button;
|
||||||
|
import com.vaadin.ui.Button.ClickEvent;
|
||||||
import com.vaadin.ui.DragAndDropWrapper;
|
import com.vaadin.ui.DragAndDropWrapper;
|
||||||
import com.vaadin.ui.HorizontalLayout;
|
import com.vaadin.ui.HorizontalLayout;
|
||||||
import com.vaadin.ui.Label;
|
import com.vaadin.ui.Label;
|
||||||
@@ -360,6 +361,84 @@ public abstract class AbstractTableHeader extends VerticalLayout {
|
|||||||
searchResetIcon.setEnabled(true);
|
searchResetIcon.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Id value of the drop filter in the table header.
|
||||||
|
*
|
||||||
|
* @return Id of the drop filter if filter is displayed, otherwise returns
|
||||||
|
* null.
|
||||||
|
*/
|
||||||
|
protected abstract String getDropFilterId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get style of the filter Icon.
|
||||||
|
*
|
||||||
|
* @return style of the filter Icon
|
||||||
|
*/
|
||||||
|
protected abstract String getFilterIconStyle();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Id value of the drop filter wrapper in the table header.
|
||||||
|
*
|
||||||
|
* @return Id of the drop filter if filter is displayed, otherwise returns
|
||||||
|
* null.
|
||||||
|
*/
|
||||||
|
protected abstract String getDropFilterWrapperId();
|
||||||
|
|
||||||
|
protected abstract DropHandler getDropFilterHandler();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if drop hits required to display and user has permissions for that.
|
||||||
|
*
|
||||||
|
* @return true if drop hits should be displayed and user has permission,
|
||||||
|
* otherwise false.
|
||||||
|
*/
|
||||||
|
protected abstract boolean isDropHintRequired();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if drop filter is required.
|
||||||
|
*
|
||||||
|
* @return true if drop filter is required to display, otherwise return
|
||||||
|
* false.
|
||||||
|
*/
|
||||||
|
protected abstract boolean isDropFilterRequired();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the creation of a new item is allowed. Default is true.
|
||||||
|
*
|
||||||
|
* @return true if the creation of a new item is allowed, otherwise returns
|
||||||
|
* false.
|
||||||
|
*/
|
||||||
|
protected abstract Boolean isAddNewItemAllowed();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Id of bulk upload Icon.
|
||||||
|
*
|
||||||
|
* @return String of bulk upload Icon.
|
||||||
|
*/
|
||||||
|
protected abstract String getBulkUploadIconId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the flag if bulk upload is allowed. Default is false
|
||||||
|
*
|
||||||
|
* @return true if bulk upload is allowed, otherwise returns false.
|
||||||
|
*/
|
||||||
|
protected abstract Boolean isBulkUploadAllowed();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if bulk upload is in progress. Default is false.
|
||||||
|
*
|
||||||
|
* @return true if bulk upload is in progress, otherwise returns false.
|
||||||
|
*/
|
||||||
|
protected abstract boolean isBulkUploadInProgress();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs the bulk upload
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
* Event of type ClickEvent
|
||||||
|
*/
|
||||||
|
protected abstract void bulkUpload(final ClickEvent event);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the title of the table.
|
* Get the title of the table.
|
||||||
*
|
*
|
||||||
@@ -388,13 +467,6 @@ public abstract class AbstractTableHeader extends VerticalLayout {
|
|||||||
*/
|
*/
|
||||||
protected abstract String getAddIconId();
|
protected abstract String getAddIconId();
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Id of bulk upload Icon.
|
|
||||||
*
|
|
||||||
* @return String of bulk upload Icon.
|
|
||||||
*/
|
|
||||||
protected abstract String getBulkUploadIconId();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get search box on load text value.
|
* Get search box on load text value.
|
||||||
*
|
*
|
||||||
@@ -402,29 +474,6 @@ public abstract class AbstractTableHeader extends VerticalLayout {
|
|||||||
*/
|
*/
|
||||||
protected abstract String onLoadSearchBoxValue();
|
protected abstract String onLoadSearchBoxValue();
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Id value of the drop filter in the table header.
|
|
||||||
*
|
|
||||||
* @return Id of the drop filter if filter is displayed, otherwise returns
|
|
||||||
* null.
|
|
||||||
*/
|
|
||||||
protected abstract String getDropFilterId();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get style of the filter Icon.
|
|
||||||
*
|
|
||||||
* @return style of the filter Icon
|
|
||||||
*/
|
|
||||||
protected abstract String getFilterIconStyle();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Id value of the drop filter wrapper in the table header.
|
|
||||||
*
|
|
||||||
* @return Id of the drop filter if filter is displayed, otherwise returns
|
|
||||||
* null.
|
|
||||||
*/
|
|
||||||
protected abstract String getDropFilterWrapperId();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if logged in user has create permission..
|
* Check if logged in user has create permission..
|
||||||
*
|
*
|
||||||
@@ -432,22 +481,6 @@ public abstract class AbstractTableHeader extends VerticalLayout {
|
|||||||
*/
|
*/
|
||||||
protected abstract boolean hasCreatePermission();
|
protected abstract boolean hasCreatePermission();
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if drop hits required to display and user has permissions for that.
|
|
||||||
*
|
|
||||||
* @return true if drop hits should be displayed and user has permission,
|
|
||||||
* otherwise false.
|
|
||||||
*/
|
|
||||||
protected abstract boolean isDropHintRequired();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if drop filter is required.
|
|
||||||
*
|
|
||||||
* @return true if drop filter is required to display, otherwise return
|
|
||||||
* false.
|
|
||||||
*/
|
|
||||||
protected abstract boolean isDropFilterRequired();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Id of the show filter buttons layout.
|
* Get Id of the show filter buttons layout.
|
||||||
*
|
*
|
||||||
@@ -491,8 +524,6 @@ public abstract class AbstractTableHeader extends VerticalLayout {
|
|||||||
*/
|
*/
|
||||||
public abstract Boolean onLoadIsTableMaximized();
|
public abstract Boolean onLoadIsTableMaximized();
|
||||||
|
|
||||||
protected abstract DropHandler getDropFilterHandler();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On load show filter button is displayed.
|
* On load show filter button is displayed.
|
||||||
*
|
*
|
||||||
@@ -500,16 +531,8 @@ public abstract class AbstractTableHeader extends VerticalLayout {
|
|||||||
*/
|
*/
|
||||||
public abstract Boolean onLoadIsShowFilterButtonDisplayed();
|
public abstract Boolean onLoadIsShowFilterButtonDisplayed();
|
||||||
|
|
||||||
protected abstract boolean isBulkUploadInProgress();
|
|
||||||
|
|
||||||
protected abstract void searchBy(String newSearchText);
|
protected abstract void searchBy(String newSearchText);
|
||||||
|
|
||||||
protected abstract void addNewItem(final Button.ClickEvent event);
|
protected abstract void addNewItem(final Button.ClickEvent event);
|
||||||
|
|
||||||
protected abstract void bulkUpload(final Button.ClickEvent event);
|
|
||||||
|
|
||||||
protected abstract Boolean isAddNewItemAllowed();
|
|
||||||
|
|
||||||
protected abstract Boolean isBulkUploadAllowed();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,28 +18,23 @@ 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;
|
||||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||||
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;
|
||||||
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractNamedVersionedEntityTableDetailsLayout;
|
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractDistributionSetDetails;
|
||||||
import org.eclipse.hawkbit.ui.common.detailslayout.DistributionSetMetadatadetailslayout;
|
|
||||||
import org.eclipse.hawkbit.ui.common.detailslayout.SoftwareModuleDetailsTable;
|
import org.eclipse.hawkbit.ui.common.detailslayout.SoftwareModuleDetailsTable;
|
||||||
import org.eclipse.hawkbit.ui.common.detailslayout.TargetFilterQueryDetailsTable;
|
import org.eclipse.hawkbit.ui.common.detailslayout.TargetFilterQueryDetailsTable;
|
||||||
import org.eclipse.hawkbit.ui.common.entity.SoftwareModuleIdName;
|
import org.eclipse.hawkbit.ui.common.entity.SoftwareModuleIdName;
|
||||||
import org.eclipse.hawkbit.ui.common.tagdetails.DistributionTagToken;
|
|
||||||
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.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.dstable.DistributionAddUpdateWindowLayout;
|
import org.eclipse.hawkbit.ui.management.dstable.DistributionAddUpdateWindowLayout;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
|
||||||
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.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;
|
||||||
@@ -47,91 +42,75 @@ import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
|||||||
import com.vaadin.data.Item;
|
import com.vaadin.data.Item;
|
||||||
import com.vaadin.server.FontAwesome;
|
import com.vaadin.server.FontAwesome;
|
||||||
import com.vaadin.ui.Button;
|
import com.vaadin.ui.Button;
|
||||||
import com.vaadin.ui.Button.ClickEvent;
|
|
||||||
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.UI;
|
import com.vaadin.ui.UI;
|
||||||
import com.vaadin.ui.VerticalLayout;
|
import com.vaadin.ui.VerticalLayout;
|
||||||
import com.vaadin.ui.Window;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Distribution set details layout.
|
* Distribution set details layout.
|
||||||
*/
|
*/
|
||||||
public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDetailsLayout<DistributionSet> {
|
public class DistributionSetDetails extends AbstractDistributionSetDetails {
|
||||||
|
|
||||||
private static final long serialVersionUID = -4595004466943546669L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private static final String SOFT_MODULE = "softwareModule";
|
private static final String SOFT_MODULE = "softwareModule";
|
||||||
|
|
||||||
private final ManageDistUIState manageDistUIState;
|
private final ManageDistUIState manageDistUIState;
|
||||||
|
|
||||||
private final DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout;
|
|
||||||
|
|
||||||
private final DistributionTagToken distributionTagToken;
|
|
||||||
|
|
||||||
private final transient SoftwareManagement softwareManagement;
|
private final transient SoftwareManagement softwareManagement;
|
||||||
|
|
||||||
private final transient DistributionSetManagement distributionSetManagement;
|
|
||||||
|
|
||||||
private final transient TargetManagement targetManagement;
|
private final transient TargetManagement targetManagement;
|
||||||
|
|
||||||
private final DsMetadataPopupLayout dsMetadataPopupLayout;
|
|
||||||
|
|
||||||
private final SoftwareModuleDetailsTable softwareModuleTable;
|
|
||||||
|
|
||||||
private final DistributionSetMetadatadetailslayout dsMetadataTable;
|
|
||||||
|
|
||||||
private final TargetFilterQueryDetailsTable tfqDetailsTable;
|
private final TargetFilterQueryDetailsTable tfqDetailsTable;
|
||||||
|
|
||||||
private VerticalLayout tagsLayout;
|
|
||||||
|
|
||||||
private Map<String, StringBuilder> assignedSWModule;
|
private Map<String, StringBuilder> assignedSWModule;
|
||||||
|
|
||||||
DistributionSetDetails(final VaadinMessageSource i18n, final UIEventBus eventBus, final SpPermissionChecker permissionChecker,
|
DistributionSetDetails(final VaadinMessageSource i18n, final UIEventBus eventBus,
|
||||||
final ManageDistUIState manageDistUIState, final ManagementUIState managementUIState,
|
final SpPermissionChecker permissionChecker, final ManageDistUIState manageDistUIState,
|
||||||
|
final ManagementUIState managementUIState,
|
||||||
final DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout,
|
final DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout,
|
||||||
final SoftwareManagement softwareManagement, final DistributionSetManagement distributionSetManagement,
|
final SoftwareManagement softwareManagement, final DistributionSetManagement distributionSetManagement,
|
||||||
final TargetManagement targetManagement, final EntityFactory entityFactory,
|
final TargetManagement targetManagement, final EntityFactory entityFactory,
|
||||||
final UINotification uinotification, final TagManagement tagManagement,
|
final UINotification uiNotification, final TagManagement tagManagement,
|
||||||
final DsMetadataPopupLayout popupLayout, final UINotification uiNotification) {
|
final DsMetadataPopupLayout dsMetadataPopupLayout) {
|
||||||
super(i18n, eventBus, permissionChecker, managementUIState);
|
super(i18n, eventBus, permissionChecker, managementUIState, distributionAddUpdateWindowLayout,
|
||||||
|
distributionSetManagement, dsMetadataPopupLayout, entityFactory, uiNotification, tagManagement,
|
||||||
|
createSoftwareModuleDetailsTable(i18n, permissionChecker, distributionSetManagement, eventBus,
|
||||||
|
manageDistUIState, uiNotification));
|
||||||
this.manageDistUIState = manageDistUIState;
|
this.manageDistUIState = manageDistUIState;
|
||||||
this.distributionAddUpdateWindowLayout = distributionAddUpdateWindowLayout;
|
|
||||||
this.distributionTagToken = new DistributionTagToken(permissionChecker, i18n, uinotification, eventBus,
|
|
||||||
managementUIState, tagManagement, distributionSetManagement);
|
|
||||||
this.softwareManagement = softwareManagement;
|
this.softwareManagement = softwareManagement;
|
||||||
this.distributionSetManagement = distributionSetManagement;
|
|
||||||
this.targetManagement = targetManagement;
|
this.targetManagement = targetManagement;
|
||||||
this.dsMetadataPopupLayout = popupLayout;
|
|
||||||
|
|
||||||
softwareModuleTable = new SoftwareModuleDetailsTable(i18n, true, permissionChecker, distributionSetManagement,
|
|
||||||
eventBus, manageDistUIState, uiNotification);
|
|
||||||
|
|
||||||
dsMetadataTable = new DistributionSetMetadatadetailslayout(i18n, permissionChecker, distributionSetManagement,
|
|
||||||
dsMetadataPopupLayout, entityFactory, uiNotification);
|
|
||||||
|
|
||||||
tfqDetailsTable = new TargetFilterQueryDetailsTable(i18n);
|
tfqDetailsTable = new TargetFilterQueryDetailsTable(i18n);
|
||||||
addTabs(detailsTab);
|
|
||||||
|
addAdditionalTab();
|
||||||
restoreState();
|
restoreState();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected VerticalLayout createTagsLayout() {
|
private void addAdditionalTab() {
|
||||||
tagsLayout = getTabLayout();
|
getDetailsTab().addTab(tfqDetailsTable, getI18n().getMessage("caption.auto.assignment.ds"), null);
|
||||||
return tagsLayout;
|
}
|
||||||
|
|
||||||
|
private static final SoftwareModuleDetailsTable createSoftwareModuleDetailsTable(final VaadinMessageSource i18n,
|
||||||
|
final SpPermissionChecker permissionChecker, final DistributionSetManagement distributionSetManagement,
|
||||||
|
final UIEventBus eventBus, final ManageDistUIState manageDistUIState, final UINotification uiNotification) {
|
||||||
|
return new SoftwareModuleDetailsTable(i18n, true, permissionChecker, distributionSetManagement, eventBus,
|
||||||
|
manageDistUIState, uiNotification);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void populateDetailsWidget() {
|
protected void populateDetailsWidget() {
|
||||||
populateDetails();
|
populateDetails();
|
||||||
populateModule();
|
populateModule();
|
||||||
populateTags();
|
populateTags(getDistributionTagToken());
|
||||||
populateMetadataDetails();
|
populateMetadataDetails();
|
||||||
populateTargetFilterQueries();
|
populateTargetFilterQueries();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateModule() {
|
@Override
|
||||||
softwareModuleTable.populateModule(getSelectedBaseEntity());
|
protected void populateModule() {
|
||||||
|
super.populateModule();
|
||||||
showUnsavedAssignment();
|
showUnsavedAssignment();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +122,7 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
|
|||||||
.map(Map.Entry::getValue).orElse(null))
|
.map(Map.Entry::getValue).orElse(null))
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
|
|
||||||
if (null != softwareModuleIdNameList) {
|
if (softwareModuleIdNameList != null) {
|
||||||
if (assignedSWModule == null) {
|
if (assignedSWModule == null) {
|
||||||
assignedSWModule = new HashMap<>();
|
assignedSWModule = new HashMap<>();
|
||||||
}
|
}
|
||||||
@@ -168,9 +147,8 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
|
|||||||
}
|
}
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
for (final Map.Entry<String, StringBuilder> entry : assignedSWModule.entrySet()) {
|
for (final Map.Entry<String, StringBuilder> entry : assignedSWModule.entrySet()) {
|
||||||
final Item item = softwareModuleTable.getContainerDataSource().getItem(entry.getKey());
|
final Item item = getSoftwareModuleTable().getContainerDataSource().getItem(entry.getKey());
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
item.getItemProperty(SOFT_MODULE).setValue(createSoftModuleLayout(entry.getValue().toString()));
|
item.getItemProperty(SOFT_MODULE).setValue(createSoftModuleLayout(entry.getValue().toString()));
|
||||||
}
|
}
|
||||||
@@ -190,24 +168,27 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getUnsavedAssigedSwModule(final String name, final String version) {
|
||||||
|
return HawkbitCommonUtil.getFormattedNameVersion(name, version);
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private void updateSoftwareModule(final SoftwareModule module) {
|
private void updateSoftwareModule(final SoftwareModule module) {
|
||||||
if (assignedSWModule == null) {
|
if (assignedSWModule == null) {
|
||||||
assignedSWModule = new HashMap<>();
|
assignedSWModule = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
softwareModuleTable.getContainerDataSource().getItemIds();
|
getSoftwareModuleTable().getContainerDataSource().getItemIds();
|
||||||
if (assignedSWModule.containsKey(module.getType().getName())) {
|
if (assignedSWModule.containsKey(module.getType().getName())) {
|
||||||
/*
|
/*
|
||||||
* If software module type is software, means multiple softwares can
|
* If software module type is software, means multiple softwares can
|
||||||
* assigned to that type. Hence if multiple softwares belongs to
|
* assigned to that type. Hence if multipe softwares belongs to same
|
||||||
* same type is dropped, then add to the list.
|
* type is drroped, then add to the list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (module.getType().getMaxAssignments() > 1) {
|
if (module.getType().getMaxAssignments() > 1) {
|
||||||
assignedSWModule.get(module.getType().getName()).append("</br>").append("<I>")
|
assignedSWModule.get(module.getType().getName()).append("</br>").append("<I>")
|
||||||
.append(HawkbitCommonUtil.getFormattedNameVersion(module.getName(), module.getVersion()))
|
.append(getUnsavedAssigedSwModule(module.getName(), module.getVersion())).append("</I>");
|
||||||
.append("</I>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -216,21 +197,17 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
|
|||||||
* same type is dropped, then override with previous one.
|
* same type is dropped, then override with previous one.
|
||||||
*/
|
*/
|
||||||
if (module.getType().getMaxAssignments() == 1) {
|
if (module.getType().getMaxAssignments() == 1) {
|
||||||
assignedSWModule.put(module.getType().getName(),
|
assignedSWModule.put(module.getType().getName(), new StringBuilder().append("<I>")
|
||||||
new StringBuilder().append("<I>").append(
|
.append(getUnsavedAssigedSwModule(module.getName(), module.getVersion())).append("</I>"));
|
||||||
HawkbitCommonUtil.getFormattedNameVersion(module.getName(), module.getVersion()))
|
|
||||||
.append("</I>"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
assignedSWModule.put(module.getType().getName(),
|
assignedSWModule.put(module.getType().getName(), new StringBuilder().append("<I>")
|
||||||
new StringBuilder().append("<I>")
|
.append(getUnsavedAssigedSwModule(module.getName(), module.getVersion())).append("</I>"));
|
||||||
.append(HawkbitCommonUtil.getFormattedNameVersion(module.getName(), module.getVersion()))
|
|
||||||
.append("</I>"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final Map.Entry<String, StringBuilder> entry : assignedSWModule.entrySet()) {
|
for (final Map.Entry<String, StringBuilder> entry : assignedSWModule.entrySet()) {
|
||||||
final Item item = softwareModuleTable.getContainerDataSource().getItem(entry.getKey());
|
final Item item = getSoftwareModuleTable().getContainerDataSource().getItem(entry.getKey());
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
item.getItemProperty(SOFT_MODULE).setValue(createSoftModuleLayout(entry.getValue().toString()));
|
item.getItemProperty(SOFT_MODULE).setValue(createSoftModuleLayout(entry.getValue().toString()));
|
||||||
}
|
}
|
||||||
@@ -253,70 +230,10 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
|
|||||||
return verticalLayout;
|
return verticalLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
private VerticalLayout createSoftwareModuleTab() {
|
|
||||||
final VerticalLayout softwareLayout = getTabLayout();
|
|
||||||
softwareLayout.setSizeFull();
|
|
||||||
softwareLayout.addComponent(softwareModuleTable);
|
|
||||||
return softwareLayout;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void populateTags() {
|
|
||||||
tagsLayout.removeAllComponents();
|
|
||||||
if (getSelectedBaseEntity() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
tagsLayout.addComponent(distributionTagToken.getTokenField());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void populateDetails() {
|
|
||||||
if (getSelectedBaseEntity() != null) {
|
|
||||||
updateDistributionSetDetailsLayout(getSelectedBaseEntity().getType().getName(),
|
|
||||||
getSelectedBaseEntity().isRequiredMigrationStep());
|
|
||||||
} else {
|
|
||||||
updateDistributionSetDetailsLayout(null, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void populateMetadataDetails() {
|
|
||||||
dsMetadataTable.populateDSMetadata(getSelectedBaseEntity());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void populateTargetFilterQueries() {
|
protected void populateTargetFilterQueries() {
|
||||||
tfqDetailsTable.populateTableByDistributionSet(getSelectedBaseEntity());
|
tfqDetailsTable.populateTableByDistributionSet(getSelectedBaseEntity());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDistributionSetDetailsLayout(final String type, final Boolean isMigrationRequired) {
|
|
||||||
final VerticalLayout detailsTabLayout = getDetailsLayout();
|
|
||||||
detailsTabLayout.removeAllComponents();
|
|
||||||
|
|
||||||
if (type != null) {
|
|
||||||
final Label typeLabel = SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.dist.details.type"),
|
|
||||||
type);
|
|
||||||
typeLabel.setId(UIComponentIdProvider.DETAILS_TYPE_LABEL_ID);
|
|
||||||
detailsTabLayout.addComponent(typeLabel);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isMigrationRequired != null) {
|
|
||||||
detailsTabLayout.addComponent(SPUIComponentProvider.createNameValueLabel(
|
|
||||||
getI18n().getMessage("checkbox.dist.migration.required"),
|
|
||||||
isMigrationRequired.equals(Boolean.TRUE) ? getI18n().getMessage("label.yes") : getI18n().getMessage("label.no")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onEdit(final ClickEvent event) {
|
|
||||||
final Window newDistWindow = distributionAddUpdateWindowLayout.getWindow(getSelectedBaseEntityId());
|
|
||||||
newDistWindow.setCaption(getI18n().getMessage(UIComponentIdProvider.DIST_UPDATE_CAPTION));
|
|
||||||
UI.getCurrent().addWindow(newDistWindow);
|
|
||||||
newDistWindow.setVisible(Boolean.TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getEditButtonId() {
|
|
||||||
return UIComponentIdProvider.DS_EDIT_BUTTON;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onLoadIsTableRowSelected() {
|
protected boolean onLoadIsTableRowSelected() {
|
||||||
return manageDistUIState.getSelectedDistributions().map(selected -> !selected.isEmpty()).orElse(false);
|
return manageDistUIState.getSelectedDistributions().map(selected -> !selected.isEmpty()).orElse(false);
|
||||||
@@ -327,27 +244,6 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
|
|||||||
return manageDistUIState.isDsTableMaximized();
|
return manageDistUIState.isDsTableMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getDefaultCaption() {
|
|
||||||
return getI18n().getMessage("distribution.details.header");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addTabs(final TabSheet detailsTab) {
|
|
||||||
detailsTab.addTab(createDetailsLayout(), getI18n().getMessage("caption.tab.details"), null);
|
|
||||||
detailsTab.addTab(createDescriptionLayout(), getI18n().getMessage("caption.tab.description"), null);
|
|
||||||
detailsTab.addTab(createSoftwareModuleTab(), getI18n().getMessage("caption.softwares.distdetail.tab"), null);
|
|
||||||
detailsTab.addTab(createTagsLayout(), getI18n().getMessage("caption.tags.tab"), null);
|
|
||||||
detailsTab.addTab(createLogLayout(), getI18n().getMessage("caption.logs.tab"), null);
|
|
||||||
detailsTab.addTab(dsMetadataTable, getI18n().getMessage("caption.metadata"), null);
|
|
||||||
detailsTab.addTab(tfqDetailsTable, getI18n().getMessage("caption.auto.assignment.ds"), null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean hasEditPermission() {
|
|
||||||
return getPermissionChecker().hasUpdateDistributionPermission();
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
@EventBusListenerMethod(scope = EventScope.UI)
|
||||||
void onEvent(final SoftwareModuleEvent event) {
|
void onEvent(final SoftwareModuleEvent event) {
|
||||||
if (event.getSoftwareModuleEventType() == SoftwareModuleEventType.ASSIGN_SOFTWARE_MODULE) {
|
if (event.getSoftwareModuleEventType() == SoftwareModuleEventType.ASSIGN_SOFTWARE_MODULE) {
|
||||||
@@ -355,11 +251,6 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
|
||||||
void onEvent(final DistributionTableEvent distributionTableEvent) {
|
|
||||||
onBaseEntityEvent(distributionTableEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
@EventBusListenerMethod(scope = EventScope.UI)
|
||||||
void onEvent(final SaveActionWindowEvent saveActionWindowEvent) {
|
void onEvent(final SaveActionWindowEvent saveActionWindowEvent) {
|
||||||
if ((saveActionWindowEvent == SaveActionWindowEvent.SAVED_ASSIGNMENTS
|
if ((saveActionWindowEvent == SaveActionWindowEvent.SAVED_ASSIGNMENTS
|
||||||
@@ -369,10 +260,11 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
|
|||||||
assignedSWModule.clear();
|
assignedSWModule.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
distributionSetManagement.findDistributionSetByIdWithDetails(getSelectedBaseEntityId()).ifPresent(set -> {
|
getDistributionSetManagement().findDistributionSetByIdWithDetails(getSelectedBaseEntityId())
|
||||||
setSelectedBaseEntity(set);
|
.ifPresent(set -> {
|
||||||
UI.getCurrent().access(this::populateModule);
|
setSelectedBaseEntity(set);
|
||||||
});
|
UI.getCurrent().access(this::populateModule);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,24 +280,4 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getTabSheetId() {
|
|
||||||
return UIComponentIdProvider.DISTRIBUTIONSET_DETAILS_TABSHEET_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getDetailsHeaderCaptionId() {
|
|
||||||
return UIComponentIdProvider.DISTRIBUTION_DETAILS_HEADER_LABEL_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isMetadataIconToBeDisplayed() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void showMetadata(final ClickEvent event) {
|
|
||||||
distributionSetManagement.findDistributionSetByIdWithDetails(getSelectedBaseEntityId())
|
|
||||||
.ifPresent(ds -> UI.getCurrent().addWindow(dsMetadataPopupLayout.getWindow(ds, null)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
package org.eclipse.hawkbit.ui.distributions.dstable;
|
package org.eclipse.hawkbit.ui.distributions.dstable;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||||
import org.eclipse.hawkbit.ui.common.table.AbstractTableHeader;
|
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.distributions.event.DistributionsUIEvent;
|
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
@@ -22,7 +22,6 @@ 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.vaadin.event.dd.DropHandler;
|
|
||||||
import com.vaadin.ui.Button.ClickEvent;
|
import com.vaadin.ui.Button.ClickEvent;
|
||||||
import com.vaadin.ui.UI;
|
import com.vaadin.ui.UI;
|
||||||
import com.vaadin.ui.Window;
|
import com.vaadin.ui.Window;
|
||||||
@@ -30,9 +29,9 @@ import com.vaadin.ui.Window;
|
|||||||
/**
|
/**
|
||||||
* Distribution table header.
|
* Distribution table header.
|
||||||
*/
|
*/
|
||||||
public class DistributionSetTableHeader extends AbstractTableHeader {
|
public class DistributionSetTableHeader extends AbstractDistributionSetTableHeader {
|
||||||
|
|
||||||
private static final long serialVersionUID = -3483238438474530748L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final DistributionAddUpdateWindowLayout addUpdateWindowLayout;
|
private final DistributionAddUpdateWindowLayout addUpdateWindowLayout;
|
||||||
|
|
||||||
@@ -49,56 +48,11 @@ public class DistributionSetTableHeader extends AbstractTableHeader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getHeaderCaption() {
|
|
||||||
return i18n.getMessage("header.dist.table");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getSearchBoxId() {
|
|
||||||
return UIComponentIdProvider.DIST_SEARCH_TEXTFIELD;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getSearchRestIconId() {
|
|
||||||
return UIComponentIdProvider.DIST_SEARCH_ICON;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getAddIconId() {
|
|
||||||
return UIComponentIdProvider.DIST_ADD_ICON;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String onLoadSearchBoxValue() {
|
protected String onLoadSearchBoxValue() {
|
||||||
return manageDistUIstate.getManageDistFilters().getSearchText().orElse(null);
|
return manageDistUIstate.getManageDistFilters().getSearchText().orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getDropFilterId() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean hasCreatePermission() {
|
|
||||||
return permChecker.hasCreateDistributionPermission();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isDropHintRequired() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isDropFilterRequired() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getShowFilterButtonLayoutId() {
|
|
||||||
return UIComponentIdProvider.SHOW_DIST_TAG_ICON;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void showFilterButtonsLayout() {
|
protected void showFilterButtonsLayout() {
|
||||||
manageDistUIstate.setDistTypeFilterClosed(false);
|
manageDistUIstate.setDistTypeFilterClosed(false);
|
||||||
@@ -113,11 +67,6 @@ public class DistributionSetTableHeader extends AbstractTableHeader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getMaxMinIconId() {
|
|
||||||
return UIComponentIdProvider.DS_MAX_MIN_TABLE_ICON;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void maximizeTable() {
|
public void maximizeTable() {
|
||||||
manageDistUIstate.setDsTableMaximized(Boolean.TRUE);
|
manageDistUIstate.setDsTableMaximized(Boolean.TRUE);
|
||||||
@@ -159,38 +108,4 @@ public class DistributionSetTableHeader extends AbstractTableHeader {
|
|||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getFilterIconStyle() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getDropFilterWrapperId() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected DropHandler getDropFilterHandler() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getBulkUploadIconId() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void bulkUpload(final ClickEvent event) {
|
|
||||||
// No implementation as no bulk upload is supported.
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Boolean isBulkUploadAllowed() {
|
|
||||||
return Boolean.FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isBulkUploadInProgress() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class DistributionSetTableLayout extends AbstractTableLayout<Distribution
|
|||||||
distributionSetTable,
|
distributionSetTable,
|
||||||
new DistributionSetDetails(i18n, eventBus, permissionChecker, manageDistUIState, null,
|
new DistributionSetDetails(i18n, eventBus, permissionChecker, manageDistUIState, null,
|
||||||
distributionAddUpdateWindowLayout, softwareManagement, distributionSetManagement,
|
distributionAddUpdateWindowLayout, softwareManagement, distributionSetManagement,
|
||||||
targetManagement, entityFactory, uiNotification, tagManagement, popupLayout, uiNotification));
|
targetManagement, entityFactory, uiNotification, tagManagement, popupLayout));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,122 +8,38 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.distributions.smtable;
|
package org.eclipse.hawkbit.ui.distributions.smtable;
|
||||||
|
|
||||||
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.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
|
||||||
import org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleAddUpdateWindow;
|
import org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleAddUpdateWindow;
|
||||||
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractNamedVersionedEntityTableDetailsLayout;
|
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractSoftwareModuleDetails;
|
||||||
import org.eclipse.hawkbit.ui.common.detailslayout.SoftwareModuleMetadatadetailslayout;
|
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
|
||||||
import org.eclipse.hawkbit.ui.distributions.event.MetadataEvent;
|
|
||||||
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.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.annotation.EventBusListenerMethod;
|
|
||||||
|
|
||||||
import com.vaadin.ui.Button.ClickEvent;
|
|
||||||
import com.vaadin.ui.Label;
|
|
||||||
import com.vaadin.ui.TabSheet;
|
|
||||||
import com.vaadin.ui.UI;
|
|
||||||
import com.vaadin.ui.VerticalLayout;
|
|
||||||
import com.vaadin.ui.Window;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of software module details block using generic abstract
|
* Implementation of software module details block using generic abstract
|
||||||
* details style .
|
* details style .
|
||||||
*/
|
*/
|
||||||
public class SwModuleDetails extends AbstractNamedVersionedEntityTableDetailsLayout<SoftwareModule> {
|
public class SwModuleDetails extends AbstractSoftwareModuleDetails {
|
||||||
|
|
||||||
private static final long serialVersionUID = -1052279281066089812L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow;
|
|
||||||
|
|
||||||
private final ManageDistUIState manageDistUIState;
|
private final ManageDistUIState manageDistUIState;
|
||||||
|
|
||||||
private final transient SoftwareManagement softwareManagement;
|
SwModuleDetails(final VaadinMessageSource i18n, final UIEventBus eventBus,
|
||||||
|
final SpPermissionChecker permissionChecker,
|
||||||
private final SwMetadataPopupLayout swMetadataPopupLayout;
|
|
||||||
|
|
||||||
private final SoftwareModuleMetadatadetailslayout swmMetadataTable;
|
|
||||||
|
|
||||||
SwModuleDetails(final VaadinMessageSource i18n, final UIEventBus eventBus, final SpPermissionChecker permissionChecker,
|
|
||||||
final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow,
|
final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow,
|
||||||
final ManageDistUIState manageDistUIState, final SoftwareManagement softwareManagement,
|
final ManageDistUIState manageDistUIState, final SoftwareManagement softwareManagement,
|
||||||
final SwMetadataPopupLayout swMetadataPopupLayout, final EntityFactory entityFactory) {
|
final SwMetadataPopupLayout swMetadataPopupLayout, final EntityFactory entityFactory) {
|
||||||
super(i18n, eventBus, permissionChecker, null);
|
super(i18n, eventBus, permissionChecker, null, softwareManagement, swMetadataPopupLayout, entityFactory,
|
||||||
this.softwareModuleAddUpdateWindow = softwareModuleAddUpdateWindow;
|
softwareModuleAddUpdateWindow);
|
||||||
this.manageDistUIState = manageDistUIState;
|
this.manageDistUIState = manageDistUIState;
|
||||||
this.softwareManagement = softwareManagement;
|
|
||||||
this.swMetadataPopupLayout = swMetadataPopupLayout;
|
|
||||||
|
|
||||||
swmMetadataTable = new SoftwareModuleMetadatadetailslayout();
|
|
||||||
swmMetadataTable.init(getI18n(), getPermissionChecker(), softwareManagement, swMetadataPopupLayout,
|
|
||||||
entityFactory);
|
|
||||||
addTabs(detailsTab);
|
|
||||||
restoreState();
|
restoreState();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* MetadataEvent.
|
|
||||||
*
|
|
||||||
* @param event
|
|
||||||
* as instance of {@link MetadataEvent}
|
|
||||||
*/
|
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
|
||||||
void onEvent(final MetadataEvent event) {
|
|
||||||
UI.getCurrent().access(() -> {
|
|
||||||
final MetaData softwareModuleMetadata = event.getMetaData();
|
|
||||||
if (softwareModuleMetadata != null && isSoftwareModuleSelected(event.getModule())) {
|
|
||||||
if (event.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.CREATE_SOFTWARE_MODULE_METADATA) {
|
|
||||||
swmMetadataTable.createMetadata(event.getMetaData().getKey());
|
|
||||||
} else if (event
|
|
||||||
.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.DELETE_SOFTWARE_MODULE_METADATA) {
|
|
||||||
swmMetadataTable.deleteMetadata(event.getMetaData().getKey());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
|
||||||
void onEvent(final SoftwareModuleEvent softwareModuleEvent) {
|
|
||||||
onBaseEntityEvent(softwareModuleEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onEdit(final ClickEvent event) {
|
|
||||||
final Window addSoftwareModule = softwareModuleAddUpdateWindow
|
|
||||||
.createUpdateSoftwareModuleWindow(getSelectedBaseEntityId());
|
|
||||||
addSoftwareModule.setCaption(getI18n().getMessage("upload.caption.update.swmodule"));
|
|
||||||
UI.getCurrent().addWindow(addSoftwareModule);
|
|
||||||
addSoftwareModule.setVisible(Boolean.TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getEditButtonId() {
|
|
||||||
return UIComponentIdProvider.UPLOAD_SW_MODULE_EDIT_BUTTON;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addTabs(final TabSheet detailsTab) {
|
|
||||||
detailsTab.addTab(createDetailsLayout(), getI18n().getMessage("caption.tab.details"), null);
|
|
||||||
detailsTab.addTab(createDescriptionLayout(), getI18n().getMessage("caption.tab.description"), null);
|
|
||||||
detailsTab.addTab(createLogLayout(), getI18n().getMessage("caption.logs.tab"), null);
|
|
||||||
detailsTab.addTab(swmMetadataTable, getI18n().getMessage("caption.metadata"), null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getDefaultCaption() {
|
|
||||||
return getI18n().getMessage("upload.swModuleTable.header");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onLoadIsTableRowSelected() {
|
protected boolean onLoadIsTableRowSelected() {
|
||||||
return !manageDistUIState.getSelectedSoftwareModules().isEmpty();
|
return !manageDistUIState.getSelectedSoftwareModules().isEmpty();
|
||||||
@@ -134,88 +50,14 @@ public class SwModuleDetails extends AbstractNamedVersionedEntityTableDetailsLay
|
|||||||
return manageDistUIState.isSwModuleTableMaximized();
|
return manageDistUIState.isSwModuleTableMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean hasEditPermission() {
|
|
||||||
return getPermissionChecker().hasUpdateDistributionPermission();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTabSheetId() {
|
protected String getTabSheetId() {
|
||||||
return UIComponentIdProvider.DIST_SW_MODULE_DETAILS_TABSHEET_ID;
|
return UIComponentIdProvider.DIST_SW_MODULE_DETAILS_TABSHEET_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateDetails() {
|
|
||||||
if (getSelectedBaseEntity() != null) {
|
|
||||||
String maxAssign;
|
|
||||||
if (getSelectedBaseEntity().getType().getMaxAssignments() == 1) {
|
|
||||||
maxAssign = getI18n().getMessage("label.singleAssign.type");
|
|
||||||
} else {
|
|
||||||
maxAssign = getI18n().getMessage("label.multiAssign.type");
|
|
||||||
}
|
|
||||||
updateSwModuleDetailsLayout(getSelectedBaseEntity().getType().getName(),
|
|
||||||
getSelectedBaseEntity().getVendor(), maxAssign);
|
|
||||||
} else {
|
|
||||||
updateSwModuleDetailsLayout(StringUtils.EMPTY, StringUtils.EMPTY, StringUtils.EMPTY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateSwModuleDetailsLayout(final String type, final String vendor, final String maxAssign) {
|
|
||||||
|
|
||||||
final VerticalLayout detailsTabLayout = getDetailsLayout();
|
|
||||||
detailsTabLayout.removeAllComponents();
|
|
||||||
|
|
||||||
final Label vendorLabel = SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.dist.details.vendor"),
|
|
||||||
HawkbitCommonUtil.trimAndNullIfEmpty(vendor) == null ? "" : vendor);
|
|
||||||
vendorLabel.setId(UIComponentIdProvider.DETAILS_VENDOR_LABEL_ID);
|
|
||||||
detailsTabLayout.addComponent(vendorLabel);
|
|
||||||
|
|
||||||
if (type != null) {
|
|
||||||
final Label typeLabel = SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.dist.details.type"),
|
|
||||||
type);
|
|
||||||
typeLabel.setId(UIComponentIdProvider.DETAILS_TYPE_LABEL_ID);
|
|
||||||
detailsTabLayout.addComponent(typeLabel);
|
|
||||||
}
|
|
||||||
|
|
||||||
final Label assignLabel = SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.assigned.type"),
|
|
||||||
HawkbitCommonUtil.trimAndNullIfEmpty(maxAssign) == null ? "" : maxAssign);
|
|
||||||
assignLabel.setId(UIComponentIdProvider.SWM_DTLS_MAX_ASSIGN);
|
|
||||||
detailsTabLayout.addComponent(assignLabel);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void populateDetailsWidget() {
|
protected boolean isSoftwareModuleSelected(final SoftwareModule softwareModule) {
|
||||||
populateDetails();
|
return compareSoftwareModulesById(softwareModule, manageDistUIState.getSelectedBaseSwModuleId().orElse(null));
|
||||||
populateMetadataDetails();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getDetailsHeaderCaptionId() {
|
|
||||||
return UIComponentIdProvider.TARGET_DETAILS_HEADER_LABEL_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void populateMetadataDetails() {
|
|
||||||
swmMetadataTable.populateSMMetadata(getSelectedBaseEntity());
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isSoftwareModuleSelected(final SoftwareModule softwareModule) {
|
|
||||||
if (softwareModule == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return manageDistUIState.getSelectedBaseSwModuleId().map(module -> module.equals(softwareModule.getId()))
|
|
||||||
.orElse(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isMetadataIconToBeDisplayed() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void showMetadata(final ClickEvent event) {
|
|
||||||
softwareManagement.findSoftwareModuleById(getSelectedBaseEntityId())
|
|
||||||
.ifPresent(swmodule -> UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,36 +12,27 @@ import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
|||||||
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
|
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.smtable.SoftwareModuleAddUpdateWindow;
|
import org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleAddUpdateWindow;
|
||||||
import org.eclipse.hawkbit.ui.common.table.AbstractTableHeader;
|
import org.eclipse.hawkbit.ui.common.table.AbstractSoftwareModuleTableHeader;
|
||||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
|
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.utils.VaadinMessageSource;
|
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
|
||||||
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.vaadin.event.dd.DropHandler;
|
|
||||||
import com.vaadin.ui.Button.ClickEvent;
|
|
||||||
import com.vaadin.ui.UI;
|
|
||||||
import com.vaadin.ui.Window;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of software module Header block using generic abstract details
|
* Implementation of software module Header block using generic abstract details
|
||||||
* style .
|
* style .
|
||||||
*/
|
*/
|
||||||
public class SwModuleTableHeader extends AbstractTableHeader {
|
public class SwModuleTableHeader extends AbstractSoftwareModuleTableHeader {
|
||||||
|
|
||||||
private static final long serialVersionUID = 242961845006626297L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow;
|
SwModuleTableHeader(final VaadinMessageSource i18n, final SpPermissionChecker permChecker,
|
||||||
|
final UIEventBus eventbus, final ManageDistUIState manageDistUIstate,
|
||||||
SwModuleTableHeader(final VaadinMessageSource i18n, final SpPermissionChecker permChecker, final UIEventBus eventbus,
|
|
||||||
final ManageDistUIState manageDistUIstate,
|
|
||||||
final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow) {
|
final SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow) {
|
||||||
super(i18n, permChecker, eventbus, null, manageDistUIstate, null);
|
super(i18n, permChecker, eventbus, null, manageDistUIstate, null, softwareModuleAddUpdateWindow);
|
||||||
this.softwareModuleAddUpdateWindow = softwareModuleAddUpdateWindow;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
@EventBusListenerMethod(scope = EventScope.UI)
|
||||||
@@ -51,53 +42,11 @@ public class SwModuleTableHeader extends AbstractTableHeader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getHeaderCaption() {
|
|
||||||
return i18n.getMessage("upload.swModuleTable.header");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getSearchBoxId() {
|
|
||||||
return UIComponentIdProvider.SW_MODULE_SEARCH_TEXT_FIELD;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getSearchRestIconId() {
|
|
||||||
return UIComponentIdProvider.SW_MODULE_SEARCH_RESET_ICON;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getAddIconId() {
|
|
||||||
return UIComponentIdProvider.SW_MODULE_ADD_BUTTON;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String onLoadSearchBoxValue() {
|
protected String onLoadSearchBoxValue() {
|
||||||
return manageDistUIstate.getSoftwareModuleFilters().getSearchText().orElse(null);
|
return manageDistUIstate.getSoftwareModuleFilters().getSearchText().orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getDropFilterId() {
|
|
||||||
/* not required */
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isDropHintRequired() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isDropFilterRequired() {
|
|
||||||
/* Not Yet Implemented */
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getShowFilterButtonLayoutId() {
|
|
||||||
return "show.type.icon";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void showFilterButtonsLayout() {
|
protected void showFilterButtonsLayout() {
|
||||||
manageDistUIstate.setSwTypeFilterClosed(false);
|
manageDistUIstate.setSwTypeFilterClosed(false);
|
||||||
@@ -112,11 +61,6 @@ public class SwModuleTableHeader extends AbstractTableHeader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getMaxMinIconId() {
|
|
||||||
return UIComponentIdProvider.SW_MAX_MIN_TABLE_ICON;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void maximizeTable() {
|
public void maximizeTable() {
|
||||||
manageDistUIstate.setSwModuleTableMaximized(Boolean.TRUE);
|
manageDistUIstate.setSwModuleTableMaximized(Boolean.TRUE);
|
||||||
@@ -146,56 +90,4 @@ public class SwModuleTableHeader extends AbstractTableHeader {
|
|||||||
eventbus.publish(this, SMFilterEvent.FILTER_BY_TEXT);
|
eventbus.publish(this, SMFilterEvent.FILTER_BY_TEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addNewItem(final ClickEvent event) {
|
|
||||||
final Window addSoftwareModule = softwareModuleAddUpdateWindow.createAddSoftwareModuleWindow();
|
|
||||||
addSoftwareModule.setCaption(i18n.getMessage("upload.caption.add.new.swmodule"));
|
|
||||||
UI.getCurrent().addWindow(addSoftwareModule);
|
|
||||||
addSoftwareModule.setVisible(Boolean.TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean hasCreatePermission() {
|
|
||||||
return permChecker.hasCreateDistributionPermission();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Boolean isAddNewItemAllowed() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getFilterIconStyle() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getDropFilterWrapperId() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected DropHandler getDropFilterHandler() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getBulkUploadIconId() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void bulkUpload(final ClickEvent event) {
|
|
||||||
// No implementation as no bulk upload is supported.
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Boolean isBulkUploadAllowed() {
|
|
||||||
return Boolean.FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isBulkUploadInProgress() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,202 +8,60 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.management.dstable;
|
package org.eclipse.hawkbit.ui.management.dstable;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Set;
|
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;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
|
||||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||||
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractNamedVersionedEntityTableDetailsLayout;
|
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractDistributionSetDetails;
|
||||||
import org.eclipse.hawkbit.ui.common.detailslayout.DistributionSetMetadatadetailslayout;
|
|
||||||
import org.eclipse.hawkbit.ui.common.detailslayout.SoftwareModuleDetailsTable;
|
import org.eclipse.hawkbit.ui.common.detailslayout.SoftwareModuleDetailsTable;
|
||||||
import org.eclipse.hawkbit.ui.common.tagdetails.DistributionTagToken;
|
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
|
||||||
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.state.ManagementUIState;
|
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
|
||||||
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.annotation.EventBusListenerMethod;
|
|
||||||
|
|
||||||
import com.vaadin.ui.Button.ClickEvent;
|
|
||||||
import com.vaadin.ui.Label;
|
|
||||||
import com.vaadin.ui.TabSheet;
|
|
||||||
import com.vaadin.ui.UI;
|
|
||||||
import com.vaadin.ui.VerticalLayout;
|
|
||||||
import com.vaadin.ui.Window;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Distribution set details layout.
|
* Distribution set details layout.
|
||||||
*/
|
*/
|
||||||
public class DistributionDetails extends AbstractNamedVersionedEntityTableDetailsLayout<DistributionSet> {
|
public class DistributionDetails extends AbstractDistributionSetDetails {
|
||||||
|
|
||||||
private static final long serialVersionUID = 350360207334118826L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout;
|
DistributionDetails(final VaadinMessageSource i18n, final UIEventBus eventBus,
|
||||||
private final DistributionTagToken distributionTagToken;
|
final SpPermissionChecker permissionChecker, final ManagementUIState managementUIState,
|
||||||
private final transient DistributionSetManagement distributionSetManagement;
|
final DistributionSetManagement distributionSetManagement,
|
||||||
private final DsMetadataPopupLayout dsMetadataPopupLayout;
|
|
||||||
|
|
||||||
private final SoftwareModuleDetailsTable softwareModuleTable;
|
|
||||||
|
|
||||||
private final DistributionSetMetadatadetailslayout dsMetadataTable;
|
|
||||||
|
|
||||||
private final UINotification notificationMessage;
|
|
||||||
|
|
||||||
DistributionDetails(final VaadinMessageSource i18n, final UIEventBus eventBus, final SpPermissionChecker permissionChecker,
|
|
||||||
final ManagementUIState managementUIState, final DistributionSetManagement distributionSetManagement,
|
|
||||||
final DsMetadataPopupLayout dsMetadataPopupLayout, final EntityFactory entityFactory,
|
final DsMetadataPopupLayout dsMetadataPopupLayout, final EntityFactory entityFactory,
|
||||||
final UINotification notificationMessage, final TagManagement tagManagement,
|
final UINotification uiNotification, final TagManagement tagManagement,
|
||||||
final DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout) {
|
final DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout) {
|
||||||
super(i18n, eventBus, permissionChecker, managementUIState);
|
super(i18n, eventBus, permissionChecker, managementUIState, distributionAddUpdateWindowLayout,
|
||||||
|
distributionSetManagement, dsMetadataPopupLayout, entityFactory, uiNotification, tagManagement,
|
||||||
this.distributionTagToken = new DistributionTagToken(permissionChecker, i18n, notificationMessage, eventBus,
|
createSoftwareModuleDetailsTable(i18n, permissionChecker, uiNotification));
|
||||||
managementUIState, tagManagement, distributionSetManagement);
|
|
||||||
this.distributionSetManagement = distributionSetManagement;
|
|
||||||
this.dsMetadataPopupLayout = new DsMetadataPopupLayout(i18n, notificationMessage, eventBus,
|
|
||||||
distributionSetManagement, entityFactory, permissionChecker);
|
|
||||||
this.distributionAddUpdateWindowLayout = distributionAddUpdateWindowLayout;
|
|
||||||
this.notificationMessage = notificationMessage;
|
|
||||||
|
|
||||||
softwareModuleTable = new SoftwareModuleDetailsTable(i18n, false, permissionChecker, null, null, null,
|
|
||||||
notificationMessage);
|
|
||||||
|
|
||||||
dsMetadataTable = new DistributionSetMetadatadetailslayout(i18n, permissionChecker, distributionSetManagement,
|
|
||||||
dsMetadataPopupLayout, entityFactory, notificationMessage);
|
|
||||||
addTabs(detailsTab);
|
|
||||||
restoreState();
|
restoreState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.UI)
|
private static final SoftwareModuleDetailsTable createSoftwareModuleDetailsTable(final VaadinMessageSource i18n,
|
||||||
private void onEvent(final DistributionTableEvent distributionTableEvent) {
|
final SpPermissionChecker permissionChecker, final UINotification uiNotification) {
|
||||||
onBaseEntityEvent(distributionTableEvent);
|
return new SoftwareModuleDetailsTable(i18n, false, permissionChecker, null, null, null, uiNotification);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getDefaultCaption() {
|
|
||||||
return getI18n().getMessage("distribution.details.header");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addTabs(final TabSheet detailsTab) {
|
|
||||||
detailsTab.addTab(createDetailsLayout(), getI18n().getMessage("caption.tab.details"), null);
|
|
||||||
detailsTab.addTab(createDescriptionLayout(), getI18n().getMessage("caption.tab.description"), null);
|
|
||||||
detailsTab.addTab(createSoftwareModuleTab(), getI18n().getMessage("caption.softwares.distdetail.tab"), null);
|
|
||||||
detailsTab.addTab(createTagsLayout(), getI18n().getMessage("caption.tags.tab"), null);
|
|
||||||
detailsTab.addTab(createLogLayout(), getI18n().getMessage("caption.logs.tab"), null);
|
|
||||||
detailsTab.addTab(dsMetadataTable, getI18n().getMessage("caption.metadata"), null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onEdit(final ClickEvent event) {
|
|
||||||
final Window newDistWindow = distributionAddUpdateWindowLayout.getWindow(getSelectedBaseEntityId());
|
|
||||||
newDistWindow.setCaption(getI18n().getMessage(UIComponentIdProvider.DIST_UPDATE_CAPTION));
|
|
||||||
UI.getCurrent().addWindow(newDistWindow);
|
|
||||||
newDistWindow.setVisible(Boolean.TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getEditButtonId() {
|
|
||||||
return UIComponentIdProvider.DS_EDIT_BUTTON;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onLoadIsTableRowSelected() {
|
protected boolean onLoadIsTableRowSelected() {
|
||||||
return managementUIState.getSelectedDsIdName().map(Set::isEmpty).orElse(true);
|
return getManagementUIState().getSelectedDsIdName().map(Set::isEmpty).orElse(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onLoadIsTableMaximized() {
|
protected boolean onLoadIsTableMaximized() {
|
||||||
return managementUIState.isDsTableMaximized();
|
return getManagementUIState().isDsTableMaximized();
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean hasEditPermission() {
|
|
||||||
return getPermissionChecker().hasUpdateDistributionPermission();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getTabSheetId() {
|
|
||||||
return UIComponentIdProvider.DISTRIBUTIONSET_DETAILS_TABSHEET_ID;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void populateDetailsWidget() {
|
protected void populateDetailsWidget() {
|
||||||
softwareModuleTable.populateModule(getSelectedBaseEntity());
|
populateModule();
|
||||||
populateDetails(getSelectedBaseEntity());
|
populateDetails();
|
||||||
|
populateTags(getDistributionTagToken());
|
||||||
populateMetadataDetails();
|
populateMetadataDetails();
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void populateMetadataDetails() {
|
|
||||||
dsMetadataTable.populateDSMetadata(getSelectedBaseEntity());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void populateDetails(final DistributionSet ds) {
|
|
||||||
if (ds != null) {
|
|
||||||
updateDistributionDetailsLayout(ds.getType().getName(), ds.isRequiredMigrationStep());
|
|
||||||
} else {
|
|
||||||
updateDistributionDetailsLayout(null, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateDistributionDetailsLayout(final String type, final Boolean isMigrationRequired) {
|
|
||||||
final VerticalLayout detailsTabLayout = getDetailsLayout();
|
|
||||||
detailsTabLayout.removeAllComponents();
|
|
||||||
|
|
||||||
if (type != null) {
|
|
||||||
final Label typeLabel = SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.dist.details.type"),
|
|
||||||
type);
|
|
||||||
typeLabel.setId(UIComponentIdProvider.DETAILS_TYPE_LABEL_ID);
|
|
||||||
detailsTabLayout.addComponent(typeLabel);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isMigrationRequired != null) {
|
|
||||||
detailsTabLayout.addComponent(SPUIComponentProvider.createNameValueLabel(
|
|
||||||
getI18n().getMessage("checkbox.dist.migration.required"),
|
|
||||||
isMigrationRequired.equals(Boolean.TRUE) ? getI18n().getMessage("label.yes") : getI18n().getMessage("label.no")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private VerticalLayout createSoftwareModuleTab() {
|
|
||||||
final VerticalLayout swLayout = getTabLayout();
|
|
||||||
swLayout.setSizeFull();
|
|
||||||
swLayout.addComponent(softwareModuleTable);
|
|
||||||
return swLayout;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected VerticalLayout createTagsLayout() {
|
|
||||||
final VerticalLayout tagsLayout = getTabLayout();
|
|
||||||
tagsLayout.addComponent(distributionTagToken.getTokenField());
|
|
||||||
return tagsLayout;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getDetailsHeaderCaptionId() {
|
|
||||||
return UIComponentIdProvider.DISTRIBUTION_DETAILS_HEADER_LABEL_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isMetadataIconToBeDisplayed() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void showMetadata(final ClickEvent event) {
|
|
||||||
final Optional<DistributionSet> ds = distributionSetManagement
|
|
||||||
.findDistributionSetById(getSelectedBaseEntityId());
|
|
||||||
if (!ds.isPresent()) {
|
|
||||||
notificationMessage.displayWarning(getI18n().getMessage("distributionset.not.exists"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
UI.getCurrent().addWindow(dsMetadataPopupLayout.getWindow(ds.get(), null));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,30 +9,29 @@
|
|||||||
package org.eclipse.hawkbit.ui.management.dstable;
|
package org.eclipse.hawkbit.ui.management.dstable;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||||
import org.eclipse.hawkbit.ui.common.table.AbstractTableHeader;
|
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.DistributionTableFilterEvent;
|
||||||
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;
|
||||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
|
||||||
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.vaadin.event.dd.DropHandler;
|
|
||||||
import com.vaadin.ui.Button.ClickEvent;
|
import com.vaadin.ui.Button.ClickEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Distribution table header.
|
* Distribution table header.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DistributionTableHeader extends AbstractTableHeader {
|
public class DistributionTableHeader extends AbstractDistributionSetTableHeader {
|
||||||
private static final long serialVersionUID = 7597766804650170127L;
|
|
||||||
|
|
||||||
DistributionTableHeader(final VaadinMessageSource i18n, final SpPermissionChecker permChecker, final UIEventBus eventbus,
|
private static final long serialVersionUID = 1L;
|
||||||
final ManagementUIState managementUIState) {
|
|
||||||
|
DistributionTableHeader(final VaadinMessageSource i18n, final SpPermissionChecker permChecker,
|
||||||
|
final UIEventBus eventbus, final ManagementUIState managementUIState) {
|
||||||
super(i18n, permChecker, eventbus, managementUIState, null, null);
|
super(i18n, permChecker, eventbus, managementUIState, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,56 +44,11 @@ public class DistributionTableHeader extends AbstractTableHeader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getHeaderCaption() {
|
|
||||||
return i18n.getMessage("header.dist.table");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getSearchBoxId() {
|
|
||||||
return UIComponentIdProvider.DIST_SEARCH_TEXTFIELD;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getSearchRestIconId() {
|
|
||||||
return UIComponentIdProvider.DIST_SEARCH_ICON;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getAddIconId() {
|
|
||||||
return UIComponentIdProvider.DIST_ADD_ICON;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String onLoadSearchBoxValue() {
|
protected String onLoadSearchBoxValue() {
|
||||||
return managementUIState.getDistributionTableFilters().getSearchText().orElse(null);
|
return managementUIState.getDistributionTableFilters().getSearchText().orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getDropFilterId() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean hasCreatePermission() {
|
|
||||||
return permChecker.hasCreateDistributionPermission();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isDropHintRequired() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isDropFilterRequired() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getShowFilterButtonLayoutId() {
|
|
||||||
return UIComponentIdProvider.SHOW_DIST_TAG_ICON;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void showFilterButtonsLayout() {
|
protected void showFilterButtonsLayout() {
|
||||||
managementUIState.setDistTagFilterClosed(false);
|
managementUIState.setDistTagFilterClosed(false);
|
||||||
@@ -109,11 +63,6 @@ public class DistributionTableHeader extends AbstractTableHeader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getMaxMinIconId() {
|
|
||||||
return UIComponentIdProvider.DS_MAX_MIN_TABLE_ICON;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void maximizeTable() {
|
public void maximizeTable() {
|
||||||
managementUIState.setDsTableMaximized(Boolean.TRUE);
|
managementUIState.setDsTableMaximized(Boolean.TRUE);
|
||||||
@@ -152,38 +101,4 @@ public class DistributionTableHeader extends AbstractTableHeader {
|
|||||||
return Boolean.FALSE;
|
return Boolean.FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getFilterIconStyle() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getDropFilterWrapperId() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected DropHandler getDropFilterHandler() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getBulkUploadIconId() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void bulkUpload(final ClickEvent event) {
|
|
||||||
// No implementation as no bulk upload is supported.
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Boolean isBulkUploadAllowed() {
|
|
||||||
return Boolean.FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isBulkUploadInProgress() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
|||||||
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.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.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;
|
||||||
@@ -64,10 +64,11 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
|
|||||||
private VerticalLayout assignedDistLayout;
|
private VerticalLayout assignedDistLayout;
|
||||||
private VerticalLayout installedDistLayout;
|
private VerticalLayout installedDistLayout;
|
||||||
|
|
||||||
TargetDetails(final VaadinMessageSource i18n, final UIEventBus eventBus, final SpPermissionChecker permissionChecker,
|
TargetDetails(final VaadinMessageSource i18n, final UIEventBus eventBus,
|
||||||
final ManagementUIState managementUIState, final UINotification uiNotification,
|
final SpPermissionChecker permissionChecker, final ManagementUIState managementUIState,
|
||||||
final TagManagement tagManagement, final TargetManagement targetManagement,
|
final UINotification uiNotification, final TagManagement tagManagement,
|
||||||
final DeploymentManagement deploymentManagement, final EntityFactory entityFactory) {
|
final TargetManagement targetManagement, final DeploymentManagement deploymentManagement,
|
||||||
|
final EntityFactory entityFactory) {
|
||||||
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);
|
||||||
@@ -75,7 +76,7 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
|
|||||||
entityFactory);
|
entityFactory);
|
||||||
this.targetManagement = targetManagement;
|
this.targetManagement = targetManagement;
|
||||||
this.deploymentManagement = deploymentManagement;
|
this.deploymentManagement = deploymentManagement;
|
||||||
addTabs(detailsTab);
|
addDetailsTab();
|
||||||
restoreState();
|
restoreState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,34 +85,26 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
|
|||||||
return getI18n().getMessage("target.details.header");
|
return getI18n().getMessage("target.details.header");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private final void addDetailsTab() {
|
||||||
protected void addTabs(final TabSheet detailsTab) {
|
getDetailsTab().addTab(getDetailsLayout(), getI18n().getMessage("caption.tab.details"), null);
|
||||||
detailsTab.addTab(createDetailsLayout(), getI18n().getMessage("caption.tab.details"), null);
|
getDetailsTab().addTab(getDescriptionLayout(), getI18n().getMessage("caption.tab.description"), null);
|
||||||
detailsTab.addTab(createDescriptionLayout(), getI18n().getMessage("caption.tab.description"), null);
|
getDetailsTab().addTab(getAttributesLayout(), getI18n().getMessage("caption.attributes.tab"), null);
|
||||||
detailsTab.addTab(createAttributesLayout(), getI18n().getMessage("caption.attributes.tab"), null);
|
getDetailsTab().addTab(createAssignedDistLayout(), getI18n().getMessage("header.target.assigned"), null);
|
||||||
detailsTab.addTab(createAssignedDistLayout(), getI18n().getMessage("header.target.assigned"), null);
|
getDetailsTab().addTab(createInstalledDistLayout(), getI18n().getMessage("header.target.installed"), null);
|
||||||
detailsTab.addTab(createInstalledDistLayout(), getI18n().getMessage("header.target.installed"), null);
|
getDetailsTab().addTab(getTagsLayout(), getI18n().getMessage("caption.tags.tab"), null);
|
||||||
detailsTab.addTab(createTagsLayout(), getI18n().getMessage("caption.tags.tab"), null);
|
getDetailsTab().addTab(getLogLayout(), getI18n().getMessage("caption.logs.tab"), null);
|
||||||
detailsTab.addTab(createLogLayout(), getI18n().getMessage("caption.logs.tab"), null);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Component createInstalledDistLayout() {
|
private Component createInstalledDistLayout() {
|
||||||
installedDistLayout = getTabLayout();
|
installedDistLayout = createTabLayout();
|
||||||
return installedDistLayout;
|
return installedDistLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Component createAssignedDistLayout() {
|
private Component createAssignedDistLayout() {
|
||||||
assignedDistLayout = getTabLayout();
|
assignedDistLayout = createTabLayout();
|
||||||
return assignedDistLayout;
|
return assignedDistLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
private VerticalLayout createTagsLayout() {
|
|
||||||
final VerticalLayout tagsLayout = getTabLayout();
|
|
||||||
tagsLayout.addComponent(targetTagToken.getTokenField());
|
|
||||||
return tagsLayout;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEdit(final ClickEvent event) {
|
protected void onEdit(final ClickEvent event) {
|
||||||
if (getSelectedBaseEntity() == null) {
|
if (getSelectedBaseEntity() == null) {
|
||||||
@@ -137,12 +130,12 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onLoadIsTableRowSelected() {
|
protected boolean onLoadIsTableRowSelected() {
|
||||||
return managementUIState.getLastSelectedTargetId() != null;
|
return getManagementUIState().getLastSelectedTargetId() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onLoadIsTableMaximized() {
|
protected boolean onLoadIsTableMaximized() {
|
||||||
return managementUIState.isTargetTableMaximized();
|
return getManagementUIState().isTargetTableMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -163,7 +156,7 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
|
|||||||
populateDistributionDtls(installedDistLayout, null);
|
populateDistributionDtls(installedDistLayout, null);
|
||||||
populateDistributionDtls(assignedDistLayout, null);
|
populateDistributionDtls(assignedDistLayout, null);
|
||||||
}
|
}
|
||||||
|
populateTags(targetTagToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -176,7 +169,8 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
|
|||||||
final VerticalLayout detailsTabLayout = getDetailsLayout();
|
final VerticalLayout detailsTabLayout = getDetailsLayout();
|
||||||
detailsTabLayout.removeAllComponents();
|
detailsTabLayout.removeAllComponents();
|
||||||
|
|
||||||
final Label controllerLabel = SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.target.id"),
|
final Label controllerLabel = SPUIComponentProvider.createNameValueLabel(
|
||||||
|
getI18n().getMessage("label.target.id"),
|
||||||
HawkbitCommonUtil.trimAndNullIfEmpty(controllerId) == null ? "" : controllerId);
|
HawkbitCommonUtil.trimAndNullIfEmpty(controllerId) == null ? "" : controllerId);
|
||||||
controllerLabel.setId(UIComponentIdProvider.TARGET_CONTROLLER_ID);
|
controllerLabel.setId(UIComponentIdProvider.TARGET_CONTROLLER_ID);
|
||||||
detailsTabLayout.addComponent(controllerLabel);
|
detailsTabLayout.addComponent(controllerLabel);
|
||||||
@@ -203,7 +197,8 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
|
|||||||
final HorizontalLayout securityTokenLayout = new HorizontalLayout();
|
final HorizontalLayout securityTokenLayout = new HorizontalLayout();
|
||||||
|
|
||||||
final Label securityTableLbl = new Label(
|
final Label securityTableLbl = new Label(
|
||||||
SPUIComponentProvider.getBoldHTMLText(getI18n().getMessage("label.target.security.token")), ContentMode.HTML);
|
SPUIComponentProvider.getBoldHTMLText(getI18n().getMessage("label.target.security.token")),
|
||||||
|
ContentMode.HTML);
|
||||||
securityTableLbl.addStyleName(SPUIDefinitions.TEXT_STYLE);
|
securityTableLbl.addStyleName(SPUIDefinitions.TEXT_STYLE);
|
||||||
securityTableLbl.addStyleName("label-style");
|
securityTableLbl.addStyleName("label-style");
|
||||||
|
|
||||||
@@ -229,8 +224,8 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
|
|||||||
layout.addComponent(SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.dist.details.name"),
|
layout.addComponent(SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.dist.details.name"),
|
||||||
distributionSet.getName()));
|
distributionSet.getName()));
|
||||||
|
|
||||||
layout.addComponent(SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.dist.details.version"),
|
layout.addComponent(SPUIComponentProvider.createNameValueLabel(
|
||||||
distributionSet.getVersion()));
|
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)));
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ import com.vaadin.ui.themes.ValoTheme;
|
|||||||
*/
|
*/
|
||||||
public class TargetTableHeader extends AbstractTableHeader {
|
public class TargetTableHeader extends AbstractTableHeader {
|
||||||
|
|
||||||
private static final long serialVersionUID = -8647521126666320022L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final UINotification notification;
|
private final UINotification notification;
|
||||||
|
|
||||||
@@ -296,11 +296,6 @@ public class TargetTableHeader extends AbstractTableHeader {
|
|||||||
bulkUploadTargetWindow.setVisible(true);
|
bulkUploadTargetWindow.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Boolean isAddNewItemAllowed() {
|
|
||||||
return Boolean.TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean isBulkUploadAllowed() {
|
protected Boolean isBulkUploadAllowed() {
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
@@ -425,14 +420,19 @@ public class TargetTableHeader extends AbstractTableHeader {
|
|||||||
managementUIState.getTargetTableFilters().getDistributionSet().ifPresent(this::addFilterTextField);
|
managementUIState.getTargetTableFilters().getDistributionSet().ifPresent(this::addFilterTextField);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isBulkUploadInProgress() {
|
||||||
|
return managementUIState.getTargetTableFilters().getBulkUpload().getSucessfulUploadCount() != 0
|
||||||
|
|| managementUIState.getTargetTableFilters().getBulkUpload().getFailedUploadCount() != 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getFilterIconStyle() {
|
protected String getFilterIconStyle() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isBulkUploadInProgress() {
|
protected Boolean isAddNewItemAllowed() {
|
||||||
return managementUIState.getTargetTableFilters().getBulkUpload().getSucessfulUploadCount() != 0
|
return Boolean.TRUE;
|
||||||
|| managementUIState.getTargetTableFilters().getBulkUpload().getFailedUploadCount() != 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user