Merge branch 'master' into Artifiact_upload_directory_upload

This commit is contained in:
asharani-murugesh
2016-02-16 10:32:16 +01:00
129 changed files with 5301 additions and 3646 deletions

View File

@@ -75,7 +75,7 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
private SpringViewProvider viewProvider;
@Autowired
private ApplicationContext context;
private transient ApplicationContext context;
@Autowired
private I18N i18n;
@@ -89,13 +89,13 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
private ErrorView errorview;
@Autowired
protected EventBus.SessionEventBus eventBus;
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
*/
@@ -103,21 +103,28 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
@AllowConcurrentEvents
public void dispatch(final org.eclipse.hawkbit.eventbus.event.Event event) {
final VaadinSession session = getSession();
if (session != null && session.getState() == State.OPEN) {
final WrappedSession wrappedSession = session.getSession();
if (wrappedSession != null) {
final SecurityContext userContext = (SecurityContext) wrappedSession
.getAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY);
if (eventSecurityCheck(userContext, event)) {
final SecurityContext oldContext = SecurityContextHolder.getContext();
try {
access(new DispatcherRunnable(eventBus, session, userContext, event));
} finally {
SecurityContextHolder.setContext(oldContext);
}
}
}
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);
}
}
protected boolean eventSecurityCheck(final SecurityContext userContext,
@@ -134,7 +141,7 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
/*
* (non-Javadoc)
*
*
* @see
* com.vaadin.server.ClientConnector.DetachListener#detach(com.vaadin.server
* .ClientConnector. DetachEvent)
@@ -225,7 +232,7 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
/**
* Get Specific Locale.
*
*
* @param availableLocalesInApp
* as set
* @return String as preferred locale

View File

@@ -8,6 +8,7 @@
*/
package org.eclipse.hawkbit.ui.artifacts.footer;
import java.util.HashSet;
import java.util.Set;
import javax.annotation.PostConstruct;
@@ -21,6 +22,7 @@ import org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout;
import org.eclipse.hawkbit.ui.management.event.DragEvent;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.springframework.beans.factory.annotation.Autowired;
@@ -36,6 +38,7 @@ 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;
/**
* Upload view footer layout implementation.
@@ -196,7 +199,7 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
final Component sourceComponent = event.getTransferable().getSourceComponent();
if (sourceComponent instanceof Table) {
final Table sourceTable = (Table) event.getTransferable().getSourceComponent();
addToDeleteList(sourceTable);
addToDeleteList(sourceTable,(TableTransferable) event.getTransferable());
updateSWActionCount();
}
if (sourceComponent.getId().startsWith(SPUIComponetIdProvider.UPLOAD_TYPE_BUTTON_PREFIX)) {
@@ -220,16 +223,23 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
private void deleteSWModuleType(final String swModuleTypeName) {
artifactUploadState.getSelectedDeleteSWModuleTypes().add(swModuleTypeName);
}
private void addToDeleteList(final Table sourceTable) {
final Set<Long> swModuleIds = (Set<Long>) sourceTable.getValue();
swModuleIds.forEach(id -> {
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>();
if (!swModuleSelected.contains(transferable.getData(SPUIDefinitions.ITEMID))) {
swModuleIdNameSet.add((Long) transferable.getData(SPUIDefinitions.ITEMID));
} else {
swModuleIdNameSet.addAll(swModuleSelected);
}
swModuleIdNameSet.forEach(id -> {
final String swModuleName = (String) sourceTable.getContainerDataSource().getItem(id)
.getItemProperty(SPUILabelDefinitions.NAME_VERSION).getValue();
artifactUploadState.getDeleteSofwareModules().put(id, swModuleName);
});
}
/**
* Update the software module delete count.
*/

View File

@@ -44,9 +44,9 @@ import com.vaadin.ui.themes.ValoTheme;
/**
* Abstract layout of confirm actions window.
*
*
*
*
*
*/
@SpringComponent
@ViewScope
@@ -84,13 +84,13 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
/*
* (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>();
final Map<String, ConfirmationTab> tabs = new HashMap<>();
if (!artifactUploadState.getDeleteSofwareModules().isEmpty()) {
tabs.put(i18n.get("caption.delete.swmodule.accordion.tab"), createSMDeleteConfirmationTab());
}
@@ -145,7 +145,7 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
/**
* Get SWModule table container.
*
*
* @return IndexedContainer
*/
@SuppressWarnings("unchecked")
@@ -153,9 +153,8 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
final IndexedContainer swcontactContainer = new IndexedContainer();
swcontactContainer.addContainerProperty("SWModuleId", String.class, "");
swcontactContainer.addContainerProperty(SW_MODULE_NAME_MSG, String.class, "");
Item item = null;
for (final Long swModuleID : artifactUploadState.getDeleteSofwareModules().keySet()) {
item = swcontactContainer.addItem(swModuleID);
final Item item = swcontactContainer.addItem(swModuleID);
item.getItemProperty("SWModuleId").setValue(swModuleID.toString());
item.getItemProperty(SW_MODULE_NAME_MSG)
.setValue(artifactUploadState.getDeleteSofwareModules().get(swModuleID));
@@ -197,7 +196,7 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
for (final CustomFile customFile : artifactUploadState.getFileSelected()) {
final String swNameVersion = HawkbitCommonUtil.getFormattedNameVersion(
customFile.getBaseSoftwareModuleName(), customFile.getBaseSoftwareModuleVersion());
if (HawkbitCommonUtil.bothSame(deleteSoftwareNameVersion, swNameVersion)) {
if (deleteSoftwareNameVersion != null && deleteSoftwareNameVersion.equals(swNameVersion)) {
tobeRemoved.add(customFile);
}
}

View File

@@ -38,13 +38,13 @@ public class ArtifactUploadState implements Serializable {
private final Map<Long, String> deleteSofwareModules = new HashMap<>();
private final Set<CustomFile> fileSelected = new HashSet<CustomFile>();
private final Set<CustomFile> fileSelected = new HashSet<>();
private Long selectedBaseSwModuleId;
private SoftwareModule selectedBaseSoftwareModule;
private final Map<String, SoftwareModule> baseSwModuleList = new HashMap<String, SoftwareModule>();
private final Map<String, SoftwareModule> baseSwModuleList = new HashMap<>();
private Set<Long> selectedSoftwareModules = Collections.emptySet();
@@ -60,7 +60,7 @@ public class ArtifactUploadState implements Serializable {
/**
* Set software.
*
*
* @return
*/
public SoftwareModuleFilters getSoftwareModuleFilters() {
@@ -85,7 +85,7 @@ public class ArtifactUploadState implements Serializable {
* @return the selectedBaseSwModuleId
*/
public Optional<Long> getSelectedBaseSwModuleId() {
return this.selectedBaseSwModuleId != null ? Optional.of(this.selectedBaseSwModuleId) : Optional.empty();
return selectedBaseSwModuleId != null ? Optional.of(selectedBaseSwModuleId) : Optional.empty();
}
/**
@@ -100,8 +100,7 @@ public class ArtifactUploadState implements Serializable {
* @return the selectedBaseSoftwareModule
*/
public Optional<SoftwareModule> getSelectedBaseSoftwareModule() {
return this.selectedBaseSoftwareModule == null ? Optional.empty()
: Optional.of(this.selectedBaseSoftwareModule);
return selectedBaseSoftwareModule == null ? Optional.empty() : Optional.of(selectedBaseSoftwareModule);
}
/**

View File

@@ -10,8 +10,6 @@ package org.eclipse.hawkbit.ui.artifacts.state;
import java.io.Serializable;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
/**
* Custom file to hold details of uploaded file.
*
@@ -168,36 +166,50 @@ public class CustomFile implements Serializable {
return failureReason;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() { // NOSONAR - as this is generated
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (fileName == null ? 0 : fileName.hashCode());
result = prime * result + ((baseSoftwareModuleName == null) ? 0 : baseSoftwareModuleName.hashCode());
result = prime * result + ((baseSoftwareModuleVersion == null) ? 0 : baseSoftwareModuleVersion.hashCode());
result = prime * result + ((fileName == null) ? 0 : fileName.hashCode());
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof CustomFile)) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final CustomFile other = (CustomFile) obj;
return HawkbitCommonUtil.bothSame(fileName, other.fileName)
&& HawkbitCommonUtil.bothSame(baseSoftwareModuleName, other.baseSoftwareModuleName)
&& HawkbitCommonUtil.bothSame(baseSoftwareModuleVersion, other.baseSoftwareModuleVersion);
if (baseSoftwareModuleName == null) {
if (other.baseSoftwareModuleName != null) {
return false;
}
} else if (!baseSoftwareModuleName.equals(other.baseSoftwareModuleName)) {
return false;
}
if (baseSoftwareModuleVersion == null) {
if (other.baseSoftwareModuleVersion != null) {
return false;
}
} else if (!baseSoftwareModuleVersion.equals(other.baseSoftwareModuleVersion)) {
return false;
}
if (fileName == null) {
if (other.fileName != null) {
return false;
}
} else if (!fileName.equals(other.fileName)) {
return false;
}
return true;
}
}

View File

@@ -8,8 +8,6 @@
*/
package org.eclipse.hawkbit.ui.common.filterlayout;
import java.util.Optional;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import com.vaadin.ui.Button;
@@ -17,20 +15,20 @@ import com.vaadin.ui.Button.ClickEvent;
/**
* Abstract Single button click behaviour of filter buttons layout.
*
*
*
*
*
*
*/
public abstract class AbstractFilterSingleButtonClick extends AbstractFilterButtonClickBehaviour {
private static final long serialVersionUID = 478874092615793581L;
private Optional<Button> alreadyClickedButton = Optional.empty();
private Button alreadyClickedButton;
/*
* (non-Javadoc)
*
*
* @see org.eclipse.hawkbit.server.ui.layouts.SPFilterButtonClick#
* processFilterButtonClick(com.vaadin.ui. Button.ClickEvent)
*/
@@ -40,18 +38,18 @@ public abstract class AbstractFilterSingleButtonClick extends AbstractFilterButt
if (isButtonUnClicked(clickedButton)) {
/* If same button clicked */
clickedButton.removeStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
alreadyClickedButton = Optional.empty();
alreadyClickedButton = null;
filterUnClicked(clickedButton);
} else if (alreadyClickedButton.isPresent()) {
} else if (alreadyClickedButton != null) {
/* If button clicked and some other button is already clicked */
alreadyClickedButton.get().removeStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
alreadyClickedButton.removeStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
clickedButton.addStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
alreadyClickedButton = Optional.of(clickedButton);
alreadyClickedButton = clickedButton;
filterClicked(clickedButton);
} else {
/* If button clicked and not other button is clicked currently */
clickedButton.addStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
alreadyClickedButton = Optional.of(clickedButton);
alreadyClickedButton = clickedButton;
filterClicked(clickedButton);
}
}
@@ -61,21 +59,19 @@ public abstract class AbstractFilterSingleButtonClick extends AbstractFilterButt
* @return
*/
private boolean isButtonUnClicked(final Button clickedButton) {
return alreadyClickedButton.isPresent() && alreadyClickedButton.get().equals(clickedButton);
return alreadyClickedButton != null && alreadyClickedButton.equals(clickedButton);
}
/*
* (non-Javadoc)
*
*
* @see org.eclipse.hawkbit.server.ui.layouts.SPFilterButtonClickBehaviour#
* setDefaultClickedButton(com.vaadin .ui.Button)
*/
@Override
protected void setDefaultClickedButton(final Button button) {
if (button == null) {
alreadyClickedButton = Optional.empty();
} else {
alreadyClickedButton = Optional.of(button);
alreadyClickedButton = button;
if (button != null) {
button.addStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
}
}
@@ -83,7 +79,7 @@ public abstract class AbstractFilterSingleButtonClick extends AbstractFilterButt
/**
* @return the alreadyClickedButton
*/
public Optional<Button> getAlreadyClickedButton() {
public Button getAlreadyClickedButton() {
return alreadyClickedButton;
}
@@ -91,7 +87,7 @@ public abstract class AbstractFilterSingleButtonClick extends AbstractFilterButt
* @param alreadyClickedButton
* the alreadyClickedButton to set
*/
public void setAlreadyClickedButton(final Optional<Button> alreadyClickedButton) {
public void setAlreadyClickedButton(final Button alreadyClickedButton) {
this.alreadyClickedButton = alreadyClickedButton;
}

View File

@@ -32,7 +32,7 @@ import com.vaadin.ui.themes.ValoTheme;
/**
* Abstract class for target/ds tag token layout.
*
*
*
*
*
@@ -47,9 +47,9 @@ public abstract class AbstractTagToken implements Serializable {
protected IndexedContainer container;
protected final Map<Long, TagData> tagDetails = new HashMap<Long, TagData>();
protected final Map<Long, TagData> tagDetails = new HashMap<>();
protected final Map<Long, TagData> tokensAdded = new HashMap<Long, TagData>();
protected final Map<Long, TagData> tokensAdded = new HashMap<>();
protected CssLayout tokenLayout = new CssLayout();
@@ -123,7 +123,7 @@ public abstract class AbstractTagToken implements Serializable {
class CustomTokenField extends TokenField {
private static final long serialVersionUID = 694216966472937436L;
final Container tokenContainer;
Container tokenContainer;
CustomTokenField(final CssLayout cssLayout, final Container tokenContainer) {
super(cssLayout);
@@ -235,9 +235,11 @@ public abstract class AbstractTagToken implements Serializable {
/**
* Tag details.
*
*
*/
public static class TagData {
public static class TagData implements Serializable {
private static final long serialVersionUID = 1L;
private String name;
@@ -247,7 +249,7 @@ public abstract class AbstractTagToken implements Serializable {
/**
* Tag data constructor.
*
*
* @param id
* @param name
* @param color

View File

@@ -9,6 +9,7 @@
package org.eclipse.hawkbit.ui.distributions.dstable;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -57,7 +58,7 @@ import com.vaadin.ui.Window;
/**
* Distribution set details layout.
*
*
*
*
*/
@@ -153,12 +154,13 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
@SuppressWarnings("unchecked")
private void showUnsavedAssignment() {
Item item;
final Map<DistributionSetIdName, Set<SoftwareModuleIdName>> assignedList = manageDistUIState.getAssignedList();
final Map<DistributionSetIdName, HashSet<SoftwareModuleIdName>> assignedList = manageDistUIState
.getAssignedList();
final Long selectedDistId = manageDistUIState.getLastSelectedDistribution().isPresent()
? manageDistUIState.getLastSelectedDistribution().get().getId() : null;
Set<SoftwareModuleIdName> softwareModuleIdNameList = null;
for (final Map.Entry<DistributionSetIdName, Set<SoftwareModuleIdName>> entry : assignedList.entrySet()) {
for (final Map.Entry<DistributionSetIdName, HashSet<SoftwareModuleIdName>> entry : assignedList.entrySet()) {
if (entry.getKey().getId().equals(selectedDistId)) {
softwareModuleIdNameList = entry.getValue();
break;
@@ -321,7 +323,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
* onEdit(com.vaadin.ui .Button.ClickEvent)
*/
@@ -336,7 +338,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
* getEditButtonId()
*/
@@ -347,7 +349,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
* onLoadIsSwModuleSelected ()
*/
@@ -359,7 +361,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
* onLoadIsTableMaximized ()
*/
@@ -370,7 +372,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
* populateDetailsWidget()
*/
@@ -381,7 +383,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
* getDefaultCaption()
*/
@@ -392,7 +394,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
* addTabs(com.vaadin. ui.TabSheet)
*/
@@ -407,7 +409,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
* clearDetails()
*/
@@ -418,7 +420,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
* hasEditSoftwareModulePermission()
*/
@@ -507,7 +509,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
* getTabSheetId()
*/

View File

@@ -73,7 +73,7 @@ import com.vaadin.ui.UI;
/**
* Distribution set table.
*
*
*
*
*/
@@ -138,7 +138,7 @@ public class DistributionSetTable extends AbstractTable {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#getTableId()
*/
@@ -149,7 +149,7 @@ public class DistributionSetTable extends AbstractTable {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#createContainer(
* )
@@ -157,7 +157,7 @@ public class DistributionSetTable extends AbstractTable {
@Override
protected Container createContainer() {
final Map<String, Object> queryConfiguration = new HashMap<String, Object>();
final Map<String, Object> queryConfiguration = new HashMap<>();
manageDistUIState.getManageDistFilters().getSearchText()
.ifPresent(value -> queryConfiguration.put(SPUIDefinitions.FILTER_BY_TEXT, value));
@@ -166,19 +166,16 @@ public class DistributionSetTable extends AbstractTable {
manageDistUIState.getManageDistFilters().getClickedDistSetType());
}
final BeanQueryFactory<ManageDistBeanQuery> distributionQF = new BeanQueryFactory<ManageDistBeanQuery>(
ManageDistBeanQuery.class);
final BeanQueryFactory<ManageDistBeanQuery> distributionQF = new BeanQueryFactory<>(ManageDistBeanQuery.class);
distributionQF.setQueryConfiguration(queryConfiguration);
final LazyQueryContainer distContainer = new LazyQueryContainer(
return new LazyQueryContainer(
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_DIST_ID_NAME),
distributionQF);
return distContainer;
}
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.table.AbstractTable#addContainerProperties
* (com.vaadin.data.Container )
*/
@@ -191,7 +188,7 @@ public class DistributionSetTable extends AbstractTable {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTable#
* addCustomGeneratedColumns ()
*/
@@ -204,7 +201,7 @@ public class DistributionSetTable extends AbstractTable {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTable#
* isFirstRowSelectedOnLoad ()
*/
@@ -216,7 +213,7 @@ public class DistributionSetTable extends AbstractTable {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.table.AbstractTable#getItemIdToSelect()
*/
@Override
@@ -229,7 +226,7 @@ public class DistributionSetTable extends AbstractTable {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#onValueChange()
*/
@@ -269,7 +266,7 @@ public class DistributionSetTable extends AbstractTable {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#isMaximized()
*/
@@ -280,7 +277,7 @@ public class DistributionSetTable extends AbstractTable {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.table.AbstractTable#getTableVisibleColumns
* ()
*/
@@ -291,7 +288,7 @@ public class DistributionSetTable extends AbstractTable {
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.common.table.AbstractTable#getTableDropHandler()
*/
@Override
@@ -317,7 +314,7 @@ public class DistributionSetTable extends AbstractTable {
final TableTransferable transferable = (TableTransferable) event.getTransferable();
final Table source = transferable.getSourceComponent();
final Set<Long> softwareModuleSelected = (Set<Long>) source.getValue();
final Set<Long> softwareModulesIdList = new HashSet<Long>();
final Set<Long> softwareModulesIdList = new HashSet<>();
if (!softwareModuleSelected.contains(transferable.getData("itemId"))) {
softwareModulesIdList.add((Long) transferable.getData("itemId"));
@@ -345,11 +342,11 @@ public class DistributionSetTable extends AbstractTable {
final String distVersion = (String) item.getItemProperty("version").getValue();
final DistributionSetIdName distributionSetIdName = new DistributionSetIdName(distId, distName, distVersion);
final Map<Long, Set<SoftwareModuleIdName>> map;
final HashMap<Long, HashSet<SoftwareModuleIdName>> map;
if (manageDistUIState.getConsolidatedDistSoftwarewList().containsKey(distributionSetIdName)) {
map = manageDistUIState.getConsolidatedDistSoftwarewList().get(distributionSetIdName);
} else {
map = new HashMap<Long, Set<SoftwareModuleIdName>>();
map = new HashMap<>();
manageDistUIState.getConsolidatedDistSoftwarewList().put(distributionSetIdName, map);
}
@@ -382,7 +379,8 @@ public class DistributionSetTable extends AbstractTable {
}
}
final Set<SoftwareModuleIdName> softwareModules = new HashSet<SoftwareModuleIdName>();
// hashset is seriablizable
final HashSet<SoftwareModuleIdName> softwareModules = new HashSet<>();
map.keySet().forEach(typeId -> softwareModules.addAll(map.get(typeId)));
updateDropedDetails(distributionSetIdName, softwareModules);
@@ -405,8 +403,8 @@ public class DistributionSetTable extends AbstractTable {
* @param softwareModule
* @param softwareModuleIdName
*/
private void handleFirmwareCase(final Map<Long, Set<SoftwareModuleIdName>> map, final SoftwareModule softwareModule,
final SoftwareModuleIdName softwareModuleIdName) {
private void handleFirmwareCase(final Map<Long, HashSet<SoftwareModuleIdName>> map,
final SoftwareModule softwareModule, final SoftwareModuleIdName softwareModuleIdName) {
if (softwareModule.getType().getMaxAssignments() == 1) {
if (!map.containsKey(softwareModule.getType().getId())) {
map.put(softwareModule.getType().getId(), new HashSet<SoftwareModuleIdName>());
@@ -423,8 +421,8 @@ public class DistributionSetTable extends AbstractTable {
* @param softwareModule
* @param softwareModuleIdName
*/
private void handleSoftwareCase(final Map<Long, Set<SoftwareModuleIdName>> map, final SoftwareModule softwareModule,
final SoftwareModuleIdName softwareModuleIdName) {
private void handleSoftwareCase(final Map<Long, HashSet<SoftwareModuleIdName>> map,
final SoftwareModule softwareModule, final SoftwareModuleIdName softwareModuleIdName) {
if (softwareModule.getType().getMaxAssignments() == Integer.MAX_VALUE) {
if (!map.containsKey(softwareModule.getType().getId())) {
map.put(softwareModule.getType().getId(), new HashSet<SoftwareModuleIdName>());
@@ -434,7 +432,7 @@ public class DistributionSetTable extends AbstractTable {
}
private void updateDropedDetails(final DistributionSetIdName distributionSetIdName,
final Set<SoftwareModuleIdName> softwareModules) {
final HashSet<SoftwareModuleIdName> softwareModules) {
LOG.debug("Adding a log to check if distributionSetIdName is null : {} ", distributionSetIdName);
manageDistUIState.getAssignedList().put(distributionSetIdName, softwareModules);
@@ -487,20 +485,20 @@ public class DistributionSetTable extends AbstractTable {
}
private boolean isSoftwareModuleDragged(final Long distId, final SoftwareModule sm) {
for (final Entry<DistributionSetIdName, Set<SoftwareModuleIdName>> entry : manageDistUIState.getAssignedList()
.entrySet()) {
if (distId.equals(entry.getKey().getId())) {
final Set<SoftwareModuleIdName> swModuleIdNames = entry.getValue();
for (final SoftwareModuleIdName swModuleIdName : swModuleIdNames) {
if ((sm.getName().concat(":" + sm.getVersion())).equals(swModuleIdName.getName())) {
notification.displayValidationError(i18n.get("message.software.already.dragged",
HawkbitCommonUtil.concatStrings(":", sm.getName(), sm.getVersion())));
return false;
}
}
for (final Entry<DistributionSetIdName, HashSet<SoftwareModuleIdName>> entry : manageDistUIState
.getAssignedList().entrySet()) {
if (!distId.equals(entry.getKey().getId())) {
continue;
}
final Set<SoftwareModuleIdName> swModuleIdNames = entry.getValue();
for (final SoftwareModuleIdName swModuleIdName : swModuleIdNames) {
if ((sm.getName().concat(":" + sm.getVersion())).equals(swModuleIdName.getName())) {
notification.displayValidationError(i18n.get("message.software.already.dragged",
HawkbitCommonUtil.concatStrings(":", sm.getName(), sm.getVersion())));
return false;
}
}
}
return true;
}
@@ -564,21 +562,18 @@ public class DistributionSetTable extends AbstractTable {
}
private void addTableStyleGenerator() {
setCellStyleGenerator(new Table.CellStyleGenerator() {
@Override
public String getStyle(final Table source, final Object itemId, final Object propertyId) {
if (propertyId == null) {
// Styling for row
final Item item = getItem(itemId);
final Boolean isComplete = (Boolean) item
.getItemProperty(SPUILabelDefinitions.VAR_IS_DISTRIBUTION_COMPLETE).getValue();
if (!isComplete) {
return SPUIDefinitions.DISABLE_DISTRIBUTION;
}
return null;
} else {
return null;
setCellStyleGenerator((source, itemId, propertyId) -> {
if (propertyId == null) {
// Styling for row
final Item item = getItem(itemId);
final Boolean isComplete = (Boolean) item
.getItemProperty(SPUILabelDefinitions.VAR_IS_DISTRIBUTION_COMPLETE).getValue();
if (!isComplete) {
return SPUIDefinitions.DISABLE_DISTRIBUTION;
}
return null;
} else {
return null;
}
});
}
@@ -603,7 +598,7 @@ public class DistributionSetTable extends AbstractTable {
/**
* DistributionTableFilterEvent.
*
*
* @param event
* as instance of {@link DistributionTableFilterEvent}
*/

View File

@@ -51,9 +51,9 @@ import com.vaadin.ui.UI;
/**
* Distributions footer layout implementation.
*
*
*
*
*
*/
@org.springframework.stereotype.Component
@ViewScope
@@ -94,10 +94,11 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.DeleteActionsLayout#init()
*/
@Override
@PostConstruct
protected void init() {
super.init();
@@ -140,7 +141,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* hasDeletePermission()
@@ -153,7 +154,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* hasUpdatePermission()
@@ -166,7 +167,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* getDeleteAreaLabel()
@@ -178,7 +179,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* getDeleteAreaId()
@@ -191,7 +192,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* getDeleteLayoutAcceptCriteria ()
@@ -204,7 +205,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* processDroppedComponent(com .vaadin.event.dd.DragAndDropEvent)
@@ -248,7 +249,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/**
* Check if distribution set type is selected.
*
*
* @param distTypeName
* @return true if ds type is selected
*/
@@ -276,7 +277,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
private void addInDeleteDistributionList(final Table sourceTable, final TableTransferable transferable) {
@SuppressWarnings("unchecked")
final Set<DistributionSetIdName> distSelected = (Set<DistributionSetIdName>) sourceTable.getValue();
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));
} else {
@@ -314,7 +315,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
@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 {
@@ -336,7 +337,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
+ manageDistUIState.getDeleteSofwareModulesList().size()
+ manageDistUIState.getDeletedDistributionList().size();
for (final Entry<DistributionSetIdName, Set<SoftwareModuleIdName>> mapEntry : manageDistUIState
for (final Entry<DistributionSetIdName, HashSet<SoftwareModuleIdName>> mapEntry : manageDistUIState
.getAssignedList().entrySet()) {
count += manageDistUIState.getAssignedList().get(mapEntry.getKey()).size();
}
@@ -345,7 +346,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/**
* DistributionsUIEvent.
*
*
* @param event
* as instance of {@link DistributionsUIEvent}
*/
@@ -357,27 +358,17 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
}
/**
*
* @param source
* @return true if it is distribution table
*/
private boolean isDistributionTable(final Component source) {
return HawkbitCommonUtil.bothSame(source.getId(), SPUIComponetIdProvider.DIST_TABLE_ID);
return SPUIComponetIdProvider.DIST_TABLE_ID.equals(source.getId());
}
/**
*
* @param source
* @return true if it is SoftwareModule table
*/
private boolean isSoftwareModuleTable(final Component source) {
return HawkbitCommonUtil.bothSame(source.getId(), SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE);
return SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE.equals(source.getId());
}
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* getNoActionsButtonLabel()
@@ -389,7 +380,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* getActionsButtonLabel()
@@ -403,7 +394,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* reloadActionCount()
@@ -416,7 +407,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* getUnsavedActionsWindowCaption ()
@@ -428,7 +419,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* unsavedActionsWindowClosed()
@@ -444,7 +435,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* getUnsavedActionsWindowContent ()
@@ -457,7 +448,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
* hasUnsavedActions()
@@ -490,7 +481,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout#
* hasBulkUploadPermission()
*/
@@ -501,7 +492,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout#
* showBulkUploadWindow()
*/
@@ -514,7 +505,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout#
* restoreBulkUploadStatusCount()
*/
@@ -531,7 +522,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
/**
* Check if the distribution set type is default.
*
*
* @param dsTypeName
* distribution set name
* @return true if distribution set type is set default in configuration

View File

@@ -10,6 +10,7 @@ package org.eclipse.hawkbit.ui.distributions.footer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -52,9 +53,9 @@ import com.vaadin.ui.themes.ValoTheme;
/**
* Abstract layout of confirm actions window.
*
*
*
*
*
*/
@org.springframework.stereotype.Component
@ViewScope
@@ -107,13 +108,13 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
/*
* (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>();
final Map<String, ConfirmationTab> tabs = new HashMap<>();
/* Create tab for SW Modules delete */
if (!manageDistUIState.getDeleteSofwareModulesList().isEmpty()) {
tabs.put(i18n.get("caption.delete.swmodule.accordion.tab"), createSMDeleteConfirmationTab());
@@ -190,26 +191,8 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
private void deleteSMAll(final ConfirmationTab tab) {
final Set<Long> swmoduleIds = manageDistUIState.getDeleteSofwareModulesList().keySet();
if (null != manageDistUIState.getAssignedList() && !manageDistUIState.getAssignedList().isEmpty()) {
for (final Entry<DistributionSetIdName, Set<SoftwareModuleIdName>> entryAssignSM : manageDistUIState
.getAssignedList().entrySet()) {
for (final Entry<Long, String> entryDeleteSM : manageDistUIState.getDeleteSofwareModulesList()
.entrySet()) {
final SoftwareModuleIdName smIdName = new SoftwareModuleIdName(entryDeleteSM.getKey(),
entryDeleteSM.getValue());
if (entryAssignSM.getValue().contains(smIdName)) {
entryAssignSM.getValue().remove(smIdName);
assignmnetTab.getTable().removeItem(HawkbitCommonUtil.concatStrings("|||",
entryAssignSM.getKey().getId().toString(), smIdName.getId().toString()));
}
if (entryAssignSM.getValue().isEmpty()) {
manageDistUIState.getAssignedList().remove(entryAssignSM.getKey());
}
}
}
if (manageDistUIState.getAssignedList() == null || manageDistUIState.getAssignedList().isEmpty()) {
removeAssignedSoftwareModules();
}
softwareManagement.deleteSoftwareModules(swmoduleIds);
@@ -221,6 +204,25 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
eventBus.publish(this, SaveActionWindowEvent.DELETE_ALL_SOFWARE);
}
private void removeAssignedSoftwareModules() {
for (final Entry<DistributionSetIdName, HashSet<SoftwareModuleIdName>> entryAssignSM : manageDistUIState
.getAssignedList().entrySet()) {
for (final Entry<Long, String> entryDeleteSM : manageDistUIState.getDeleteSofwareModulesList().entrySet()) {
final SoftwareModuleIdName smIdName = new SoftwareModuleIdName(entryDeleteSM.getKey(),
entryDeleteSM.getValue());
if (entryAssignSM.getValue().contains(smIdName)) {
entryAssignSM.getValue().remove(smIdName);
assignmnetTab.getTable().removeItem(HawkbitCommonUtil.concatStrings("|||",
entryAssignSM.getKey().getId().toString(), smIdName.getId().toString()));
}
if (entryAssignSM.getValue().isEmpty()) {
manageDistUIState.getAssignedList().remove(entryAssignSM.getKey());
}
}
}
}
private void discardSMAll(final ConfirmationTab tab) {
removeCurrentTab(tab);
manageDistUIState.getDeleteSofwareModulesList().clear();
@@ -230,7 +232,7 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
/**
* Get SWModule table container.
*
*
* @return IndexedContainer
*/
@SuppressWarnings("unchecked")
@@ -238,9 +240,8 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
final IndexedContainer swcontactContainer = new IndexedContainer();
swcontactContainer.addContainerProperty("SWModuleId", String.class, "");
swcontactContainer.addContainerProperty(SW_MODULE_NAME_MSG, String.class, "");
Item item = null;
for (final Long swModuleID : manageDistUIState.getDeleteSofwareModulesList().keySet()) {
item = swcontactContainer.addItem(swModuleID);
final Item item = swcontactContainer.addItem(swModuleID);
item.getItemProperty("SWModuleId").setValue(swModuleID.toString());
item.getItemProperty(SW_MODULE_NAME_MSG)
.setValue(manageDistUIState.getDeleteSofwareModulesList().get(swModuleID));
@@ -640,7 +641,8 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
contactContainer.addContainerProperty(DIST_ID_NAME, DistributionSetIdName.class, "");
contactContainer.addContainerProperty(SOFTWARE_MODULE_ID_NAME, SoftwareModuleIdName.class, "");
final Map<DistributionSetIdName, Set<SoftwareModuleIdName>> assignedList = manageDistUIState.getAssignedList();
final Map<DistributionSetIdName, HashSet<SoftwareModuleIdName>> assignedList = manageDistUIState
.getAssignedList();
assignedList.forEach((distIdname, softIdNameSet) -> softIdNameSet.forEach(softIdName -> {
final String itemId = HawkbitCommonUtil.concatStrings("|||", distIdname.getId().toString(),
@@ -672,8 +674,8 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
});
int count = 0;
for (final Entry<DistributionSetIdName, Set<SoftwareModuleIdName>> entry : manageDistUIState.getAssignedList()
.entrySet()) {
for (final Entry<DistributionSetIdName, HashSet<SoftwareModuleIdName>> entry : manageDistUIState
.getAssignedList().entrySet()) {
count += entry.getValue().size();
}
addToConsolitatedMsg(FontAwesome.TASKS.getHtml() + SPUILabelDefinitions.HTML_SPACE
@@ -707,7 +709,7 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
if (softIdNameSet.isEmpty()) {
manageDistUIState.getAssignedList().remove(discardDistIdName);
}
final Map<Long, Set<SoftwareModuleIdName>> map = manageDistUIState.getConsolidatedDistSoftwarewList()
final Map<Long, HashSet<SoftwareModuleIdName>> map = manageDistUIState.getConsolidatedDistSoftwarewList()
.get(discardDistIdName);
map.keySet().forEach(typeId -> map.get(typeId).remove(discardSoftIdName));

View File

@@ -40,11 +40,11 @@ public class ManageDistUIState implements Serializable {
@Autowired
private ManageSoftwareModuleFilters softwareModuleFilters;
private final Map<DistributionSetIdName, Set<SoftwareModuleIdName>> assignedList = new HashMap<DistributionSetIdName, Set<SoftwareModuleIdName>>();
private final Map<DistributionSetIdName, HashSet<SoftwareModuleIdName>> assignedList = new HashMap<>();
private final Set<DistributionSetIdName> deletedDistributionList = new HashSet<DistributionSetIdName>();
private final Set<DistributionSetIdName> deletedDistributionList = new HashSet<>();
private Set<DistributionSetIdName> selectedDistributions = new HashSet<DistributionSetIdName>();
private Set<DistributionSetIdName> selectedDistributions = new HashSet<>();
private DistributionSetIdName lastSelectedDistribution;
@@ -66,9 +66,9 @@ public class ManageDistUIState implements Serializable {
private boolean isDsTableMaximized = Boolean.FALSE;
private final Map<String, SoftwareModuleIdName> assignedSoftwareModuleDetails = new HashMap<String, SoftwareModuleIdName>();
private final Map<String, SoftwareModuleIdName> assignedSoftwareModuleDetails = new HashMap<>();
private final Map<DistributionSetIdName, Map<Long, Set<SoftwareModuleIdName>>> consolidatedDistSoftwarewList = new HashMap<DistributionSetIdName, Map<Long, Set<SoftwareModuleIdName>>>();
private final Map<DistributionSetIdName, HashMap<Long, HashSet<SoftwareModuleIdName>>> consolidatedDistSoftwarewList = new HashMap<>();
private boolean noDataAvilableSwModule = Boolean.FALSE;
@@ -89,10 +89,11 @@ public class ManageDistUIState implements Serializable {
}
/**
*
* Need HashSet because the Set have to be serializable
*
* @return the assignedList
*/
public Map<DistributionSetIdName, Set<SoftwareModuleIdName>> getAssignedList() {
public Map<DistributionSetIdName, HashSet<SoftwareModuleIdName>> getAssignedList() {
return assignedList;
}
@@ -119,7 +120,7 @@ public class ManageDistUIState implements Serializable {
}
public void setSelectedDistributions(final Set<DistributionSetIdName> slectedDistributions) {
this.selectedDistributions = slectedDistributions;
selectedDistributions = slectedDistributions;
}
/**
@@ -140,7 +141,7 @@ public class ManageDistUIState implements Serializable {
* @return the selectedBaseSwModuleId
*/
public Optional<Long> getSelectedBaseSwModuleId() {
return this.selectedBaseSwModuleId != null ? Optional.of(this.selectedBaseSwModuleId) : Optional.empty();
return selectedBaseSwModuleId != null ? Optional.of(selectedBaseSwModuleId) : Optional.empty();
}
/**
@@ -214,7 +215,7 @@ public class ManageDistUIState implements Serializable {
/**
* Get isSwModuleTableMaximized.
*
*
* @return boolean
*/
public boolean isDsTableMaximized() {
@@ -223,11 +224,11 @@ public class ManageDistUIState implements Serializable {
/***
* Set isDsModuleTableMaximized.
*
*
* @param isDsModuleTableMaximized
*/
public void setDsTableMaximized(final boolean isDsModuleTableMaximized) {
this.isDsTableMaximized = isDsModuleTableMaximized;
isDsTableMaximized = isDsModuleTableMaximized;
}
public Map<String, SoftwareModuleIdName> getAssignedSoftwareModuleDetails() {
@@ -279,7 +280,12 @@ public class ManageDistUIState implements Serializable {
this.noDataAvailableDist = noDataAvailableDist;
}
public Map<DistributionSetIdName, Map<Long, Set<SoftwareModuleIdName>>> getConsolidatedDistSoftwarewList() {
/**
* Need HashSet because the Set have to be serializable
*
* @return map
*/
public Map<DistributionSetIdName, HashMap<Long, HashSet<SoftwareModuleIdName>>> getConsolidatedDistSoftwarewList() {
return consolidatedDistSoftwarewList;
}

View File

@@ -8,6 +8,8 @@
*/
package org.eclipse.hawkbit.ui.filtermanagement;
import java.util.concurrent.Executor;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
@@ -26,6 +28,7 @@ import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
@@ -37,10 +40,12 @@ import com.vaadin.event.FieldEvents.TextChangeEvent;
import com.vaadin.event.FieldEvents.TextChangeListener;
import com.vaadin.event.LayoutEvents.LayoutClickEvent;
import com.vaadin.event.LayoutEvents.LayoutClickListener;
import com.vaadin.event.ShortcutAction.KeyCode;
import com.vaadin.server.FontAwesome;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.AbstractField;
import com.vaadin.ui.AbstractTextField.TextChangeEventMode;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
@@ -49,6 +54,7 @@ import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Link;
import com.vaadin.ui.TextField;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.themes.ValoTheme;
@@ -80,6 +86,10 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
@Autowired
private UINotification notification;
@Autowired
@Qualifier("uiExecutor")
private transient Executor executor;
private Label headerCaption;
private TextField queryTextField;
@@ -110,6 +120,8 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
private LayoutClickListener nameLayoutClickListner;
private boolean validationFailed = false;
/**
* Initialize the Campaign Status History Header.
*/
@@ -123,9 +135,6 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
eventBus.subscribe(this);
}
/**
*
*/
private void restoreOnLoad() {
if (filterManagementUIState.isEditViewDisplayed()) {
populateComponents();
@@ -145,8 +154,9 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
} else if (custFUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK) {
setUpCaptionLayout(true);
resetComponents();
} else if (custFUIEvent == CustomFilterUIEvent.UPDATE_TARGET_FILTER_SEARCH_ICON) {
UI.getCurrent().access(() -> updateStatusIconAfterTablePopulated());
}
}
private void populateComponents() {
@@ -156,7 +166,6 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
oldFilterName = filterManagementUIState.getTfQuery().get().getName();
oldFilterQuery = filterManagementUIState.getTfQuery().get().getQuery();
}
searchLayout.addComponentAsFirst(validationIcon);
showValidationSuccesIcon();
titleFilterIconsLayout.addStyleName(SPUIStyleDefinitions.TARGET_FILTER_CAPTION_LAYOUT);
headerCaption.setVisible(false);
@@ -167,18 +176,26 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
headerCaption.setVisible(true);
nameLabel.setValue("");
queryTextField.setValue("");
removeStatusIcon();
setInitialStatusIconStyle(validationIcon);
validationFailed = false;
saveButton.setEnabled(false);
titleFilterIconsLayout.removeStyleName(SPUIStyleDefinitions.TARGET_FILTER_CAPTION_LAYOUT);
}
private Label createStatusIcon() {
final Label statusIcon = new Label(FontAwesome.CHECK_CIRCLE.getHtml(), ContentMode.HTML);
statusIcon.addStyleName(SPUIStyleDefinitions.SUCCESS_ICON);
statusIcon.setSizeUndefined();
final Label statusIcon = new Label();
statusIcon.setImmediate(true);
statusIcon.setContentMode(ContentMode.HTML);
statusIcon.setSizeFull();
setInitialStatusIconStyle(statusIcon);
return statusIcon;
}
private void setInitialStatusIconStyle(final Label statusIcon) {
statusIcon.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
statusIcon.setStyleName("hide-status-label");
}
private void createComponents() {
headerCaption = SPUIComponentProvider.getLabel(SPUILabelDefinitions.VAR_CREATE_FILTER,
SPUILabelDefinitions.SP_WIDGET_CAPTION);
@@ -200,9 +217,6 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
closeIcon = createSearchResetIcon();
}
/**
* @return
*/
private TextField createNameTextField() {
final TextField nameField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, false, null,
i18n.get("textfield.customfiltername"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
@@ -238,10 +252,6 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
};
}
/**
* @param event
* @return
*/
private void onFiterNameChange(final TextChangeEvent event) {
if (isNameAndQueryEmpty(event.getText(), queryTextField.getValue())
|| (event.getText().equals(oldFilterName) && queryTextField.getValue().equals(oldFilterQuery))) {
@@ -274,8 +284,9 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
searchLayout = new HorizontalLayout();
searchLayout.setSizeUndefined();
searchLayout.setSpacing(false);
searchLayout.addComponent(queryTextField);
searchLayout.addComponents(validationIcon, queryTextField);
searchLayout.addStyleName("custom-search-layout");
searchLayout.setComponentAlignment(validationIcon, Alignment.MIDDLE_CENTER);
final HorizontalLayout iconLayout = new HorizontalLayout();
iconLayout.setSizeUndefined();
@@ -308,25 +319,40 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
private void addSearchLisenter() {
queryTextField.addTextChangeListener(new TextChangeListener() {
private static final long serialVersionUID = -6668604418942689391L;
@Override
public void textChange(final TextChangeEvent event) {
validationIcon.addStyleName("show-status-label");
showValidationInProgress();
onQueryChange(event.getText());
eventBus.publish(this, CustomFilterUIEvent.FILTER_TARGET_BY_QUERY);
executor.execute(new StatusCircledAsync(UI.getCurrent()));
}
});
}
private void onQueryChange(final String text) {
boolean validationFailed = false;
if (!Strings.isNullOrEmpty(text)) {
final String input = text.toLowerCase();
searchLayout.addComponentAsFirst(validationIcon);
class StatusCircledAsync implements Runnable {
private final UI current;
public StatusCircledAsync(final UI current) {
this.current = current;
}
@Override
public void run() {
UI.setCurrent(current);
eventBus.publish(this, CustomFilterUIEvent.FILTER_TARGET_BY_QUERY);
}
}
private void onQueryChange(final String input) {
if (!Strings.isNullOrEmpty(input)) {
final ValidationResult validationResult = FilterQueryValidation.getExpectedTokens(input);
if (!validationResult.getIsValidationFailed()) {
showValidationSuccesIcon();
filterManagementUIState.setFilterQueryValue(input);
filterManagementUIState.setIsFilterByInvalidFilterQuery(Boolean.FALSE);
validationFailed = false;
} else {
validationFailed = true;
filterManagementUIState.setFilterQueryValue(null);
@@ -336,10 +362,11 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
}
enableDisableSaveButton(validationFailed, input);
} else {
removeStatusIcon();
setInitialStatusIconStyle(validationIcon);
filterManagementUIState.setFilterQueryValue(null);
filterManagementUIState.setIsFilterByInvalidFilterQuery(Boolean.TRUE);
}
queryTextField.setValue(input);
}
private void enableDisableSaveButton(final boolean validationFailed, final String query) {
@@ -360,16 +387,9 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
return false;
}
private void removeStatusIcon() {
if (searchLayout.getComponentIndex(validationIcon) != -1) {
searchLayout.removeComponent(validationIcon);
}
}
private void showValidationSuccesIcon() {
validationIcon.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
validationIcon.setStyleName(SPUIStyleDefinitions.SUCCESS_ICON);
validationIcon.setDescription("");
}
private void showValidationFailureIcon() {
@@ -377,6 +397,11 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
validationIcon.setStyleName(SPUIStyleDefinitions.ERROR_ICON);
}
private void showValidationInProgress() {
validationIcon.setValue(null);
validationIcon.setStyleName(SPUIStyleDefinitions.TARGET_FILTER_SEARCH_PROGRESS_INDICATOR_STYLE);
}
private SPUIButton createSearchResetIcon() {
final SPUIButton button = (SPUIButton) SPUIComponentProvider.getButton("create.custom.filter.close.Id", "", "",
null, false, FontAwesome.TIMES, SPUIButtonStyleSmallNoBorder.class);
@@ -392,6 +417,8 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
textField.setWidth(900.0F, Unit.PIXELS);
textField.setTextChangeEventMode(TextChangeEventMode.LAZY);
textField.setTextChangeTimeout(1000);
textField.addShortcutListener(new AbstractField.FocusShortcut(textField, KeyCode.ENTER));
return textField;
}
@@ -469,9 +496,6 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
}
}
/**
* @return
*/
private boolean doesAlreadyExists() {
if (targetFilterQueryManagement.findTargetFilterQueryByName(nameTextField.getValue()) != null) {
notification.displayValidationError(i18n.get("message.target.filter.duplicate", nameTextField.getValue()));
@@ -480,9 +504,6 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
return false;
}
/**
* @return
*/
private boolean manadatoryFieldsPresent() {
if (Strings.isNullOrEmpty(nameTextField.getValue())
|| Strings.isNullOrEmpty(filterManagementUIState.getFilterQueryValue())) {
@@ -492,4 +513,11 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
return true;
}
private void updateStatusIconAfterTablePopulated() {
queryTextField.focus();
if (!validationFailed && !Strings.isNullOrEmpty(queryTextField.getValue())) {
showValidationSuccesIcon();
}
}
}

View File

@@ -43,6 +43,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.themes.ValoTheme;
/**
*
@@ -72,13 +74,18 @@ public class CreateOrUpdateFilterTable extends 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);
setColumnCollapsingAllowed(true);
addCustomGeneratedColumns();
restoreOnLoad();
populateTableData();
setStyleName("sp-table");
setId(SPUIComponetIdProvider.CUSTOM_FILTER_TARGET_TABLE_ID);
setSelectable(false);
eventBus.subscribe(this);
}
@@ -89,10 +96,11 @@ public class CreateOrUpdateFilterTable extends Table {
@EventBusListenerMethod(scope = EventScope.SESSION)
void onEvent(final CustomFilterUIEvent custFUIEvent) {
if (custFUIEvent == CustomFilterUIEvent.FILTER_TARGET_BY_QUERY
|| custFUIEvent == CustomFilterUIEvent.TARGET_DETAILS_VIEW
if (custFUIEvent == CustomFilterUIEvent.TARGET_DETAILS_VIEW
|| custFUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK) {
populateTableData();
UI.getCurrent().access(() -> populateTableData());
} else if (custFUIEvent == CustomFilterUIEvent.FILTER_TARGET_BY_QUERY) {
UI.getCurrent().access(() -> onQuery());
}
}
@@ -149,9 +157,6 @@ public class CreateOrUpdateFilterTable extends Table {
setCollapsibleColumns();
}
/**
*
*/
private void setCollapsibleColumns() {
setColumnCollapsed(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, true);
setColumnCollapsed(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, true);
@@ -175,8 +180,8 @@ public class CreateOrUpdateFilterTable extends Table {
private List<TableColumn> getVisbleColumns() {
final List<TableColumn> columnList = new ArrayList<>();
columnList.add(new TableColumn(SPUILabelDefinitions.NAME, i18n.get("header.name"), 0.15F));
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_BY, i18n.get("header.createdBy"), 0.1F));
columnList.add(new TableColumn(SPUILabelDefinitions.NAME, i18n.get("header.name"), 0.15f));
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_BY, i18n.get("header.createdBy"), 0.1f));
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_DATE, i18n.get("header.createdDate"), 0.1F));
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, i18n.get("header.modifiedBy"), 0.1F));
columnList.add(
@@ -235,4 +240,8 @@ public class CreateOrUpdateFilterTable extends Table {
addGeneratedColumn(SPUILabelDefinitions.STATUS_ICON, (source, itemId, columnId) -> getStatusIcon(itemId));
}
private void onQuery() {
populateTableData();
eventBus.publish(this, CustomFilterUIEvent.UPDATE_TARGET_FILTER_SEARCH_ICON);
}
}

View File

@@ -32,7 +32,8 @@ import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
import com.google.common.base.Strings;
/**
*
* Simple implementation of generics bean query which dynamically loads
* {@link ProxyTarget} batch of beans.
*
*/
public class CustomTargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
@@ -43,7 +44,6 @@ public class CustomTargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
private FilterManagementUIState filterManagementUIState;
private transient I18N i18N;
private String filterQuery;
private Boolean isInvalidFilterQuery;
/**
* Parametric Constructor.
@@ -63,7 +63,6 @@ public class CustomTargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
if (HawkbitCommonUtil.mapCheckStrKey(queryConfig)) {
filterQuery = (String) queryConfig.get(SPUIDefinitions.FILTER_BY_QUERY);
isInvalidFilterQuery = (Boolean) queryConfig.get(SPUIDefinitions.FILTER_BY_INVALID_QUERY);
}
if (HawkbitCommonUtil.checkBolArray(sortStates)) {
// Initalize Sor
@@ -126,11 +125,14 @@ public class CustomTargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
prxyTarget.setInstalledDistributionSet(installedDistributionSet);
final DistributionSet assignedDistributionSet = target.getAssignedDistributionSet();
prxyTarget.setAssignedDistributionSet(assignedDistributionSet);
if (null != assignedDistributionSet) {
prxyTarget.setAssignedDistNameVersion(assignedDistributionSet.getName());
prxyTarget.setAssignedDistNameVersion(HawkbitCommonUtil.getFormattedNameVersion(
assignedDistributionSet.getName(), assignedDistributionSet.getVersion()));
}
if (null != installedDistributionSet) {
prxyTarget.setInstalledDistNameVersion(installedDistributionSet.getName());
prxyTarget.setInstalledDistNameVersion(HawkbitCommonUtil.getFormattedNameVersion(
installedDistributionSet.getName(), installedDistributionSet.getVersion()));
}
prxyTarget.setUpdateStatus(targ.getTargetInfo().getUpdateStatus());
prxyTarget.setLastTargetQuery(targ.getTargetInfo().getLastTargetQuery());
@@ -161,16 +163,11 @@ public class CustomTargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
*/
@Override
public int size() {
final long totSize = getTargetManagement().countTargetsAll();
long size;
long size = 0;
if (!Strings.isNullOrEmpty(filterQuery)) {
size = getTargetManagement().countTargetByTargetFilterQuery(filterQuery);
} else if (getFilterManagementUIState().isCreateFilterViewDisplayed() || isInvalidFilterQuery) {
size = 0;
} else {
size = totSize;
}
getFilterManagementUIState().setTargetsCountAll(totSize);
getFilterManagementUIState().setTargetsCountAll(size);
if (size > SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES) {
getFilterManagementUIState().setTargetsTruncated(size - SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES);
size = SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES;

View File

@@ -12,6 +12,7 @@ import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.ui.HawkbitUI;
import org.eclipse.hawkbit.ui.filtermanagement.event.CustomFilterUIEvent;
import org.eclipse.hawkbit.ui.filtermanagement.footer.TargetFilterCountMessageLabel;
import org.eclipse.hawkbit.ui.filtermanagement.state.FilterManagementUIState;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
@@ -23,6 +24,7 @@ import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.spring.annotation.SpringView;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
@@ -55,6 +57,9 @@ public class FilterManagementView extends VerticalLayout implements View {
@Autowired
private FilterManagementUIState filterManagementUIState;
@Autowired
private TargetFilterCountMessageLabel targetFilterCountMessageLabel;
@Autowired
private transient EventBus.SessionEventBus eventBus;
@@ -75,7 +80,6 @@ public class FilterManagementView extends VerticalLayout implements View {
setSizeFull();
setSpacing(false);
setMargin(false);
addStyleName("table-layout");
if (filterManagementUIState.isCreateFilterViewDisplayed()) {
viewCreateTargetFilterLayout();
} else if (filterManagementUIState.isEditViewDisplayed()) {
@@ -89,8 +93,9 @@ public class FilterManagementView extends VerticalLayout implements View {
void onEvent(final CustomFilterUIEvent custFilterUIEvent) {
if (custFilterUIEvent == CustomFilterUIEvent.TARGET_FILTER_DETAIL_VIEW) {
viewTargetFilterDetailLayout();
} else if (custFilterUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK) {
UI.getCurrent().access(() -> viewCreateTargetFilterLayout());
} else if (custFilterUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK
|| custFilterUIEvent == CustomFilterUIEvent.FILTER_TARGET_BY_QUERY) {
this.getUI().access(() -> viewCreateTargetFilterLayout());
} else if (custFilterUIEvent == CustomFilterUIEvent.EXIT_CREATE_OR_UPDATE_FILTRER_VIEW) {
UI.getCurrent().access(() -> viewListView());
}
@@ -107,18 +112,47 @@ public class FilterManagementView extends VerticalLayout implements View {
private void buildFilterDetailOrCreateView() {
removeAllComponents();
addComponents(createNewFilterHeader, createNewFilterTable);
setComponentAlignment(createNewFilterHeader, Alignment.TOP_LEFT);
setComponentAlignment(createNewFilterTable, Alignment.TOP_LEFT);
setExpandRatio(createNewFilterTable, 1.0f);
final VerticalLayout tableHeaderLayout = new VerticalLayout();
tableHeaderLayout.setSizeFull();
tableHeaderLayout.setSpacing(false);
tableHeaderLayout.setMargin(false);
tableHeaderLayout.setStyleName("table-layout");
tableHeaderLayout.addComponent(createNewFilterHeader);
tableHeaderLayout.setComponentAlignment(createNewFilterHeader, Alignment.TOP_CENTER);
tableHeaderLayout.addComponent(createNewFilterTable);
tableHeaderLayout.setComponentAlignment(createNewFilterTable, Alignment.TOP_CENTER);
tableHeaderLayout.setExpandRatio(createNewFilterTable, 1.0f);
addComponent(tableHeaderLayout);
setComponentAlignment(tableHeaderLayout, Alignment.TOP_CENTER);
setExpandRatio(tableHeaderLayout, 1.0f);
final HorizontalLayout targetsCountmessageLabelLayout = addTargetFilterMessageLabel();
addComponent(targetsCountmessageLabelLayout);
setComponentAlignment(targetsCountmessageLabelLayout, Alignment.BOTTOM_CENTER);
}
private void viewListView() {
removeAllComponents();
addComponents(targetFilterHeader, targetFilterTable);
setComponentAlignment(targetFilterHeader, Alignment.TOP_LEFT);
setComponentAlignment(targetFilterTable, Alignment.TOP_LEFT);
setExpandRatio(targetFilterTable, 1.0f);
final VerticalLayout tableHeaderLayout = new VerticalLayout();
tableHeaderLayout.setSizeFull();
tableHeaderLayout.setSpacing(false);
tableHeaderLayout.setMargin(false);
tableHeaderLayout.setStyleName("table-layout");
tableHeaderLayout.addComponent(targetFilterHeader);
tableHeaderLayout.setComponentAlignment(targetFilterHeader, Alignment.TOP_CENTER);
tableHeaderLayout.addComponent(targetFilterTable);
tableHeaderLayout.setComponentAlignment(targetFilterTable, Alignment.TOP_CENTER);
tableHeaderLayout.setExpandRatio(targetFilterTable, 1.0f);
addComponent(tableHeaderLayout);
}
private HorizontalLayout addTargetFilterMessageLabel() {
final HorizontalLayout messageLabelLayout = new HorizontalLayout();
messageLabelLayout.addComponent(targetFilterCountMessageLabel);
messageLabelLayout.addStyleName("footer-layout");
return messageLabelLayout;
}
}

View File

@@ -41,6 +41,7 @@ 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;
@@ -83,18 +84,20 @@ public class TargetFilterTable extends Table {
* Initialize the Action History Table.
*/
@PostConstruct
public void init() {
addCustomGeneratedColumns();
populateTableData();
setStyleName("sp-table");
addStyleName(ValoTheme.TABLE_NO_VERTICAL_LINES);
addStyleName(ValoTheme.TABLE_SMALL);
setColumnCollapsingAllowed(true);
setColumnProperties();
setId(SPUIComponetIdProvider.TAEGET_FILTER_TABLE_ID);
eventBus.subscribe(this);
setSizeFull();
}
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() {
@@ -103,14 +106,12 @@ public class TargetFilterTable extends Table {
@EventBusListenerMethod(scope = EventScope.SESSION)
void onEvent(final CustomFilterUIEvent filterEvent) {
UI.getCurrent().access(() -> {
if (filterEvent == CustomFilterUIEvent.FILTER_BY_CUST_FILTER_TEXT
|| filterEvent == CustomFilterUIEvent.FILTER_BY_CUST_FILTER_TEXT_REMOVE
|| filterEvent == CustomFilterUIEvent.CREATE_TARGET_FILTER_QUERY
|| filterEvent == CustomFilterUIEvent.UPDATED_TARGET_FILTER_QUERY) {
refreshContainer();
}
});
if (filterEvent == CustomFilterUIEvent.FILTER_BY_CUST_FILTER_TEXT
|| filterEvent == CustomFilterUIEvent.FILTER_BY_CUST_FILTER_TEXT_REMOVE
|| filterEvent == CustomFilterUIEvent.CREATE_TARGET_FILTER_QUERY
|| filterEvent == CustomFilterUIEvent.UPDATED_TARGET_FILTER_QUERY) {
UI.getCurrent().access(() -> refreshContainer());
}
}
/**
@@ -125,8 +126,8 @@ public class TargetFilterTable extends Table {
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,8 +136,8 @@ 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));
filterManagementUIState.getCustomFilterSearchText().ifPresent(
value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
return queryConfig;
}
@@ -205,8 +206,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();
}
});

View File

@@ -15,5 +15,5 @@ package org.eclipse.hawkbit.ui.filtermanagement.event;
*
*/
public enum CustomFilterUIEvent {
FILTER_TARGET_BY_QUERY, FILTER_BY_CUST_FILTER_TEXT, FILTER_BY_CUST_FILTER_TEXT_REMOVE, CREATE_NEW_FILTER_CLICK, EXIT_CREATE_OR_UPDATE_FILTRER_VIEW, TARGET_FILTER_DETAIL_VIEW, TARGET_DETAILS_VIEW, CREATE_TARGET_FILTER_QUERY, UPDATED_TARGET_FILTER_QUERY,
FILTER_TARGET_BY_QUERY, FILTER_BY_CUST_FILTER_TEXT, FILTER_BY_CUST_FILTER_TEXT_REMOVE, CREATE_NEW_FILTER_CLICK, EXIT_CREATE_OR_UPDATE_FILTRER_VIEW, TARGET_FILTER_DETAIL_VIEW, TARGET_DETAILS_VIEW, CREATE_TARGET_FILTER_QUERY, UPDATED_TARGET_FILTER_QUERY, UPDATE_TARGET_FILTER_SEARCH_ICON
}

View File

@@ -0,0 +1,116 @@
/**
* 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.filtermanagement.footer;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.ui.filtermanagement.event.CustomFilterUIEvent;
import org.eclipse.hawkbit.ui.filtermanagement.state.FilterManagementUIState;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.vaadin.server.FontAwesome;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;
/**
* @author Venugopal Boodidadinne(RBEI/BSJ)
*
* Count message label which display current filter details and details
* on pinning.
*/
@SpringComponent
@ViewScope
public class TargetFilterCountMessageLabel extends Label {
private static final long serialVersionUID = -7188528790042766877L;
@Autowired
private FilterManagementUIState filterManagementUIState;
@Autowired
private I18N i18n;
@Autowired
private transient EventBus.SessionEventBus eventBus;
/**
* PostConstruct method called by spring after bean has been initialized.
*/
@PostConstruct
public void postConstruct() {
applyStyle();
displayTargetFilterMessage();
eventBus.subscribe(this);
}
@PreDestroy
void destroy() {
eventBus.unsubscribe(this);
}
@EventBusListenerMethod(scope = EventScope.SESSION)
void onEvent(final CustomFilterUIEvent custFUIEvent) {
if (custFUIEvent == CustomFilterUIEvent.TARGET_DETAILS_VIEW
|| custFUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK
|| custFUIEvent == CustomFilterUIEvent.EXIT_CREATE_OR_UPDATE_FILTRER_VIEW
|| custFUIEvent == CustomFilterUIEvent.UPDATE_TARGET_FILTER_SEARCH_ICON) {
UI.getCurrent().access(() -> displayTargetFilterMessage());
}
}
private void applyStyle() {
addStyleName(SPUILabelDefinitions.SP_LABEL_MESSAGE_STYLE);
setContentMode(ContentMode.HTML);
setId(SPUIComponetIdProvider.COUNT_LABEL);
}
private void displayTargetFilterMessage() {
long totalTargets = 0;
if (filterManagementUIState.isCreateFilterViewDisplayed() || filterManagementUIState.isEditViewDisplayed()) {
if (null != filterManagementUIState.getFilterQueryValue()) {
totalTargets = filterManagementUIState.getTargetsCountAll().get();
}
final StringBuilder targetMessage = new StringBuilder(i18n.get("label.target.filtered.total"));
if (filterManagementUIState.getTargetsTruncated() != null) {
// set the icon
setIcon(FontAwesome.INFO_CIRCLE);
setDescription(i18n.get("label.target.filter.truncated", filterManagementUIState.getTargetsTruncated(),
SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES));
} else {
setIcon(null);
setDescription(null);
}
targetMessage.append(totalTargets);
targetMessage.append(HawkbitCommonUtil.SP_STRING_SPACE);
targetMessage.append(i18n.get("label.filter.shown"));
if (totalTargets > SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES) {
targetMessage.append(SPUIDefinitions.MAX_TARGET_TABLE_ENTRIES);
} else {
targetMessage.append(HawkbitCommonUtil.SP_STRING_SPACE);
targetMessage.append(totalTargets);
}
setCaption(targetMessage.toString());
}
}
}

View File

@@ -49,7 +49,7 @@ public class HawkbitLoginUI extends DefaultHawkbitUI {
private SpringViewProvider viewProvider;
@Autowired
private ApplicationContext context;
private transient ApplicationContext context;
@Override
protected void init(final VaadinRequest request) {

View File

@@ -79,10 +79,10 @@ public class ActionHistoryTable extends TreeTable implements Handler {
private I18N i18n;
@Autowired
private DeploymentManagement deploymentManagement;
private transient DeploymentManagement deploymentManagement;
@Autowired
private EventBus.SessionEventBus eventBus;
private transient EventBus.SessionEventBus eventBus;
@Autowired
private UINotification notification;
@@ -204,10 +204,10 @@ public class ActionHistoryTable extends TreeTable implements Handler {
/**
* Get Action based on status.
*
*
* @param type
* as Action.Type
*
*
* @return List of Actions
*/
private List<Object> getVisbleColumns() {
@@ -227,12 +227,12 @@ public class ActionHistoryTable extends TreeTable implements Handler {
/**
* fetch the target details using controller id, and set it globally.
*
*
* @param selectedTarget
* reference of target
*/
public void populateTableData(final Target selectedTarget) {
this.target = selectedTarget;
target = selectedTarget;
refreshContainer();
}
@@ -255,7 +255,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
/**
* Populate Container for Action.
*
*
* @param isActiveActions
* as flag
* @param reversedActions
@@ -275,14 +275,14 @@ public class ActionHistoryTable extends TreeTable implements Handler {
final Item item = hierarchicalContainer.addItem(actionWithStatusCount.getActionId());
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN).setValue(
actionWithStatusCount.getActionStatus());
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN)
.setValue(actionWithStatusCount.getActionStatus());
/*
* add action id.
*/
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID).setValue(
actionWithStatusCount.getActionId().toString());
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID)
.setValue(actionWithStatusCount.getActionId().toString());
/*
* add active/inactive status to the item which will be used in
* Column generator to generate respective icon
@@ -294,28 +294,27 @@ public class ActionHistoryTable extends TreeTable implements Handler {
* add action Id to the item which will be used for fetching child
* items ( previous action status ) during expand
*/
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID_HIDDEN).setValue(
actionWithStatusCount.getActionId());
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID_HIDDEN)
.setValue(actionWithStatusCount.getActionId());
/*
* add distribution name to the item which will be displayed in the
* table. The name should not exceed certain limit.
*/
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST).setValue(
HawkbitCommonUtil.getFormattedText(actionWithStatusCount.getDsName() + ":"
+ actionWithStatusCount.getDsVersion()));
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST).setValue(HawkbitCommonUtil
.getFormattedText(actionWithStatusCount.getDsName() + ":" + actionWithStatusCount.getDsVersion()));
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_FORCED).setValue(action);
/* Default no child */
((Hierarchical) hierarchicalContainer).setChildrenAllowed(actionWithStatusCount.getActionId(), false);
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DATETIME)
.setValue(
SPDateTimeUtil.getFormattedDate((actionWithStatusCount.getActionLastModifiedAt() != null) ? actionWithStatusCount
.getActionLastModifiedAt() : actionWithStatusCount.getActionCreatedAt()));
.setValue(SPDateTimeUtil.getFormattedDate((actionWithStatusCount.getActionLastModifiedAt() != null)
? actionWithStatusCount.getActionLastModifiedAt()
: actionWithStatusCount.getActionCreatedAt()));
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ROLLOUT_NAME).setValue(
actionWithStatusCount.getRolloutName());
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ROLLOUT_NAME)
.setValue(actionWithStatusCount.getRolloutName());
if (actionWithStatusCount.getActionStatusCount() > 0) {
((Hierarchical) hierarchicalContainer).setChildrenAllowed(actionWithStatusCount.getActionId(), true);
@@ -390,10 +389,10 @@ public class ActionHistoryTable extends TreeTable implements Handler {
}
final String distName = (String) hierarchicalContainer.getItem(itemId)
.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST).getValue();
final Label activeStatusIcon = createActiveStatusLabel(
activeValue,
final Label activeStatusIcon = createActiveStatusLabel(activeValue,
(Action.Status) hierarchicalContainer.getItem(itemId)
.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN).getValue() == Action.Status.ERROR);
.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN)
.getValue() == Action.Status.ERROR);
activeStatusIcon.setId(new StringJoiner(".").add(distName).add(itemId.toString())
.add(SPUIDefinitions.ACTION_HIS_TBL_ACTIVE).add(activeValue).toString());
return activeStatusIcon;
@@ -412,7 +411,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
/**
* Load the rows of previous status history of the selected action row and
* add it next to the selected action row.
*
*
* @param parentRowIdx
* index of the selected action row.
*/
@@ -447,14 +446,14 @@ public class ActionHistoryTable extends TreeTable implements Handler {
*/
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTIVE_HIDDEN).setValue("");
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST).setValue(
HawkbitCommonUtil.getFormattedText(action.getDistributionSet().getName() + ":"
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST)
.setValue(HawkbitCommonUtil.getFormattedText(action.getDistributionSet().getName() + ":"
+ action.getDistributionSet().getVersion()));
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DATETIME).setValue(
SPDateTimeUtil.getFormattedDate(actionStatus.getCreatedAt()));
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN).setValue(
actionStatus.getStatus());
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DATETIME)
.setValue(SPDateTimeUtil.getFormattedDate(actionStatus.getCreatedAt()));
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN)
.setValue(actionStatus.getStatus());
showOrHideMessage(childItem, actionStatus);
/* No further child items allowed for the child items */
((Hierarchical) hierarchicalContainer).setChildrenAllowed(childId, false);
@@ -469,7 +468,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
/**
* Hide the rows of previous status history of the selected action row.
*
*
* @param parentRowIdx
* index of the selected action row.
*/
@@ -487,7 +486,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
/**
* Get status icon.
*
*
* @param status
* as Status
* @return Label as UI
@@ -561,13 +560,11 @@ public class ActionHistoryTable extends TreeTable implements Handler {
if (actionWithActiveStatus.isHitAutoForceTime(currentTimeMillis)) {
autoForceLabel.setDescription("autoforced");
autoForceLabel.setStyleName(STATUS_ICON_GREEN);
autoForceLabel.setDescription("auto forced since "
+ SPDateTimeUtil.getDurationFormattedString(actionWithActiveStatus.getForcedTime(),
currentTimeMillis, i18n));
autoForceLabel.setDescription("auto forced since " + SPDateTimeUtil
.getDurationFormattedString(actionWithActiveStatus.getForcedTime(), currentTimeMillis, i18n));
} else {
autoForceLabel.setDescription("auto forcing in "
+ SPDateTimeUtil.getDurationFormattedString(currentTimeMillis,
actionWithActiveStatus.getForcedTime(), i18n));
autoForceLabel.setDescription("auto forcing in " + SPDateTimeUtil
.getDurationFormattedString(currentTimeMillis, actionWithActiveStatus.getForcedTime(), i18n));
autoForceLabel.setStyleName("statusIconPending");
autoForceLabel.setValue(FontAwesome.HISTORY.getHtml());
}
@@ -576,7 +573,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
/**
* Create Status Label.
*
*
* @param activeValue
* as String
* @return Labeal as UI
@@ -649,7 +646,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
/**
* create Message block for Actions.
*
*
* @param messages
* as List of msg
* @return Component as UI
@@ -748,7 +745,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
/**
* Show confirmation window and if ok then only, force the action.
*
*
* @param actionId
* as Id if the action needs to be forced.
*/
@@ -776,9 +773,8 @@ public class ActionHistoryTable extends TreeTable implements Handler {
private void confirmAndForceQuitAction(final Long actionId) {
/* Display the confirmation */
final ConfirmationDialog confirmDialog = new ConfirmationDialog(
i18n.get("caption.forcequit.action.confirmbox"), i18n.get("message.forcequit.action.confirm"),
i18n.get("button.ok"), i18n.get("button.cancel"), ok -> {
final ConfirmationDialog confirmDialog = new ConfirmationDialog(i18n.get("caption.forcequit.action.confirmbox"),
i18n.get("message.forcequit.action.confirm"), i18n.get("button.ok"), i18n.get("button.cancel"), ok -> {
if (ok) {
final boolean cancelResult = forceQuitActiveAction(actionId);
if (cancelResult) {
@@ -793,14 +789,14 @@ public class ActionHistoryTable extends TreeTable implements Handler {
notification.displayValidationError(i18n.get("message.forcequit.action.failed"));
}
}
}, FontAwesome.WARNING);
} , FontAwesome.WARNING);
UI.getCurrent().addWindow(confirmDialog.getWindow());
confirmDialog.getWindow().bringToFront();
}
/**
* Show confirmation window and if ok then only, cancel the action.
*
*
* @param actionId
* as Id if the action needs to be cancelled.
*/
@@ -880,8 +876,8 @@ public class ActionHistoryTable extends TreeTable implements Handler {
if (managementUIState.getDistributionTableFilters().getPinnedTargetId().isPresent()
&& null != managementUIState.getDistributionTableFilters().getPinnedTargetId().get()) {
final String alreadyPinnedControllerId = managementUIState.getDistributionTableFilters()
.getPinnedTargetId().get();
final String alreadyPinnedControllerId = managementUIState.getDistributionTableFilters().getPinnedTargetId()
.get();
// if the current target is pinned publish a pin event again
if (null != alreadyPinnedControllerId && alreadyPinnedControllerId.equals(target.getControllerId())) {
eventBus.publish(this, PinUnpinEvent.PIN_TARGET);
@@ -898,7 +894,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
/**
* Set messages false.
*
*
* @param alreadyHasMessages
* the alreadyHasMessages to set
*/

View File

@@ -54,6 +54,7 @@ import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.Component;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.TextArea;
@@ -109,7 +110,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
private String originalDistDescription;
private Boolean originalReqMigStep;
private String originalDistSetType;
private final List<Object> changedComponents = new ArrayList<Object>();
private final List<Component> changedComponents = new ArrayList<>();
private ValueChangeListener reqMigStepCheckboxListerner;
private TextChangeListener descTextAreaListener;
private TextChangeListener distNameTextFieldListener;
@@ -197,12 +198,12 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
/**
* Get the LazyQueryContainer instance for DistributionSetTypes.
*
*
* @return
*/
private LazyQueryContainer getDistSetTypeLazyQueryContainer() {
final Map<String, Object> queryConfig = new HashMap<String, Object>();
final BeanQueryFactory<DistributionSetTypeBeanQuery> dtQF = new BeanQueryFactory<DistributionSetTypeBeanQuery>(
final Map<String, Object> queryConfig = new HashMap<>();
final BeanQueryFactory<DistributionSetTypeBeanQuery> dtQF = new BeanQueryFactory<>(
DistributionSetTypeBeanQuery.class);
dtQF.setQueryConfiguration(queryConfig);
@@ -341,15 +342,6 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
distributionSet.setRequiredMigrationStep(isMigStepReq);
}
/**
* Duplicate check-Name and version for {@link DistributionSet} unique.
*
* @param name
* as String
* @param version
* as String
* @return
*/
private boolean duplicateCheck(final String name, final String version) {
final DistributionSet existingDs = distributionSetManagement.findDistributionSetByNameAndVersion(name, version);
/*
@@ -358,7 +350,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
* (or) when the "existingDs" is not null and it is edit window and the
* distribution Id of the edit window is different then the "existingDs"
*/
if (existingDs != null && (!editDistribution || editDistribution && !existingDs.getId().equals(editDistId))) {
if (existingDs != null && !existingDs.getId().equals(editDistId)) {
distNameTextField.addStyleName("v-textfield-error");
distVersionTextField.addStyleName("v-textfield-error");
notificationMessage.displayValidationError(
@@ -499,7 +491,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
/**
* populate data.
*
*
* @param editDistId
*/
public void populateValuesOfDistribution(final Long editDistId) {

View File

@@ -8,7 +8,6 @@
*/
package org.eclipse.hawkbit.ui.management.footer;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
@@ -27,7 +26,7 @@ public final class DeleteActionsLayoutHelper {
/**
* Checks if component is a target tag.
*
*
* @param source
* Component dropped
* @return true if it component is target tag
@@ -45,7 +44,7 @@ public final class DeleteActionsLayoutHelper {
/**
* Checks if component is distribution tag.
*
*
* @param source
* component dropped
* @return true if it component is distribution tag
@@ -63,29 +62,29 @@ public final class DeleteActionsLayoutHelper {
/**
* Checks if component is target table.
*
*
* @param source
* component dropped
* @return true if it component is target table
*/
public static boolean isTargetTable(final Component source) {
return HawkbitCommonUtil.bothSame(source.getId(), SPUIComponetIdProvider.TARGET_TABLE_ID);
return SPUIComponetIdProvider.TARGET_TABLE_ID.equalsIgnoreCase(source.getId());
}
/**
* Checks id component is distribution table.
*
*
* @param source
* component dropped
* @return true if it component is distribution table
*/
public static boolean isDistributionTable(final Component source) {
return HawkbitCommonUtil.bothSame(source.getId(), SPUIComponetIdProvider.DIST_TABLE_ID);
return SPUIComponetIdProvider.DIST_TABLE_ID.equalsIgnoreCase(source.getId());
}
/**
* Check if dropped component can be deleted.
*
*
* @param source
* component dropped
* @return true if component can be deleted

View File

@@ -35,17 +35,19 @@ public class ManagementUIState implements Serializable {
private static final long serialVersionUID = 7301409196969723794L;
private final transient Set<Object> expandParentActionRowId = new HashSet<>();
@Autowired
private DistributionTableFilters distributionTableFilters;
@Autowired
private TargetTableFilters targetTableFilters;
private final Map<TargetIdName, DistributionSetIdName> assignedList = new HashMap<TargetIdName, DistributionSetIdName>();
private final Map<TargetIdName, DistributionSetIdName> assignedList = new HashMap<>();
private final Set<DistributionSetIdName> deletedDistributionList = new HashSet<DistributionSetIdName>();
private final Set<DistributionSetIdName> deletedDistributionList = new HashSet<>();
private final Set<TargetIdName> deletedTargetList = new HashSet<TargetIdName>();
private final Set<TargetIdName> deletedTargetList = new HashSet<>();
private Boolean targetTagLayoutVisible = Boolean.TRUE;
@@ -79,9 +81,7 @@ public class ManagementUIState implements Serializable {
private boolean noDataAvailableDistribution = Boolean.FALSE;
private final Set<String> canceledTargetName = new HashSet<String>();
private final Set<Object> expandParentActionRowId = new HashSet<Object>();
private final Set<String> canceledTargetName = new HashSet<>();
private boolean customFilterSelected;
@@ -114,7 +114,7 @@ public class ManagementUIState implements Serializable {
* the isCustomFilterSelected to set
*/
public void setCustomFilterSelected(final boolean isCustomFilterSelected) {
this.customFilterSelected = isCustomFilterSelected;
customFilterSelected = isCustomFilterSelected;
}
public Set<Object> getExpandParentActionRowId() {
@@ -134,7 +134,7 @@ public class ManagementUIState implements Serializable {
}
public void setTargetTagLayoutVisible(final Boolean targetTagVisible) {
this.targetTagLayoutVisible = targetTagVisible;
targetTagLayoutVisible = targetTagVisible;
}
public Boolean getTargetTagLayoutVisible() {
@@ -241,16 +241,16 @@ public class ManagementUIState implements Serializable {
* increments the targets all counter.
*/
public void incrementTargetsCountAll() {
this.targetsCountAll.incrementAndGet();
targetsCountAll.incrementAndGet();
}
/**
* decrement the targets all counter.
*/
public void decrementTargetsCountAll() {
final long decrementAndGet = this.targetsCountAll.decrementAndGet();
final long decrementAndGet = targetsCountAll.decrementAndGet();
if (decrementAndGet < 0) {
this.targetsCountAll.set(0);
targetsCountAll.set(0);
}
}

View File

@@ -56,12 +56,7 @@ import com.vaadin.ui.components.colorpicker.ColorSelector;
import com.vaadin.ui.themes.ValoTheme;
/**
*
* Abstract class for create/update target tag layout.
*
*
*
*
*/
public abstract class CreateUpdateTagLayout extends CustomComponent implements ColorChangeListener, ColorSelector {
private static final long serialVersionUID = 4229177824620576456L;
@@ -78,7 +73,7 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
protected I18N i18n;
@Autowired
protected TagManagement tagManagement;
protected transient TagManagement tagManagement;
@Autowired
protected transient EventBus.SessionEventBus eventBus;
@@ -124,14 +119,14 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
/**
* Save new tag / update new tag.
*
*
* @param event
*/
protected abstract void save(final Button.ClickEvent event);
/**
* Discard the changes and close the popup.
*
*
* @param event
*/
protected abstract void discard(final Button.ClickEvent event);
@@ -202,7 +197,7 @@ public abstract class CreateUpdateTagLayout 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);
@@ -284,28 +279,7 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
*/
private void previewButtonClicked() {
if (!tagPreviewBtnClicked) {
final String selectedOption = (String) optiongroup.getValue();
if (null != selectedOption && selectedOption.equalsIgnoreCase(updateTagNw)) {
if (null != tagNameComboBox.getValue()) {
final TargetTag targetTagSelected = tagManagement
.findTargetTag(tagNameComboBox.getValue().toString());
if (null != targetTagSelected) {
selectedColor = targetTagSelected.getColour() != null
? rgbToColorConverter(targetTagSelected.getColour())
: rgbToColorConverter(DEFAULT_COLOR);
} else {
final DistributionSetTag distTag = tagManagement
.findDistributionSetTag(tagNameComboBox.getValue().toString());
selectedColor = distTag.getColour() != null ? rgbToColorConverter(distTag.getColour())
: rgbToColorConverter(DEFAULT_COLOR);
}
} else {
selectedColor = rgbToColorConverter(DEFAULT_COLOR);
}
}
setColor();
selPreview.setColor(selectedColor);
fieldLayout.addComponent(sliders);
mainLayout.addComponent(colorPickerLayout);
@@ -314,28 +288,53 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
tagPreviewBtnClicked = !tagPreviewBtnClicked;
}
private void setColor() {
final String selectedOption = (String) optiongroup.getValue();
if (selectedOption == null || !selectedOption.equalsIgnoreCase(updateTagNw)) {
return;
}
if (tagNameComboBox.getValue() == null) {
selectedColor = rgbToColorConverter(DEFAULT_COLOR);
return;
}
final TargetTag targetTagSelected = tagManagement.findTargetTag(tagNameComboBox.getValue().toString());
if (targetTagSelected == null) {
final DistributionSetTag distTag = tagManagement
.findDistributionSetTag(tagNameComboBox.getValue().toString());
selectedColor = distTag.getColour() != null ? rgbToColorConverter(distTag.getColour())
: rgbToColorConverter(DEFAULT_COLOR);
} else {
selectedColor = targetTagSelected.getColour() != null ? rgbToColorConverter(targetTagSelected.getColour())
: rgbToColorConverter(DEFAULT_COLOR);
}
}
/**
* Covert RGB code to {@Color}.
*
*
* @param value
* RGB vale
* @return Color
*/
protected Color rgbToColorConverter(final String value) {
if (value.startsWith("rgb")) {
// RGB color format rgb/rgba(255,255,255,0.1)
final String[] colors = value.substring(value.indexOf('(') + 1, value.length() - 1).split(",");
final int red = Integer.parseInt(colors[0]);
final int green = Integer.parseInt(colors[1]);
final int blue = Integer.parseInt(colors[2]);
if (colors.length > 3) {
final int alpha = (int) (Double.parseDouble(colors[3]) * 255d);
return new Color(red, green, blue, alpha);
} else {
return new Color(red, green, blue);
}
if (!value.startsWith("rgb")) {
return null;
}
// RGB color format rgb/rgba(255,255,255,0.1)
final String[] colors = value.substring(value.indexOf('(') + 1, value.length() - 1).split(",");
final int red = Integer.parseInt(colors[0]);
final int green = Integer.parseInt(colors[1]);
final int blue = Integer.parseInt(colors[2]);
if (colors.length > 3) {
final int alpha = (int) (Double.parseDouble(colors[3]) * 255d);
return new Color(red, green, blue, alpha);
} else {
return new Color(red, green, blue);
}
return null;
}
private Label getMandatoryLabel() {
@@ -369,7 +368,7 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
/**
* Listener for option group - Create tag/Update.
*
*
* @param event
* ValueChangeEvent
*/
@@ -478,7 +477,7 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
/**
* Set tag name and desc field border color based on chosen color.
*
*
* @param tagName
* @param tagDesc
* @param taregtTagColor
@@ -506,7 +505,7 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
/**
* Get target style - Dynamically as per the color picked, cannot be done
* from the static css.
*
*
* @param colorPickedPreview
*/
private void getTargetDynamicStyles(final String colorPickedPreview) {

View File

@@ -9,7 +9,6 @@
package org.eclipse.hawkbit.ui.management.targettag;
import java.io.Serializable;
import java.util.Optional;
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
@@ -27,9 +26,9 @@ import com.vaadin.ui.Button.ClickEvent;
/**
* Single button click behaviour of custom target filter buttons layout.
*
*
*
*
*
*/
@SpringComponent
@ViewScope
@@ -48,28 +47,28 @@ public class CustomTargetTagFilterButtonClick extends AbstractFilterSingleButton
/*
* (non-Javadoc)
*
*
* @see org.eclipse.hawkbit.server.ui.common.filterlayout.
* AbstractFilterButtonClickBehaviour#filterUnClicked (com.vaadin.ui.Button)
*/
@Override
protected void filterUnClicked(final Button clickedButton) {
managementUIState.getTargetTableFilters().setTargetFilterQuery(null);
eventBus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_TARGET_FILTER_QUERY);
this.managementUIState.getTargetTableFilters().setTargetFilterQuery(null);
this.eventBus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_TARGET_FILTER_QUERY);
}
/*
* (non-Javadoc)
*
*
* @see hawkbit.server.ui.layouts.SPFilterButtonClickBehaviour#filterClicked
* (com.vaadin.ui.Button )
*/
@Override
protected void filterClicked(final Button clickedButton) {
final TargetFilterQuery targetFilterQuery = targetFilterQueryManagement
final TargetFilterQuery targetFilterQuery = this.targetFilterQueryManagement
.findTargetFilterQueryById((Long) clickedButton.getData());
managementUIState.getTargetTableFilters().setTargetFilterQuery(targetFilterQuery);
eventBus.publish(this, TargetFilterEvent.FILTER_BY_TARGET_FILTER_QUERY);
this.managementUIState.getTargetTableFilters().setTargetFilterQuery(targetFilterQuery);
this.eventBus.publish(this, TargetFilterEvent.FILTER_BY_TARGET_FILTER_QUERY);
}
protected void processButtonClick(final ClickEvent event) {
@@ -77,12 +76,12 @@ public class CustomTargetTagFilterButtonClick extends AbstractFilterSingleButton
}
protected void clearAppliedTargetFilterQuery() {
if (getAlreadyClickedButton().isPresent()) {
getAlreadyClickedButton().get().removeStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
setAlreadyClickedButton(Optional.empty());
if (getAlreadyClickedButton() != null) {
getAlreadyClickedButton().removeStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
setAlreadyClickedButton(null);
}
managementUIState.getTargetTableFilters().setTargetFilterQuery(null);
eventBus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_TARGET_FILTER_QUERY);
this.managementUIState.getTargetTableFilters().setTargetFilterQuery(null);
this.eventBus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_TARGET_FILTER_QUERY);
}
protected void setDefaultButtonClicked(final Button button) {

View File

@@ -10,6 +10,7 @@ package org.eclipse.hawkbit.ui.management.targettag;
import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
@@ -63,6 +64,9 @@ public class MultipleTargetFilter extends Accordion implements SelectedTabChange
@Autowired
private CreateUpdateTargetTagLayout createUpdateTargetTagLayout;
@Autowired
private SpPermissionChecker permChecker;
@Autowired
private ManagementUIState managementUIState;
@@ -85,10 +89,11 @@ public class MultipleTargetFilter extends Accordion implements SelectedTabChange
filterByButtons.addStyleName(SPUIStyleDefinitions.NO_TOP_BORDER);
targetFilterQueryButtonsTab.init(customTargetTagFilterButtonClick);
config = SPUIComponentProvider.getButton(SPUIComponetIdProvider.ADD_TARGET_TAG, "", "", "", true,
FontAwesome.COG, SPUIButtonStyleSmallNoBorder.class);
config.addClickListener(event -> settingsIconClicked());
if (permChecker.hasCreateTargetPermission() || permChecker.hasUpdateTargetPermission()) {
config = SPUIComponentProvider.getButton(SPUIComponetIdProvider.ADD_TARGET_TAG, "", "", "", true,
FontAwesome.COG, SPUIButtonStyleSmallNoBorder.class);
config.addClickListener(event -> settingsIconClicked());
}
addStyleName(ValoTheme.ACCORDION_BORDERLESS);
addTabs();
setSizeFull();
@@ -119,8 +124,10 @@ public class MultipleTargetFilter extends Accordion implements SelectedTabChange
simpleFilterTab = new VerticalLayout();
final VerticalLayout targetTagTableLayout = new VerticalLayout();
targetTagTableLayout.setSizeFull();
targetTagTableLayout.addComponent(config);
targetTagTableLayout.setComponentAlignment(config, Alignment.TOP_RIGHT);
if (null != config) {
targetTagTableLayout.addComponent(config);
targetTagTableLayout.setComponentAlignment(config, Alignment.TOP_RIGHT);
}
targetTagTableLayout.addComponent(filterByButtons);
targetTagTableLayout.setComponentAlignment(filterByButtons, Alignment.MIDDLE_CENTER);
targetTagTableLayout.addStyleName("target-tag-drop-hint");

View File

@@ -197,33 +197,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:
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;
}
}
}

View File

@@ -8,12 +8,14 @@
*/
package org.eclipse.hawkbit.ui.tenantconfiguration.authentication;
import java.io.Serializable;
import com.vaadin.ui.Component;
/**
* Interface to be implemented by any tenant specific configuration to show on
* the UI.
*
*
*
*
*
@@ -48,7 +50,7 @@ public interface TenantConfigurationItem extends Component {
/**
* Adds a configuration change listener to notify about configuration
* changes.
*
*
* @param listener
* the listener to be notified in case the item changes some
* configuration
@@ -58,11 +60,12 @@ public interface TenantConfigurationItem extends Component {
/**
* Configuration Change Listener to be notified about configuration changes
* in configuration item.
*
*
*
*
*/
interface TenantConfigurationChangeListener {
@FunctionalInterface
interface TenantConfigurationChangeListener extends Serializable {
/**
* called to notify about configuration has been changed.
*/

View File

@@ -20,6 +20,7 @@ import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.hawkbit.im.authentication.UserPrincipal;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
@@ -263,14 +264,13 @@ public final class HawkbitCommonUtil {
public static String concatStrings(final String delimiter, final String... texts) {
final String delim = delimiter == null ? SP_STRING_EMPTY : delimiter;
final StringBuilder conCatStrBldr = new StringBuilder();
String conCatedStr = null;
if (null != texts) {
for (final String text : texts) {
conCatStrBldr.append(delim);
conCatStrBldr.append(text);
}
}
conCatedStr = conCatStrBldr.toString();
final String conCatedStr = conCatStrBldr.toString();
return delim.length() > 0 && conCatedStr.startsWith(delim) ? conCatedStr.substring(1) : conCatedStr;
}
@@ -343,31 +343,6 @@ public final class HawkbitCommonUtil {
return labelId.toString();
}
/**
* Check if two objects are same or not.
*
* @param obj1
* as reference
* @param obj2
* as reference
* @return true if both obj1 & obj2 are null (or) if the .equals() method
* return true. false if only either one of obj1 & obj2 is null (or)
* if .equals() method return false.
*/
public static boolean bothSame(final Object obj1, final Object obj2) {
boolean result = false;
if (obj1 == null && obj2 == null) {
result = true;
} else if (obj1 == null && obj2 != null) {
result = false;
} else if (obj1 != null && obj2 == null) {
result = false;
} else {
result = obj2.equals(obj1);
}
return result;
}
/**
* Get label with software module name and description.
*
@@ -463,13 +438,16 @@ public final class HawkbitCommonUtil {
* @return String formatted text
*/
public static String getFormattedText(final String orgText) {
String formtdTxt = orgText == null ? "" : orgText;
final int txtLengthAllowed = SPUIDefinitions.NAME_DESCRIPTION_LENGTH;
if (formtdTxt.length() > txtLengthAllowed) {
formtdTxt = new StringBuilder(orgText.substring(0, txtLengthAllowed)).append("...").toString();
if (orgText == null) {
return StringUtils.EMPTY;
}
return formtdTxt;
final int txtLengthAllowed = SPUIDefinitions.NAME_DESCRIPTION_LENGTH;
if (orgText.length() > txtLengthAllowed) {
return new StringBuilder(orgText.substring(0, txtLengthAllowed)).append("...").toString();
}
return orgText;
}
/**
@@ -725,7 +703,7 @@ public final class HawkbitCommonUtil {
final UserDetailsService idManagement = SpringContextHelper.getBean(UserDetailsService.class);
try {
imReslovedUser = HawkbitCommonUtil.getFormattedName(idManagement.loadUserByUsername(uuid));
} catch (final UsernameNotFoundException e) {
} catch (final UsernameNotFoundException e) { // NOSONAR
// nope not need to handle
}
// If Null display the UID
@@ -982,12 +960,10 @@ public final class HawkbitCommonUtil {
* @return instance of {@link LazyQueryContainer}.
*/
public static LazyQueryContainer createLazyQueryContainer(
final BeanQueryFactory<? extends AbstractBeanQuery> queryFactory) {
final Map<String, Object> queryConfig = new HashMap<String, Object>();
final BeanQueryFactory<? extends AbstractBeanQuery<?>> queryFactory) {
final Map<String, Object> queryConfig = new HashMap<>();
queryFactory.setQueryConfiguration(queryConfig);
final LazyQueryContainer typeContainer = new LazyQueryContainer(
new LazyQueryDefinition(true, 20, SPUILabelDefinitions.VAR_NAME), queryFactory);
return typeContainer;
return new LazyQueryContainer(new LazyQueryDefinition(true, 20, SPUILabelDefinitions.VAR_NAME), queryFactory);
}
/**
@@ -998,12 +974,10 @@ public final class HawkbitCommonUtil {
* @return LazyQueryContainer
*/
public static LazyQueryContainer createDSLazyQueryContainer(
final BeanQueryFactory<? extends AbstractBeanQuery> queryFactory) {
final Map<String, Object> queryConfig = new HashMap<String, Object>();
final BeanQueryFactory<? extends AbstractBeanQuery<?>> queryFactory) {
final Map<String, Object> queryConfig = new HashMap<>();
queryFactory.setQueryConfiguration(queryConfig);
final LazyQueryContainer typeContainer = new LazyQueryContainer(new LazyQueryDefinition(true, 20, "tagIdName"),
queryFactory);
return typeContainer;
return new LazyQueryContainer(new LazyQueryDefinition(true, 20, "tagIdName"), queryFactory);
}
/**
@@ -1037,7 +1011,7 @@ public final class HawkbitCommonUtil {
*/
public static List<TableColumn> getTableVisibleColumns(final Boolean isMaximized, final Boolean isShowPinColumn,
final I18N i18n) {
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));

View File

@@ -706,6 +706,11 @@ public final class SPUIComponetIdProvider {
*/
public static final String BULK_UPLOAD_STATUS_BUTTON = "bulk.upload.notification.id";
/**
* Target Filter Status button id.
*/
public static final String TARGET_FILTER_STATUS_BUTTON = "target.filter.status.button.id";
/**
* Target bulk upload minimize button id.
*/

View File

@@ -244,6 +244,11 @@ public final class SPUIStyleDefinitions {
*/
public static final String BULK_UPLOAD_PROGRESS_INDICATOR_STYLE = "app-loading";
/**
* Target filter search progress indicator style.
*/
public static final String TARGET_FILTER_SEARCH_PROGRESS_INDICATOR_STYLE = "target-filter-spinner";
/**
* Constructor.
*/

View File

@@ -41,5 +41,21 @@
box-shadow:none !important;
}
.target-filter-spinner{
@include valo-spinner(
$size: $v-font-size--small,
$color: $bosch-color-light-blue
);
}
.hide-status-label {
visibility: hidden;
}
.show-status-label {
visibility: visible;
}
}

View File

@@ -123,6 +123,11 @@ label.combobox.type = Select Type
label.combobox.tag = Select Tag
label.choose.tag = Choose Tag to update
label.choose.tag.color = Choose Tag Color
label.filter = Filter:
label.target.filter.count = Total Targets:
label.target.filtered.total = Total filtered targets :
label.filter.selected = Selected:
label.filter.shown = Shown:
label.filter = Filter :
label.target.filter.count = Total Targets :
label.filter.selected = Selected :

View File

@@ -122,6 +122,11 @@ label.combobox.type = Select Type
label.combobox.tag = Select Tag
label.choose.tag = Choose Tag to update
label.choose.tag.color = Choose Tag Color
label.filter = Filter:
label.target.filter.count = Total Targets:
label.target.filtered.total = Total filtered targets :
label.filter.selected = Selected:
label.filter.shown = Shown:
label.filter = Filter :
label.target.filter.count = Total Targets :
label.filter.selected = Selected :

View File

@@ -122,6 +122,12 @@ label.combobox.type = Select Type
label.combobox.tag = Select Tag
label.choose.tag = Choose Tag to update
label.choose.tag.color = Choose Tag Color
label.filter = Filter:
label.target.filter.count = Total Targets:
label.target.filtered.total = Total filtered targets :
label.filter.selected = Selected:
label.filter.shown = Shown:
label.filter.targets = Filtered targets :
label.filter = Filter :
label.target.filter.count = Total Targets :
label.filter.selected = Selected :
@@ -453,4 +459,4 @@ message.rollouts = Rollouts
label.target.per.group = Targets per group :
message.dist.already.assigned = Distribution {0} is already assigned to target
message.error.creating.rollout = Server error. Error creating rollout. Please contact the administrator
message.error.starting.rollout = Server error. Error starting rollout. Please contact the administrator
message.error.starting.rollout = Server error. Error starting rollout. Please contact the administrator