Merge remote-tracking branch 'eclipse/master' into harmonize-test-documentation
This commit is contained in:
@@ -14,12 +14,11 @@ import java.util.Set;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.EntityEvent;
|
||||
import org.eclipse.hawkbit.im.authentication.TenantAwareAuthenticationDetails;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIErrorHandler;
|
||||
import org.eclipse.hawkbit.ui.menu.DashboardEvent.PostViewChangeEvent;
|
||||
import org.eclipse.hawkbit.ui.menu.DashboardMenu;
|
||||
import org.eclipse.hawkbit.ui.menu.DashboardMenuItem;
|
||||
import org.eclipse.hawkbit.ui.push.EventPushStrategy;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
||||
@@ -28,14 +27,8 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.security.core.context.SecurityContext;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.web.context.HttpSessionSecurityContextRepository;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventBus.SessionEventBus;
|
||||
|
||||
import com.google.common.eventbus.AllowConcurrentEvents;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.vaadin.annotations.Title;
|
||||
import com.vaadin.navigator.Navigator;
|
||||
import com.vaadin.navigator.View;
|
||||
@@ -45,9 +38,6 @@ import com.vaadin.server.ClientConnector.DetachListener;
|
||||
import com.vaadin.server.Responsive;
|
||||
import com.vaadin.server.VaadinRequest;
|
||||
import com.vaadin.server.VaadinService;
|
||||
import com.vaadin.server.VaadinSession;
|
||||
import com.vaadin.server.VaadinSession.State;
|
||||
import com.vaadin.server.WrappedSession;
|
||||
import com.vaadin.spring.navigator.SpringViewProvider;
|
||||
import com.vaadin.ui.Component;
|
||||
import com.vaadin.ui.CssLayout;
|
||||
@@ -71,6 +61,8 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
|
||||
|
||||
private static final String EMPTY_VIEW = "";
|
||||
|
||||
private EventPushStrategy pushStrategy;
|
||||
|
||||
@Autowired
|
||||
private SpringViewProvider viewProvider;
|
||||
|
||||
@@ -92,69 +84,37 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
|
||||
protected transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
/**
|
||||
* An {@link com.google.common.eventbus.EventBus} subscriber which
|
||||
* subscribes {@link EntityEvent} from the repository to dispatch these
|
||||
* events to the UI {@link SessionEventBus}.
|
||||
*
|
||||
* @param event
|
||||
* the entity event which has been published from the repository
|
||||
* Default constructor.
|
||||
*/
|
||||
@Subscribe
|
||||
@AllowConcurrentEvents
|
||||
public void dispatch(final org.eclipse.hawkbit.eventbus.event.Event event) {
|
||||
final VaadinSession session = getSession();
|
||||
if (session == null || session.getState() != State.OPEN) {
|
||||
return;
|
||||
}
|
||||
|
||||
final WrappedSession wrappedSession = session.getSession();
|
||||
if (wrappedSession == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final SecurityContext userContext = (SecurityContext) wrappedSession
|
||||
.getAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY);
|
||||
if (!eventSecurityCheck(userContext, event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final SecurityContext oldContext = SecurityContextHolder.getContext();
|
||||
try {
|
||||
access(new DispatcherRunnable(eventBus, session, userContext, event));
|
||||
} finally {
|
||||
SecurityContextHolder.setContext(oldContext);
|
||||
}
|
||||
|
||||
public HawkbitUI() {
|
||||
// is empty, is ok.
|
||||
}
|
||||
|
||||
protected boolean eventSecurityCheck(final SecurityContext userContext,
|
||||
final org.eclipse.hawkbit.eventbus.event.Event event) {
|
||||
if (userContext != null && userContext.getAuthentication() != null) {
|
||||
final Object tenantAuthenticationDetails = userContext.getAuthentication().getDetails();
|
||||
if (tenantAuthenticationDetails instanceof TenantAwareAuthenticationDetails) {
|
||||
return ((TenantAwareAuthenticationDetails) tenantAuthenticationDetails).getTenant()
|
||||
.equalsIgnoreCase(event.getTenant());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
/**
|
||||
* Constructor taking the push strategy.
|
||||
*
|
||||
* @param pushStrategy
|
||||
* the strategy to push events from the backend to the UI
|
||||
*/
|
||||
public HawkbitUI(final EventPushStrategy pushStrategy) {
|
||||
this.pushStrategy = pushStrategy;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.vaadin.server.ClientConnector.DetachListener#detach(com.vaadin.server
|
||||
* .ClientConnector. DetachEvent)
|
||||
*/
|
||||
@Override
|
||||
public void detach(final DetachEvent event) {
|
||||
LOG.info("ManagementUI is detached uiid - {}", getUIId());
|
||||
|
||||
eventBus.unsubscribe(this);
|
||||
if (pushStrategy != null) {
|
||||
pushStrategy.clean();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init(final VaadinRequest vaadinRequest) {
|
||||
LOG.info("ManagementUI init starts uiid - {}", getUI().getUIId());
|
||||
if (pushStrategy != null) {
|
||||
pushStrategy.init(getUI());
|
||||
}
|
||||
addDetachListener(this);
|
||||
SpringContextHelper.setContext(context);
|
||||
|
||||
|
||||
@@ -208,14 +208,13 @@ public class ArtifactDetailsLayout extends VerticalLayout {
|
||||
}
|
||||
|
||||
private Container createArtifactLazyQueryContainer() {
|
||||
final Map<String, Object> queryConfiguration = new HashMap<String, Object>();
|
||||
final Map<String, Object> queryConfiguration = new HashMap<>();
|
||||
return getArtifactLazyQueryContainer(queryConfiguration);
|
||||
}
|
||||
|
||||
private LazyQueryContainer getArtifactLazyQueryContainer(final Map<String, Object> queryConfig) {
|
||||
|
||||
final BeanQueryFactory<ArtifactBeanQuery> artifactQF = new BeanQueryFactory<ArtifactBeanQuery>(
|
||||
ArtifactBeanQuery.class);
|
||||
final BeanQueryFactory<ArtifactBeanQuery> artifactQF = new BeanQueryFactory<>(ArtifactBeanQuery.class);
|
||||
artifactQF.setQueryConfiguration(queryConfig);
|
||||
final LazyQueryContainer artifactCont = new LazyQueryContainer(new LazyQueryDefinition(true, 10, "id"),
|
||||
artifactQF);
|
||||
@@ -431,7 +430,7 @@ public class ArtifactDetailsLayout extends VerticalLayout {
|
||||
titleOfArtifactDetails.setContentMode(ContentMode.HTML);
|
||||
}
|
||||
}
|
||||
final Map<String, Object> queryConfiguration = new HashMap<String, Object>();
|
||||
final Map<String, Object> queryConfiguration = new HashMap<>();
|
||||
if (baseSwModuleId != null) {
|
||||
queryConfiguration.put(SPUIDefinitions.BY_BASE_SOFTWARE_MODULE, baseSwModuleId);
|
||||
}
|
||||
|
||||
@@ -47,12 +47,6 @@ public class UploadViewAcceptCriteria extends AbstractAcceptCriteria {
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.AbstractAcceptCriteria#analyseDragComponent
|
||||
* (com.vaadin.event .dd.DragAndDropEvent, com.vaadin.ui.Component)
|
||||
*/
|
||||
@Override
|
||||
protected void analyseDragComponent(final Component compsource) {
|
||||
final String sourceID = getComponentId(compsource);
|
||||
@@ -60,24 +54,11 @@ public class UploadViewAcceptCriteria extends AbstractAcceptCriteria {
|
||||
eventBus.publish(this, event);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#hideDropHints
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
protected void hideDropHints() {
|
||||
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#invalidDrop()
|
||||
*/
|
||||
@Override
|
||||
protected void invalidDrop() {
|
||||
uiNotification.displayValidationError(SPUILabelDefinitions.ACTION_NOT_ALLOWED);
|
||||
@@ -92,41 +73,23 @@ public class UploadViewAcceptCriteria extends AbstractAcceptCriteria {
|
||||
return id;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#
|
||||
* getDropHintConfigurations()
|
||||
*/
|
||||
@Override
|
||||
protected Map<String, Object> getDropHintConfigurations() {
|
||||
return DROP_HINTS_CONFIGS;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#
|
||||
* publishDragStartEvent(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
protected void publishDragStartEvent(final Object event) {
|
||||
eventBus.publish(this, event);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#
|
||||
* getDropConfigurations()
|
||||
*/
|
||||
@Override
|
||||
protected Map<String, List<String>> getDropConfigurations() {
|
||||
return DROP_CONFIGS;
|
||||
}
|
||||
|
||||
private static Map<String, List<String>> createDropConfigurations() {
|
||||
final Map<String, List<String>> config = new HashMap<String, List<String>>();
|
||||
final Map<String, List<String>> config = new HashMap<>();
|
||||
// Delete drop area droppable components
|
||||
config.put(SPUIComponetIdProvider.DELETE_BUTTON_WRAPPER_ID, Arrays.asList(
|
||||
SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE, SPUIComponetIdProvider.UPLOAD_TYPE_BUTTON_PREFIX));
|
||||
@@ -135,7 +98,7 @@ public class UploadViewAcceptCriteria extends AbstractAcceptCriteria {
|
||||
}
|
||||
|
||||
private static Map<String, Object> createDropHintConfigurations() {
|
||||
final Map<String, Object> config = new HashMap<String, Object>();
|
||||
final Map<String, Object> config = new HashMap<>();
|
||||
config.put(SPUIComponetIdProvider.UPLOAD_TYPE_BUTTON_PREFIX, UploadArtifactUIEvent.SOFTWARE_TYPE_DRAG_START);
|
||||
config.put(SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE, UploadArtifactUIEvent.SOFTWARE_DRAG_START);
|
||||
return config;
|
||||
|
||||
@@ -37,8 +37,8 @@ import com.vaadin.spring.annotation.ViewScope;
|
||||
import com.vaadin.ui.Component;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.Table;
|
||||
import com.vaadin.ui.UI;
|
||||
import com.vaadin.ui.Table.TableTransferable;
|
||||
import com.vaadin.ui.UI;
|
||||
|
||||
/**
|
||||
* Upload view footer layout implementation.
|
||||
@@ -71,12 +71,7 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
@Autowired
|
||||
private UploadViewAcceptCriteria uploadViewAcceptCriteria;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.DeleteActionsLayout#init()
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
@@ -134,23 +129,11 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.footer.DeleteActionsLayout#
|
||||
* hasDeletePermission()
|
||||
*/
|
||||
@Override
|
||||
protected boolean hasDeletePermission() {
|
||||
return permChecker.hasDeleteDistributionPermission();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.footer.DeleteActionsLayout#
|
||||
* hasUpdatePermission()
|
||||
*/
|
||||
@Override
|
||||
protected boolean hasUpdatePermission() {
|
||||
/**
|
||||
@@ -161,12 +144,6 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.footer.DeleteActionsLayout#
|
||||
* getDeleteAreaLabel()
|
||||
*/
|
||||
@Override
|
||||
protected String getDeleteAreaLabel() {
|
||||
return i18n.get("label.software.module.drop.area");
|
||||
@@ -177,29 +154,17 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
return SPUIComponetIdProvider.DELETE_BUTTON_WRAPPER_ID;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.footer.DeleteActionsLayout#
|
||||
* getDeleteLayoutAcceptCriteria()
|
||||
*/
|
||||
@Override
|
||||
protected AcceptCriterion getDeleteLayoutAcceptCriteria() {
|
||||
return uploadViewAcceptCriteria;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.footer.DeleteActionsLayout#
|
||||
* processDroppedComponent(com.vaadin .event.dd.DragAndDropEvent)
|
||||
*/
|
||||
@Override
|
||||
protected void processDroppedComponent(final DragAndDropEvent event) {
|
||||
final Component sourceComponent = event.getTransferable().getSourceComponent();
|
||||
if (sourceComponent instanceof Table) {
|
||||
final Table sourceTable = (Table) event.getTransferable().getSourceComponent();
|
||||
addToDeleteList(sourceTable,(TableTransferable) event.getTransferable());
|
||||
addToDeleteList(sourceTable, (TableTransferable) event.getTransferable());
|
||||
updateSWActionCount();
|
||||
}
|
||||
if (sourceComponent.getId().startsWith(SPUIComponetIdProvider.UPLOAD_TYPE_BUTTON_PREFIX)) {
|
||||
@@ -223,11 +188,11 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
private void deleteSWModuleType(final String swModuleTypeName) {
|
||||
artifactUploadState.getSelectedDeleteSWModuleTypes().add(swModuleTypeName);
|
||||
}
|
||||
|
||||
|
||||
private void addToDeleteList(final Table sourceTable, final TableTransferable transferable) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final Set<Long> swModuleSelected = (Set<Long>) sourceTable.getValue();
|
||||
final Set<Long> swModuleIdNameSet = new HashSet<Long>();
|
||||
final Set<Long> swModuleIdNameSet = new HashSet<>();
|
||||
if (!swModuleSelected.contains(transferable.getData(SPUIDefinitions.ITEMID))) {
|
||||
swModuleIdNameSet.add((Long) transferable.getData(SPUIDefinitions.ITEMID));
|
||||
} else {
|
||||
@@ -239,33 +204,18 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
artifactUploadState.getDeleteSofwareModules().put(id, swModuleName);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the software module delete count.
|
||||
*/
|
||||
|
||||
private void updateSWActionCount() {
|
||||
final int count = artifactUploadState.getDeleteSofwareModules().size()
|
||||
+ artifactUploadState.getSelectedDeleteSWModuleTypes().size();
|
||||
updateActionsCount(count);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.footer.DeleteActionsLayout#
|
||||
* getNoActionsButtonLabel()
|
||||
*/
|
||||
@Override
|
||||
protected String getNoActionsButtonLabel() {
|
||||
return i18n.get("button.no.actions");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.footer.DeleteActionsLayout#
|
||||
* getActionsButtonLabel()
|
||||
*/
|
||||
@Override
|
||||
protected String getActionsButtonLabel() {
|
||||
return i18n.get("button.actions");
|
||||
@@ -276,25 +226,11 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
updateSWActionCount();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* getUnsavedActionsWindowCaption ()
|
||||
*/
|
||||
@Override
|
||||
protected String getUnsavedActionsWindowCaption() {
|
||||
return i18n.get("caption.save.window");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* unsavedActionsWindowClosed()
|
||||
*/
|
||||
@Override
|
||||
protected void unsavedActionsWindowClosed() {
|
||||
final String message = uploadViewConfirmationWindowLayout.getConsolidatedMessage();
|
||||
@@ -303,26 +239,12 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* getUnsavedActionsWindowContent ()
|
||||
*/
|
||||
@Override
|
||||
protected Component getUnsavedActionsWindowContent() {
|
||||
uploadViewConfirmationWindowLayout.init();
|
||||
return uploadViewConfirmationWindowLayout;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* hasUnsavedActions()
|
||||
*/
|
||||
@Override
|
||||
protected boolean hasUnsavedActions() {
|
||||
return !artifactUploadState.getDeleteSofwareModules().isEmpty()
|
||||
@@ -339,23 +261,11 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* isBulkUploadAllowed()
|
||||
*/
|
||||
@Override
|
||||
protected boolean hasBulkUploadPermission() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* showBulkUploadWindow()
|
||||
*/
|
||||
@Override
|
||||
protected void showBulkUploadWindow() {
|
||||
/**
|
||||
@@ -363,12 +273,6 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* restoreBulkUploadStatusCount()
|
||||
*/
|
||||
@Override
|
||||
protected void restoreBulkUploadStatusCount() {
|
||||
/**
|
||||
|
||||
@@ -32,10 +32,6 @@ import com.google.common.base.Strings;
|
||||
* Simple implementation of generics bean query which dynamically loads a batch
|
||||
* of beans.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class BaseSwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSoftwareModuleItem> {
|
||||
private static final long serialVersionUID = 4362142538539335466L;
|
||||
@@ -76,7 +72,7 @@ public class BaseSwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSoftwareMo
|
||||
@Override
|
||||
protected List<ProxyBaseSoftwareModuleItem> loadBeans(final int startIndex, final int count) {
|
||||
final Slice<SoftwareModule> swModuleBeans;
|
||||
final List<ProxyBaseSoftwareModuleItem> proxyBeans = new ArrayList<ProxyBaseSoftwareModuleItem>();
|
||||
final List<ProxyBaseSoftwareModuleItem> proxyBeans = new ArrayList<>();
|
||||
|
||||
if (type == null && Strings.isNullOrEmpty(searchText)) {
|
||||
swModuleBeans = getSoftwareManagementService()
|
||||
|
||||
@@ -70,6 +70,7 @@ public class SoftwareModuleDetails extends AbstractTableDetailsLayout {
|
||||
/**
|
||||
* Initialize the component.
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
|
||||
@@ -55,8 +55,6 @@ import com.vaadin.ui.UI;
|
||||
/**
|
||||
* Header of Software module table.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
@@ -82,6 +80,7 @@ public class SoftwareModuleTable extends AbstractTable {
|
||||
/**
|
||||
* Initialize the filter layout.
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
@@ -110,37 +109,30 @@ public class SoftwareModuleTable extends AbstractTable {
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.SPTable#getTableId()
|
||||
*/
|
||||
@Override
|
||||
protected String getTableId() {
|
||||
return SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.SPTable#createContainer()
|
||||
*/
|
||||
@Override
|
||||
protected Container createContainer() {
|
||||
final Map<String, Object> queryConfiguration = new HashMap<String, Object>();
|
||||
artifactUploadState.getSoftwareModuleFilters().getSearchText()
|
||||
.ifPresent(value -> queryConfiguration.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
||||
final Map<String, Object> queryConfiguration = prepareQueryConfigFilters();
|
||||
|
||||
artifactUploadState.getSoftwareModuleFilters().getSoftwareModuleType()
|
||||
.ifPresent(type -> queryConfiguration.put(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE, type));
|
||||
|
||||
final BeanQueryFactory<BaseSwModuleBeanQuery> swQF = new BeanQueryFactory<BaseSwModuleBeanQuery>(
|
||||
BaseSwModuleBeanQuery.class);
|
||||
final BeanQueryFactory<BaseSwModuleBeanQuery> swQF = new BeanQueryFactory<>(BaseSwModuleBeanQuery.class);
|
||||
swQF.setQueryConfiguration(queryConfiguration);
|
||||
|
||||
final LazyQueryContainer container = new LazyQueryContainer(
|
||||
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, "swId"), swQF);
|
||||
return container;
|
||||
return new LazyQueryContainer(new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, "swId"), swQF);
|
||||
}
|
||||
|
||||
private Map<String, Object> prepareQueryConfigFilters() {
|
||||
final Map<String, Object> queryConfig = new HashMap<>();
|
||||
artifactUploadState.getSoftwareModuleFilters().getSearchText()
|
||||
.ifPresent(value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
||||
|
||||
artifactUploadState.getSoftwareModuleFilters().getSoftwareModuleType()
|
||||
.ifPresent(type -> queryConfig.put(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE, type));
|
||||
|
||||
return queryConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -265,16 +257,9 @@ public class SoftwareModuleTable extends AbstractTable {
|
||||
select(swModule.getId());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.SPTable#getTableVisibleColumns
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
protected List<TableColumn> getTableVisibleColumns() {
|
||||
final List<TableColumn> columnList = new ArrayList<TableColumn>();
|
||||
final List<TableColumn> columnList = new ArrayList<>();
|
||||
if (isMaximized()) {
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get("header.name"), 0.2F));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_VERSION, i18n.get("header.version"), 0.1F));
|
||||
|
||||
@@ -62,6 +62,7 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
|
||||
/**
|
||||
* Initialize the components.
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
@@ -84,55 +85,26 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
|
||||
eventbus.unsubscribe(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#getHeaderCaption
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
protected String getHeaderCaption() {
|
||||
return i18n.get("upload.swModuleTable.header");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#getSearchBoxId()
|
||||
*/
|
||||
@Override
|
||||
protected String getSearchBoxId() {
|
||||
return SPUIComponetIdProvider.SW_MODULE_SEARCH_TEXT_FIELD;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.SPTableHeader#getSearchRestIconId()
|
||||
*/
|
||||
@Override
|
||||
protected String getSearchRestIconId() {
|
||||
return SPUIComponetIdProvider.SW_MODULE_SEARCH_RESET_ICON;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#getAddIconId()
|
||||
*/
|
||||
@Override
|
||||
protected String getAddIconId() {
|
||||
return SPUIComponetIdProvider.SW_MODULE_ADD_BUTTON;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.SPTableHeader#onLoadSearchBoxValue()
|
||||
*/
|
||||
@Override
|
||||
protected String onLoadSearchBoxValue() {
|
||||
if (artifactUploadState.getSoftwareModuleFilters().getSearchText().isPresent()) {
|
||||
@@ -141,68 +113,34 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#getDropFilterId(
|
||||
* )
|
||||
*/
|
||||
@Override
|
||||
protected String getDropFilterId() {
|
||||
/* No dropping on software module table header in Upload View */
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.SPTableHeader#hasCreatePermission()
|
||||
*/
|
||||
@Override
|
||||
protected boolean hasCreatePermission() {
|
||||
return permChecker.hasCreateDistributionPermission();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.SPTableHeader#isDropHintRequired()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isDropHintRequired() {
|
||||
/* No dropping on software module table header in Upload View */
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.SPTableHeader#isDropFilterRequired()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isDropFilterRequired() {
|
||||
/* No dropping on software module table header in Upload View */
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#
|
||||
* getShowFilterButtonLayoutId()
|
||||
*/
|
||||
@Override
|
||||
protected String getShowFilterButtonLayoutId() {
|
||||
return "show.type.icon";
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.SPTableHeader#showFilterButtonsLayout
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
protected void showFilterButtonsLayout() {
|
||||
artifactUploadState.setSwTypeFilterClosed(false);
|
||||
@@ -210,37 +148,19 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#resetSearchText(
|
||||
* )
|
||||
*/
|
||||
@Override
|
||||
protected void resetSearchText() {
|
||||
artifactUploadState.getSoftwareModuleFilters().setSearchText(null);
|
||||
eventbus.publish(this, SMFilterEvent.REMOVER_FILTER_BY_TEXT);
|
||||
if (artifactUploadState.getSoftwareModuleFilters().getSearchText().isPresent()) {
|
||||
artifactUploadState.getSoftwareModuleFilters().setSearchText(null);
|
||||
eventbus.publish(this, SMFilterEvent.REMOVER_FILTER_BY_TEXT);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#getMaxMinIconId(
|
||||
* )
|
||||
*/
|
||||
@Override
|
||||
protected String getMaxMinIconId() {
|
||||
return SPUIComponetIdProvider.SW_MAX_MIN_TABLE_ICON;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#maximizeTable()
|
||||
*/
|
||||
@Override
|
||||
public void maximizeTable() {
|
||||
artifactUploadState.setSwModuleTableMaximized(Boolean.TRUE);
|
||||
@@ -248,58 +168,28 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#minimizeTable()
|
||||
*/
|
||||
@Override
|
||||
public void minimizeTable() {
|
||||
artifactUploadState.setSwModuleTableMaximized(Boolean.FALSE);
|
||||
eventbus.publish(this, new SoftwareModuleEvent(SoftwareModuleEventType.MINIMIZED, null));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.SPTableHeader#onLoadIsTableMaximized(
|
||||
* )
|
||||
*/
|
||||
@Override
|
||||
public Boolean onLoadIsTableMaximized() {
|
||||
return artifactUploadState.isSwModuleTableMaximized();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#
|
||||
* onLoadIsShowFilterButtonDisplayed()
|
||||
*/
|
||||
@Override
|
||||
public Boolean onLoadIsShowFilterButtonDisplayed() {
|
||||
return artifactUploadState.isSwTypeFilterClosed();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.SPTableHeader#searchBy(java.lang.
|
||||
* String)
|
||||
*/
|
||||
@Override
|
||||
protected void searchBy(final String newSearchText) {
|
||||
artifactUploadState.getSoftwareModuleFilters().setSearchText(newSearchText);
|
||||
eventbus.publish(this, SMFilterEvent.FILTER_BY_TEXT);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.SPTableHeader#addNewItem(com.vaadin.
|
||||
* ui.Button.ClickEvent)
|
||||
*/
|
||||
@Override
|
||||
protected void addNewItem(final ClickEvent event) {
|
||||
final Window addSoftwareModule = softwareModuleAddUpdateWindow.createAddSoftwareModuleWindow();
|
||||
@@ -308,11 +198,6 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
|
||||
addSoftwareModule.setVisible(Boolean.TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#canAddNewItem()
|
||||
*/
|
||||
@Override
|
||||
protected Boolean isAddNewItemAllowed() {
|
||||
return Boolean.TRUE;
|
||||
@@ -333,47 +218,21 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
||||
* getBulkUploadIconId()
|
||||
*/
|
||||
@Override
|
||||
protected String getBulkUploadIconId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#bulkUpload(com.
|
||||
* vaadin.ui.Button.ClickEvent )
|
||||
*/
|
||||
@Override
|
||||
protected void bulkUpload(final ClickEvent event) {
|
||||
/**
|
||||
* No implementation as no bulk upload is supported.
|
||||
*/
|
||||
// No implementation as no bulk upload is supported.
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
||||
* isBulkUploadAllowed()
|
||||
*/
|
||||
@Override
|
||||
protected Boolean isBulkUploadAllowed() {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.common.table.AbstractTableHeader#
|
||||
* isBulkUploadInProgress()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isBulkUploadInProgress() {
|
||||
return false;
|
||||
|
||||
@@ -193,7 +193,7 @@ public class CreateUpdateSoftwareTypeLayout extends CustomComponent implements C
|
||||
getPreviewButtonColor(DEFAULT_COLOR);
|
||||
tagColorPreviewBtn.setStyleName(TAG_DYNAMIC_STYLE);
|
||||
|
||||
selectors = new HashSet<ColorSelector>();
|
||||
selectors = new HashSet<>();
|
||||
selectedColor = new Color(44, 151, 32);
|
||||
selPreview = new SpColorPickerPreview(selectedColor);
|
||||
|
||||
@@ -741,38 +741,17 @@ public class CreateUpdateSoftwareTypeLayout extends CustomComponent implements C
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.vaadin.ui.components.colorpicker.HasColorChangeListener#
|
||||
* addColorChangeListener(com.vaadin
|
||||
* .ui.components.colorpicker.ColorChangeListener)
|
||||
*/
|
||||
@Override
|
||||
public void addColorChangeListener(final ColorChangeListener listener) {
|
||||
LOG.debug("inside addColorChangeListener");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.vaadin.ui.components.colorpicker.HasColorChangeListener#
|
||||
* removeColorChangeListener(com.
|
||||
* vaadin.ui.components.colorpicker.ColorChangeListener)
|
||||
*/
|
||||
@Override
|
||||
public void removeColorChangeListener(final ColorChangeListener listener) {
|
||||
LOG.debug("inside removeColorChangeListener");
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.vaadin.ui.components.colorpicker.ColorSelector#setColor(com.vaadin.
|
||||
* shared.ui.colorpicker .Color)
|
||||
*/
|
||||
@Override
|
||||
public void setColor(final Color color) {
|
||||
if (color == null) {
|
||||
@@ -788,23 +767,11 @@ public class CreateUpdateSoftwareTypeLayout extends CustomComponent implements C
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.vaadin.ui.components.colorpicker.ColorSelector#getColor()
|
||||
*/
|
||||
@Override
|
||||
public Color getColor() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.vaadin.ui.components.colorpicker.ColorChangeListener#colorChanged(com
|
||||
* .vaadin.ui.components .colorpicker.ColorChangeEvent)
|
||||
*/
|
||||
@Override
|
||||
public void colorChanged(final ColorChangeEvent event) {
|
||||
setColor(event.getColor());
|
||||
|
||||
@@ -35,8 +35,6 @@ import com.vaadin.spring.annotation.ViewScope;
|
||||
/**
|
||||
* Software module type filter buttons.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
@@ -59,6 +57,7 @@ public class SMTypeFilterButtons extends AbstractFilterButtons {
|
||||
* @param filterButtonClickBehaviour
|
||||
* the clickable behaviour.
|
||||
*/
|
||||
@Override
|
||||
public void init(final AbstractFilterButtonClickBehaviour filterButtonClickBehaviour) {
|
||||
super.init(filterButtonClickBehaviour);
|
||||
eventBus.subscribe(this);
|
||||
@@ -86,58 +85,28 @@ public class SMTypeFilterButtons extends AbstractFilterButtons {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.layouts.SPFilterButtons#getButtonsTableId()
|
||||
*/
|
||||
@Override
|
||||
protected String getButtonsTableId() {
|
||||
return SPUIComponetIdProvider.SW_MODULE_TYPE_TABLE_ID;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.layouts.SPFilterButtons#
|
||||
* createButtonsLazyQueryContainer()
|
||||
*/
|
||||
@Override
|
||||
protected LazyQueryContainer createButtonsLazyQueryContainer() {
|
||||
return HawkbitCommonUtil.createLazyQueryContainer(
|
||||
new BeanQueryFactory<SoftwareModuleTypeBeanQuery>(SoftwareModuleTypeBeanQuery.class));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.layouts.SPFilterButtons#isClickedByDefault(java.
|
||||
* lang.Long)
|
||||
*/
|
||||
@Override
|
||||
protected boolean isClickedByDefault(final Long buttonId) {
|
||||
return artifactUploadState.getSoftwareModuleFilters().getSoftwareModuleType().isPresent() && artifactUploadState
|
||||
.getSoftwareModuleFilters().getSoftwareModuleType().get().getId().equals(buttonId);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.layouts.SPFilterButtons#createButtonId(java.lang.
|
||||
* String)
|
||||
*/
|
||||
@Override
|
||||
protected String createButtonId(final String name) {
|
||||
return SPUIComponetIdProvider.SM_TYPE_FILTER_BTN_ID + name;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.filterlayout.SPFilterButtons#
|
||||
* getFilterButtonDropHandler()
|
||||
*/
|
||||
@Override
|
||||
protected DropHandler getFilterButtonDropHandler() {
|
||||
return new DropHandler() {
|
||||
@@ -155,13 +124,6 @@ public class SMTypeFilterButtons extends AbstractFilterButtons {
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* getButttonWrapperId()
|
||||
*/
|
||||
@Override
|
||||
protected String getButttonWrapperIdPrefix() {
|
||||
return SPUIComponetIdProvider.UPLOAD_TYPE_BUTTON_PREFIX;
|
||||
|
||||
@@ -28,9 +28,6 @@ import com.vaadin.ui.Window;
|
||||
|
||||
/**
|
||||
* Software module type filter buttons header.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
@@ -53,6 +50,7 @@ public class SMTypeFilterHeader extends AbstractFilterHeader {
|
||||
/**
|
||||
* Initialize the components.
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
@@ -61,32 +59,16 @@ public class SMTypeFilterHeader extends AbstractFilterHeader {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.layouts.SPFilterHeader#hasCreateUpdatePermission()
|
||||
*/
|
||||
@Override
|
||||
protected boolean hasCreateUpdatePermission() {
|
||||
return permChecker.hasCreateDistributionPermission() || permChecker.hasUpdateDistributionPermission();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.layouts.SPFilterHeader#getTitle()
|
||||
*/
|
||||
@Override
|
||||
protected String getTitle() {
|
||||
return SPUILabelDefinitions.TYPE;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.layouts.SPFilterHeader#settingsIconClicked(com.
|
||||
* vaadin.ui.Button.ClickEvent )
|
||||
*/
|
||||
@Override
|
||||
protected void settingsIconClicked(final ClickEvent event) {
|
||||
final Window addUpdateWindow = createUpdateSWTypeLayout.getWindow();
|
||||
@@ -94,58 +76,27 @@ public class SMTypeFilterHeader extends AbstractFilterHeader {
|
||||
addUpdateWindow.setVisible(Boolean.TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.layouts.SPFilterHeader#dropHitsRequired()
|
||||
*/
|
||||
@Override
|
||||
protected boolean dropHitsRequired() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.filterlayout.SPFilterHeader#
|
||||
* hideFilterButtonLayout()
|
||||
*/
|
||||
@Override
|
||||
protected void hideFilterButtonLayout() {
|
||||
artifactUploadState.setSwTypeFilterClosed(true);
|
||||
eventbus.publish(this, UploadArtifactUIEvent.HIDE_FILTER_BY_TYPE);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.filterlayout.SPFilterHeader#
|
||||
* getConfigureFilterButtonId()
|
||||
*/
|
||||
@Override
|
||||
protected String getConfigureFilterButtonId() {
|
||||
return SPUIDefinitions.ADD_SOFTWARE_MODULE_TYPE;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* getHideButtonId()
|
||||
*/
|
||||
@Override
|
||||
protected String getHideButtonId() {
|
||||
return SPUIComponetIdProvider.SM_SHOW_FILTER_BUTTON_ID;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* isAddTagRequired()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isAddTagRequired() {
|
||||
return true;
|
||||
|
||||
@@ -56,11 +56,7 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Artifact upload confirmation popup.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class UploadConfirmationwindow implements Button.ClickListener {
|
||||
|
||||
@@ -106,7 +102,7 @@ public class UploadConfirmationwindow implements Button.ClickListener {
|
||||
|
||||
private IndexedContainer tabelContainer;
|
||||
|
||||
private final List<UploadStatus> uploadResultList = new ArrayList<UploadStatus>();
|
||||
private final List<UploadStatus> uploadResultList = new ArrayList<>();
|
||||
|
||||
private VerticalLayout uploadArtifactDetails;
|
||||
|
||||
|
||||
@@ -108,8 +108,10 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
||||
public OutputStream receiveUpload(final String fileName, final String mimeType) {
|
||||
this.fileName = fileName;
|
||||
this.mimeType = mimeType;
|
||||
//reset has directory flag before upload
|
||||
view.setHasDirectory(false);
|
||||
try {
|
||||
if (view.validate()) {
|
||||
if (view.checkIfSoftwareModuleIsSelected()) {
|
||||
if (view.checkForDuplicate(fileName)) {
|
||||
view.showDuplicateMessage();
|
||||
} else {
|
||||
@@ -167,7 +169,7 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
||||
view.updateActionCount();
|
||||
|
||||
// display the duplicate message after streaming all files
|
||||
view.displayDuplicateMessageAfterStreamingAll();
|
||||
view.displayDuplicateValidationMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -292,7 +294,7 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
||||
if (view.enableProcessBtn()) {
|
||||
infoWindow.uploadSessionFinished();
|
||||
}
|
||||
view.displayDuplicateMessageAfterStreamingAll();
|
||||
view.displayDuplicateValidationMessage();
|
||||
|
||||
LOG.info("Streaming failed due to :{}", event.getException());
|
||||
}
|
||||
@@ -316,7 +318,6 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
||||
}
|
||||
view.updateActionCount();
|
||||
infoWindow.uploadFailed(event.getFilename(), failureReason);
|
||||
|
||||
LOG.info("Upload failed for file :{}", event.getReason());
|
||||
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.vaadin.event.dd.DragAndDropEvent;
|
||||
import com.vaadin.event.dd.DropHandler;
|
||||
import com.vaadin.event.dd.acceptcriteria.AcceptAll;
|
||||
@@ -69,8 +70,6 @@ import com.vaadin.ui.VerticalLayout;
|
||||
|
||||
/**
|
||||
* Upload files layout.
|
||||
*
|
||||
*
|
||||
*/
|
||||
@ViewScope
|
||||
@SpringComponent
|
||||
@@ -102,7 +101,7 @@ public class UploadLayout extends VerticalLayout {
|
||||
|
||||
private final AtomicInteger numberOfFilesActuallyUpload = new AtomicInteger();
|
||||
|
||||
private final List<String> duplicateFileNamesList = new ArrayList<String>();
|
||||
private final List<String> duplicateFileNamesList = new ArrayList<>();
|
||||
|
||||
private Button processBtn;
|
||||
|
||||
@@ -118,6 +117,8 @@ public class UploadLayout extends VerticalLayout {
|
||||
|
||||
private DragAndDropWrapper dropAreaWrapper;
|
||||
|
||||
private Boolean hasDirectory = Boolean.FALSE;
|
||||
|
||||
/**
|
||||
* Initialize the upload layout.
|
||||
*/
|
||||
@@ -184,27 +185,60 @@ public class UploadLayout extends VerticalLayout {
|
||||
|
||||
@Override
|
||||
public void drop(final DragAndDropEvent event) {
|
||||
if (validate()) {
|
||||
|
||||
if (validate(event)) {
|
||||
final Html5File[] files = ((WrapperTransferable) event.getTransferable()).getFiles();
|
||||
if (files != null) {
|
||||
for (final Html5File file : files) {
|
||||
if (!checkForDuplicate(file.getFileName())) {
|
||||
numberOfFileUploadsExpected.incrementAndGet();
|
||||
file.setStreamVariable(createStreamVariable(file));
|
||||
}
|
||||
}
|
||||
if (numberOfFileUploadsExpected.get() > 0) {
|
||||
processBtn.setEnabled(false);
|
||||
// reset before we start
|
||||
uploadInfoWindow.uploadSessionStarted();
|
||||
}
|
||||
// in case if all selected files are duplicate ,then display
|
||||
// message
|
||||
displayDuplicateMessageAfterStreamingAll();
|
||||
// reset the flag
|
||||
hasDirectory = Boolean.FALSE;
|
||||
for (final Html5File file : files) {
|
||||
processFile(file);
|
||||
}
|
||||
if (numberOfFileUploadsExpected.get() > 0) {
|
||||
processBtn.setEnabled(false);
|
||||
// reset before we start
|
||||
uploadInfoWindow.uploadSessionStarted();
|
||||
} else {
|
||||
// If the upload is not started, it signifies all
|
||||
// dropped files as either duplicate or directory.So
|
||||
// display message accordingly
|
||||
displayCompositeMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void processFile(final Html5File file) {
|
||||
if (!isDirectory(file)) {
|
||||
if (!checkForDuplicate(file.getFileName())) {
|
||||
numberOfFileUploadsExpected.incrementAndGet();
|
||||
file.setStreamVariable(createStreamVariable(file));
|
||||
}
|
||||
} else {
|
||||
hasDirectory = Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isDirectory(final Html5File file) {
|
||||
if (Strings.isNullOrEmpty(file.getType()) && file.getFileSize() % 4096 == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void displayCompositeMessage() {
|
||||
final String duplicateMessage = getDuplicateFileValidationMessage();
|
||||
final StringBuilder compositeMessage = new StringBuilder();
|
||||
if (!Strings.isNullOrEmpty(duplicateMessage)) {
|
||||
compositeMessage.append(duplicateMessage);
|
||||
}
|
||||
if (hasDirectory) {
|
||||
if (compositeMessage.length() > 0) {
|
||||
compositeMessage.append("<br>");
|
||||
}
|
||||
compositeMessage.append(i18n.get("message.no.directory.upload"));
|
||||
}
|
||||
if (!compositeMessage.toString().isEmpty()) {
|
||||
uiNotification.displayValidationError(compositeMessage.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private VerticalLayout createDropAreaLayout() {
|
||||
@@ -315,10 +349,33 @@ public class UploadLayout extends VerticalLayout {
|
||||
}
|
||||
}
|
||||
|
||||
Boolean validate() {
|
||||
Boolean validate(DragAndDropEvent event) {
|
||||
// check if drop is valid.If valid ,check if software module is
|
||||
// selected.
|
||||
if(!isFilesDropped(event)){
|
||||
uiNotification.displayValidationError(i18n.get("message.action.not.allowed"));
|
||||
return false;
|
||||
}
|
||||
return checkIfSoftwareModuleIsSelected();
|
||||
}
|
||||
|
||||
private boolean isFilesDropped(DragAndDropEvent event) {
|
||||
if (event.getTransferable() instanceof WrapperTransferable) {
|
||||
final Html5File[] files = ((WrapperTransferable) event.getTransferable()).getFiles();
|
||||
// other components can also be wrapped in WrapperTransferable , so
|
||||
// additional check on files
|
||||
if (files == null) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Boolean checkIfSoftwareModuleIsSelected() {
|
||||
if (!isSoftwareModuleSelected()) {
|
||||
uiNotification.displayValidationError(i18n.get("message.error.noSwModuleSelected"));
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -383,27 +440,30 @@ public class UploadLayout extends VerticalLayout {
|
||||
}
|
||||
}
|
||||
|
||||
void displayDuplicateMessageAfterStreamingAll() {
|
||||
void displayDuplicateValidationMessage() {
|
||||
// check if streaming of all dropped files are completed
|
||||
if (numberOfFilesActuallyUpload.intValue() == numberOfFileUploadsExpected.intValue()) {
|
||||
showDuplicateMessage();
|
||||
displayCompositeMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show duplicate file selected message.
|
||||
*/
|
||||
public void showDuplicateMessage() {
|
||||
private String getDuplicateFileValidationMessage() {
|
||||
StringBuilder message = new StringBuilder();
|
||||
if (!duplicateFileNamesList.isEmpty()) {
|
||||
final String fileNames = StringUtils.collectionToCommaDelimitedString(duplicateFileNamesList);
|
||||
if (duplicateFileNamesList.size() == 1) {
|
||||
uiNotification.displayValidationError(i18n.get("message.no.duplicateFile") + fileNames);
|
||||
message.append(i18n.get("message.no.duplicateFile") + fileNames);
|
||||
|
||||
} else if (duplicateFileNamesList.size() > 1) {
|
||||
uiNotification.displayValidationError(i18n.get("message.no.duplicateFiles"));
|
||||
message.append(i18n.get("message.no.duplicateFiles"));
|
||||
}
|
||||
duplicateFileNamesList.clear();
|
||||
}
|
||||
return message.toString();
|
||||
}
|
||||
|
||||
public void showDuplicateMessage() {
|
||||
uiNotification.displayValidationError(getDuplicateFileValidationMessage());
|
||||
}
|
||||
|
||||
void increaseNumberOfFileUploadsExpected() {
|
||||
@@ -595,4 +655,8 @@ public class UploadLayout extends VerticalLayout {
|
||||
return uiNotification;
|
||||
}
|
||||
|
||||
|
||||
public void setHasDirectory(Boolean hasDirectory) {
|
||||
this.hasDirectory = hasDirectory;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class UploadResultWindow implements Button.ClickListener {
|
||||
|
||||
private static final long serialVersionUID = 5205927189362269027L;
|
||||
|
||||
private List<UploadStatus> uploadResultList = new ArrayList<UploadStatus>();
|
||||
private List<UploadStatus> uploadResultList = new ArrayList<>();
|
||||
|
||||
private Button closeBtn;
|
||||
|
||||
|
||||
@@ -29,9 +29,6 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
*
|
||||
* module.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ConfirmationDialog implements Button.ClickListener {
|
||||
/** Serial version UID. */
|
||||
@@ -127,6 +124,7 @@ public class ConfirmationDialog implements Button.ClickListener {
|
||||
* @param event
|
||||
* the click event.
|
||||
*/
|
||||
@Override
|
||||
public void buttonClick(final ClickEvent event) {
|
||||
if (window.getParent() != null) {
|
||||
UI.getCurrent().removeWindow(window);
|
||||
@@ -146,6 +144,7 @@ public class ConfirmationDialog implements Button.ClickListener {
|
||||
/**
|
||||
* Interface for confirmation dialog callbacks.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ConfirmationDialogCallback {
|
||||
/**
|
||||
* The user response.
|
||||
|
||||
@@ -83,7 +83,7 @@ public class DistributionSetTypeBeanQuery extends AbstractBeanQuery<Distribution
|
||||
@Override
|
||||
protected List<DistributionSetType> loadBeans(final int startIndex, final int count) {
|
||||
Page<DistributionSetType> typeBeans;
|
||||
final List<DistributionSetType> distSetTypeList = new ArrayList<DistributionSetType>();
|
||||
final List<DistributionSetType> distSetTypeList = new ArrayList<>();
|
||||
if (startIndex == 0 && firstPageDistSetType != null) {
|
||||
typeBeans = firstPageDistSetType;
|
||||
} else {
|
||||
|
||||
@@ -45,8 +45,6 @@ import com.vaadin.ui.UI;
|
||||
|
||||
/**
|
||||
* Implementation of target/ds tag token layout.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@@ -80,6 +78,7 @@ public class DistributionTagToken extends AbstractTagToken {
|
||||
// To Be Done : have to set this value based on view???
|
||||
private static final Boolean NOTAGS_SELECTED = Boolean.FALSE;
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
@@ -88,34 +87,16 @@ public class DistributionTagToken extends AbstractTagToken {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.tagDetails.AbstractTagToken#getTagStyleName
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
protected String getTagStyleName() {
|
||||
return "distribution-tag-";
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.tagDetails.AbstractTagToken#
|
||||
* getTokenInputPrompt()
|
||||
*/
|
||||
@Override
|
||||
protected String getTokenInputPrompt() {
|
||||
return i18n.get("combo.type.tag.name");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.tagDetails.AbstractTagToken#assignTag(java.
|
||||
* lang.String)
|
||||
*/
|
||||
@Override
|
||||
protected void assignTag(final String tagNameSelected) {
|
||||
if (tagNameSelected != null) {
|
||||
@@ -129,7 +110,7 @@ public class DistributionTagToken extends AbstractTagToken {
|
||||
}
|
||||
|
||||
private DistributionSetTagAssigmentResult toggleAssignment(final String tagNameSelected) {
|
||||
final Set<Long> distributionList = new HashSet<Long>();
|
||||
final Set<Long> distributionList = new HashSet<>();
|
||||
distributionList.add(selectedDS.getId());
|
||||
final DistributionSetTagAssigmentResult result = distributionSetManagement.toggleTagAssignment(distributionList,
|
||||
tagNameSelected);
|
||||
@@ -137,12 +118,6 @@ public class DistributionTagToken extends AbstractTagToken {
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.tagDetails.AbstractTagToken#unassignTag(
|
||||
* java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
protected void unassignTag(final String tagName) {
|
||||
final DistributionSetTagAssigmentResult result = toggleAssignment(tagName);
|
||||
@@ -160,26 +135,14 @@ public class DistributionTagToken extends AbstractTagToken {
|
||||
|
||||
/* To Be Done : this implementation will vary in views */
|
||||
private List<String> getClickedTagList() {
|
||||
return new ArrayList<String>();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.tagDetails.AbstractTagToken#
|
||||
* hasUpdatePermission()
|
||||
*/
|
||||
@Override
|
||||
protected Boolean isToggleTagAssignmentAllowed() {
|
||||
return spChecker.hasUpdateDistributionPermission();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.tagDetails.AbstractTagToken#
|
||||
* displayAlreadyAssignedTags()
|
||||
*/
|
||||
@Override
|
||||
public void displayAlreadyAssignedTags() {
|
||||
removePreviouslyAddedTokens();
|
||||
@@ -190,12 +153,6 @@ public class DistributionTagToken extends AbstractTagToken {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.tagDetails.AbstractTagToken#
|
||||
* populateContainer()
|
||||
*/
|
||||
@Override
|
||||
protected void populateContainer() {
|
||||
container.removeAllItems();
|
||||
|
||||
@@ -78,7 +78,7 @@ public class TargetTagToken extends AbstractTargetTagToken {
|
||||
}
|
||||
|
||||
private TargetTagAssigmentResult toggleAssignment(final String tagNameSelected) {
|
||||
final Set<String> targetList = new HashSet<String>();
|
||||
final Set<String> targetList = new HashSet<>();
|
||||
targetList.add(selectedTarget.getControllerId());
|
||||
final TargetTagAssigmentResult result = targetManagement.toggleTagAssignment(targetList, tagNameSelected);
|
||||
uinotification.displaySuccess(HawkbitCommonUtil.getTargetTagAssigmentMsg(tagNameSelected, result, i18n));
|
||||
@@ -102,7 +102,7 @@ public class TargetTagToken extends AbstractTargetTagToken {
|
||||
|
||||
/* To Be Done : this implementation will vary in views */
|
||||
private List<String> getClickedTagList() {
|
||||
return new ArrayList<String>();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,29 +14,11 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Style for button: Primary.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SPUIButtonStylePrimarySmall implements SPUIButtonDecorator {
|
||||
|
||||
/**
|
||||
* Decorate Button and return.
|
||||
*
|
||||
* @param button
|
||||
* as Button
|
||||
* @param style
|
||||
* as String
|
||||
* @param setStyle
|
||||
* as String
|
||||
* @param icon
|
||||
* as resource
|
||||
* @return Button
|
||||
*/
|
||||
public Button decorate(Button button, String style, boolean setStyle, Resource icon) {
|
||||
@Override
|
||||
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
|
||||
button.addStyleName(ValoTheme.BUTTON_PRIMARY + " " + ValoTheme.BUTTON_SMALL);
|
||||
// Set Style
|
||||
if (null != style) {
|
||||
|
||||
@@ -14,29 +14,12 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Style for button: Small.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SPUIButtonStyleSmall implements SPUIButtonDecorator {
|
||||
|
||||
/**
|
||||
* Decorate Button and return.
|
||||
*
|
||||
* @param button
|
||||
* as Button
|
||||
* @param style
|
||||
* as String
|
||||
* @param setStyle
|
||||
* as String
|
||||
* @param icon
|
||||
* as resource
|
||||
* @return Button
|
||||
*/
|
||||
public Button decorate(Button button, String style, boolean setStyle, Resource icon) {
|
||||
@Override
|
||||
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
|
||||
button.addStyleName(ValoTheme.BUTTON_SMALL);
|
||||
// Set Style
|
||||
if (null != style) {
|
||||
|
||||
@@ -14,29 +14,12 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Style for button: Small NoBorder Height UnDefined.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SPUIButtonStyleSmallNoBorderUH implements SPUIButtonDecorator {
|
||||
|
||||
/**
|
||||
* Decorate Button and return.
|
||||
*
|
||||
* @param button
|
||||
* as Button
|
||||
* @param style
|
||||
* as String
|
||||
* @param setStyle
|
||||
* as String
|
||||
* @param icon
|
||||
* as resource
|
||||
* @return Button
|
||||
*/
|
||||
public Button decorate(Button button, String style, boolean setStyle, Resource icon) {
|
||||
@Override
|
||||
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
|
||||
button.addStyleName(ValoTheme.BUTTON_SMALL);
|
||||
button.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
|
||||
button.setHeightUndefined();
|
||||
|
||||
@@ -14,29 +14,12 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Style for button: Small NoBorder Height and size UnDefined.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SPUIButtonStyleSmallNoBorderUHS implements SPUIButtonDecorator {
|
||||
|
||||
/**
|
||||
* Decorate Button and return.
|
||||
*
|
||||
* @param button
|
||||
* as Button
|
||||
* @param style
|
||||
* as String
|
||||
* @param setStyle
|
||||
* as String
|
||||
* @param icon
|
||||
* as resource
|
||||
* @return Button
|
||||
*/
|
||||
public Button decorate(Button button, String style, boolean setStyle, Resource icon) {
|
||||
@Override
|
||||
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
|
||||
button.addStyleName(ValoTheme.BUTTON_SMALL);
|
||||
button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
|
||||
button.setHeightUndefined();
|
||||
|
||||
@@ -14,29 +14,12 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Style for button: Small.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SPUIButtonStyleTiny implements SPUIButtonDecorator {
|
||||
|
||||
/**
|
||||
* Decorate Button and return.
|
||||
*
|
||||
* @param button
|
||||
* as Button
|
||||
* @param style
|
||||
* as String
|
||||
* @param setStyle
|
||||
* as String
|
||||
* @param icon
|
||||
* as resource
|
||||
* @return Button
|
||||
*/
|
||||
public Button decorate(Button button, String style, boolean setStyle, Resource icon) {
|
||||
@Override
|
||||
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
|
||||
button.addStyleName(ValoTheme.BUTTON_TINY);
|
||||
// Set Style
|
||||
if (null != style) {
|
||||
|
||||
@@ -16,27 +16,10 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Style for button: Tag.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SPUITagButtonStyle implements SPUIButtonDecorator {
|
||||
/**
|
||||
* Decorate Button and return.
|
||||
*
|
||||
* @param button
|
||||
* as Button
|
||||
* @param style
|
||||
* as String
|
||||
* @param setStyle
|
||||
* as String
|
||||
* @param icon
|
||||
* as resource
|
||||
* @return Button
|
||||
*/
|
||||
|
||||
@Override
|
||||
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
|
||||
|
||||
/**
|
||||
|
||||
@@ -79,8 +79,6 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Window for create update Distribution Set Type.
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
@@ -221,7 +219,7 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
|
||||
|
||||
getPreviewButtonColor(DEFAULT_COLOR);
|
||||
|
||||
selectors = new HashSet<ColorSelector>();
|
||||
selectors = new HashSet<>();
|
||||
selectedColor = new Color(44, 151, 32);
|
||||
selPreview = new SpColorPickerPreview(selectedColor);
|
||||
|
||||
@@ -457,6 +455,7 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
|
||||
sourceTable.setItemDescriptionGenerator(new ItemDescriptionGenerator() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String generateDescription(final Component source, final Object itemId, final Object propertyId) {
|
||||
final Item item = sourceTable.getItem(itemId);
|
||||
final String description = (String) item.getItemProperty(DIST_TYPE_DESCRIPTION).getValue();
|
||||
@@ -475,7 +474,7 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void getSelectedTableItemData(final Long id) {
|
||||
Item saveTblitem = null;
|
||||
Item saveTblitem;
|
||||
if (null != selectedTablecontainer) {
|
||||
saveTblitem = selectedTablecontainer.addItem(id);
|
||||
saveTblitem.getItemProperty(DIST_TYPE_NAME).setValue(
|
||||
@@ -657,10 +656,10 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
|
||||
DistributionSetType newDistType = new DistributionSetType(typeKeyValue, typeNameValue, typeDescValue);
|
||||
for (final Long id : itemIds) {
|
||||
final Item item = selectedTable.getItem(id);
|
||||
final String dist_type_name = (String) item.getItemProperty(DIST_TYPE_NAME).getValue();
|
||||
final String distTypeName = (String) item.getItemProperty(DIST_TYPE_NAME).getValue();
|
||||
final CheckBox mandatoryCheckBox = (CheckBox) item.getItemProperty(DIST_TYPE_MANDATORY).getValue();
|
||||
final Boolean isMandatory = mandatoryCheckBox.getValue();
|
||||
final SoftwareModuleType swModuleType = softwareManagement.findSoftwareModuleTypeByName(dist_type_name);
|
||||
final SoftwareModuleType swModuleType = softwareManagement.findSoftwareModuleTypeByName(distTypeName);
|
||||
if (isMandatory) {
|
||||
newDistType.addMandatoryModuleType(swModuleType);
|
||||
|
||||
@@ -1032,7 +1031,6 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
|
||||
* as the selected tag from combo
|
||||
*/
|
||||
private void setTypeTagCombo(final String distSetTypeSelected) {
|
||||
boolean mandatory = false;
|
||||
typeName.setValue(distSetTypeSelected);
|
||||
getSourceTableData();
|
||||
selectedTable.getContainerDataSource().removeAllItems();
|
||||
@@ -1053,13 +1051,11 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
|
||||
saveDistSetType.setEnabled(false);
|
||||
}
|
||||
for (final SoftwareModuleType swModuleType : selectedTypeTag.getOptionalModuleTypes()) {
|
||||
mandatory = false;
|
||||
addTargetTableforUpdate(swModuleType, mandatory);
|
||||
addTargetTableforUpdate(swModuleType, false);
|
||||
}
|
||||
|
||||
for (final SoftwareModuleType swModuleType : selectedTypeTag.getMandatoryModuleTypes()) {
|
||||
mandatory = true;
|
||||
addTargetTableforUpdate(swModuleType, mandatory);
|
||||
addTargetTableforUpdate(swModuleType, true);
|
||||
}
|
||||
|
||||
if (null == selectedTypeTag.getColour()) {
|
||||
|
||||
@@ -60,44 +60,24 @@ public class DSTypeFilterButtons extends AbstractFilterButtons {
|
||||
* @param filterButtonClickBehaviour
|
||||
* the clickable behaviour.
|
||||
*/
|
||||
@Override
|
||||
public void init(final AbstractFilterButtonClickBehaviour filterButtonClickBehaviour) {
|
||||
super.init(filterButtonClickBehaviour);
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* getButtonsTableId()
|
||||
*/
|
||||
@Override
|
||||
protected String getButtonsTableId() {
|
||||
|
||||
return SPUIComponetIdProvider.DISTRIBUTION_SET_TYPE_TABLE_ID;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* createButtonsLazyQueryContainer ()
|
||||
*/
|
||||
@Override
|
||||
protected LazyQueryContainer createButtonsLazyQueryContainer() {
|
||||
return HawkbitCommonUtil.createLazyQueryContainer(
|
||||
new BeanQueryFactory<DistributionSetTypeBeanQuery>(DistributionSetTypeBeanQuery.class));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* isClickedByDefault(java.lang .Long)
|
||||
*/
|
||||
@Override
|
||||
protected boolean isClickedByDefault(final Long buttonId) {
|
||||
|
||||
@@ -105,26 +85,12 @@ public class DSTypeFilterButtons extends AbstractFilterButtons {
|
||||
&& manageDistUIState.getManageDistFilters().getClickedDistSetType().getId().equals(buttonId);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* createButtonId(java.lang. String)
|
||||
*/
|
||||
@Override
|
||||
protected String createButtonId(final String name) {
|
||||
|
||||
return SPUIComponetIdProvider.DS_TYPE_FILTER_BTN_ID + name;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* getFilterButtonDropHandler()
|
||||
*/
|
||||
@Override
|
||||
protected DropHandler getFilterButtonDropHandler() {
|
||||
|
||||
@@ -148,13 +114,6 @@ public class DSTypeFilterButtons extends AbstractFilterButtons {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* getButttonWrapperId()
|
||||
*/
|
||||
@Override
|
||||
protected String getButttonWrapperIdPrefix() {
|
||||
|
||||
|
||||
@@ -27,9 +27,6 @@ import com.vaadin.ui.Window;
|
||||
|
||||
/**
|
||||
* Distribution Set Type filter buttons header.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
@@ -49,9 +46,7 @@ public class DSTypeFilterHeader extends AbstractFilterHeader {
|
||||
@Autowired
|
||||
private CreateUpdateDistSetTypeLayout createUpdateDistSetTypeLayout;
|
||||
|
||||
/**
|
||||
* Initialize the components.
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
super.init();
|
||||
@@ -60,37 +55,16 @@ public class DSTypeFilterHeader extends AbstractFilterHeader {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* hasCreateUpdatePermission()
|
||||
*/
|
||||
@Override
|
||||
protected boolean hasCreateUpdatePermission() {
|
||||
|
||||
return permChecker.hasCreateDistributionPermission() || permChecker.hasUpdateDistributionPermission();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#getTitle(
|
||||
* )
|
||||
*/
|
||||
@Override
|
||||
protected String getTitle() {
|
||||
return SPUILabelDefinitions.TYPE;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* settingsIconClicked(com.vaadin .ui.Button.ClickEvent)
|
||||
*/
|
||||
@Override
|
||||
protected void settingsIconClicked(final ClickEvent event) {
|
||||
final Window addUpdateWindow = createUpdateDistSetTypeLayout.getWindow();
|
||||
@@ -99,25 +73,11 @@ public class DSTypeFilterHeader extends AbstractFilterHeader {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* dropHitsRequired()
|
||||
*/
|
||||
@Override
|
||||
protected boolean dropHitsRequired() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* hideFilterButtonLayout()
|
||||
*/
|
||||
@Override
|
||||
protected void hideFilterButtonLayout() {
|
||||
manageDistUIState.setDistTypeFilterClosed(true);
|
||||
@@ -125,38 +85,17 @@ public class DSTypeFilterHeader extends AbstractFilterHeader {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* getConfigureFilterButtonId()
|
||||
*/
|
||||
@Override
|
||||
protected String getConfigureFilterButtonId() {
|
||||
|
||||
return SPUIDefinitions.ADD_DISTRIBUTION_TYPE_TAG;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* getHideButtonId()
|
||||
*/
|
||||
@Override
|
||||
protected String getHideButtonId() {
|
||||
|
||||
return SPUIDefinitions.HIDE_FILTER_DIST_TYPE;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* isAddTagRequired()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isAddTagRequired() {
|
||||
return true;
|
||||
|
||||
@@ -74,8 +74,6 @@ import com.vaadin.ui.UI;
|
||||
/**
|
||||
* Distribution set table.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
@@ -136,49 +134,36 @@ public class DistributionSetTable extends AbstractTable {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#getTableId()
|
||||
*/
|
||||
@Override
|
||||
protected String getTableId() {
|
||||
return SPUIComponetIdProvider.DIST_TABLE_ID;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#createContainer(
|
||||
* )
|
||||
*/
|
||||
@Override
|
||||
protected Container createContainer() {
|
||||
|
||||
final Map<String, Object> queryConfiguration = new HashMap<>();
|
||||
manageDistUIState.getManageDistFilters().getSearchText()
|
||||
.ifPresent(value -> queryConfiguration.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
||||
|
||||
if (null != manageDistUIState.getManageDistFilters().getClickedDistSetType()) {
|
||||
queryConfiguration.put(SPUIDefinitions.FILTER_BY_DISTRIBUTION_SET_TYPE,
|
||||
manageDistUIState.getManageDistFilters().getClickedDistSetType());
|
||||
}
|
||||
|
||||
final Map<String, Object> queryConfiguration = prepareQueryConfigFilters();
|
||||
final BeanQueryFactory<ManageDistBeanQuery> distributionQF = new BeanQueryFactory<>(ManageDistBeanQuery.class);
|
||||
|
||||
distributionQF.setQueryConfiguration(queryConfiguration);
|
||||
return new LazyQueryContainer(
|
||||
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_DIST_ID_NAME),
|
||||
distributionQF);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTable#addContainerProperties
|
||||
* (com.vaadin.data.Container )
|
||||
*/
|
||||
private Map<String, Object> prepareQueryConfigFilters() {
|
||||
final Map<String, Object> queryConfig = new HashMap<>();
|
||||
manageDistUIState.getManageDistFilters().getSearchText()
|
||||
.ifPresent(value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
||||
|
||||
if (null != manageDistUIState.getManageDistFilters().getClickedDistSetType()) {
|
||||
queryConfig.put(SPUIDefinitions.FILTER_BY_DISTRIBUTION_SET_TYPE,
|
||||
manageDistUIState.getManageDistFilters().getClickedDistSetType());
|
||||
}
|
||||
|
||||
return queryConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addContainerProperties(final Container container) {
|
||||
HawkbitCommonUtil.getDsTableColumnProperties(container);
|
||||
@@ -186,12 +171,6 @@ public class DistributionSetTable extends AbstractTable {
|
||||
Boolean.class, null, false, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTable#
|
||||
* addCustomGeneratedColumns ()
|
||||
*/
|
||||
@Override
|
||||
protected void addCustomGeneratedColumns() {
|
||||
/**
|
||||
@@ -199,23 +178,12 @@ public class DistributionSetTable extends AbstractTable {
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTable#
|
||||
* isFirstRowSelectedOnLoad ()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isFirstRowSelectedOnLoad() {
|
||||
return !manageDistUIState.getSelectedDistributions().isPresent()
|
||||
|| manageDistUIState.getSelectedDistributions().get().isEmpty();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTable#getItemIdToSelect()
|
||||
*/
|
||||
@Override
|
||||
protected Object getItemIdToSelect() {
|
||||
if (manageDistUIState.getSelectedDistributions().isPresent()) {
|
||||
@@ -224,12 +192,6 @@ public class DistributionSetTable extends AbstractTable {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#onValueChange()
|
||||
*/
|
||||
@Override
|
||||
protected void onValueChange() {
|
||||
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||
@@ -264,33 +226,16 @@ public class DistributionSetTable extends AbstractTable {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#isMaximized()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isMaximized() {
|
||||
return manageDistUIState.isDsTableMaximized();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTable#getTableVisibleColumns
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
protected List<TableColumn> getTableVisibleColumns() {
|
||||
return HawkbitCommonUtil.getTableVisibleColumns(isMaximized(), false, i18n);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTable#getTableDropHandler()
|
||||
*/
|
||||
@Override
|
||||
protected DropHandler getTableDropHandler() {
|
||||
return new DropHandler() {
|
||||
|
||||
@@ -36,8 +36,6 @@ import com.vaadin.ui.Window;
|
||||
|
||||
/**
|
||||
* Distribution table header.
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
@@ -60,9 +58,7 @@ public class DistributionSetTableHeader extends AbstractTableHeader {
|
||||
@Autowired
|
||||
private DistributionAddUpdateWindowLayout addUpdateWindowLayout;
|
||||
|
||||
/**
|
||||
* Initialize the component.
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
@@ -76,54 +72,26 @@ public class DistributionSetTableHeader extends AbstractTableHeader {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#getHeaderCaption(
|
||||
* )
|
||||
*/
|
||||
@Override
|
||||
protected String getHeaderCaption() {
|
||||
return i18n.get("header.dist.table");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#getSearchBoxId()
|
||||
*/
|
||||
@Override
|
||||
protected String getSearchBoxId() {
|
||||
return SPUIComponetIdProvider.DIST_SEARCH_TEXTFIELD;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
||||
* getSearchRestIconId()
|
||||
*/
|
||||
@Override
|
||||
protected String getSearchRestIconId() {
|
||||
return SPUIComponetIdProvider.DIST_SEARCH_ICON;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#getAddIconId()
|
||||
*/
|
||||
@Override
|
||||
protected String getAddIconId() {
|
||||
return SPUIComponetIdProvider.DIST_ADD_ICON;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
||||
* onLoadSearchBoxValue()
|
||||
*/
|
||||
@Override
|
||||
protected String onLoadSearchBoxValue() {
|
||||
if (manageDistUIstate.getManageDistFilters().getSearchText().isPresent()) {
|
||||
@@ -132,11 +100,6 @@ public class DistributionSetTableHeader extends AbstractTableHeader {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#getDropFilterId()
|
||||
*/
|
||||
@Override
|
||||
protected String getDropFilterId() {
|
||||
return null;
|
||||
@@ -170,9 +133,10 @@ public class DistributionSetTableHeader extends AbstractTableHeader {
|
||||
|
||||
@Override
|
||||
protected void resetSearchText() {
|
||||
manageDistUIstate.getManageDistFilters().setSearchText(null);
|
||||
eventbus.publish(this, DistributionTableFilterEvent.REMOVE_FILTER_BY_TEXT);
|
||||
|
||||
if (manageDistUIstate.getManageDistFilters().getSearchText().isPresent()) {
|
||||
manageDistUIstate.getManageDistFilters().setSearchText(null);
|
||||
eventbus.publish(this, DistributionTableFilterEvent.REMOVE_FILTER_BY_TEXT);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -222,11 +186,6 @@ public class DistributionSetTableHeader extends AbstractTableHeader {
|
||||
eventbus.unsubscribe(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#canAddNewItem()
|
||||
*/
|
||||
@Override
|
||||
protected Boolean isAddNewItemAllowed() {
|
||||
return Boolean.TRUE;
|
||||
@@ -247,47 +206,21 @@ public class DistributionSetTableHeader extends AbstractTableHeader {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
||||
* getBulkUploadIconId()
|
||||
*/
|
||||
@Override
|
||||
protected String getBulkUploadIconId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#bulkUpload(com.
|
||||
* vaadin.ui.Button.ClickEvent )
|
||||
*/
|
||||
@Override
|
||||
protected void bulkUpload(final ClickEvent event) {
|
||||
/**
|
||||
* No implementation as no bulk upload is supported.
|
||||
*/
|
||||
// No implementation as no bulk upload is supported.
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
||||
* isBulkUploadAllowed()
|
||||
*/
|
||||
@Override
|
||||
protected Boolean isBulkUploadAllowed() {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.common.table.AbstractTableHeader#
|
||||
* isBulkUploadInProgress()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isBulkUploadInProgress() {
|
||||
return false;
|
||||
|
||||
@@ -37,8 +37,6 @@ import com.google.common.base.Strings;
|
||||
/**
|
||||
* Manage Distributions table bean query.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
|
||||
|
||||
@@ -83,28 +81,15 @@ public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#constructBean()
|
||||
*/
|
||||
@Override
|
||||
protected ProxyDistribution constructBean() {
|
||||
return new ProxyDistribution();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#loadBeans(int,
|
||||
* int)
|
||||
*/
|
||||
@Override
|
||||
protected List<ProxyDistribution> loadBeans(final int startIndex, final int count) {
|
||||
Page<DistributionSet> distBeans;
|
||||
final List<ProxyDistribution> proxyDistributions = new ArrayList<ProxyDistribution>();
|
||||
final List<ProxyDistribution> proxyDistributions = new ArrayList<>();
|
||||
if (startIndex == 0 && firstPageDistributionSets != null) {
|
||||
distBeans = firstPageDistributionSets;
|
||||
} else if (Strings.isNullOrEmpty(searchText)) {
|
||||
@@ -136,24 +121,12 @@ public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
|
||||
return proxyDistributions;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#saveBeans(java.
|
||||
* util.List, java.util.List, java.util.List)
|
||||
*/
|
||||
@Override
|
||||
protected void saveBeans(final List<ProxyDistribution> arg0, final List<ProxyDistribution> arg1,
|
||||
final List<ProxyDistribution> arg2) {
|
||||
// Add,Delete and Update are performed through repository methods
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#size()
|
||||
*/
|
||||
@Override
|
||||
public int size() {
|
||||
if (Strings.isNullOrEmpty(searchText) && null == distributionSetType) {
|
||||
|
||||
@@ -28,8 +28,6 @@ import com.vaadin.ui.Component;
|
||||
/**
|
||||
* Distributions View for Accept criteria.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
@@ -47,12 +45,6 @@ public class DistributionsViewAcceptCriteria extends AbstractAcceptCriteria {
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.AbstractAcceptCriteria#analyseDragComponent
|
||||
* (com.vaadin.event .dd.DragAndDropEvent, com.vaadin.ui.Component)
|
||||
*/
|
||||
@Override
|
||||
protected void analyseDragComponent(final Component compsource) {
|
||||
final String sourceID = getComponentId(compsource);
|
||||
@@ -60,24 +52,11 @@ public class DistributionsViewAcceptCriteria extends AbstractAcceptCriteria {
|
||||
eventBus.publish(this, event);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#hideDropHints
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
protected void hideDropHints() {
|
||||
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#invalidDrop()
|
||||
*/
|
||||
@Override
|
||||
protected void invalidDrop() {
|
||||
uiNotification.displayValidationError(SPUILabelDefinitions.ACTION_NOT_ALLOWED);
|
||||
@@ -94,34 +73,16 @@ public class DistributionsViewAcceptCriteria extends AbstractAcceptCriteria {
|
||||
return id;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#
|
||||
* getDropHintConfigurations()
|
||||
*/
|
||||
@Override
|
||||
protected Map<String, Object> getDropHintConfigurations() {
|
||||
return DROP_HINTS_CONFIGS;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#
|
||||
* publishDragStartEvent(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
protected void publishDragStartEvent(final Object event) {
|
||||
eventBus.publish(this, event);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#
|
||||
* getDropConfigurations()
|
||||
*/
|
||||
@Override
|
||||
protected Map<String, List<String>> getDropConfigurations() {
|
||||
return DROP_CONFIGS;
|
||||
@@ -137,7 +98,7 @@ public class DistributionsViewAcceptCriteria extends AbstractAcceptCriteria {
|
||||
}
|
||||
|
||||
private static Map<String, List<String>> createDropConfigurations() {
|
||||
final Map<String, List<String>> config = new HashMap<String, List<String>>();
|
||||
final Map<String, List<String>> config = new HashMap<>();
|
||||
|
||||
// Delete drop area droppable components
|
||||
config.put(SPUIComponetIdProvider.DELETE_BUTTON_WRAPPER_ID,
|
||||
@@ -153,7 +114,7 @@ public class DistributionsViewAcceptCriteria extends AbstractAcceptCriteria {
|
||||
}
|
||||
|
||||
private static Map<String, Object> createDropHintConfigurations() {
|
||||
final Map<String, Object> config = new HashMap<String, Object>();
|
||||
final Map<String, Object> config = new HashMap<>();
|
||||
config.put(SPUIDefinitions.DISTRIBUTION_TYPE_ID_PREFIXS, DragEvent.DISTRIBUTION_TYPE_DRAG);
|
||||
config.put(SPUIComponetIdProvider.DIST_TABLE_ID, DragEvent.DISTRIBUTION_DRAG);
|
||||
config.put(SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE, DragEvent.SOFTWAREMODULE_DRAG);
|
||||
|
||||
@@ -32,9 +32,6 @@ import com.google.common.base.Strings;
|
||||
/**
|
||||
* Simple implementation of generics bean query which dynamically loads a batch
|
||||
* of beans.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem> {
|
||||
@@ -77,17 +74,10 @@ public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem>
|
||||
return new ProxyBaseSwModuleItem();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery#loadBeans(int,
|
||||
* int)
|
||||
*/
|
||||
@Override
|
||||
protected List<ProxyBaseSwModuleItem> loadBeans(final int startIndex, final int count) {
|
||||
final Slice<CustomSoftwareModule> swModuleBeans;
|
||||
final List<ProxyBaseSwModuleItem> proxyBeans = new ArrayList<ProxyBaseSwModuleItem>();
|
||||
final List<ProxyBaseSwModuleItem> proxyBeans = new ArrayList<>();
|
||||
|
||||
swModuleBeans = getSoftwareManagement().findSoftwareModuleOrderByDistribution(
|
||||
new OffsetBasedPageRequest(startIndex, count, new Sort(Direction.ASC, "name", "version")),
|
||||
|
||||
@@ -39,9 +39,6 @@ import com.vaadin.ui.Window;
|
||||
/**
|
||||
* Implementation of software module details block using generic abstract
|
||||
* details style .
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
@@ -70,9 +67,7 @@ public class SwModuleDetails extends AbstractTableDetailsLayout {
|
||||
|
||||
private SoftwareModule selectedSwModule;
|
||||
|
||||
/**
|
||||
* Initialize the component.
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
@@ -133,49 +128,21 @@ public class SwModuleDetails extends AbstractTableDetailsLayout {
|
||||
detailsTab.addTab(createLogLayout(), i18n.get("caption.logs.tab"), null);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.detailslayout.TableDetailsLayout#
|
||||
* getDefaultCaption()
|
||||
*/
|
||||
@Override
|
||||
protected String getDefaultCaption() {
|
||||
return i18n.get("upload.swModuleTable.header");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.detailslayout.TableDetailsLayout#
|
||||
* onLoadIsSwModuleSelected()
|
||||
*/
|
||||
@Override
|
||||
protected Boolean onLoadIsTableRowSelected() {
|
||||
return !manageDistUIState.getSelectedSoftwareModules().isEmpty();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.detailslayout.TableDetailsLayout#
|
||||
* onLoadIsTableMaximized()
|
||||
*/
|
||||
@Override
|
||||
protected Boolean onLoadIsTableMaximized() {
|
||||
return manageDistUIState.isSwModuleTableMaximized();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.detailslayout.TableDetailsLayout#
|
||||
* populateDetailsWidget()
|
||||
*/
|
||||
@Override
|
||||
protected void populateDetailsWidget() {
|
||||
populateDetailsWidget(selectedSwModule);
|
||||
@@ -191,12 +158,6 @@ public class SwModuleDetails extends AbstractTableDetailsLayout {
|
||||
return permissionChecker.hasUpdateDistributionPermission();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* getTabSheetId()
|
||||
*/
|
||||
@Override
|
||||
protected String getTabSheetId() {
|
||||
return null;
|
||||
|
||||
@@ -67,8 +67,6 @@ import com.vaadin.ui.Window;
|
||||
|
||||
/**
|
||||
* Implementation of software module table using generic abstract table styles .
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@@ -98,6 +96,7 @@ public class SwModuleTable extends AbstractTable {
|
||||
/**
|
||||
* Initialize the filter layout.
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
@@ -158,50 +157,35 @@ public class SwModuleTable extends AbstractTable {
|
||||
}
|
||||
}
|
||||
|
||||
/* All Override methods */
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.SPTable#getTableId()
|
||||
*/
|
||||
@Override
|
||||
protected String getTableId() {
|
||||
return SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.SPTable#createContainer()
|
||||
*/
|
||||
@Override
|
||||
protected Container createContainer() {
|
||||
final Map<String, Object> queryConfiguration = new HashMap<String, Object>();
|
||||
manageDistUIState.getSoftwareModuleFilters().getSearchText()
|
||||
.ifPresent(value -> queryConfiguration.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
||||
final Map<String, Object> queryConfiguration = prepareQueryConfigFilters();
|
||||
|
||||
manageDistUIState.getSoftwareModuleFilters().getSoftwareModuleType()
|
||||
.ifPresent(type -> queryConfiguration.put(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE, type));
|
||||
|
||||
manageDistUIState.getLastSelectedDistribution().ifPresent(
|
||||
distIdName -> queryConfiguration.put(SPUIDefinitions.ORDER_BY_DISTRIBUTION, distIdName.getId()));
|
||||
|
||||
final BeanQueryFactory<SwModuleBeanQuery> swQF = new BeanQueryFactory<SwModuleBeanQuery>(
|
||||
SwModuleBeanQuery.class);
|
||||
final BeanQueryFactory<SwModuleBeanQuery> swQF = new BeanQueryFactory<>(SwModuleBeanQuery.class);
|
||||
swQF.setQueryConfiguration(queryConfiguration);
|
||||
|
||||
final LazyQueryContainer container = new LazyQueryContainer(
|
||||
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, "swId"), swQF);
|
||||
return container;
|
||||
return new LazyQueryContainer(new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, "swId"), swQF);
|
||||
}
|
||||
|
||||
private Map<String, Object> prepareQueryConfigFilters() {
|
||||
final Map<String, Object> queryConfig = new HashMap<>();
|
||||
manageDistUIState.getSoftwareModuleFilters().getSearchText()
|
||||
.ifPresent(value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
||||
|
||||
manageDistUIState.getSoftwareModuleFilters().getSoftwareModuleType()
|
||||
.ifPresent(type -> queryConfig.put(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE, type));
|
||||
|
||||
manageDistUIState.getLastSelectedDistribution()
|
||||
.ifPresent(distIdName -> queryConfig.put(SPUIDefinitions.ORDER_BY_DISTRIBUTION, distIdName.getId()));
|
||||
|
||||
return queryConfig;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.SPTable#addContainerProperties(com.
|
||||
* vaadin.data.Container)
|
||||
*/
|
||||
@Override
|
||||
protected void addContainerProperties(final Container container) {
|
||||
final LazyQueryContainer lazyContainer = (LazyQueryContainer) container;
|
||||
@@ -220,11 +204,6 @@ public class SwModuleTable extends AbstractTable {
|
||||
lazyContainer.addContainerProperty(SPUILabelDefinitions.VAR_SOFT_TYPE_ID, Long.class, null, false, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.SPTable#addCustomGeneratedColumns()
|
||||
*/
|
||||
@Override
|
||||
protected void addCustomGeneratedColumns() {
|
||||
|
||||
@@ -243,32 +222,16 @@ public class SwModuleTable extends AbstractTable {
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.SPTable#isFirstRowSelectedOnLoad()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isFirstRowSelectedOnLoad() {
|
||||
return manageDistUIState.getSelectedSoftwareModules().isEmpty();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.SPTable#getItemIdToSelect()
|
||||
*/
|
||||
@Override
|
||||
protected Object getItemIdToSelect() {
|
||||
return manageDistUIState.getSelectedSoftwareModules();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.SPTable#isMaximized()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isMaximized() {
|
||||
return manageDistUIState.isSwModuleTableMaximized();
|
||||
@@ -300,16 +263,9 @@ public class SwModuleTable extends AbstractTable {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.SPTable#getTableVisibleColumns
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
protected List<TableColumn> getTableVisibleColumns() {
|
||||
final List<TableColumn> columnList = new ArrayList<TableColumn>();
|
||||
final List<TableColumn> columnList = new ArrayList<>();
|
||||
if (isMaximized()) {
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get("header.name"), 0.2F));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_VERSION, i18n.get("header.version"), 0.1F));
|
||||
@@ -364,11 +320,6 @@ public class SwModuleTable extends AbstractTable {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param color
|
||||
* @param isAssigned
|
||||
* @return
|
||||
*/
|
||||
private String getTableStyle(final Long typeId, final boolean isAssigned, final String color) {
|
||||
if (isAssigned) {
|
||||
addTypeStyle(typeId, color);
|
||||
@@ -385,11 +336,6 @@ public class SwModuleTable extends AbstractTable {
|
||||
+ "{background-color:" + color + " !important;background-image:none !important }")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param itemId
|
||||
* @param propertyId
|
||||
* @return
|
||||
*/
|
||||
private String createTableStyle(final Object itemId, final Object propertyId) {
|
||||
if (null == propertyId) {
|
||||
final Item item = getItem(itemId);
|
||||
@@ -423,12 +369,6 @@ public class SwModuleTable extends AbstractTable {
|
||||
return name + "." + version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new software module to table.
|
||||
*
|
||||
* @param swModule
|
||||
* new software module
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private void addSoftwareModule(final SoftwareModule swModule) {
|
||||
final Object addItem = addItem();
|
||||
@@ -455,11 +395,6 @@ public class SwModuleTable extends AbstractTable {
|
||||
select(swModule.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param itemId
|
||||
* @param nameVersionStr
|
||||
* @return
|
||||
*/
|
||||
private void showArtifactDetailsWindow(final Long itemId, final String nameVersionStr) {
|
||||
final Window atrifactDtlsWindow = new Window();
|
||||
atrifactDtlsWindow.setCaption(HawkbitCommonUtil.getArtifactoryDetailsLabelId(nameVersionStr));
|
||||
|
||||
@@ -36,9 +36,6 @@ import com.vaadin.ui.Window;
|
||||
/**
|
||||
* Implementation of software module Header block using generic abstract details
|
||||
* style .
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
@@ -61,9 +58,7 @@ public class SwModuleTableHeader extends AbstractTableHeader {
|
||||
@Autowired
|
||||
private SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow;
|
||||
|
||||
/**
|
||||
* Initialize the components.
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
@@ -82,45 +77,21 @@ public class SwModuleTableHeader extends AbstractTableHeader {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#getHeaderCaption
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
protected String getHeaderCaption() {
|
||||
return i18n.get("upload.swModuleTable.header");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#getSearchBoxId()
|
||||
*/
|
||||
@Override
|
||||
protected String getSearchBoxId() {
|
||||
return SPUIComponetIdProvider.SW_MODULE_SEARCH_TEXT_FIELD;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.SPTableHeader#getSearchRestIconId()
|
||||
*/
|
||||
@Override
|
||||
protected String getSearchRestIconId() {
|
||||
return SPUIComponetIdProvider.SW_MODULE_SEARCH_RESET_ICON;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#getAddIconId()
|
||||
*/
|
||||
@Override
|
||||
protected String getAddIconId() {
|
||||
return SPUIComponetIdProvider.SW_MODULE_ADD_BUTTON;
|
||||
@@ -134,97 +105,47 @@ public class SwModuleTableHeader extends AbstractTableHeader {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#getDropFilterId(
|
||||
* )
|
||||
*/
|
||||
@Override
|
||||
protected String getDropFilterId() {
|
||||
/* not required */
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
||||
* isDropHintRequired()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isDropHintRequired() {
|
||||
/* not required */
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.SPTableHeader#isDropFilterRequired()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isDropFilterRequired() {
|
||||
/* Not Yet Implemented */
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#
|
||||
* getShowFilterButtonLayoutId()
|
||||
*/
|
||||
@Override
|
||||
protected String getShowFilterButtonLayoutId() {
|
||||
return "show.type.icon";
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.SPTableHeader#showFilterButtonsLayout
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
protected void showFilterButtonsLayout() {
|
||||
manageDistUIState.setSwTypeFilterClosed(false);
|
||||
eventbus.publish(this, DistributionsUIEvent.SHOW_SM_FILTER_BY_TYPE);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#resetSearchText(
|
||||
* )
|
||||
*/
|
||||
@Override
|
||||
protected void resetSearchText() {
|
||||
manageDistUIState.getSoftwareModuleFilters().setSearchText(null);
|
||||
eventbus.publish(this, SMFilterEvent.REMOVER_FILTER_BY_TEXT);
|
||||
if (manageDistUIState.getSoftwareModuleFilters().getSearchText().isPresent()) {
|
||||
manageDistUIState.getSoftwareModuleFilters().setSearchText(null);
|
||||
eventbus.publish(this, SMFilterEvent.REMOVER_FILTER_BY_TEXT);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#getMaxMinIconId(
|
||||
* )
|
||||
*/
|
||||
@Override
|
||||
protected String getMaxMinIconId() {
|
||||
return SPUIComponetIdProvider.SW_MAX_MIN_TABLE_ICON;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#maximizeTable()
|
||||
*/
|
||||
@Override
|
||||
public void maximizeTable() {
|
||||
manageDistUIState.setSwModuleTableMaximized(Boolean.TRUE);
|
||||
@@ -232,58 +153,28 @@ public class SwModuleTableHeader extends AbstractTableHeader {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#minimizeTable()
|
||||
*/
|
||||
@Override
|
||||
public void minimizeTable() {
|
||||
manageDistUIState.setSwModuleTableMaximized(Boolean.FALSE);
|
||||
eventbus.publish(this, new SoftwareModuleEvent(SoftwareModuleEventType.MINIMIZED, null));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.SPTableHeader#onLoadIsTableMaximized(
|
||||
* )
|
||||
*/
|
||||
@Override
|
||||
public Boolean onLoadIsTableMaximized() {
|
||||
return manageDistUIState.isSwModuleTableMaximized();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.SPTableHeader#
|
||||
* onLoadIsShowFilterButtonDisplayed()
|
||||
*/
|
||||
@Override
|
||||
public Boolean onLoadIsShowFilterButtonDisplayed() {
|
||||
return manageDistUIState.isSwTypeFilterClosed();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.SPTableHeader#searchBy(java.lang.
|
||||
* String)
|
||||
*/
|
||||
@Override
|
||||
protected void searchBy(final String newSearchText) {
|
||||
manageDistUIState.getSoftwareModuleFilters().setSearchText(newSearchText);
|
||||
eventbus.publish(this, SMFilterEvent.FILTER_BY_TEXT);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.SPTableHeader#addNewItem(com.vaadin.
|
||||
* ui.Button.ClickEvent)
|
||||
*/
|
||||
@Override
|
||||
protected void addNewItem(final ClickEvent event) {
|
||||
final Window addSoftwareModule = softwareModuleAddUpdateWindow.createAddSoftwareModuleWindow();
|
||||
@@ -292,22 +183,11 @@ public class SwModuleTableHeader extends AbstractTableHeader {
|
||||
addSoftwareModule.setVisible(Boolean.TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.SPTableHeader#hasCreatePermission()
|
||||
*/
|
||||
@Override
|
||||
protected boolean hasCreatePermission() {
|
||||
return permChecker.hasCreateDistributionPermission();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
||||
* isAddNewItemAllowed()
|
||||
*/
|
||||
@Override
|
||||
protected Boolean isAddNewItemAllowed() {
|
||||
return true;
|
||||
@@ -328,47 +208,21 @@ public class SwModuleTableHeader extends AbstractTableHeader {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
||||
* getBulkUploadIconId()
|
||||
*/
|
||||
@Override
|
||||
protected String getBulkUploadIconId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#bulkUpload(com.
|
||||
* vaadin.ui.Button.ClickEvent )
|
||||
*/
|
||||
@Override
|
||||
protected void bulkUpload(final ClickEvent event) {
|
||||
/**
|
||||
* No implementation as no bulk upload is supported.
|
||||
*/
|
||||
// No implementation as no bulk upload is supported.
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
||||
* isBulkUploadAllowed()
|
||||
*/
|
||||
@Override
|
||||
protected Boolean isBulkUploadAllowed() {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.common.table.AbstractTableHeader#
|
||||
* isBulkUploadInProgress()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isBulkUploadInProgress() {
|
||||
return false;
|
||||
|
||||
@@ -40,8 +40,6 @@ import com.vaadin.spring.annotation.ViewScope;
|
||||
/**
|
||||
* Software Module Type filter buttons.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
@@ -58,46 +56,24 @@ public class DistSMTypeFilterButtons extends AbstractFilterButtons {
|
||||
@Autowired
|
||||
private DistributionsViewAcceptCriteria distributionsViewAcceptCriteria;
|
||||
|
||||
/**
|
||||
* Initialize component.
|
||||
*
|
||||
* @param filterButtonClickBehaviour
|
||||
* the clickable behaviour.
|
||||
*/
|
||||
@Override
|
||||
public void init(final AbstractFilterButtonClickBehaviour filterButtonClickBehaviour) {
|
||||
super.init(filterButtonClickBehaviour);
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* getButtonsTableId()
|
||||
*/
|
||||
@Override
|
||||
protected String getButtonsTableId() {
|
||||
|
||||
return SPUIComponetIdProvider.SW_MODULE_TYPE_TABLE_ID;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* createButtonsLazyQueryContainer ()
|
||||
*/
|
||||
@Override
|
||||
protected LazyQueryContainer createButtonsLazyQueryContainer() {
|
||||
final Map<String, Object> queryConfig = new HashMap<String, Object>();
|
||||
final BeanQueryFactory<SoftwareModuleTypeBeanQuery> typeQF = new BeanQueryFactory<SoftwareModuleTypeBeanQuery>(
|
||||
final Map<String, Object> queryConfig = new HashMap<>();
|
||||
final BeanQueryFactory<SoftwareModuleTypeBeanQuery> typeQF = new BeanQueryFactory<>(
|
||||
SoftwareModuleTypeBeanQuery.class);
|
||||
typeQF.setQueryConfiguration(queryConfig);
|
||||
final LazyQueryContainer lazyQueryContainer = new LazyQueryContainer(
|
||||
new LazyQueryDefinition(true, 20, SPUILabelDefinitions.VAR_NAME), typeQF);
|
||||
return lazyQueryContainer;
|
||||
return new LazyQueryContainer(new LazyQueryDefinition(true, 20, SPUILabelDefinitions.VAR_NAME), typeQF);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -105,13 +81,6 @@ public class DistSMTypeFilterButtons extends AbstractFilterButtons {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* isClickedByDefault(java.lang .Long)
|
||||
*/
|
||||
@Override
|
||||
protected boolean isClickedByDefault(final Long buttonId) {
|
||||
|
||||
@@ -119,25 +88,11 @@ public class DistSMTypeFilterButtons extends AbstractFilterButtons {
|
||||
&& manageDistUIState.getSoftwareModuleFilters().getSoftwareModuleType().get().getId().equals(buttonId);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* createButtonId(java.lang. String)
|
||||
*/
|
||||
@Override
|
||||
protected String createButtonId(final String name) {
|
||||
return SPUIComponetIdProvider.SM_TYPE_FILTER_BTN_ID + name;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* getFilterButtonDropHandler()
|
||||
*/
|
||||
@Override
|
||||
protected DropHandler getFilterButtonDropHandler() {
|
||||
|
||||
@@ -156,16 +111,8 @@ public class DistSMTypeFilterButtons extends AbstractFilterButtons {
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* getButttonWrapperId()
|
||||
*/
|
||||
@Override
|
||||
protected String getButttonWrapperIdPrefix() {
|
||||
|
||||
return SPUIDefinitions.SOFTWARE_MODULE_TAG_ID_PREFIXS;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,9 +29,6 @@ import com.vaadin.ui.Window;
|
||||
|
||||
/**
|
||||
* Software Module Type filter buttons header.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
@@ -51,9 +48,7 @@ public class DistSMTypeFilterHeader extends AbstractFilterHeader {
|
||||
@Autowired
|
||||
private CreateUpdateSoftwareTypeLayout createUpdateSWTypeLayout;
|
||||
|
||||
/**
|
||||
* Initialize the components.
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
super.init();
|
||||
@@ -62,50 +57,21 @@ public class DistSMTypeFilterHeader extends AbstractFilterHeader {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* getHideButtonId()
|
||||
*/
|
||||
@Override
|
||||
protected String getHideButtonId() {
|
||||
return SPUIComponetIdProvider.SM_SHOW_FILTER_BUTTON_ID;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* hasCreateUpdatePermission()
|
||||
*/
|
||||
@Override
|
||||
protected boolean hasCreateUpdatePermission() {
|
||||
|
||||
return permChecker.hasCreateDistributionPermission() || permChecker.hasUpdateDistributionPermission();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#getTitle(
|
||||
* )
|
||||
*/
|
||||
@Override
|
||||
protected String getTitle() {
|
||||
|
||||
return SPUILabelDefinitions.TYPE;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* settingsIconClicked(com.vaadin .ui.Button.ClickEvent)
|
||||
*/
|
||||
@Override
|
||||
protected void settingsIconClicked(final ClickEvent event) {
|
||||
final Window addUpdateWindow = createUpdateSWTypeLayout.getWindow();
|
||||
@@ -114,51 +80,22 @@ public class DistSMTypeFilterHeader extends AbstractFilterHeader {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* dropHitsRequired()
|
||||
*/
|
||||
@Override
|
||||
protected boolean dropHitsRequired() {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* hideFilterButtonLayout()
|
||||
*/
|
||||
@Override
|
||||
protected void hideFilterButtonLayout() {
|
||||
manageDistUIState.setSwTypeFilterClosed(true);
|
||||
eventBus.publish(this, DistributionsUIEvent.HIDE_SM_FILTER_BY_TYPE);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* getConfigureFilterButtonId()
|
||||
*/
|
||||
@Override
|
||||
protected String getConfigureFilterButtonId() {
|
||||
return SPUIDefinitions.ADD_SOFTWARE_MODULE_TYPE;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* isAddTagRequired()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isAddTagRequired() {
|
||||
return true;
|
||||
|
||||
@@ -20,8 +20,6 @@ import com.vaadin.spring.annotation.VaadinSessionScope;
|
||||
|
||||
/**
|
||||
* Distribution table filter state.
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@VaadinSessionScope
|
||||
@@ -31,9 +29,9 @@ public class ManageDistFilters implements Serializable {
|
||||
|
||||
private String searchText;
|
||||
|
||||
private List<String> distSetTags = new ArrayList<String>();
|
||||
private List<String> distSetTags = new ArrayList<>();
|
||||
|
||||
private List<String> clickedDistSetTags = new ArrayList<String>();
|
||||
private List<String> clickedDistSetTags = new ArrayList<>();
|
||||
|
||||
private DistributionSetType clickedDistSetType;
|
||||
|
||||
@@ -61,17 +59,10 @@ public class ManageDistFilters implements Serializable {
|
||||
this.clickedDistSetTags = clickedDistSetTags;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the searchText
|
||||
*/
|
||||
public Optional<String> getSearchText() {
|
||||
return searchText == null ? Optional.empty() : Optional.of(searchText);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param searchText
|
||||
* the searchText to set
|
||||
*/
|
||||
public void setSearchText(final String searchText) {
|
||||
this.searchText = searchText;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ import com.google.common.base.Strings;
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
public class TargetFilterBeanQuery extends AbstractBeanQuery<ProxyTargetFilter> {
|
||||
|
||||
private static final long serialVersionUID = 1845964596238990987L;
|
||||
@@ -76,8 +75,8 @@ public class TargetFilterBeanQuery extends AbstractBeanQuery<ProxyTargetFilter>
|
||||
|
||||
@Override
|
||||
protected List<ProxyTargetFilter> loadBeans(final int startIndex, final int count) {
|
||||
Slice<TargetFilterQuery> targetFilterQuery = null;
|
||||
final List<ProxyTargetFilter> proxyTargetFilter = new ArrayList<ProxyTargetFilter>();
|
||||
Slice<TargetFilterQuery> targetFilterQuery;
|
||||
final List<ProxyTargetFilter> proxyTargetFilter = new ArrayList<>();
|
||||
if (startIndex == 0 && firstPageTargetFilter != null) {
|
||||
targetFilterQuery = firstPageTargetFilter;
|
||||
} else if (Strings.isNullOrEmpty(searchText)) {
|
||||
|
||||
@@ -41,7 +41,6 @@ import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
import com.vaadin.data.Container;
|
||||
import com.vaadin.data.Item;
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.server.Sizeable.Unit;
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
import com.vaadin.ui.Button;
|
||||
@@ -84,20 +83,20 @@ public class TargetFilterTable extends Table {
|
||||
* Initialize the Action History Table.
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
setStyleName("sp-table");
|
||||
setSizeFull();
|
||||
setImmediate(true);
|
||||
setHeight(100.0f, Unit.PERCENTAGE);
|
||||
addStyleName(ValoTheme.TABLE_NO_VERTICAL_LINES);
|
||||
addStyleName(ValoTheme.TABLE_SMALL);
|
||||
addCustomGeneratedColumns();
|
||||
populateTableData();
|
||||
setColumnCollapsingAllowed(true);
|
||||
setColumnProperties();
|
||||
setId(SPUIComponetIdProvider.TAEGET_FILTER_TABLE_ID);
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
public void init() {
|
||||
setStyleName("sp-table");
|
||||
setSizeFull();
|
||||
setImmediate(true);
|
||||
setHeight(100.0f, Unit.PERCENTAGE);
|
||||
addStyleName(ValoTheme.TABLE_NO_VERTICAL_LINES);
|
||||
addStyleName(ValoTheme.TABLE_SMALL);
|
||||
addCustomGeneratedColumns();
|
||||
populateTableData();
|
||||
setColumnCollapsingAllowed(true);
|
||||
setColumnProperties();
|
||||
setId(SPUIComponetIdProvider.TAEGET_FILTER_TABLE_ID);
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
@@ -114,20 +113,14 @@ public class TargetFilterTable extends Table {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a empty HierarchicalContainer.
|
||||
*
|
||||
*
|
||||
*/
|
||||
private Container createContainer() {
|
||||
final Map<String, Object> queryConfig = prepareQueryConfigFilters();
|
||||
final BeanQueryFactory<TargetFilterBeanQuery> targetQF = new BeanQueryFactory<TargetFilterBeanQuery>(
|
||||
TargetFilterBeanQuery.class);
|
||||
final BeanQueryFactory<TargetFilterBeanQuery> targetQF = new BeanQueryFactory<>(TargetFilterBeanQuery.class);
|
||||
|
||||
targetQF.setQueryConfiguration(queryConfig);
|
||||
// create lazy query container with lazy defination and query
|
||||
final LazyQueryContainer targetFilterContainer = new LazyQueryContainer(new LazyQueryDefinition(true,
|
||||
SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_ID), targetQF);
|
||||
final LazyQueryContainer targetFilterContainer = new LazyQueryContainer(
|
||||
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_ID), targetQF);
|
||||
targetFilterContainer.getQueryView().getQueryDefinition().setMaxNestedPropertyDepth(PROPERTY_DEPT);
|
||||
|
||||
return targetFilterContainer;
|
||||
@@ -135,15 +128,12 @@ public class TargetFilterTable extends Table {
|
||||
}
|
||||
|
||||
private Map<String, Object> prepareQueryConfigFilters() {
|
||||
final Map<String, Object> queryConfig = new HashMap<String, Object>();
|
||||
filterManagementUIState.getCustomFilterSearchText().ifPresent(
|
||||
value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
||||
final Map<String, Object> queryConfig = new HashMap<>();
|
||||
filterManagementUIState.getCustomFilterSearchText()
|
||||
.ifPresent(value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
||||
return queryConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a empty HierarchicalContainer.
|
||||
*/
|
||||
private void addContainerproperties() {
|
||||
/* Create HierarchicalContainer container */
|
||||
container.addContainerProperty(SPUILabelDefinitions.NAME, Link.class, null);
|
||||
@@ -154,7 +144,7 @@ public class TargetFilterTable extends Table {
|
||||
}
|
||||
|
||||
private List<TableColumn> getVisbleColumns() {
|
||||
final List<TableColumn> columnList = new ArrayList<TableColumn>();
|
||||
final List<TableColumn> columnList = new ArrayList<>();
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.NAME, i18n.get("header.name"), 0.2F));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_USER, i18n.get("header.createdBy"), 0.15F));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_DATE, i18n.get("header.createdDate"), 0.2F));
|
||||
@@ -165,7 +155,6 @@ public class TargetFilterTable extends Table {
|
||||
|
||||
}
|
||||
|
||||
/* re -create the container and get the data and set it to the table */
|
||||
private void refreshContainer() {
|
||||
populateTableData();
|
||||
|
||||
@@ -187,10 +176,6 @@ public class TargetFilterTable extends Table {
|
||||
.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param event
|
||||
* @return
|
||||
*/
|
||||
private void onDelete(final ClickEvent event) {
|
||||
/* Display the confirmation */
|
||||
final ConfirmationDialog confirmDialog = new ConfirmationDialog(i18n.get("caption.filter.delete.confirmbox"),
|
||||
@@ -206,8 +191,8 @@ public class TargetFilterTable extends Table {
|
||||
* of the deleted custom filter.
|
||||
*/
|
||||
|
||||
notification.displaySuccess(i18n.get("message.delete.filter.success",
|
||||
new Object[] { deletedFilterName }));
|
||||
notification.displaySuccess(
|
||||
i18n.get("message.delete.filter.success", new Object[] { deletedFilterName }));
|
||||
refreshContainer();
|
||||
}
|
||||
});
|
||||
@@ -236,10 +221,6 @@ public class TargetFilterTable extends Table {
|
||||
return updateIcon;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param event
|
||||
* @return
|
||||
*/
|
||||
private void onClickOfDetailButton(final ClickEvent event) {
|
||||
final String targetFilterName = (String) ((Button) event.getComponent()).getData();
|
||||
final TargetFilterQuery targetFilterQuery = targetFilterQueryManagement
|
||||
|
||||
@@ -202,16 +202,8 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
hierarchicalContainer.addContainerProperty(SPUIDefinitions.ACTION_HIS_TBL_ROLLOUT_NAME, String.class, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Action based on status.
|
||||
*
|
||||
* @param type
|
||||
* as Action.Type
|
||||
*
|
||||
* @return List of Actions
|
||||
*/
|
||||
private List<Object> getVisbleColumns() {
|
||||
final List<Object> visibleColumnIds = new ArrayList<Object>();
|
||||
final List<Object> visibleColumnIds = new ArrayList<>();
|
||||
visibleColumnIds.add(SPUIDefinitions.ACTION_HIS_TBL_ACTIVE);
|
||||
visibleColumnIds.add(SPUIDefinitions.ACTION_HIS_TBL_DIST);
|
||||
visibleColumnIds.add(SPUIDefinitions.ACTION_HIS_TBL_DATETIME);
|
||||
|
||||
@@ -96,7 +96,7 @@ public class DistributionBeanQuery extends AbstractBeanQuery<ProxyDistribution>
|
||||
@Override
|
||||
protected List<ProxyDistribution> loadBeans(final int startIndex, final int count) {
|
||||
Page<DistributionSet> distBeans;
|
||||
final List<ProxyDistribution> proxyDistributions = new ArrayList<ProxyDistribution>();
|
||||
final List<ProxyDistribution> proxyDistributions = new ArrayList<>();
|
||||
if (startIndex == 0 && firstPageDistributionSets != null) {
|
||||
distBeans = firstPageDistributionSets;
|
||||
} else if (pinnedControllerId != null) {
|
||||
|
||||
@@ -39,9 +39,6 @@ import com.vaadin.ui.Window;
|
||||
|
||||
/**
|
||||
* Distribution set details layout.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
@@ -75,9 +72,7 @@ public class DistributionDetails extends AbstractTableDetailsLayout {
|
||||
|
||||
private UI ui;
|
||||
|
||||
/**
|
||||
* softwareLayout Initialize the component.
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
eventBus.subscribe(this);
|
||||
@@ -116,23 +111,11 @@ public class DistributionDetails extends AbstractTableDetailsLayout {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* getDefaultCaption()
|
||||
*/
|
||||
@Override
|
||||
protected String getDefaultCaption() {
|
||||
return i18n.get("distribution.details.header");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* addTabs(com.vaadin. ui.TabSheet)
|
||||
*/
|
||||
@Override
|
||||
protected void addTabs(final TabSheet detailsTab) {
|
||||
detailsTab.addTab(createDetailsLayout(), i18n.get("caption.tab.details"), null);
|
||||
@@ -142,12 +125,6 @@ public class DistributionDetails extends AbstractTableDetailsLayout {
|
||||
detailsTab.addTab(createLogLayout(), i18n.get("caption.logs.tab"), null);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* onEdit(com.vaadin.ui .Button.ClickEvent)
|
||||
*/
|
||||
@Override
|
||||
protected void onEdit(final ClickEvent event) {
|
||||
final Window newDistWindow = distributionAddUpdateWindowLayout.getWindow();
|
||||
@@ -157,79 +134,37 @@ public class DistributionDetails extends AbstractTableDetailsLayout {
|
||||
newDistWindow.setVisible(Boolean.TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* getEditButtonId()
|
||||
*/
|
||||
@Override
|
||||
protected String getEditButtonId() {
|
||||
return SPUIComponetIdProvider.DS_EDIT_BUTTON;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* onLoadIsTableRowSelected ()
|
||||
*/
|
||||
@Override
|
||||
protected Boolean onLoadIsTableRowSelected() {
|
||||
return !(managementUIState.getSelectedDsIdName().isPresent()
|
||||
&& managementUIState.getSelectedDsIdName().get().isEmpty());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* onLoadIsTableMaximized ()
|
||||
*/
|
||||
@Override
|
||||
protected Boolean onLoadIsTableMaximized() {
|
||||
return managementUIState.isDsTableMaximized();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* populateDetailsWidget()
|
||||
*/
|
||||
@Override
|
||||
protected void populateDetailsWidget() {
|
||||
populateDetailsWidget(selectedDsModule);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* clearDetails()
|
||||
*/
|
||||
@Override
|
||||
protected void clearDetails() {
|
||||
populateDetailsWidget(null);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* hasEditPermission()
|
||||
*/
|
||||
@Override
|
||||
protected Boolean hasEditPermission() {
|
||||
return permissionChecker.hasUpdateDistributionPermission();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* getTabSheetId()
|
||||
*/
|
||||
@Override
|
||||
protected String getTabSheetId() {
|
||||
return SPUIComponetIdProvider.DISTRIBUTION_DETAILS_TABSHEET;
|
||||
|
||||
@@ -73,9 +73,6 @@ import com.vaadin.ui.UI;
|
||||
|
||||
/**
|
||||
* Distribution set table.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
@@ -113,9 +110,7 @@ public class DistributionTable extends AbstractTable {
|
||||
|
||||
private Button distributinPinnedBtn;
|
||||
|
||||
/**
|
||||
* Initialize the distribution table.
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
@@ -219,44 +214,37 @@ public class DistributionTable extends AbstractTable {
|
||||
*/
|
||||
@Override
|
||||
protected Container createContainer() {
|
||||
final Map<String, Object> queryConfiguration = new HashMap<String, Object>();
|
||||
final Map<String, Object> queryConfiguration = prepareQueryConfigFilters();
|
||||
|
||||
final BeanQueryFactory<DistributionBeanQuery> distributionQF = new BeanQueryFactory<>(
|
||||
DistributionBeanQuery.class);
|
||||
distributionQF.setQueryConfiguration(queryConfiguration);
|
||||
return new LazyQueryContainer(
|
||||
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_DIST_ID_NAME),
|
||||
distributionQF);
|
||||
}
|
||||
|
||||
private Map<String, Object> prepareQueryConfigFilters() {
|
||||
final Map<String, Object> queryConfig = new HashMap<>();
|
||||
managementUIState.getDistributionTableFilters().getSearchText()
|
||||
.ifPresent(value -> queryConfiguration.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
||||
.ifPresent(value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
||||
managementUIState.getDistributionTableFilters().getPinnedTargetId()
|
||||
.ifPresent(value -> queryConfiguration.put(SPUIDefinitions.ORDER_BY_PINNED_TARGET, value));
|
||||
final List<String> list = new ArrayList<String>();
|
||||
queryConfiguration.put(SPUIDefinitions.FILTER_BY_NO_TAG,
|
||||
.ifPresent(value -> queryConfig.put(SPUIDefinitions.ORDER_BY_PINNED_TARGET, value));
|
||||
final List<String> list = new ArrayList<>();
|
||||
queryConfig.put(SPUIDefinitions.FILTER_BY_NO_TAG,
|
||||
managementUIState.getDistributionTableFilters().isNoTagSelected());
|
||||
if (!managementUIState.getDistributionTableFilters().getDistSetTags().isEmpty()) {
|
||||
list.addAll(managementUIState.getDistributionTableFilters().getDistSetTags());
|
||||
}
|
||||
queryConfiguration.put(SPUIDefinitions.FILTER_BY_TAG, list);
|
||||
final BeanQueryFactory<DistributionBeanQuery> distributionQF = new BeanQueryFactory<DistributionBeanQuery>(
|
||||
DistributionBeanQuery.class);
|
||||
distributionQF.setQueryConfiguration(queryConfiguration);
|
||||
final LazyQueryContainer distributionContainer = new LazyQueryContainer(
|
||||
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_DIST_ID_NAME),
|
||||
distributionQF);
|
||||
return distributionContainer;
|
||||
queryConfig.put(SPUIDefinitions.FILTER_BY_TAG, list);
|
||||
return queryConfig;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTable#addContainerProperties(
|
||||
* com.vaadin.data.Container )
|
||||
*/
|
||||
@Override
|
||||
protected void addContainerProperties(final Container container) {
|
||||
HawkbitCommonUtil.getDsTableColumnProperties(container);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTable#
|
||||
* addCustomGeneratedColumns()
|
||||
*/
|
||||
@Override
|
||||
protected void addCustomGeneratedColumns() {
|
||||
addGeneratedColumn(SPUILabelDefinitions.PIN_COLUMN, new Table.ColumnGenerator() {
|
||||
@@ -269,23 +257,12 @@ public class DistributionTable extends AbstractTable {
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTable#
|
||||
* isFirstRowSelectedOnLoad()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isFirstRowSelectedOnLoad() {
|
||||
return !managementUIState.getSelectedDsIdName().isPresent()
|
||||
|| managementUIState.getSelectedDsIdName().get().isEmpty();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTable#getItemIdToSelect()
|
||||
*/
|
||||
@Override
|
||||
protected Object getItemIdToSelect() {
|
||||
if (managementUIState.getSelectedDsIdName().isPresent()) {
|
||||
@@ -294,16 +271,9 @@ public class DistributionTable extends AbstractTable {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#onValueChange()
|
||||
*/
|
||||
@Override
|
||||
protected void onValueChange() {
|
||||
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||
@SuppressWarnings("unchecked")
|
||||
final Set<DistributionSetIdName> values = HawkbitCommonUtil.getSelectedDSDetails(this);
|
||||
DistributionSetIdName value = null;
|
||||
if (values != null && !values.isEmpty()) {
|
||||
@@ -312,10 +282,7 @@ public class DistributionTable extends AbstractTable {
|
||||
while (iterator.hasNext()) {
|
||||
value = iterator.next();
|
||||
}
|
||||
/**
|
||||
* Adding null check to make to avoid NPE.Its weird that at times
|
||||
* getValue returns null.
|
||||
*/
|
||||
|
||||
if (null != value) {
|
||||
managementUIState.setSelectedDsIdName(values);
|
||||
managementUIState.setLastSelectedDsIdName(value);
|
||||
@@ -332,33 +299,16 @@ public class DistributionTable extends AbstractTable {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#isMaximized()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isMaximized() {
|
||||
return managementUIState.isDsTableMaximized();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTable#getTableVisibleColumns(
|
||||
* )
|
||||
*/
|
||||
@Override
|
||||
protected List<TableColumn> getTableVisibleColumns() {
|
||||
return HawkbitCommonUtil.getTableVisibleColumns(isMaximized(), true, i18n);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTable#getTableDropHandler()
|
||||
*/
|
||||
@Override
|
||||
protected DropHandler getTableDropHandler() {
|
||||
return new DropHandler() {
|
||||
@@ -396,7 +346,7 @@ public class DistributionTable extends AbstractTable {
|
||||
final com.vaadin.event.dd.TargetDetails taregtDet = event.getTargetDetails();
|
||||
final Table distTable = (Table) taregtDet.getTarget();
|
||||
final Set<DistributionSetIdName> distsSelected = HawkbitCommonUtil.getSelectedDSDetails(distTable);
|
||||
final Set<Long> distList = new HashSet<Long>();
|
||||
final Set<Long> distList = new HashSet<>();
|
||||
|
||||
final AbstractSelectTargetDetails dropData = (AbstractSelectTargetDetails) event.getTargetDetails();
|
||||
final Object distItemId = dropData.getItemIdOver();
|
||||
@@ -428,7 +378,7 @@ public class DistributionTable extends AbstractTable {
|
||||
// assign dist to those targets
|
||||
final List<Target> assignedTargets = targetService.findTargetsByTag(targetTagName);
|
||||
if (!assignedTargets.isEmpty()) {
|
||||
final Set<TargetIdName> targetDetailsList = new HashSet<TargetIdName>();
|
||||
final Set<TargetIdName> targetDetailsList = new HashSet<>();
|
||||
assignedTargets.forEach(target -> targetDetailsList
|
||||
.add(new TargetIdName(target.getId(), target.getControllerId(), target.getName())));
|
||||
assignTargetToDs(getItem(distItemId), targetDetailsList);
|
||||
@@ -441,7 +391,7 @@ public class DistributionTable extends AbstractTable {
|
||||
final TableTransferable transferable = (TableTransferable) event.getTransferable();
|
||||
final Table source = transferable.getSourceComponent();
|
||||
final Set<TargetIdName> targetsSelected = HawkbitCommonUtil.getSelectedTargetDetails(source);
|
||||
final Set<TargetIdName> targetDetailsList = new HashSet<TargetIdName>();
|
||||
final Set<TargetIdName> targetDetailsList = new HashSet<>();
|
||||
|
||||
if (!targetsSelected.contains(transferable.getData("itemId"))) {
|
||||
targetDetailsList.add((TargetIdName) transferable.getData("itemId"));
|
||||
@@ -467,13 +417,6 @@ public class DistributionTable extends AbstractTable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate event.
|
||||
*
|
||||
* @param dragEvent
|
||||
* as event
|
||||
* @return boolean as flag
|
||||
*/
|
||||
private Boolean doValidation(final DragAndDropEvent dragEvent) {
|
||||
final Component compsource = dragEvent.getTransferable().getSourceComponent();
|
||||
if (compsource instanceof Table) {
|
||||
@@ -521,15 +464,6 @@ public class DistributionTable extends AbstractTable {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the assignment.
|
||||
*
|
||||
* @param targetDetailsList
|
||||
* @param source
|
||||
* @param distId
|
||||
* @param distName
|
||||
* @return String as indicator
|
||||
*/
|
||||
private String validate(final Set<TargetIdName> targetDetailsList,
|
||||
final DistributionSetIdName distributionSetIdName) {
|
||||
String pendingActionMessage = null;
|
||||
@@ -548,17 +482,6 @@ public class DistributionTable extends AbstractTable {
|
||||
return pendingActionMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Message for Pending Action.
|
||||
*
|
||||
* @param message
|
||||
* as msg
|
||||
* @param targId
|
||||
* as ID
|
||||
* @param distName
|
||||
* as Dist Set Name
|
||||
* @return String as message
|
||||
*/
|
||||
private String getPendingActionMessage(final String message, final String targId, final String distNameVersion) {
|
||||
String pendActionMsg = i18n.get("message.target.assigned.pending");
|
||||
if (null == message) {
|
||||
@@ -567,12 +490,6 @@ public class DistributionTable extends AbstractTable {
|
||||
return pendActionMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show or Hide Popup Notification Message.
|
||||
*
|
||||
* @param message
|
||||
* as msg
|
||||
*/
|
||||
private void showOrHidePopupAndNotification(final String message) {
|
||||
if (null != managementUIState.getAssignedList() && !managementUIState.getAssignedList().isEmpty()) {
|
||||
eventBus.publish(this, ManagementUIEvent.UPDATE_COUNT);
|
||||
@@ -629,19 +546,6 @@ public class DistributionTable extends AbstractTable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Added by Saumya Get Pin style.
|
||||
*
|
||||
* @param itemId
|
||||
* as item clicked
|
||||
* @param propertyId
|
||||
* as property
|
||||
* @param installedDistItemIds
|
||||
* as set
|
||||
* @param assignedDistTableItemIds
|
||||
* as set
|
||||
* @return String as Style
|
||||
*/
|
||||
private String getPinnedDistributionStyle(final Long installedDistItemIds, final Long assignedDistTableItemIds,
|
||||
final Object itemId) {
|
||||
final Long distId = ((DistributionSetIdName) itemId).getId();
|
||||
@@ -655,10 +559,6 @@ public class DistributionTable extends AbstractTable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param itemId
|
||||
* @return
|
||||
*/
|
||||
private Object getPinButton(final Object itemId) {
|
||||
final DistributionSetIdName dist = (DistributionSetIdName) getContainerDataSource().getItem(itemId)
|
||||
.getItemProperty(SPUILabelDefinitions.VAR_DIST_ID_NAME).getValue();
|
||||
@@ -677,12 +577,6 @@ public class DistributionTable extends AbstractTable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add listener to pin.
|
||||
*
|
||||
* @param pinBtn
|
||||
* as event
|
||||
*/
|
||||
private void addPinClickListener(final ClickEvent event) {
|
||||
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||
checkifAlreadyPinned(event.getButton());
|
||||
@@ -694,12 +588,6 @@ public class DistributionTable extends AbstractTable {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Check already pinned.
|
||||
*
|
||||
* @param eventBtn
|
||||
* as button
|
||||
*/
|
||||
private void checkifAlreadyPinned(final Button eventBtn) {
|
||||
final Long newPinnedDistItemId = ((DistributionSetIdName) eventBtn.getData()).getId();
|
||||
Long pinnedDistId = null;
|
||||
@@ -751,9 +639,6 @@ public class DistributionTable extends AbstractTable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* set style to distribution set table.
|
||||
*/
|
||||
private void styleDistributionSetTable() {
|
||||
setCellStyleGenerator(new Table.CellStyleGenerator() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -765,12 +650,6 @@ public class DistributionTable extends AbstractTable {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply pin style to pin.
|
||||
*
|
||||
* @param eventBtn
|
||||
* as button
|
||||
*/
|
||||
private void applyPinStyle(final Button eventBtn) {
|
||||
final StringBuilder style = new StringBuilder(SPUIComponentProvider.getPinButtonStyle());
|
||||
style.append(' ').append(SPUIStyleDefinitions.DIST_PIN).append(' ').append("tablePin").append(' ')
|
||||
@@ -815,14 +694,9 @@ public class DistributionTable extends AbstractTable {
|
||||
* @param assignedDistTableItemIds
|
||||
* Item ids of assigned distribution set
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public void styleDistributionSetTable(final Long installedDistItemId, final Long assignedDistTableItemId) {
|
||||
setCellStyleGenerator(new Table.CellStyleGenerator() {
|
||||
@Override
|
||||
public String getStyle(final Table source, final Object itemId, final Object propertyId) {
|
||||
return getPinnedDistributionStyle(installedDistItemId, assignedDistTableItemId, itemId);
|
||||
}
|
||||
});
|
||||
setCellStyleGenerator((source, itemId, propertyId) -> getPinnedDistributionStyle(installedDistItemId,
|
||||
assignedDistTableItemId, itemId));
|
||||
}
|
||||
|
||||
public void setDistributinPinnedBtn(final Button distributinPinnedBtn) {
|
||||
|
||||
@@ -58,9 +58,7 @@ public class DistributionTableHeader extends AbstractTableHeader {
|
||||
@Autowired
|
||||
private DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout;
|
||||
|
||||
/**
|
||||
* Initialize the component.
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
@@ -81,54 +79,26 @@ public class DistributionTableHeader extends AbstractTableHeader {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#getHeaderCaption(
|
||||
* )
|
||||
*/
|
||||
@Override
|
||||
protected String getHeaderCaption() {
|
||||
return i18n.get("header.dist.table");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#getSearchBoxId()
|
||||
*/
|
||||
@Override
|
||||
protected String getSearchBoxId() {
|
||||
return SPUIComponetIdProvider.DIST_SEARCH_TEXTFIELD;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
||||
* getSearchRestIconId()
|
||||
*/
|
||||
@Override
|
||||
protected String getSearchRestIconId() {
|
||||
return SPUIComponetIdProvider.DIST_SEARCH_ICON;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#getAddIconId()
|
||||
*/
|
||||
@Override
|
||||
protected String getAddIconId() {
|
||||
return SPUIComponetIdProvider.DIST_ADD_ICON;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
||||
* onLoadSearchBoxValue()
|
||||
*/
|
||||
@Override
|
||||
protected String onLoadSearchBoxValue() {
|
||||
if (managementUIState.getDistributionTableFilters().getSearchText().isPresent()) {
|
||||
@@ -137,155 +107,78 @@ public class DistributionTableHeader extends AbstractTableHeader {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#getDropFilterId()
|
||||
*/
|
||||
@Override
|
||||
protected String getDropFilterId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
||||
* hasCreatePermission()
|
||||
*/
|
||||
@Override
|
||||
protected boolean hasCreatePermission() {
|
||||
return permChecker.hasCreateDistributionPermission();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
||||
* isDropHintRequired()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isDropHintRequired() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
||||
* isDropFilterRequired()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isDropFilterRequired() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
||||
* getShowFilterButtonLayoutId()
|
||||
*/
|
||||
@Override
|
||||
protected String getShowFilterButtonLayoutId() {
|
||||
return "show.dist.tags.icon";
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
||||
* showFilterButtonsLayout()
|
||||
*/
|
||||
@Override
|
||||
protected void showFilterButtonsLayout() {
|
||||
managementUIState.setDistTagFilterClosed(false);
|
||||
eventbus.publish(this, ManagementUIEvent.SHOW_DISTRIBUTION_TAG_LAYOUT);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#resetSearchText()
|
||||
*/
|
||||
@Override
|
||||
protected void resetSearchText() {
|
||||
managementUIState.getDistributionTableFilters().setSearchText(null);
|
||||
eventbus.publish(this, DistributionTableFilterEvent.REMOVE_FILTER_BY_TEXT);
|
||||
if (managementUIState.getDistributionTableFilters().getSearchText().isPresent()) {
|
||||
managementUIState.getDistributionTableFilters().setSearchText(null);
|
||||
eventbus.publish(this, DistributionTableFilterEvent.REMOVE_FILTER_BY_TEXT);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#getMaxMinIconId()
|
||||
*/
|
||||
@Override
|
||||
protected String getMaxMinIconId() {
|
||||
return SPUIComponetIdProvider.DS_MAX_MIN_TABLE_ICON;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#maximizeTable()
|
||||
*/
|
||||
@Override
|
||||
public void maximizeTable() {
|
||||
managementUIState.setDsTableMaximized(Boolean.TRUE);
|
||||
eventbus.publish(this, new DistributionTableEvent(DistributionComponentEvent.MAXIMIZED, null));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#minimizeTable()
|
||||
*/
|
||||
@Override
|
||||
public void minimizeTable() {
|
||||
managementUIState.setDsTableMaximized(Boolean.FALSE);
|
||||
eventbus.publish(this, new DistributionTableEvent(DistributionComponentEvent.MINIMIZED, null));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
||||
* onLoadIsTableMaximized()
|
||||
*/
|
||||
@Override
|
||||
public Boolean onLoadIsTableMaximized() {
|
||||
return managementUIState.isDsTableMaximized();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
||||
* onLoadIsShowFilterButtonDisplayed()
|
||||
*/
|
||||
@Override
|
||||
public Boolean onLoadIsShowFilterButtonDisplayed() {
|
||||
return managementUIState.isDistTagFilterClosed();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#searchBy(java.
|
||||
* lang.String)
|
||||
*/
|
||||
@Override
|
||||
protected void searchBy(final String newSearchText) {
|
||||
managementUIState.getDistributionTableFilters().setSearchText(newSearchText);
|
||||
eventbus.publish(this, DistributionTableFilterEvent.FILTER_BY_TEXT);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#addNewItem(com.
|
||||
* vaadin.ui.Button.ClickEvent )
|
||||
*/
|
||||
@Override
|
||||
protected void addNewItem(final ClickEvent event) {
|
||||
final Window newDistWindow = distributionAddUpdateWindowLayout.getWindow();
|
||||
@@ -295,12 +188,6 @@ public class DistributionTableHeader extends AbstractTableHeader {
|
||||
eventbus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
||||
* isAddNewItemAllowed()
|
||||
*/
|
||||
@Override
|
||||
protected Boolean isAddNewItemAllowed() {
|
||||
return Boolean.FALSE;
|
||||
@@ -321,47 +208,21 @@ public class DistributionTableHeader extends AbstractTableHeader {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
||||
* getBulkUploadIconId()
|
||||
*/
|
||||
@Override
|
||||
protected String getBulkUploadIconId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTableHeader#bulkUpload(com.
|
||||
* vaadin.ui.Button.ClickEvent )
|
||||
*/
|
||||
@Override
|
||||
protected void bulkUpload(final ClickEvent event) {
|
||||
/**
|
||||
* No implementation as no bulk upload is supported.
|
||||
*/
|
||||
// No implementation as no bulk upload is supported.
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
||||
* isBulkUploadAllowed()
|
||||
*/
|
||||
@Override
|
||||
protected Boolean isBulkUploadAllowed() {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.common.table.AbstractTableHeader#
|
||||
* isBulkUploadInProgress()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isBulkUploadInProgress() {
|
||||
return false;
|
||||
|
||||
@@ -75,7 +75,7 @@ public class DistributionTagBeanQuery extends AbstractBeanQuery<ProxyTag> {
|
||||
@Override
|
||||
protected List<ProxyTag> loadBeans(final int startIndex, final int count) {
|
||||
Page<DistributionSetTag> dsTagBeans;
|
||||
final List<ProxyTag> tagList = new ArrayList<ProxyTag>();
|
||||
final List<ProxyTag> tagList = new ArrayList<>();
|
||||
if (startIndex == 0 && firstPageDsTag != null) {
|
||||
dsTagBeans = firstPageDsTag;
|
||||
} else {
|
||||
|
||||
@@ -64,12 +64,7 @@ public class DistributionTagButtons extends AbstractFilterButtons {
|
||||
@Autowired
|
||||
private ManagementUIState managementUIState;
|
||||
|
||||
/**
|
||||
* Initialize component.
|
||||
*
|
||||
* @param filterButtonClickBehaviour
|
||||
* the clickable behaviour.
|
||||
*/
|
||||
@Override
|
||||
public void init(final AbstractFilterButtonClickBehaviour filterButtonClickBehaviour) {
|
||||
super.init(filterButtonClickBehaviour);
|
||||
addNewTag(new DistributionSetTag("NO TAG"));
|
||||
@@ -98,7 +93,6 @@ public class DistributionTagButtons extends AbstractFilterButtons {
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final DragEvent dragEvent) {
|
||||
|
||||
if (dragEvent == DragEvent.DISTRIBUTION_DRAG) {
|
||||
UI.getCurrent().access(() -> addStyleName(SPUIStyleDefinitions.SHOW_DROP_HINT_FILTER_BUTTON));
|
||||
} else {
|
||||
@@ -106,34 +100,18 @@ public class DistributionTagButtons extends AbstractFilterButtons {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* getButtonsTableId()
|
||||
*/
|
||||
@Override
|
||||
protected String getButtonsTableId() {
|
||||
return SPUIComponetIdProvider.DISTRIBUTION_TAG_TABLE_ID;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* createButtonsLazyQueryContainer ()
|
||||
*/
|
||||
@Override
|
||||
protected LazyQueryContainer createButtonsLazyQueryContainer() {
|
||||
final Map<String, Object> queryConfig = new HashMap<String, Object>();
|
||||
final BeanQueryFactory<DistributionTagBeanQuery> tagQF = new BeanQueryFactory<DistributionTagBeanQuery>(
|
||||
DistributionTagBeanQuery.class);
|
||||
final Map<String, Object> queryConfig = new HashMap<>();
|
||||
final BeanQueryFactory<DistributionTagBeanQuery> tagQF = new BeanQueryFactory<>(DistributionTagBeanQuery.class);
|
||||
tagQF.setQueryConfiguration(queryConfig);
|
||||
final LazyQueryContainer tagContainer = HawkbitCommonUtil.createDSLazyQueryContainer(
|
||||
return HawkbitCommonUtil.createDSLazyQueryContainer(
|
||||
new BeanQueryFactory<DistributionTagBeanQuery>(DistributionTagBeanQuery.class));
|
||||
return tagContainer;
|
||||
|
||||
}
|
||||
|
||||
@@ -142,13 +120,6 @@ public class DistributionTagButtons extends AbstractFilterButtons {
|
||||
return SPUIDefinitions.DISTRIBUTION_TAG_BUTTON;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* isClickedByDefault(java.lang .Long)
|
||||
*/
|
||||
@Override
|
||||
protected boolean isClickedByDefault(final Long buttonId) {
|
||||
final DistributionSetTag dsTagObject = tagMgmtService.findDistributionSetTagById(buttonId);
|
||||
@@ -161,37 +132,16 @@ public class DistributionTagButtons extends AbstractFilterButtons {
|
||||
return managementUIState.getDistributionTableFilters().isNoTagSelected();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* createButtonId(java.lang. String)
|
||||
*/
|
||||
@Override
|
||||
protected String createButtonId(final String name) {
|
||||
return name;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* getFilterButtonDropHandler()
|
||||
*/
|
||||
@Override
|
||||
protected DropHandler getFilterButtonDropHandler() {
|
||||
return spDistTagDropEvent;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* getButttonWrapperId()
|
||||
*/
|
||||
@Override
|
||||
protected String getButttonWrapperIdPrefix() {
|
||||
return SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS;
|
||||
|
||||
@@ -50,9 +50,7 @@ public class DistributionTagHeader extends AbstractFilterHeader {
|
||||
@Autowired
|
||||
private CreateUpdateDistributionTagLayoutWindow createORUpdateDistributionTagLayout;
|
||||
|
||||
/**
|
||||
* Initialize the components.
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
super.init();
|
||||
@@ -61,100 +59,45 @@ public class DistributionTagHeader extends AbstractFilterHeader {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* getHideButtonId()
|
||||
*/
|
||||
@Override
|
||||
protected String getHideButtonId() {
|
||||
return "hide.distribution.tags";
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* hasCreateUpdatePermission()
|
||||
*/
|
||||
@Override
|
||||
protected boolean hasCreateUpdatePermission() {
|
||||
return permChecker.hasCreateDistributionPermission() || permChecker.hasUpdateDistributionPermission();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#getTitle(
|
||||
* )
|
||||
*/
|
||||
@Override
|
||||
protected String getTitle() {
|
||||
return i18n.get("header.filter.tag", new Object[] {});
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* settingsIconClicked(com.vaadin .ui.Button.ClickEvent)
|
||||
*/
|
||||
@Override
|
||||
protected void settingsIconClicked(final ClickEvent event) {
|
||||
final Window addUpdateWindow = createORUpdateDistributionTagLayout.getWindow();
|
||||
UI.getCurrent().addWindow(addUpdateWindow);
|
||||
addUpdateWindow.setModal(true);
|
||||
addUpdateWindow.setVisible(Boolean.TRUE);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* dropHitsRequired()
|
||||
*/
|
||||
@Override
|
||||
protected boolean dropHitsRequired() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* hideFilterButtonLayout()
|
||||
*/
|
||||
@Override
|
||||
protected void hideFilterButtonLayout() {
|
||||
managementUIState.setDistTagFilterClosed(true);
|
||||
eventbus.publish(this, ManagementUIEvent.HIDE_DISTRIBUTION_TAG_LAYOUT);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* getConfigureFilterButtonId()
|
||||
*/
|
||||
@Override
|
||||
protected String getConfigureFilterButtonId() {
|
||||
return SPUIComponetIdProvider.ADD_DISTRIBUTION_TAG;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* isAddTagRequired()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isAddTagRequired() {
|
||||
return true;
|
||||
|
||||
@@ -86,20 +86,13 @@ public class DistributionTagDropEvent implements DropHandler {
|
||||
private Boolean isNoTagAssigned(final DragAndDropEvent event) {
|
||||
final String tagName = ((DragAndDropWrapper) (event.getTargetDetails().getTarget())).getData().toString();
|
||||
if (tagName.equals(SPUIDefinitions.DISTRIBUTION_TAG_BUTTON)) {
|
||||
notification.displayValidationError(i18n.get("message.tag.cannot.be.assigned",
|
||||
new Object[] { i18n.get("label.no.tag.assigned") }));
|
||||
notification.displayValidationError(
|
||||
i18n.get("message.tag.cannot.be.assigned", new Object[] { i18n.get("label.no.tag.assigned") }));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the drop.
|
||||
*
|
||||
* @param event
|
||||
* DragAndDropEvent reference
|
||||
* @return Boolean
|
||||
*/
|
||||
private Boolean validate(final DragAndDropEvent event) {
|
||||
final Component compsource = event.getTransferable().getSourceComponent();
|
||||
if (!(compsource instanceof Table)) {
|
||||
@@ -116,11 +109,6 @@ public class DistributionTagDropEvent implements DropHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* validate the update permission.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
private boolean checkForDSUpdatePermission() {
|
||||
if (!permChecker.hasUpdateDistributionPermission()) {
|
||||
|
||||
@@ -131,13 +119,6 @@ public class DistributionTagDropEvent implements DropHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* validate the source tables.
|
||||
*
|
||||
* @param source
|
||||
* table
|
||||
* @return boolean
|
||||
*/
|
||||
private boolean validateIfSourceIsDs(final Table source) {
|
||||
if (!source.getId().equals(SPUIComponetIdProvider.DIST_TABLE_ID)) {
|
||||
notification.displayValidationError(i18n.get(SPUILabelDefinitions.ACTION_NOT_ALLOWED));
|
||||
@@ -146,12 +127,6 @@ public class DistributionTagDropEvent implements DropHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process target Drop event.
|
||||
*
|
||||
* @param event
|
||||
* DragAndDropEvent
|
||||
*/
|
||||
private void processDistributionDrop(final DragAndDropEvent event) {
|
||||
|
||||
final com.vaadin.event.dd.TargetDetails targetDetails = event.getTargetDetails();
|
||||
@@ -161,7 +136,7 @@ public class DistributionTagDropEvent implements DropHandler {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
final Set<DistributionSetIdName> distSelected = (Set<DistributionSetIdName>) source.getValue();
|
||||
final Set<Long> distributionList = new HashSet<Long>();
|
||||
final Set<Long> distributionList = new HashSet<>();
|
||||
if (!distSelected.contains(transferable.getData(ITEMID))) {
|
||||
distributionList.add(((DistributionSetIdName) transferable.getData(ITEMID)).getId());
|
||||
} else {
|
||||
@@ -172,8 +147,8 @@ public class DistributionTagDropEvent implements DropHandler {
|
||||
SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS);
|
||||
|
||||
final List<String> tagsClickedList = distFilterParameters.getDistSetTags();
|
||||
final DistributionSetTagAssigmentResult result = distributionSetManagement.toggleTagAssignment(
|
||||
distributionList, distTagName);
|
||||
final DistributionSetTagAssigmentResult result = distributionSetManagement.toggleTagAssignment(distributionList,
|
||||
distTagName);
|
||||
|
||||
notification.displaySuccess(HawkbitCommonUtil.getDistributionTagAssignmentMsg(distTagName, result, i18n));
|
||||
if (result.getUnassigned() >= 1 && !tagsClickedList.isEmpty()) {
|
||||
|
||||
@@ -47,12 +47,6 @@ public class ManagementViewAcceptCriteria extends AbstractAcceptCriteria {
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.AbstractAcceptCriteria#analyseDragComponent
|
||||
* (com.vaadin.event .dd.DragAndDropEvent, com.vaadin.ui.Component)
|
||||
*/
|
||||
@Override
|
||||
protected void analyseDragComponent(final Component compsource) {
|
||||
final String sourceID = getComponentId(compsource);
|
||||
@@ -60,24 +54,11 @@ public class ManagementViewAcceptCriteria extends AbstractAcceptCriteria {
|
||||
eventBus.publish(this, event);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#hideDropHints
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
protected void hideDropHints() {
|
||||
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#invalidDrop()
|
||||
*/
|
||||
@Override
|
||||
protected void invalidDrop() {
|
||||
uiNotification.displayValidationError(SPUILabelDefinitions.ACTION_NOT_ALLOWED);
|
||||
@@ -94,60 +75,31 @@ public class ManagementViewAcceptCriteria extends AbstractAcceptCriteria {
|
||||
return id;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#
|
||||
* getDropHintConfigurations()
|
||||
*/
|
||||
@Override
|
||||
protected Map<String, Object> getDropHintConfigurations() {
|
||||
return DROP_HINTS_CONFIGS;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#
|
||||
* publishDragStartEvent(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
protected void publishDragStartEvent(final Object event) {
|
||||
eventBus.publish(this, event);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.AbstractAcceptCriteria#
|
||||
* getDropConfigurations()
|
||||
*/
|
||||
@Override
|
||||
protected Map<String, List<String>> getDropConfigurations() {
|
||||
return DROP_CONFIGS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
private boolean isDistributionTagId(final String id) {
|
||||
return id != null && id.startsWith(SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
private boolean isTargetTagId(final String id) {
|
||||
return id != null && id.startsWith(SPUIDefinitions.TARGET_TAG_ID_PREFIXS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
private static Map<String, List<String>> createDropConfigurations() {
|
||||
final Map<String, List<String>> config = new HashMap<String, List<String>>();
|
||||
final Map<String, List<String>> config = new HashMap<>();
|
||||
|
||||
// Delete drop area acceptable components
|
||||
config.put(SPUIComponetIdProvider.DELETE_BUTTON_WRAPPER_ID,
|
||||
@@ -174,7 +126,7 @@ public class ManagementViewAcceptCriteria extends AbstractAcceptCriteria {
|
||||
}
|
||||
|
||||
private static Map<String, Object> createDropHintConfigurations() {
|
||||
final Map<String, Object> config = new HashMap<String, Object>();
|
||||
final Map<String, Object> config = new HashMap<>();
|
||||
config.put(SPUIDefinitions.TARGET_TAG_ID_PREFIXS, DragEvent.TARGET_TAG_DRAG);
|
||||
config.put(SPUIComponetIdProvider.TARGET_TABLE_ID, DragEvent.TARGET_DRAG);
|
||||
config.put(SPUIComponetIdProvider.DIST_TABLE_ID, DragEvent.DISTRIBUTION_DRAG);
|
||||
|
||||
@@ -19,7 +19,6 @@ import org.eclipse.hawkbit.repository.TagManagement;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||
import org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout;
|
||||
import org.eclipse.hawkbit.ui.management.dstable.DistributionTable;
|
||||
import org.eclipse.hawkbit.ui.management.event.BulkUploadPopupEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||
@@ -28,7 +27,6 @@ import org.eclipse.hawkbit.ui.management.event.SaveActionWindowEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentEvent;
|
||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||
import org.eclipse.hawkbit.ui.management.targettable.TargetTable;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
@@ -85,12 +83,7 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
@Autowired
|
||||
private CountMessageLabel countMessageLabel;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.DeleteActionsLayout#init()
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
@@ -172,73 +165,31 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* hasDeletePermission()
|
||||
*/
|
||||
@Override
|
||||
protected boolean hasDeletePermission() {
|
||||
return permChecker.hasDeleteDistributionPermission() || permChecker.hasDeleteTargetPermission();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* hasUpdatePermission()
|
||||
*/
|
||||
@Override
|
||||
protected boolean hasUpdatePermission() {
|
||||
return permChecker.hasUpdateTargetPermission() && permChecker.hasReadDistributionPermission();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* getDeleteAreaLabel()
|
||||
*/
|
||||
@Override
|
||||
protected String getDeleteAreaLabel() {
|
||||
return i18n.get("label.components.drop.area");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* getDeleteAreaId()
|
||||
*/
|
||||
@Override
|
||||
protected String getDeleteAreaId() {
|
||||
return SPUIComponetIdProvider.DELETE_BUTTON_WRAPPER_ID;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* getDeleteLayoutAcceptCriteria ()
|
||||
*/
|
||||
@Override
|
||||
protected AcceptCriterion getDeleteLayoutAcceptCriteria() {
|
||||
return managementViewAcceptCriteria;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* processDroppedComponent(com .vaadin.event.dd.DragAndDropEvent)
|
||||
*/
|
||||
@Override
|
||||
protected void processDroppedComponent(final DragAndDropEvent event) {
|
||||
final Component source = event.getTransferable().getSourceComponent();
|
||||
@@ -275,61 +226,26 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* getNoActionsButtonLabel()
|
||||
*/
|
||||
@Override
|
||||
protected String getNoActionsButtonLabel() {
|
||||
return i18n.get("button.no.actions");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* getActionsButtonLabel()
|
||||
*/
|
||||
@Override
|
||||
protected String getActionsButtonLabel() {
|
||||
return i18n.get("button.actions");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* reloadActionCount()
|
||||
*/
|
||||
@Override
|
||||
protected void restoreActionCount() {
|
||||
updateActionCount();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* getUnsavedActionsWindowCaption ()
|
||||
*/
|
||||
@Override
|
||||
protected String getUnsavedActionsWindowCaption() {
|
||||
return i18n.get("caption.save.window");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* unsavedActionsWindowClosed()
|
||||
*/
|
||||
@Override
|
||||
protected void unsavedActionsWindowClosed() {
|
||||
final String message = manangementConfirmationWindowLayout.getConsolidatedMessage();
|
||||
@@ -338,26 +254,12 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* getUnsavedActionsWindowContent ()
|
||||
*/
|
||||
@Override
|
||||
protected Component getUnsavedActionsWindowContent() {
|
||||
manangementConfirmationWindowLayout.init();
|
||||
return manangementConfirmationWindowLayout;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* hasUnsavedActions()
|
||||
*/
|
||||
@Override
|
||||
protected boolean hasUnsavedActions() {
|
||||
if (!managementUIState.getDeletedDistributionList().isEmpty()
|
||||
@@ -368,25 +270,11 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* hasCountMessage()
|
||||
*/
|
||||
@Override
|
||||
protected boolean hasCountMessage() {
|
||||
return permChecker.hasTargetReadPermission();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* getCountMessageLabel()
|
||||
*/
|
||||
@Override
|
||||
protected Label getCountMessageLabel() {
|
||||
return countMessageLabel;
|
||||
@@ -413,19 +301,9 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Prepare deleted distribution set .
|
||||
*
|
||||
* @param sourceTable
|
||||
* {@link DistributionTable}
|
||||
* @param transferable
|
||||
* {@link TableTransferable}
|
||||
*
|
||||
*/
|
||||
private void addInDeleteDistributionList(final Table sourceTable, final TableTransferable transferable) {
|
||||
final Set<DistributionSetIdName> distSelected = HawkbitCommonUtil.getSelectedDSDetails(sourceTable);
|
||||
final Set<DistributionSetIdName> distributionIdNameSet = new HashSet<DistributionSetIdName>();
|
||||
final Set<DistributionSetIdName> distributionIdNameSet = new HashSet<>();
|
||||
|
||||
if (!distSelected.contains(transferable.getData(SPUIDefinitions.ITEMID))) {
|
||||
distributionIdNameSet.add((DistributionSetIdName) transferable.getData(SPUIDefinitions.ITEMID));
|
||||
@@ -477,15 +355,6 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare deleted target list.
|
||||
*
|
||||
* @param sourceTable
|
||||
* {@link TargetTable}
|
||||
* @param transferable
|
||||
* {@link TableTransferable}
|
||||
*
|
||||
*/
|
||||
private void addInDeleteTargetList(final Table sourceTable, final TableTransferable transferable) {
|
||||
final Set<TargetIdName> targetSelected = HawkbitCommonUtil.getSelectedTargetDetails(sourceTable);
|
||||
|
||||
@@ -521,9 +390,6 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the software module delete count.
|
||||
*/
|
||||
private void updateActionCount() {
|
||||
final int count = managementUIState.getDeletedTargetList().size()
|
||||
+ managementUIState.getDeletedDistributionList().size() + managementUIState.getAssignedList().size();
|
||||
@@ -546,34 +412,16 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* hasBulkUploadPermission()
|
||||
*/
|
||||
@Override
|
||||
protected boolean hasBulkUploadPermission() {
|
||||
return permChecker.hasCreateTargetPermission();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* showBulkUploadWindow()
|
||||
*/
|
||||
@Override
|
||||
protected void showBulkUploadWindow() {
|
||||
eventBus.publish(this, BulkUploadPopupEvent.MAXIMIMIZED);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* restoreBulkUploadStatusCount()
|
||||
*/
|
||||
@Override
|
||||
protected void restoreBulkUploadStatusCount() {
|
||||
final Long failedCount = managementUIState.getTargetTableFilters().getBulkUpload().getFailedUploadCount();
|
||||
|
||||
@@ -107,32 +107,15 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
||||
super.inittialize();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.confirmwindow.layout.
|
||||
* AbstractConfirmationWindowLayout# getConfimrationTabs()
|
||||
*/
|
||||
@Override
|
||||
protected Map<String, ConfirmationTab> getConfimrationTabs() {
|
||||
final Map<String, ConfirmationTab> tabs = new HashMap<String, ConfirmationTab>();
|
||||
/**
|
||||
* create tab for deleted distribution.
|
||||
*/
|
||||
|
||||
/* Create tab for SW Module Type delete */
|
||||
final Map<String, ConfirmationTab> tabs = new HashMap<>();
|
||||
if (!managementUIState.getDeletedDistributionList().isEmpty()) {
|
||||
tabs.put(i18n.get("caption.delete.dist.accordion.tab"), createDeletedDistributionTab());
|
||||
}
|
||||
/**
|
||||
* create tab for deleted target.
|
||||
*/
|
||||
if (!managementUIState.getDeletedTargetList().isEmpty()) {
|
||||
tabs.put(i18n.get("caption.delete.target.accordion.tab"), createDeletedTargetTab());
|
||||
}
|
||||
/**
|
||||
* create tab for assignment.
|
||||
*/
|
||||
if (!managementUIState.getAssignedList().isEmpty()) {
|
||||
tabs.put(i18n.get("caption.assign.dist.accordion.tab"), createAssignmentTab());
|
||||
}
|
||||
@@ -196,8 +179,8 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
||||
private void saveAllAssignments(final ConfirmationTab tab) {
|
||||
final Set<TargetIdName> itemIds = managementUIState.getAssignedList().keySet();
|
||||
Long distId;
|
||||
List<TargetIdName> targetIdSetList = null;
|
||||
List<TargetIdName> tempIdList = null;
|
||||
List<TargetIdName> targetIdSetList;
|
||||
List<TargetIdName> tempIdList;
|
||||
final ActionType actionType = ((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout
|
||||
.getActionTypeOptionGroup().getValue()).getActionType();
|
||||
final long forcedTimeStamp = (((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout
|
||||
@@ -205,7 +188,7 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
||||
? actionTypeOptionGroupLayout.getForcedTimeDateField().getValue().getTime()
|
||||
: Action.NO_FORCE_TIME;
|
||||
|
||||
final Map<Long, ArrayList<TargetIdName>> saveAssignedList = new HashMap<Long, ArrayList<TargetIdName>>();
|
||||
final Map<Long, ArrayList<TargetIdName>> saveAssignedList = new HashMap<>();
|
||||
|
||||
int successAssignmentCount = 0;
|
||||
int duplicateAssignmentCount = 0;
|
||||
@@ -216,7 +199,7 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
||||
if (saveAssignedList.containsKey(distId)) {
|
||||
targetIdSetList = saveAssignedList.get(distId);
|
||||
} else {
|
||||
targetIdSetList = new ArrayList<TargetIdName>();
|
||||
targetIdSetList = new ArrayList<>();
|
||||
}
|
||||
targetIdSetList.add(itemId);
|
||||
saveAssignedList.put(distId, (ArrayList<TargetIdName>) targetIdSetList);
|
||||
@@ -275,15 +258,13 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
||||
}
|
||||
|
||||
private String getAssigmentSuccessMessage(final int assignedCount) {
|
||||
final String assignment = FontAwesome.TASKS.getHtml() + SPUILabelDefinitions.HTML_SPACE
|
||||
return FontAwesome.TASKS.getHtml() + SPUILabelDefinitions.HTML_SPACE
|
||||
+ i18n.get("message.target.assignment", new Object[] { assignedCount });
|
||||
return assignment;
|
||||
}
|
||||
|
||||
private String getDuplicateAssignmentMessage(final int alreadyAssignedCount) {
|
||||
final String alreadyAssigned = FontAwesome.TASKS.getHtml() + SPUILabelDefinitions.HTML_SPACE
|
||||
return FontAwesome.TASKS.getHtml() + SPUILabelDefinitions.HTML_SPACE
|
||||
+ i18n.get("message.target.alreadyAssigned", new Object[] { alreadyAssignedCount });
|
||||
return alreadyAssigned;
|
||||
}
|
||||
|
||||
private void discardAllAssignments(final ConfirmationTab tab) {
|
||||
@@ -456,7 +437,7 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
||||
}
|
||||
|
||||
private void deleteAllDistributions(final ConfirmationTab tab) {
|
||||
final Set<Long> deletedIds = new HashSet<Long>();
|
||||
final Set<Long> deletedIds = new HashSet<>();
|
||||
managementUIState.getDeletedDistributionList().forEach(distIdName -> deletedIds.add(distIdName.getId()));
|
||||
distributionSetManagement.deleteDistributionSet(deletedIds.toArray(new Long[deletedIds.size()]));
|
||||
addToConsolitatedMsg(FontAwesome.TRASH_O.getHtml() + SPUILabelDefinitions.HTML_SPACE
|
||||
@@ -516,7 +497,7 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
||||
final IndexedContainer contactContainer = new IndexedContainer();
|
||||
contactContainer.addContainerProperty(TARGET_ID, String.class, "");
|
||||
contactContainer.addContainerProperty(TARGET_NAME, String.class, "");
|
||||
Item item = null;
|
||||
Item item;
|
||||
for (final TargetIdName targteId : managementUIState.getDeletedTargetList()) {
|
||||
item = contactContainer.addItem(targteId);
|
||||
item.getItemProperty(TARGET_ID).setValue(targteId.getControllerId());
|
||||
|
||||
@@ -33,9 +33,9 @@ public class DistributionTableFilters implements Serializable {
|
||||
|
||||
private String pinnedTargetId;
|
||||
|
||||
private final List<String> distSetTags = new ArrayList<String>();
|
||||
private final List<String> distSetTags = new ArrayList<>();
|
||||
|
||||
private List<String> clickedDistSetTags = new ArrayList<String>();
|
||||
private List<String> clickedDistSetTags = new ArrayList<>();
|
||||
|
||||
private Boolean noTagSelected = Boolean.FALSE;
|
||||
|
||||
|
||||
@@ -30,9 +30,9 @@ public class TargetFilterParameters implements Serializable {
|
||||
|
||||
private String searchText;
|
||||
|
||||
private final List<TargetUpdateStatus> status = new ArrayList<TargetUpdateStatus>();
|
||||
private final List<TargetUpdateStatus> status = new ArrayList<>();
|
||||
|
||||
private List<String> targetTags = new ArrayList<String>();
|
||||
private List<String> targetTags = new ArrayList<>();
|
||||
|
||||
private Long distributionSetId;
|
||||
|
||||
|
||||
@@ -22,9 +22,6 @@ import com.vaadin.spring.annotation.VaadinSessionScope;
|
||||
|
||||
/**
|
||||
* Target Table Filters.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@VaadinSessionScope
|
||||
@SpringComponent
|
||||
@@ -32,8 +29,8 @@ public class TargetTableFilters implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -5251492630546463593L;
|
||||
|
||||
private final List<String> clickedTargetTags = new ArrayList<String>();
|
||||
private final List<TargetUpdateStatus> clickedStatusTargetTags = new ArrayList<TargetUpdateStatus>();
|
||||
private final List<String> clickedTargetTags = new ArrayList<>();
|
||||
private final List<TargetUpdateStatus> clickedStatusTargetTags = new ArrayList<>();
|
||||
private String searchText;
|
||||
private DistributionSetIdName distributionSet;
|
||||
private Long pinnedDistId;
|
||||
|
||||
@@ -39,10 +39,6 @@ import com.google.common.base.Strings;
|
||||
* Simple implementation of generics bean query which dynamically loads a batch
|
||||
* of beans.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
|
||||
private static final long serialVersionUID = -5645680058303167558L;
|
||||
@@ -105,7 +101,7 @@ public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
|
||||
@Override
|
||||
protected List<ProxyTarget> loadBeans(final int startIndex, final int count) {
|
||||
Slice<Target> targetBeans;
|
||||
final List<ProxyTarget> proxyTargetBeans = new ArrayList<ProxyTarget>();
|
||||
final List<ProxyTarget> proxyTargetBeans = new ArrayList<>();
|
||||
if (pinnedDistId != null) {
|
||||
targetBeans = getTargetManagement().findTargetsAllOrderByLinkedDistributionSet(
|
||||
new OffsetBasedPageRequest(startIndex, SPUIDefinitions.PAGE_SIZE, sort), pinnedDistId,
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -140,6 +141,8 @@ public class TargetTable extends AbstractTable implements Handler {
|
||||
private Boolean isTargetPinned = Boolean.FALSE;
|
||||
private ShortcutAction actionSelectAll;
|
||||
private ShortcutAction actionUnSelectAll;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
|
||||
@@ -56,9 +56,6 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Target table header layout.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
@@ -92,9 +89,7 @@ public class TargetTableHeader extends AbstractTableHeader {
|
||||
|
||||
private Boolean isComplexFilterViewDisplayed = Boolean.FALSE;
|
||||
|
||||
/**
|
||||
* Initialization of Target Header Component.
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
@@ -258,8 +253,10 @@ public class TargetTableHeader extends AbstractTableHeader {
|
||||
|
||||
@Override
|
||||
protected void resetSearchText() {
|
||||
managementUIState.getTargetTableFilters().setSearchText(null);
|
||||
eventBus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_TEXT);
|
||||
if (managementUIState.getTargetTableFilters().getSearchText().isPresent()) {
|
||||
managementUIState.getTargetTableFilters().setSearchText(null);
|
||||
eventBus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_TEXT);
|
||||
}
|
||||
}
|
||||
|
||||
private String getSearchText() {
|
||||
@@ -335,6 +332,11 @@ public class TargetTableHeader extends AbstractTableHeader {
|
||||
@Override
|
||||
protected DropHandler getDropFilterHandler() {
|
||||
return new DropHandler() {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void drop(final DragAndDropEvent event) {
|
||||
filterByDroppedDist(event);
|
||||
@@ -393,10 +395,9 @@ public class TargetTableHeader extends AbstractTableHeader {
|
||||
}
|
||||
|
||||
private Set<DistributionSetIdName> getDropppedDistributionDetails(final TableTransferable transferable) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final Set<DistributionSetIdName> distSelected = HawkbitCommonUtil
|
||||
.getSelectedDSDetails(transferable.getSourceComponent());
|
||||
final Set<DistributionSetIdName> distributionIdSet = new HashSet<DistributionSetIdName>();
|
||||
final Set<DistributionSetIdName> distributionIdSet = new HashSet<>();
|
||||
if (!distSelected.contains(transferable.getData("itemId"))) {
|
||||
distributionIdSet.add((DistributionSetIdName) transferable.getData("itemId"));
|
||||
} else {
|
||||
@@ -441,12 +442,6 @@ public class TargetTableHeader extends AbstractTableHeader {
|
||||
eventBus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_DISTRIBUTION);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
||||
* displayFilterDropedInfoOnLoad()
|
||||
*/
|
||||
@Override
|
||||
protected void displayFilterDropedInfoOnLoad() {
|
||||
if (managementUIState.getTargetTableFilters().getDistributionSet().isPresent()) {
|
||||
@@ -454,23 +449,11 @@ public class TargetTableHeader extends AbstractTableHeader {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTableHeader#
|
||||
* getFilterIconStyle()
|
||||
*/
|
||||
@Override
|
||||
protected String getFilterIconStyle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.common.table.AbstractTableHeader#
|
||||
* isBulkUploadInProgress()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isBulkUploadInProgress() {
|
||||
return managementUIState.getTargetTableFilters().getBulkUpload().getSucessfulUploadCount() != 0
|
||||
|
||||
@@ -75,7 +75,7 @@ public class TargetTagBeanQuery extends AbstractBeanQuery<ProxyTag> {
|
||||
@Override
|
||||
protected List<ProxyTag> loadBeans(final int startIndex, final int count) {
|
||||
Page<TargetTag> targetTagBeans;
|
||||
final List<ProxyTag> targetTagList = new ArrayList<ProxyTag>();
|
||||
final List<ProxyTag> targetTagList = new ArrayList<>();
|
||||
if (startIndex == 0 && firstPageTargetTag != null) {
|
||||
targetTagBeans = firstPageTargetTag;
|
||||
} else {
|
||||
|
||||
@@ -57,9 +57,6 @@ import com.vaadin.ui.UI;
|
||||
|
||||
/**
|
||||
* Target Tag filter buttons table.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
@@ -129,40 +126,18 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* getButtonsTableId()
|
||||
*/
|
||||
@Override
|
||||
protected String getButtonsTableId() {
|
||||
return SPUIComponetIdProvider.TARGET_TAG_TABLE_ID;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* createButtonsLazyQueryContainer ()
|
||||
*/
|
||||
@Override
|
||||
protected LazyQueryContainer createButtonsLazyQueryContainer() {
|
||||
final LazyQueryContainer tagContainer = HawkbitCommonUtil
|
||||
return HawkbitCommonUtil
|
||||
.createDSLazyQueryContainer(new BeanQueryFactory<TargetTagBeanQuery>(TargetTagBeanQuery.class));
|
||||
return tagContainer;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* isClickedByDefault(java.lang .Long)
|
||||
*/
|
||||
@Override
|
||||
protected boolean isClickedByDefault(final Long buttonId) {
|
||||
final TargetTag newTagClickedObj = tagMgmtService.findTargetTagById(buttonId);
|
||||
@@ -175,26 +150,12 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
|
||||
return managementUIState.getTargetTableFilters().isNoTagSelected();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* createButtonId(java.lang. String)
|
||||
*/
|
||||
@Override
|
||||
protected String createButtonId(final String name) {
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* getFilterButtonDropHandler()
|
||||
*/
|
||||
@Override
|
||||
protected DropHandler getFilterButtonDropHandler() {
|
||||
|
||||
@@ -267,21 +228,14 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process target Drop event.
|
||||
*
|
||||
* @param event
|
||||
* DragAndDropEvent
|
||||
*/
|
||||
private void processTargetDrop(final DragAndDropEvent event) {
|
||||
|
||||
final com.vaadin.event.dd.TargetDetails targetDetails = event.getTargetDetails();
|
||||
final TableTransferable transferable = (TableTransferable) event.getTransferable();
|
||||
final Table source = transferable.getSourceComponent();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
final Set<TargetIdName> targetSelected = HawkbitCommonUtil.getSelectedTargetDetails(source);
|
||||
final Set<String> targetList = new HashSet<String>();
|
||||
final Set<String> targetList = new HashSet<>();
|
||||
if (transferable.getData(ITEMID) != null) {
|
||||
if (!targetSelected.contains(transferable.getData(ITEMID))) {
|
||||
targetList.add(((TargetIdName) transferable.getData(ITEMID)).getControllerId());
|
||||
@@ -306,13 +260,6 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* validate the source tables.
|
||||
*
|
||||
* @param source
|
||||
* table
|
||||
* @return boolean
|
||||
*/
|
||||
private boolean validateIfSourceisTargetTable(final Table source) {
|
||||
if (!source.getId().equals(SPUIComponetIdProvider.TARGET_TABLE_ID)) {
|
||||
notification.displayValidationError(i18n.get(SPUILabelDefinitions.ACTION_NOT_ALLOWED));
|
||||
@@ -321,13 +268,6 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterButtons#
|
||||
* getButttonWrapperId()
|
||||
*/
|
||||
@Override
|
||||
protected String getButttonWrapperIdPrefix() {
|
||||
|
||||
|
||||
@@ -25,9 +25,6 @@ import com.vaadin.ui.Button.ClickEvent;
|
||||
|
||||
/**
|
||||
* Target Tag filter by Tag Header.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
@@ -50,9 +47,7 @@ public class TargetTagFilterHeader extends AbstractFilterHeader {
|
||||
@Autowired
|
||||
private ManagementUIState managementUIState;
|
||||
|
||||
/**
|
||||
* Initialize Tag Header.
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
super.init();
|
||||
@@ -61,101 +56,45 @@ public class TargetTagFilterHeader extends AbstractFilterHeader {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* getHideButtonId()
|
||||
*/
|
||||
@Override
|
||||
protected String getHideButtonId() {
|
||||
|
||||
return SPUIComponetIdProvider.HIDE_TARGET_TAGS;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* hasCreateUpdatePermission()
|
||||
*/
|
||||
@Override
|
||||
protected boolean hasCreateUpdatePermission() {
|
||||
|
||||
return permChecker.hasCreateTargetPermission() || permChecker.hasUpdateTargetPermission();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#getTitle(
|
||||
* )
|
||||
*/
|
||||
@Override
|
||||
protected String getTitle() {
|
||||
return i18n.get("header.target.filter.tag", new Object[] {});
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* settingsIconClicked(com.vaadin .ui.Button.ClickEvent)
|
||||
*/
|
||||
@Override
|
||||
protected void settingsIconClicked(final ClickEvent event) {
|
||||
/**
|
||||
* Add tag icon not displayed.
|
||||
*/
|
||||
// Add tag icon not displayed.
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* dropHitsRequired()
|
||||
*/
|
||||
@Override
|
||||
protected boolean dropHitsRequired() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* hideFilterButtonLayout()
|
||||
*/
|
||||
@Override
|
||||
protected void hideFilterButtonLayout() {
|
||||
managementUIState.setTargetTagFilterClosed(true);
|
||||
eventbus.publish(this, ManagementUIEvent.HIDE_TARGET_TAG_LAYOUT);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* getConfigureFilterButtonId()
|
||||
*/
|
||||
@Override
|
||||
protected String getConfigureFilterButtonId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader#
|
||||
* isAddTagRequired()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isAddTagRequired() {
|
||||
return false;
|
||||
|
||||
@@ -0,0 +1,244 @@
|
||||
/**
|
||||
* 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.push;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.BlockingDeque;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.LinkedBlockingDeque;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagCreatedBulkEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.EntityEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.RolloutChangeEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.RolloutGroupChangeEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetCreatedEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetDeletedEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetInfoUpdateEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetTagCreatedBulkEvent;
|
||||
import org.eclipse.hawkbit.im.authentication.TenantAwareAuthenticationDetails;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.security.core.context.SecurityContext;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.web.context.HttpSessionSecurityContextRepository;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventBus.SessionEventBus;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.eventbus.AllowConcurrentEvents;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.vaadin.server.VaadinSession;
|
||||
import com.vaadin.server.VaadinSession.State;
|
||||
import com.vaadin.server.WrappedSession;
|
||||
import com.vaadin.ui.UI;
|
||||
|
||||
/**
|
||||
* A {@link EventPushStrategy} implementation which retrieves events from
|
||||
* {@link com.google.common.eventbus.EventBus} and store them first in an queue
|
||||
* where they will dispatched every 2 seconds to the {@link EventBus} in a
|
||||
* Vaadin access thread {@link UI#access(Runnable)}.
|
||||
*
|
||||
* This strategy avoids blocking UIs when too many events are fired and
|
||||
* dispatched to the UI thread. The UI will freeze in the time. To avoid that
|
||||
* all events are collected first and same events are merged to a list of events
|
||||
* before they dispatched to the UI thread.
|
||||
*
|
||||
* The strategy also verifies the current tenant in the session with the tenant
|
||||
* in the event and only forwards event from the right tenant to the UI.
|
||||
*
|
||||
*/
|
||||
public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DelayedEventBusPushStrategy.class);
|
||||
|
||||
private static final int BLOCK_SIZE = 10_000;
|
||||
private final ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
|
||||
private final BlockingDeque<org.eclipse.hawkbit.eventbus.event.Event> queue = new LinkedBlockingDeque<>(BLOCK_SIZE);
|
||||
private final EventBus.SessionEventBus eventBus;
|
||||
private final com.google.common.eventbus.EventBus systemEventBus;
|
||||
|
||||
private ScheduledFuture<?> jobHandle;
|
||||
|
||||
/**
|
||||
* only events defined in the set are dispatched to the session event bus.
|
||||
*/
|
||||
private static final Set<Class<?>> UI_EVENTS = Sets.newHashSet(TargetInfoUpdateEvent.class,
|
||||
TargetCreatedEvent.class, TargetDeletedEvent.class, RolloutChangeEvent.class, RolloutGroupChangeEvent.class,
|
||||
TargetTagCreatedBulkEvent.class, DistributionSetTagCreatedBulkEvent.class);
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param eventBus
|
||||
* the session event bus to where the events should be dispatched
|
||||
* @param systemEventBus
|
||||
* the system event bus where to retrieve the events from the
|
||||
* back-end
|
||||
*/
|
||||
public DelayedEventBusPushStrategy(final SessionEventBus eventBus,
|
||||
final com.google.common.eventbus.EventBus systemEventBus) {
|
||||
this.eventBus = eventBus;
|
||||
this.systemEventBus = systemEventBus;
|
||||
}
|
||||
|
||||
/**
|
||||
* An {@link com.google.common.eventbus.EventBus} subscriber which
|
||||
* subscribes {@link EntityEvent} from the repository to dispatch these
|
||||
* events to the UI {@link SessionEventBus}.
|
||||
*
|
||||
* @param event
|
||||
* the entity event which has been published from the repository
|
||||
*/
|
||||
@Subscribe
|
||||
@AllowConcurrentEvents
|
||||
public void dispatch(final org.eclipse.hawkbit.eventbus.event.Event event) {
|
||||
// to dispatch too many events which are not interested on the UI
|
||||
if (UI_EVENTS.contains(event.getClass()) && !queue.offer(event)) {
|
||||
LOG.warn("Deque limit is reached, cannot add more events!!! Dropped event is {}", event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(final UI vaadinUI) {
|
||||
LOG.debug("Initialize delayed event push strategy");
|
||||
jobHandle = executorService.scheduleWithFixedDelay(new DispatchRunnable(vaadinUI, vaadinUI.getSession()), 500,
|
||||
2000, TimeUnit.MILLISECONDS);
|
||||
systemEventBus.register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clean() {
|
||||
LOG.debug("Cleanup resources");
|
||||
jobHandle.cancel(true);
|
||||
systemEventBus.unregister(this);
|
||||
executorService.shutdownNow();
|
||||
queue.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the tenant within the event is equal with the current tenant in
|
||||
* the context.
|
||||
*
|
||||
* @param userContext
|
||||
* the security context of the current session
|
||||
* @param event
|
||||
* the event to dispatch to the UI
|
||||
* @return {@code true} if the event can be dispatched to the UI otherwise
|
||||
* {@code false}
|
||||
*/
|
||||
protected boolean eventSecurityCheck(final SecurityContext userContext,
|
||||
final org.eclipse.hawkbit.eventbus.event.Event event) {
|
||||
if (userContext == null || userContext.getAuthentication() == null) {
|
||||
return false;
|
||||
}
|
||||
final Object tenantAuthenticationDetails = userContext.getAuthentication().getDetails();
|
||||
if (tenantAuthenticationDetails instanceof TenantAwareAuthenticationDetails) {
|
||||
return ((TenantAwareAuthenticationDetails) tenantAuthenticationDetails).getTenant()
|
||||
.equalsIgnoreCase(event.getTenant());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private final class DispatchRunnable implements Runnable {
|
||||
|
||||
private final UI vaadinUI;
|
||||
private final VaadinSession vaadinSession;
|
||||
|
||||
private DispatchRunnable(final UI ui, final VaadinSession session) {
|
||||
vaadinUI = ui;
|
||||
vaadinSession = session;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
LOG.debug("UI EventBus aggregator started");
|
||||
final long timestamp = System.currentTimeMillis();
|
||||
final List<org.eclipse.hawkbit.eventbus.event.Event> events = new LinkedList<>();
|
||||
for (int i = 0; i < BLOCK_SIZE; i++) {
|
||||
final org.eclipse.hawkbit.eventbus.event.Event pollEvent = queue.poll();
|
||||
if (pollEvent == null) {
|
||||
continue;
|
||||
}
|
||||
events.add(pollEvent);
|
||||
}
|
||||
|
||||
if (events.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (vaadinSession == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG.debug("UI EventBus aggregator session: {}", vaadinSession);
|
||||
|
||||
final WrappedSession wrappedSession = vaadinSession.getSession();
|
||||
if (wrappedSession == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int eventsSize = events.size();
|
||||
|
||||
doDispatch(events, wrappedSession);
|
||||
|
||||
LOG.debug("UI EventBus aggregator done with sending {} events in {} ms", eventsSize,
|
||||
System.currentTimeMillis() - timestamp);
|
||||
|
||||
}
|
||||
|
||||
private void doDispatch(final List<org.eclipse.hawkbit.eventbus.event.Event> events,
|
||||
final WrappedSession wrappedSession) {
|
||||
final SecurityContext userContext = (SecurityContext) wrappedSession
|
||||
.getAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY);
|
||||
final SecurityContext oldContext = SecurityContextHolder.getContext();
|
||||
try {
|
||||
SecurityContextHolder.setContext(userContext);
|
||||
vaadinUI.access(() -> {
|
||||
if (vaadinSession.getState() != State.OPEN) {
|
||||
return;
|
||||
}
|
||||
fowardEvents(events, userContext);
|
||||
|
||||
// send a list of events, because ui performance issues
|
||||
publishEventAsList(events, userContext, TargetInfoUpdateEvent.class);
|
||||
publishEventAsList(events, userContext, TargetCreatedEvent.class);
|
||||
publishEventAsList(events, userContext, TargetDeletedEvent.class);
|
||||
});
|
||||
} finally {
|
||||
SecurityContextHolder.setContext(oldContext);
|
||||
}
|
||||
}
|
||||
|
||||
private void publishEventAsList(final List<org.eclipse.hawkbit.eventbus.event.Event> events,
|
||||
final SecurityContext userContext, final Class<?> eventType) {
|
||||
final List<org.eclipse.hawkbit.eventbus.event.Event> bulkEvents = events.stream()
|
||||
.filter(event -> DelayedEventBusPushStrategy.this.eventSecurityCheck(userContext, event)
|
||||
&& eventType.isInstance(event))
|
||||
.collect(Collectors.toList());
|
||||
if (bulkEvents.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
eventBus.publish(vaadinUI, bulkEvents);
|
||||
}
|
||||
|
||||
private void fowardEvents(final List<org.eclipse.hawkbit.eventbus.event.Event> events,
|
||||
final SecurityContext userContext) {
|
||||
events.stream().filter(event -> DelayedEventBusPushStrategy.this.eventSecurityCheck(userContext, event))
|
||||
.forEach(event -> eventBus.publish(vaadinUI, event));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.push;
|
||||
|
||||
import com.vaadin.ui.UI;
|
||||
|
||||
/**
|
||||
* Interface declaring a strategy to push events from the back-end to the UI.
|
||||
*
|
||||
*/
|
||||
public interface EventPushStrategy {
|
||||
|
||||
/**
|
||||
* Initialize the event push strategy, this is bound to the life-cycle of
|
||||
* the {@link UI} so the strategy can be initialized based a {@link UI}.
|
||||
*
|
||||
* @param vaadinUI
|
||||
* the {@link UI}
|
||||
*/
|
||||
void init(UI vaadinUI);
|
||||
|
||||
/**
|
||||
* Cleans up resources when the strategy is not be used anymore e.g.
|
||||
* {@link UI#detach()}.
|
||||
*/
|
||||
void clean();
|
||||
}
|
||||
@@ -24,10 +24,6 @@ public class ProxyRollout extends Rollout {
|
||||
|
||||
private String modifiedDate;
|
||||
|
||||
private String createdBy;
|
||||
|
||||
private String lastModifiedBy;
|
||||
|
||||
private Long numberOfGroups;
|
||||
|
||||
private Long runningTargetsCount;
|
||||
@@ -106,36 +102,6 @@ public class ProxyRollout extends Rollout {
|
||||
this.modifiedDate = modifiedDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the createdBy
|
||||
*/
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param createdBy
|
||||
* the createdBy to set
|
||||
*/
|
||||
public void setCreatedBy(final String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the lastModifiedBy
|
||||
*/
|
||||
public String getLastModifiedBy() {
|
||||
return lastModifiedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param lastModifiedBy
|
||||
* the lastModifiedBy to set
|
||||
*/
|
||||
public void setLastModifiedBy(final String lastModifiedBy) {
|
||||
this.lastModifiedBy = lastModifiedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the runningTargetsCount
|
||||
*/
|
||||
|
||||
@@ -22,10 +22,6 @@ public class ProxyRolloutGroup extends RolloutGroup {
|
||||
|
||||
private String modifiedDate;
|
||||
|
||||
private String createdBy;
|
||||
|
||||
private String lastModifiedBy;
|
||||
|
||||
private String finishedPercentage;
|
||||
|
||||
private Long runningTargetsCount;
|
||||
@@ -74,36 +70,6 @@ public class ProxyRolloutGroup extends RolloutGroup {
|
||||
this.modifiedDate = modifiedDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the createdBy
|
||||
*/
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param createdBy
|
||||
* the createdBy to set
|
||||
*/
|
||||
public void setCreatedBy(final String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the lastModifiedBy
|
||||
*/
|
||||
public String getLastModifiedBy() {
|
||||
return lastModifiedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param lastModifiedBy
|
||||
* the lastModifiedBy to set
|
||||
*/
|
||||
public void setLastModifiedBy(final String lastModifiedBy) {
|
||||
this.lastModifiedBy = lastModifiedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the finishedPercentage
|
||||
*/
|
||||
|
||||
@@ -53,6 +53,7 @@ public class RolloutGroupTargetsListHeader extends AbstractSimpleTableHeader {
|
||||
private Button rolloutsGroupViewLink;
|
||||
private Label headerCaption;
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
@@ -78,8 +79,8 @@ public class RolloutGroupTargetsListHeader extends AbstractSimpleTableHeader {
|
||||
headerCaption.setCaption(rolloutGroup.getName());
|
||||
}
|
||||
|
||||
rolloutsGroupViewLink.setCaption(rolloutUiState.getRolloutName().isPresent() ? rolloutUiState.getRolloutName()
|
||||
.get() : "");
|
||||
rolloutsGroupViewLink
|
||||
.setCaption(rolloutUiState.getRolloutName().isPresent() ? rolloutUiState.getRolloutName().get() : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -103,9 +104,7 @@ public class RolloutGroupTargetsListHeader extends AbstractSimpleTableHeader {
|
||||
|
||||
@Override
|
||||
protected void searchBy(final String newSearchText) {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
// No implementation required.
|
||||
|
||||
}
|
||||
|
||||
@@ -162,12 +161,6 @@ public class RolloutGroupTargetsListHeader extends AbstractSimpleTableHeader {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.rollout.AbstractSimpleTableHeader#
|
||||
* getHeaderCaptionLayout()
|
||||
*/
|
||||
@Override
|
||||
protected HorizontalLayout getHeaderCaptionLayout() {
|
||||
headerCaption = SPUIComponentProvider.getLabel("", SPUILabelDefinitions.SP_WIDGET_CAPTION);
|
||||
@@ -204,12 +197,6 @@ public class RolloutGroupTargetsListHeader extends AbstractSimpleTableHeader {
|
||||
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUTS);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.ui.rollout.AbstractSimpleTableHeader#restoreCaption()
|
||||
*/
|
||||
@Override
|
||||
protected void restoreCaption() {
|
||||
setCaptionDetails();
|
||||
|
||||
@@ -61,6 +61,7 @@ public class RolloutGroupTargetsListTable extends AbstractSimpleTable {
|
||||
@Autowired
|
||||
private transient RolloutUIState rolloutUIState;
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
@@ -88,8 +89,8 @@ public class RolloutGroupTargetsListTable extends AbstractSimpleTable {
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_DATE, i18n.get("header.createdDate"), 0.15f));
|
||||
columnList
|
||||
.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, i18n.get("header.modifiedBy"), 0.15f));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, i18n.get("header.modifiedDate"),
|
||||
0.15f));
|
||||
columnList.add(
|
||||
new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, i18n.get("header.modifiedDate"), 0.15f));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_DESC, i18n.get("header.description"), 0.15f));
|
||||
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_TARGET_STATUS, i18n.get("header.status"), 0.1f));
|
||||
@@ -101,15 +102,16 @@ public class RolloutGroupTargetsListTable extends AbstractSimpleTable {
|
||||
protected Container createContainer() {
|
||||
final BeanQueryFactory<RolloutGroupTargetsBeanQuery> rolloutgrouBeanQueryFactory = new BeanQueryFactory<>(
|
||||
RolloutGroupTargetsBeanQuery.class);
|
||||
return new LazyQueryContainer(new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE,
|
||||
SPUILabelDefinitions.VAR_ID), rolloutgrouBeanQueryFactory);
|
||||
return new LazyQueryContainer(
|
||||
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_ID),
|
||||
rolloutgrouBeanQueryFactory);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addContainerProperties(final Container container) {
|
||||
final LazyQueryContainer rolloutGroupTargetTableContainer = (LazyQueryContainer) container;
|
||||
rolloutGroupTargetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_CONT_ID, String.class, "",
|
||||
false, false);
|
||||
rolloutGroupTargetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_CONT_ID, String.class, "", false,
|
||||
false);
|
||||
rolloutGroupTargetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, "", false,
|
||||
true);
|
||||
rolloutGroupTargetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_STATUS, Status.class,
|
||||
@@ -124,10 +126,10 @@ public class RolloutGroupTargetsListTable extends AbstractSimpleTable {
|
||||
false, true);
|
||||
rolloutGroupTargetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, String.class,
|
||||
null, false, true);
|
||||
rolloutGroupTargetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, String.class,
|
||||
rolloutGroupTargetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, String.class, null,
|
||||
false, true);
|
||||
rolloutGroupTargetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, String.class,
|
||||
null, false, true);
|
||||
rolloutGroupTargetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE,
|
||||
String.class, null, false, true);
|
||||
rolloutGroupTargetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, "", false,
|
||||
true);
|
||||
}
|
||||
@@ -140,23 +142,20 @@ public class RolloutGroupTargetsListTable extends AbstractSimpleTable {
|
||||
|
||||
@Override
|
||||
protected void onValueChange() {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
// No implementation required.
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addCustomGeneratedColumns() {
|
||||
addGeneratedColumn(SPUILabelDefinitions.VAR_TARGET_STATUS, (source, itemId, columnId) -> getStatusLabel(itemId));
|
||||
addGeneratedColumn(SPUILabelDefinitions.VAR_TARGET_STATUS,
|
||||
(source, itemId, columnId) -> getStatusLabel(itemId));
|
||||
setColumnAlignment(SPUILabelDefinitions.VAR_TARGET_STATUS, Align.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setCollapsiblecolumns() {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
// No implementation required.
|
||||
}
|
||||
|
||||
private Label getStatusLabel(final Object itemId) {
|
||||
@@ -171,8 +170,8 @@ public class RolloutGroupTargetsListTable extends AbstractSimpleTable {
|
||||
|
||||
private void setStatusIcon(final Object itemId, final Label statusLabel) {
|
||||
final Item item = getItem(itemId);
|
||||
final RolloutGroup rolloutGroup = rolloutUIState.getRolloutGroup().isPresent() ? rolloutUIState
|
||||
.getRolloutGroup().get() : null;
|
||||
final RolloutGroup rolloutGroup = rolloutUIState.getRolloutGroup().isPresent()
|
||||
? rolloutUIState.getRolloutGroup().get() : null;
|
||||
if (item != null) {
|
||||
final Status status = (Status) item.getItemProperty(SPUILabelDefinitions.VAR_STATUS).getValue();
|
||||
if (status == null) {
|
||||
@@ -184,10 +183,10 @@ public class RolloutGroupTargetsListTable extends AbstractSimpleTable {
|
||||
statusLabel.setValue(FontAwesome.MINUS_CIRCLE.getHtml());
|
||||
statusLabel.addStyleName("statusIconBlue");
|
||||
|
||||
final String dsNameVersion = (String) item.getItemProperty(
|
||||
SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER).getValue();
|
||||
statusLabel.setDescription(i18n
|
||||
.get("message.dist.already.assigned", new Object[] { dsNameVersion }));
|
||||
final String dsNameVersion = (String) item
|
||||
.getItemProperty(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER).getValue();
|
||||
statusLabel
|
||||
.setDescription(i18n.get("message.dist.already.assigned", new Object[] { dsNameVersion }));
|
||||
}
|
||||
} else {
|
||||
setRolloutStatusIcon(status, statusLabel);
|
||||
@@ -197,36 +196,36 @@ public class RolloutGroupTargetsListTable extends AbstractSimpleTable {
|
||||
}
|
||||
|
||||
private void setRolloutStatusIcon(final Status targetUpdateStatus, final Label statusLabel) {
|
||||
switch (targetUpdateStatus) {
|
||||
case ERROR:
|
||||
statusLabel.setValue(FontAwesome.EXCLAMATION_CIRCLE.getHtml());
|
||||
statusLabel.addStyleName("statusIconRed");
|
||||
break;
|
||||
case SCHEDULED:
|
||||
statusLabel.setValue(FontAwesome.BULLSEYE.getHtml());
|
||||
statusLabel.addStyleName("statusIconBlue");
|
||||
break;
|
||||
case FINISHED:
|
||||
statusLabel.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
|
||||
statusLabel.addStyleName("statusIconGreen");
|
||||
break;
|
||||
case RUNNING:
|
||||
case RETRIEVED:
|
||||
case WARNING:
|
||||
case DOWNLOAD:
|
||||
statusLabel.setValue(FontAwesome.ADJUST.getHtml());
|
||||
statusLabel.addStyleName("statusIconYellow");
|
||||
break;
|
||||
case CANCELED:
|
||||
statusLabel.setValue(FontAwesome.TIMES_CIRCLE.getHtml());
|
||||
statusLabel.addStyleName("statusIconGreen");
|
||||
break;
|
||||
case CANCELING:
|
||||
statusLabel.setValue(FontAwesome.TIMES_CIRCLE.getHtml());
|
||||
statusLabel.addStyleName("statusIconPending");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (targetUpdateStatus) {
|
||||
case ERROR:
|
||||
statusLabel.setValue(FontAwesome.EXCLAMATION_CIRCLE.getHtml());
|
||||
statusLabel.addStyleName("statusIconRed");
|
||||
break;
|
||||
case SCHEDULED:
|
||||
statusLabel.setValue(FontAwesome.BULLSEYE.getHtml());
|
||||
statusLabel.addStyleName("statusIconBlue");
|
||||
break;
|
||||
case FINISHED:
|
||||
statusLabel.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
|
||||
statusLabel.addStyleName("statusIconGreen");
|
||||
break;
|
||||
case RUNNING:
|
||||
case RETRIEVED:
|
||||
case WARNING:
|
||||
case DOWNLOAD:
|
||||
statusLabel.setValue(FontAwesome.ADJUST.getHtml());
|
||||
statusLabel.addStyleName("statusIconYellow");
|
||||
break;
|
||||
case CANCELED:
|
||||
statusLabel.setValue(FontAwesome.TIMES_CIRCLE.getHtml());
|
||||
statusLabel.addStyleName("statusIconGreen");
|
||||
break;
|
||||
case CANCELING:
|
||||
statusLabel.setValue(FontAwesome.TIMES_CIRCLE.getHtml());
|
||||
statusLabel.addStyleName("statusIconPending");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ public class RolloutGroupsListHeader extends AbstractSimpleTableHeader {
|
||||
|
||||
private Label headerCaption;
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
@@ -71,54 +72,42 @@ public class RolloutGroupsListHeader extends AbstractSimpleTableHeader {
|
||||
}
|
||||
|
||||
private void setCaptionDetails() {
|
||||
headerCaption.setCaption(rolloutUiState.getRolloutName().isPresent() ? rolloutUiState.getRolloutName().get()
|
||||
: "");
|
||||
headerCaption
|
||||
.setCaption(rolloutUiState.getRolloutName().isPresent() ? rolloutUiState.getRolloutName().get() : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void resetSearchText() {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
// No implementation required.
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getSearchBoxId() {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
// No implementation required.
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getSearchRestIconId() {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
// No implementation required.
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void searchBy(final String newSearchText) {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
// No implementation required.
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getAddIconId() {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
// No implementation required.
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addNewItem(final ClickEvent event) {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
// No implementation required.
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -129,7 +118,6 @@ public class RolloutGroupsListHeader extends AbstractSimpleTableHeader {
|
||||
|
||||
@Override
|
||||
protected boolean hasCreatePermission() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -140,7 +128,6 @@ public class RolloutGroupsListHeader extends AbstractSimpleTableHeader {
|
||||
|
||||
@Override
|
||||
protected boolean showCloseButton() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -159,12 +146,6 @@ public class RolloutGroupsListHeader extends AbstractSimpleTableHeader {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.rollout.AbstractSimpleTableHeader#
|
||||
* getHeaderCaptionLayout()
|
||||
*/
|
||||
@Override
|
||||
protected HorizontalLayout getHeaderCaptionLayout() {
|
||||
headerCaption = SPUIComponentProvider.getLabel("", SPUILabelDefinitions.SP_WIDGET_CAPTION);
|
||||
@@ -184,12 +165,6 @@ public class RolloutGroupsListHeader extends AbstractSimpleTableHeader {
|
||||
return headerCaptionLayout;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.ui.rollout.AbstractSimpleTableHeader#restoreCaption()
|
||||
*/
|
||||
@Override
|
||||
protected void restoreCaption() {
|
||||
setCaptionDetails();
|
||||
|
||||
@@ -50,9 +50,7 @@ public class RolloutListHeader extends AbstractSimpleTableHeader {
|
||||
@Autowired
|
||||
private AddUpdateRolloutWindowLayout addUpdateRolloutWindow;
|
||||
|
||||
/**
|
||||
* Initialization of Target Header Component.
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
@@ -101,9 +99,7 @@ public class RolloutListHeader extends AbstractSimpleTableHeader {
|
||||
|
||||
@Override
|
||||
protected void onClose(final ClickEvent event) {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
// No implementation required.
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -133,16 +129,9 @@ public class RolloutListHeader extends AbstractSimpleTableHeader {
|
||||
|
||||
@Override
|
||||
protected boolean isRollout() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.rollout.AbstractSimpleTableHeader#
|
||||
* getHeaderCaptionLayout()
|
||||
*/
|
||||
@Override
|
||||
protected HorizontalLayout getHeaderCaptionLayout() {
|
||||
final Label headerCaption = SPUIComponentProvider.getLabel(getHeaderCaption(),
|
||||
@@ -153,17 +142,9 @@ public class RolloutListHeader extends AbstractSimpleTableHeader {
|
||||
return headerCaptionLayout;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.ui.rollout.AbstractSimpleTableHeader#restoreCaption()
|
||||
*/
|
||||
@Override
|
||||
protected void restoreCaption() {
|
||||
/**
|
||||
* No implementation required.
|
||||
*/
|
||||
// No implementation required.
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ soft.module.os =OS
|
||||
message.error.noFileSelected = No file selected for upload
|
||||
message.error.noProvidedName = Please provide custom file name
|
||||
message.error.noSwModuleSelected = Please select a software module
|
||||
message.no.duplicateFiles = duplicate files selected
|
||||
message.no.duplicateFiles = Duplicate files selected
|
||||
message.no.duplicateFile = Duplicate file selected :
|
||||
message.delete.artifact = Are you sure that you want to delete artifact {0} ?
|
||||
message.duplicate.filename = Duplicate file name
|
||||
|
||||
@@ -310,7 +310,7 @@ soft.module.os =OS
|
||||
message.error.noFileSelected = No file selected for upload
|
||||
message.error.noProvidedName = Please provide custom file name
|
||||
message.error.noSwModuleSelected = Please select a software module
|
||||
message.no.duplicateFiles = duplicate files selected
|
||||
message.no.duplicateFiles = Duplicate files selected
|
||||
message.no.duplicateFile = Duplicate file selected :
|
||||
message.delete.artifact = Are you sure that you want to delete artifact {0} ?
|
||||
message.duplicate.filename = Duplicate file name
|
||||
|
||||
@@ -305,7 +305,7 @@ soft.module.os =OS
|
||||
message.error.noFileSelected = No file selected for upload
|
||||
message.error.noProvidedName = Please provide custom file name
|
||||
message.error.noSwModuleSelected = Please select a software module
|
||||
message.no.duplicateFiles = duplicate files selected
|
||||
message.no.duplicateFiles = Duplicate files selected
|
||||
message.no.duplicateFile = Duplicate file selected :
|
||||
message.delete.artifact = Are you sure that you want to delete artifact {0} ?
|
||||
message.duplicate.filename = Duplicate file name
|
||||
|
||||
Reference in New Issue
Block a user