New event strategy (#380)
* Add notfication overview for remote events Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * Refactor css for notification button Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * Remove todo Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * - Style notfication button (css) - Add i18n message keys - Add switch slider for auto refresh event Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * Insert Label in MenuItem for displaying occurred events Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * - Style notfication button (css) - Add i18n message keys - Add switch slider for auto refresh event - Insert Label in MenuItem for displaying occurred events Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * Solve merge conflicts and add menu item counter Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * CSS refactor Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Adapt JUnit test for events, because constructor is changed Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * Skip delete event Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * - Insert Id for notification menu - Enable push mechanism for target and ds tag and add notfications - Fix several typos Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * Add update ui events for tags and add different id's for menue item Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * Insert push for SoftwareModule Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Set button enablement Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * Add Software module update push event Add unit test software module push events Adapt test for software push event Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * Close window and set pop id Update the target table to set the new icon Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * - several code improvements - Correct license header Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Update vaadin version Rename the base entity and redefine constructors unread counter was not correct Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * Closebox of notificationButton is invisible: Insert height for HorizontalLayout of NotificationUnreadButton Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Add software modules to the new event types Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * Introduce animation in unreadNotificationButton Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Fix close on safari Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Add publish events direct to the tag entities. Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
committed by
Kai Zimmermann
parent
ccc23bf634
commit
2dec35915c
@@ -39,5 +39,5 @@
|
||||
<inherits name="org.vaadin.hene.flexibleoptiongroup.widgetset.FlexibleOptionGroupWidgetset" />
|
||||
|
||||
<inherits name="org.vaadin.alump.distributionbar.gwt.DistributionBarWidgetset" />
|
||||
|
||||
|
||||
</module>
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.Set;
|
||||
import javax.servlet.http.Cookie;
|
||||
|
||||
import org.eclipse.hawkbit.ui.components.HawkbitUIErrorHandler;
|
||||
import org.eclipse.hawkbit.ui.components.NotificationUnreadButton;
|
||||
import org.eclipse.hawkbit.ui.menu.DashboardEvent.PostViewChangeEvent;
|
||||
import org.eclipse.hawkbit.ui.menu.DashboardMenu;
|
||||
import org.eclipse.hawkbit.ui.menu.DashboardMenuItem;
|
||||
@@ -39,10 +40,12 @@ import com.vaadin.server.Responsive;
|
||||
import com.vaadin.server.VaadinRequest;
|
||||
import com.vaadin.server.VaadinService;
|
||||
import com.vaadin.spring.navigator.SpringViewProvider;
|
||||
import com.vaadin.ui.Alignment;
|
||||
import com.vaadin.ui.Component;
|
||||
import com.vaadin.ui.CssLayout;
|
||||
import com.vaadin.ui.CustomLayout;
|
||||
import com.vaadin.ui.HorizontalLayout;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.UI;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
@@ -76,11 +79,12 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
|
||||
@Autowired
|
||||
private DashboardMenu dashboardMenu;
|
||||
|
||||
private HorizontalLayout content;
|
||||
|
||||
@Autowired
|
||||
private ErrorView errorview;
|
||||
|
||||
@Autowired
|
||||
private NotificationUnreadButton notificationUnreadButton;
|
||||
|
||||
/**
|
||||
* Constructor taking the push strategy.
|
||||
*
|
||||
@@ -126,10 +130,25 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
|
||||
rootLayout.addComponent(dashboardMenu);
|
||||
rootLayout.addComponent(contentVerticalLayout);
|
||||
|
||||
content = new HorizontalLayout();
|
||||
final HorizontalLayout viewHeadercontent = new HorizontalLayout();
|
||||
contentVerticalLayout.addComponent(viewHeadercontent);
|
||||
viewHeadercontent.setWidth("100%");
|
||||
viewHeadercontent.setHeight("43px");
|
||||
viewHeadercontent.addStyleName("view-header-layout");
|
||||
|
||||
final Label viewHeader = new Label();
|
||||
viewHeader.setWidth("100%");
|
||||
viewHeader.setStyleName("header-content");
|
||||
viewHeadercontent.addComponent(viewHeader);
|
||||
|
||||
viewHeadercontent.addComponent(notificationUnreadButton);
|
||||
viewHeadercontent.setComponentAlignment(notificationUnreadButton, Alignment.MIDDLE_RIGHT);
|
||||
|
||||
final HorizontalLayout content = new HorizontalLayout();
|
||||
contentVerticalLayout.addComponent(content);
|
||||
content.setStyleName("view-content");
|
||||
content.setSizeFull();
|
||||
|
||||
rootLayout.setExpandRatio(contentVerticalLayout, 1.0F);
|
||||
contentVerticalLayout.setStyleName("main-content");
|
||||
contentVerticalLayout.setExpandRatio(content, 1.0F);
|
||||
@@ -157,10 +176,11 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
|
||||
final DashboardMenuItem view = dashboardMenu.getByViewName(event.getViewName());
|
||||
dashboardMenu.postViewChange(new PostViewChangeEvent(view));
|
||||
if (view == null) {
|
||||
content.setCaption(null);
|
||||
viewHeader.setCaption(null);
|
||||
return;
|
||||
}
|
||||
content.setCaption(view.getDashboardCaptionLong());
|
||||
viewHeader.setCaption(view.getDashboardCaptionLong());
|
||||
notificationUnreadButton.setCurrentView(event.getNewView());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -12,21 +12,23 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission;
|
||||
import org.eclipse.hawkbit.ui.menu.DashboardMenuItem;
|
||||
import org.eclipse.hawkbit.ui.management.AbstractDashboardMenuItemNotification;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.server.Resource;
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.UIScope;
|
||||
|
||||
/**
|
||||
* Display artifacts upload view menu item.
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
@SpringComponent
|
||||
@UIScope
|
||||
@Order(500)
|
||||
public class UploadArtifactViewMenuItem implements DashboardMenuItem {
|
||||
public class UploadArtifactViewMenuItem extends AbstractDashboardMenuItemNotification {
|
||||
|
||||
private static final long serialVersionUID = 4096851897640769726L;
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.artifacts.event;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseUIEntityEvent;
|
||||
@@ -28,6 +30,16 @@ public class SoftwareModuleEvent extends BaseUIEntityEvent<SoftwareModule> {
|
||||
|
||||
private SoftwareModuleEventType softwareModuleEventType;
|
||||
|
||||
/**
|
||||
* Creates software module event.
|
||||
*
|
||||
* @param entityEventType
|
||||
* the event type
|
||||
*/
|
||||
public SoftwareModuleEvent(final BaseEntityEventType entityEventType) {
|
||||
super(entityEventType, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates software module event.
|
||||
*
|
||||
@@ -40,6 +52,18 @@ public class SoftwareModuleEvent extends BaseUIEntityEvent<SoftwareModule> {
|
||||
super(entityEventType, softwareModule);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param eventType
|
||||
* the event type
|
||||
* @param entityIds
|
||||
* the entity ids
|
||||
*/
|
||||
public SoftwareModuleEvent(final BaseEntityEventType eventType, final Collection<Long> entityIds) {
|
||||
super(eventType, entityIds, SoftwareModule.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates software module event.
|
||||
*
|
||||
|
||||
@@ -10,6 +10,7 @@ package org.eclipse.hawkbit.ui.artifacts.smtable;
|
||||
|
||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleCreate;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||
import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
|
||||
@@ -206,13 +207,16 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
|
||||
final String description = HawkbitCommonUtil.trimAndNullIfEmpty(descTextArea.getValue());
|
||||
final String type = typeComboBox.getValue() != null ? typeComboBox.getValue().toString() : null;
|
||||
|
||||
final SoftwareModule newBaseSoftwareModule = HawkbitCommonUtil.addNewBaseSoftware(entityFactory, name, version,
|
||||
vendor, softwareManagement.findSoftwareModuleTypeByName(type), description);
|
||||
if (newBaseSoftwareModule != null) {
|
||||
/* display success message */
|
||||
final SoftwareModuleCreate softwareModule = entityFactory.softwareModule().create()
|
||||
.type(softwareManagement.findSoftwareModuleTypeByName(type)).name(name).version(version)
|
||||
.description(description).vendor(vendor);
|
||||
|
||||
final SoftwareModule newSoftwareModule = softwareManagement.createSoftwareModule(softwareModule);
|
||||
|
||||
if (newSoftwareModule != null) {
|
||||
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.ADD_ENTITY, newSoftwareModule));
|
||||
uiNotifcation.displaySuccess(i18n.get("message.save.success",
|
||||
new Object[] { newBaseSoftwareModule.getName() + ":" + newBaseSoftwareModule.getVersion() }));
|
||||
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.NEW_ENTITY, newBaseSoftwareModule));
|
||||
new Object[] { newSoftwareModule.getName() + ":" + newSoftwareModule.getVersion() }));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.dd.criteria.UploadViewClientCriterion;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||
import org.eclipse.hawkbit.ui.distributions.smtable.SwMetadataPopupLayout;
|
||||
import org.eclipse.hawkbit.ui.push.SoftwareModuleUpdatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
@@ -174,15 +175,19 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Item addEntity(final SoftwareModule baseEntity) {
|
||||
final Item item = super.addEntity(baseEntity);
|
||||
if (!artifactUploadState.getSelectedSoftwareModules().isEmpty()) {
|
||||
artifactUploadState.getSelectedSoftwareModules().stream().forEach(this::unselect);
|
||||
}
|
||||
select(baseEntity.getId());
|
||||
return item;
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
void onSoftwareModuleUpdateEvents(final SoftwareModuleUpdatedEventContainer eventContainer) {
|
||||
|
||||
final List<Long> visibleItemIds = (List<Long>) getVisibleItemIds();
|
||||
|
||||
eventContainer.getEvents().stream().filter(event -> visibleItemIds.contains(event.getEntityId()))
|
||||
.forEach(event -> updateSoftwareModuleInTable(event.getEntity()));
|
||||
|
||||
}
|
||||
|
||||
private void updateSoftwareModuleInTable(final SoftwareModule editedSm) {
|
||||
final Item item = getContainerDataSource().getItem(editedSm.getId());
|
||||
updateEntity(editedSm, item);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -258,4 +263,5 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
|
||||
/* display the window */
|
||||
UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -125,14 +125,14 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
|
||||
@Override
|
||||
public void maximizeTable() {
|
||||
artifactUploadState.setSwModuleTableMaximized(Boolean.TRUE);
|
||||
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MAXIMIZED, null));
|
||||
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MAXIMIZED));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void minimizeTable() {
|
||||
artifactUploadState.setSwModuleTableMaximized(Boolean.FALSE);
|
||||
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MINIMIZED, null));
|
||||
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MINIMIZED));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||
/**
|
||||
* Software module table layout. (Upload Management)
|
||||
*/
|
||||
public class SoftwareModuleTableLayout extends AbstractTableLayout {
|
||||
public class SoftwareModuleTableLayout extends AbstractTableLayout<SoftwareModuleTable> {
|
||||
|
||||
private static final long serialVersionUID = 6464291374980641235L;
|
||||
|
||||
|
||||
@@ -123,10 +123,10 @@ public abstract class AbstractFilterButtons extends Table {
|
||||
bsmBtnWrapper.addStyleName(ValoTheme.DRAG_AND_DROP_WRAPPER_NO_HORIZONTAL_DRAG_HINTS);
|
||||
bsmBtnWrapper.addStyleName(SPUIStyleDefinitions.FILTER_BUTTON_WRAPPER);
|
||||
if (getButtonWrapperData() != null) {
|
||||
if (id != null) {
|
||||
bsmBtnWrapper.setData(getButtonWrapperData().concat(id.toString()));
|
||||
} else {
|
||||
if (id == null) {
|
||||
bsmBtnWrapper.setData(getButtonWrapperData());
|
||||
} else {
|
||||
bsmBtnWrapper.setData(getButtonWrapperData().concat("" + id));
|
||||
}
|
||||
}
|
||||
bsmBtnWrapper.setId(getButttonWrapperIdPrefix().concat(name));
|
||||
@@ -169,7 +169,7 @@ public abstract class AbstractFilterButtons extends Table {
|
||||
return button;
|
||||
}
|
||||
|
||||
private String prepareFilterButtonCaption(final String name, final String color) {
|
||||
private static String prepareFilterButtonCaption(final String name, final String color) {
|
||||
final StringBuilder caption = new StringBuilder();
|
||||
caption.append("<span style=\"color: ").append(color).append(" !important;\">");
|
||||
caption.append(FontAwesome.CIRCLE.getHtml());
|
||||
|
||||
@@ -51,6 +51,14 @@ public abstract class AbstractFilterLayout extends VerticalLayout {
|
||||
}
|
||||
}
|
||||
|
||||
protected AbstractFilterButtons getFilterButtons() {
|
||||
return filterButtons;
|
||||
}
|
||||
|
||||
protected AbstractFilterHeader getFilterHeader() {
|
||||
return filterHeader;
|
||||
}
|
||||
|
||||
/**
|
||||
* On load, software module type filter is cloaed.
|
||||
*
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
package org.eclipse.hawkbit.ui.common.grid;
|
||||
|
||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.components.RefreshableContainer;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||
|
||||
@@ -22,7 +24,7 @@ import com.vaadin.ui.Grid;
|
||||
* Abstract table class.
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractGrid extends Grid {
|
||||
public abstract class AbstractGrid extends Grid implements RefreshableContainer {
|
||||
|
||||
private static final long serialVersionUID = 4856562746502217630L;
|
||||
|
||||
@@ -36,7 +38,6 @@ public abstract class AbstractGrid extends Grid {
|
||||
this.i18n = i18n;
|
||||
this.eventBus = eventBus;
|
||||
this.permissionChecker = permissionChecker;
|
||||
|
||||
setSizeFull();
|
||||
setImmediate(true);
|
||||
setId(getGridId());
|
||||
@@ -46,6 +47,18 @@ public abstract class AbstractGrid extends Grid {
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the container.
|
||||
*/
|
||||
@Override
|
||||
public void refreshContainer() {
|
||||
final Container container = getContainerDataSource();
|
||||
if (!(container instanceof LazyQueryContainer)) {
|
||||
return;
|
||||
}
|
||||
((LazyQueryContainer) container).refresh();
|
||||
}
|
||||
|
||||
private void addNewContainerDS() {
|
||||
final Container container = createContainer();
|
||||
setContainerDataSource((Indexed) container);
|
||||
|
||||
@@ -19,12 +19,14 @@ import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
||||
import org.eclipse.hawkbit.ui.common.ManagmentEntityState;
|
||||
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||
import org.eclipse.hawkbit.ui.components.RefreshableContainer;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.TableColumn;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||
|
||||
@@ -50,7 +52,7 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
* @param <I>
|
||||
* i is the id of the table
|
||||
*/
|
||||
public abstract class AbstractTable<E extends NamedEntity, I> extends Table {
|
||||
public abstract class AbstractTable<E extends NamedEntity, I> extends Table implements RefreshableContainer {
|
||||
|
||||
private static final float DEFAULT_COLUMN_NAME_MIN_SIZE = 0.8F;
|
||||
|
||||
@@ -202,19 +204,6 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table {
|
||||
selectRow();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new software module to table.
|
||||
*
|
||||
* @param baseEntity
|
||||
* new software module
|
||||
*/
|
||||
protected Item addEntity(final E baseEntity) {
|
||||
final Object addItem = addItem();
|
||||
final Item item = getItem(addItem);
|
||||
updateEntity(baseEntity, item);
|
||||
return item;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void updateEntity(final E baseEntity, final Item item) {
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_NAME).setValue(baseEntity.getName());
|
||||
@@ -236,8 +225,9 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table {
|
||||
UI.getCurrent().access(this::applyMinTableSettings);
|
||||
} else if (BaseEntityEventType.MAXIMIZED == event.getEventType()) {
|
||||
UI.getCurrent().access(this::applyMaxTableSettings);
|
||||
} else if (BaseEntityEventType.NEW_ENTITY == event.getEventType()) {
|
||||
UI.getCurrent().access(() -> addEntity(event.getEntity()));
|
||||
} else if (BaseEntityEventType.ADD_ENTITY == event.getEventType()
|
||||
|| BaseEntityEventType.REMOVE_ENTITY == event.getEventType()) {
|
||||
UI.getCurrent().access(this::refreshContainer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,6 +429,18 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the container.
|
||||
*/
|
||||
@Override
|
||||
public void refreshContainer() {
|
||||
final Container container = getContainerDataSource();
|
||||
if (!(container instanceof LazyQueryContainer)) {
|
||||
return;
|
||||
}
|
||||
((LazyQueryContainer) getContainerDataSource()).refresh();
|
||||
}
|
||||
|
||||
protected abstract boolean hasDropPermission();
|
||||
|
||||
protected abstract boolean validateDragAndDropWrapper(final DragAndDropWrapper wrapperSource);
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
package org.eclipse.hawkbit.ui.common.table;
|
||||
|
||||
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractTableDetailsLayout;
|
||||
import org.eclipse.hawkbit.ui.components.RefreshableContainer;
|
||||
import org.eclipse.hawkbit.ui.utils.ShortCutModifierUtils;
|
||||
|
||||
import com.vaadin.event.Action;
|
||||
@@ -21,18 +22,22 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Parent class for table layout.
|
||||
*
|
||||
*
|
||||
* @param <T>
|
||||
* type of the concrete table
|
||||
*/
|
||||
public abstract class AbstractTableLayout extends VerticalLayout {
|
||||
public abstract class AbstractTableLayout<T extends AbstractTable<?, ?>> extends VerticalLayout {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private AbstractTableHeader tableHeader;
|
||||
|
||||
private AbstractTable<?, ?> table;
|
||||
private T table;
|
||||
|
||||
private AbstractTableDetailsLayout<?> detailsLayout;
|
||||
|
||||
protected void init(final AbstractTableHeader tableHeader, final AbstractTable<?, ?> table,
|
||||
protected void init(final AbstractTableHeader tableHeader, final T table,
|
||||
final AbstractTableDetailsLayout<?> detailsLayout) {
|
||||
this.tableHeader = tableHeader;
|
||||
this.table = table;
|
||||
@@ -106,6 +111,10 @@ public abstract class AbstractTableLayout extends VerticalLayout {
|
||||
tableHeader.setFilterButtonsIconVisible(visible);
|
||||
}
|
||||
|
||||
public RefreshableContainer getTable() {
|
||||
return table;
|
||||
}
|
||||
|
||||
private class TableShortCutHandler implements Handler {
|
||||
|
||||
private static final String SELECT_ALL_TEXT = "Select All";
|
||||
|
||||
@@ -13,5 +13,5 @@ package org.eclipse.hawkbit.ui.common.table;
|
||||
*
|
||||
*/
|
||||
public enum BaseEntityEventType {
|
||||
NEW_ENTITY, UPDATED_ENTITY, DELETE_ENTITY, SELECTED_ENTITY, MAXIMIZED, MINIMIZED;
|
||||
ADD_ENTITY, REMOVE_ENTITY, UPDATED_ENTITY, SELECTED_ENTITY, MAXIMIZED, MINIMIZED;
|
||||
}
|
||||
|
||||
@@ -8,17 +8,32 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.common.table;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.apache.commons.lang3.ClassUtils;
|
||||
import org.eclipse.hawkbit.repository.event.TenantAwareEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.RemoteIdEvent;
|
||||
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* TenantAwareEvent to represent add, update or delete.
|
||||
*
|
||||
* * @param <T> entity class
|
||||
*/
|
||||
public class BaseUIEntityEvent<T extends BaseEntity> {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(BaseUIEntityEvent.class);
|
||||
|
||||
private final BaseEntityEventType eventType;
|
||||
|
||||
private final T entity;
|
||||
private T entity;
|
||||
|
||||
private final Collection<Long> entityIds;
|
||||
|
||||
private Class<?> entityClass;
|
||||
|
||||
/**
|
||||
* Base entity event
|
||||
@@ -31,6 +46,28 @@ public class BaseUIEntityEvent<T extends BaseEntity> {
|
||||
public BaseUIEntityEvent(final BaseEntityEventType eventType, final T entity) {
|
||||
this.eventType = eventType;
|
||||
this.entity = entity;
|
||||
entityIds = new ArrayList<>();
|
||||
if (entity != null) {
|
||||
entityIds.add(entity.getId());
|
||||
this.entityClass = entity.getClass();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Base entity event
|
||||
*
|
||||
* @param eventType
|
||||
* the event type
|
||||
* @param entityIds
|
||||
* entities which will be deleted
|
||||
* @param class1
|
||||
* the entityClass
|
||||
*/
|
||||
public BaseUIEntityEvent(final BaseEntityEventType eventType, final Collection<Long> entityIds,
|
||||
final Class<? extends BaseEntity> class1) {
|
||||
this.eventType = eventType;
|
||||
this.entityIds = entityIds;
|
||||
this.entityClass = class1;
|
||||
}
|
||||
|
||||
public T getEntity() {
|
||||
@@ -41,4 +78,27 @@ public class BaseUIEntityEvent<T extends BaseEntity> {
|
||||
return eventType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the remote event is the same as this UI event. Then maybe you
|
||||
* can skip the remote event because it is already executed.
|
||||
*
|
||||
* @param tenantAwareEvent
|
||||
* the remote event
|
||||
* @return {@code true} match ; {@code false} not match
|
||||
*/
|
||||
public boolean matchRemoteEvent(final TenantAwareEvent tenantAwareEvent) {
|
||||
if (!(tenantAwareEvent instanceof RemoteIdEvent) || entityClass == null || entityIds == null) {
|
||||
return false;
|
||||
}
|
||||
final RemoteIdEvent remoteIdEvent = (RemoteIdEvent) tenantAwareEvent;
|
||||
try {
|
||||
final Class<?> remoteEntityClass = ClassUtils.getClass(remoteIdEvent.getEntityClass());
|
||||
return entityClass.isAssignableFrom(remoteEntityClass) && entityIds.contains(remoteIdEvent.getEntityId());
|
||||
} catch (final ClassNotFoundException e) {
|
||||
LOG.error("Entity Class of remoteIdEvent cannot be found", e);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
/**
|
||||
* 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.components;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.event.TenantAwareEvent;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseUIEntityEvent;
|
||||
import org.eclipse.hawkbit.ui.menu.DashboardMenuItem;
|
||||
import org.eclipse.hawkbit.ui.push.EventContainer;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.vaadin.navigator.View;
|
||||
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
|
||||
/**
|
||||
* Abstract view for all views, which show notifications.
|
||||
*/
|
||||
public abstract class AbstractNotificationView extends VerticalLayout implements View {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final transient Cache<BaseUIEntityEvent<?>, Object> skipUiEventsCache;
|
||||
|
||||
private final transient EventBus.UIEventBus eventBus;
|
||||
|
||||
private final NotificationUnreadButton notificationUnreadButton;
|
||||
|
||||
private final AtomicInteger viewUnreadNotifcations;
|
||||
|
||||
private transient Map<Class<?>, RefreshableContainer> supportedEvents;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param eventBus
|
||||
* the ui event bus
|
||||
* @param notificationUnreadButton
|
||||
* the notificationUnreadButton
|
||||
*/
|
||||
public AbstractNotificationView(final EventBus.UIEventBus eventBus,
|
||||
final NotificationUnreadButton notificationUnreadButton) {
|
||||
this.eventBus = eventBus;
|
||||
this.notificationUnreadButton = notificationUnreadButton;
|
||||
this.viewUnreadNotifcations = new AtomicInteger(0);
|
||||
skipUiEventsCache = CacheBuilder.newBuilder().expireAfterAccess(10, SECONDS).build();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
void onEventContainerEvent(final EventContainer<?> eventContainer) {
|
||||
if (!supportNotificationEventContainer(eventContainer.getClass()) || eventContainer.getEvents().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
eventContainer.getEvents().stream().filter(event -> !anyEventMatch(event)).forEach(event -> {
|
||||
notificationUnreadButton.incrementUnreadNotification(this, eventContainer);
|
||||
viewUnreadNotifcations.incrementAndGet();
|
||||
});
|
||||
getDashboardMenuItem().setNotificationUnreadValue(viewUnreadNotifcations);
|
||||
}
|
||||
|
||||
private boolean anyEventMatch(final TenantAwareEvent tenantAwareEvent) {
|
||||
return skipUiEventsCache.asMap().keySet().stream()
|
||||
.anyMatch(uiEvent -> uiEvent.matchRemoteEvent(tenantAwareEvent));
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
void onUiEvent(final BaseUIEntityEvent<?> event) {
|
||||
if (BaseEntityEventType.ADD_ENTITY != event.getEventType()
|
||||
&& BaseEntityEventType.REMOVE_ENTITY != event.getEventType()
|
||||
&& BaseEntityEventType.UPDATED_ENTITY != event.getEventType()) {
|
||||
return;
|
||||
}
|
||||
skipUiEventsCache.put(event, new Object());
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
protected void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the view by event container changes.
|
||||
*
|
||||
* @param eventContainers
|
||||
* event container which container changed
|
||||
*
|
||||
*/
|
||||
public void refreshView(final Set<Class<?>> eventContainers) {
|
||||
eventContainers.stream().filter(this::supportNotificationEventContainer).forEach(this::refreshContainer);
|
||||
clear();
|
||||
}
|
||||
|
||||
private void refreshContainer(final Class<?> containerClazz) {
|
||||
getSupportedEvents().get(containerClazz).refreshContainer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the view by event container changes.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public void refreshView() {
|
||||
if (viewUnreadNotifcations.get() <= 0) {
|
||||
return;
|
||||
}
|
||||
refreshAllContainer();
|
||||
clear();
|
||||
}
|
||||
|
||||
private void refreshAllContainer() {
|
||||
getSupportedEvents().values().stream().forEach(container -> container.refreshContainer());
|
||||
}
|
||||
|
||||
private void clear() {
|
||||
viewUnreadNotifcations.set(0);
|
||||
getDashboardMenuItem().setNotificationUnreadValue(viewUnreadNotifcations);
|
||||
}
|
||||
|
||||
private boolean supportNotificationEventContainer(final Class<?> eventContainerClass) {
|
||||
return getSupportedEvents().containsKey(eventContainerClass);
|
||||
}
|
||||
|
||||
public EventBus.UIEventBus getEventBus() {
|
||||
return eventBus;
|
||||
}
|
||||
|
||||
private Map<Class<?>, RefreshableContainer> getSupportedEvents() {
|
||||
if (supportedEvents == null) {
|
||||
supportedEvents = getSupportedPushEvents();
|
||||
}
|
||||
return supportedEvents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter(final ViewChangeEvent event) {
|
||||
// intended to override
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a map with all supported events and this related component which
|
||||
* should be refreshed after a change.
|
||||
*/
|
||||
protected abstract Map<Class<?>, RefreshableContainer> getSupportedPushEvents();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the related dashboard menu item for this view.
|
||||
*/
|
||||
protected abstract DashboardMenuItem getDashboardMenuItem();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
/**
|
||||
* 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.components;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.eclipse.hawkbit.ui.push.EventContainer;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.vaadin.navigator.View;
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.UIScope;
|
||||
import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
import com.vaadin.ui.Window;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Button which shows all notification in a popup.
|
||||
*/
|
||||
@SpringComponent
|
||||
@UIScope
|
||||
public class NotificationUnreadButton extends Button {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final String TITLE = "notification.unread.button.title";
|
||||
private static final String DESCRIPTION = "notification.unread.button.description";
|
||||
|
||||
private static final String STYLE = "notifications-unread";
|
||||
private static final String STYLE_UNREAD_COUNTER = "unread";
|
||||
private static final String STYLE_POPUP = "notifications-unread-popup";
|
||||
private static final String STYLE_NO_CLOSEBOX = "no-closebox";
|
||||
|
||||
private int unreadNotificationCounter;
|
||||
private AbstractNotificationView currentView;
|
||||
private Window notificationsWindow;
|
||||
private transient Map<Class<?>, NotificationUnreadValue> unreadNotifications;
|
||||
private transient I18N i18n;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param i18n
|
||||
* i18n
|
||||
*/
|
||||
@Autowired
|
||||
public NotificationUnreadButton(final I18N i18n) {
|
||||
this.i18n = i18n;
|
||||
this.unreadNotifications = new ConcurrentHashMap<>();
|
||||
setIcon(FontAwesome.BELL);
|
||||
setId(UIComponentIdProvider.NOTIFICATION_UNREAD_ID);
|
||||
addStyleName(SPUIStyleDefinitions.ACTION_BUTTON);
|
||||
addStyleName(ValoTheme.BUTTON_SMALL);
|
||||
addStyleName(STYLE);
|
||||
setHtmlContentAllowed(true);
|
||||
setEnabled(false);
|
||||
createNotificationWindow();
|
||||
addClickListener(this::toggleWindow);
|
||||
}
|
||||
|
||||
private void createUnreadMessagesLayout() {
|
||||
final VerticalLayout notificationsLayout = new VerticalLayout();
|
||||
notificationsLayout.setMargin(true);
|
||||
notificationsLayout.setSpacing(true);
|
||||
|
||||
final Label title = new Label(i18n.get(TITLE));
|
||||
title.addStyleName(ValoTheme.LABEL_H3);
|
||||
title.addStyleName(ValoTheme.LABEL_NO_MARGIN);
|
||||
notificationsLayout.addComponent(title);
|
||||
|
||||
unreadNotifications.values().stream().forEach(value -> createNotification(notificationsLayout, value));
|
||||
notificationsWindow.setContent(notificationsLayout);
|
||||
}
|
||||
|
||||
private void createNotificationWindow() {
|
||||
notificationsWindow = new Window();
|
||||
notificationsWindow.setWidth(300.0F, Unit.PIXELS);
|
||||
notificationsWindow.addStyleName(STYLE_POPUP);
|
||||
notificationsWindow.addStyleName(STYLE_NO_CLOSEBOX);
|
||||
notificationsWindow.setClosable(true);
|
||||
notificationsWindow.setResizable(false);
|
||||
notificationsWindow.setDraggable(false);
|
||||
notificationsWindow.setId(UIComponentIdProvider.NOTIFICATION_UNREAD_POPUP_id);
|
||||
notificationsWindow.addCloseListener(event -> refreshCaption());
|
||||
}
|
||||
|
||||
private void toggleWindow(final ClickEvent event) {
|
||||
if (notificationsWindow.isAttached()) {
|
||||
getUI().removeWindow(notificationsWindow);
|
||||
return;
|
||||
}
|
||||
createUnreadMessagesLayout();
|
||||
notificationsWindow.setPositionY(event.getClientY() - event.getRelativeY() + 40);
|
||||
getUI().addWindow(notificationsWindow);
|
||||
currentView.refreshView(unreadNotifications.keySet());
|
||||
clear();
|
||||
notificationsWindow.focus();
|
||||
}
|
||||
|
||||
private void createNotification(final VerticalLayout notificationsLayout,
|
||||
final NotificationUnreadValue notificationUnreadValue) {
|
||||
final Label contentLabel = new Label(notificationUnreadValue.getUnreadNotifications() + " "
|
||||
+ i18n.get(notificationUnreadValue.getUnreadNotificationMessageKey()));
|
||||
notificationsLayout.addComponent(contentLabel);
|
||||
}
|
||||
|
||||
public void setCurrentView(final View currentView) {
|
||||
clear();
|
||||
this.currentView = null;
|
||||
|
||||
if (!(currentView instanceof AbstractNotificationView)) {
|
||||
return;
|
||||
}
|
||||
this.currentView = (AbstractNotificationView) currentView;
|
||||
this.currentView.refreshView();
|
||||
}
|
||||
|
||||
private void clear() {
|
||||
unreadNotificationCounter = 0;
|
||||
unreadNotifications.clear();
|
||||
refreshCaption();
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment the counter.
|
||||
*
|
||||
* @param view
|
||||
* the view
|
||||
* @param newEventContainer
|
||||
* the event container
|
||||
*/
|
||||
public void incrementUnreadNotification(final AbstractNotificationView view,
|
||||
final EventContainer<?> newEventContainer) {
|
||||
if (!view.equals(currentView) || newEventContainer.getUnreadNotificationMessageKey() == null) {
|
||||
return;
|
||||
}
|
||||
NotificationUnreadValue notificationUnreadValue = unreadNotifications.get(newEventContainer.getClass());
|
||||
if (notificationUnreadValue == null) {
|
||||
notificationUnreadValue = new NotificationUnreadValue(0,
|
||||
newEventContainer.getUnreadNotificationMessageKey());
|
||||
unreadNotifications.put(newEventContainer.getClass(), notificationUnreadValue);
|
||||
}
|
||||
|
||||
notificationUnreadValue.incrementUnreadNotifications();
|
||||
unreadNotificationCounter++;
|
||||
refreshCaption();
|
||||
}
|
||||
|
||||
private void refreshCaption() {
|
||||
setCaption(null);
|
||||
setEnabled(notificationsWindow.isAttached());
|
||||
if (unreadNotificationCounter > 0) {
|
||||
setVisible(true);
|
||||
setEnabled(true);
|
||||
setCaption("<div class='" + STYLE_UNREAD_COUNTER + "'>" + unreadNotificationCounter + "</div>");
|
||||
}
|
||||
setDescription(i18n.get(DESCRIPTION, new Object[] { unreadNotificationCounter }));
|
||||
}
|
||||
|
||||
private static class NotificationUnreadValue {
|
||||
private Integer unreadNotifications;
|
||||
private final String unreadNotificationMessageKey;
|
||||
|
||||
/**
|
||||
* @param unreadNotifications
|
||||
* @param unreadNotificationMessageKey
|
||||
*/
|
||||
public NotificationUnreadValue(final Integer unreadNotifications, final String unreadNotificationMessageKey) {
|
||||
this.unreadNotifications = unreadNotifications;
|
||||
this.unreadNotificationMessageKey = unreadNotificationMessageKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment the unread notifications.
|
||||
*
|
||||
*/
|
||||
public void incrementUnreadNotifications() {
|
||||
unreadNotifications++;
|
||||
}
|
||||
|
||||
public String getUnreadNotificationMessageKey() {
|
||||
return unreadNotificationMessageKey;
|
||||
}
|
||||
|
||||
public Integer getUnreadNotifications() {
|
||||
return unreadNotifications;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* 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.components;
|
||||
|
||||
/**
|
||||
* Components which are refreshable.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface RefreshableContainer {
|
||||
|
||||
/**
|
||||
* Refresh the container.
|
||||
*/
|
||||
void refreshContainer();
|
||||
|
||||
}
|
||||
@@ -8,8 +8,9 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.distributions;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
@@ -23,6 +24,9 @@ import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.components.AbstractNotificationView;
|
||||
import org.eclipse.hawkbit.ui.components.NotificationUnreadButton;
|
||||
import org.eclipse.hawkbit.ui.components.RefreshableContainer;
|
||||
import org.eclipse.hawkbit.ui.dd.criteria.DistributionsViewClientCriterion;
|
||||
import org.eclipse.hawkbit.ui.distributions.disttype.DSTypeFilterLayout;
|
||||
import org.eclipse.hawkbit.ui.distributions.dstable.DistributionSetTableLayout;
|
||||
@@ -31,17 +35,20 @@ import org.eclipse.hawkbit.ui.distributions.smtable.SwModuleTableLayout;
|
||||
import org.eclipse.hawkbit.ui.distributions.smtype.DistSMTypeFilterLayout;
|
||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||
import org.eclipse.hawkbit.ui.menu.DashboardMenuItem;
|
||||
import org.eclipse.hawkbit.ui.push.DistributionCreatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.DistributionDeletedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.SoftwareModuleCreatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.SoftwareModuleDeletedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
import com.vaadin.navigator.View;
|
||||
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.vaadin.server.Page;
|
||||
import com.vaadin.server.Page.BrowserWindowResizeEvent;
|
||||
import com.vaadin.server.Page.BrowserWindowResizeListener;
|
||||
@@ -49,22 +56,19 @@ import com.vaadin.spring.annotation.SpringView;
|
||||
import com.vaadin.spring.annotation.UIScope;
|
||||
import com.vaadin.ui.Alignment;
|
||||
import com.vaadin.ui.GridLayout;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
|
||||
/**
|
||||
* Manage distributions and distributions type view.
|
||||
*/
|
||||
@UIScope
|
||||
@SpringView(name = DistributionsView.VIEW_NAME, ui = HawkbitUI.class)
|
||||
public class DistributionsView extends VerticalLayout implements View, BrowserWindowResizeListener {
|
||||
public class DistributionsView extends AbstractNotificationView implements BrowserWindowResizeListener {
|
||||
|
||||
public static final String VIEW_NAME = "distributions";
|
||||
private static final long serialVersionUID = 3887435076372276300L;
|
||||
|
||||
private final SpPermissionChecker permChecker;
|
||||
|
||||
private final transient EventBus.UIEventBus eventBus;
|
||||
|
||||
private final I18N i18n;
|
||||
|
||||
private final UINotification uiNotification;
|
||||
@@ -81,6 +85,8 @@ public class DistributionsView extends VerticalLayout implements View, BrowserWi
|
||||
|
||||
private final ManageDistUIState manageDistUIState;
|
||||
|
||||
private final DistributionsViewMenuItem distributionsViewMenuItem;
|
||||
|
||||
private GridLayout mainLayout;
|
||||
|
||||
@Autowired
|
||||
@@ -90,9 +96,10 @@ public class DistributionsView extends VerticalLayout implements View, BrowserWi
|
||||
final TargetManagement targetManagement, final EntityFactory entityFactory,
|
||||
final TagManagement tagManagement, final DistributionsViewClientCriterion distributionsViewClientCriterion,
|
||||
final ArtifactUploadState artifactUploadState, final SystemManagement systemManagement,
|
||||
final ArtifactManagement artifactManagement) {
|
||||
final ArtifactManagement artifactManagement, final NotificationUnreadButton notificationUnreadButton,
|
||||
final DistributionsViewMenuItem distributionsViewMenuItem) {
|
||||
super(eventBus, notificationUnreadButton);
|
||||
this.permChecker = permChecker;
|
||||
this.eventBus = eventBus;
|
||||
this.i18n = i18n;
|
||||
this.uiNotification = uiNotification;
|
||||
this.filterByDSTypeLayout = new DSTypeFilterLayout(manageDistUIState, i18n, permChecker, eventBus,
|
||||
@@ -110,6 +117,7 @@ public class DistributionsView extends VerticalLayout implements View, BrowserWi
|
||||
systemManagement, manageDistUIState, distributionsViewClientCriterion, distributionSetManagement,
|
||||
softwareManagement);
|
||||
this.manageDistUIState = manageDistUIState;
|
||||
this.distributionsViewMenuItem = distributionsViewMenuItem;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
@@ -118,14 +126,13 @@ public class DistributionsView extends VerticalLayout implements View, BrowserWi
|
||||
buildLayout();
|
||||
restoreState();
|
||||
checkNoDataAvaialble();
|
||||
eventBus.subscribe(this);
|
||||
Page.getCurrent().addBrowserWindowResizeListener(this);
|
||||
showOrHideFilterButtons(Page.getCurrent().getBrowserWindowWidth());
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
@Override
|
||||
protected DashboardMenuItem getDashboardMenuItem() {
|
||||
return distributionsViewMenuItem;
|
||||
}
|
||||
|
||||
private void restoreState() {
|
||||
@@ -251,8 +258,16 @@ public class DistributionsView extends VerticalLayout implements View, BrowserWi
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter(final ViewChangeEvent event) {
|
||||
// This view is constructed in the init() method()
|
||||
protected Map<Class<?>, RefreshableContainer> getSupportedPushEvents() {
|
||||
final Map<Class<?>, RefreshableContainer> supportedEvents = Maps.newHashMapWithExpectedSize(2);
|
||||
|
||||
supportedEvents.put(DistributionCreatedEventContainer.class, distributionTableLayout.getTable());
|
||||
supportedEvents.put(DistributionDeletedEventContainer.class, distributionTableLayout.getTable());
|
||||
|
||||
supportedEvents.put(SoftwareModuleCreatedEventContainer.class, softwareModuleTableLayout.getTable());
|
||||
supportedEvents.put(SoftwareModuleDeletedEventContainer.class, softwareModuleTableLayout.getTable());
|
||||
|
||||
return supportedEvents;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,12 +12,13 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission;
|
||||
import org.eclipse.hawkbit.ui.menu.DashboardMenuItem;
|
||||
import org.eclipse.hawkbit.ui.management.AbstractDashboardMenuItemNotification;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.server.Resource;
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.UIScope;
|
||||
|
||||
/**
|
||||
* Menu item for distributions view.
|
||||
@@ -25,9 +26,10 @@ import com.vaadin.server.Resource;
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
@SpringComponent
|
||||
@UIScope
|
||||
@Order(400)
|
||||
public class DistributionsViewMenuItem implements DashboardMenuItem {
|
||||
public class DistributionsViewMenuItem extends AbstractDashboardMenuItemNotification {
|
||||
|
||||
private static final long serialVersionUID = -4048522766974227222L;
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ import java.util.Set;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.event.remote.DistributionSetDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
@@ -38,8 +37,6 @@ import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
|
||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableFilterEvent;
|
||||
import org.eclipse.hawkbit.ui.push.DistributionCreatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.DistributionDeletedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.DistributionSetUpdatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
@@ -137,34 +134,6 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
|
||||
.forEach(event -> updateDistributionInTable(event.getEntity()));
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
void onDistributionCreatedEvents(final DistributionCreatedEventContainer eventContainer) {
|
||||
refreshDistributions();
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
void onDistributionDeletedEvents(final DistributionDeletedEventContainer eventContainer) {
|
||||
final LazyQueryContainer dsContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
final List<Object> visibleItemIds = (List<Object>) getVisibleItemIds();
|
||||
boolean shouldRefreshDs = false;
|
||||
for (final DistributionSetDeletedEvent deletedEvent : eventContainer.getEvents()) {
|
||||
final Long distributionSetId = deletedEvent.getEntityId();
|
||||
final DistributionSetIdName targetIdName = new DistributionSetIdName(distributionSetId, null, null);
|
||||
if (visibleItemIds.contains(targetIdName)) {
|
||||
dsContainer.removeItem(targetIdName);
|
||||
} else {
|
||||
shouldRefreshDs = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldRefreshDs) {
|
||||
refreshOnDelete();
|
||||
} else {
|
||||
dsContainer.commit();
|
||||
}
|
||||
reSelectItemsAfterDeletionEvent();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTableId() {
|
||||
return UIComponentIdProvider.DIST_TABLE_ID;
|
||||
@@ -487,16 +456,6 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Item addEntity(final DistributionSet baseEntity) {
|
||||
final Item item = super.addEntity(baseEntity);
|
||||
if (manageDistUIState.getSelectedDistributions().isPresent()) {
|
||||
manageDistUIState.getSelectedDistributions().get().stream().forEach(this::unselect);
|
||||
}
|
||||
select(DistributionSetIdName.generate(baseEntity));
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void updateEntity(final DistributionSet baseEntity, final Item item) {
|
||||
@@ -557,51 +516,10 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
|
||||
return name + "." + version;
|
||||
}
|
||||
|
||||
private void refreshDistributions() {
|
||||
final LazyQueryContainer dsContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
final int size = dsContainer.size();
|
||||
if (size < SPUIDefinitions.MAX_TABLE_ENTRIES) {
|
||||
refreshTablecontainer();
|
||||
}
|
||||
if (size != 0) {
|
||||
setData(SPUIDefinitions.DATA_AVAILABLE);
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshTablecontainer() {
|
||||
final LazyQueryContainer dsContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
dsContainer.refresh();
|
||||
selectRow();
|
||||
}
|
||||
|
||||
private void updateDistributionInTable(final DistributionSet editedDs) {
|
||||
final Item item = getContainerDataSource()
|
||||
.getItem(new DistributionSetIdName(editedDs.getId(), editedDs.getName(), editedDs.getVersion()));
|
||||
updateEntity(editedDs, item);
|
||||
}
|
||||
|
||||
private void refreshOnDelete() {
|
||||
final LazyQueryContainer dsContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
final int size = dsContainer.size();
|
||||
refreshTablecontainer();
|
||||
if (size != 0) {
|
||||
setData(SPUIDefinitions.DATA_AVAILABLE);
|
||||
}
|
||||
}
|
||||
|
||||
private void reSelectItemsAfterDeletionEvent() {
|
||||
Set<Object> values = new HashSet<>();
|
||||
if (isMultiSelect()) {
|
||||
values = new HashSet<>((Set<?>) getValue());
|
||||
} else {
|
||||
values.add(getValue());
|
||||
}
|
||||
setValue(null);
|
||||
|
||||
for (final Object value : values) {
|
||||
if (getVisibleItemIds().contains(value)) {
|
||||
select(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,13 +124,13 @@ public class DistributionSetTableHeader extends AbstractTableHeader {
|
||||
@Override
|
||||
public void maximizeTable() {
|
||||
manageDistUIstate.setDsTableMaximized(Boolean.TRUE);
|
||||
eventbus.publish(this, new DistributionTableEvent(BaseEntityEventType.MAXIMIZED, null));
|
||||
eventbus.publish(this, new DistributionTableEvent(BaseEntityEventType.MAXIMIZED));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void minimizeTable() {
|
||||
manageDistUIstate.setDsTableMaximized(Boolean.FALSE);
|
||||
eventbus.publish(this, new DistributionTableEvent(BaseEntityEventType.MINIMIZED, null));
|
||||
eventbus.publish(this, new DistributionTableEvent(BaseEntityEventType.MINIMIZED));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||
/**
|
||||
* DistributionSet table layout
|
||||
*/
|
||||
public class DistributionSetTableLayout extends AbstractTableLayout {
|
||||
public class DistributionSetTableLayout extends AbstractTableLayout<DistributionSetTable> {
|
||||
|
||||
private static final long serialVersionUID = 6464291374980641235L;
|
||||
|
||||
|
||||
@@ -18,9 +18,11 @@ import java.util.stream.Collectors;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleIdName;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
|
||||
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.AbstractConfirmationWindowLayout;
|
||||
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.ConfirmationTab;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||
import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
|
||||
@@ -158,6 +160,8 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
|
||||
}
|
||||
|
||||
softwareManagement.deleteSoftwareModules(swmoduleIds);
|
||||
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.REMOVE_ENTITY, swmoduleIds));
|
||||
|
||||
addToConsolitatedMsg(FontAwesome.TRASH_O.getHtml() + SPUILabelDefinitions.HTML_SPACE
|
||||
+ i18n.get("message.swModule.deleted", swmoduleIds.size()));
|
||||
manageDistUIState.getDeleteSofwareModulesList().clear();
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.Set;
|
||||
|
||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.SoftwareModuleUpdatedEvent;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.ui.artifacts.details.ArtifactDetailsLayout;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
|
||||
@@ -28,6 +29,7 @@ import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
|
||||
import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
|
||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||
import org.eclipse.hawkbit.ui.push.SoftwareModuleUpdatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
@@ -132,6 +134,31 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
|
||||
onBaseEntityEvent(event);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
void onSoftwareModuleUpdateEvents(final SoftwareModuleUpdatedEventContainer eventContainer) {
|
||||
|
||||
final List<Long> visibleItemIds = (List<Long>) getVisibleItemIds();
|
||||
|
||||
handleSelectedAndUpdatedSoftwareModules(eventContainer.getEvents());
|
||||
|
||||
eventContainer.getEvents().stream().filter(event -> visibleItemIds.contains(event.getEntityId()))
|
||||
.forEach(event -> updateSoftwareModuleInTable(event.getEntity()));
|
||||
|
||||
}
|
||||
|
||||
private void handleSelectedAndUpdatedSoftwareModules(final List<SoftwareModuleUpdatedEvent> events) {
|
||||
manageDistUIState.getSelectedBaseSwModuleId()
|
||||
.ifPresent(lastSelectedModuleId -> events.stream()
|
||||
.filter(event -> lastSelectedModuleId.equals(event.getEntityId())).findFirst()
|
||||
.ifPresent(lastEvent -> eventBus.publish(this,
|
||||
new SoftwareModuleEvent(BaseEntityEventType.SELECTED_ENTITY, lastEvent.getEntity()))));
|
||||
}
|
||||
|
||||
private void updateSoftwareModuleInTable(final SoftwareModule editedSm) {
|
||||
final Item item = getContainerDataSource().getItem(editedSm.getId());
|
||||
updateEntity(editedSm, item);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTableId() {
|
||||
return UIComponentIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE;
|
||||
@@ -339,17 +366,6 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
|
||||
return name + "." + version;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Item addEntity(final SoftwareModule baseEntity) {
|
||||
final Item item = super.addEntity(baseEntity);
|
||||
|
||||
if (!manageDistUIState.getSelectedSoftwareModules().isEmpty()) {
|
||||
manageDistUIState.getSelectedSoftwareModules().stream().forEach(this::unselect);
|
||||
}
|
||||
select(baseEntity.getId());
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void updateEntity(final SoftwareModule baseEntity, final Item item) {
|
||||
|
||||
@@ -120,14 +120,14 @@ public class SwModuleTableHeader extends AbstractTableHeader {
|
||||
@Override
|
||||
public void maximizeTable() {
|
||||
manageDistUIstate.setSwModuleTableMaximized(Boolean.TRUE);
|
||||
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MAXIMIZED, null));
|
||||
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MAXIMIZED));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void minimizeTable() {
|
||||
manageDistUIstate.setSwModuleTableMaximized(Boolean.FALSE);
|
||||
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MINIMIZED, null));
|
||||
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MINIMIZED));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||
/**
|
||||
* Implementation of software module Layout
|
||||
*/
|
||||
public class SwModuleTableLayout extends AbstractTableLayout {
|
||||
public class SwModuleTableLayout extends AbstractTableLayout<SwModuleTable> {
|
||||
|
||||
private static final long serialVersionUID = 6464291374980641235L;
|
||||
|
||||
|
||||
@@ -12,12 +12,13 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission;
|
||||
import org.eclipse.hawkbit.ui.menu.DashboardMenuItem;
|
||||
import org.eclipse.hawkbit.ui.management.AbstractDashboardMenuItemNotification;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.server.Resource;
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.UIScope;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -25,9 +26,10 @@ import com.vaadin.server.Resource;
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
@SpringComponent
|
||||
@UIScope
|
||||
@Order(300)
|
||||
public class FilterManagementViewMenuItem implements DashboardMenuItem {
|
||||
public class FilterManagementViewMenuItem extends AbstractDashboardMenuItemNotification {
|
||||
|
||||
private static final long serialVersionUID = -1272853053031512243L;
|
||||
|
||||
|
||||
@@ -24,4 +24,5 @@
|
||||
<inherits name="org.vaadin.hene.flexibleoptiongroup.widgetset.FlexibleOptionGroupWidgetset" />
|
||||
|
||||
<inherits name="org.vaadin.alump.distributionbar.gwt.DistributionBarWidgetset" />
|
||||
|
||||
</module>
|
||||
|
||||
@@ -25,7 +25,10 @@ import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.builder.TextAreaBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.builder.WindowBuilder;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.management.event.DistributionSetTagTableEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.TargetTagTableEvent;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
@@ -557,8 +560,11 @@ public abstract class AbstractCreateUpdateTagLayout<E extends NamedEntity> exten
|
||||
.colour(ColorPickerHelper.getColorPickedString(colorPickerLayout.getSelPreview()));
|
||||
if (targetObj instanceof TargetTag) {
|
||||
tagManagement.updateTargetTag(update);
|
||||
eventBus.publish(this, new TargetTagTableEvent(BaseEntityEventType.UPDATED_ENTITY, (TargetTag) targetObj));
|
||||
} else if (targetObj instanceof DistributionSetTag) {
|
||||
tagManagement.updateDistributionSetTag(update);
|
||||
eventBus.publish(this, new DistributionSetTagTableEvent(BaseEntityEventType.UPDATED_ENTITY,
|
||||
(DistributionSetTag) targetObj));
|
||||
}
|
||||
uiNotification.displaySuccess(i18n.get("message.update.success", new Object[] { targetObj.getName() }));
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* 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.management;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.eclipse.hawkbit.ui.menu.DashboardMenuItem;
|
||||
|
||||
import com.vaadin.ui.Label;
|
||||
|
||||
/**
|
||||
* Contains the menu items' Label for the notification display.
|
||||
*/
|
||||
public abstract class AbstractDashboardMenuItemNotification implements DashboardMenuItem {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final Label notificationsLabel = new Label();
|
||||
|
||||
@Override
|
||||
public void setNotificationUnreadValue(final AtomicInteger notificationUnread) {
|
||||
notificationsLabel.setValue(String.valueOf(notificationUnread.get()));
|
||||
notificationsLabel.setVisible(notificationUnread.get() > 0);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Label getNotificationUnreadLabel() {
|
||||
return notificationsLabel;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,8 +8,9 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.management;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
@@ -22,6 +23,9 @@ import org.eclipse.hawkbit.ui.HawkbitUI;
|
||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.UiProperties;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.components.AbstractNotificationView;
|
||||
import org.eclipse.hawkbit.ui.components.NotificationUnreadButton;
|
||||
import org.eclipse.hawkbit.ui.components.RefreshableContainer;
|
||||
import org.eclipse.hawkbit.ui.dd.criteria.ManagementViewClientCriterion;
|
||||
import org.eclipse.hawkbit.ui.management.actionhistory.ActionHistoryComponent;
|
||||
import org.eclipse.hawkbit.ui.management.dstable.DistributionTableLayout;
|
||||
@@ -36,17 +40,26 @@ import org.eclipse.hawkbit.ui.management.targettable.TargetTable;
|
||||
import org.eclipse.hawkbit.ui.management.targettable.TargetTableLayout;
|
||||
import org.eclipse.hawkbit.ui.management.targettag.CreateUpdateTargetTagLayoutWindow;
|
||||
import org.eclipse.hawkbit.ui.management.targettag.TargetTagFilterLayout;
|
||||
import org.eclipse.hawkbit.ui.menu.DashboardMenuItem;
|
||||
import org.eclipse.hawkbit.ui.push.DistributionCreatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.DistributionDeletedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.DistributionSetTagCreatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.DistributionSetTagDeletedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.DistributionSetTagUpdatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.TargetCreatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.TargetDeletedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.TargetTagCreatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.TargetTagDeletedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.TargetTagUpdatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
import com.vaadin.navigator.View;
|
||||
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.vaadin.server.Page;
|
||||
import com.vaadin.server.Page.BrowserWindowResizeEvent;
|
||||
import com.vaadin.server.Page.BrowserWindowResizeListener;
|
||||
@@ -55,21 +68,17 @@ import com.vaadin.spring.annotation.UIScope;
|
||||
import com.vaadin.ui.Alignment;
|
||||
import com.vaadin.ui.GridLayout;
|
||||
import com.vaadin.ui.UI;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
|
||||
/**
|
||||
* Target status and deployment management view.
|
||||
*
|
||||
* Target status and deployment management view
|
||||
*/
|
||||
@UIScope
|
||||
@SpringView(name = DeploymentView.VIEW_NAME, ui = HawkbitUI.class)
|
||||
public class DeploymentView extends VerticalLayout implements View, BrowserWindowResizeListener {
|
||||
public class DeploymentView extends AbstractNotificationView implements BrowserWindowResizeListener {
|
||||
|
||||
public static final String VIEW_NAME = "deployment";
|
||||
private static final long serialVersionUID = 1847434723456644998L;
|
||||
|
||||
private final transient EventBus.UIEventBus eventbus;
|
||||
|
||||
private final SpPermissionChecker permChecker;
|
||||
|
||||
private final I18N i18n;
|
||||
@@ -92,6 +101,8 @@ public class DeploymentView extends VerticalLayout implements View, BrowserWindo
|
||||
|
||||
private GridLayout mainLayout;
|
||||
|
||||
private final DeploymentViewMenuItem deploymentViewMenuItem;
|
||||
|
||||
@Autowired
|
||||
DeploymentView(final UIEventBus eventbus, final SpPermissionChecker permChecker, final I18N i18n,
|
||||
final UINotification uiNotification, final ManagementUIState managementUIState,
|
||||
@@ -100,8 +111,10 @@ public class DeploymentView extends VerticalLayout implements View, BrowserWindo
|
||||
final DistributionSetManagement distributionSetManagement, final TargetManagement targetManagement,
|
||||
final EntityFactory entityFactory, final UiProperties uiproperties,
|
||||
final ManagementViewClientCriterion managementViewClientCriterion, final TagManagement tagManagement,
|
||||
final TargetFilterQueryManagement targetFilterQueryManagement, final SystemManagement systemManagement) {
|
||||
this.eventbus = eventbus;
|
||||
final TargetFilterQueryManagement targetFilterQueryManagement, final SystemManagement systemManagement,
|
||||
final NotificationUnreadButton notificationUnreadButton,
|
||||
final DeploymentViewMenuItem deploymentViewMenuItem) {
|
||||
super(eventBus, notificationUnreadButton);
|
||||
this.permChecker = permChecker;
|
||||
this.i18n = i18n;
|
||||
this.uiNotification = uiNotification;
|
||||
@@ -129,6 +142,8 @@ public class DeploymentView extends VerticalLayout implements View, BrowserWindo
|
||||
this.deleteAndActionsLayout = new DeleteActionsLayout(i18n, permChecker, eventBus, uiNotification,
|
||||
tagManagement, managementViewClientCriterion, managementUIState, targetManagement, targetTable,
|
||||
deploymentManagement, distributionSetManagement);
|
||||
|
||||
this.deploymentViewMenuItem = deploymentViewMenuItem;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
@@ -136,15 +151,14 @@ public class DeploymentView extends VerticalLayout implements View, BrowserWindo
|
||||
buildLayout();
|
||||
restoreState();
|
||||
checkNoDataAvaialble();
|
||||
eventbus.subscribe(this);
|
||||
Page.getCurrent().addBrowserWindowResizeListener(this);
|
||||
showOrHideFilterButtons(Page.getCurrent().getBrowserWindowWidth());
|
||||
eventbus.publish(this, ManagementUIEvent.SHOW_COUNT_MESSAGE);
|
||||
getEventBus().publish(this, ManagementUIEvent.SHOW_COUNT_MESSAGE);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventbus.unsubscribe(this);
|
||||
@Override
|
||||
protected DashboardMenuItem getDashboardMenuItem() {
|
||||
return deploymentViewMenuItem;
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
@@ -360,8 +374,24 @@ public class DeploymentView extends VerticalLayout implements View, BrowserWindo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter(final ViewChangeEvent event) {
|
||||
// This view is constructed in the init() method()
|
||||
protected Map<Class<?>, RefreshableContainer> getSupportedPushEvents() {
|
||||
final Map<Class<?>, RefreshableContainer> supportedEvents = Maps.newHashMapWithExpectedSize(10);
|
||||
|
||||
supportedEvents.put(TargetCreatedEventContainer.class, targetTableLayout.getTable());
|
||||
supportedEvents.put(TargetDeletedEventContainer.class, targetTableLayout.getTable());
|
||||
|
||||
supportedEvents.put(DistributionCreatedEventContainer.class, distributionTableLayoutNew.getTable());
|
||||
supportedEvents.put(DistributionDeletedEventContainer.class, distributionTableLayoutNew.getTable());
|
||||
|
||||
supportedEvents.put(TargetTagCreatedEventContainer.class, targetTagFilterLayout);
|
||||
supportedEvents.put(TargetTagDeletedEventContainer.class, targetTagFilterLayout);
|
||||
supportedEvents.put(TargetTagUpdatedEventContainer.class, targetTagFilterLayout);
|
||||
|
||||
supportedEvents.put(DistributionSetTagCreatedEventContainer.class, distributionTagLayout);
|
||||
supportedEvents.put(DistributionSetTagDeletedEventContainer.class, distributionTagLayout);
|
||||
supportedEvents.put(DistributionSetTagUpdatedEventContainer.class, distributionTagLayout);
|
||||
|
||||
return supportedEvents;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,22 +12,21 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission;
|
||||
import org.eclipse.hawkbit.ui.menu.DashboardMenuItem;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.server.Resource;
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.UIScope;
|
||||
|
||||
/**
|
||||
* Menu item for deplyoment.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
@SpringComponent
|
||||
@UIScope
|
||||
@Order(100)
|
||||
public class DeploymentViewMenuItem implements DashboardMenuItem {
|
||||
public class DeploymentViewMenuItem extends AbstractDashboardMenuItemNotification {
|
||||
|
||||
private static final long serialVersionUID = 6112540239655168995L;
|
||||
|
||||
@@ -56,4 +55,5 @@ public class DeploymentViewMenuItem implements DashboardMenuItem {
|
||||
return Arrays.asList(SpPermission.CREATE_REPOSITORY, SpPermission.READ_REPOSITORY, SpPermission.CREATE_TARGET,
|
||||
SpPermission.READ_TARGET, SpPermission.UPDATE_TARGET, SpPermission.UPDATE_REPOSITORY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -220,6 +220,8 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
|
||||
.description(desc).type(distributionSetManagement.findDistributionSetTypeById(distSetTypeId))
|
||||
.requiredMigrationStep(isMigStepReq));
|
||||
|
||||
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.ADD_ENTITY, newDist));
|
||||
|
||||
notificationMessage.displaySuccess(
|
||||
i18n.get("message.new.dist.save.success", new Object[] { newDist.getName(), newDist.getVersion() }));
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import org.eclipse.hawkbit.repository.EntityFactory;
|
||||
import org.eclipse.hawkbit.repository.TagManagement;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
|
||||
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractNamedVersionedEntityTableDetailsLayout;
|
||||
import org.eclipse.hawkbit.ui.common.detailslayout.DistributionSetMetadatadetailslayout;
|
||||
import org.eclipse.hawkbit.ui.common.detailslayout.SoftwareModuleDetailsTable;
|
||||
@@ -126,7 +125,7 @@ public class DistributionDetails extends AbstractNamedVersionedEntityTableDetail
|
||||
|
||||
@Override
|
||||
protected String getTabSheetId() {
|
||||
return UIComponentIdProvider.DISTRIBUTION_DETAILS_TABSHEET;
|
||||
return UIComponentIdProvider.DISTRIBUTIONSET_DETAILS_TABSHEET_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -191,13 +190,6 @@ public class DistributionDetails extends AbstractNamedVersionedEntityTableDetail
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean isDistributionSetSelected(final DistributionSet ds) {
|
||||
final DistributionSetIdName lastselectedManageDS = managementUIState.getLastSelectedDistribution().isPresent()
|
||||
? managementUIState.getLastSelectedDistribution().get() : null;
|
||||
return ds != null && lastselectedManageDS != null && lastselectedManageDS.getName().equals(ds.getName())
|
||||
&& lastselectedManageDS.getVersion().endsWith(ds.getVersion());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void showMetadata(final ClickEvent event) {
|
||||
final DistributionSet ds = distributionSetManagement.findDistributionSetById(getSelectedBaseEntityId());
|
||||
|
||||
@@ -19,7 +19,6 @@ import java.util.stream.Collectors;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.event.remote.DistributionSetDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
|
||||
@@ -40,8 +39,6 @@ import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.PinUnpinEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.SaveActionWindowEvent;
|
||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||
import org.eclipse.hawkbit.ui.push.DistributionCreatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.DistributionDeletedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.DistributionSetUpdatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
@@ -108,43 +105,13 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
||||
setDataAvailable(getContainerDataSource().size() != 0);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
void onDistributionCreatedEvents(final DistributionCreatedEventContainer eventContainer) {
|
||||
if (eventContainer.getEvents().stream().anyMatch(event -> event.getEntity().isComplete())) {
|
||||
refreshDistributions();
|
||||
}
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
void onDistributionDeleteEvents(final DistributionDeletedEventContainer eventContainer) {
|
||||
final LazyQueryContainer dsContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
final List<Object> visibleItemIds = (List<Object>) getVisibleItemIds();
|
||||
boolean shouldRefreshDs = false;
|
||||
for (final DistributionSetDeletedEvent deletedEvent : eventContainer.getEvents()) {
|
||||
final Long distributionSetId = deletedEvent.getEntityId();
|
||||
final DistributionSetIdName targetIdName = new DistributionSetIdName(distributionSetId, null, null);
|
||||
if (visibleItemIds.contains(targetIdName)) {
|
||||
dsContainer.removeItem(targetIdName);
|
||||
} else {
|
||||
shouldRefreshDs = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldRefreshDs) {
|
||||
refreshOnDelete();
|
||||
} else {
|
||||
dsContainer.commit();
|
||||
}
|
||||
reSelectItemsAfterDeletionEvent();
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
void onDistributionSetUpdateEvents(final DistributionSetUpdatedEventContainer eventContainer) {
|
||||
|
||||
final List<DistributionSetIdName> visibleItemIds = (List<DistributionSetIdName>) getVisibleItemIds();
|
||||
|
||||
if (allOfThemAffectCompletedSetsThatAreNotVisible(eventContainer.getEvents(), visibleItemIds)) {
|
||||
refreshDistributions();
|
||||
refreshContainer();
|
||||
} else if (!checkAndHandleIfVisibleDsSwitchesFromCompleteToIncomplete(eventContainer.getEvents(),
|
||||
visibleItemIds)) {
|
||||
updateVisableTableEntries(eventContainer.getEvents(), visibleItemIds);
|
||||
@@ -186,8 +153,7 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (!setsThatAreVisibleButNotCompleteAnymore.isEmpty()) {
|
||||
refreshDistributions();
|
||||
|
||||
refreshContainer();
|
||||
if (setsThatAreVisibleButNotCompleteAnymore.stream()
|
||||
.anyMatch(set -> set.getId().equals(managementUIState.getLastSelectedDsIdName().getId()))) {
|
||||
managementUIState.setLastSelectedDistribution(null);
|
||||
@@ -755,45 +721,4 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
||||
UI.getCurrent().addWindow(dsMetadataPopupLayout.getWindow(ds, null));
|
||||
}
|
||||
|
||||
private void reSelectItemsAfterDeletionEvent() {
|
||||
Set<Object> values = new HashSet<>();
|
||||
if (isMultiSelect()) {
|
||||
values = new HashSet<>((Set<?>) getValue());
|
||||
} else {
|
||||
values.add(getValue());
|
||||
}
|
||||
setValue(null);
|
||||
|
||||
for (final Object value : values) {
|
||||
if (getVisibleItemIds().contains(value)) {
|
||||
select(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshDistributions() {
|
||||
final LazyQueryContainer dsContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
final int size = dsContainer.size();
|
||||
if (size < SPUIDefinitions.MAX_TABLE_ENTRIES) {
|
||||
refreshTablecontainer();
|
||||
}
|
||||
if (size != 0) {
|
||||
setData(SPUIDefinitions.DATA_AVAILABLE);
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshOnDelete() {
|
||||
final LazyQueryContainer dsContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
final int size = dsContainer.size();
|
||||
refreshTablecontainer();
|
||||
if (size != 0) {
|
||||
setData(SPUIDefinitions.DATA_AVAILABLE);
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshTablecontainer() {
|
||||
final LazyQueryContainer dsContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
dsContainer.refresh();
|
||||
selectRow();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,6 @@ import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
import com.vaadin.event.dd.DropHandler;
|
||||
import com.vaadin.ui.Button.ClickEvent;
|
||||
import com.vaadin.ui.UI;
|
||||
import com.vaadin.ui.Window;
|
||||
|
||||
/**
|
||||
* Distribution table header.
|
||||
@@ -33,13 +31,9 @@ import com.vaadin.ui.Window;
|
||||
public class DistributionTableHeader extends AbstractTableHeader {
|
||||
private static final long serialVersionUID = 7597766804650170127L;
|
||||
|
||||
private final DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout;
|
||||
|
||||
DistributionTableHeader(final I18N i18n, final SpPermissionChecker permChecker, final UIEventBus eventbus,
|
||||
final ManagementUIState managementUIState,
|
||||
final DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout) {
|
||||
final ManagementUIState managementUIState) {
|
||||
super(i18n, permChecker, eventbus, managementUIState, null, null);
|
||||
this.distributionAddUpdateWindowLayout = distributionAddUpdateWindowLayout;
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
@@ -126,13 +120,13 @@ public class DistributionTableHeader extends AbstractTableHeader {
|
||||
@Override
|
||||
public void maximizeTable() {
|
||||
managementUIState.setDsTableMaximized(Boolean.TRUE);
|
||||
eventbus.publish(this, new DistributionTableEvent(BaseEntityEventType.MAXIMIZED, null));
|
||||
eventbus.publish(this, new DistributionTableEvent(BaseEntityEventType.MAXIMIZED));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void minimizeTable() {
|
||||
managementUIState.setDsTableMaximized(Boolean.FALSE);
|
||||
eventbus.publish(this, new DistributionTableEvent(BaseEntityEventType.MINIMIZED, null));
|
||||
eventbus.publish(this, new DistributionTableEvent(BaseEntityEventType.MINIMIZED));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -153,10 +147,7 @@ public class DistributionTableHeader extends AbstractTableHeader {
|
||||
|
||||
@Override
|
||||
protected void addNewItem(final ClickEvent event) {
|
||||
final Window newDistWindow = distributionAddUpdateWindowLayout.getWindow(null);
|
||||
newDistWindow.setCaption(i18n.get("caption.add.new.dist"));
|
||||
UI.getCurrent().addWindow(newDistWindow);
|
||||
newDistWindow.setVisible(Boolean.TRUE);
|
||||
// is okay and not supported
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||
/**
|
||||
* Software module table layout.
|
||||
*/
|
||||
public class DistributionTableLayout extends AbstractTableLayout {
|
||||
public class DistributionTableLayout extends AbstractTableLayout<DistributionTable> {
|
||||
|
||||
private static final long serialVersionUID = 6464291374980641235L;
|
||||
|
||||
@@ -46,10 +46,7 @@ public class DistributionTableLayout extends AbstractTableLayout {
|
||||
notification, managementUIState, managementViewClientCriterion, targetService, dsMetadataPopupLayout,
|
||||
distributionSetManagement);
|
||||
|
||||
super.init(
|
||||
new DistributionTableHeader(i18n, permissionChecker, eventBus, managementUIState,
|
||||
distributionAddUpdateWindowLayout),
|
||||
distributionTable,
|
||||
super.init(new DistributionTableHeader(i18n, permissionChecker, eventBus, managementUIState), distributionTable,
|
||||
new DistributionDetails(i18n, eventBus, permissionChecker, managementUIState, distributionSetManagement,
|
||||
dsMetadataPopupLayout, entityFactory, notification, tagManagement,
|
||||
distributionAddUpdateWindowLayout));
|
||||
|
||||
@@ -18,24 +18,23 @@ import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerConstants;
|
||||
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerHelper;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.components.RefreshableContainer;
|
||||
import org.eclipse.hawkbit.ui.layouts.AbstractCreateUpdateTagLayout;
|
||||
import org.eclipse.hawkbit.ui.push.DistributionSetTagCreatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.DistributionSetTagDeletedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.DistributionSetTagUpdatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.management.event.DistributionSetTagTableEvent;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
import com.vaadin.ui.UI;
|
||||
|
||||
/**
|
||||
* Class for Create/Update Tag Layout of distribution set
|
||||
*/
|
||||
public class CreateUpdateDistributionTagLayoutWindow extends AbstractCreateUpdateTagLayout<DistributionSetTag> {
|
||||
public class CreateUpdateDistributionTagLayoutWindow extends AbstractCreateUpdateTagLayout<DistributionSetTag>
|
||||
implements RefreshableContainer {
|
||||
|
||||
private static final long serialVersionUID = 444276149954167545L;
|
||||
|
||||
@@ -48,27 +47,6 @@ public class CreateUpdateDistributionTagLayoutWindow extends AbstractCreateUpdat
|
||||
super(i18n, tagManagement, entityFactory, eventBus, permChecker, uiNotification);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
// Exception squid:S1172 - event not needed
|
||||
@SuppressWarnings({ "squid:S1172" })
|
||||
void onDistributionSetTagCreatedBulkEvent(final DistributionSetTagCreatedEventContainer eventContainer) {
|
||||
populateTagNameCombo();
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
// Exception squid:S1172 - event not needed
|
||||
@SuppressWarnings({ "squid:S1172" })
|
||||
void onDistributionSetTagDeletedEvent(final DistributionSetTagDeletedEventContainer eventContainer) {
|
||||
populateTagNameCombo();
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
// Exception squid:S1172 - event not needed
|
||||
@SuppressWarnings({ "squid:S1172" })
|
||||
void onDistributionSetTagUpdateEvent(final DistributionSetTagUpdatedEventContainer eventContainer) {
|
||||
populateTagNameCombo();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void populateTagNameCombo() {
|
||||
tagNameComboBox.removeAllItems();
|
||||
@@ -114,6 +92,7 @@ public class CreateUpdateDistributionTagLayoutWindow extends AbstractCreateUpdat
|
||||
|
||||
final DistributionSetTag newDistTag = tagManagement.createDistributionSetTag(
|
||||
entityFactory.tag().create().name(tagNameValue).description(tagDescValue).colour(colour));
|
||||
eventBus.publish(this, new DistributionSetTagTableEvent(BaseEntityEventType.ADD_ENTITY, newDistTag));
|
||||
displaySuccess(newDistTag.getName());
|
||||
resetDistTagValues();
|
||||
} else {
|
||||
@@ -184,4 +163,9 @@ public class CreateUpdateDistributionTagLayoutWindow extends AbstractCreateUpdat
|
||||
protected String getWindowCaption() {
|
||||
return i18n.get("caption.add.tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshContainer() {
|
||||
populateTagNameCombo();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,14 +15,12 @@ import org.eclipse.hawkbit.repository.EntityFactory;
|
||||
import org.eclipse.hawkbit.repository.model.Tag;
|
||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtons;
|
||||
import org.eclipse.hawkbit.ui.components.RefreshableContainer;
|
||||
import org.eclipse.hawkbit.ui.dd.criteria.ManagementViewClientCriterion;
|
||||
import org.eclipse.hawkbit.ui.management.event.DistributionTagDropEvent;
|
||||
import org.eclipse.hawkbit.ui.management.state.DistributionTableFilters;
|
||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||
import org.eclipse.hawkbit.ui.management.tag.TagIdName;
|
||||
import org.eclipse.hawkbit.ui.push.DistributionSetTagCreatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.DistributionSetTagDeletedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.DistributionSetTagUpdatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
@@ -32,8 +30,6 @@ import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
import com.vaadin.data.Item;
|
||||
import com.vaadin.event.dd.DropHandler;
|
||||
@@ -42,7 +38,7 @@ import com.vaadin.event.dd.DropHandler;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class DistributionTagButtons extends AbstractFilterButtons {
|
||||
public class DistributionTagButtons extends AbstractFilterButtons implements RefreshableContainer {
|
||||
|
||||
private static final String NO_TAG = "NO TAG";
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -65,27 +61,6 @@ public class DistributionTagButtons extends AbstractFilterButtons {
|
||||
addNewTag(entityFactory.tag().create().name(NO_TAG).build());
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
// Exception squid:S1172 - event not needed
|
||||
@SuppressWarnings({ "squid:S1172" })
|
||||
void onDistributionSetTagCreatedBulkEvent(final DistributionSetTagCreatedEventContainer eventContainer) {
|
||||
refreshTagTable();
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
// Exception squid:S1172 - event not needed
|
||||
@SuppressWarnings({ "squid:S1172" })
|
||||
void onDistributionSetTagDeletedEvent(final DistributionSetTagDeletedEventContainer eventContainer) {
|
||||
refreshTagTable();
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
// Exception squid:S1172 - event not needed
|
||||
@SuppressWarnings({ "squid:S1172" })
|
||||
void onDistributionSetTagUpdateEvent(final DistributionSetTagUpdatedEventContainer eventContainer) {
|
||||
refreshTagTable();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getButtonsTableId() {
|
||||
return UIComponentIdProvider.DISTRIBUTION_TAG_TABLE_ID;
|
||||
@@ -130,13 +105,6 @@ public class DistributionTagButtons extends AbstractFilterButtons {
|
||||
return SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS;
|
||||
}
|
||||
|
||||
private void refreshTagTable() {
|
||||
((LazyQueryContainer) getContainerDataSource()).refresh();
|
||||
removeGeneratedColumn(FILTER_BUTTON_COLUMN);
|
||||
addNewTag(entityFactory.tag().create().name(NO_TAG).build());
|
||||
addColumn();
|
||||
}
|
||||
|
||||
private void addNewTag(final Tag daTag) {
|
||||
final LazyQueryContainer targetTagContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
final Object addItem = targetTagContainer.addItem();
|
||||
@@ -148,4 +116,12 @@ public class DistributionTagButtons extends AbstractFilterButtons {
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_COLOR).setValue(daTag.getColour());
|
||||
item.getItemProperty("tagIdName").setValue(new TagIdName(daTag.getName(), daTag.getId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshContainer() {
|
||||
((LazyQueryContainer) getContainerDataSource()).refresh();
|
||||
removeGeneratedColumn(FILTER_BUTTON_COLUMN);
|
||||
addNewTag(entityFactory.tag().create().name(NO_TAG).build());
|
||||
addColumn();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.eclipse.hawkbit.repository.EntityFactory;
|
||||
import org.eclipse.hawkbit.repository.TagManagement;
|
||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader;
|
||||
import org.eclipse.hawkbit.ui.components.RefreshableContainer;
|
||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
@@ -27,7 +28,7 @@ import com.vaadin.ui.Window;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class DistributionTagHeader extends AbstractFilterHeader {
|
||||
public class DistributionTagHeader extends AbstractFilterHeader implements RefreshableContainer {
|
||||
|
||||
private static final long serialVersionUID = -1439667766337270066L;
|
||||
|
||||
@@ -90,4 +91,9 @@ public class DistributionTagHeader extends AbstractFilterHeader {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshContainer() {
|
||||
createORUpdateDistributionTagLayout.refreshContainer();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,8 +12,13 @@ import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||
import org.eclipse.hawkbit.repository.TagManagement;
|
||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtons;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterLayout;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.components.RefreshableContainer;
|
||||
import org.eclipse.hawkbit.ui.dd.criteria.ManagementViewClientCriterion;
|
||||
import org.eclipse.hawkbit.ui.management.event.DistributionSetTagTableEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||
import org.eclipse.hawkbit.ui.management.state.DistributionTableFilters;
|
||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||
@@ -27,7 +32,7 @@ import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class DistributionTagLayout extends AbstractFilterLayout {
|
||||
public class DistributionTagLayout extends AbstractFilterLayout implements RefreshableContainer {
|
||||
|
||||
private static final long serialVersionUID = 4363033587261057567L;
|
||||
|
||||
@@ -62,9 +67,32 @@ public class DistributionTagLayout extends AbstractFilterLayout {
|
||||
}
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
void onDistributionSetTagTableEvent(final DistributionSetTagTableEvent distributionSetTagTableEvent) {
|
||||
if (BaseEntityEventType.ADD_ENTITY != distributionSetTagTableEvent.getEventType()
|
||||
&& BaseEntityEventType.REMOVE_ENTITY != distributionSetTagTableEvent.getEventType()) {
|
||||
return;
|
||||
}
|
||||
refreshContainer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean onLoadIsTypeFilterIsClosed() {
|
||||
return managementUIState.isDistTagFilterClosed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshContainer() {
|
||||
final AbstractFilterButtons filterButtons = getFilterButtons();
|
||||
if (filterButtons instanceof RefreshableContainer) {
|
||||
((RefreshableContainer) filterButtons).refreshContainer();
|
||||
}
|
||||
|
||||
final AbstractFilterHeader filterHeader = getFilterHeader();
|
||||
if (filterHeader instanceof RefreshableContainer) {
|
||||
((RefreshableContainer) filterHeader).refreshContainer();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* 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.management.event;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseUIEntityEvent;
|
||||
|
||||
/**
|
||||
* Event for distribution set tag table
|
||||
*/
|
||||
public class DistributionSetTagTableEvent extends BaseUIEntityEvent<DistributionSetTag> {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param eventType
|
||||
* the event type
|
||||
* @param entity
|
||||
* the entity.
|
||||
*/
|
||||
public DistributionSetTagTableEvent(final BaseEntityEventType eventType, final DistributionSetTag entity) {
|
||||
super(eventType, entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param eventType
|
||||
* the event type
|
||||
* @param entityIds
|
||||
* the entity ids
|
||||
*/
|
||||
public DistributionSetTagTableEvent(final BaseEntityEventType eventType, final Collection<Long> entityIds) {
|
||||
super(eventType, entityIds, DistributionSetTag.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,6 +8,8 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.management.event;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseUIEntityEvent;
|
||||
@@ -18,6 +20,16 @@ import org.eclipse.hawkbit.ui.common.table.BaseUIEntityEvent;
|
||||
*/
|
||||
public class DistributionTableEvent extends BaseUIEntityEvent<DistributionSet> {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param eventType
|
||||
* the event type
|
||||
*/
|
||||
public DistributionTableEvent(final BaseEntityEventType eventType) {
|
||||
super(eventType, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@@ -30,4 +42,16 @@ public class DistributionTableEvent extends BaseUIEntityEvent<DistributionSet> {
|
||||
super(eventType, entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param eventType
|
||||
* the event type
|
||||
* @param entityIds
|
||||
* the entity ids
|
||||
*/
|
||||
public DistributionTableEvent(final BaseEntityEventType eventType, final Collection<Long> entityIds) {
|
||||
super(eventType, entityIds, DistributionSet.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,6 @@ package org.eclipse.hawkbit.ui.management.event;
|
||||
*/
|
||||
public enum SaveActionWindowEvent {
|
||||
|
||||
SAVED_ASSIGNMENTS, DISCARD_ALL_ASSIGNMENTS, DISCARD_ASSIGNMENTS, DELETED_DISTRIBUTIONS, DISCARD_ALL_DISTRIBUTIONS, SHOW_HIDE_TAB, DISCARD_ALL_TARGETS, DISCARD_ASSIGNMENT, DISCARD_DELETE_TARGET, DISCARD_DELETE_DS, DELETED_TARGETS
|
||||
SAVED_ASSIGNMENTS, DISCARD_ALL_ASSIGNMENTS, DISCARD_ASSIGNMENTS, DELETED_DISTRIBUTIONS, DISCARD_ALL_DISTRIBUTIONS, SHOW_HIDE_TAB, DISCARD_ALL_TARGETS, DISCARD_ASSIGNMENT, DISCARD_DELETE_TARGET, DISCARD_DELETE_DS
|
||||
|
||||
}
|
||||
|
||||
@@ -8,12 +8,15 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.management.event;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseUIEntityEvent;
|
||||
|
||||
/**
|
||||
* Class which contains the TenantAwareEvent when selecting all entries of the target table
|
||||
* Class which contains the TenantAwareEvent when selecting all entries of the
|
||||
* target table
|
||||
*/
|
||||
public class TargetTableEvent extends BaseUIEntityEvent<Target> {
|
||||
|
||||
@@ -28,7 +31,17 @@ public class TargetTableEvent extends BaseUIEntityEvent<Target> {
|
||||
private TargetComponentEvent targetComponentEvent;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Constrcutor.
|
||||
*
|
||||
* @param eventType
|
||||
* the event type.
|
||||
*/
|
||||
public TargetTableEvent(final BaseEntityEventType eventType) {
|
||||
super(eventType, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constrcutor .
|
||||
*
|
||||
* @param eventType
|
||||
* the event type.
|
||||
@@ -39,6 +52,18 @@ public class TargetTableEvent extends BaseUIEntityEvent<Target> {
|
||||
super(eventType, entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param eventType
|
||||
* the event type
|
||||
* @param entityIds
|
||||
* the entity ids
|
||||
*/
|
||||
public TargetTableEvent(final BaseEntityEventType eventType, final Collection<Long> entityIds) {
|
||||
super(eventType, entityIds, Target.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* The component event.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* 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.management.event;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseUIEntityEvent;
|
||||
|
||||
/**
|
||||
* Event for target tag table
|
||||
*/
|
||||
public class TargetTagTableEvent extends BaseUIEntityEvent<TargetTag> {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param eventType
|
||||
* the event typ
|
||||
* @param entity
|
||||
* the created entity.
|
||||
*/
|
||||
public TargetTagTableEvent(final BaseEntityEventType eventType, final TargetTag entity) {
|
||||
super(eventType, entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param eventType
|
||||
* the event type
|
||||
* @param entityIds
|
||||
* the entity ids
|
||||
*/
|
||||
public TargetTagTableEvent(final BaseEntityEventType eventType, final Collection<Long> entityIds) {
|
||||
super(eventType, entityIds, TargetTag.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.management.footer;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||
@@ -19,12 +20,15 @@ import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
|
||||
import org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout;
|
||||
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.dd.criteria.ManagementViewClientCriterion;
|
||||
import org.eclipse.hawkbit.ui.management.event.BulkUploadPopupEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.DistributionSetTagTableEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.SaveActionWindowEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.TargetTagTableEvent;
|
||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||
import org.eclipse.hawkbit.ui.management.targettable.TargetTable;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
@@ -39,6 +43,7 @@ import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
import com.vaadin.event.dd.DragAndDropEvent;
|
||||
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
|
||||
import com.vaadin.ui.Component;
|
||||
import com.vaadin.ui.DragAndDropWrapper;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.Table;
|
||||
import com.vaadin.ui.Table.TableTransferable;
|
||||
@@ -61,12 +66,12 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
private final ManangementConfirmationWindowLayout manangementConfirmationWindowLayout;
|
||||
|
||||
private final CountMessageLabel countMessageLabel;
|
||||
|
||||
|
||||
public DeleteActionsLayout(final I18N i18n, final SpPermissionChecker permChecker, final UIEventBus eventBus,
|
||||
final UINotification notification, final TagManagement tagManagementService,
|
||||
final ManagementViewClientCriterion managementViewClientCriterion, final ManagementUIState managementUIState,
|
||||
final TargetManagement targetManagement, final TargetTable targetTable,
|
||||
final DeploymentManagement deploymentManagement,
|
||||
final ManagementViewClientCriterion managementViewClientCriterion,
|
||||
final ManagementUIState managementUIState, final TargetManagement targetManagement,
|
||||
final TargetTable targetTable, final DeploymentManagement deploymentManagement,
|
||||
final DistributionSetManagement distributionSetManagement) {
|
||||
super(i18n, permChecker, eventBus, notification);
|
||||
this.tagManagementService = tagManagementService;
|
||||
@@ -230,6 +235,13 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
notification.displayValidationError(i18n.get("message.tag.delete", new Object[] { tagName }));
|
||||
} else {
|
||||
tagManagementService.deleteDistributionSetTag(tagName);
|
||||
|
||||
if (source instanceof DragAndDropWrapper) {
|
||||
final Long id = DeleteActionsLayoutHelper.getDistributionTagId((DragAndDropWrapper) source);
|
||||
eventBus.publish(this,
|
||||
new DistributionSetTagTableEvent(BaseEntityEventType.REMOVE_ENTITY, Arrays.asList(id)));
|
||||
}
|
||||
|
||||
notification.displaySuccess(i18n.get("message.delete.success", new Object[] { tagName }));
|
||||
}
|
||||
}
|
||||
@@ -240,6 +252,12 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
notification.displayValidationError(i18n.get("message.tag.delete", new Object[] { tagName }));
|
||||
} else {
|
||||
tagManagementService.deleteTargetTag(tagName);
|
||||
|
||||
if (source instanceof DragAndDropWrapper) {
|
||||
final Long id = DeleteActionsLayoutHelper.getTargetTagId((DragAndDropWrapper) source);
|
||||
eventBus.publish(this, new TargetTagTableEvent(BaseEntityEventType.REMOVE_ENTITY, Arrays.asList(id)));
|
||||
}
|
||||
|
||||
notification.displaySuccess(i18n.get("message.delete.success", new Object[] { tagName }));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,13 +53,37 @@ public final class DeleteActionsLayoutHelper {
|
||||
if (source instanceof DragAndDropWrapper) {
|
||||
final String wrapperData = ((DragAndDropWrapper) source).getData().toString();
|
||||
final String id = wrapperData.replace(SPUIDefinitions.DISTRIBUTION_TAG_BUTTON, "");
|
||||
if (wrapperData.contains(SPUIDefinitions.DISTRIBUTION_TAG_BUTTON) && !id.trim().isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
return wrapperData.contains(SPUIDefinitions.DISTRIBUTION_TAG_BUTTON) && !id.trim().isEmpty();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the ds tag id by the drag and drop component
|
||||
*
|
||||
* @param source
|
||||
* the source
|
||||
* @return the ds tag id
|
||||
*/
|
||||
public static Long getDistributionTagId(final DragAndDropWrapper source) {
|
||||
final String wrapperData = source.getData().toString();
|
||||
final String id = wrapperData.replace(SPUIDefinitions.DISTRIBUTION_TAG_BUTTON, "");
|
||||
return Long.valueOf(id.trim());
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the target tag id by the drag and drop component
|
||||
*
|
||||
* @param source
|
||||
* the source
|
||||
* @return the target tag id
|
||||
*/
|
||||
public static Long getTargetTagId(final DragAndDropWrapper source) {
|
||||
final String wrapperData = source.getData().toString();
|
||||
final String id = wrapperData.replace(SPUIDefinitions.TARGET_TAG_BUTTON, "");
|
||||
return Long.valueOf(id.trim());
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if component is target table.
|
||||
*
|
||||
@@ -90,10 +114,7 @@ public final class DeleteActionsLayoutHelper {
|
||||
* @return true if component can be deleted
|
||||
*/
|
||||
public static Boolean isComponentDeletable(final Component source) {
|
||||
if (isTargetTable(source) || isDistributionTable(source) || isTargetTag(source) || isDistributionTag(source)) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
return isTargetTable(source) || isDistributionTable(source) || isTargetTag(source) || isDistributionTag(source);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,8 +28,11 @@ import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
|
||||
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.AbstractConfirmationWindowLayout;
|
||||
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.ConfirmationTab;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.PinUnpinEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.SaveActionWindowEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
||||
import org.eclipse.hawkbit.ui.management.footer.ActionTypeOptionGroupLayout.ActionTypeOption;
|
||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
@@ -380,7 +383,10 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
||||
private void deleteAllDistributions(final ConfirmationTab tab) {
|
||||
final Set<Long> deletedIds = new HashSet<>();
|
||||
managementUIState.getDeletedDistributionList().forEach(distIdName -> deletedIds.add(distIdName.getId()));
|
||||
|
||||
distributionSetManagement.deleteDistributionSet(deletedIds.toArray(new Long[deletedIds.size()]));
|
||||
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.REMOVE_ENTITY, deletedIds));
|
||||
|
||||
addToConsolitatedMsg(FontAwesome.TRASH_O.getHtml() + SPUILabelDefinitions.HTML_SPACE
|
||||
+ i18n.get("message.dist.deleted", managementUIState.getDeletedDistributionList().size()));
|
||||
|
||||
@@ -472,20 +478,18 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
||||
final Set<TargetIdName> itemIds = managementUIState.getDeletedTargetList();
|
||||
final List<Long> targetIds = itemIds.stream().map(t -> t.getTargetId()).collect(Collectors.toList());
|
||||
|
||||
targetManagement.deleteTargets(targetIds.toArray(new Long[targetIds.size()]));
|
||||
targetManagement.deleteTargets(targetIds);
|
||||
|
||||
eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.REMOVE_ENTITY, targetIds));
|
||||
|
||||
addToConsolitatedMsg(FontAwesome.TRASH_O.getHtml() + SPUILabelDefinitions.HTML_SPACE
|
||||
+ i18n.get("message.target.deleted", targetIds.size()));
|
||||
removeCurrentTab(tab);
|
||||
setActionMessage(i18n.get("message.target.delete.success"));
|
||||
// TobeDone change eventing convention
|
||||
|
||||
removeDeletedTargetsFromAssignmentTab();
|
||||
|
||||
/*
|
||||
* On delete of pinned target ,unpin refresh both target table and DS
|
||||
*/
|
||||
managementUIState.getDistributionTableFilters().getPinnedTargetId().ifPresent(this::unPinDeletedTarget);
|
||||
eventBus.publish(this, SaveActionWindowEvent.DELETED_TARGETS);
|
||||
eventBus.publish(this, SaveActionWindowEvent.SHOW_HIDE_TAB);
|
||||
managementUIState.getDeletedTargetList().clear();
|
||||
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.common.tagdetails.AbstractTagToken.TagData;
|
||||
import org.eclipse.hawkbit.ui.components.HawkbitErrorNotificationMessage;
|
||||
import org.eclipse.hawkbit.ui.management.event.BulkUploadValidationMessageEvent;
|
||||
@@ -386,9 +387,11 @@ public class BulkUploadHandler extends CustomComponent
|
||||
final String newName = HawkbitCommonUtil.trimAndNullIfEmpty(name);
|
||||
final String newDesc = HawkbitCommonUtil.trimAndNullIfEmpty(descTextArea.getValue());
|
||||
|
||||
/* create new target entity */
|
||||
targetManagement.createTarget(entityFactory.target().create().controllerId(newControllerId)
|
||||
.name(newName).description(newDesc));
|
||||
final Target newTarget = targetManagement.createTarget(entityFactory.target().create()
|
||||
.controllerId(newControllerId).name(newName).description(newDesc));
|
||||
|
||||
eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.ADD_ENTITY, newTarget));
|
||||
|
||||
managementUIState.getTargetTableFilters().getBulkUpload().getTargetsCreated().add(newControllerId);
|
||||
successfullTargetCount++;
|
||||
}
|
||||
|
||||
@@ -8,13 +8,9 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.management.targettable;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||
import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
|
||||
import org.eclipse.hawkbit.ui.common.CommonDialogWindow.SaveDialogCloseListener;
|
||||
import org.eclipse.hawkbit.ui.common.builder.TextAreaBuilder;
|
||||
@@ -55,8 +51,6 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
|
||||
|
||||
private final transient EntityFactory entityFactory;
|
||||
|
||||
private final TargetTable targetTable;
|
||||
|
||||
private TextField controllerIDTextField;
|
||||
private TextField nameTextField;
|
||||
private TextArea descTextArea;
|
||||
@@ -66,13 +60,12 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
|
||||
private CommonDialogWindow window;
|
||||
|
||||
TargetAddUpdateWindowLayout(final I18N i18n, final TargetManagement targetManagement, final UIEventBus eventBus,
|
||||
final UINotification uINotification, final EntityFactory entityFactory, final TargetTable targetTable) {
|
||||
final UINotification uINotification, final EntityFactory entityFactory) {
|
||||
this.i18n = i18n;
|
||||
this.targetManagement = targetManagement;
|
||||
this.eventBus = eventBus;
|
||||
this.uINotification = uINotification;
|
||||
this.entityFactory = entityFactory;
|
||||
this.targetTable = targetTable;
|
||||
createRequiredComponents();
|
||||
buildLayout();
|
||||
setCompositionRoot(formLayout);
|
||||
@@ -143,15 +136,11 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
|
||||
final String newName = HawkbitCommonUtil.trimAndNullIfEmpty(nameTextField.getValue());
|
||||
final String newDesc = HawkbitCommonUtil.trimAndNullIfEmpty(descTextArea.getValue());
|
||||
|
||||
/* save new target */
|
||||
final Target newTarget = targetManagement.createTarget(
|
||||
entityFactory.target().create().controllerId(newControllerId).name(newName).description(newDesc));
|
||||
|
||||
final Set<TargetIdName> s = new HashSet<>();
|
||||
s.add(newTarget.getTargetIdName());
|
||||
targetTable.setValue(s);
|
||||
eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.ADD_ENTITY, newTarget));
|
||||
|
||||
/* display success msg */
|
||||
uINotification.displaySuccess(i18n.get("message.save.success", new Object[] { newTarget.getName() }));
|
||||
}
|
||||
|
||||
|
||||
@@ -62,12 +62,12 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
|
||||
TargetDetails(final I18N i18n, final UIEventBus eventBus, final SpPermissionChecker permissionChecker,
|
||||
final ManagementUIState managementUIState, final UINotification uiNotification,
|
||||
final TagManagement tagManagement, final TargetManagement targetManagement,
|
||||
final EntityFactory entityFactory, final TargetTable targetTable) {
|
||||
final EntityFactory entityFactory) {
|
||||
super(i18n, eventBus, permissionChecker, managementUIState);
|
||||
this.targetTagToken = new TargetTagToken(permissionChecker, i18n, uiNotification, eventBus, managementUIState,
|
||||
tagManagement, targetManagement);
|
||||
targetAddUpdateWindowLayout = new TargetAddUpdateWindowLayout(i18n, targetManagement, eventBus, uiNotification,
|
||||
entityFactory, targetTable);
|
||||
entityFactory);
|
||||
addTabs(detailsTab);
|
||||
restoreState();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import static org.eclipse.hawkbit.ui.management.event.TargetFilterEvent.REMOVE_F
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -29,7 +28,6 @@ import java.util.stream.Stream;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.eclipse.hawkbit.repository.FilterParams;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||
@@ -53,8 +51,6 @@ import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentE
|
||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||
import org.eclipse.hawkbit.ui.management.state.TargetTableFilters;
|
||||
import org.eclipse.hawkbit.ui.push.CancelTargetAssignmentEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.TargetCreatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.TargetDeletedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.TargetUpdatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.utils.AssignInstalledDSTooltipGenerator;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
@@ -77,7 +73,6 @@ import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.vaadin.data.Container;
|
||||
import com.vaadin.data.Item;
|
||||
import com.vaadin.event.dd.DragAndDropEvent;
|
||||
@@ -129,29 +124,6 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
|
||||
setDataAvailable(getContainerDataSource().size() != 0);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
void onTargetDeletedEvents(final TargetDeletedEventContainer eventContainer) {
|
||||
final LazyQueryContainer targetContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
final List<Object> visibleItemIds = (List<Object>) getVisibleItemIds();
|
||||
boolean shouldRefreshTargets = false;
|
||||
for (final TargetDeletedEvent deletedEvent : eventContainer.getEvents()) {
|
||||
final TargetIdName targetIdName = new TargetIdName(deletedEvent.getEntityId(), null, null);
|
||||
if (visibleItemIds.contains(targetIdName)) {
|
||||
targetContainer.removeItem(targetIdName);
|
||||
} else {
|
||||
shouldRefreshTargets = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (shouldRefreshTargets) {
|
||||
refreshOnDelete();
|
||||
} else {
|
||||
targetContainer.commit();
|
||||
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.REFRESH_TARGETS));
|
||||
}
|
||||
reSelectItemsAfterDeletionEvent();
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
void onCancelTargetAssignmentEvents(final CancelTargetAssignmentEventContainer eventContainer) {
|
||||
// workaround until push is available for action
|
||||
@@ -163,8 +135,6 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
void onTargetUpdatedEvents(final TargetUpdatedEventContainer eventContainer) {
|
||||
final LazyQueryContainer targetContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
@SuppressWarnings("unchecked")
|
||||
final List<Object> visibleItemIds = (List<Object>) getVisibleItemIds();
|
||||
|
||||
if (isFilterEnabled()) {
|
||||
@@ -173,9 +143,7 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
|
||||
eventContainer.getEvents().stream()
|
||||
.filter(event -> visibleItemIds.contains(new TargetIdName(event.getEntityId(), null, null)))
|
||||
.forEach(event -> updateVisibleItemOnEvent(event.getEntity().getTargetInfo()));
|
||||
targetContainer.commit();
|
||||
}
|
||||
|
||||
// workaround until push is available for action
|
||||
// history, re-select
|
||||
// the updated target so the action history gets
|
||||
@@ -188,11 +156,6 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
|
||||
target -> eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.SELECTED_ENTITY, target)));
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
void onTargetCreatedEvents(final TargetCreatedEventContainer holder) {
|
||||
refreshTargets();
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
void onEvent(final PinUnpinEvent pinUnpinEvent) {
|
||||
UI.getCurrent().access(() -> {
|
||||
@@ -237,16 +200,10 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
void onEvent(final SaveActionWindowEvent event) {
|
||||
if (event == SaveActionWindowEvent.SAVED_ASSIGNMENTS) {
|
||||
refreshTablecontainer();
|
||||
refreshContainer();
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshTablecontainer() {
|
||||
final LazyQueryContainer tableContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
tableContainer.refresh();
|
||||
selectRow();
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
void onEvent(final TargetTableEvent event) {
|
||||
onBaseEntityEvent(event);
|
||||
@@ -337,33 +294,6 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
|
||||
return managementViewClientCriterion;
|
||||
}
|
||||
|
||||
private void reSelectItemsAfterDeletionEvent() {
|
||||
Set<Object> values;
|
||||
if (isMultiSelect()) {
|
||||
values = new HashSet<>((Set<?>) getValue());
|
||||
} else {
|
||||
values = Sets.newHashSetWithExpectedSize(1);
|
||||
values.add(getValue());
|
||||
}
|
||||
unSelectAll();
|
||||
|
||||
for (final Object value : values) {
|
||||
if (getVisibleItemIds().contains(value)) {
|
||||
select(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshOnDelete() {
|
||||
final LazyQueryContainer targetContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
final int size = targetContainer.size();
|
||||
refreshTablecontainer();
|
||||
if (size != 0) {
|
||||
setData(SPUIDefinitions.DATA_AVAILABLE);
|
||||
}
|
||||
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.REFRESH_TARGETS));
|
||||
}
|
||||
|
||||
private Map<String, Object> prepareQueryConfigFilters() {
|
||||
final Map<String, Object> queryConfig = Maps.newHashMapWithExpectedSize(7);
|
||||
managementUIState.getTargetTableFilters().getSearchText()
|
||||
@@ -650,13 +580,17 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
|
||||
public void updateTarget(final Target updatedTarget) {
|
||||
if (updatedTarget != null) {
|
||||
final Item item = getItem(updatedTarget.getTargetIdName());
|
||||
/* Update the new Name, Description and poll date */
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_NAME).setValue(updatedTarget.getName());
|
||||
|
||||
// TO DO update SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER
|
||||
// &
|
||||
// SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER
|
||||
|
||||
/*
|
||||
* Update the status which will trigger the value change lister
|
||||
* registered for the target update status. That listener will
|
||||
* update the new status icon showing for this target in the table.
|
||||
*/
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS)
|
||||
.setValue(updatedTarget.getTargetInfo().getUpdateStatus());
|
||||
/*
|
||||
* Update the last query which will trigger the value change lister
|
||||
* registered for the target last query column. That listener will
|
||||
@@ -671,13 +605,9 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
|
||||
.setValue(SPDateTimeUtil.getFormattedDate(updatedTarget.getLastModifiedAt()));
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_DESC).setValue(updatedTarget.getDescription());
|
||||
|
||||
/*
|
||||
* Update the status which will trigger the value change lister
|
||||
* registered for the target update status. That listener will
|
||||
* update the new status icon showing for this target in the table.
|
||||
*/
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS)
|
||||
.setValue(updatedTarget.getTargetInfo().getUpdateStatus());
|
||||
/* Update the new Name, Description and poll date */
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_NAME).setValue(updatedTarget.getName());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -750,7 +680,7 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
|
||||
final LazyQueryContainer targetContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
final int size = targetContainer.size();
|
||||
if (size < SPUIDefinitions.MAX_TABLE_ENTRIES) {
|
||||
refreshTablecontainer();
|
||||
super.refreshContainer();
|
||||
} else {
|
||||
// If table is not refreshed , explicitly target total count and
|
||||
// truncated count has to be updated
|
||||
@@ -760,7 +690,12 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
|
||||
if (size != 0) {
|
||||
setData(SPUIDefinitions.DATA_AVAILABLE);
|
||||
}
|
||||
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.REFRESH_TARGETS));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshContainer() {
|
||||
super.refreshContainer();
|
||||
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.REFRESH_TARGETS));
|
||||
}
|
||||
|
||||
@@ -772,10 +707,10 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
|
||||
final LazyQueryContainer targetContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
final Item item = targetContainer.getItem(targetIdName);
|
||||
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS).setValue(targetInfo.getUpdateStatus());
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_NAME).setValue(target.getName());
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_POLL_STATUS_TOOL_TIP)
|
||||
.setValue(HawkbitCommonUtil.getPollStatusToolTip(targetInfo.getPollStatus(), i18n));
|
||||
item.getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS).setValue(targetInfo.getUpdateStatus());
|
||||
}
|
||||
|
||||
private boolean isLastSelectedTarget(final TargetIdName targetIdName) {
|
||||
@@ -800,13 +735,6 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
|
||||
setValue(getItemIds());
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all selections in the table.
|
||||
*/
|
||||
private void unSelectAll() {
|
||||
setValue(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setDataAvailable(final boolean available) {
|
||||
managementUIState.setNoDataAvilableTarget(!available);
|
||||
|
||||
@@ -74,13 +74,12 @@ public class TargetTableHeader extends AbstractTableHeader {
|
||||
final UINotification notification, final ManagementUIState managementUIState,
|
||||
final ManagementViewClientCriterion managementViewClientCriterion, final TargetManagement targetManagement,
|
||||
final DeploymentManagement deploymentManagement, final UiProperties uiproperties, final UIEventBus eventBus,
|
||||
final EntityFactory entityFactory, final UINotification uinotification, final TagManagement tagManagement,
|
||||
final TargetTable targetTable) {
|
||||
final EntityFactory entityFactory, final UINotification uinotification, final TagManagement tagManagement) {
|
||||
super(i18n, permChecker, eventbus, managementUIState, null, null);
|
||||
this.notification = notification;
|
||||
this.managementViewClientCriterion = managementViewClientCriterion;
|
||||
this.targetAddUpdateWindow = new TargetAddUpdateWindowLayout(i18n, targetManagement, eventBus, uinotification,
|
||||
entityFactory, targetTable);
|
||||
entityFactory);
|
||||
this.targetBulkUpdateWindow = new TargetBulkUpdateWindowLayout(i18n, targetManagement, eventBus,
|
||||
managementUIState, deploymentManagement, uiproperties, permChecker, uinotification, tagManagement);
|
||||
|
||||
@@ -243,13 +242,13 @@ public class TargetTableHeader extends AbstractTableHeader {
|
||||
@Override
|
||||
public void maximizeTable() {
|
||||
managementUIState.setTargetTableMaximized(Boolean.TRUE);
|
||||
eventbus.publish(this, new TargetTableEvent(BaseEntityEventType.MAXIMIZED, null));
|
||||
eventbus.publish(this, new TargetTableEvent(BaseEntityEventType.MAXIMIZED));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void minimizeTable() {
|
||||
managementUIState.setTargetTableMaximized(Boolean.FALSE);
|
||||
eventbus.publish(this, new TargetTableEvent(BaseEntityEventType.MINIMIZED, null));
|
||||
eventbus.publish(this, new TargetTableEvent(BaseEntityEventType.MINIMIZED));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||
/**
|
||||
* Target table layout.
|
||||
*/
|
||||
public class TargetTableLayout extends AbstractTableLayout {
|
||||
public class TargetTableLayout extends AbstractTableLayout<TargetTable> {
|
||||
|
||||
private static final long serialVersionUID = 2248703121998709112L;
|
||||
|
||||
@@ -46,17 +46,16 @@ public class TargetTableLayout extends AbstractTableLayout {
|
||||
final TagManagement tagManagement) {
|
||||
this.eventBus = eventBus;
|
||||
this.targetDetails = new TargetDetails(i18n, eventbus, permissionChecker, managementUIState, uinotification,
|
||||
tagManagement, targetManagement, entityFactory, targetTable);
|
||||
tagManagement, targetManagement, entityFactory);
|
||||
this.targetTableHeader = new TargetTableHeader(i18n, permissionChecker, eventBus, notification,
|
||||
managementUIState, managementViewClientCriterion, targetManagement, deploymentManagement, uiproperties,
|
||||
eventbus, entityFactory, uinotification, tagManagement, targetTable);
|
||||
eventbus, entityFactory, uinotification, tagManagement);
|
||||
|
||||
super.init(targetTableHeader, targetTable, targetDetails);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void publishEvent() {
|
||||
|
||||
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.SELECT_ALL));
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,10 @@ public abstract class AbstractTargetTagFilterLayout extends VerticalLayout {
|
||||
}
|
||||
}
|
||||
|
||||
protected MultipleTargetFilter getMultipleFilterTabs() {
|
||||
return multipleFilterTabs;
|
||||
}
|
||||
|
||||
/**
|
||||
* On load, software module type filter is cloaed.
|
||||
*
|
||||
|
||||
@@ -18,21 +18,20 @@ import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerConstants;
|
||||
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerHelper;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.components.RefreshableContainer;
|
||||
import org.eclipse.hawkbit.ui.layouts.AbstractCreateUpdateTagLayout;
|
||||
import org.eclipse.hawkbit.ui.push.TargetTagCreatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.TargetTagDeletedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.TargetTagUpdatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.management.event.TargetTagTableEvent;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
/**
|
||||
*
|
||||
* Class for Create / Update Tag Layout of target
|
||||
*/
|
||||
public class CreateUpdateTargetTagLayoutWindow extends AbstractCreateUpdateTagLayout<TargetTag> {
|
||||
public class CreateUpdateTargetTagLayoutWindow extends AbstractCreateUpdateTagLayout<TargetTag>
|
||||
implements RefreshableContainer {
|
||||
|
||||
private static final long serialVersionUID = 2446682350481560235L;
|
||||
|
||||
@@ -42,27 +41,6 @@ public class CreateUpdateTargetTagLayoutWindow extends AbstractCreateUpdateTagLa
|
||||
super(i18n, tagManagement, entityFactory, eventBus, permChecker, uiNotification);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
// Exception squid:S1172 - event not needed
|
||||
@SuppressWarnings({ "squid:S1172" })
|
||||
void onEventTargetTagCreated(final TargetTagCreatedEventContainer eventContainer) {
|
||||
populateTagNameCombo();
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
// Exception squid:S1172 - event not needed
|
||||
@SuppressWarnings({ "squid:S1172" })
|
||||
void onEventTargetDeletedEvent(final TargetTagDeletedEventContainer eventContainer) {
|
||||
populateTagNameCombo();
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
// Exception squid:S1172 - event not needed
|
||||
@SuppressWarnings({ "squid:S1172" })
|
||||
void onEventTargetTagUpdateEvent(final TargetTagUpdatedEventContainer eventContainer) {
|
||||
populateTagNameCombo();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addListeners() {
|
||||
super.addListeners();
|
||||
@@ -130,6 +108,7 @@ public class CreateUpdateTargetTagLayoutWindow extends AbstractCreateUpdateTagLa
|
||||
|
||||
final TargetTag newTargetTag = tagManagement.createTargetTag(
|
||||
entityFactory.tag().create().name(getTagNameValue()).description(getTagDescValue()).colour(colour));
|
||||
eventBus.publish(this, new TargetTagTableEvent(BaseEntityEventType.ADD_ENTITY, newTargetTag));
|
||||
displaySuccess(newTargetTag.getName());
|
||||
} else {
|
||||
displayValidationError(i18n.get(MESSAGE_ERROR_MISSING_TAGNAME));
|
||||
@@ -154,4 +133,9 @@ public class CreateUpdateTargetTagLayoutWindow extends AbstractCreateUpdateTagLa
|
||||
return i18n.get("caption.add.tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshContainer() {
|
||||
populateTagNameCombo();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -75,6 +75,10 @@ public class MultipleTargetFilter extends Accordion implements SelectedTabChange
|
||||
buildComponents();
|
||||
}
|
||||
|
||||
public TargetTagFilterButtons getFilterByButtons() {
|
||||
return filterByButtons;
|
||||
}
|
||||
|
||||
/**
|
||||
* Intialize component.
|
||||
*/
|
||||
|
||||
@@ -20,13 +20,11 @@ import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
|
||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtons;
|
||||
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
||||
import org.eclipse.hawkbit.ui.components.RefreshableContainer;
|
||||
import org.eclipse.hawkbit.ui.dd.criteria.ManagementViewClientCriterion;
|
||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||
import org.eclipse.hawkbit.ui.management.tag.TagIdName;
|
||||
import org.eclipse.hawkbit.ui.push.TargetTagCreatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.TargetTagDeletedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.push.TargetTagUpdatedEventContainer;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
@@ -52,7 +50,7 @@ import com.vaadin.ui.UI;
|
||||
/**
|
||||
* Target Tag filter buttons table.
|
||||
*/
|
||||
public class TargetTagFilterButtons extends AbstractFilterButtons {
|
||||
public class TargetTagFilterButtons extends AbstractFilterButtons implements RefreshableContainer {
|
||||
private static final String NO_TAG = "NO TAG";
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -256,28 +254,8 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
|
||||
return SPUIDefinitions.TARGET_TAG_ID_PREFIXS;
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
// Exception squid:S1172 - event not needed
|
||||
@SuppressWarnings({ "squid:S1172" })
|
||||
void onEvent(final TargetTagUpdatedEventContainer eventContainer) {
|
||||
refreshContainer();
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
// Exception squid:S1172 - event not needed
|
||||
@SuppressWarnings({ "squid:S1172" })
|
||||
void onEventTargetTagCreated(final TargetTagCreatedEventContainer eventContainer) {
|
||||
refreshContainer();
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
// Exception squid:S1172 - event not needed
|
||||
@SuppressWarnings({ "squid:S1172" })
|
||||
void onEventTargetDeletedEvent(final TargetTagDeletedEventContainer eventContainer) {
|
||||
refreshContainer();
|
||||
}
|
||||
|
||||
private void refreshContainer() {
|
||||
@Override
|
||||
public void refreshContainer() {
|
||||
removeGeneratedColumn(FILTER_BUTTON_COLUMN);
|
||||
((LazyQueryContainer) getContainerDataSource()).refresh();
|
||||
addNewTargetTag(entityFactory.tag().create().name(NO_TAG).build());
|
||||
|
||||
@@ -12,8 +12,11 @@ import org.eclipse.hawkbit.repository.EntityFactory;
|
||||
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.components.RefreshableContainer;
|
||||
import org.eclipse.hawkbit.ui.dd.criteria.ManagementViewClientCriterion;
|
||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.TargetTagTableEvent;
|
||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
@@ -24,21 +27,22 @@ import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
/**
|
||||
* Target Tag filter layout.
|
||||
*/
|
||||
public class TargetTagFilterLayout extends AbstractTargetTagFilterLayout {
|
||||
public class TargetTagFilterLayout extends AbstractTargetTagFilterLayout implements RefreshableContainer {
|
||||
|
||||
private static final long serialVersionUID = 2153612878428575009L;
|
||||
private final CreateUpdateTargetTagLayoutWindow createUpdateTargetTagLayout;
|
||||
|
||||
public TargetTagFilterLayout(final I18N i18n, final CreateUpdateTargetTagLayoutWindow createUpdateTargetTagLayout,
|
||||
final ManagementUIState managementUIState,
|
||||
final ManagementViewClientCriterion managementViewClientCriterion,
|
||||
final SpPermissionChecker permChecker, final UIEventBus eventBus, final UINotification notification,
|
||||
final EntityFactory entityFactory, final TargetManagement targetManagement,
|
||||
final TargetFilterQueryManagement targetFilterQueryManagement) {
|
||||
final ManagementViewClientCriterion managementViewClientCriterion, final SpPermissionChecker permChecker,
|
||||
final UIEventBus eventBus, final UINotification notification, final EntityFactory entityFactory,
|
||||
final TargetManagement targetManagement, final TargetFilterQueryManagement targetFilterQueryManagement) {
|
||||
super(new TargetTagFilterHeader(i18n, createUpdateTargetTagLayout, managementUIState, permChecker, eventBus),
|
||||
new MultipleTargetFilter(createUpdateTargetTagLayout, permChecker, managementUIState, i18n, eventBus,
|
||||
managementViewClientCriterion, notification, entityFactory, targetManagement,
|
||||
targetFilterQueryManagement),
|
||||
managementUIState);
|
||||
this.createUpdateTargetTagLayout = createUpdateTargetTagLayout;
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@@ -52,8 +56,23 @@ public class TargetTagFilterLayout extends AbstractTargetTagFilterLayout {
|
||||
}
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.UI)
|
||||
void onTargetTagTableEvent(final TargetTagTableEvent tableEvent) {
|
||||
if (BaseEntityEventType.ADD_ENTITY != tableEvent.getEventType()
|
||||
&& BaseEntityEventType.REMOVE_ENTITY != tableEvent.getEventType()) {
|
||||
return;
|
||||
}
|
||||
refreshContainer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean onLoadIsTypeFilterIsClosed() {
|
||||
return managementUIState.isTargetTagFilterClosed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshContainer() {
|
||||
getMultipleFilterTabs().getFilterByButtons().refreshContainer();
|
||||
createUpdateTargetTagLayout.refreshContainer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.Button.ClickEvent;
|
||||
import com.vaadin.ui.Button.ClickListener;
|
||||
import com.vaadin.ui.Component;
|
||||
import com.vaadin.ui.CssLayout;
|
||||
import com.vaadin.ui.CustomComponent;
|
||||
import com.vaadin.ui.HorizontalLayout;
|
||||
import com.vaadin.ui.Label;
|
||||
@@ -241,11 +242,34 @@ public final class DashboardMenu extends CustomComponent {
|
||||
for (final DashboardMenuItem view : accessibleViews) {
|
||||
final ValoMenuItemButton menuItemComponent = new ValoMenuItemButton(view);
|
||||
menuButtons.add(menuItemComponent);
|
||||
menuItemsLayout.addComponent(menuItemComponent);
|
||||
menuItemsLayout.addComponent(buildLabelWrapper(menuItemComponent, view.getNotificationUnreadLabel()));
|
||||
}
|
||||
return menuItemsLayout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the wrapper which contains the menu item and the adjacent label
|
||||
* for displaying the occurred events
|
||||
*
|
||||
* @param menuItemButton
|
||||
* the menu item
|
||||
* @param notificationLabel
|
||||
* the label for displaying the occurred events
|
||||
* @return Component of type CssLayout
|
||||
*/
|
||||
private static Component buildLabelWrapper(final ValoMenuItemButton menuItemButton,
|
||||
final Component notificationLabel) {
|
||||
final CssLayout dashboardWrapper = new CssLayout(menuItemButton);
|
||||
dashboardWrapper.addStyleName("labelwrapper");
|
||||
dashboardWrapper.addStyleName(ValoTheme.MENU_ITEM);
|
||||
notificationLabel.addStyleName(ValoTheme.MENU_BADGE);
|
||||
notificationLabel.setWidthUndefined();
|
||||
notificationLabel.setVisible(false);
|
||||
notificationLabel.setId(UIComponentIdProvider.NOTIFICATION_MENU_ID + menuItemButton.getCaption().toLowerCase());
|
||||
dashboardWrapper.addComponent(notificationLabel);
|
||||
return dashboardWrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all views which are currently accessible by the current logged in
|
||||
* user.
|
||||
@@ -373,6 +397,7 @@ public final class DashboardMenu extends CustomComponent {
|
||||
setIcon(view.getDashboardIcon());
|
||||
setCaption(view.getDashboardCaption());
|
||||
setDescription(view.getDashboardCaptionLong());
|
||||
setId(view.getDashboardCaption().toLowerCase());
|
||||
/* Avoid double click */
|
||||
setDisableOnClick(true);
|
||||
addClickListener(event -> event.getComponent().getUI().getNavigator().navigateTo(view.getViewName()));
|
||||
|
||||
@@ -10,8 +10,10 @@ package org.eclipse.hawkbit.ui.menu;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import com.vaadin.server.Resource;
|
||||
import com.vaadin.ui.Label;
|
||||
|
||||
/**
|
||||
* Describe a menu entry for the Dashboard.
|
||||
@@ -57,4 +59,18 @@ public interface DashboardMenuItem extends Serializable {
|
||||
*/
|
||||
List<String> getPermissions();
|
||||
|
||||
/**
|
||||
* Set the value of the
|
||||
*
|
||||
* @param notificationUnread
|
||||
* the unreadNotifciations
|
||||
*/
|
||||
void setNotificationUnreadValue(AtomicInteger notificationUnread);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return return the notification
|
||||
*/
|
||||
Label getNotificationUnreadLabel();
|
||||
|
||||
}
|
||||
|
||||
@@ -69,7 +69,6 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy, Applicati
|
||||
private static final int BLOCK_SIZE = 10_000;
|
||||
private final BlockingDeque<org.eclipse.hawkbit.repository.event.TenantAwareEvent> queue = new LinkedBlockingDeque<>(
|
||||
BLOCK_SIZE);
|
||||
private int uiid = -1;
|
||||
|
||||
private final ScheduledExecutorService executorService;
|
||||
|
||||
@@ -78,6 +77,8 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy, Applicati
|
||||
private final UIEventProvider eventProvider;
|
||||
private ScheduledFuture<?> jobHandle;
|
||||
|
||||
private UI vaadinUI;
|
||||
|
||||
public DelayedEventBusPushStrategy(final ScheduledExecutorService executorService, final UIEventBus eventBus,
|
||||
final UIEventProvider eventProvider) {
|
||||
this.executorService = executorService;
|
||||
@@ -91,19 +92,19 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy, Applicati
|
||||
|
||||
@Override
|
||||
public void init(final UI vaadinUI) {
|
||||
uiid = vaadinUI.getUIId();
|
||||
LOG.info("Initialize delayed event push strategy for UI {}", uiid);
|
||||
this.vaadinUI = vaadinUI;
|
||||
LOG.info("Initialize delayed event push strategy for UI {}", vaadinUI.getUIId());
|
||||
if (vaadinUI.getSession() == null) {
|
||||
LOG.error("Vaadin session of UI {} is null! Event push disabled!", uiid);
|
||||
LOG.error("Vaadin session of UI {} is null! Event push disabled!", vaadinUI.getUIId());
|
||||
}
|
||||
|
||||
jobHandle = executorService.scheduleWithFixedDelay(new DispatchRunnable(vaadinUI, vaadinUI.getSession()),
|
||||
10_000, 1_000, TimeUnit.MILLISECONDS);
|
||||
10_000, 2_000, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clean() {
|
||||
LOG.info("Cleanup delayed event push strategy for UI", uiid);
|
||||
LOG.info("Cleanup delayed event push strategy for UI", vaadinUI.getUIId());
|
||||
jobHandle.cancel(true);
|
||||
queue.clear();
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetCreated
|
||||
*
|
||||
*/
|
||||
public class DistributionCreatedEventContainer implements EventContainer<DistributionSetCreatedEvent> {
|
||||
private static final String I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE = "distribution.created.event.container.notifcation.message";
|
||||
private final List<DistributionSetCreatedEvent> events;
|
||||
|
||||
DistributionCreatedEventContainer(final List<DistributionSetCreatedEvent> events) {
|
||||
@@ -28,4 +29,9 @@ public class DistributionCreatedEventContainer implements EventContainer<Distrib
|
||||
return events;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnreadNotificationMessageKey() {
|
||||
return I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.eclipse.hawkbit.repository.event.remote.DistributionSetDeletedEvent;
|
||||
*
|
||||
*/
|
||||
public class DistributionDeletedEventContainer implements EventContainer<DistributionSetDeletedEvent> {
|
||||
private static final String I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE = "distribution.deleted.event.container.notifcation.message";
|
||||
private final List<DistributionSetDeletedEvent> events;
|
||||
|
||||
DistributionDeletedEventContainer(final List<DistributionSetDeletedEvent> events) {
|
||||
@@ -28,4 +29,9 @@ public class DistributionDeletedEventContainer implements EventContainer<Distrib
|
||||
return events;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnreadNotificationMessageKey() {
|
||||
return I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetTagCrea
|
||||
*
|
||||
*/
|
||||
public class DistributionSetTagCreatedEventContainer implements EventContainer<DistributionSetTagCreatedEvent> {
|
||||
private static final String I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE = "distribution.set.tag.created.event.container.notifcation.message";
|
||||
private final List<DistributionSetTagCreatedEvent> events;
|
||||
|
||||
DistributionSetTagCreatedEventContainer(final List<DistributionSetTagCreatedEvent> events) {
|
||||
@@ -28,4 +29,9 @@ public class DistributionSetTagCreatedEventContainer implements EventContainer<D
|
||||
return events;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnreadNotificationMessageKey() {
|
||||
return I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.eclipse.hawkbit.repository.event.remote.DistributionSetTagDeletedEven
|
||||
*
|
||||
*/
|
||||
public class DistributionSetTagDeletedEventContainer implements EventContainer<DistributionSetTagDeletedEvent> {
|
||||
private static final String I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE = "distribution.set.tag.deleted.event.container.notifcation.message";
|
||||
private final List<DistributionSetTagDeletedEvent> events;
|
||||
|
||||
DistributionSetTagDeletedEventContainer(final List<DistributionSetTagDeletedEvent> events) {
|
||||
@@ -28,4 +29,9 @@ public class DistributionSetTagDeletedEventContainer implements EventContainer<D
|
||||
return events;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnreadNotificationMessageKey() {
|
||||
return I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetTagUpda
|
||||
*
|
||||
*/
|
||||
public class DistributionSetTagUpdatedEventContainer implements EventContainer<DistributionSetTagUpdateEvent> {
|
||||
private static final String I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE = "distribution.set.tag.updated.event.container.notifcation.message";
|
||||
private final List<DistributionSetTagUpdateEvent> events;
|
||||
|
||||
DistributionSetTagUpdatedEventContainer(final List<DistributionSetTagUpdateEvent> events) {
|
||||
@@ -28,4 +29,9 @@ public class DistributionSetTagUpdatedEventContainer implements EventContainer<D
|
||||
return events;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnreadNotificationMessageKey() {
|
||||
return I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,4 +28,13 @@ public interface EventContainer<T extends TenantAwareEvent> {
|
||||
*/
|
||||
List<T> getEvents();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the message for unread notification button. <null> means that no
|
||||
* unread message is supported.
|
||||
*/
|
||||
default String getUnreadNotificationMessageKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import java.util.Map;
|
||||
import org.eclipse.hawkbit.repository.event.TenantAwareEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.DistributionSetDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.DistributionSetTagDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.SoftwareModuleDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetTagDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.CancelTargetAssignmentEvent;
|
||||
@@ -20,6 +21,8 @@ import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetCreated
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetTagCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetTagUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.SoftwareModuleCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.SoftwareModuleUpdatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetTagCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetTagUpdateEvent;
|
||||
@@ -58,6 +61,10 @@ public class HawkbitEventProvider implements UIEventProvider {
|
||||
EVENTS.put(RolloutGroupChangeEvent.class, RolloutGroupChangeEventContainer.class);
|
||||
EVENTS.put(RolloutChangeEvent.class, RolloutChangeEventContainer.class);
|
||||
|
||||
EVENTS.put(SoftwareModuleCreatedEvent.class, SoftwareModuleCreatedEventContainer.class);
|
||||
EVENTS.put(SoftwareModuleDeletedEvent.class, SoftwareModuleDeletedEventContainer.class);
|
||||
EVENTS.put(SoftwareModuleUpdatedEvent.class, SoftwareModuleUpdatedEventContainer.class);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.push;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.SoftwareModuleCreatedEvent;
|
||||
|
||||
/**
|
||||
* EventHolder for {@link SoftwareModuleCreatedEvent}s.
|
||||
*
|
||||
*/
|
||||
public class SoftwareModuleCreatedEventContainer implements EventContainer<SoftwareModuleCreatedEvent> {
|
||||
private static final String I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE = "software.module.created.event.container.notifcation.message";
|
||||
|
||||
private final List<SoftwareModuleCreatedEvent> events;
|
||||
|
||||
SoftwareModuleCreatedEventContainer(final List<SoftwareModuleCreatedEvent> events) {
|
||||
this.events = events;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SoftwareModuleCreatedEvent> getEvents() {
|
||||
return events;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnreadNotificationMessageKey() {
|
||||
return I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.push;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.event.remote.SoftwareModuleDeletedEvent;
|
||||
|
||||
/**
|
||||
* EventHolder for {@link SoftwareModuleDeletedEvent}s.
|
||||
*
|
||||
*/
|
||||
public class SoftwareModuleDeletedEventContainer implements EventContainer<SoftwareModuleDeletedEvent> {
|
||||
private static final String I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE = "software.module.deleted.event.container.notifcation.message";
|
||||
private final List<SoftwareModuleDeletedEvent> events;
|
||||
|
||||
SoftwareModuleDeletedEventContainer(final List<SoftwareModuleDeletedEvent> events) {
|
||||
this.events = events;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SoftwareModuleDeletedEvent> getEvents() {
|
||||
return events;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnreadNotificationMessageKey() {
|
||||
return I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.push;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.SoftwareModuleUpdatedEvent;
|
||||
|
||||
/**
|
||||
* EventHolder for {@link SoftwareModuleUpdatedEvent}s.
|
||||
*
|
||||
*/
|
||||
public class SoftwareModuleUpdatedEventContainer implements EventContainer<SoftwareModuleUpdatedEvent> {
|
||||
|
||||
private final List<SoftwareModuleUpdatedEvent> events;
|
||||
|
||||
SoftwareModuleUpdatedEventContainer(final List<SoftwareModuleUpdatedEvent> events) {
|
||||
this.events = events;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SoftwareModuleUpdatedEvent> getEvents() {
|
||||
return events;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,6 +17,8 @@ import org.eclipse.hawkbit.repository.event.remote.entity.TargetCreatedEvent;
|
||||
*
|
||||
*/
|
||||
public class TargetCreatedEventContainer implements EventContainer<TargetCreatedEvent> {
|
||||
private static final String I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE = "target.created.event.container.notifcation.message";
|
||||
|
||||
private final List<TargetCreatedEvent> events;
|
||||
|
||||
TargetCreatedEventContainer(final List<TargetCreatedEvent> events) {
|
||||
@@ -28,4 +30,9 @@ public class TargetCreatedEventContainer implements EventContainer<TargetCreated
|
||||
return events;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnreadNotificationMessageKey() {
|
||||
return I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.eclipse.hawkbit.repository.event.remote.TargetDeletedEvent;
|
||||
*
|
||||
*/
|
||||
public class TargetDeletedEventContainer implements EventContainer<TargetDeletedEvent> {
|
||||
private static final String I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE = "target.deleted.event.container.notifcation.message";
|
||||
private final List<TargetDeletedEvent> events;
|
||||
|
||||
TargetDeletedEventContainer(final List<TargetDeletedEvent> events) {
|
||||
@@ -28,4 +29,9 @@ public class TargetDeletedEventContainer implements EventContainer<TargetDeleted
|
||||
return events;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnreadNotificationMessageKey() {
|
||||
return I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.eclipse.hawkbit.repository.event.remote.entity.TargetTagCreatedEvent;
|
||||
*
|
||||
*/
|
||||
public class TargetTagCreatedEventContainer implements EventContainer<TargetTagCreatedEvent> {
|
||||
private static final String I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE = "target.tag.created.event.container.notifcation.message";
|
||||
private final List<TargetTagCreatedEvent> events;
|
||||
|
||||
TargetTagCreatedEventContainer(final List<TargetTagCreatedEvent> events) {
|
||||
@@ -28,4 +29,9 @@ public class TargetTagCreatedEventContainer implements EventContainer<TargetTagC
|
||||
return events;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnreadNotificationMessageKey() {
|
||||
return I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.eclipse.hawkbit.repository.event.remote.TargetTagDeletedEvent;
|
||||
*
|
||||
*/
|
||||
public class TargetTagDeletedEventContainer implements EventContainer<TargetTagDeletedEvent> {
|
||||
private static final String I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE = "target.tag.deleted.event.container.notifcation.message";
|
||||
private final List<TargetTagDeletedEvent> events;
|
||||
|
||||
TargetTagDeletedEventContainer(final List<TargetTagDeletedEvent> events) {
|
||||
@@ -28,4 +29,9 @@ public class TargetTagDeletedEventContainer implements EventContainer<TargetTagD
|
||||
return events;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnreadNotificationMessageKey() {
|
||||
return I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.eclipse.hawkbit.repository.event.remote.entity.TargetTagUpdateEvent;
|
||||
*
|
||||
*/
|
||||
public class TargetTagUpdatedEventContainer implements EventContainer<TargetTagUpdateEvent> {
|
||||
private static final String I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE = "target.tag.updated.event.container.notifcation.message";
|
||||
private final List<TargetTagUpdateEvent> events;
|
||||
|
||||
TargetTagUpdatedEventContainer(final List<TargetTagUpdateEvent> events) {
|
||||
@@ -28,4 +29,9 @@ public class TargetTagUpdatedEventContainer implements EventContainer<TargetTagU
|
||||
return events;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnreadNotificationMessageKey() {
|
||||
return I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,12 +12,13 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission;
|
||||
import org.eclipse.hawkbit.ui.menu.DashboardMenuItem;
|
||||
import org.eclipse.hawkbit.ui.management.AbstractDashboardMenuItemNotification;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.server.Resource;
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.UIScope;
|
||||
|
||||
/**
|
||||
* Menu item for rollout .
|
||||
@@ -25,9 +26,10 @@ import com.vaadin.server.Resource;
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
@SpringComponent
|
||||
@UIScope
|
||||
@Order(200)
|
||||
public class RolloutViewMenuItem implements DashboardMenuItem {
|
||||
public class RolloutViewMenuItem extends AbstractDashboardMenuItemNotification {
|
||||
|
||||
private static final long serialVersionUID = 6112540239655168995L;
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
case CREATE_ROLLOUT:
|
||||
case UPDATE_ROLLOUT:
|
||||
case SHOW_ROLLOUTS:
|
||||
refreshGrid();
|
||||
refreshContainer();
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
@@ -178,7 +178,7 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
final LazyQueryContainer rolloutContainer = (LazyQueryContainer) getContainerDataSource();
|
||||
final Item item = rolloutContainer.getItem(rolloutChangeEvent.getRolloutId());
|
||||
if (item == null) {
|
||||
refreshGrid();
|
||||
refreshContainer();
|
||||
return;
|
||||
}
|
||||
item.getItemProperty(VAR_STATUS).setValue(rollout.getStatus());
|
||||
@@ -431,10 +431,6 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
addTargetWindow.setVisible(Boolean.TRUE);
|
||||
}
|
||||
|
||||
private void refreshGrid() {
|
||||
((LazyQueryContainer) getContainerDataSource()).refresh();
|
||||
}
|
||||
|
||||
private String getDescription(final CellReference cell) {
|
||||
|
||||
String description = null;
|
||||
|
||||
@@ -12,19 +12,21 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission;
|
||||
import org.eclipse.hawkbit.ui.menu.DashboardMenuItem;
|
||||
import org.eclipse.hawkbit.ui.management.AbstractDashboardMenuItemNotification;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.server.Resource;
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.UIScope;
|
||||
|
||||
/**
|
||||
* Menu item for system configuration view.
|
||||
*/
|
||||
@Component
|
||||
@SpringComponent
|
||||
@UIScope
|
||||
@Order(700)
|
||||
public class TenantConfigurationDashboardViewMenuItem implements DashboardMenuItem {
|
||||
public class TenantConfigurationDashboardViewMenuItem extends AbstractDashboardMenuItemNotification {
|
||||
|
||||
private static final long serialVersionUID = 348659206461499664L;
|
||||
|
||||
|
||||
@@ -14,15 +14,11 @@ import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||
import org.eclipse.hawkbit.repository.model.AssignmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.PollStatus;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||
import org.eclipse.hawkbit.ui.rollout.StatusFontIcon;
|
||||
@@ -313,31 +309,6 @@ public final class HawkbitCommonUtil {
|
||||
return name + ":" + version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new base software module.
|
||||
*
|
||||
* @param bsname
|
||||
* base software module name
|
||||
* @param bsversion
|
||||
* base software module version
|
||||
* @param bsvendor
|
||||
* base software module vendor
|
||||
* @param bstype
|
||||
* base software module type
|
||||
* @param description
|
||||
* base software module description
|
||||
* @param entityFactory
|
||||
* the entity factory to create new entity instances
|
||||
* @return BaseSoftwareModule new base software module
|
||||
*/
|
||||
public static SoftwareModule addNewBaseSoftware(final EntityFactory entityFactory, final String bsname,
|
||||
final String bsversion, final String bsvendor, final SoftwareModuleType bstype, final String description) {
|
||||
final SoftwareManagement swMgmtService = SpringContextHelper.getBean(SoftwareManagement.class);
|
||||
|
||||
return swMgmtService.createSoftwareModule(entityFactory.softwareModule().create().type(bstype).name(bsname)
|
||||
.version(bsversion).description(description).vendor(bsvendor));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param distName
|
||||
* @param distVersion
|
||||
|
||||
@@ -403,10 +403,6 @@ public final class UIComponentIdProvider {
|
||||
* Tab sheet id.
|
||||
*/
|
||||
public static final String TARGET_DETAILS_TABSHEET = "target.details.tabsheet";
|
||||
/**
|
||||
* Tab sheet id.
|
||||
*/
|
||||
public static final String DISTRIBUTION_DETAILS_TABSHEET = "distribution.details.tabsheet.";
|
||||
|
||||
/**
|
||||
* Combobox id.
|
||||
@@ -911,6 +907,12 @@ public final class UIComponentIdProvider {
|
||||
*/
|
||||
public static final String DIST_SET_SELECT_ENABLE_ID = "distribution.set.select.enable";
|
||||
|
||||
public static final String NOTIFICATION_UNREAD_ID = "notification.unread";
|
||||
|
||||
public static final String NOTIFICATION_UNREAD_POPUP_id = "notification.unread.popup";
|
||||
|
||||
public static final String NOTIFICATION_MENU_ID = "notification.menu.";
|
||||
|
||||
/**
|
||||
* /* Private Constructor.
|
||||
*/
|
||||
|
||||
@@ -9,18 +9,25 @@
|
||||
// scss-lint:disable ImportantRule, PropertySortOrder
|
||||
@include keyframes(animate-in-scale-up) {
|
||||
0% {
|
||||
|
||||
@include transform(scale(0));
|
||||
}
|
||||
}
|
||||
|
||||
@mixin dashboard-common {
|
||||
.v-ui {
|
||||
|
||||
//View caption style
|
||||
.v-caption-view-content {
|
||||
.v-caption-header-content {
|
||||
padding-left: 20px;
|
||||
color: $widget-caption-color;
|
||||
font: $view-caption-font-style;
|
||||
font: $view-caption-font-style !important;
|
||||
}
|
||||
|
||||
.view-header-layout{
|
||||
width: 100%;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.v-ui {
|
||||
|
||||
//Menu style
|
||||
.valo-menu {
|
||||
@@ -32,6 +39,11 @@
|
||||
position: relative;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.labelwrapper {
|
||||
position: relative;
|
||||
padding: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
// View main content.When view content width and height is less than min-width and min-height ,scroll bars are displayed
|
||||
@@ -114,6 +126,15 @@
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.valo-menu .valo-menu-badge,
|
||||
.dashboard-view .notifications.unread .v-button-caption {
|
||||
@include valo-badge-style;
|
||||
position: absolute;
|
||||
right: round($v-unit-size/3);
|
||||
font-size: round($v-font-size * 0.9);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
//Menu item - white border is displayed after each menu item
|
||||
.valo-menu-item,
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@mixin notification-unread-change {
|
||||
|
||||
.notifications-unread{
|
||||
width: 37px !important;
|
||||
height: 37px !important;
|
||||
padding-left: 10px !important;
|
||||
}
|
||||
|
||||
.notifications-unread-popup.v-window {
|
||||
overflow: visible !important;
|
||||
// top: 3 * $v-unit-size !important;
|
||||
right: $view-padding;
|
||||
left: auto !important;
|
||||
max-width: 90%;
|
||||
|
||||
$window-outline: $v-overlay-shadow;
|
||||
@if list-of-lists($window-outline) {
|
||||
$window-outline: last($v-overlay-shadow);
|
||||
}
|
||||
$window-outline: flatten-list(valo-bevel-and-shadow($bevel: null, $shadow: $window-outline));
|
||||
$outline-width: nth($window-outline, length($window-outline) - 1);
|
||||
$outline-color: last($window-outline);
|
||||
|
||||
@include transform-origin(296px - (2 * $v-unit-size - round($v-unit-size / 3)) -7px);
|
||||
|
||||
&.v-window-animate-in {
|
||||
@include animation(animate-in-scale-up 260ms cubic-bezier(.68,.37,.51,1.37));
|
||||
}
|
||||
|
||||
&:before,
|
||||
&:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: -12px;
|
||||
right: (2 * $v-unit-size - round($v-unit-size / 3)) - 55px !important;
|
||||
border: 7px solid transparent;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-bottom-color: $v-window-background-color;
|
||||
}
|
||||
|
||||
|
||||
&:before {
|
||||
@if type-of($outline-width) == number and $outline-width > 0 {
|
||||
top: -15px - 2 * $outline-width;
|
||||
margin-right: -$outline-width;
|
||||
border-width: 7px + $outline-width;
|
||||
border-bottom-width: 8px;
|
||||
border-bottom-color: $outline-color;
|
||||
} @else {
|
||||
content: none;
|
||||
}
|
||||
}
|
||||
|
||||
.v-window-header {
|
||||
color: $v-selection-color;
|
||||
}
|
||||
|
||||
.notification-item {
|
||||
font-size: round($v-font-size * 0.9);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Need to use normal media queries because Responsive doesn't work for overlay elements just yet
|
||||
@media screen and (max-width: 480px) {
|
||||
.notifications-unread-popup.v-window {
|
||||
right: round($view-padding / 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -166,4 +166,9 @@
|
||||
margin-top: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.v-window-no-closebox .v-window-closebox:before {
|
||||
height: 0px !important;
|
||||
content: "" !important;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,8 @@ $v-grid-cell-horizontal-border: 0px ;
|
||||
$v-grid-cell-focused-border: 0px ;
|
||||
$v-grid-cell-padding-horizontal:6px;
|
||||
|
||||
$v-animations-enabled: true;
|
||||
|
||||
@import '../valo/valo';
|
||||
@import 'customstyles/table';
|
||||
@import 'customstyles/filter-status';
|
||||
@@ -62,7 +64,7 @@ $v-grid-cell-padding-horizontal:6px;
|
||||
@import 'customstyles/target-filter-query';
|
||||
@import 'customstyles/statusprogressbar';
|
||||
@import 'customstyles/rollout';
|
||||
|
||||
@import 'customstyles/notification-unread-change';
|
||||
|
||||
// Optimize the CSS output
|
||||
$v-included-components: remove($v-included-components, calendar);
|
||||
@@ -95,11 +97,10 @@ $v-included-components: remove($v-included-components, form);
|
||||
@include table-header-common;
|
||||
@include footer-common;
|
||||
@include popup-common;
|
||||
@include valo-menu-responsive;
|
||||
@include target-filter-query;
|
||||
@include statusprogressbar;
|
||||
@include rollout;
|
||||
|
||||
@include notification-unread-change;
|
||||
|
||||
.v-app-loading {
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
|
||||
@@ -27,6 +27,8 @@ button.auto.assignment.desc = Select auto assign distribution set
|
||||
bulk.targets.upload = Please upload csv file.
|
||||
bulkupload.ds.name = DS Name
|
||||
button.discard=Discard
|
||||
notification.unread.button.title=Notifications
|
||||
notification.unread.button.description=Notifications ({0} unread)
|
||||
|
||||
# Headers prefix with - header
|
||||
header.target.table=Targets
|
||||
@@ -60,6 +62,20 @@ header.action.pause=Pause
|
||||
header.action.update=Edit
|
||||
header.status=Status
|
||||
|
||||
# event container
|
||||
target.created.event.container.notifcation.message=targets created
|
||||
target.deleted.event.container.notifcation.message=targets deleted
|
||||
distribution.created.event.container.notifcation.message=distribution sets created
|
||||
distribution.deleted.event.container.notifcation.message=distribution sets deleted
|
||||
target.tag.created.event.container.notifcation.message=target tags created
|
||||
target.tag.deleted.event.container.notifcation.message=target tags deleted
|
||||
target.tag.updated.event.container.notifcation.message=target tags changed
|
||||
software.module.created.event.container.notifcation.message=software module created
|
||||
software.module.deleted.event.container.notifcation.message=software module deleted
|
||||
distribution.set.tag.created.event.container.notifcation.message=distribution set tags created
|
||||
distribution.set.tag.deleted.event.container.notifcation.message=distribution set tags deleted
|
||||
distribution.set.tag.updated.event.container.notifcation.message=distribution set tags changed
|
||||
|
||||
# Captions prefix with - caption
|
||||
caption.action.history = Action history for {0}
|
||||
caption.error = Error
|
||||
|
||||
Reference in New Issue
Block a user