Merge branch 'master' into Methods_only_called_by_inner_classes_should_move_to_those_classes
Conflicts: hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/RolloutListGrid.java hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rolloutgroup/RolloutGroupListGrid.java hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rolloutgrouptargets/RolloutGroupTargetsListGrid.java Signed-off-by: Jonathan Philip Knoblauch <JonathanPhilip.Knoblauch@bosch-si.com>
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* 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;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagCreatedBulkEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagDeletedEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagUpdateEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.Event;
|
||||
import org.eclipse.hawkbit.eventbus.event.RolloutChangeEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.RolloutGroupChangeEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetCreatedEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetDeletedEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetInfoUpdateEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetTagCreatedBulkEvent;
|
||||
|
||||
/**
|
||||
* The default hawkbit event provider.
|
||||
*/
|
||||
public class HawkbitEventProvider implements UIEventProvider {
|
||||
|
||||
private static final Set<Class<? extends Event>> SINGLE_EVENTS = new HashSet<>(6);
|
||||
private static final Set<Class<? extends Event>> BULK_EVENTS = new HashSet<>(3);
|
||||
|
||||
static {
|
||||
SINGLE_EVENTS.add(TargetTagCreatedBulkEvent.class);
|
||||
SINGLE_EVENTS.add(DistributionSetTagCreatedBulkEvent.class);
|
||||
SINGLE_EVENTS.add(DistributionSetTagDeletedEvent.class);
|
||||
SINGLE_EVENTS.add(DistributionSetTagUpdateEvent.class);
|
||||
SINGLE_EVENTS.add(RolloutGroupChangeEvent.class);
|
||||
SINGLE_EVENTS.add(RolloutChangeEvent.class);
|
||||
|
||||
BULK_EVENTS.add(TargetCreatedEvent.class);
|
||||
BULK_EVENTS.add(TargetInfoUpdateEvent.class);
|
||||
BULK_EVENTS.add(TargetDeletedEvent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Class<? extends Event>> getSingleEvents() {
|
||||
return SINGLE_EVENTS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Class<? extends Event>> getBulkEvents() {
|
||||
return BULK_EVENTS;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* 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;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.Event;
|
||||
|
||||
/**
|
||||
* The UI event provider hold all supported repository events which will
|
||||
* delegated to the UI. A event type can delegated as single event or bulk
|
||||
* event. Bulk event means, that all events from one type is collected by the
|
||||
* provider. The delegater and delegated as a list of this events.
|
||||
*/
|
||||
public interface UIEventProvider {
|
||||
|
||||
/**
|
||||
* Return all supported repository single event types. All events which this
|
||||
* type are delegated to the UI as single event.
|
||||
*
|
||||
* @return list of provided event types. Should not be null
|
||||
*/
|
||||
default Set<Class<? extends Event>> getSingleEvents() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all supported repository bulk event types. All events which this
|
||||
* type are delegated to the UI as a list. This list contains all collected
|
||||
* events from one type.
|
||||
*
|
||||
* @return list of provided bulk event types. Should not be null
|
||||
*/
|
||||
default Set<Class<? extends Event>> getBulkEvents() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all filtered bulk event types by the given events. The default
|
||||
* maps the events by class.
|
||||
*
|
||||
* @param allEvents
|
||||
* the events
|
||||
* @return list of provided bulk event types which are filtered. Should not
|
||||
* be null
|
||||
*/
|
||||
default Set<Class<?>> getFilteredBulkEventsType(final List<Event> allEvents) {
|
||||
return allEvents.stream().map(Event::getClass).filter(getBulkEvents()::contains).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,12 +14,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.hawkbit.ui.common.AbstractAcceptCriteria;
|
||||
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
@@ -28,8 +23,6 @@ import com.vaadin.ui.Component;
|
||||
/**
|
||||
* Upload UI View for Accept criteria.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
@@ -41,29 +34,6 @@ public class UploadViewAcceptCriteria extends AbstractAcceptCriteria {
|
||||
|
||||
private static final Map<String, Object> DROP_HINTS_CONFIGS = createDropHintConfigurations();
|
||||
|
||||
@Autowired
|
||||
private transient UINotification uiNotification;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Override
|
||||
protected void analyseDragComponent(final Component compsource) {
|
||||
final String sourceID = getComponentId(compsource);
|
||||
final Object event = DROP_HINTS_CONFIGS.get(sourceID);
|
||||
eventBus.publish(this, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void hideDropHints() {
|
||||
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void invalidDrop() {
|
||||
uiNotification.displayValidationError(SPUILabelDefinitions.ACTION_NOT_ALLOWED);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getComponentId(final Component component) {
|
||||
String id = component.getId();
|
||||
@@ -78,11 +48,6 @@ public class UploadViewAcceptCriteria extends AbstractAcceptCriteria {
|
||||
return DROP_HINTS_CONFIGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void publishDragStartEvent(final Object event) {
|
||||
eventBus.publish(this, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, List<String>> getDropConfigurations() {
|
||||
return DROP_CONFIGS;
|
||||
|
||||
@@ -11,22 +11,15 @@ package org.eclipse.hawkbit.ui.artifacts.footer;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.UploadViewAcceptCriteria;
|
||||
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||
import org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout;
|
||||
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
@@ -50,18 +43,6 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
private static final long serialVersionUID = -3273982053389866299L;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private SpPermissionChecker permChecker;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private transient UINotification notification;
|
||||
|
||||
@Autowired
|
||||
private ArtifactUploadState artifactUploadState;
|
||||
|
||||
@@ -71,22 +52,6 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
@Autowired
|
||||
private UploadViewAcceptCriteria uploadViewAcceptCriteria;
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
/*
|
||||
* It's good manners to do this, even though vaadin-spring will
|
||||
* automatically unsubscribe when this UI is garbage collected.
|
||||
*/
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final UploadArtifactUIEvent event) {
|
||||
|
||||
@@ -211,26 +176,11 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
updateActionsCount(count);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getNoActionsButtonLabel() {
|
||||
return i18n.get("button.no.actions");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getActionsButtonLabel() {
|
||||
return i18n.get("button.actions");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void restoreActionCount() {
|
||||
updateSWActionCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getUnsavedActionsWindowCaption() {
|
||||
return i18n.get("caption.save.window");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void unsavedActionsWindowClosed() {
|
||||
final String message = uploadViewConfirmationWindowLayout.getConsolidatedMessage();
|
||||
|
||||
@@ -28,8 +28,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
|
||||
import com.vaadin.event.FieldEvents.TextChangeEvent;
|
||||
import com.vaadin.event.FieldEvents.TextChangeListener;
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
@@ -245,27 +243,21 @@ public class SoftwareModuleAddUpdateWindow implements Serializable {
|
||||
}
|
||||
|
||||
private void addDescriptionTextChangeListener() {
|
||||
descTextArea.addTextChangeListener(new TextChangeListener() {
|
||||
@Override
|
||||
public void textChange(final TextChangeEvent event) {
|
||||
if (event.getText().equals(oldDescriptionValue) && vendorTextField.getValue().equals(oldVendorValue)) {
|
||||
saveSoftware.setEnabled(false);
|
||||
} else {
|
||||
saveSoftware.setEnabled(true);
|
||||
}
|
||||
descTextArea.addTextChangeListener(event -> {
|
||||
if (event.getText().equals(oldDescriptionValue) && vendorTextField.getValue().equals(oldVendorValue)) {
|
||||
saveSoftware.setEnabled(false);
|
||||
} else {
|
||||
saveSoftware.setEnabled(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addVendorTextChangeListener() {
|
||||
vendorTextField.addTextChangeListener(new TextChangeListener() {
|
||||
@Override
|
||||
public void textChange(final TextChangeEvent event) {
|
||||
if (event.getText().equals(oldVendorValue) && descTextArea.getValue().equals(oldDescriptionValue)) {
|
||||
saveSoftware.setEnabled(false);
|
||||
} else {
|
||||
saveSoftware.setEnabled(true);
|
||||
}
|
||||
vendorTextField.addTextChangeListener(event -> {
|
||||
if (event.getText().equals(oldVendorValue) && descTextArea.getValue().equals(oldDescriptionValue)) {
|
||||
saveSoftware.setEnabled(false);
|
||||
} else {
|
||||
saveSoftware.setEnabled(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -280,7 +272,7 @@ public class SoftwareModuleAddUpdateWindow implements Serializable {
|
||||
final String description = HawkbitCommonUtil.trimAndNullIfEmpty(descTextArea.getValue());
|
||||
final String type = typeComboBox.getValue() != null ? typeComboBox.getValue().toString() : null;
|
||||
if (mandatoryCheck(name, version, type)) {
|
||||
if (HawkbitCommonUtil.isDuplicate(name, version)) {
|
||||
if (HawkbitCommonUtil.isDuplicate(name, version, type)) {
|
||||
uiNotifcation.displayValidationError(
|
||||
i18n.get("message.duplicate.softwaremodule", new Object[] { name, version }));
|
||||
} else {
|
||||
|
||||
@@ -8,10 +8,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.artifacts.smtable;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
|
||||
@@ -19,10 +15,8 @@ import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractTableDetailsLayout;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
@@ -46,38 +40,16 @@ public class SoftwareModuleDetails extends AbstractTableDetailsLayout {
|
||||
|
||||
private static final long serialVersionUID = -4900381301076646366L;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private SpPermissionChecker permissionChecker;
|
||||
|
||||
@Autowired
|
||||
private SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow;
|
||||
|
||||
@Autowired
|
||||
private ArtifactUploadState artifactUploadState;
|
||||
|
||||
private UI ui;
|
||||
|
||||
private Long swModuleId;
|
||||
|
||||
private SoftwareModule selectedSwModule;
|
||||
|
||||
/**
|
||||
* Initialize the component.
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
ui = UI.getCurrent();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getEditButtonId() {
|
||||
return SPUIComponetIdProvider.UPLOAD_SW_MODULE_EDIT_BUTTON;
|
||||
@@ -175,58 +147,24 @@ public class SoftwareModuleDetails extends AbstractTableDetailsLayout {
|
||||
}
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
/*
|
||||
* It's good manners to do this, even though vaadin-spring will
|
||||
* automatically unsubscribe when this UI is garbage collected.
|
||||
*/
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.detailslayout.TableDetailsLayout#
|
||||
* getDefaultCaption()
|
||||
*/
|
||||
@Override
|
||||
protected String getDefaultCaption() {
|
||||
return i18n.get("upload.swModuleTable.header");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.detailslayout.TableDetailsLayout#
|
||||
* onLoadIsSwModuleSelected()
|
||||
*/
|
||||
@Override
|
||||
protected Boolean onLoadIsTableRowSelected() {
|
||||
return artifactUploadState.getSelectedBaseSoftwareModule().isPresent();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.detailslayout.TableDetailsLayout#
|
||||
* onLoadIsTableMaximized()
|
||||
*/
|
||||
|
||||
@Override
|
||||
protected Boolean onLoadIsTableMaximized() {
|
||||
return artifactUploadState.isSwModuleTableMaximized();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.detailslayout.TableDetailsLayout#
|
||||
* populateDetailsWidget()
|
||||
*/
|
||||
|
||||
@Override
|
||||
protected void populateDetailsWidget() {
|
||||
populateDetailsWidget(selectedSwModule);
|
||||
@@ -266,12 +204,7 @@ public class SoftwareModuleDetails extends AbstractTableDetailsLayout {
|
||||
return permissionChecker.hasUpdateDistributionPermission();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* getTabSheetId()
|
||||
*/
|
||||
|
||||
@Override
|
||||
protected String getTabSheetId() {
|
||||
return null;
|
||||
|
||||
@@ -8,20 +8,14 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.artifacts.smtable;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
||||
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||
import org.eclipse.hawkbit.ui.common.table.AbstractTableHeader;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
@@ -44,31 +38,12 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
|
||||
|
||||
private static final long serialVersionUID = 242961845006626297L;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private SpPermissionChecker permChecker;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventbus;
|
||||
|
||||
@Autowired
|
||||
private ArtifactUploadState artifactUploadState;
|
||||
|
||||
@Autowired
|
||||
private SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow;
|
||||
|
||||
/**
|
||||
* Initialize the components.
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
eventbus.subscribe(this);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final UploadArtifactUIEvent event) {
|
||||
if (event == UploadArtifactUIEvent.HIDE_FILTER_BY_TYPE) {
|
||||
@@ -76,14 +51,6 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
|
||||
}
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
/*
|
||||
* It's good manners to do this, even though vaadin-spring will
|
||||
* automatically unsubscribe when this UI is garbage collected.
|
||||
*/
|
||||
eventbus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getHeaderCaption() {
|
||||
|
||||
@@ -8,21 +8,17 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.artifacts.smtype;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.UploadViewAcceptCriteria;
|
||||
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||
import org.eclipse.hawkbit.ui.common.SoftwareModuleTypeBeanQuery;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtonClickBehaviour;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtons;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
@@ -48,26 +44,6 @@ public class SMTypeFilterButtons extends AbstractFilterButtons {
|
||||
@Autowired
|
||||
private UploadViewAcceptCriteria uploadViewAcceptCriteria;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
/**
|
||||
* Initialize component.
|
||||
*
|
||||
* @param filterButtonClickBehaviour
|
||||
* the clickable behaviour.
|
||||
*/
|
||||
@Override
|
||||
public void init(final AbstractFilterButtonClickBehaviour filterButtonClickBehaviour) {
|
||||
super.init(filterButtonClickBehaviour);
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final SoftwareModuleTypeEvent event) {
|
||||
if (event.getSoftwareModuleTypeEnum() == SoftwareModuleTypeEvent.SoftwareModuleTypeEnum.ADD_SOFTWARE_MODULE_TYPE
|
||||
@@ -97,9 +73,9 @@ public class SMTypeFilterButtons extends AbstractFilterButtons {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isClickedByDefault(final Long buttonId) {
|
||||
protected boolean isClickedByDefault(final String typeName) {
|
||||
return artifactUploadState.getSoftwareModuleFilters().getSoftwareModuleType().isPresent() && artifactUploadState
|
||||
.getSoftwareModuleFilters().getSoftwareModuleType().get().getId().equals(buttonId);
|
||||
.getSoftwareModuleFilters().getSoftwareModuleType().get().getName().equals(typeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,7 +10,6 @@ package org.eclipse.hawkbit.ui.artifacts.smtype;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
||||
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader;
|
||||
@@ -18,7 +17,6 @@ import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
@@ -35,12 +33,6 @@ public class SMTypeFilterHeader extends AbstractFilterHeader {
|
||||
|
||||
private static final long serialVersionUID = -4855810338059032342L;
|
||||
|
||||
@Autowired
|
||||
private SpPermissionChecker permChecker;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventbus;
|
||||
|
||||
@Autowired
|
||||
private ArtifactUploadState artifactUploadState;
|
||||
|
||||
@@ -84,7 +76,7 @@ public class SMTypeFilterHeader extends AbstractFilterHeader {
|
||||
@Override
|
||||
protected void hideFilterButtonLayout() {
|
||||
artifactUploadState.setSwTypeFilterClosed(true);
|
||||
eventbus.publish(this, UploadArtifactUIEvent.HIDE_FILTER_BY_TYPE);
|
||||
eventBus.publish(this, UploadArtifactUIEvent.HIDE_FILTER_BY_TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,8 +13,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
|
||||
import com.vaadin.event.dd.DragAndDropEvent;
|
||||
import com.vaadin.event.dd.acceptcriteria.ServerSideCriterion;
|
||||
@@ -27,9 +32,6 @@ import com.vaadin.ui.Table;
|
||||
/**
|
||||
* Abstract class for Accept criteria.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractAcceptCriteria extends ServerSideCriterion {
|
||||
|
||||
@@ -37,13 +39,12 @@ public abstract class AbstractAcceptCriteria extends ServerSideCriterion {
|
||||
|
||||
private int previousRowCount;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.vaadin.event.dd.acceptcriteria.AcceptCriterion#accept(com.vaadin.
|
||||
* event.dd.DragAndDropEvent )
|
||||
*/
|
||||
@Autowired
|
||||
protected transient UINotification uiNotification;
|
||||
|
||||
@Autowired
|
||||
protected transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Override
|
||||
public boolean accept(final DragAndDropEvent dragEvent) {
|
||||
final Component compsource = dragEvent.getTransferable().getSourceComponent();
|
||||
@@ -129,7 +130,7 @@ public abstract class AbstractAcceptCriteria extends ServerSideCriterion {
|
||||
protected void analyseDragComponent(final Component compsource) {
|
||||
final String sourceID = getComponentId(compsource);
|
||||
final Object event = getDropHintConfigurations().get(sourceID);
|
||||
publishDragStartEvent(event);
|
||||
eventBus.publish(this, event);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,23 +160,19 @@ public abstract class AbstractAcceptCriteria extends ServerSideCriterion {
|
||||
*/
|
||||
protected abstract String getComponentId(final Component component);
|
||||
|
||||
/**
|
||||
* publish the given event into eventBus.
|
||||
*
|
||||
* @param event
|
||||
* to be published in eventBus.
|
||||
*/
|
||||
protected abstract void publishDragStartEvent(Object event);
|
||||
|
||||
/**
|
||||
* Hide the drop hints. Dragging is stopped.
|
||||
*/
|
||||
protected abstract void hideDropHints();
|
||||
protected void hideDropHints() {
|
||||
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display invalid drop message.
|
||||
*/
|
||||
protected abstract void invalidDrop();
|
||||
protected void invalidDrop() {
|
||||
uiNotification.displayValidationError(SPUILabelDefinitions.ACTION_NOT_ALLOWED);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
|
||||
@@ -10,6 +10,10 @@ package org.eclipse.hawkbit.ui.common.detailslayout;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||
@@ -19,6 +23,8 @@ import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.shared.ui.label.ContentMode;
|
||||
@@ -27,6 +33,7 @@ import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.HorizontalLayout;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.TabSheet;
|
||||
import com.vaadin.ui.UI;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
|
||||
/**
|
||||
@@ -37,6 +44,17 @@ public abstract class AbstractTableDetailsLayout extends VerticalLayout {
|
||||
|
||||
private static final long serialVersionUID = 4862529368471627190L;
|
||||
|
||||
@Autowired
|
||||
protected I18N i18n;
|
||||
|
||||
@Autowired
|
||||
protected transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
protected SpPermissionChecker permissionChecker;
|
||||
|
||||
protected UI ui;
|
||||
|
||||
private Label caption;
|
||||
|
||||
private Button editButton;
|
||||
@@ -54,7 +72,9 @@ public abstract class AbstractTableDetailsLayout extends VerticalLayout {
|
||||
/**
|
||||
* Initialize components.
|
||||
*/
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
ui = UI.getCurrent();
|
||||
createComponents();
|
||||
buildLayout();
|
||||
/**
|
||||
@@ -62,6 +82,12 @@ public abstract class AbstractTableDetailsLayout extends VerticalLayout {
|
||||
* selected in table.
|
||||
*/
|
||||
restoreState();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
private void createComponents() {
|
||||
|
||||
@@ -161,7 +161,6 @@ public class SoftwareModuleDetailsTable extends Table {
|
||||
if (null != distributionSet) {
|
||||
if (isUnassignSoftModAllowed && permissionChecker.hasUpdateDistributionPermission()) {
|
||||
try {
|
||||
distributionSetManagement.checkDistributionSetAlreadyUse(distributionSet);
|
||||
isTargetAssigned = false;
|
||||
} catch (final EntityLockedException exception) {
|
||||
isTargetAssigned = true;
|
||||
|
||||
@@ -11,13 +11,17 @@ package org.eclipse.hawkbit.ui.common.filterlayout;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUITagButtonStyle;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
|
||||
import com.vaadin.data.Item;
|
||||
import com.vaadin.event.dd.DropHandler;
|
||||
@@ -38,10 +42,13 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
public abstract class AbstractFilterButtons extends Table {
|
||||
|
||||
private static final long serialVersionUID = 7783305719009746375L;
|
||||
|
||||
|
||||
private static final String DEFAULT_GREEN = "rgb(44,151,32)";
|
||||
|
||||
protected static final String FILTER_BUTTON_COLUMN = "filterButton";
|
||||
|
||||
@Autowired
|
||||
protected transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
private AbstractFilterButtonClickBehaviour filterButtonClickBehaviour;
|
||||
|
||||
@@ -54,6 +61,12 @@ public abstract class AbstractFilterButtons extends Table {
|
||||
public void init(final AbstractFilterButtonClickBehaviour filterButtonClickBehaviour) {
|
||||
this.filterButtonClickBehaviour = filterButtonClickBehaviour;
|
||||
createTable();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
private void createTable() {
|
||||
@@ -88,12 +101,7 @@ public abstract class AbstractFilterButtons extends Table {
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
protected void addColumn() {
|
||||
addGeneratedColumn(FILTER_BUTTON_COLUMN, new ColumnGenerator() {
|
||||
@Override
|
||||
public Object generateCell(final Table source, final Object itemId, final Object columnId) {
|
||||
return addGeneratedCell(itemId);
|
||||
}
|
||||
});
|
||||
addGeneratedColumn(FILTER_BUTTON_COLUMN, (source, itemId, columnId) -> addGeneratedCell(itemId));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,7 +122,7 @@ public abstract class AbstractFilterButtons extends Table {
|
||||
typeButton.addClickListener(event -> filterButtonClickBehaviour.processFilterButtonClick(event));
|
||||
if (typeButton.getData().equals(SPUIDefinitions.NO_TAG_BUTTON_ID) && isNoTagSateSelected()) {
|
||||
filterButtonClickBehaviour.setDefaultClickedButton(typeButton);
|
||||
} else if (id != null && isClickedByDefault(id)) {
|
||||
} else if (id != null && isClickedByDefault(name)) {
|
||||
filterButtonClickBehaviour.setDefaultClickedButton(typeButton);
|
||||
}
|
||||
final DragAndDropWrapper wrapper = createDragAndDropWrapper(typeButton, name, id);
|
||||
@@ -205,10 +213,11 @@ public abstract class AbstractFilterButtons extends Table {
|
||||
/**
|
||||
* Check if button should be displayed as clicked by default.
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
* @param buttonCaption
|
||||
* button caption
|
||||
* @return true if button is clicked
|
||||
*/
|
||||
protected abstract boolean isClickedByDefault(final Long buttonId);
|
||||
protected abstract boolean isClickedByDefault(final String buttonCaption);
|
||||
|
||||
/**
|
||||
* Get filter button Id.
|
||||
|
||||
@@ -8,10 +8,13 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.common.filterlayout;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.ui.Alignment;
|
||||
@@ -31,6 +34,13 @@ public abstract class AbstractFilterHeader extends VerticalLayout {
|
||||
|
||||
private static final long serialVersionUID = -1388340600522323332L;
|
||||
|
||||
|
||||
@Autowired
|
||||
protected SpPermissionChecker permChecker;
|
||||
|
||||
@Autowired
|
||||
protected transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
private Label title;
|
||||
|
||||
private Button config;
|
||||
|
||||
@@ -8,12 +8,20 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.common.footer;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmall;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
|
||||
import com.vaadin.event.dd.DragAndDropEvent;
|
||||
import com.vaadin.event.dd.DropHandler;
|
||||
@@ -34,14 +42,23 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
/**
|
||||
* Parent class for footer layout.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractDeleteActionsLayout extends VerticalLayout implements DropHandler {
|
||||
|
||||
private static final long serialVersionUID = -6047975388519155509L;
|
||||
|
||||
@Autowired
|
||||
protected I18N i18n;
|
||||
|
||||
@Autowired
|
||||
protected SpPermissionChecker permChecker;
|
||||
|
||||
@Autowired
|
||||
protected transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
protected transient UINotification notification;
|
||||
|
||||
private DragAndDropWrapper deleteWrapper;
|
||||
|
||||
private Button noActionBtn;
|
||||
@@ -53,12 +70,19 @@ public abstract class AbstractDeleteActionsLayout extends VerticalLayout impleme
|
||||
/**
|
||||
* Initialize.
|
||||
*/
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
if (hasCountMessage() || hasDeletePermission() || hasUpdatePermission() || hasBulkUploadPermission()) {
|
||||
createComponents();
|
||||
buildLayout();
|
||||
reload();
|
||||
}
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
private void reload() {
|
||||
@@ -311,14 +335,27 @@ public abstract class AbstractDeleteActionsLayout extends VerticalLayout impleme
|
||||
*
|
||||
* @return the no actions label.
|
||||
*/
|
||||
protected abstract String getNoActionsButtonLabel();
|
||||
protected String getNoActionsButtonLabel() {
|
||||
return i18n.get("button.no.actions");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the pending actions button label.
|
||||
*
|
||||
* @return the actions label.
|
||||
*/
|
||||
protected abstract String getActionsButtonLabel();
|
||||
protected String getActionsButtonLabel() {
|
||||
return i18n.get("button.actions");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get caption of unsaved actions window.
|
||||
*
|
||||
* @return caption of the window.
|
||||
*/
|
||||
protected String getUnsavedActionsWindowCaption() {
|
||||
return i18n.get("caption.save.window");
|
||||
}
|
||||
|
||||
/**
|
||||
* reload the count value.
|
||||
@@ -330,13 +367,6 @@ public abstract class AbstractDeleteActionsLayout extends VerticalLayout impleme
|
||||
*/
|
||||
protected abstract void restoreBulkUploadStatusCount();
|
||||
|
||||
/**
|
||||
* Get caption of unsaved actions window.
|
||||
*
|
||||
* @return caption of the window.
|
||||
*/
|
||||
protected abstract String getUnsavedActionsWindowCaption();
|
||||
|
||||
/**
|
||||
* This method will be called when unsaved actions window is closed.
|
||||
*/
|
||||
|
||||
@@ -8,14 +8,17 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.common.grid;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
|
||||
import com.vaadin.data.Container;
|
||||
import com.vaadin.data.Container.Indexed;
|
||||
import com.vaadin.shared.ui.grid.HeightMode;
|
||||
import com.vaadin.ui.Grid;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Abstract table class.
|
||||
@@ -24,10 +27,18 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
public abstract class AbstractGrid extends Grid {
|
||||
|
||||
private static final long serialVersionUID = 4856562746502217630L;
|
||||
|
||||
@Autowired
|
||||
protected I18N i18n;
|
||||
|
||||
@Autowired
|
||||
protected transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the components.
|
||||
*/
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
setSizeFull();
|
||||
setImmediate(true);
|
||||
@@ -35,6 +46,12 @@ public abstract class AbstractGrid extends Grid {
|
||||
setSelectionMode(SelectionMode.NONE);
|
||||
setColumnReorderingAllowed(true);
|
||||
addNewContainerDS();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
public void addNewContainerDS() {
|
||||
@@ -46,13 +63,13 @@ public abstract class AbstractGrid extends Grid {
|
||||
setColumnHeaderNames();
|
||||
addColumnRenderes();
|
||||
|
||||
CellDescriptionGenerator cellDescriptionGenerator = getDescriptionGenerator();
|
||||
final CellDescriptionGenerator cellDescriptionGenerator = getDescriptionGenerator();
|
||||
if (getDescriptionGenerator() != null) {
|
||||
setCellDescriptionGenerator(cellDescriptionGenerator);
|
||||
}
|
||||
|
||||
// Allow column hiding
|
||||
for (Column c : getColumns()) {
|
||||
for (final Column c : getColumns()) {
|
||||
c.setHidable(true);
|
||||
}
|
||||
setHiddenColumns();
|
||||
|
||||
@@ -8,13 +8,20 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.common.table;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIButton;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
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.SPUIStyleDefinitions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
|
||||
import com.vaadin.event.dd.DropHandler;
|
||||
import com.vaadin.server.FontAwesome;
|
||||
@@ -37,6 +44,16 @@ import com.vaadin.ui.VerticalLayout;
|
||||
public abstract class AbstractTableHeader extends VerticalLayout {
|
||||
|
||||
private static final long serialVersionUID = 4881626370291837175L;
|
||||
|
||||
@Autowired
|
||||
protected I18N i18n;
|
||||
|
||||
@Autowired
|
||||
protected SpPermissionChecker permChecker;
|
||||
|
||||
@Autowired
|
||||
protected transient EventBus.SessionEventBus eventbus;
|
||||
|
||||
|
||||
private Label headerCaption;
|
||||
|
||||
@@ -59,10 +76,17 @@ public abstract class AbstractTableHeader extends VerticalLayout {
|
||||
/**
|
||||
* Initialze components.
|
||||
*/
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
createComponents();
|
||||
buildLayout();
|
||||
restoreState();
|
||||
eventbus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventbus.unsubscribe(this);
|
||||
}
|
||||
|
||||
private void createComponents() {
|
||||
|
||||
@@ -13,10 +13,17 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.tokenfield.TokenField;
|
||||
import org.vaadin.tokenfield.TokenField.InsertPosition;
|
||||
|
||||
@@ -52,13 +59,33 @@ public abstract class AbstractTagToken implements Serializable {
|
||||
protected final Map<Long, TagData> tokensAdded = new HashMap<>();
|
||||
|
||||
protected CssLayout tokenLayout = new CssLayout();
|
||||
|
||||
@Autowired
|
||||
protected SpPermissionChecker checker;
|
||||
|
||||
@Autowired
|
||||
protected I18N i18n;
|
||||
|
||||
@Autowired
|
||||
protected UINotification uinotification;
|
||||
|
||||
@Autowired
|
||||
protected transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
protected ManagementUIState managementUIState;
|
||||
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
createTokenField();
|
||||
checkIfTagAssignedIsAllowed();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
private void createTokenField() {
|
||||
|
||||
@@ -8,54 +8,25 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.common.tagdetails;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetTagCreatedBulkEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetTagDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.TagManagement;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
import com.vaadin.ui.UI;
|
||||
|
||||
/**
|
||||
* Abstract class for target tag token layout.
|
||||
*/
|
||||
public abstract class AbstractTargetTagToken extends AbstractTagToken {
|
||||
|
||||
private static final long serialVersionUID = 7772876588903171201L;
|
||||
protected UI ui;
|
||||
|
||||
@Autowired
|
||||
protected transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
protected I18N i18n;
|
||||
|
||||
@Autowired
|
||||
protected transient TagManagement tagManagement;
|
||||
|
||||
@Autowired
|
||||
protected SpPermissionChecker checker;
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
ui = UI.getCurrent();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEventTargetTagCreated(final TargetTagCreatedBulkEvent event) {
|
||||
|
||||
@@ -14,7 +14,6 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagAssigmentResultEvent;
|
||||
@@ -22,19 +21,15 @@ import org.eclipse.hawkbit.eventbus.event.DistributionSetTagCreatedBulkEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagDeletedEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.TagManagement;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssigmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
|
||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent.DistributionComponentEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
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.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
@@ -52,19 +47,6 @@ import com.vaadin.ui.UI;
|
||||
public class DistributionTagToken extends AbstractTagToken {
|
||||
|
||||
private static final long serialVersionUID = -8022738301736043396L;
|
||||
|
||||
@Autowired
|
||||
private SpPermissionChecker spChecker;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private UINotification uinotification;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private transient TagManagement tagManagement;
|
||||
|
||||
@@ -73,20 +55,9 @@ public class DistributionTagToken extends AbstractTagToken {
|
||||
|
||||
private DistributionSet selectedDS;
|
||||
|
||||
private UI ui;
|
||||
|
||||
// To Be Done : have to set this value based on view???
|
||||
private static final Boolean NOTAGS_SELECTED = Boolean.FALSE;
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
ui = UI.getCurrent();
|
||||
eventBus.subscribe(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTagStyleName() {
|
||||
return "distribution-tag-";
|
||||
@@ -100,7 +71,7 @@ public class DistributionTagToken extends AbstractTagToken {
|
||||
@Override
|
||||
protected void assignTag(final String tagNameSelected) {
|
||||
if (tagNameSelected != null) {
|
||||
final DistributionSetTagAssigmentResult result = toggleAssignment(tagNameSelected);
|
||||
final DistributionSetTagAssignmentResult result = toggleAssignment(tagNameSelected);
|
||||
if (result.getAssigned() >= 1 && NOTAGS_SELECTED) {
|
||||
eventBus.publish(this, ManagementUIEvent.ASSIGN_DISTRIBUTION_TAG);
|
||||
}
|
||||
@@ -109,18 +80,18 @@ public class DistributionTagToken extends AbstractTagToken {
|
||||
}
|
||||
}
|
||||
|
||||
private DistributionSetTagAssigmentResult toggleAssignment(final String tagNameSelected) {
|
||||
private DistributionSetTagAssignmentResult toggleAssignment(final String tagNameSelected) {
|
||||
final Set<Long> distributionList = new HashSet<>();
|
||||
distributionList.add(selectedDS.getId());
|
||||
final DistributionSetTagAssigmentResult result = distributionSetManagement.toggleTagAssignment(distributionList,
|
||||
final DistributionSetTagAssignmentResult result = distributionSetManagement.toggleTagAssignment(distributionList,
|
||||
tagNameSelected);
|
||||
uinotification.displaySuccess(HawkbitCommonUtil.getDistributionTagAssignmentMsg(tagNameSelected, result, i18n));
|
||||
uinotification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(tagNameSelected, result, i18n));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void unassignTag(final String tagName) {
|
||||
final DistributionSetTagAssigmentResult result = toggleAssignment(tagName);
|
||||
final DistributionSetTagAssignmentResult result = toggleAssignment(tagName);
|
||||
if (result.getUnassigned() >= 1 && (isClickedTagListEmpty() || getClickedTagList().contains(tagName))) {
|
||||
eventBus.publish(this, ManagementUIEvent.UNASSIGN_DISTRIBUTION_TAG);
|
||||
}
|
||||
@@ -140,7 +111,7 @@ public class DistributionTagToken extends AbstractTagToken {
|
||||
|
||||
@Override
|
||||
protected Boolean isToggleTagAssignmentAllowed() {
|
||||
return spChecker.hasUpdateDistributionPermission();
|
||||
return checker.hasUpdateDistributionPermission();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -163,18 +134,15 @@ public class DistributionTagToken extends AbstractTagToken {
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final DistributionTableEvent distributionTableEvent) {
|
||||
if (distributionTableEvent.getDistributionComponentEvent() == DistributionComponentEvent.ON_VALUE_CHANGE) {
|
||||
ui.access(() -> {
|
||||
/**
|
||||
* distributionTableEvent.getDistributionSet() is null when
|
||||
* table has no data.
|
||||
*/
|
||||
if (distributionTableEvent.getDistributionSet() != null) {
|
||||
selectedDS = distributionTableEvent.getDistributionSet();
|
||||
repopulateToken();
|
||||
}
|
||||
});
|
||||
if (distributionTableEvent.getDistributionComponentEvent() != DistributionComponentEvent.ON_VALUE_CHANGE) {
|
||||
return;
|
||||
}
|
||||
UI.getCurrent().access(() -> {
|
||||
if (distributionTableEvent.getDistributionSet() != null) {
|
||||
selectedDS = distributionTableEvent.getDistributionSet();
|
||||
repopulateToken();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
@@ -202,7 +170,7 @@ public class DistributionTagToken extends AbstractTagToken {
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onTargetTagAssigmentResultEvent(final DistributionSetTagAssigmentResultEvent event) {
|
||||
final DistributionSetTagAssigmentResult assignmentResult = event.getAssigmentResult();
|
||||
final DistributionSetTagAssignmentResult assignmentResult = event.getAssigmentResult();
|
||||
final DistributionSetTag tag = assignmentResult.getDistributionSetTag();
|
||||
if (isAssign(assignmentResult)) {
|
||||
addNewToken(tag.getId());
|
||||
@@ -212,9 +180,9 @@ public class DistributionTagToken extends AbstractTagToken {
|
||||
|
||||
}
|
||||
|
||||
protected boolean isAssign(final DistributionSetTagAssigmentResult assignmentResult) {
|
||||
protected boolean isAssign(final DistributionSetTagAssignmentResult assignmentResult) {
|
||||
if (assignmentResult.getAssigned() > 0) {
|
||||
final List<Long> assignedDsNames = assignmentResult.getAssignedDs().stream().map(t -> t.getId())
|
||||
final List<Long> assignedDsNames = assignmentResult.getAssignedEntity().stream().map(t -> t.getId())
|
||||
.collect(Collectors.toList());
|
||||
if (assignedDsNames.contains(managementUIState.getLastSelectedDsIdName().getId())) {
|
||||
return true;
|
||||
@@ -223,9 +191,9 @@ public class DistributionTagToken extends AbstractTagToken {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isUnassign(final DistributionSetTagAssigmentResult assignmentResult) {
|
||||
protected boolean isUnassign(final DistributionSetTagAssignmentResult assignmentResult) {
|
||||
if (assignmentResult.getUnassigned() > 0) {
|
||||
final List<Long> assignedDsNames = assignmentResult.getUnassignedDs().stream().map(t -> t.getId())
|
||||
final List<Long> assignedDsNames = assignmentResult.getUnassignedEntity().stream().map(t -> t.getId())
|
||||
.collect(Collectors.toList());
|
||||
if (assignedDsNames.contains(managementUIState.getLastSelectedDsIdName().getId())) {
|
||||
return true;
|
||||
@@ -234,6 +202,7 @@ public class DistributionTagToken extends AbstractTagToken {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
|
||||
@@ -19,7 +19,7 @@ import org.eclipse.hawkbit.eventbus.event.TargetTagUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTagAssigmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
|
||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentEvent;
|
||||
@@ -32,6 +32,7 @@ import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
import com.vaadin.data.Item;
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
import com.vaadin.ui.UI;
|
||||
|
||||
/**
|
||||
* Implementation of Target tag token.
|
||||
@@ -68,7 +69,7 @@ public class TargetTagToken extends AbstractTargetTagToken {
|
||||
@Override
|
||||
protected void assignTag(final String tagNameSelected) {
|
||||
if (tagNameSelected != null) {
|
||||
final TargetTagAssigmentResult result = toggleAssignment(tagNameSelected);
|
||||
final TargetTagAssignmentResult result = toggleAssignment(tagNameSelected);
|
||||
if (result.getAssigned() >= 1 && NOTAGS_SELECTED) {
|
||||
eventBus.publish(this, ManagementUIEvent.ASSIGN_TARGET_TAG);
|
||||
}
|
||||
@@ -77,17 +78,17 @@ public class TargetTagToken extends AbstractTargetTagToken {
|
||||
}
|
||||
}
|
||||
|
||||
private TargetTagAssigmentResult toggleAssignment(final String tagNameSelected) {
|
||||
private TargetTagAssignmentResult toggleAssignment(final String tagNameSelected) {
|
||||
final Set<String> targetList = new HashSet<>();
|
||||
targetList.add(selectedTarget.getControllerId());
|
||||
final TargetTagAssigmentResult result = targetManagement.toggleTagAssignment(targetList, tagNameSelected);
|
||||
uinotification.displaySuccess(HawkbitCommonUtil.getTargetTagAssigmentMsg(tagNameSelected, result, i18n));
|
||||
final TargetTagAssignmentResult result = targetManagement.toggleTagAssignment(targetList, tagNameSelected);
|
||||
uinotification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(tagNameSelected, result, i18n));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void unassignTag(final String tagName) {
|
||||
final TargetTagAssigmentResult result = toggleAssignment(tagName);
|
||||
final TargetTagAssignmentResult result = toggleAssignment(tagName);
|
||||
if (result.getUnassigned() >= 1 && (isClickedTagListEmpty() || getClickedTagList().contains(tagName))) {
|
||||
eventBus.publish(this, ManagementUIEvent.UNASSIGN_TARGET_TAG);
|
||||
}
|
||||
@@ -139,7 +140,7 @@ public class TargetTagToken extends AbstractTargetTagToken {
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onTargetTagAssigmentResultEvent(final TargetTagAssigmentResultEvent event) {
|
||||
final TargetTagAssigmentResult assignmentResult = event.getAssigmentResult();
|
||||
final TargetTagAssignmentResult assignmentResult = event.getAssigmentResult();
|
||||
final TargetTag targetTag = assignmentResult.getTargetTag();
|
||||
if (isAssign(assignmentResult)) {
|
||||
addNewToken(targetTag.getId());
|
||||
@@ -149,9 +150,9 @@ public class TargetTagToken extends AbstractTargetTagToken {
|
||||
|
||||
}
|
||||
|
||||
protected boolean isAssign(final TargetTagAssigmentResult assignmentResult) {
|
||||
protected boolean isAssign(final TargetTagAssignmentResult assignmentResult) {
|
||||
if (assignmentResult.getAssigned() > 0) {
|
||||
final List<String> assignedTargetNames = assignmentResult.getAssignedTargets().stream()
|
||||
final List<String> assignedTargetNames = assignmentResult.getAssignedEntity().stream()
|
||||
.map(t -> t.getControllerId()).collect(Collectors.toList());
|
||||
if (assignedTargetNames.contains(managementUIState.getLastSelectedTargetIdName().getControllerId())) {
|
||||
return true;
|
||||
@@ -160,9 +161,9 @@ public class TargetTagToken extends AbstractTargetTagToken {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isUnassign(final TargetTagAssigmentResult assignmentResult) {
|
||||
protected boolean isUnassign(final TargetTagAssignmentResult assignmentResult) {
|
||||
if (assignmentResult.getUnassigned() > 0) {
|
||||
final List<String> unassignedTargetNamesList = assignmentResult.getUnassignedTargets().stream()
|
||||
final List<String> unassignedTargetNamesList = assignmentResult.getUnassignedEntity().stream()
|
||||
.map(t -> t.getControllerId()).collect(Collectors.toList());
|
||||
if (unassignedTargetNamesList.contains(managementUIState.getLastSelectedTargetIdName().getControllerId())) {
|
||||
return true;
|
||||
@@ -175,10 +176,7 @@ public class TargetTagToken extends AbstractTargetTagToken {
|
||||
void onEvent(final TargetTableEvent targetTableEvent) {
|
||||
if (targetTableEvent.getTargetComponentEvent() == TargetComponentEvent.SELECTED_TARGET
|
||||
&& targetTableEvent.getTarget() != null) {
|
||||
ui.access(() -> {
|
||||
/**
|
||||
* targetTableEvent.getTarget() is null when table has no data.
|
||||
*/
|
||||
UI.getCurrent().access(() -> {
|
||||
selectedTarget = targetTableEvent.getTarget();
|
||||
repopulateToken();
|
||||
});
|
||||
|
||||
@@ -8,10 +8,7 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.distributions.disttype;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.ui.common.DistributionSetTypeBeanQuery;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtonClickBehaviour;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtons;
|
||||
import org.eclipse.hawkbit.ui.distributions.event.DistributionSetTypeEvent;
|
||||
import org.eclipse.hawkbit.ui.distributions.event.DistributionsViewAcceptCriteria;
|
||||
@@ -23,7 +20,6 @@ import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
@@ -45,27 +41,12 @@ public class DSTypeFilterButtons extends AbstractFilterButtons {
|
||||
|
||||
private static final long serialVersionUID = 771251569981876005L;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private ManageDistUIState manageDistUIState;
|
||||
|
||||
@Autowired
|
||||
private DistributionsViewAcceptCriteria distributionsViewAcceptCriteria;
|
||||
|
||||
/**
|
||||
* Initialize component.
|
||||
*
|
||||
* @param filterButtonClickBehaviour
|
||||
* the clickable behaviour.
|
||||
*/
|
||||
@Override
|
||||
public void init(final AbstractFilterButtonClickBehaviour filterButtonClickBehaviour) {
|
||||
super.init(filterButtonClickBehaviour);
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getButtonsTableId() {
|
||||
|
||||
@@ -79,10 +60,9 @@ public class DSTypeFilterButtons extends AbstractFilterButtons {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isClickedByDefault(final Long buttonId) {
|
||||
|
||||
protected boolean isClickedByDefault(final String typeName) {
|
||||
return manageDistUIState.getManageDistFilters().getClickedDistSetType() != null
|
||||
&& manageDistUIState.getManageDistFilters().getClickedDistSetType().getId().equals(buttonId);
|
||||
&& manageDistUIState.getManageDistFilters().getClickedDistSetType().getName().equals(typeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -141,9 +121,4 @@ public class DSTypeFilterButtons extends AbstractFilterButtons {
|
||||
setContainerDataSource(createButtonsLazyQueryContainer());
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,14 +10,12 @@ package org.eclipse.hawkbit.ui.distributions.disttype;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader;
|
||||
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
|
||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
@@ -34,12 +32,6 @@ public class DSTypeFilterHeader extends AbstractFilterHeader {
|
||||
|
||||
private static final long serialVersionUID = 3433417459392880222L;
|
||||
|
||||
@Autowired
|
||||
private SpPermissionChecker permChecker;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventbus;
|
||||
|
||||
@Autowired
|
||||
private ManageDistUIState manageDistUIState;
|
||||
|
||||
@@ -81,8 +73,7 @@ public class DSTypeFilterHeader extends AbstractFilterHeader {
|
||||
@Override
|
||||
protected void hideFilterButtonLayout() {
|
||||
manageDistUIState.setDistTypeFilterClosed(true);
|
||||
eventbus.publish(this, DistributionsUIEvent.HIDE_DIST_FILTER_BY_TYPE);
|
||||
|
||||
eventBus.publish(this, DistributionsUIEvent.HIDE_DIST_FILTER_BY_TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,12 +13,8 @@ import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
@@ -37,10 +33,8 @@ import org.eclipse.hawkbit.ui.management.dstable.DistributionAddUpdateWindowLayo
|
||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent.DistributionComponentEvent;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
@@ -72,15 +66,6 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
||||
|
||||
private static final String UNASSIGN_SOFT_MODULE = "unassignSoftModule";
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private SpPermissionChecker permissionChecker;
|
||||
|
||||
@Autowired
|
||||
private ManageDistUIState manageDistUIState;
|
||||
|
||||
@@ -104,21 +89,16 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
||||
|
||||
private Long dsId;
|
||||
|
||||
private UI ui;
|
||||
|
||||
Map<String, StringBuilder> assignedSWModule = new HashMap<>();
|
||||
|
||||
/**
|
||||
* softwareLayout Initialize the component.
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
softwareModuleTable = new SoftwareModuleDetailsTable();
|
||||
softwareModuleTable.init(i18n, true, permissionChecker, distributionSetManagement, eventBus, manageDistUIState);
|
||||
super.init();
|
||||
ui = UI.getCurrent();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
protected VerticalLayout createTagsLayout() {
|
||||
@@ -321,12 +301,6 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
||||
this.dsId = dsId;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* onEdit(com.vaadin.ui .Button.ClickEvent)
|
||||
*/
|
||||
@Override
|
||||
protected void onEdit(final ClickEvent event) {
|
||||
final Window newDistWindow = distributionAddUpdateWindowLayout.getWindow();
|
||||
@@ -336,68 +310,32 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
||||
newDistWindow.setVisible(Boolean.TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* getEditButtonId()
|
||||
*/
|
||||
@Override
|
||||
protected String getEditButtonId() {
|
||||
return SPUIComponetIdProvider.DS_EDIT_BUTTON;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* onLoadIsSwModuleSelected ()
|
||||
*/
|
||||
@Override
|
||||
protected Boolean onLoadIsTableRowSelected() {
|
||||
return manageDistUIState.getSelectedDistributions().isPresent()
|
||||
&& !manageDistUIState.getSelectedDistributions().get().isEmpty();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* onLoadIsTableMaximized ()
|
||||
*/
|
||||
@Override
|
||||
protected Boolean onLoadIsTableMaximized() {
|
||||
return manageDistUIState.isDsTableMaximized();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* populateDetailsWidget()
|
||||
*/
|
||||
@Override
|
||||
protected void populateDetailsWidget() {
|
||||
populateDetailsWidget(selectedDsModule);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* getDefaultCaption()
|
||||
*/
|
||||
@Override
|
||||
protected String getDefaultCaption() {
|
||||
return i18n.get("distribution.details.header");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* addTabs(com.vaadin. ui.TabSheet)
|
||||
*/
|
||||
@Override
|
||||
protected void addTabs(final TabSheet detailsTab) {
|
||||
detailsTab.addTab(createDetailsLayout(), i18n.get("caption.tab.details"), null);
|
||||
@@ -407,23 +345,11 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
||||
detailsTab.addTab(createLogLayout(), i18n.get("caption.logs.tab"), null);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* clearDetails()
|
||||
*/
|
||||
@Override
|
||||
protected void clearDetails() {
|
||||
populateDetailsWidget(null);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* hasEditSoftwareModulePermission()
|
||||
*/
|
||||
@Override
|
||||
protected Boolean hasEditPermission() {
|
||||
return permissionChecker.hasUpdateDistributionPermission();
|
||||
@@ -476,7 +402,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final SaveActionWindowEvent saveActionWindowEvent) {
|
||||
if ((saveActionWindowEvent == SaveActionWindowEvent.SAVED_ASSIGNMENTS
|
||||
@@ -498,21 +424,6 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
||||
}
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
/*
|
||||
* It's good to do this, even though vaadin-spring will automatically
|
||||
* unsubscribe .
|
||||
*/
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* getTabSheetId()
|
||||
*/
|
||||
@Override
|
||||
protected String getTabSheetId() {
|
||||
return null;
|
||||
|
||||
@@ -8,10 +8,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.distributions.dstable;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.common.table.AbstractTableHeader;
|
||||
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
|
||||
import org.eclipse.hawkbit.ui.distributions.event.DragEvent;
|
||||
@@ -20,10 +16,8 @@ import org.eclipse.hawkbit.ui.management.dstable.DistributionAddUpdateWindowLayo
|
||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent.DistributionComponentEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableFilterEvent;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
@@ -43,28 +37,12 @@ public class DistributionSetTableHeader extends AbstractTableHeader {
|
||||
|
||||
private static final long serialVersionUID = -3483238438474530748L;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private SpPermissionChecker permChecker;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventbus;
|
||||
|
||||
@Autowired
|
||||
private ManageDistUIState manageDistUIstate;
|
||||
|
||||
@Autowired
|
||||
private DistributionAddUpdateWindowLayout addUpdateWindowLayout;
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
eventbus.subscribe(this);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final DistributionsUIEvent event) {
|
||||
if (event == DistributionsUIEvent.HIDE_DIST_FILTER_BY_TYPE) {
|
||||
@@ -181,11 +159,6 @@ public class DistributionSetTableHeader extends AbstractTableHeader {
|
||||
eventbus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventbus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Boolean isAddNewItemAllowed() {
|
||||
return Boolean.TRUE;
|
||||
|
||||
@@ -16,10 +16,6 @@ import java.util.Map;
|
||||
import org.eclipse.hawkbit.ui.common.AbstractAcceptCriteria;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
@@ -39,29 +35,6 @@ public class DistributionsViewAcceptCriteria extends AbstractAcceptCriteria {
|
||||
|
||||
private static final Map<String, List<String>> DROP_CONFIGS = createDropConfigurations();
|
||||
|
||||
@Autowired
|
||||
private transient UINotification uiNotification;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Override
|
||||
protected void analyseDragComponent(final Component compsource) {
|
||||
final String sourceID = getComponentId(compsource);
|
||||
final Object event = DROP_HINTS_CONFIGS.get(sourceID);
|
||||
eventBus.publish(this, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void hideDropHints() {
|
||||
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void invalidDrop() {
|
||||
uiNotification.displayValidationError(SPUILabelDefinitions.ACTION_NOT_ALLOWED);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getComponentId(final Component component) {
|
||||
String id = component.getId();
|
||||
@@ -78,11 +51,6 @@ public class DistributionsViewAcceptCriteria extends AbstractAcceptCriteria {
|
||||
return DROP_HINTS_CONFIGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void publishDragStartEvent(final Object event) {
|
||||
eventBus.publish(this, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, List<String>> getDropConfigurations() {
|
||||
return DROP_CONFIGS;
|
||||
|
||||
@@ -15,10 +15,6 @@ import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.SystemManagement;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
@@ -30,13 +26,10 @@ import org.eclipse.hawkbit.ui.distributions.event.DragEvent;
|
||||
import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
|
||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
@@ -65,21 +58,6 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
Arrays.asList(DragEvent.DISTRIBUTION_TYPE_DRAG, DragEvent.DISTRIBUTION_DRAG, DragEvent.SOFTWAREMODULE_DRAG,
|
||||
DragEvent.SOFTWAREMODULE_TYPE_DRAG));
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private SpPermissionChecker permChecker;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private transient UINotification notification;
|
||||
|
||||
@Autowired
|
||||
private transient UINotification uiNotification;
|
||||
|
||||
@Autowired
|
||||
private transient SystemManagement systemManagement;
|
||||
|
||||
@@ -92,28 +70,6 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
@Autowired
|
||||
private DistributionsViewAcceptCriteria distributionsViewAcceptCriteria;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.DeleteActionsLayout#init()
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
/*
|
||||
* It's good manners to do this, even though vaadin-spring will
|
||||
* automatically unsubscribe when this UI is garbage collected.
|
||||
*/
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final DragEvent event) {
|
||||
if (event == DragEvent.HIDE_DROP_HINT) {
|
||||
@@ -139,77 +95,34 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* hasDeletePermission()
|
||||
*/
|
||||
@Override
|
||||
protected boolean hasDeletePermission() {
|
||||
return permChecker.hasDeleteDistributionPermission();
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* hasUpdatePermission()
|
||||
*/
|
||||
@Override
|
||||
protected boolean hasUpdatePermission() {
|
||||
|
||||
return permChecker.hasUpdateDistributionPermission();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* getDeleteAreaLabel()
|
||||
*/
|
||||
@Override
|
||||
protected String getDeleteAreaLabel() {
|
||||
return i18n.get("label.components.drop.area");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* getDeleteAreaId()
|
||||
*/
|
||||
@Override
|
||||
protected String getDeleteAreaId() {
|
||||
|
||||
return SPUIComponetIdProvider.DELETE_BUTTON_WRAPPER_ID;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* getDeleteLayoutAcceptCriteria ()
|
||||
*/
|
||||
@Override
|
||||
protected AcceptCriterion getDeleteLayoutAcceptCriteria() {
|
||||
|
||||
return distributionsViewAcceptCriteria;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* processDroppedComponent(com .vaadin.event.dd.DragAndDropEvent)
|
||||
*/
|
||||
@Override
|
||||
protected void processDroppedComponent(final DragAndDropEvent event) {
|
||||
final Component sourceComponent = event.getTransferable().getSourceComponent();
|
||||
@@ -298,7 +211,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
* message accordingly.
|
||||
*/
|
||||
|
||||
uiNotification.displayValidationError(i18n.get("message.targets.already.deleted"));
|
||||
notification.displayValidationError(i18n.get("message.targets.already.deleted"));
|
||||
} else if (newDeletedDistributionsSize - existingDeletedDistributionsSize != distributionIdNameSet.size()) {
|
||||
/*
|
||||
* Not the all distributions dropped now are added to the delete
|
||||
@@ -306,7 +219,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
* delete list. Hence display warning message accordingly.
|
||||
*/
|
||||
|
||||
uiNotification.displayValidationError(i18n.get("message.dist.deleted.pending"));
|
||||
notification.displayValidationError(i18n.get("message.dist.deleted.pending"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -366,64 +279,12 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
return SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE.equals(source.getId());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* getNoActionsButtonLabel()
|
||||
*/
|
||||
@Override
|
||||
protected String getNoActionsButtonLabel() {
|
||||
return i18n.get("button.no.actions");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* getActionsButtonLabel()
|
||||
*/
|
||||
@Override
|
||||
protected String getActionsButtonLabel() {
|
||||
|
||||
return i18n.get("button.actions");
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* reloadActionCount()
|
||||
*/
|
||||
@Override
|
||||
protected void restoreActionCount() {
|
||||
updateDSActionCount();
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* getUnsavedActionsWindowCaption ()
|
||||
*/
|
||||
@Override
|
||||
protected String getUnsavedActionsWindowCaption() {
|
||||
return i18n.get("caption.save.window");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* unsavedActionsWindowClosed()
|
||||
*/
|
||||
@Override
|
||||
protected void unsavedActionsWindowClosed() {
|
||||
final String message = distConfirmationWindowLayout.getConsolidatedMessage();
|
||||
@@ -433,26 +294,12 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* getUnsavedActionsWindowContent ()
|
||||
*/
|
||||
@Override
|
||||
protected Component getUnsavedActionsWindowContent() {
|
||||
distConfirmationWindowLayout.init();
|
||||
return distConfirmationWindowLayout;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* hasUnsavedActions()
|
||||
*/
|
||||
@Override
|
||||
protected boolean hasUnsavedActions() {
|
||||
boolean unSavedActionsTypes = false;
|
||||
@@ -479,23 +326,11 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* hasBulkUploadPermission()
|
||||
*/
|
||||
@Override
|
||||
protected boolean hasBulkUploadPermission() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* showBulkUploadWindow()
|
||||
*/
|
||||
@Override
|
||||
protected void showBulkUploadWindow() {
|
||||
/**
|
||||
@@ -503,12 +338,6 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* restoreBulkUploadStatusCount()
|
||||
*/
|
||||
@Override
|
||||
protected void restoreBulkUploadStatusCount() {
|
||||
/**
|
||||
|
||||
@@ -22,8 +22,6 @@ import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
||||
import org.springframework.data.domain.Slice;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
|
||||
import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
|
||||
|
||||
@@ -79,9 +77,8 @@ public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem>
|
||||
final Slice<CustomSoftwareModule> swModuleBeans;
|
||||
final List<ProxyBaseSwModuleItem> proxyBeans = new ArrayList<>();
|
||||
|
||||
swModuleBeans = getSoftwareManagement().findSoftwareModuleOrderByDistribution(
|
||||
new OffsetBasedPageRequest(startIndex, count, new Sort(Direction.ASC, "name", "version")),
|
||||
orderByDistId, searchText, type);
|
||||
swModuleBeans = getSoftwareManagement().findSoftwareModuleOrderBySetAssignmentAndModuleNameAscModuleVersionAsc(
|
||||
new OffsetBasedPageRequest(startIndex, count), orderByDistId, searchText, type);
|
||||
|
||||
for (final CustomSoftwareModule swModule : swModuleBeans) {
|
||||
proxyBeans.add(getProxyBean(swModule));
|
||||
|
||||
@@ -8,10 +8,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.distributions.smtable;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
|
||||
@@ -20,10 +16,8 @@ import org.eclipse.hawkbit.ui.common.detailslayout.AbstractTableDetailsLayout;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
@@ -46,44 +40,16 @@ public class SwModuleDetails extends AbstractTableDetailsLayout {
|
||||
|
||||
private static final long serialVersionUID = -1052279281066089812L;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private SpPermissionChecker permissionChecker;
|
||||
|
||||
@Autowired
|
||||
private SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow;
|
||||
|
||||
@Autowired
|
||||
private ManageDistUIState manageDistUIState;
|
||||
|
||||
private UI ui;
|
||||
|
||||
private Long swModuleId;
|
||||
|
||||
private SoftwareModule selectedSwModule;
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
ui = UI.getCurrent();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
/*
|
||||
* It's good manners to do this, even though vaadin-spring will
|
||||
* automatically unsubscribe when this UI is garbage collected.
|
||||
*/
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final SoftwareModuleEvent softwareModuleEvent) {
|
||||
if (softwareModuleEvent.getSoftwareModuleEventType() == SoftwareModuleEventType.SELECTED_SOFTWARE_MODULE
|
||||
|
||||
@@ -8,10 +8,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.distributions.smtable;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
|
||||
@@ -19,10 +15,8 @@ import org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleAddUpdateWindow;
|
||||
import org.eclipse.hawkbit.ui.common.table.AbstractTableHeader;
|
||||
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
|
||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
@@ -43,14 +37,6 @@ public class SwModuleTableHeader extends AbstractTableHeader {
|
||||
|
||||
private static final long serialVersionUID = 242961845006626297L;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private SpPermissionChecker permChecker;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventbus;
|
||||
|
||||
@Autowired
|
||||
private ManageDistUIState manageDistUIState;
|
||||
@@ -58,18 +44,6 @@ public class SwModuleTableHeader extends AbstractTableHeader {
|
||||
@Autowired
|
||||
private SoftwareModuleAddUpdateWindow softwareModuleAddUpdateWindow;
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
eventbus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventbus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final DistributionsUIEvent event) {
|
||||
if (event == DistributionsUIEvent.HIDE_SM_FILTER_BY_TYPE) {
|
||||
|
||||
@@ -11,11 +11,8 @@ package org.eclipse.hawkbit.ui.distributions.smtype;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent;
|
||||
import org.eclipse.hawkbit.ui.common.SoftwareModuleTypeBeanQuery;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtonClickBehaviour;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtons;
|
||||
import org.eclipse.hawkbit.ui.distributions.event.DistributionsViewAcceptCriteria;
|
||||
import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
|
||||
@@ -27,7 +24,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
@@ -47,21 +43,12 @@ public class DistSMTypeFilterButtons extends AbstractFilterButtons {
|
||||
|
||||
private static final long serialVersionUID = 6804534533362387433L;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private ManageDistUIState manageDistUIState;
|
||||
|
||||
@Autowired
|
||||
private DistributionsViewAcceptCriteria distributionsViewAcceptCriteria;
|
||||
|
||||
@Override
|
||||
public void init(final AbstractFilterButtonClickBehaviour filterButtonClickBehaviour) {
|
||||
super.init(filterButtonClickBehaviour);
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getButtonsTableId() {
|
||||
return SPUIComponetIdProvider.SW_MODULE_TYPE_TABLE_ID;
|
||||
@@ -82,10 +69,9 @@ public class DistSMTypeFilterButtons extends AbstractFilterButtons {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isClickedByDefault(final Long buttonId) {
|
||||
|
||||
protected boolean isClickedByDefault(final String typeName) {
|
||||
return manageDistUIState.getSoftwareModuleFilters().getSoftwareModuleType().isPresent()
|
||||
&& manageDistUIState.getSoftwareModuleFilters().getSoftwareModuleType().get().getId().equals(buttonId);
|
||||
&& manageDistUIState.getSoftwareModuleFilters().getSoftwareModuleType().get().getName().equals(typeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -136,9 +122,5 @@ public class DistSMTypeFilterButtons extends AbstractFilterButtons {
|
||||
setContainerDataSource(createButtonsLazyQueryContainer());
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ package org.eclipse.hawkbit.ui.distributions.smtype;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.artifacts.smtype.CreateUpdateSoftwareTypeLayout;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader;
|
||||
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
|
||||
@@ -19,7 +18,6 @@ import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
@@ -36,12 +34,6 @@ public class DistSMTypeFilterHeader extends AbstractFilterHeader {
|
||||
|
||||
private static final long serialVersionUID = -8763788280848718344L;
|
||||
|
||||
@Autowired
|
||||
private SpPermissionChecker permChecker;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private ManageDistUIState manageDistUIState;
|
||||
|
||||
|
||||
@@ -8,10 +8,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.management.dstable;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractTableDetailsLayout;
|
||||
import org.eclipse.hawkbit.ui.common.detailslayout.SoftwareModuleDetailsTable;
|
||||
@@ -21,10 +17,8 @@ import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent.DistributionComponentEvent;
|
||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
@@ -46,15 +40,7 @@ public class DistributionDetails extends AbstractTableDetailsLayout {
|
||||
|
||||
private static final long serialVersionUID = 350360207334118826L;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private SpPermissionChecker permissionChecker;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ManagementUIState managementUIState;
|
||||
|
||||
@@ -70,22 +56,13 @@ public class DistributionDetails extends AbstractTableDetailsLayout {
|
||||
|
||||
private DistributionSet selectedDsModule;
|
||||
|
||||
private UI ui;
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
eventBus.subscribe(this);
|
||||
softwareModuleTable = new SoftwareModuleDetailsTable();
|
||||
softwareModuleTable.init(i18n, false, permissionChecker, null, null, null);
|
||||
super.init();
|
||||
ui = UI.getCurrent();
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final DistributionTableEvent distributionTableEvent) {
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssigmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
||||
@@ -360,10 +360,10 @@ public class DistributionTable extends AbstractTable {
|
||||
final String distTagName = HawkbitCommonUtil.removePrefix(event.getTransferable().getSourceComponent().getId(),
|
||||
SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS);
|
||||
|
||||
final DistributionSetTagAssigmentResult result = distributionSetManagement.toggleTagAssignment(distList,
|
||||
final DistributionSetTagAssignmentResult result = distributionSetManagement.toggleTagAssignment(distList,
|
||||
distTagName);
|
||||
|
||||
notification.displaySuccess(HawkbitCommonUtil.getDistributionTagAssignmentMsg(distTagName, result, i18n));
|
||||
notification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(distTagName, result, i18n));
|
||||
if (result.getAssigned() >= 1 && managementUIState.getDistributionTableFilters().isNoTagSelected()) {
|
||||
refreshFilter();
|
||||
}
|
||||
@@ -564,7 +564,7 @@ public class DistributionTable extends AbstractTable {
|
||||
.getItemProperty(SPUILabelDefinitions.VAR_DIST_ID_NAME).getValue();
|
||||
final Button pinBtn = getPinBtn(itemId, dist.getName(), dist.getVersion());
|
||||
saveDistributionPinnedBtn(pinBtn);
|
||||
pinBtn.addClickListener(event -> addPinClickListener(event));
|
||||
pinBtn.addClickListener(this::addPinClickListener);
|
||||
rePinDistribution(pinBtn, dist.getId());
|
||||
return pinBtn;
|
||||
}
|
||||
|
||||
@@ -8,10 +8,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.management.dstable;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.common.table.AbstractTableHeader;
|
||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent.DistributionComponentEvent;
|
||||
@@ -19,10 +15,8 @@ import org.eclipse.hawkbit.ui.management.event.DistributionTableFilterEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
@@ -43,33 +37,12 @@ import com.vaadin.ui.Window;
|
||||
public class DistributionTableHeader extends AbstractTableHeader {
|
||||
private static final long serialVersionUID = 7597766804650170127L;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private SpPermissionChecker permChecker;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventbus;
|
||||
|
||||
@Autowired
|
||||
private ManagementUIState managementUIState;
|
||||
|
||||
@Autowired
|
||||
private DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout;
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
eventbus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventbus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final ManagementUIEvent event) {
|
||||
if (event == ManagementUIEvent.HIDE_DISTRIBUTION_TAG_LAYOUT) {
|
||||
|
||||
@@ -11,12 +11,9 @@ package org.eclipse.hawkbit.ui.management.dstag;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagCreatedBulkEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagDeletedEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.TagManagement;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtonClickBehaviour;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtons;
|
||||
@@ -32,7 +29,6 @@ import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
@@ -52,15 +48,9 @@ public class DistributionTagButtons extends AbstractFilterButtons {
|
||||
|
||||
private static final long serialVersionUID = -8151483237450892057L;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private DistributionTagDropEvent spDistTagDropEvent;
|
||||
|
||||
@Autowired
|
||||
private transient TagManagement tagMgmtService;
|
||||
|
||||
@Autowired
|
||||
private ManagementUIState managementUIState;
|
||||
|
||||
@@ -68,12 +58,6 @@ public class DistributionTagButtons extends AbstractFilterButtons {
|
||||
public void init(final AbstractFilterButtonClickBehaviour filterButtonClickBehaviour) {
|
||||
super.init(filterButtonClickBehaviour);
|
||||
addNewTag(new DistributionSetTag("NO TAG"));
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
@@ -121,10 +105,9 @@ public class DistributionTagButtons extends AbstractFilterButtons {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isClickedByDefault(final Long buttonId) {
|
||||
final DistributionSetTag dsTagObject = tagMgmtService.findDistributionSetTagById(buttonId);
|
||||
protected boolean isClickedByDefault(final String tagName) {
|
||||
return null != managementUIState.getDistributionTableFilters().getDistSetTags()
|
||||
&& managementUIState.getDistributionTableFilters().getDistSetTags().contains(dsTagObject.getName());
|
||||
&& managementUIState.getDistributionTableFilters().getDistSetTags().contains(tagName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,14 +10,12 @@ package org.eclipse.hawkbit.ui.management.dstag;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader;
|
||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
@@ -38,12 +36,6 @@ public class DistributionTagHeader extends AbstractFilterHeader {
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private SpPermissionChecker permChecker;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventbus;
|
||||
|
||||
@Autowired
|
||||
private ManagementUIState managementUIState;
|
||||
|
||||
@@ -90,7 +82,7 @@ public class DistributionTagHeader extends AbstractFilterHeader {
|
||||
@Override
|
||||
protected void hideFilterButtonLayout() {
|
||||
managementUIState.setDistTagFilterClosed(true);
|
||||
eventbus.publish(this, ManagementUIEvent.HIDE_DISTRIBUTION_TAG_LAYOUT);
|
||||
eventBus.publish(this, ManagementUIEvent.HIDE_DISTRIBUTION_TAG_LAYOUT);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.stream.Collectors;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssigmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
|
||||
import org.eclipse.hawkbit.ui.management.state.DistributionTableFilters;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
@@ -147,10 +147,10 @@ public class DistributionTagDropEvent implements DropHandler {
|
||||
SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS);
|
||||
|
||||
final List<String> tagsClickedList = distFilterParameters.getDistSetTags();
|
||||
final DistributionSetTagAssigmentResult result = distributionSetManagement.toggleTagAssignment(distributionList,
|
||||
final DistributionSetTagAssignmentResult result = distributionSetManagement.toggleTagAssignment(distributionList,
|
||||
distTagName);
|
||||
|
||||
notification.displaySuccess(HawkbitCommonUtil.getDistributionTagAssignmentMsg(distTagName, result, i18n));
|
||||
notification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(distTagName, result, i18n));
|
||||
if (result.getUnassigned() >= 1 && !tagsClickedList.isEmpty()) {
|
||||
eventBus.publish(this, TargetFilterEvent.FILTER_BY_TAG);
|
||||
}
|
||||
|
||||
@@ -16,10 +16,6 @@ import java.util.Map;
|
||||
import org.eclipse.hawkbit.ui.common.AbstractAcceptCriteria;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
@@ -41,29 +37,6 @@ public class ManagementViewAcceptCriteria extends AbstractAcceptCriteria {
|
||||
|
||||
private static final Map<String, Object> DROP_HINTS_CONFIGS = createDropHintConfigurations();
|
||||
|
||||
@Autowired
|
||||
private transient UINotification uiNotification;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Override
|
||||
protected void analyseDragComponent(final Component compsource) {
|
||||
final String sourceID = getComponentId(compsource);
|
||||
final Object event = DROP_HINTS_CONFIGS.get(sourceID);
|
||||
eventBus.publish(this, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void hideDropHints() {
|
||||
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void invalidDrop() {
|
||||
uiNotification.displayValidationError(SPUILabelDefinitions.ACTION_NOT_ALLOWED);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getComponentId(final Component component) {
|
||||
String id = component.getId();
|
||||
@@ -80,11 +53,6 @@ public class ManagementViewAcceptCriteria extends AbstractAcceptCriteria {
|
||||
return DROP_HINTS_CONFIGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void publishDragStartEvent(final Object event) {
|
||||
eventBus.publish(this, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, List<String>> getDropConfigurations() {
|
||||
return DROP_CONFIGS;
|
||||
|
||||
@@ -11,10 +11,6 @@ package org.eclipse.hawkbit.ui.management.footer;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.TagManagement;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||
@@ -28,12 +24,9 @@ import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentEvent;
|
||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
@@ -56,17 +49,6 @@ import com.vaadin.ui.UI;
|
||||
public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
private static final long serialVersionUID = -8112907467821886253L;
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private SpPermissionChecker permChecker;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private transient UINotification notification;
|
||||
|
||||
@Autowired
|
||||
private transient TagManagement tagManagementService;
|
||||
@@ -83,18 +65,6 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
@Autowired
|
||||
private CountMessageLabel countMessageLabel;
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final ManagementUIEvent event) {
|
||||
if (event == ManagementUIEvent.UPDATE_COUNT) {
|
||||
@@ -226,26 +196,11 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getNoActionsButtonLabel() {
|
||||
return i18n.get("button.no.actions");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getActionsButtonLabel() {
|
||||
return i18n.get("button.actions");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void restoreActionCount() {
|
||||
updateActionCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getUnsavedActionsWindowCaption() {
|
||||
return i18n.get("caption.save.window");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void unsavedActionsWindowClosed() {
|
||||
final String message = manangementConfirmationWindowLayout.getConsolidatedMessage();
|
||||
|
||||
@@ -10,11 +10,7 @@ package org.eclipse.hawkbit.ui.management.targettable;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
@@ -25,12 +21,10 @@ import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentEvent;
|
||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
@@ -60,15 +54,6 @@ public class TargetDetails extends AbstractTableDetailsLayout {
|
||||
|
||||
private static final long serialVersionUID = 4571732743399605843L;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private SpPermissionChecker permChecker;
|
||||
|
||||
@Autowired
|
||||
private ManagementUIState managementUIState;
|
||||
|
||||
@@ -87,11 +72,9 @@ public class TargetDetails extends AbstractTableDetailsLayout {
|
||||
* Initialize the Target details.
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
super.init();
|
||||
targetAddUpdateWindowLayout.init();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -286,7 +269,7 @@ public class TargetDetails extends AbstractTableDetailsLayout {
|
||||
|
||||
@Override
|
||||
protected Boolean hasEditPermission() {
|
||||
return permChecker.hasUpdateTargetPermission();
|
||||
return permissionChecker.hasUpdateTargetPermission();
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
@@ -312,11 +295,6 @@ public class TargetDetails extends AbstractTableDetailsLayout {
|
||||
}
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTabSheetId() {
|
||||
return SPUIComponetIdProvider.TARGET_DETAILS_TABSHEET;
|
||||
|
||||
@@ -15,7 +15,6 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -33,7 +32,7 @@ import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||
import org.eclipse.hawkbit.repository.model.TargetInfo;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTagAssigmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
||||
import org.eclipse.hawkbit.ui.filter.FilterExpression;
|
||||
@@ -105,12 +104,11 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
@ViewScope
|
||||
public class TargetTable extends AbstractTable implements Handler {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TargetTable.class);
|
||||
private static final String TARGET_PINNED = "targetPinned";
|
||||
|
||||
private static final long serialVersionUID = -2300392868806614568L;
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TargetTable.class);
|
||||
|
||||
private static final int PROPERTY_DEPT = 3;
|
||||
private static final String ITEMID = "itemId";
|
||||
private static final String ACTION_NOT_ALLOWED_MSG = "message.action.not.allowed";
|
||||
@@ -141,8 +139,6 @@ public class TargetTable extends AbstractTable implements Handler {
|
||||
private Boolean isTargetPinned = Boolean.FALSE;
|
||||
private ShortcutAction actionSelectAll;
|
||||
private ShortcutAction actionUnSelectAll;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
@@ -329,38 +325,20 @@ public class TargetTable extends AbstractTable implements Handler {
|
||||
(source, itemId, columnId) -> getTagetPollTime(itemId));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTable#
|
||||
* isFirstRowSelectedOnLoad ()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isFirstRowSelectedOnLoad() {
|
||||
return !managementUIState.getSelectedTargetIdName().isPresent()
|
||||
|| managementUIState.getSelectedTargetIdName().get().isEmpty();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTable#getItemIdToSelect()
|
||||
*/
|
||||
@Override
|
||||
protected Object getItemIdToSelect() {
|
||||
if (managementUIState.getSelectedTargetIdName().isPresent()) {
|
||||
setCurrentPageFirstItemId(managementUIState.getLastSelectedTargetIdName());
|
||||
return managementUIState.getSelectedTargetIdName().get();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#onValueChange()
|
||||
*/
|
||||
@Override
|
||||
protected void onValueChange() {
|
||||
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
||||
@@ -380,23 +358,11 @@ public class TargetTable extends AbstractTable implements Handler {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#isMaximized()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isMaximized() {
|
||||
return managementUIState.isTargetTableMaximized();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTable#getTableVisibleColumns
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
protected List<TableColumn> getTableVisibleColumns() {
|
||||
final List<TableColumn> columnList = new ArrayList<>();
|
||||
@@ -453,13 +419,29 @@ public class TargetTable extends AbstractTable implements Handler {
|
||||
} else {
|
||||
shouldRefreshTargets = true;
|
||||
}
|
||||
unselect(targetIdName);
|
||||
}
|
||||
|
||||
if (shouldRefreshTargets) {
|
||||
refreshOnDelete();
|
||||
} else {
|
||||
targetContainer.commit();
|
||||
selectRow();
|
||||
}
|
||||
reSelectItemsAfterDeletionEvent();
|
||||
}
|
||||
|
||||
private void reSelectItemsAfterDeletionEvent() {
|
||||
Set<Object> values = new HashSet<>();
|
||||
if (isMultiSelect()) {
|
||||
values = new HashSet<>((Set<?>) getValue());
|
||||
} else {
|
||||
values.add(getValue());
|
||||
}
|
||||
unSelectAll();
|
||||
|
||||
for (final Object value : values) {
|
||||
if (getVisibleItemIds().contains(value)) {
|
||||
select(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -659,10 +641,10 @@ public class TargetTable extends AbstractTable implements Handler {
|
||||
}
|
||||
final String targTagName = HawkbitCommonUtil.removePrefix(event.getTransferable().getSourceComponent().getId(),
|
||||
SPUIDefinitions.TARGET_TAG_ID_PREFIXS);
|
||||
final TargetTagAssigmentResult result = targetManagement.toggleTagAssignment(targetList, targTagName);
|
||||
final TargetTagAssignmentResult result = targetManagement.toggleTagAssignment(targetList, targTagName);
|
||||
|
||||
final List<String> tagsClickedList = managementUIState.getTargetTableFilters().getClickedTargetTags();
|
||||
notification.displaySuccess(HawkbitCommonUtil.getTargetTagAssigmentMsg(targTagName, result, i18n));
|
||||
notification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(targTagName, result, i18n));
|
||||
if (result.getUnassigned() >= 1 && !tagsClickedList.isEmpty()) {
|
||||
refreshFilter();
|
||||
}
|
||||
@@ -1038,7 +1020,7 @@ public class TargetTable extends AbstractTable implements Handler {
|
||||
final String[] tagArray = tagList.toArray(new String[tagList.size()]);
|
||||
|
||||
List<TargetIdName> targetIdList;
|
||||
targetIdList = targetManagement.findAllTargetIdsByFilters(pageRequest, filterByDistId, statusList, searchText,
|
||||
targetIdList = targetManagement.findAllTargetIdsByFilters(pageRequest, statusList, searchText, filterByDistId,
|
||||
noTagSelected, tagList.toArray(tagArray));
|
||||
Collections.reverse(targetIdList);
|
||||
return targetIdList;
|
||||
|
||||
@@ -11,10 +11,6 @@ package org.eclipse.hawkbit.ui.management.targettable;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
||||
import org.eclipse.hawkbit.ui.common.table.AbstractTableHeader;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
@@ -29,7 +25,6 @@ import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentEvent;
|
||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUITargetDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
@@ -63,12 +58,6 @@ public class TargetTableHeader extends AbstractTableHeader {
|
||||
|
||||
private static final long serialVersionUID = -8647521126666320022L;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private SpPermissionChecker permChecker;
|
||||
|
||||
@Autowired
|
||||
private UINotification notification;
|
||||
|
||||
@@ -90,21 +79,14 @@ public class TargetTableHeader extends AbstractTableHeader {
|
||||
private Boolean isComplexFilterViewDisplayed = Boolean.FALSE;
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
// creating add window for adding new target
|
||||
targetAddUpdateWindow.init();
|
||||
targetBulkUpdateWindow.init();
|
||||
eventBus.subscribe(this);
|
||||
onLoadRestoreState();
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final ManagementUIEvent event) {
|
||||
if (event == ManagementUIEvent.HIDE_TARGET_TAG_LAYOUT) {
|
||||
|
||||
@@ -13,17 +13,14 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetTagCreatedBulkEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetTagDeletedEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetTagUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.TagManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTagAssigmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtons;
|
||||
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||
@@ -39,7 +36,6 @@ import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
@@ -64,15 +60,9 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
|
||||
|
||||
private static final long serialVersionUID = 5049554600376508073L;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private ManagementUIState managementUIState;
|
||||
|
||||
@Autowired
|
||||
private transient TagManagement tagMgmtService;
|
||||
|
||||
@Autowired
|
||||
private ManagementViewAcceptCriteria managementViewAcceptCriteria;
|
||||
|
||||
@@ -103,12 +93,6 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
|
||||
this.filterButtonClickBehaviour = filterButtonClickBehaviour;
|
||||
super.init(filterButtonClickBehaviour);
|
||||
addNewTargetTag(new TargetTag("NO TAG"));
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
@@ -139,10 +123,9 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isClickedByDefault(final Long buttonId) {
|
||||
final TargetTag newTagClickedObj = tagMgmtService.findTargetTagById(buttonId);
|
||||
return managementUIState.getTargetTableFilters().getClickedTargetTags() != null && managementUIState
|
||||
.getTargetTableFilters().getClickedTargetTags().contains(newTagClickedObj.getName());
|
||||
protected boolean isClickedByDefault(final String tagName) {
|
||||
return managementUIState.getTargetTableFilters().getClickedTargetTags() != null
|
||||
&& managementUIState.getTargetTableFilters().getClickedTargetTags().contains(tagName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -248,8 +231,8 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
|
||||
|
||||
final List<String> tagsClickedList = managementUIState.getTargetTableFilters().getClickedTargetTags();
|
||||
|
||||
final TargetTagAssigmentResult result = targetManagement.toggleTagAssignment(targetList, targTagName);
|
||||
notification.displaySuccess(HawkbitCommonUtil.getTargetTagAssigmentMsg(targTagName, result, i18n));
|
||||
final TargetTagAssignmentResult result = targetManagement.toggleTagAssignment(targetList, targTagName);
|
||||
notification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(targTagName, result, i18n));
|
||||
|
||||
if (result.getAssigned() >= 1 && managementUIState.getTargetTableFilters().isNoTagSelected()) {
|
||||
eventBus.publish(this, ManagementUIEvent.ASSIGN_TARGET_TAG);
|
||||
|
||||
@@ -10,14 +10,12 @@ package org.eclipse.hawkbit.ui.management.targettag;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader;
|
||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
|
||||
import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.ViewScope;
|
||||
@@ -32,15 +30,9 @@ public class TargetTagFilterHeader extends AbstractFilterHeader {
|
||||
|
||||
private static final long serialVersionUID = 3046367045669148009L;
|
||||
|
||||
@Autowired
|
||||
private SpPermissionChecker permChecker;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventbus;
|
||||
|
||||
@Autowired
|
||||
private CreateUpdateTargetTagLayout createUpdateTargetTagLayout;
|
||||
|
||||
@@ -58,7 +50,6 @@ public class TargetTagFilterHeader extends AbstractFilterHeader {
|
||||
|
||||
@Override
|
||||
protected String getHideButtonId() {
|
||||
|
||||
return SPUIComponetIdProvider.HIDE_TARGET_TAGS;
|
||||
}
|
||||
|
||||
@@ -87,7 +78,7 @@ public class TargetTagFilterHeader extends AbstractFilterHeader {
|
||||
@Override
|
||||
protected void hideFilterButtonLayout() {
|
||||
managementUIState.setTargetTagFilterClosed(true);
|
||||
eventbus.publish(this, ManagementUIEvent.HIDE_TARGET_TAG_LAYOUT);
|
||||
eventBus.publish(this, ManagementUIEvent.HIDE_TARGET_TAG_LAYOUT);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,15 +19,9 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagCreatedBulkEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.EntityEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.RolloutChangeEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.RolloutGroupChangeEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetCreatedEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetDeletedEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetInfoUpdateEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetTagCreatedBulkEvent;
|
||||
import org.eclipse.hawkbit.im.authentication.TenantAwareAuthenticationDetails;
|
||||
import org.eclipse.hawkbit.ui.UIEventProvider;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.security.core.context.SecurityContext;
|
||||
@@ -36,7 +30,6 @@ import org.springframework.security.web.context.HttpSessionSecurityContextReposi
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventBus.SessionEventBus;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.eventbus.AllowConcurrentEvents;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.vaadin.server.VaadinSession;
|
||||
@@ -49,15 +42,15 @@ import com.vaadin.ui.UI;
|
||||
* {@link com.google.common.eventbus.EventBus} and store them first in an queue
|
||||
* where they will dispatched every 2 seconds to the {@link EventBus} in a
|
||||
* Vaadin access thread {@link UI#access(Runnable)}.
|
||||
*
|
||||
*
|
||||
* This strategy avoids blocking UIs when too many events are fired and
|
||||
* dispatched to the UI thread. The UI will freeze in the time. To avoid that
|
||||
* all events are collected first and same events are merged to a list of events
|
||||
* before they dispatched to the UI thread.
|
||||
*
|
||||
*
|
||||
* The strategy also verifies the current tenant in the session with the tenant
|
||||
* in the event and only forwards event from the right tenant to the UI.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
|
||||
@@ -71,16 +64,11 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
|
||||
private ScheduledFuture<?> jobHandle;
|
||||
|
||||
/**
|
||||
* only events defined in the set are dispatched to the session event bus.
|
||||
*/
|
||||
private static final Set<Class<?>> UI_EVENTS = Sets.newHashSet(TargetInfoUpdateEvent.class,
|
||||
TargetCreatedEvent.class, TargetDeletedEvent.class, RolloutChangeEvent.class, RolloutGroupChangeEvent.class,
|
||||
TargetTagCreatedBulkEvent.class, DistributionSetTagCreatedBulkEvent.class);
|
||||
private final UIEventProvider eventProvider;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
*
|
||||
* @param eventBus
|
||||
* the session event bus to where the events should be dispatched
|
||||
* @param systemEventBus
|
||||
@@ -88,9 +76,10 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
* back-end
|
||||
*/
|
||||
public DelayedEventBusPushStrategy(final SessionEventBus eventBus,
|
||||
final com.google.common.eventbus.EventBus systemEventBus) {
|
||||
final com.google.common.eventbus.EventBus systemEventBus, final UIEventProvider eventProvider) {
|
||||
this.eventBus = eventBus;
|
||||
this.systemEventBus = systemEventBus;
|
||||
this.eventProvider = eventProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,12 +94,22 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
@AllowConcurrentEvents
|
||||
public void dispatch(final org.eclipse.hawkbit.eventbus.event.Event event) {
|
||||
// to dispatch too many events which are not interested on the UI
|
||||
if (UI_EVENTS.contains(event.getClass()) && !queue.offer(event)) {
|
||||
if (!isEventProvided(event)) {
|
||||
LOG.trace("Event is not supported in the UI!!! Dropped event is {}", event);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!queue.offer(event)) {
|
||||
LOG.warn("Deque limit is reached, cannot add more events!!! Dropped event is {}", event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isEventProvided(final org.eclipse.hawkbit.eventbus.event.Event event) {
|
||||
return eventProvider.getSingleEvents().contains(event.getClass())
|
||||
|| eventProvider.getBulkEvents().contains(event.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(final UI vaadinUI) {
|
||||
LOG.debug("Initialize delayed event push strategy");
|
||||
@@ -131,7 +130,7 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
/**
|
||||
* Checks if the tenant within the event is equal with the current tenant in
|
||||
* the context.
|
||||
*
|
||||
*
|
||||
* @param userContext
|
||||
* the security context of the current session
|
||||
* @param event
|
||||
@@ -206,37 +205,43 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
final SecurityContext oldContext = SecurityContextHolder.getContext();
|
||||
try {
|
||||
SecurityContextHolder.setContext(userContext);
|
||||
|
||||
vaadinUI.access(() -> {
|
||||
if (vaadinSession.getState() != State.OPEN) {
|
||||
return;
|
||||
}
|
||||
fowardEvents(events, userContext);
|
||||
|
||||
// send a list of events, because ui performance issues
|
||||
publishEventAsList(events, userContext, TargetInfoUpdateEvent.class);
|
||||
publishEventAsList(events, userContext, TargetCreatedEvent.class);
|
||||
publishEventAsList(events, userContext, TargetDeletedEvent.class);
|
||||
fowardSingleEvents(events, userContext);
|
||||
fowardBulkEvents(events, userContext);
|
||||
});
|
||||
} finally {
|
||||
SecurityContextHolder.setContext(oldContext);
|
||||
}
|
||||
}
|
||||
|
||||
private void publishEventAsList(final List<org.eclipse.hawkbit.eventbus.event.Event> events,
|
||||
final SecurityContext userContext, final Class<?> eventType) {
|
||||
final List<org.eclipse.hawkbit.eventbus.event.Event> bulkEvents = events.stream()
|
||||
.filter(event -> DelayedEventBusPushStrategy.this.eventSecurityCheck(userContext, event)
|
||||
&& eventType.isInstance(event))
|
||||
.collect(Collectors.toList());
|
||||
if (bulkEvents.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
eventBus.publish(vaadinUI, bulkEvents);
|
||||
private void fowardBulkEvents(final List<org.eclipse.hawkbit.eventbus.event.Event> events,
|
||||
final SecurityContext userContext) {
|
||||
final Set<Class<?>> filterBulkEvenTypes = eventProvider.getFilteredBulkEventsType(events);
|
||||
publishBulkEvent(events, userContext, filterBulkEvenTypes);
|
||||
}
|
||||
|
||||
private void fowardEvents(final List<org.eclipse.hawkbit.eventbus.event.Event> events,
|
||||
private void publishBulkEvent(final List<org.eclipse.hawkbit.eventbus.event.Event> events,
|
||||
final SecurityContext userContext, final Set<Class<?>> filterBulkEvenTypes) {
|
||||
for (final Class<?> bulkType : filterBulkEvenTypes) {
|
||||
final List<org.eclipse.hawkbit.eventbus.event.Event> listBulkEvents = events.stream()
|
||||
.filter(event -> DelayedEventBusPushStrategy.this.eventSecurityCheck(userContext, event)
|
||||
&& bulkType.isInstance(event))
|
||||
.collect(Collectors.toList());
|
||||
if (!listBulkEvents.isEmpty()) {
|
||||
eventBus.publish(vaadinUI, listBulkEvents);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void fowardSingleEvents(final List<org.eclipse.hawkbit.eventbus.event.Event> events,
|
||||
final SecurityContext userContext) {
|
||||
events.stream().filter(event -> DelayedEventBusPushStrategy.this.eventSecurityCheck(userContext, event))
|
||||
events.stream()
|
||||
.filter(event -> DelayedEventBusPushStrategy.this.eventSecurityCheck(userContext, event)
|
||||
&& eventProvider.getSingleEvents().contains(event.getClass()))
|
||||
.forEach(event -> eventBus.publish(vaadinUI, event));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,9 +15,6 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.RolloutChangeEvent;
|
||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
@@ -33,7 +30,6 @@ import org.eclipse.hawkbit.ui.rollout.StatusFontIcon;
|
||||
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
@@ -46,7 +42,6 @@ import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
||||
import org.vaadin.peter.contextmenu.ContextMenu;
|
||||
import org.vaadin.peter.contextmenu.ContextMenu.ContextMenuItem;
|
||||
import org.vaadin.peter.contextmenu.ContextMenu.ContextMenuItemClickEvent;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
@@ -82,11 +77,6 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
|
||||
private static final String START_OPTION = "Start";
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private transient RolloutManagement rolloutManagement;
|
||||
@@ -105,17 +95,6 @@ public class RolloutListGrid extends AbstractGrid {
|
||||
|
||||
private transient Map<RolloutStatus, StatusFontIcon> statusIconMap = new EnumMap<>(RolloutStatus.class);
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final RolloutEvent event) {
|
||||
|
||||
@@ -15,9 +15,6 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.RolloutGroupChangeEvent;
|
||||
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
@@ -32,7 +29,6 @@ import org.eclipse.hawkbit.ui.rollout.StatusFontIcon;
|
||||
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
@@ -41,7 +37,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
@@ -64,12 +59,6 @@ import com.vaadin.ui.renderers.HtmlRenderer;
|
||||
public class RolloutGroupListGrid extends AbstractGrid {
|
||||
private static final long serialVersionUID = 4060904914954370524L;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private transient RolloutGroupManagement rolloutGroupManagement;
|
||||
|
||||
@@ -81,18 +70,6 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
||||
|
||||
private transient Map<RolloutGroupStatus, StatusFontIcon> statusIconMap = new EnumMap<>(RolloutGroupStatus.class);
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final RolloutEvent event) {
|
||||
if (RolloutEvent.SHOW_ROLLOUT_GROUPS != event) {
|
||||
|
||||
@@ -14,9 +14,6 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
|
||||
@@ -26,7 +23,6 @@ import org.eclipse.hawkbit.ui.rollout.StatusFontIcon;
|
||||
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
@@ -35,7 +31,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
@@ -55,29 +50,12 @@ import com.vaadin.spring.annotation.ViewScope;
|
||||
public class RolloutGroupTargetsListGrid extends AbstractGrid {
|
||||
|
||||
private static final long serialVersionUID = -2244756637458984597L;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
|
||||
@Autowired
|
||||
private transient RolloutUIState rolloutUIState;
|
||||
|
||||
private transient Map<Status, StatusFontIcon> statusIconMap = new EnumMap<>(Status.class);
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
eventBus.subscribe(this);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
eventBus.unsubscribe(this);
|
||||
}
|
||||
|
||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||
void onEvent(final RolloutEvent event) {
|
||||
|
||||
@@ -24,14 +24,14 @@ import java.util.TimeZone;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.hawkbit.im.authentication.UserPrincipal;
|
||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||
import org.eclipse.hawkbit.repository.model.AssignmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssigmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
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.TargetIdName;
|
||||
import org.eclipse.hawkbit.repository.model.TargetInfo.PollStatus;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTagAssigmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus.Status;
|
||||
@@ -803,13 +803,16 @@ public final class HawkbitCommonUtil {
|
||||
* as string
|
||||
* @param version
|
||||
* as string
|
||||
* @param type
|
||||
* key as string
|
||||
* @return boolean as flag
|
||||
*/
|
||||
public static boolean isDuplicate(final String name, final String version) {
|
||||
public static boolean isDuplicate(final String name, final String version, final String type) {
|
||||
final SoftwareManagement swMgmtService = SpringContextHelper.getBean(SoftwareManagement.class);
|
||||
final List<SoftwareModule> swModulesList = swMgmtService.findSoftwareModuleByNameAndVersion(name, version);
|
||||
final SoftwareModule swModule = swMgmtService.findSoftwareModuleByNameAndVersion(name, version,
|
||||
swMgmtService.findSoftwareModuleTypeByName(type));
|
||||
boolean duplicate = false;
|
||||
if (swModulesList != null && !swModulesList.isEmpty()) {
|
||||
if (swModule != null) {
|
||||
duplicate = true;
|
||||
}
|
||||
return duplicate;
|
||||
@@ -866,7 +869,7 @@ public final class HawkbitCommonUtil {
|
||||
/**
|
||||
* Display Target Tag action message.
|
||||
*
|
||||
* @param targTagName
|
||||
* @param tagName
|
||||
* as tag name
|
||||
* @param result
|
||||
* as TargetTagAssigmentResult
|
||||
@@ -876,7 +879,7 @@ public final class HawkbitCommonUtil {
|
||||
* I18N
|
||||
* @return message
|
||||
*/
|
||||
public static String getTargetTagAssigmentMsg(final String targTagName, final TargetTagAssigmentResult result,
|
||||
public static String createAssignmentMessage(final String tagName, final AssignmentResult<? extends NamedEntity> result,
|
||||
final I18N i18n) {
|
||||
final StringBuilder formMsg = new StringBuilder();
|
||||
final int assignedCount = result.getAssigned();
|
||||
@@ -885,10 +888,10 @@ public final class HawkbitCommonUtil {
|
||||
|
||||
if (assignedCount == 1) {
|
||||
formMsg.append(i18n.get("message.target.assigned.one",
|
||||
new Object[] { result.getAssignedTargets().get(0).getName(), targTagName })).append("<br>");
|
||||
new Object[] { result.getAssignedEntity().get(0).getName(), tagName })).append("<br>");
|
||||
|
||||
} else if (assignedCount > 1) {
|
||||
formMsg.append(i18n.get("message.target.assigned.many", new Object[] { assignedCount, targTagName }))
|
||||
formMsg.append(i18n.get("message.target.assigned.many", new Object[] { assignedCount, tagName }))
|
||||
.append("<br>");
|
||||
|
||||
if (alreadyAssignedCount > 0) {
|
||||
@@ -900,55 +903,10 @@ public final class HawkbitCommonUtil {
|
||||
|
||||
if (unassignedCount == 1) {
|
||||
formMsg.append(i18n.get("message.target.unassigned.one",
|
||||
new Object[] { result.getUnassignedTargets().get(0).getName(), targTagName })).append("<br>");
|
||||
new Object[] { result.getUnassignedEntity().get(0).getName(), tagName })).append("<br>");
|
||||
|
||||
} else if (unassignedCount > 1) {
|
||||
formMsg.append(i18n.get("message.target.unassigned.many", new Object[] { unassignedCount, targTagName }))
|
||||
.append("<br>");
|
||||
}
|
||||
return formMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get message to be displayed after distribution tag assignment.
|
||||
*
|
||||
* @param targTagName
|
||||
* tag name
|
||||
* @param result
|
||||
* DistributionSetTagAssigmentResult
|
||||
* @param tagsClickedList
|
||||
* list of clicked tags
|
||||
* @param i18n
|
||||
* I18N
|
||||
* @return message
|
||||
*/
|
||||
public static String getDistributionTagAssignmentMsg(final String targTagName,
|
||||
final DistributionSetTagAssigmentResult result, final I18N i18n) {
|
||||
final StringBuilder formMsg = new StringBuilder();
|
||||
final int assignedCount = result.getAssigned();
|
||||
final int alreadyAssignedCount = result.getAlreadyAssigned();
|
||||
final int unassignedCount = result.getUnassigned();
|
||||
|
||||
if (assignedCount == 1) {
|
||||
formMsg.append(i18n.get("message.target.assigned.one",
|
||||
new Object[] { result.getAssignedDs().get(0).getName(), targTagName })).append("<br>");
|
||||
|
||||
} else if (assignedCount > 1) {
|
||||
formMsg.append(i18n.get("message.target.assigned.many", new Object[] { assignedCount, targTagName }))
|
||||
.append("<br>");
|
||||
|
||||
if (alreadyAssignedCount > 0) {
|
||||
final String alreadyAssigned = i18n.get("message.target.alreadyAssigned",
|
||||
new Object[] { alreadyAssignedCount });
|
||||
formMsg.append(alreadyAssigned).append("<br>");
|
||||
}
|
||||
}
|
||||
|
||||
if (unassignedCount == 1) {
|
||||
formMsg.append(i18n.get("message.target.unassigned.one",
|
||||
new Object[] { result.getUnassignedDs().get(0).getName(), targTagName })).append("<br>");
|
||||
} else if (unassignedCount > 1) {
|
||||
formMsg.append(i18n.get("message.target.unassigned.many", new Object[] { unassignedCount, targTagName }))
|
||||
formMsg.append(i18n.get("message.target.unassigned.many", new Object[] { unassignedCount, tagName }))
|
||||
.append("<br>");
|
||||
}
|
||||
return formMsg.toString();
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.8 KiB |
Reference in New Issue
Block a user