Merge branch 'master' into fix-set-db-read-uncommited
This commit is contained in:
@@ -22,7 +22,7 @@ https://hawkbit.eu-gb.mybluemix.net/UI/
|
|||||||
|
|
||||||
# Compile, Run and Getting Started
|
# Compile, Run and Getting Started
|
||||||
|
|
||||||
We are not providing an off the shelf installation ready hawkBit update server. However, we recommend to check out the [Example Application](examples/hawkbit-example-app) for a runtime ready Spring Boot based update server that is empowered by hawkBit.
|
We are not providing an off the shelf installation ready hawkBit update server. However, we recommend to check out the [Example Application](examples/hawkbit-example-app) for a runtime ready Spring Boot based update server that is empowered by hawkBit. In addition we have [guide](https://github.com/eclipse/hawkbit/wiki/Run-hawkBit) for setting up a complete landscape.
|
||||||
|
|
||||||
#### Clone and build hawkBit
|
#### Clone and build hawkBit
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -86,8 +86,11 @@ public class SimulationController {
|
|||||||
final String deviceId = name + i;
|
final String deviceId = name + i;
|
||||||
repository.add(deviceFactory.createSimulatedDevice(deviceId, tenant, protocol, pollDelay, new URL(endpoint),
|
repository.add(deviceFactory.createSimulatedDevice(deviceId, tenant, protocol, pollDelay, new URL(endpoint),
|
||||||
gatewayToken));
|
gatewayToken));
|
||||||
|
|
||||||
|
if (protocol == Protocol.DMF_AMQP) {
|
||||||
spSenderService.createOrUpdateThing(tenant, deviceId);
|
spSenderService.createOrUpdateThing(tenant, deviceId);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ResponseEntity.ok("Updated " + amount + " DMF connected targets!");
|
return ResponseEntity.ok("Updated " + amount + " DMF connected targets!");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.simulator;
|
|||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.simulator.AbstractSimulatedDevice.Protocol;
|
||||||
import org.eclipse.hawkbit.simulator.amqp.SpSenderService;
|
import org.eclipse.hawkbit.simulator.amqp.SpSenderService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -52,8 +53,10 @@ public class SimulatorStartup implements ApplicationListener<ContextRefreshedEve
|
|||||||
LOGGER.error("Creation of simulated device at startup failed.", e);
|
LOGGER.error("Creation of simulated device at startup failed.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (autostart.getApi() == Protocol.DMF_AMQP) {
|
||||||
spSenderService.createOrUpdateThing(autostart.getTenant(), deviceId);
|
spSenderService.createOrUpdateThing(autostart.getTenant(), deviceId);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -166,20 +166,12 @@ public class AmqpMessageHandlerService extends BaseAmqpService {
|
|||||||
final LocalArtifact localArtifact = findLocalArtifactByFileResource(fileResource);
|
final LocalArtifact localArtifact = findLocalArtifactByFileResource(fileResource);
|
||||||
|
|
||||||
if (localArtifact == null) {
|
if (localArtifact == null) {
|
||||||
|
LOG.info("target {} requested file resource {} which does not exists to download",
|
||||||
|
secruityToken.getControllerId(), fileResource);
|
||||||
throw new EntityNotFoundException();
|
throw new EntityNotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
// check action for this download purposes, the method will throw an
|
checkIfArtifactIsAssignedToTarget(secruityToken, localArtifact);
|
||||||
// EntityNotFoundException in case the controller is not allowed to
|
|
||||||
// download this file because it's not assigned to an action and not
|
|
||||||
// assigned to this controller. Otherwise no controllerId is set =
|
|
||||||
// anonymous download
|
|
||||||
if (secruityToken.getControllerId() != null) {
|
|
||||||
final Action action = controllerManagement.getActionForDownloadByTargetAndSoftwareModule(
|
|
||||||
secruityToken.getControllerId(), localArtifact.getSoftwareModule());
|
|
||||||
LOG.info("Found action for download authentication request action: {}, resource: {}", action,
|
|
||||||
secruityToken.getFileResource());
|
|
||||||
}
|
|
||||||
|
|
||||||
final Artifact artifact = convertDbArtifact(artifactManagement.loadLocalArtifactBinary(localArtifact));
|
final Artifact artifact = convertDbArtifact(artifactManagement.loadLocalArtifactBinary(localArtifact));
|
||||||
if (artifact == null) {
|
if (artifact == null) {
|
||||||
@@ -213,6 +205,35 @@ public class AmqpMessageHandlerService extends BaseAmqpService {
|
|||||||
return getMessageConverter().toMessage(authentificationResponse, messageProperties);
|
return getMessageConverter().toMessage(authentificationResponse, messageProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* check action for this download purposes, the method will throw an
|
||||||
|
* EntityNotFoundException in case the controller is not allowed to download
|
||||||
|
* this file because it's not assigned to an action and not assigned to this
|
||||||
|
* controller. Otherwise no controllerId is set = anonymous download
|
||||||
|
*
|
||||||
|
* @param secruityToken
|
||||||
|
* the security token which holds the target ID to check on
|
||||||
|
* @param localArtifact
|
||||||
|
* the local artifact to verify if the given target is allowed to
|
||||||
|
* download this artifact
|
||||||
|
*/
|
||||||
|
private void checkIfArtifactIsAssignedToTarget(final TenantSecurityToken secruityToken,
|
||||||
|
final LocalArtifact localArtifact) {
|
||||||
|
final String controllerId = secruityToken.getControllerId();
|
||||||
|
if (controllerId == null) {
|
||||||
|
LOG.info("anonymous download no authentication check for artifact {}", localArtifact);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LOG.debug("no anonymous download request, doing authentication check for target {} and artifact {}",
|
||||||
|
controllerId, localArtifact);
|
||||||
|
if (!controllerManagement.hasTargetArtifactAssigned(controllerId, localArtifact)) {
|
||||||
|
LOG.info("target {} tried to download artifact {} which is not assigned to the target", controllerId,
|
||||||
|
localArtifact);
|
||||||
|
throw new EntityNotFoundException();
|
||||||
|
}
|
||||||
|
LOG.info("download security check for target {} and artifact {} granted", controllerId, localArtifact);
|
||||||
|
}
|
||||||
|
|
||||||
private LocalArtifact findLocalArtifactByFileResource(final FileResource fileResource) {
|
private LocalArtifact findLocalArtifactByFileResource(final FileResource fileResource) {
|
||||||
if (fileResource.getSha1() != null) {
|
if (fileResource.getSha1() != null) {
|
||||||
return artifactManagement.findFirstLocalArtifactsBySHA1(fileResource.getSha1());
|
return artifactManagement.findFirstLocalArtifactsBySHA1(fileResource.getSha1());
|
||||||
|
|||||||
@@ -313,11 +313,10 @@ public class AmqpMessageHandlerServiceTest {
|
|||||||
|
|
||||||
// mock
|
// mock
|
||||||
final LocalArtifact localArtifactMock = mock(LocalArtifact.class);
|
final LocalArtifact localArtifactMock = mock(LocalArtifact.class);
|
||||||
final Action actionMock = mock(Action.class);
|
|
||||||
final DbArtifact dbArtifactMock = mock(DbArtifact.class);
|
final DbArtifact dbArtifactMock = mock(DbArtifact.class);
|
||||||
when(artifactManagementMock.findFirstLocalArtifactsBySHA1(anyString())).thenReturn(localArtifactMock);
|
when(artifactManagementMock.findFirstLocalArtifactsBySHA1(anyString())).thenReturn(localArtifactMock);
|
||||||
when(controllerManagementMock.getActionForDownloadByTargetAndSoftwareModule(anyObject(), anyObject()))
|
when(controllerManagementMock.hasTargetArtifactAssigned(securityToken.getControllerId(), localArtifactMock))
|
||||||
.thenReturn(actionMock);
|
.thenReturn(true);
|
||||||
when(artifactManagementMock.loadLocalArtifactBinary(localArtifactMock)).thenReturn(dbArtifactMock);
|
when(artifactManagementMock.loadLocalArtifactBinary(localArtifactMock)).thenReturn(dbArtifactMock);
|
||||||
when(dbArtifactMock.getArtifactId()).thenReturn("artifactId");
|
when(dbArtifactMock.getArtifactId()).thenReturn("artifactId");
|
||||||
when(dbArtifactMock.getSize()).thenReturn(1L);
|
when(dbArtifactMock.getSize()).thenReturn(1L);
|
||||||
|
|||||||
@@ -28,12 +28,14 @@ import org.eclipse.hawkbit.repository.model.Action.Status;
|
|||||||
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.ActionStatus_;
|
import org.eclipse.hawkbit.repository.model.ActionStatus_;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
|
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetInfo;
|
import org.eclipse.hawkbit.repository.model.TargetInfo;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.Target_;
|
import org.eclipse.hawkbit.repository.model.Target_;
|
||||||
import org.eclipse.hawkbit.repository.model.TenantConfiguration;
|
import org.eclipse.hawkbit.repository.model.TenantConfiguration;
|
||||||
|
import org.eclipse.hawkbit.repository.specifications.ActionSpecifications;
|
||||||
import org.eclipse.hawkbit.security.HawkbitSecurityProperties;
|
import org.eclipse.hawkbit.security.HawkbitSecurityProperties;
|
||||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
||||||
import org.hibernate.validator.constraints.NotEmpty;
|
import org.hibernate.validator.constraints.NotEmpty;
|
||||||
@@ -167,6 +169,31 @@ public class ControllerManagement {
|
|||||||
return action.get(0);
|
return action.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a given target has currently or has even been assigned to the
|
||||||
|
* given artifact through the action history list. This can e.g. indicate if
|
||||||
|
* a target is allowed to download a given artifact because it has currently
|
||||||
|
* assigned or had ever been assigned to the target and so it's visible to a
|
||||||
|
* specific target e.g. for downloading.
|
||||||
|
*
|
||||||
|
* @param targetId
|
||||||
|
* the ID of the target to check
|
||||||
|
* @param localArtifact
|
||||||
|
* the artifact to verify if the given target had even been
|
||||||
|
* assigned to
|
||||||
|
* @return {@code true} if the given target has currently or had ever a
|
||||||
|
* relation to the given artifact through the action history,
|
||||||
|
* otherwise {@code false}
|
||||||
|
*/
|
||||||
|
public boolean hasTargetArtifactAssigned(@NotNull final String targetId,
|
||||||
|
@NotNull final LocalArtifact localArtifact) {
|
||||||
|
final Target target = targetRepository.findByControllerId(targetId);
|
||||||
|
if (target == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return actionRepository.count(ActionSpecifications.hasTargetAssignedArtifact(target, localArtifact)) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refreshes the time of the last time the controller has been connected to
|
* Refreshes the time of the last time the controller has been connected to
|
||||||
* the server.
|
* the server.
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/**
|
||||||
|
* 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.repository.specifications;
|
||||||
|
|
||||||
|
import javax.persistence.criteria.Join;
|
||||||
|
import javax.persistence.criteria.ListJoin;
|
||||||
|
import javax.persistence.criteria.SetJoin;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.repository.model.Action;
|
||||||
|
import org.eclipse.hawkbit.repository.model.Action_;
|
||||||
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
|
import org.eclipse.hawkbit.repository.model.DistributionSet_;
|
||||||
|
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
||||||
|
import org.eclipse.hawkbit.repository.model.LocalArtifact_;
|
||||||
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
|
import org.eclipse.hawkbit.repository.model.SoftwareModule_;
|
||||||
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility class for {@link Action}s {@link Specification}s. The class provides
|
||||||
|
* Spring Data JPQL Specifications.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ActionSpecifications {
|
||||||
|
|
||||||
|
private ActionSpecifications() {
|
||||||
|
// utility class
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specification which joins all necessary tables to retrieve the dependency
|
||||||
|
* between a target and a local file assignment through the assigen action
|
||||||
|
* of the target. All actions are included, not only active actions.
|
||||||
|
*
|
||||||
|
* @param target
|
||||||
|
* the target to verfiy if the given artifact is currently
|
||||||
|
* assigned or had been assigned
|
||||||
|
* @param localArtifact
|
||||||
|
* the local artifact to check wherever the target had ever been
|
||||||
|
* assigned
|
||||||
|
* @return a specification to use with spring JPA
|
||||||
|
*/
|
||||||
|
public static Specification<Action> hasTargetAssignedArtifact(final Target target,
|
||||||
|
final LocalArtifact localArtifact) {
|
||||||
|
return (actionRoot, query, criteriaBuilder) -> {
|
||||||
|
final Join<Action, DistributionSet> dsJoin = actionRoot.join(Action_.distributionSet);
|
||||||
|
final SetJoin<DistributionSet, SoftwareModule> modulesJoin = dsJoin.join(DistributionSet_.modules);
|
||||||
|
final ListJoin<SoftwareModule, LocalArtifact> artifactsJoin = modulesJoin.join(SoftwareModule_.artifacts);
|
||||||
|
return criteriaBuilder.and(
|
||||||
|
criteriaBuilder.equal(artifactsJoin.get(LocalArtifact_.filename), localArtifact.getFilename()),
|
||||||
|
criteriaBuilder.equal(actionRoot.get(Action_.target), target));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
34
hawkbit-ui/README.md
Normal file
34
hawkbit-ui/README.md
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# hawkBit User Interface
|
||||||
|
|
||||||
|
The hawkBit user interface is based on the Vaadin and Vaadin-Spring framework and allows to manage software updates and large scale roll-outs via a user interface.
|
||||||
|
|
||||||
|
## Debugging client-side code
|
||||||
|
### Debug using SuperDevMode
|
||||||
|
The SuperDevMode can be used to debug client side code without any browser plugin.
|
||||||
|
|
||||||
|
#### Using SuperDevMode with chrome :
|
||||||
|
|
||||||
|
- Add required maven dependencies
|
||||||
|
- Add vaadin-client-compiler dependency
|
||||||
|
- Add jetty dependencies (version : 8.1x)
|
||||||
|
- Set redirect property in the AppWidgetSet.gwt.xml module descriptor as follows
|
||||||
|
- < set-configuration-property name="devModeRedirectEnabled" value="true" />
|
||||||
|
- Create launch configuration for the SuperDevMode
|
||||||
|
- The main class to execute should be com.google.gwt.dev.codeserver.CodeServer.
|
||||||
|
- Add fully-qualified class name of widgetset (org.eclipse.hawkbit.ui.AppWidgetSet) as parameter
|
||||||
|
- Enable debug in chrome
|
||||||
|
- Chrome inspector window ▸ Click on settings icon ▸ Scripts ▸ Enable source maps option
|
||||||
|
- Run the SuperDevMode Code Server with the launch configuration created above
|
||||||
|
- Open http://localhost:8080/UI/?debug .Click on "SuperDev" button in debug console (Alternatively can directly add ?superdevmode parameter to URL)
|
||||||
|
- Widgetset is compiled and you can see the java code files loaded in 'Chrome inspector window ▸ Source tab'
|
||||||
|
|
||||||
|
|
||||||
|
#### Using SuperDevMode with Eclipse :
|
||||||
|
|
||||||
|
- Install the plugin from http://sdbg.github.io/p2
|
||||||
|
- Start the server and Super Dev Mode as mentioned above
|
||||||
|
- Create a new launch configuration in Eclipse
|
||||||
|
- Type is "Launch Chrome"
|
||||||
|
- http://localhost:8080/UI/?superdevmode
|
||||||
|
- Launch the new configuration in debug mode
|
||||||
|
- Now breakpoints in eclipse can be set
|
||||||
@@ -21,6 +21,7 @@ import org.eclipse.hawkbit.eventbus.event.TargetCreatedEvent;
|
|||||||
import org.eclipse.hawkbit.eventbus.event.TargetDeletedEvent;
|
import org.eclipse.hawkbit.eventbus.event.TargetDeletedEvent;
|
||||||
import org.eclipse.hawkbit.eventbus.event.TargetInfoUpdateEvent;
|
import org.eclipse.hawkbit.eventbus.event.TargetInfoUpdateEvent;
|
||||||
import org.eclipse.hawkbit.eventbus.event.TargetTagCreatedBulkEvent;
|
import org.eclipse.hawkbit.eventbus.event.TargetTagCreatedBulkEvent;
|
||||||
|
import org.eclipse.hawkbit.eventbus.event.TargetTagDeletedEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default hawkbit event provider.
|
* The default hawkbit event provider.
|
||||||
@@ -34,6 +35,7 @@ public class HawkbitEventProvider implements UIEventProvider {
|
|||||||
SINGLE_EVENTS.add(TargetTagCreatedBulkEvent.class);
|
SINGLE_EVENTS.add(TargetTagCreatedBulkEvent.class);
|
||||||
SINGLE_EVENTS.add(DistributionSetTagCreatedBulkEvent.class);
|
SINGLE_EVENTS.add(DistributionSetTagCreatedBulkEvent.class);
|
||||||
SINGLE_EVENTS.add(DistributionSetTagDeletedEvent.class);
|
SINGLE_EVENTS.add(DistributionSetTagDeletedEvent.class);
|
||||||
|
SINGLE_EVENTS.add(TargetTagDeletedEvent.class);
|
||||||
SINGLE_EVENTS.add(DistributionSetTagUpdateEvent.class);
|
SINGLE_EVENTS.add(DistributionSetTagUpdateEvent.class);
|
||||||
SINGLE_EVENTS.add(RolloutGroupChangeEvent.class);
|
SINGLE_EVENTS.add(RolloutGroupChangeEvent.class);
|
||||||
SINGLE_EVENTS.add(RolloutChangeEvent.class);
|
SINGLE_EVENTS.add(RolloutChangeEvent.class);
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ import org.eclipse.hawkbit.ui.HawkbitUI;
|
|||||||
import org.eclipse.hawkbit.ui.artifacts.details.ArtifactDetailsLayout;
|
import org.eclipse.hawkbit.ui.artifacts.details.ArtifactDetailsLayout;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.ArtifactDetailsEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.ArtifactDetailsEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
|
|
||||||
import org.eclipse.hawkbit.ui.artifacts.footer.SMDeleteActionsLayout;
|
import org.eclipse.hawkbit.ui.artifacts.footer.SMDeleteActionsLayout;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleTableLayout;
|
import org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleTableLayout;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.smtype.SMTypeFilterLayout;
|
import org.eclipse.hawkbit.ui.artifacts.smtype.SMTypeFilterLayout;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.upload.UploadLayout;
|
import org.eclipse.hawkbit.ui.artifacts.upload.UploadLayout;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
@@ -111,9 +111,9 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
|
|||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final SoftwareModuleEvent event) {
|
void onEvent(final SoftwareModuleEvent event) {
|
||||||
if (event.getSoftwareModuleEventType() == SoftwareModuleEventType.MINIMIZED) {
|
if (BaseEntityEventType.MINIMIZED == event.getEventType()) {
|
||||||
minimizeSwTable();
|
minimizeSwTable();
|
||||||
} else if (event.getSoftwareModuleEventType() == SoftwareModuleEventType.MAXIMIZED) {
|
} else if (BaseEntityEventType.MAXIMIZED == event.getEventType()) {
|
||||||
maximizeSwTable();
|
maximizeSwTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
|||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||||
import org.eclipse.hawkbit.ui.common.ConfirmationDialog;
|
import org.eclipse.hawkbit.ui.common.ConfirmationDialog;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIButton;
|
import org.eclipse.hawkbit.ui.components.SPUIButton;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||||
@@ -110,8 +111,6 @@ public class ArtifactDetailsLayout extends VerticalLayout {
|
|||||||
|
|
||||||
private boolean fullWindowMode = false;
|
private boolean fullWindowMode = false;
|
||||||
|
|
||||||
private UI ui;
|
|
||||||
|
|
||||||
private boolean readOnly = false;
|
private boolean readOnly = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -122,7 +121,6 @@ public class ArtifactDetailsLayout extends VerticalLayout {
|
|||||||
createComponents();
|
createComponents();
|
||||||
buildLayout();
|
buildLayout();
|
||||||
eventBus.subscribe(this);
|
eventBus.subscribe(this);
|
||||||
ui = UI.getCurrent();
|
|
||||||
if (artifactUploadState.getSelectedBaseSoftwareModule().isPresent()) {
|
if (artifactUploadState.getSelectedBaseSoftwareModule().isPresent()) {
|
||||||
final SoftwareModule selectedSoftwareModule = artifactUploadState.getSelectedBaseSoftwareModule().get();
|
final SoftwareModule selectedSoftwareModule = artifactUploadState.getSelectedBaseSoftwareModule().get();
|
||||||
populateArtifactDetails(selectedSoftwareModule.getId(), HawkbitCommonUtil
|
populateArtifactDetails(selectedSoftwareModule.getId(), HawkbitCommonUtil
|
||||||
@@ -461,23 +459,23 @@ public class ArtifactDetailsLayout extends VerticalLayout {
|
|||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final SoftwareModuleEvent softwareModuleEvent) {
|
void onEvent(final SoftwareModuleEvent softwareModuleEvent) {
|
||||||
if (softwareModuleEvent.getSoftwareModuleEventType() == SoftwareModuleEventType.SELECTED_SOFTWARE_MODULE) {
|
if (BaseEntityEventType.SELECTED_ENTITY == softwareModuleEvent.getEventType()) {
|
||||||
ui.access(() -> {
|
UI.getCurrent().access(() -> {
|
||||||
if (softwareModuleEvent.getSoftwareModule() != null) {
|
if (softwareModuleEvent.getEntity() != null) {
|
||||||
populateArtifactDetails(softwareModuleEvent.getSoftwareModule().getId(),
|
populateArtifactDetails(softwareModuleEvent.getEntity().getId(),
|
||||||
HawkbitCommonUtil.getFormattedNameVersion(softwareModuleEvent.getSoftwareModule().getName(),
|
HawkbitCommonUtil.getFormattedNameVersion(softwareModuleEvent.getEntity().getName(),
|
||||||
softwareModuleEvent.getSoftwareModule().getVersion()));
|
softwareModuleEvent.getEntity().getVersion()));
|
||||||
} else {
|
} else {
|
||||||
populateArtifactDetails(null, null);
|
populateArtifactDetails(null, null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (softwareModuleEvent.getSoftwareModuleEventType() == SoftwareModuleEventType.ARTIFACTS_CHANGED) {
|
if (softwareModuleEvent.getSoftwareModuleEventType() == SoftwareModuleEventType.ARTIFACTS_CHANGED) {
|
||||||
ui.access(() -> {
|
UI.getCurrent().access(() -> {
|
||||||
if (softwareModuleEvent.getSoftwareModule() != null) {
|
if (softwareModuleEvent.getEntity() != null) {
|
||||||
populateArtifactDetails(softwareModuleEvent.getSoftwareModule().getId(),
|
populateArtifactDetails(softwareModuleEvent.getEntity().getId(),
|
||||||
HawkbitCommonUtil.getFormattedNameVersion(softwareModuleEvent.getSoftwareModule().getName(),
|
HawkbitCommonUtil.getFormattedNameVersion(softwareModuleEvent.getEntity().getName(),
|
||||||
softwareModuleEvent.getSoftwareModule().getVersion()));
|
softwareModuleEvent.getEntity().getVersion()));
|
||||||
} else {
|
} else {
|
||||||
populateArtifactDetails(null, null);
|
populateArtifactDetails(null, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,58 +9,53 @@
|
|||||||
package org.eclipse.hawkbit.ui.artifacts.event;
|
package org.eclipse.hawkbit.ui.artifacts.event;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEvent;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event to represent software add, update or delete.
|
* Event to represent software add, update or delete.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class SoftwareModuleEvent {
|
public class SoftwareModuleEvent extends BaseEntityEvent<SoftwareModule> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Software module events in the Upload UI.
|
* Software module events in the Upload UI.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public enum SoftwareModuleEventType {
|
public enum SoftwareModuleEventType {
|
||||||
NEW_SOFTWARE_MODULE, UPDATED_SOFTWARE_MODULE, DELETE_SOFTWARE_MODULE, SELECTED_SOFTWARE_MODULE, MAXIMIZED, MINIMIZED, ARTIFACTS_CHANGED, ASSIGN_SOFTWARE_MODULE
|
ARTIFACTS_CHANGED, ASSIGN_SOFTWARE_MODULE
|
||||||
}
|
}
|
||||||
|
|
||||||
private SoftwareModuleEventType softwareModuleEventType;
|
private SoftwareModuleEventType softwareModuleEventType;
|
||||||
|
|
||||||
private SoftwareModule softwareModule;
|
/**
|
||||||
|
* Creates software module event.
|
||||||
|
*
|
||||||
|
* @param entityEventType
|
||||||
|
* the event type
|
||||||
|
* @param softwareModule
|
||||||
|
* the module
|
||||||
|
*/
|
||||||
|
public SoftwareModuleEvent(final BaseEntityEventType entityEventType, final SoftwareModule softwareModule) {
|
||||||
|
super(entityEventType, softwareModule);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates software module event.
|
* Creates software module event.
|
||||||
*
|
*
|
||||||
* @param softwareModuleEventType
|
* @param softwareModuleEventType
|
||||||
* reference of {@link SoftwareModuleEventType}
|
* the event type
|
||||||
* @param softwareModule
|
* @param softwareModule
|
||||||
* reference of {@link SoftwareModule}
|
* the module
|
||||||
*/
|
*/
|
||||||
public SoftwareModuleEvent(final SoftwareModuleEventType softwareModuleEventType,
|
public SoftwareModuleEvent(final SoftwareModuleEventType softwareModuleEventType,
|
||||||
final SoftwareModule softwareModule) {
|
final SoftwareModule softwareModule) {
|
||||||
super();
|
super(null, softwareModule);
|
||||||
this.softwareModuleEventType = softwareModuleEventType;
|
this.softwareModuleEventType = softwareModuleEventType;
|
||||||
this.softwareModule = softwareModule;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SoftwareModuleEventType getSoftwareModuleEventType() {
|
public SoftwareModuleEventType getSoftwareModuleEventType() {
|
||||||
return softwareModuleEventType;
|
return softwareModuleEventType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSoftwareModuleEventType(final SoftwareModuleEventType softwareModuleEventType) {
|
|
||||||
this.softwareModuleEventType = softwareModuleEventType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SoftwareModule getSoftwareModule() {
|
|
||||||
return softwareModule;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSoftwareModule(final SoftwareModule softwareModule) {
|
|
||||||
this.softwareModule = softwareModule;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,16 +8,15 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.artifacts.footer;
|
package org.eclipse.hawkbit.ui.artifacts.footer;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.UploadViewAcceptCriteria;
|
import org.eclipse.hawkbit.ui.artifacts.event.UploadViewAcceptCriteria;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||||
import org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout;
|
import org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
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.SPUILabelDefinitions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.vaadin.spring.events.EventScope;
|
import org.vaadin.spring.events.EventScope;
|
||||||
@@ -28,7 +27,6 @@ import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
|
|||||||
import com.vaadin.spring.annotation.SpringComponent;
|
import com.vaadin.spring.annotation.SpringComponent;
|
||||||
import com.vaadin.spring.annotation.ViewScope;
|
import com.vaadin.spring.annotation.ViewScope;
|
||||||
import com.vaadin.ui.Component;
|
import com.vaadin.ui.Component;
|
||||||
import com.vaadin.ui.Label;
|
|
||||||
import com.vaadin.ui.Table;
|
import com.vaadin.ui.Table;
|
||||||
import com.vaadin.ui.Table.TableTransferable;
|
import com.vaadin.ui.Table.TableTransferable;
|
||||||
import com.vaadin.ui.UI;
|
import com.vaadin.ui.UI;
|
||||||
@@ -156,13 +154,9 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
|
|
||||||
private void addToDeleteList(final Table sourceTable, final TableTransferable transferable) {
|
private void addToDeleteList(final Table sourceTable, final TableTransferable transferable) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
final Set<Long> swModuleSelected = (Set<Long>) sourceTable.getValue();
|
final AbstractTable<?, Long> swTable = (AbstractTable<?, Long>) sourceTable;
|
||||||
final Set<Long> swModuleIdNameSet = new HashSet<>();
|
final Set<Long> swModuleIdNameSet = swTable.getDeletedEntityByTransferable(transferable);
|
||||||
if (!swModuleSelected.contains(transferable.getData(SPUIDefinitions.ITEMID))) {
|
|
||||||
swModuleIdNameSet.add((Long) transferable.getData(SPUIDefinitions.ITEMID));
|
|
||||||
} else {
|
|
||||||
swModuleIdNameSet.addAll(swModuleSelected);
|
|
||||||
}
|
|
||||||
swModuleIdNameSet.forEach(id -> {
|
swModuleIdNameSet.forEach(id -> {
|
||||||
final String swModuleName = (String) sourceTable.getContainerDataSource().getItem(id)
|
final String swModuleName = (String) sourceTable.getContainerDataSource().getItem(id)
|
||||||
.getItemProperty(SPUILabelDefinitions.NAME_VERSION).getValue();
|
.getItemProperty(SPUILabelDefinitions.NAME_VERSION).getValue();
|
||||||
@@ -191,7 +185,7 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Component getUnsavedActionsWindowContent() {
|
protected Component getUnsavedActionsWindowContent() {
|
||||||
uploadViewConfirmationWindowLayout.init();
|
uploadViewConfirmationWindowLayout.initialize();
|
||||||
return uploadViewConfirmationWindowLayout;
|
return uploadViewConfirmationWindowLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,33 +195,4 @@ public class SMDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
|| !artifactUploadState.getSelectedDeleteSWModuleTypes().isEmpty();
|
|| !artifactUploadState.getSelectedDeleteSWModuleTypes().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean hasCountMessage() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Label getCountMessageLabel() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean hasBulkUploadPermission() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void showBulkUploadWindow() {
|
|
||||||
/**
|
|
||||||
* Bulk upload not supported .No implementation required.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void restoreBulkUploadStatusCount() {
|
|
||||||
/**
|
|
||||||
* Bulk upload not supported .No implementation required.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,23 +14,17 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.state.CustomFile;
|
import org.eclipse.hawkbit.ui.artifacts.state.CustomFile;
|
||||||
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.AbstractConfirmationWindowLayout;
|
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.AbstractConfirmationWindowLayout;
|
||||||
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.ConfirmationTab;
|
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.ConfirmationTab;
|
||||||
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.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.vaadin.spring.events.EventBus;
|
|
||||||
|
|
||||||
import com.vaadin.data.Container;
|
import com.vaadin.data.Container;
|
||||||
import com.vaadin.data.Item;
|
import com.vaadin.data.Item;
|
||||||
@@ -39,8 +33,8 @@ import com.vaadin.server.FontAwesome;
|
|||||||
import com.vaadin.spring.annotation.SpringComponent;
|
import com.vaadin.spring.annotation.SpringComponent;
|
||||||
import com.vaadin.spring.annotation.ViewScope;
|
import com.vaadin.spring.annotation.ViewScope;
|
||||||
import com.vaadin.ui.Button;
|
import com.vaadin.ui.Button;
|
||||||
|
import com.vaadin.ui.Button.ClickListener;
|
||||||
import com.vaadin.ui.Table.Align;
|
import com.vaadin.ui.Table.Align;
|
||||||
import com.vaadin.ui.themes.ValoTheme;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract layout of confirm actions window.
|
* Abstract layout of confirm actions window.
|
||||||
@@ -62,32 +56,12 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
|
|||||||
|
|
||||||
private static final String DISCARD = "Discard";
|
private static final String DISCARD = "Discard";
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private I18N i18n;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private transient SoftwareManagement softwareManagement;
|
private transient SoftwareManagement softwareManagement;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private transient EventBus.SessionEventBus eventBus;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ArtifactUploadState artifactUploadState;
|
private ArtifactUploadState artifactUploadState;
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialze the component.
|
|
||||||
*/
|
|
||||||
@PostConstruct
|
|
||||||
void init() {
|
|
||||||
super.inittialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.confirmwindow.layout.
|
|
||||||
* AbstractConfirmationWindowLayout# getConfimrationTabs()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, ConfirmationTab> getConfimrationTabs() {
|
protected Map<String, ConfirmationTab> getConfimrationTabs() {
|
||||||
final Map<String, ConfirmationTab> tabs = new HashMap<>();
|
final Map<String, ConfirmationTab> tabs = new HashMap<>();
|
||||||
@@ -116,26 +90,13 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
|
|||||||
|
|
||||||
// Add the discard action column
|
// Add the discard action column
|
||||||
tab.getTable().addGeneratedColumn(SW_DISCARD_CHGS, (source, itemId, columnId) -> {
|
tab.getTable().addGeneratedColumn(SW_DISCARD_CHGS, (source, itemId, columnId) -> {
|
||||||
final Button deleteswIcon = SPUIComponentProvider.getButton("", "", SPUILabelDefinitions.DISCARD,
|
final ClickListener clickListener = event -> discardSoftwareDelete(event, itemId, tab);
|
||||||
ValoTheme.BUTTON_TINY + " " + "redicon", true, FontAwesome.REPLY,
|
return createDiscardButton(itemId, clickListener);
|
||||||
SPUIButtonStyleSmallNoBorder.class);
|
|
||||||
deleteswIcon.setData(itemId);
|
|
||||||
deleteswIcon.setImmediate(true);
|
|
||||||
deleteswIcon.addClickListener(event -> discardSoftwareDelete(event, itemId, tab));
|
|
||||||
return deleteswIcon;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// set the visible columns
|
tab.getTable().setVisibleColumns(SW_MODULE_NAME_MSG, SW_DISCARD_CHGS);
|
||||||
final List<Object> visibleColumnIds = new ArrayList<>();
|
tab.getTable().setColumnHeaders(i18n.get("upload.swModuleTable.header"),
|
||||||
final List<String> visibleColumnLabels = new ArrayList<>();
|
i18n.get("header.second.deletetarget.table"));
|
||||||
if (visibleColumnIds.isEmpty() && visibleColumnLabels.isEmpty()) {
|
|
||||||
visibleColumnIds.add(SW_MODULE_NAME_MSG);
|
|
||||||
visibleColumnIds.add(SW_DISCARD_CHGS);
|
|
||||||
visibleColumnLabels.add(i18n.get("upload.swModuleTable.header"));
|
|
||||||
visibleColumnLabels.add(i18n.get("header.second.deletetarget.table"));
|
|
||||||
}
|
|
||||||
tab.getTable().setVisibleColumns(visibleColumnIds.toArray());
|
|
||||||
tab.getTable().setColumnHeaders(visibleColumnLabels.toArray(new String[0]));
|
|
||||||
|
|
||||||
tab.getTable().setColumnExpandRatio(SW_MODULE_NAME_MSG, SPUIDefinitions.TARGET_DISTRIBUTION_COLUMN_WIDTH);
|
tab.getTable().setColumnExpandRatio(SW_MODULE_NAME_MSG, SPUIDefinitions.TARGET_DISTRIBUTION_COLUMN_WIDTH);
|
||||||
tab.getTable().setColumnExpandRatio(SW_DISCARD_CHGS, SPUIDefinitions.DISCARD_COLUMN_WIDTH);
|
tab.getTable().setColumnExpandRatio(SW_DISCARD_CHGS, SPUIDefinitions.DISCARD_COLUMN_WIDTH);
|
||||||
@@ -233,30 +194,14 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
|
|||||||
|
|
||||||
// Add the discard action column
|
// Add the discard action column
|
||||||
tab.getTable().addGeneratedColumn(DISCARD, (source, itemId, columnId) -> {
|
tab.getTable().addGeneratedColumn(DISCARD, (source, itemId, columnId) -> {
|
||||||
final StringBuilder style = new StringBuilder(ValoTheme.BUTTON_TINY);
|
final ClickListener clickListener = event -> discardSoftwareTypeDelete(
|
||||||
style.append(' ');
|
(String) ((Button) event.getComponent()).getData(), itemId, tab);
|
||||||
style.append("redicon");
|
return createDiscardButton(itemId, clickListener);
|
||||||
final Button deleteIcon = SPUIComponentProvider.getButton("", "", SPUILabelDefinitions.DISCARD,
|
|
||||||
style.toString(), true, FontAwesome.REPLY, SPUIButtonStyleSmallNoBorder.class);
|
|
||||||
deleteIcon.setData(itemId);
|
|
||||||
deleteIcon.setImmediate(true);
|
|
||||||
deleteIcon.addClickListener(event -> discardSoftwareTypeDelete(
|
|
||||||
(String) ((Button) event.getComponent()).getData(), itemId, tab));
|
|
||||||
return deleteIcon;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// set the visible columns
|
tab.getTable().setVisibleColumns(SW_MODULE_TYPE_NAME, DISCARD);
|
||||||
final List<Object> visibleColumnIds = new ArrayList<>();
|
tab.getTable().setColumnHeaders(i18n.get("header.first.delete.swmodule.type.table"),
|
||||||
final List<String> visibleColumnLabels = new ArrayList<>();
|
i18n.get("header.second.delete.swmodule.type.table"));
|
||||||
if (visibleColumnIds.isEmpty() && visibleColumnLabels.isEmpty()) {
|
|
||||||
visibleColumnIds.add(SW_MODULE_TYPE_NAME);
|
|
||||||
visibleColumnIds.add(DISCARD);
|
|
||||||
visibleColumnLabels.add(i18n.get("header.first.delete.swmodule.type.table"));
|
|
||||||
visibleColumnLabels.add(i18n.get("header.second.delete.swmodule.type.table"));
|
|
||||||
|
|
||||||
}
|
|
||||||
tab.getTable().setVisibleColumns(visibleColumnIds.toArray());
|
|
||||||
tab.getTable().setColumnHeaders(visibleColumnLabels.toArray(new String[0]));
|
|
||||||
|
|
||||||
tab.getTable().setColumnExpandRatio(SW_MODULE_TYPE_NAME, 2);
|
tab.getTable().setColumnExpandRatio(SW_MODULE_TYPE_NAME, 2);
|
||||||
tab.getTable().setColumnExpandRatio(SW_DISCARD_CHGS, SPUIDefinitions.DISCARD_COLUMN_WIDTH);
|
tab.getTable().setColumnExpandRatio(SW_DISCARD_CHGS, SPUIDefinitions.DISCARD_COLUMN_WIDTH);
|
||||||
@@ -264,9 +209,6 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
|
|||||||
return tab;
|
return tab;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private Container getSWModuleTypeTableContainer() {
|
private Container getSWModuleTypeTableContainer() {
|
||||||
final IndexedContainer contactContainer = new IndexedContainer();
|
final IndexedContainer contactContainer = new IndexedContainer();
|
||||||
contactContainer.addContainerProperty(SW_MODULE_TYPE_NAME, String.class, "");
|
contactContainer.addContainerProperty(SW_MODULE_TYPE_NAME, String.class, "");
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import java.io.Serializable;
|
|||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
|
|
||||||
import org.eclipse.hawkbit.ui.common.SoftwareModuleTypeBeanQuery;
|
import org.eclipse.hawkbit.ui.common.SoftwareModuleTypeBeanQuery;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
@@ -282,8 +282,8 @@ public class SoftwareModuleAddUpdateWindow implements Serializable {
|
|||||||
/* display success message */
|
/* display success message */
|
||||||
uiNotifcation.displaySuccess(i18n.get("message.save.success", new Object[] {
|
uiNotifcation.displaySuccess(i18n.get("message.save.success", new Object[] {
|
||||||
newBaseSoftwareModule.getName() + ":" + newBaseSoftwareModule.getVersion() }));
|
newBaseSoftwareModule.getName() + ":" + newBaseSoftwareModule.getVersion() }));
|
||||||
eventBus.publish(this, new SoftwareModuleEvent(SoftwareModuleEventType.NEW_SOFTWARE_MODULE,
|
eventBus.publish(this,
|
||||||
newBaseSoftwareModule));
|
new SoftwareModuleEvent(BaseEntityEventType.NEW_ENTITY, newBaseSoftwareModule));
|
||||||
}
|
}
|
||||||
// close the window
|
// close the window
|
||||||
closeThisWindow();
|
closeThisWindow();
|
||||||
@@ -302,8 +302,7 @@ public class SoftwareModuleAddUpdateWindow implements Serializable {
|
|||||||
uiNotifcation.displaySuccess(i18n.get("message.save.success",
|
uiNotifcation.displaySuccess(i18n.get("message.save.success",
|
||||||
new Object[] { newSWModule.getName() + ":" + newSWModule.getVersion() }));
|
new Object[] { newSWModule.getName() + ":" + newSWModule.getVersion() }));
|
||||||
|
|
||||||
eventBus.publish(this,
|
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.UPDATED_ENTITY, newSWModule));
|
||||||
new SoftwareModuleEvent(SoftwareModuleEventType.UPDATED_SOFTWARE_MODULE, newSWModule));
|
|
||||||
}
|
}
|
||||||
closeThisWindow();
|
closeThisWindow();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,8 @@ package org.eclipse.hawkbit.ui.artifacts.smtable;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
|
|
||||||
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||||
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractTableDetailsLayout;
|
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractNamedVersionedEntityTableDetailsLayout;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||||
@@ -36,7 +35,7 @@ import com.vaadin.ui.Window;
|
|||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
public class SoftwareModuleDetails extends AbstractTableDetailsLayout {
|
public class SoftwareModuleDetails extends AbstractNamedVersionedEntityTableDetailsLayout<SoftwareModule> {
|
||||||
|
|
||||||
private static final long serialVersionUID = -4900381301076646366L;
|
private static final long serialVersionUID = -4900381301076646366L;
|
||||||
|
|
||||||
@@ -46,10 +45,6 @@ public class SoftwareModuleDetails extends AbstractTableDetailsLayout {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ArtifactUploadState artifactUploadState;
|
private ArtifactUploadState artifactUploadState;
|
||||||
|
|
||||||
private Long swModuleId;
|
|
||||||
|
|
||||||
private SoftwareModule selectedSwModule;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getEditButtonId() {
|
protected String getEditButtonId() {
|
||||||
return SPUIComponetIdProvider.UPLOAD_SW_MODULE_EDIT_BUTTON;
|
return SPUIComponetIdProvider.UPLOAD_SW_MODULE_EDIT_BUTTON;
|
||||||
@@ -57,28 +52,31 @@ public class SoftwareModuleDetails extends AbstractTableDetailsLayout {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addTabs(final TabSheet detailsTab) {
|
protected void addTabs(final TabSheet detailsTab) {
|
||||||
detailsTab.addTab(createDetailsLayout(), i18n.get("caption.tab.details"), null);
|
detailsTab.addTab(createDetailsLayout(), getI18n().get("caption.tab.details"), null);
|
||||||
detailsTab.addTab(createDescriptionLayout(), i18n.get("caption.tab.description"), null);
|
detailsTab.addTab(createDescriptionLayout(), getI18n().get("caption.tab.description"), null);
|
||||||
detailsTab.addTab(createLogLayout(), i18n.get("caption.logs.tab"), null);
|
detailsTab.addTab(createLogLayout(), getI18n().get("caption.logs.tab"), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEdit(final ClickEvent event) {
|
protected void onEdit(final ClickEvent event) {
|
||||||
final Window addSoftwareModule = softwareModuleAddUpdateWindow.createUpdateSoftwareModuleWindow(swModuleId);
|
final Window addSoftwareModule = softwareModuleAddUpdateWindow
|
||||||
addSoftwareModule.setCaption(i18n.get("upload.caption.update.swmodule"));
|
.createUpdateSoftwareModuleWindow(getSelectedBaseEntityId());
|
||||||
|
addSoftwareModule.setCaption(getI18n().get("upload.caption.update.swmodule"));
|
||||||
UI.getCurrent().addWindow(addSoftwareModule);
|
UI.getCurrent().addWindow(addSoftwareModule);
|
||||||
addSoftwareModule.setVisible(Boolean.TRUE);
|
addSoftwareModule.setVisible(Boolean.TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateDetails(final SoftwareModule swModule) {
|
@Override
|
||||||
|
protected void populateDetailsWidget() {
|
||||||
String maxAssign = HawkbitCommonUtil.SP_STRING_EMPTY;
|
String maxAssign = HawkbitCommonUtil.SP_STRING_EMPTY;
|
||||||
if (swModule != null) {
|
if (getSelectedBaseEntity() != null) {
|
||||||
if (swModule.getType().getMaxAssignments() == Integer.MAX_VALUE) {
|
if (getSelectedBaseEntity().getType().getMaxAssignments() == Integer.MAX_VALUE) {
|
||||||
maxAssign = i18n.get("label.multiAssign.type");
|
maxAssign = getI18n().get("label.multiAssign.type");
|
||||||
} else {
|
} else {
|
||||||
maxAssign = i18n.get("label.singleAssign.type");
|
maxAssign = getI18n().get("label.singleAssign.type");
|
||||||
}
|
}
|
||||||
updateSoftwareModuleDetailsLayout(swModule.getType().getName(), swModule.getVendor(), maxAssign);
|
updateSoftwareModuleDetailsLayout(getSelectedBaseEntity().getType().getName(),
|
||||||
|
getSelectedBaseEntity().getVendor(), maxAssign);
|
||||||
} else {
|
} else {
|
||||||
updateSoftwareModuleDetailsLayout(HawkbitCommonUtil.SP_STRING_EMPTY, HawkbitCommonUtil.SP_STRING_EMPTY,
|
updateSoftwareModuleDetailsLayout(HawkbitCommonUtil.SP_STRING_EMPTY, HawkbitCommonUtil.SP_STRING_EMPTY,
|
||||||
maxAssign);
|
maxAssign);
|
||||||
@@ -90,67 +88,28 @@ public class SoftwareModuleDetails extends AbstractTableDetailsLayout {
|
|||||||
|
|
||||||
detailsTabLayout.removeAllComponents();
|
detailsTabLayout.removeAllComponents();
|
||||||
|
|
||||||
final Label vendorLabel = SPUIComponentProvider.createNameValueLabel(i18n.get("label.dist.details.vendor"),
|
final Label vendorLabel = SPUIComponentProvider.createNameValueLabel(getI18n().get("label.dist.details.vendor"),
|
||||||
HawkbitCommonUtil.trimAndNullIfEmpty(vendor) == null ? "" : vendor);
|
HawkbitCommonUtil.trimAndNullIfEmpty(vendor) == null ? "" : vendor);
|
||||||
vendorLabel.setId(SPUIComponetIdProvider.DETAILS_VENDOR_LABEL_ID);
|
vendorLabel.setId(SPUIComponetIdProvider.DETAILS_VENDOR_LABEL_ID);
|
||||||
detailsTabLayout.addComponent(vendorLabel);
|
detailsTabLayout.addComponent(vendorLabel);
|
||||||
|
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
final Label typeLabel = SPUIComponentProvider.createNameValueLabel(i18n.get("label.dist.details.type"),
|
final Label typeLabel = SPUIComponentProvider.createNameValueLabel(getI18n().get("label.dist.details.type"),
|
||||||
type);
|
type);
|
||||||
typeLabel.setId(SPUIComponetIdProvider.DETAILS_TYPE_LABEL_ID);
|
typeLabel.setId(SPUIComponetIdProvider.DETAILS_TYPE_LABEL_ID);
|
||||||
detailsTabLayout.addComponent(typeLabel);
|
detailsTabLayout.addComponent(typeLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Label assignLabel = SPUIComponentProvider.createNameValueLabel(i18n.get("label.assigned.type"),
|
final Label assignLabel = SPUIComponentProvider.createNameValueLabel(getI18n().get("label.assigned.type"),
|
||||||
HawkbitCommonUtil.trimAndNullIfEmpty(maxAssign) == null ? "" : maxAssign);
|
HawkbitCommonUtil.trimAndNullIfEmpty(maxAssign) == null ? "" : maxAssign);
|
||||||
assignLabel.setId(SPUIComponetIdProvider.SWM_DTLS_MAX_ASSIGN);
|
assignLabel.setId(SPUIComponetIdProvider.SWM_DTLS_MAX_ASSIGN);
|
||||||
detailsTabLayout.addComponent(assignLabel);
|
detailsTabLayout.addComponent(assignLabel);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateLog(final SoftwareModule softwareModule) {
|
|
||||||
if (null != softwareModule) {
|
|
||||||
updateLogLayout(getLogLayout(), softwareModule.getLastModifiedAt(), softwareModule.getLastModifiedBy(),
|
|
||||||
softwareModule.getCreatedAt(), softwareModule.getCreatedBy(), i18n);
|
|
||||||
} else {
|
|
||||||
updateLogLayout(getLogLayout(), null, HawkbitCommonUtil.SP_STRING_EMPTY, null, null, i18n);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSwModuleId(final Long swModuleId) {
|
|
||||||
this.swModuleId = swModuleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void populateDetailsWidget(final SoftwareModule swModule) {
|
|
||||||
if (swModule != null) {
|
|
||||||
setSwModuleId(swModule.getId());
|
|
||||||
setName(getDefaultCaption(),
|
|
||||||
HawkbitCommonUtil.getFormattedNameVersion(swModule.getName(), swModule.getVersion()));
|
|
||||||
populateDetails(swModule);
|
|
||||||
populateDescription(swModule);
|
|
||||||
populateLog(swModule);
|
|
||||||
} else {
|
|
||||||
setSwModuleId(null);
|
|
||||||
setName(getDefaultCaption(), HawkbitCommonUtil.SP_STRING_EMPTY);
|
|
||||||
populateDetails(null);
|
|
||||||
populateDescription(null);
|
|
||||||
populateLog(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void populateDescription(final SoftwareModule swModule) {
|
|
||||||
if (swModule != null) {
|
|
||||||
updateDescriptionLayout(i18n.get("label.description"), swModule.getDescription());
|
|
||||||
} else {
|
|
||||||
updateDescriptionLayout(i18n.get("label.description"), null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getDefaultCaption() {
|
protected String getDefaultCaption() {
|
||||||
return i18n.get("upload.swModuleTable.header");
|
return getI18n().get("upload.swModuleTable.header");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -158,53 +117,21 @@ public class SoftwareModuleDetails extends AbstractTableDetailsLayout {
|
|||||||
return artifactUploadState.getSelectedBaseSoftwareModule().isPresent();
|
return artifactUploadState.getSelectedBaseSoftwareModule().isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean onLoadIsTableMaximized() {
|
protected Boolean onLoadIsTableMaximized() {
|
||||||
return artifactUploadState.isSwModuleTableMaximized();
|
return artifactUploadState.isSwModuleTableMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void populateDetailsWidget() {
|
|
||||||
populateDetailsWidget(selectedSwModule);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final SoftwareModuleEvent softwareModuleEvent) {
|
void onEvent(final SoftwareModuleEvent softwareModuleEvent) {
|
||||||
if (softwareModuleEvent.getSoftwareModuleEventType() == SoftwareModuleEventType.SELECTED_SOFTWARE_MODULE
|
onBaseEntityEvent(softwareModuleEvent);
|
||||||
|| softwareModuleEvent
|
|
||||||
.getSoftwareModuleEventType() == SoftwareModuleEventType.UPDATED_SOFTWARE_MODULE) {
|
|
||||||
ui.access(() -> {
|
|
||||||
/**
|
|
||||||
* softwareModuleEvent.getSoftwareModule() is null when table
|
|
||||||
* has no data.
|
|
||||||
*/
|
|
||||||
if (softwareModuleEvent.getSoftwareModule() != null) {
|
|
||||||
selectedSwModule = softwareModuleEvent.getSoftwareModule();
|
|
||||||
populateData(true);
|
|
||||||
} else {
|
|
||||||
populateData(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (softwareModuleEvent.getSoftwareModuleEventType() == SoftwareModuleEventType.MINIMIZED) {
|
|
||||||
showLayout();
|
|
||||||
} else if (softwareModuleEvent.getSoftwareModuleEventType() == SoftwareModuleEventType.MAXIMIZED) {
|
|
||||||
hideLayout();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void clearDetails() {
|
|
||||||
populateDetailsWidget(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean hasEditPermission() {
|
protected Boolean hasEditPermission() {
|
||||||
return permissionChecker.hasUpdateDistributionPermission();
|
return getPermissionChecker().hasUpdateDistributionPermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTabSheetId() {
|
protected String getTabSheetId() {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -8,29 +8,20 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.artifacts.smtable;
|
package org.eclipse.hawkbit.ui.artifacts.smtable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import javax.annotation.PreDestroy;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
|
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.UploadViewAcceptCriteria;
|
import org.eclipse.hawkbit.ui.artifacts.event.UploadViewAcceptCriteria;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||||
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
import org.eclipse.hawkbit.ui.common.table.AbstractNamedVersionTable;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
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.SPUIComponetIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
@@ -39,7 +30,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
||||||
import org.vaadin.spring.events.EventBus;
|
|
||||||
import org.vaadin.spring.events.EventScope;
|
import org.vaadin.spring.events.EventScope;
|
||||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||||
|
|
||||||
@@ -58,45 +48,19 @@ import com.vaadin.ui.UI;
|
|||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
public class SoftwareModuleTable extends AbstractTable {
|
public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModule, Long> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 6469417305487144809L;
|
private static final long serialVersionUID = 6469417305487144809L;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private I18N i18n;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ArtifactUploadState artifactUploadState;
|
private ArtifactUploadState artifactUploadState;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private transient EventBus.SessionEventBus eventBus;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private transient SoftwareManagement softwareManagement;
|
private transient SoftwareManagement softwareManagement;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UploadViewAcceptCriteria uploadViewAcceptCriteria;
|
private UploadViewAcceptCriteria uploadViewAcceptCriteria;
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the filter layout.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@PostConstruct
|
|
||||||
protected void init() {
|
|
||||||
super.init();
|
|
||||||
eventBus.subscribe(this);
|
|
||||||
setNoDataAvailable();
|
|
||||||
}
|
|
||||||
|
|
||||||
@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)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final SMFilterEvent filterEvent) {
|
void onEvent(final SMFilterEvent filterEvent) {
|
||||||
UI.getCurrent().access(() -> {
|
UI.getCurrent().access(() -> {
|
||||||
@@ -150,74 +114,40 @@ public class SoftwareModuleTable extends AbstractTable {
|
|||||||
lqc.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, String.class, null, false, true);
|
lqc.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, String.class, null, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addCustomGeneratedColumns() {
|
|
||||||
/* No generated columns */
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isFirstRowSelectedOnLoad() {
|
protected boolean isFirstRowSelectedOnLoad() {
|
||||||
return artifactUploadState.getSelectedSoftwareModules().isEmpty();
|
return artifactUploadState.getSelectedSoftwareModules().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.SPTable#getItemIdToSelect()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Object getItemIdToSelect() {
|
protected Object getItemIdToSelect() {
|
||||||
return artifactUploadState.getSelectedSoftwareModules();
|
return artifactUploadState.getSelectedSoftwareModules();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.SPTable#isMaximized()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isMaximized() {
|
protected boolean isMaximized() {
|
||||||
return artifactUploadState.isSwModuleTableMaximized();
|
return artifactUploadState.isSwModuleTableMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
|
||||||
@Override
|
@Override
|
||||||
protected void onValueChange() {
|
protected SoftwareModule findEntityByTableValue(final Long entityTableId) {
|
||||||
eventBus.publish(this, UploadArtifactUIEvent.HIDE_DROP_HINTS);
|
return softwareManagement.findSoftwareModuleById(entityTableId);
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
final Set<Long> values = (Set) getValue();
|
|
||||||
if (values != null && !values.isEmpty()) {
|
|
||||||
final Iterator<Long> iterator = values.iterator();
|
|
||||||
Long value = null;
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
value = iterator.next();
|
|
||||||
}
|
}
|
||||||
if (null != value) {
|
|
||||||
artifactUploadState.setSelectedBaseSwModuleId(value);
|
@Override
|
||||||
final SoftwareModule baseSoftwareModule = softwareManagement.findSoftwareModuleById(value);
|
protected ArtifactUploadState getManagmentEntityState() {
|
||||||
artifactUploadState.setSelectedBaseSoftwareModule(baseSoftwareModule);
|
return artifactUploadState;
|
||||||
artifactUploadState.setSelectedSoftwareModules(values);
|
|
||||||
eventBus.publish(this,
|
|
||||||
new SoftwareModuleEvent(SoftwareModuleEventType.SELECTED_SOFTWARE_MODULE, baseSoftwareModule));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
artifactUploadState.setSelectedBaseSwModuleId(null);
|
|
||||||
artifactUploadState.setSelectedBaseSoftwareModule(null);
|
|
||||||
artifactUploadState.setSelectedSoftwareModules(Collections.emptySet());
|
|
||||||
eventBus.publish(this, new SoftwareModuleEvent(SoftwareModuleEventType.SELECTED_SOFTWARE_MODULE, null));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void publishEntityAfterValueChange(final SoftwareModule lastSoftwareModule) {
|
||||||
|
artifactUploadState.setSelectedBaseSoftwareModule(lastSoftwareModule);
|
||||||
|
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.SELECTED_ENTITY, lastSoftwareModule));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final SoftwareModuleEvent event) {
|
void onEvent(final SoftwareModuleEvent event) {
|
||||||
if (event.getSoftwareModuleEventType() == SoftwareModuleEventType.MINIMIZED) {
|
onBaseEntityEvent(event);
|
||||||
UI.getCurrent().access(() -> applyMinTableSettings());
|
|
||||||
} else if (event.getSoftwareModuleEventType() == SoftwareModuleEventType.MAXIMIZED) {
|
|
||||||
UI.getCurrent().access(() -> applyMaxTableSettings());
|
|
||||||
} else if (event.getSoftwareModuleEventType() == SoftwareModuleEventType.NEW_SOFTWARE_MODULE) {
|
|
||||||
UI.getCurrent().access(() -> addSoftwareModule(event.getSoftwareModule()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
@@ -227,55 +157,35 @@ public class SoftwareModuleTable extends AbstractTable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Add new software module to table.
|
protected Item addEntity(final SoftwareModule baseEntity) {
|
||||||
*
|
final Item item = super.addEntity(baseEntity);
|
||||||
* @param swModule
|
|
||||||
* new software module
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private void addSoftwareModule(final SoftwareModule swModule) {
|
|
||||||
final Object addItem = addItem();
|
|
||||||
final Item item = getItem(addItem);
|
|
||||||
final String swNameVersion = HawkbitCommonUtil.concatStrings(":", swModule.getName(), swModule.getVersion());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.NAME_VERSION).setValue(swNameVersion);
|
|
||||||
item.getItemProperty("swId").setValue(swModule.getId());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_ID).setValue(swModule.getId());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_DESC).setValue(swModule.getDescription());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_VERSION).setValue(swModule.getVersion());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_NAME).setValue(swModule.getName());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_VENDOR).setValue(swModule.getVendor());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_CREATED_BY).setValue(swModule.getCreatedBy());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY).setValue(swModule.getLastModifiedBy());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_CREATED_DATE)
|
|
||||||
.setValue(SPDateTimeUtil.getFormattedDate(swModule.getCreatedAt()));
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE)
|
|
||||||
.setValue(SPDateTimeUtil.getFormattedDate(swModule.getLastModifiedAt()));
|
|
||||||
if (!artifactUploadState.getSelectedSoftwareModules().isEmpty()) {
|
if (!artifactUploadState.getSelectedSoftwareModules().isEmpty()) {
|
||||||
artifactUploadState.getSelectedSoftwareModules().stream().forEach(swmNameId -> unselect(swmNameId));
|
artifactUploadState.getSelectedSoftwareModules().stream().forEach(this::unselect);
|
||||||
}
|
}
|
||||||
select(swModule.getId());
|
select(baseEntity.getId());
|
||||||
|
return item;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
protected void updateEntity(final SoftwareModule baseEntity, final Item item) {
|
||||||
|
final String swNameVersion = HawkbitCommonUtil.concatStrings(":", baseEntity.getName(),
|
||||||
|
baseEntity.getVersion());
|
||||||
|
item.getItemProperty(SPUILabelDefinitions.NAME_VERSION).setValue(swNameVersion);
|
||||||
|
item.getItemProperty("swId").setValue(baseEntity.getId());
|
||||||
|
item.getItemProperty(SPUILabelDefinitions.VAR_VENDOR).setValue(baseEntity.getVendor());
|
||||||
|
super.updateEntity(baseEntity, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<TableColumn> getTableVisibleColumns() {
|
protected List<TableColumn> getTableVisibleColumns() {
|
||||||
final List<TableColumn> columnList = new ArrayList<>();
|
final List<TableColumn> columnList = super.getTableVisibleColumns();
|
||||||
if (isMaximized()) {
|
if (!isMaximized()) {
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get("header.name"), 0.2F));
|
return columnList;
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_VERSION, i18n.get("header.version"), 0.1F));
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_VENDOR, i18n.get("header.vendor"), 0.1F));
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_BY, i18n.get("header.createdBy"), 0.1F));
|
|
||||||
columnList
|
|
||||||
.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_DATE, i18n.get("header.createdDate"), 0.1F));
|
|
||||||
columnList.add(
|
|
||||||
new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, i18n.get("header.modifiedBy"), 0.1F));
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, i18n.get("header.modifiedDate"),
|
|
||||||
0.1F));
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_DESC, i18n.get("header.description"), 0.2F));
|
|
||||||
} else {
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get("header.name"), 0.8F));
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_VERSION, i18n.get("header.version"), 0.2F));
|
|
||||||
}
|
}
|
||||||
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_VENDOR, i18n.get("header.vendor"), 0.1F));
|
||||||
return columnList;
|
return columnList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,12 +207,8 @@ public class SoftwareModuleTable extends AbstractTable {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setNoDataAvailable() {
|
@Override
|
||||||
final int containerSize = getContainerDataSource().size();
|
protected void setDataAvailable(final boolean available) {
|
||||||
if (containerSize == 0) {
|
artifactUploadState.setNoDataAvilableSoftwareModule(!available);
|
||||||
artifactUploadState.setNoDataAvilableSoftwareModule(true);
|
|
||||||
} else {
|
|
||||||
artifactUploadState.setNoDataAvilableSoftwareModule(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ package org.eclipse.hawkbit.ui.artifacts.smtable;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
|
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||||
import org.eclipse.hawkbit.ui.common.table.AbstractTableHeader;
|
import org.eclipse.hawkbit.ui.common.table.AbstractTableHeader;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.vaadin.spring.events.EventScope;
|
import org.vaadin.spring.events.EventScope;
|
||||||
@@ -51,7 +51,6 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getHeaderCaption() {
|
protected String getHeaderCaption() {
|
||||||
return i18n.get("upload.swModuleTable.header");
|
return i18n.get("upload.swModuleTable.header");
|
||||||
@@ -131,14 +130,14 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
|
|||||||
@Override
|
@Override
|
||||||
public void maximizeTable() {
|
public void maximizeTable() {
|
||||||
artifactUploadState.setSwModuleTableMaximized(Boolean.TRUE);
|
artifactUploadState.setSwModuleTableMaximized(Boolean.TRUE);
|
||||||
eventbus.publish(this, new SoftwareModuleEvent(SoftwareModuleEventType.MAXIMIZED, null));
|
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MAXIMIZED, null));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void minimizeTable() {
|
public void minimizeTable() {
|
||||||
artifactUploadState.setSwModuleTableMaximized(Boolean.FALSE);
|
artifactUploadState.setSwModuleTableMaximized(Boolean.FALSE);
|
||||||
eventbus.publish(this, new SoftwareModuleEvent(SoftwareModuleEventType.MINIMIZED, null));
|
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MINIMIZED, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import java.util.Optional;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
|
import org.eclipse.hawkbit.ui.common.ManagmentEntityState;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import com.vaadin.spring.annotation.SpringComponent;
|
import com.vaadin.spring.annotation.SpringComponent;
|
||||||
@@ -29,7 +30,7 @@ import com.vaadin.spring.annotation.VaadinSessionScope;
|
|||||||
*/
|
*/
|
||||||
@VaadinSessionScope
|
@VaadinSessionScope
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
public class ArtifactUploadState implements Serializable {
|
public class ArtifactUploadState implements ManagmentEntityState<Long>, Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 8273440375917450859L;
|
private static final long serialVersionUID = 8273440375917450859L;
|
||||||
|
|
||||||
@@ -85,30 +86,7 @@ public class ArtifactUploadState implements Serializable {
|
|||||||
* @return the selectedBaseSwModuleId
|
* @return the selectedBaseSwModuleId
|
||||||
*/
|
*/
|
||||||
public Optional<Long> getSelectedBaseSwModuleId() {
|
public Optional<Long> getSelectedBaseSwModuleId() {
|
||||||
return selectedBaseSwModuleId != null ? Optional.of(selectedBaseSwModuleId) : Optional.empty();
|
return Optional.ofNullable(selectedBaseSwModuleId);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param selectedBaseSwModuleId
|
|
||||||
* the selectedBaseSwModuleId to set
|
|
||||||
*/
|
|
||||||
public void setSelectedBaseSwModuleId(final Long selectedBaseSwModuleId) {
|
|
||||||
this.selectedBaseSwModuleId = selectedBaseSwModuleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the selectedBaseSoftwareModule
|
|
||||||
*/
|
|
||||||
public Optional<SoftwareModule> getSelectedBaseSoftwareModule() {
|
|
||||||
return selectedBaseSoftwareModule == null ? Optional.empty() : Optional.of(selectedBaseSoftwareModule);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param selectedBaseSoftwareModule
|
|
||||||
* the selectedBaseSoftwareModule to set
|
|
||||||
*/
|
|
||||||
public void setSelectedBaseSoftwareModule(final SoftwareModule selectedBaseSoftwareModule) {
|
|
||||||
this.selectedBaseSoftwareModule = selectedBaseSoftwareModule;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -125,12 +103,15 @@ public class ArtifactUploadState implements Serializable {
|
|||||||
return selectedSoftwareModules;
|
return selectedSoftwareModules;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @param selectedSoftwareModules
|
public void setLastSelectedEntity(final Long value) {
|
||||||
* the selectedSoftwareModules to set
|
this.selectedBaseSwModuleId = value;
|
||||||
*/
|
|
||||||
public void setSelectedSoftwareModules(final Set<Long> selectedSoftwareModules) {
|
}
|
||||||
this.selectedSoftwareModules = selectedSoftwareModules;
|
|
||||||
|
@Override
|
||||||
|
public void setSelectedEnitities(final Set<Long> values) {
|
||||||
|
this.selectedSoftwareModules = values;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -197,4 +178,11 @@ public class ArtifactUploadState implements Serializable {
|
|||||||
this.noDataAvilableSoftwareModule = noDataAvilableSoftwareModule;
|
this.noDataAvilableSoftwareModule = noDataAvilableSoftwareModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Optional<SoftwareModule> getSelectedBaseSoftwareModule() {
|
||||||
|
return Optional.ofNullable(selectedBaseSoftwareModule);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelectedBaseSoftwareModule(final SoftwareModule selectedBaseSoftwareModule) {
|
||||||
|
this.selectedBaseSoftwareModule = selectedBaseSoftwareModule;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*/
|
||||||
|
package org.eclipse.hawkbit.ui.common;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for all entity states UI to show the details to a entity.
|
||||||
|
*/
|
||||||
|
public interface ManagmentEntityState<T> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The selected entities for the detail.
|
||||||
|
*
|
||||||
|
* @param values
|
||||||
|
* the selected entities.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void setSelectedEnitities(Set<T> values);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The last selected value.
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* the value
|
||||||
|
*/
|
||||||
|
void setLastSelectedEntity(T value);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -11,21 +11,29 @@ package org.eclipse.hawkbit.ui.common.confirmwindow.layout;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import javax.annotation.PostConstruct;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
|
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||||
|
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.ui.Accordion;
|
import com.vaadin.ui.Accordion;
|
||||||
import com.vaadin.ui.Alignment;
|
import com.vaadin.ui.Alignment;
|
||||||
|
import com.vaadin.ui.Button;
|
||||||
|
import com.vaadin.ui.Button.ClickListener;
|
||||||
import com.vaadin.ui.Label;
|
import com.vaadin.ui.Label;
|
||||||
import com.vaadin.ui.VerticalLayout;
|
import com.vaadin.ui.VerticalLayout;
|
||||||
|
import com.vaadin.ui.themes.ValoTheme;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract layout of confirm actions window.
|
* Abstract layout of confirm actions window.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractConfirmationWindowLayout extends VerticalLayout {
|
public abstract class AbstractConfirmationWindowLayout extends VerticalLayout {
|
||||||
|
|
||||||
@@ -37,33 +45,25 @@ public abstract class AbstractConfirmationWindowLayout extends VerticalLayout {
|
|||||||
|
|
||||||
private String consolidatedMessage;
|
private String consolidatedMessage;
|
||||||
|
|
||||||
protected void inittialize() {
|
@Autowired
|
||||||
// Remove all components
|
protected I18N i18n;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
protected transient EventBus.SessionEventBus eventBus;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void initialize() {
|
||||||
removeAllComponents();
|
removeAllComponents();
|
||||||
consolidatedMessage = "";
|
consolidatedMessage = "";
|
||||||
|
|
||||||
// create components again
|
|
||||||
createComponents();
|
createComponents();
|
||||||
|
|
||||||
// Build layout.
|
|
||||||
buildLayout();
|
buildLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create accordion and add respective tabs.
|
|
||||||
*/
|
|
||||||
private void createComponents() {
|
private void createComponents() {
|
||||||
// create accordion
|
|
||||||
createAccordian();
|
createAccordian();
|
||||||
|
|
||||||
// create action message label
|
|
||||||
createActionMessgaeLabel();
|
createActionMessgaeLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a message label to show the results of any actions which user does
|
|
||||||
* in the confirmation window.
|
|
||||||
*/
|
|
||||||
private void createActionMessgaeLabel() {
|
private void createActionMessgaeLabel() {
|
||||||
actionMessage = SPUIComponentProvider.getLabel("", null);
|
actionMessage = SPUIComponentProvider.getLabel("", null);
|
||||||
actionMessage.addStyleName(SPUIStyleDefinitions.CONFIRM_WINDOW_INFO_BOX);
|
actionMessage.addStyleName(SPUIStyleDefinitions.CONFIRM_WINDOW_INFO_BOX);
|
||||||
@@ -138,4 +138,14 @@ public abstract class AbstractConfirmationWindowLayout extends VerticalLayout {
|
|||||||
public String getConsolidatedMessage() {
|
public String getConsolidatedMessage() {
|
||||||
return consolidatedMessage;
|
return consolidatedMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Button createDiscardButton(final Object itemId, final ClickListener clickListener) {
|
||||||
|
final Button deletesDsIcon = SPUIComponentProvider.getButton("", "", SPUILabelDefinitions.DISCARD,
|
||||||
|
ValoTheme.BUTTON_TINY + " " + SPUIStyleDefinitions.REDICON, true, FontAwesome.REPLY,
|
||||||
|
SPUIButtonStyleSmallNoBorder.class);
|
||||||
|
deletesDsIcon.setData(itemId);
|
||||||
|
deletesDsIcon.setImmediate(true);
|
||||||
|
deletesDsIcon.addClickListener(clickListener);
|
||||||
|
return deletesDsIcon;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*/
|
||||||
|
package org.eclipse.hawkbit.ui.common.detailslayout;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public abstract class AbstractNamedVersionedEntityTableDetailsLayout<T extends NamedVersionedEntity>
|
||||||
|
extends AbstractTableDetailsLayout<T> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getName() {
|
||||||
|
return HawkbitCommonUtil.getFormattedNameVersion(getSelectedBaseEntity().getName(),
|
||||||
|
getSelectedBaseEntity().getVersion());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,8 +13,12 @@ import java.util.Map;
|
|||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.annotation.PreDestroy;
|
import javax.annotation.PreDestroy;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||||
|
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEvent;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
@@ -37,23 +41,23 @@ import com.vaadin.ui.UI;
|
|||||||
import com.vaadin.ui.VerticalLayout;
|
import com.vaadin.ui.VerticalLayout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Abstract Layout to show the entity details.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractTableDetailsLayout extends VerticalLayout {
|
public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends VerticalLayout {
|
||||||
|
|
||||||
private static final long serialVersionUID = 4862529368471627190L;
|
private static final long serialVersionUID = 4862529368471627190L;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
protected I18N i18n;
|
private I18N i18n;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
protected transient EventBus.SessionEventBus eventBus;
|
private transient EventBus.SessionEventBus eventBus;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
protected SpPermissionChecker permissionChecker;
|
private SpPermissionChecker permissionChecker;
|
||||||
|
|
||||||
protected UI ui;
|
private T selectedBaseEntity;
|
||||||
|
|
||||||
private Label caption;
|
private Label caption;
|
||||||
|
|
||||||
@@ -74,13 +78,8 @@ public abstract class AbstractTableDetailsLayout extends VerticalLayout {
|
|||||||
*/
|
*/
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
protected void init() {
|
protected void init() {
|
||||||
ui = UI.getCurrent();
|
|
||||||
createComponents();
|
createComponents();
|
||||||
buildLayout();
|
buildLayout();
|
||||||
/**
|
|
||||||
* On load of UI/Refresh details will be loaded based on the row
|
|
||||||
* selected in table.
|
|
||||||
*/
|
|
||||||
restoreState();
|
restoreState();
|
||||||
eventBus.subscribe(this);
|
eventBus.subscribe(this);
|
||||||
}
|
}
|
||||||
@@ -90,10 +89,44 @@ public abstract class AbstractTableDetailsLayout extends VerticalLayout {
|
|||||||
eventBus.unsubscribe(this);
|
eventBus.unsubscribe(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createComponents() {
|
protected SpPermissionChecker getPermissionChecker() {
|
||||||
|
return permissionChecker;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected EventBus.SessionEventBus getEventBus() {
|
||||||
|
return eventBus;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected I18N getI18n() {
|
||||||
|
return i18n;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected T getSelectedBaseEntity() {
|
||||||
|
return selectedBaseEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelectedBaseEntity(final T selectedBaseEntity) {
|
||||||
|
this.selectedBaseEntity = selectedBaseEntity;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default caption is set.Reset on selecting table row.
|
* Default implementation to handle an entity event.
|
||||||
|
*
|
||||||
|
* @param baseEntityEvent
|
||||||
|
* the event
|
||||||
*/
|
*/
|
||||||
|
protected void onBaseEntityEvent(final BaseEntityEvent<T> baseEntityEvent) {
|
||||||
|
final BaseEntityEventType eventType = baseEntityEvent.getEventType();
|
||||||
|
if (BaseEntityEventType.SELECTED_ENTITY == eventType || BaseEntityEventType.UPDATED_ENTITY == eventType) {
|
||||||
|
UI.getCurrent().access(() -> populateData(baseEntityEvent.getEntity()));
|
||||||
|
} else if (BaseEntityEventType.MINIMIZED == eventType) {
|
||||||
|
UI.getCurrent().access(() -> setVisible(true));
|
||||||
|
} else if (BaseEntityEventType.MAXIMIZED == eventType) {
|
||||||
|
UI.getCurrent().access(() -> setVisible(false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createComponents() {
|
||||||
caption = createHeaderCaption();
|
caption = createHeaderCaption();
|
||||||
caption.setImmediate(true);
|
caption.setImmediate(true);
|
||||||
caption.setContentMode(ContentMode.HTML);
|
caption.setContentMode(ContentMode.HTML);
|
||||||
@@ -102,7 +135,7 @@ public abstract class AbstractTableDetailsLayout extends VerticalLayout {
|
|||||||
editButton = SPUIComponentProvider.getButton("", "", "", null, false, FontAwesome.PENCIL_SQUARE_O,
|
editButton = SPUIComponentProvider.getButton("", "", "", null, false, FontAwesome.PENCIL_SQUARE_O,
|
||||||
SPUIButtonStyleSmallNoBorder.class);
|
SPUIButtonStyleSmallNoBorder.class);
|
||||||
editButton.setId(getEditButtonId());
|
editButton.setId(getEditButtonId());
|
||||||
editButton.addClickListener(event -> onEdit(event));
|
editButton.addClickListener(this::onEdit);
|
||||||
|
|
||||||
editButton.setEnabled(false);
|
editButton.setEnabled(false);
|
||||||
|
|
||||||
@@ -116,7 +149,6 @@ public abstract class AbstractTableDetailsLayout extends VerticalLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void buildLayout() {
|
private void buildLayout() {
|
||||||
|
|
||||||
final HorizontalLayout nameEditLayout = new HorizontalLayout();
|
final HorizontalLayout nameEditLayout = new HorizontalLayout();
|
||||||
nameEditLayout.setWidth(100.0f, Unit.PERCENTAGE);
|
nameEditLayout.setWidth(100.0f, Unit.PERCENTAGE);
|
||||||
nameEditLayout.addComponent(caption);
|
nameEditLayout.addComponent(caption);
|
||||||
@@ -156,44 +188,29 @@ public abstract class AbstractTableDetailsLayout extends VerticalLayout {
|
|||||||
|
|
||||||
private void restoreState() {
|
private void restoreState() {
|
||||||
if (onLoadIsTableRowSelected()) {
|
if (onLoadIsTableRowSelected()) {
|
||||||
populateData(true);
|
populateData(null);
|
||||||
|
editButton.setEnabled(true);
|
||||||
}
|
}
|
||||||
if (onLoadIsTableMaximized()) {
|
if (onLoadIsTableMaximized()) {
|
||||||
/**
|
|
||||||
* If table is maximized hide details layout.
|
|
||||||
*/
|
|
||||||
hideLayout();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void showLayout() {
|
|
||||||
setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void hideLayout() {
|
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If no data in table (i,e no row selected),then disable the edit button.
|
* If no data in table (i,e no row selected),then disable the edit button.
|
||||||
* If row is selected ,enable edit button.
|
* If row is selected ,enable edit button.
|
||||||
*/
|
*/
|
||||||
protected void populateData(final Boolean isRowSelected) {
|
private void populateData(final T selectedBaseEntity) {
|
||||||
if (isRowSelected) {
|
this.selectedBaseEntity = selectedBaseEntity;
|
||||||
populateDetailsWidget();
|
editButton.setEnabled(selectedBaseEntity != null);
|
||||||
enableEditButton();
|
if (selectedBaseEntity == null) {
|
||||||
|
setName(getDefaultCaption(), StringUtils.EMPTY);
|
||||||
} else {
|
} else {
|
||||||
disableEditButton();
|
setName(getDefaultCaption(), getName());
|
||||||
clearDetails();
|
|
||||||
}
|
}
|
||||||
}
|
populateLog();
|
||||||
|
populateDescription();
|
||||||
protected void enableEditButton() {
|
populateDetailsWidget();
|
||||||
editButton.setEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void disableEditButton() {
|
|
||||||
editButton.setEnabled(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateLogLayout(final VerticalLayout changeLogLayout, final Long lastModifiedAt,
|
protected void updateLogLayout(final VerticalLayout changeLogLayout, final Long lastModifiedAt,
|
||||||
@@ -297,13 +314,6 @@ public abstract class AbstractTableDetailsLayout extends VerticalLayout {
|
|||||||
|
|
||||||
protected abstract String getTabSheetId();
|
protected abstract String getTabSheetId();
|
||||||
|
|
||||||
/**
|
|
||||||
* Populate details layout.
|
|
||||||
*/
|
|
||||||
protected abstract void populateDetailsWidget();
|
|
||||||
|
|
||||||
protected abstract void clearDetails();
|
|
||||||
|
|
||||||
protected abstract Boolean hasEditPermission();
|
protected abstract Boolean hasEditPermission();
|
||||||
|
|
||||||
public VerticalLayout getDetailsLayout() {
|
public VerticalLayout getDetailsLayout() {
|
||||||
@@ -314,6 +324,31 @@ public abstract class AbstractTableDetailsLayout extends VerticalLayout {
|
|||||||
return logLayout;
|
return logLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void populateLog() {
|
||||||
|
if (selectedBaseEntity == null) {
|
||||||
|
updateLogLayout(getLogLayout(), null, StringUtils.EMPTY, null, null, i18n);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
updateLogLayout(getLogLayout(), selectedBaseEntity.getLastModifiedAt(), selectedBaseEntity.getLastModifiedBy(),
|
||||||
|
selectedBaseEntity.getCreatedAt(), selectedBaseEntity.getCreatedBy(), i18n);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void populateDescription() {
|
||||||
|
if (selectedBaseEntity != null) {
|
||||||
|
updateDescriptionLayout(i18n.get("label.description"), selectedBaseEntity.getDescription());
|
||||||
|
} else {
|
||||||
|
updateDescriptionLayout(i18n.get("label.description"), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void populateDetailsWidget();
|
||||||
|
|
||||||
|
protected Long getSelectedBaseEntityId() {
|
||||||
|
return selectedBaseEntity == null ? null : selectedBaseEntity.getId();
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract String getDetailsHeaderCaptionId();
|
protected abstract String getDetailsHeaderCaptionId();
|
||||||
|
|
||||||
|
protected abstract String getName();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ import org.eclipse.hawkbit.repository.exception.EntityLockedException;
|
|||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||||
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
|
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
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.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||||
@@ -214,9 +214,8 @@ public class SoftwareModuleDetailsTable extends Table {
|
|||||||
.getItem(event.getButton().getId()).getItemProperty(SOFT_MODULE).getValue(), alreadyAssignedSwModules);
|
.getItem(event.getButton().getId()).getItemProperty(SOFT_MODULE).getValue(), alreadyAssignedSwModules);
|
||||||
final DistributionSet newDistributionSet = distributionSetManagement.unassignSoftwareModule(distributionSet,
|
final DistributionSet newDistributionSet = distributionSetManagement.unassignSoftwareModule(distributionSet,
|
||||||
unAssignedSw);
|
unAssignedSw);
|
||||||
manageDistUIState.setLastSelectedDistribution(newDistributionSet.getDistributionSetIdName());
|
manageDistUIState.setLastSelectedEntity(newDistributionSet.getDistributionSetIdName());
|
||||||
eventBus.publish(this,
|
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.SELECTED_ENTITY, newDistributionSet));
|
||||||
new DistributionTableEvent(DistributionComponentEvent.ON_VALUE_CHANGE, newDistributionSet));
|
|
||||||
eventBus.publish(this, DistributionsUIEvent.ORDER_BY_DISTRIBUTION);
|
eventBus.publish(this, DistributionsUIEvent.ORDER_BY_DISTRIBUTION);
|
||||||
uiNotification.displaySuccess(i18n.get("message.sw.unassigned", unAssignedSw.getName()));
|
uiNotification.displaySuccess(i18n.get("message.sw.unassigned", unAssignedSw.getName()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,33 +182,39 @@ public abstract class AbstractDeleteActionsLayout extends VerticalLayout impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void setUploadStatusButtonCaption(final Long count) {
|
protected void setUploadStatusButtonCaption(final Long count) {
|
||||||
if (null != bulkUploadStatusButton) {
|
if (bulkUploadStatusButton == null) {
|
||||||
bulkUploadStatusButton.setCaption("<div class='unread'>" + count + "</div>");
|
return;
|
||||||
}
|
}
|
||||||
|
bulkUploadStatusButton.setCaption("<div class='unread'>" + count + "</div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void enableBulkUploadStatusButton() {
|
protected void enableBulkUploadStatusButton() {
|
||||||
if (null != bulkUploadStatusButton) {
|
if (bulkUploadStatusButton == null) {
|
||||||
bulkUploadStatusButton.setVisible(true);
|
return;
|
||||||
}
|
}
|
||||||
|
bulkUploadStatusButton.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateUploadBtnIconToComplete() {
|
protected void updateUploadBtnIconToComplete() {
|
||||||
if (null != bulkUploadStatusButton) {
|
if (bulkUploadStatusButton == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
bulkUploadStatusButton.removeStyleName(SPUIStyleDefinitions.BULK_UPLOAD_PROGRESS_INDICATOR_STYLE);
|
bulkUploadStatusButton.removeStyleName(SPUIStyleDefinitions.BULK_UPLOAD_PROGRESS_INDICATOR_STYLE);
|
||||||
bulkUploadStatusButton.setIcon(FontAwesome.UPLOAD);
|
bulkUploadStatusButton.setIcon(FontAwesome.UPLOAD);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected void updateUploadBtnIconToProgressIndicator() {
|
protected void updateUploadBtnIconToProgressIndicator() {
|
||||||
if (null != bulkUploadStatusButton) {
|
if (bulkUploadStatusButton == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
bulkUploadStatusButton.addStyleName(SPUIStyleDefinitions.BULK_UPLOAD_PROGRESS_INDICATOR_STYLE);
|
bulkUploadStatusButton.addStyleName(SPUIStyleDefinitions.BULK_UPLOAD_PROGRESS_INDICATOR_STYLE);
|
||||||
bulkUploadStatusButton.setIcon(null);
|
bulkUploadStatusButton.setIcon(null);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected void actionButtonClicked() {
|
protected void actionButtonClicked() {
|
||||||
if (hasUnsavedActions()) {
|
if (!hasUnsavedActions()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
unsavedActionsWindow = SPUIComponentProvider.getWindow(getUnsavedActionsWindowCaption(),
|
unsavedActionsWindow = SPUIComponentProvider.getWindow(getUnsavedActionsWindowCaption(),
|
||||||
SPUIComponetIdProvider.SAVE_ACTIONS_POPUP, SPUIDefinitions.CONFIRMATION_WINDOW);
|
SPUIComponetIdProvider.SAVE_ACTIONS_POPUP, SPUIDefinitions.CONFIRMATION_WINDOW);
|
||||||
unsavedActionsWindow.addCloseListener(event -> unsavedActionsWindowClosed());
|
unsavedActionsWindow.addCloseListener(event -> unsavedActionsWindowClosed());
|
||||||
@@ -216,7 +222,6 @@ public abstract class AbstractDeleteActionsLayout extends VerticalLayout impleme
|
|||||||
unsavedActionsWindow.setId(SPUIComponetIdProvider.CONFIRMATION_POPUP_ID);
|
unsavedActionsWindow.setId(SPUIComponetIdProvider.CONFIRMATION_POPUP_ID);
|
||||||
UI.getCurrent().addWindow(unsavedActionsWindow);
|
UI.getCurrent().addWindow(unsavedActionsWindow);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It will close the unsaved actions window.
|
* It will close the unsaved actions window.
|
||||||
@@ -225,22 +230,11 @@ public abstract class AbstractDeleteActionsLayout extends VerticalLayout impleme
|
|||||||
UI.getCurrent().removeWindow(unsavedActionsWindow);
|
UI.getCurrent().removeWindow(unsavedActionsWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see com.vaadin.event.dd.DropHandler#getAcceptCriterion()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public AcceptCriterion getAcceptCriterion() {
|
public AcceptCriterion getAcceptCriterion() {
|
||||||
return getDeleteLayoutAcceptCriteria();
|
return getDeleteLayoutAcceptCriteria();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see com.vaadin.event.dd.DropHandler#drop(com.vaadin.event.dd.
|
|
||||||
* DragAndDropEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void drop(final DragAndDropEvent event) {
|
public void drop(final DragAndDropEvent event) {
|
||||||
processDroppedComponent(event);
|
processDroppedComponent(event);
|
||||||
@@ -287,6 +281,42 @@ public abstract class AbstractDeleteActionsLayout extends VerticalLayout impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return true if the count label is displayed false is not displayed
|
||||||
|
*/
|
||||||
|
protected boolean hasCountMessage() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return the count message label
|
||||||
|
*/
|
||||||
|
protected Label getCountMessageLabel() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if bulk upload is allowed and has required create
|
||||||
|
* permissions.
|
||||||
|
*/
|
||||||
|
protected boolean hasBulkUploadPermission() {
|
||||||
|
// can be overriden
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showBulkUploadWindow() {
|
||||||
|
// can be overriden
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* restore the upload status count.
|
||||||
|
*/
|
||||||
|
protected void restoreBulkUploadStatusCount() {
|
||||||
|
// can be overriden
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check user has delete permission.
|
* Check user has delete permission.
|
||||||
*
|
*
|
||||||
@@ -362,11 +392,6 @@ public abstract class AbstractDeleteActionsLayout extends VerticalLayout impleme
|
|||||||
*/
|
*/
|
||||||
protected abstract void restoreActionCount();
|
protected abstract void restoreActionCount();
|
||||||
|
|
||||||
/**
|
|
||||||
* restore the upload status count.
|
|
||||||
*/
|
|
||||||
protected abstract void restoreBulkUploadStatusCount();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will be called when unsaved actions window is closed.
|
* This method will be called when unsaved actions window is closed.
|
||||||
*/
|
*/
|
||||||
@@ -387,21 +412,4 @@ public abstract class AbstractDeleteActionsLayout extends VerticalLayout impleme
|
|||||||
*/
|
*/
|
||||||
protected abstract boolean hasUnsavedActions();
|
protected abstract boolean hasUnsavedActions();
|
||||||
|
|
||||||
/**
|
|
||||||
* Only in deployment view count message is displayed.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected abstract boolean hasCountMessage();
|
|
||||||
|
|
||||||
protected abstract Label getCountMessageLabel();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return true if bulk upload is allowed and has required create
|
|
||||||
* permissions.
|
|
||||||
*/
|
|
||||||
protected abstract boolean hasBulkUploadPermission();
|
|
||||||
|
|
||||||
protected abstract void showBulkUploadWindow();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*/
|
||||||
|
package org.eclipse.hawkbit.ui.common.table;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.TableColumn;
|
||||||
|
|
||||||
|
import com.vaadin.data.Item;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract table to handling {@link NamedVersionedEntity}
|
||||||
|
*
|
||||||
|
* @param <E>
|
||||||
|
* e is the entity class
|
||||||
|
* @param <I>
|
||||||
|
* i is the id of the table
|
||||||
|
*/
|
||||||
|
public abstract class AbstractNamedVersionTable<E extends NamedVersionedEntity, I> extends AbstractTable<E, I> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 780050712209750719L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<TableColumn> getTableVisibleColumns() {
|
||||||
|
final List<TableColumn> columnList = super.getTableVisibleColumns();
|
||||||
|
final float versionColumnSize = isMaximized() ? 0.1F : 0.2F;
|
||||||
|
columnList
|
||||||
|
.add(new TableColumn(SPUILabelDefinitions.VAR_VERSION, i18n.get("header.version"), versionColumnSize));
|
||||||
|
return columnList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
protected void updateEntity(final E baseEntity, final Item item) {
|
||||||
|
super.updateEntity(baseEntity, item);
|
||||||
|
item.getItemProperty(SPUILabelDefinitions.VAR_VERSION).setValue(baseEntity.getVersion());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -9,34 +9,65 @@
|
|||||||
package org.eclipse.hawkbit.ui.common.table;
|
package org.eclipse.hawkbit.ui.common.table;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.annotation.PreDestroy;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||||
|
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
||||||
|
import org.eclipse.hawkbit.ui.common.ManagmentEntityState;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.TableColumn;
|
import org.eclipse.hawkbit.ui.utils.TableColumn;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.vaadin.spring.events.EventBus;
|
||||||
|
|
||||||
|
import com.google.gwt.thirdparty.guava.common.collect.Iterables;
|
||||||
import com.vaadin.data.Container;
|
import com.vaadin.data.Container;
|
||||||
|
import com.vaadin.data.Item;
|
||||||
import com.vaadin.event.dd.DropHandler;
|
import com.vaadin.event.dd.DropHandler;
|
||||||
import com.vaadin.ui.Table;
|
import com.vaadin.ui.Table;
|
||||||
|
import com.vaadin.ui.UI;
|
||||||
import com.vaadin.ui.themes.ValoTheme;
|
import com.vaadin.ui.themes.ValoTheme;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parent class for table.
|
* Abstract table to handling entity
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
*
|
||||||
|
* @param <E>
|
||||||
|
* e is the entity class
|
||||||
|
* @param <I>
|
||||||
|
* i is the id of the table
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractTable extends Table {
|
public abstract class AbstractTable<E extends NamedEntity, I> extends Table {
|
||||||
|
|
||||||
private static final long serialVersionUID = 4856562746502217630L;
|
private static final long serialVersionUID = 4856562746502217630L;
|
||||||
|
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(AbstractTable.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
protected transient EventBus.SessionEventBus eventBus;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
protected I18N i18n;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the components.
|
* Initialize the components.
|
||||||
*/
|
*/
|
||||||
|
@PostConstruct
|
||||||
protected void init() {
|
protected void init() {
|
||||||
setStyleName("sp-table");
|
setStyleName("sp-table");
|
||||||
setSizeFull();
|
setSizeFull();
|
||||||
setImmediate(true);
|
setImmediate(true);
|
||||||
setHeight(100.0f, Unit.PERCENTAGE);
|
setHeight(100.0F, Unit.PERCENTAGE);
|
||||||
addStyleName(ValoTheme.TABLE_NO_VERTICAL_LINES);
|
addStyleName(ValoTheme.TABLE_NO_VERTICAL_LINES);
|
||||||
addStyleName(ValoTheme.TABLE_SMALL);
|
addStyleName(ValoTheme.TABLE_SMALL);
|
||||||
setSortEnabled(false);
|
setSortEnabled(false);
|
||||||
@@ -48,6 +79,50 @@ public abstract class AbstractTable extends Table {
|
|||||||
addValueChangeListener(event -> onValueChange());
|
addValueChangeListener(event -> onValueChange());
|
||||||
selectRow();
|
selectRow();
|
||||||
setPageLength(SPUIDefinitions.PAGE_SIZE);
|
setPageLength(SPUIDefinitions.PAGE_SIZE);
|
||||||
|
|
||||||
|
setDataAvailable(getContainerDataSource().size() != 0);
|
||||||
|
eventBus.subscribe(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreDestroy
|
||||||
|
protected void destroy() {
|
||||||
|
eventBus.unsubscribe(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Set<T> getTableValue(final Table table) {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
Set<T> values = (Set<T>) table.getValue();
|
||||||
|
if (values == null) {
|
||||||
|
values = Collections.emptySet();
|
||||||
|
}
|
||||||
|
if (values.contains(null)) {
|
||||||
|
LOG.warn("Null values in table content. How could this happen?");
|
||||||
|
}
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onValueChange() {
|
||||||
|
eventBus.publish(this, UploadArtifactUIEvent.HIDE_DROP_HINTS);
|
||||||
|
|
||||||
|
final Set<I> values = getTableValue(this);
|
||||||
|
|
||||||
|
E entity = null;
|
||||||
|
I lastId = null;
|
||||||
|
if (!values.isEmpty()) {
|
||||||
|
lastId = Iterables.getLast(values);
|
||||||
|
entity = findEntityByTableValue(lastId);
|
||||||
|
}
|
||||||
|
setManagementEntitiyStateValues(values, lastId);
|
||||||
|
publishEntityAfterValueChange(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setManagementEntitiyStateValues(final Set<I> values, final I lastId) {
|
||||||
|
final ManagmentEntityState<I> managmentEntityState = getManagmentEntityState();
|
||||||
|
if (managmentEntityState == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
managmentEntityState.setLastSelectedEntity(lastId);
|
||||||
|
managmentEntityState.setSelectedEnitities(values);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDefault() {
|
private void setDefault() {
|
||||||
@@ -118,6 +193,75 @@ public abstract class AbstractTable extends Table {
|
|||||||
selectRow();
|
selectRow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add new software module to table.
|
||||||
|
*
|
||||||
|
* @param baseEntity
|
||||||
|
* new software module
|
||||||
|
*/
|
||||||
|
protected Item addEntity(final E baseEntity) {
|
||||||
|
final Object addItem = addItem();
|
||||||
|
final Item item = getItem(addItem);
|
||||||
|
updateEntity(baseEntity, item);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
protected void updateEntity(final E baseEntity, final Item item) {
|
||||||
|
item.getItemProperty(SPUILabelDefinitions.VAR_NAME).setValue(baseEntity.getName());
|
||||||
|
item.getItemProperty(SPUILabelDefinitions.VAR_ID).setValue(baseEntity.getId());
|
||||||
|
item.getItemProperty(SPUILabelDefinitions.VAR_DESC).setValue(baseEntity.getDescription());
|
||||||
|
item.getItemProperty(SPUILabelDefinitions.VAR_CREATED_BY)
|
||||||
|
.setValue(HawkbitCommonUtil.getIMUser(baseEntity.getCreatedBy()));
|
||||||
|
item.getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY)
|
||||||
|
.setValue(HawkbitCommonUtil.getIMUser(baseEntity.getLastModifiedBy()));
|
||||||
|
item.getItemProperty(SPUILabelDefinitions.VAR_CREATED_DATE)
|
||||||
|
.setValue(SPDateTimeUtil.getFormattedDate(baseEntity.getCreatedAt()));
|
||||||
|
item.getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE)
|
||||||
|
.setValue(SPDateTimeUtil.getFormattedDate(baseEntity.getLastModifiedAt()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onBaseEntityEvent(final BaseEntityEvent<E> event) {
|
||||||
|
if (BaseEntityEventType.MINIMIZED == event.getEventType()) {
|
||||||
|
UI.getCurrent().access(() -> applyMinTableSettings());
|
||||||
|
} else if (BaseEntityEventType.MAXIMIZED == event.getEventType()) {
|
||||||
|
UI.getCurrent().access(() -> applyMaxTableSettings());
|
||||||
|
} else if (BaseEntityEventType.NEW_ENTITY == event.getEventType()) {
|
||||||
|
UI.getCurrent().access(() -> addEntity(event.getEntity()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the entity which should be deleted by a transferable
|
||||||
|
*
|
||||||
|
* @param transferable
|
||||||
|
* the table transferable
|
||||||
|
* @return set of entities id which will deleted
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public Set<I> getDeletedEntityByTransferable(final TableTransferable transferable) {
|
||||||
|
final Set<I> selectedEntities = (Set<I>) getTableValue(this);
|
||||||
|
final Set<I> ids = new HashSet<>();
|
||||||
|
final Object tranferableData = transferable.getData(SPUIDefinitions.ITEMID);
|
||||||
|
if (tranferableData == null) {
|
||||||
|
return ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!selectedEntities.contains(tranferableData)) {
|
||||||
|
ids.add((I) tranferableData);
|
||||||
|
} else {
|
||||||
|
ids.addAll(selectedEntities);
|
||||||
|
}
|
||||||
|
return ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract E findEntityByTableValue(I lastSelectedId);
|
||||||
|
|
||||||
|
protected abstract void publishEntityAfterValueChange(E selectedLastEntity);
|
||||||
|
|
||||||
|
protected abstract ManagmentEntityState<I> getManagmentEntityState();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Id of the table.
|
* Get Id of the table.
|
||||||
*
|
*
|
||||||
@@ -141,7 +285,9 @@ public abstract class AbstractTable extends Table {
|
|||||||
/**
|
/**
|
||||||
* Add any generated columns if required.
|
* Add any generated columns if required.
|
||||||
*/
|
*/
|
||||||
protected abstract void addCustomGeneratedColumns();
|
protected void addCustomGeneratedColumns() {
|
||||||
|
// can be overriden
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if first row should be selected by default on load.
|
* Check if first row should be selected by default on load.
|
||||||
@@ -157,11 +303,6 @@ public abstract class AbstractTable extends Table {
|
|||||||
*/
|
*/
|
||||||
protected abstract Object getItemIdToSelect();
|
protected abstract Object getItemIdToSelect();
|
||||||
|
|
||||||
/**
|
|
||||||
* On select of row.
|
|
||||||
*/
|
|
||||||
protected abstract void onValueChange();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the table is maximized or minimized.
|
* Check if the table is maximized or minimized.
|
||||||
*
|
*
|
||||||
@@ -174,7 +315,26 @@ public abstract class AbstractTable extends Table {
|
|||||||
*
|
*
|
||||||
* @return List<TableColumn> list of visible columns
|
* @return List<TableColumn> list of visible columns
|
||||||
*/
|
*/
|
||||||
protected abstract List<TableColumn> getTableVisibleColumns();
|
protected List<TableColumn> getTableVisibleColumns() {
|
||||||
|
final List<TableColumn> columnList = new ArrayList<>();
|
||||||
|
if (!isMaximized()) {
|
||||||
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get("header.name"),
|
||||||
|
getColumnNameMinimizedSize()));
|
||||||
|
return columnList;
|
||||||
|
}
|
||||||
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get("header.name"), 0.2F));
|
||||||
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_BY, i18n.get("header.createdBy"), 0.1F));
|
||||||
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_DATE, i18n.get("header.createdDate"), 0.1F));
|
||||||
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, i18n.get("header.modifiedBy"), 0.1F));
|
||||||
|
columnList.add(
|
||||||
|
new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, i18n.get("header.modifiedDate"), 0.1F));
|
||||||
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_DESC, i18n.get("header.description"), 0.2F));
|
||||||
|
return columnList;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected float getColumnNameMinimizedSize() {
|
||||||
|
return 0.8F;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get drop handler for the table.
|
* Get drop handler for the table.
|
||||||
@@ -183,4 +343,6 @@ public abstract class AbstractTable extends Table {
|
|||||||
*/
|
*/
|
||||||
protected abstract DropHandler getTableDropHandler();
|
protected abstract DropHandler getTableDropHandler();
|
||||||
|
|
||||||
|
protected abstract void setDataAvailable(boolean available);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*/
|
||||||
|
package org.eclipse.hawkbit.ui.common.table;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event to represent add, update or delete.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class BaseEntityEvent<T extends BaseEntity> {
|
||||||
|
|
||||||
|
private final BaseEntityEventType eventType;
|
||||||
|
|
||||||
|
private final T entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base entity event
|
||||||
|
*
|
||||||
|
* @param eventType
|
||||||
|
* the event type
|
||||||
|
* @param entity
|
||||||
|
* the entity reference
|
||||||
|
*/
|
||||||
|
public BaseEntityEvent(final BaseEntityEventType eventType, final T entity) {
|
||||||
|
this.eventType = eventType;
|
||||||
|
this.entity = entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getEntity() {
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseEntityEventType getEventType() {
|
||||||
|
return eventType;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*/
|
||||||
|
package org.eclipse.hawkbit.ui.common.table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of the entity event.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public enum BaseEntityEventType {
|
||||||
|
NEW_ENTITY, UPDATED_ENTITY, DELETE_ENTITY, SELECTED_ENTITY, MAXIMIZED, MINIMIZED;
|
||||||
|
}
|
||||||
@@ -17,6 +17,9 @@ import javax.annotation.PostConstruct;
|
|||||||
import javax.annotation.PreDestroy;
|
import javax.annotation.PreDestroy;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||||
|
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEvent;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
@@ -35,6 +38,7 @@ import com.vaadin.server.FontAwesome;
|
|||||||
import com.vaadin.shared.ui.combobox.FilteringMode;
|
import com.vaadin.shared.ui.combobox.FilteringMode;
|
||||||
import com.vaadin.ui.Button;
|
import com.vaadin.ui.Button;
|
||||||
import com.vaadin.ui.CssLayout;
|
import com.vaadin.ui.CssLayout;
|
||||||
|
import com.vaadin.ui.UI;
|
||||||
import com.vaadin.ui.themes.ValoTheme;
|
import com.vaadin.ui.themes.ValoTheme;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,7 +48,7 @@ import com.vaadin.ui.themes.ValoTheme;
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractTagToken implements Serializable {
|
public abstract class AbstractTagToken<T extends BaseEntity> implements Serializable {
|
||||||
|
|
||||||
private static final String COLOR_PROPERTY = "color";
|
private static final String COLOR_PROPERTY = "color";
|
||||||
|
|
||||||
@@ -75,6 +79,8 @@ public abstract class AbstractTagToken implements Serializable {
|
|||||||
@Autowired
|
@Autowired
|
||||||
protected ManagementUIState managementUIState;
|
protected ManagementUIState managementUIState;
|
||||||
|
|
||||||
|
protected T selectedEntity;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
protected void init() {
|
protected void init() {
|
||||||
createTokenField();
|
createTokenField();
|
||||||
@@ -82,12 +88,24 @@ public abstract class AbstractTagToken implements Serializable {
|
|||||||
eventBus.subscribe(this);
|
eventBus.subscribe(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PreDestroy
|
@PreDestroy
|
||||||
void destroy() {
|
protected void destroy() {
|
||||||
eventBus.unsubscribe(this);
|
eventBus.unsubscribe(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void onBaseEntityEvent(final BaseEntityEvent<T> baseEntityEvent) {
|
||||||
|
if (BaseEntityEventType.SELECTED_ENTITY != baseEntityEvent.getEventType()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
UI.getCurrent().access(() -> {
|
||||||
|
final T entity = baseEntityEvent.getEntity();
|
||||||
|
if (entity != null) {
|
||||||
|
selectedEntity = entity;
|
||||||
|
repopulateToken();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void createTokenField() {
|
private void createTokenField() {
|
||||||
final Container tokenContainer = createContainer();
|
final Container tokenContainer = createContainer();
|
||||||
tokenField = createTokenField(tokenContainer);
|
tokenField = createTokenField(tokenContainer);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.ui.common.tagdetails;
|
|||||||
import org.eclipse.hawkbit.eventbus.event.TargetTagCreatedBulkEvent;
|
import org.eclipse.hawkbit.eventbus.event.TargetTagCreatedBulkEvent;
|
||||||
import org.eclipse.hawkbit.eventbus.event.TargetTagDeletedEvent;
|
import org.eclipse.hawkbit.eventbus.event.TargetTagDeletedEvent;
|
||||||
import org.eclipse.hawkbit.repository.TagManagement;
|
import org.eclipse.hawkbit.repository.TagManagement;
|
||||||
|
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.vaadin.spring.events.EventScope;
|
import org.vaadin.spring.events.EventScope;
|
||||||
@@ -19,15 +20,13 @@ import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
|||||||
/**
|
/**
|
||||||
* Abstract class for target tag token layout.
|
* Abstract class for target tag token layout.
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractTargetTagToken extends AbstractTagToken {
|
public abstract class AbstractTargetTagToken<T extends BaseEntity> extends AbstractTagToken<T> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 7772876588903171201L;
|
private static final long serialVersionUID = 7772876588903171201L;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
protected transient TagManagement tagManagement;
|
protected transient TagManagement tagManagement;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEventTargetTagCreated(final TargetTagCreatedBulkEvent event) {
|
void onEventTargetTagCreated(final TargetTagCreatedBulkEvent event) {
|
||||||
for (final TargetTag tag : event.getEntities()) {
|
for (final TargetTag tag : event.getEntities()) {
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.annotation.PreDestroy;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagAssigmentResultEvent;
|
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagAssigmentResultEvent;
|
||||||
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagCreatedBulkEvent;
|
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagCreatedBulkEvent;
|
||||||
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagDeletedEvent;
|
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagDeletedEvent;
|
||||||
@@ -26,7 +24,6 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
|
|||||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
|
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
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.management.event.ManagementUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -36,7 +33,6 @@ import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
|||||||
import com.vaadin.data.Item;
|
import com.vaadin.data.Item;
|
||||||
import com.vaadin.spring.annotation.SpringComponent;
|
import com.vaadin.spring.annotation.SpringComponent;
|
||||||
import com.vaadin.spring.annotation.ViewScope;
|
import com.vaadin.spring.annotation.ViewScope;
|
||||||
import com.vaadin.ui.UI;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of target/ds tag token layout.
|
* Implementation of target/ds tag token layout.
|
||||||
@@ -44,7 +40,7 @@ import com.vaadin.ui.UI;
|
|||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
public class DistributionTagToken extends AbstractTagToken {
|
public class DistributionTagToken extends AbstractTagToken<DistributionSet> {
|
||||||
|
|
||||||
private static final long serialVersionUID = -8022738301736043396L;
|
private static final long serialVersionUID = -8022738301736043396L;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -53,8 +49,6 @@ public class DistributionTagToken extends AbstractTagToken {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private transient DistributionSetManagement distributionSetManagement;
|
private transient DistributionSetManagement distributionSetManagement;
|
||||||
|
|
||||||
private DistributionSet selectedDS;
|
|
||||||
|
|
||||||
// To Be Done : have to set this value based on view???
|
// To Be Done : have to set this value based on view???
|
||||||
private static final Boolean NOTAGS_SELECTED = Boolean.FALSE;
|
private static final Boolean NOTAGS_SELECTED = Boolean.FALSE;
|
||||||
|
|
||||||
@@ -82,9 +76,9 @@ public class DistributionTagToken extends AbstractTagToken {
|
|||||||
|
|
||||||
private DistributionSetTagAssignmentResult toggleAssignment(final String tagNameSelected) {
|
private DistributionSetTagAssignmentResult toggleAssignment(final String tagNameSelected) {
|
||||||
final Set<Long> distributionList = new HashSet<>();
|
final Set<Long> distributionList = new HashSet<>();
|
||||||
distributionList.add(selectedDS.getId());
|
distributionList.add(selectedEntity.getId());
|
||||||
final DistributionSetTagAssignmentResult result = distributionSetManagement.toggleTagAssignment(distributionList,
|
final DistributionSetTagAssignmentResult result = distributionSetManagement
|
||||||
tagNameSelected);
|
.toggleTagAssignment(distributionList, tagNameSelected);
|
||||||
uinotification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(tagNameSelected, result, i18n));
|
uinotification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(tagNameSelected, result, i18n));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -117,8 +111,8 @@ public class DistributionTagToken extends AbstractTagToken {
|
|||||||
@Override
|
@Override
|
||||||
public void displayAlreadyAssignedTags() {
|
public void displayAlreadyAssignedTags() {
|
||||||
removePreviouslyAddedTokens();
|
removePreviouslyAddedTokens();
|
||||||
if (selectedDS != null) {
|
if (selectedEntity != null) {
|
||||||
for (final DistributionSetTag tag : selectedDS.getTags()) {
|
for (final DistributionSetTag tag : selectedEntity.getTags()) {
|
||||||
addNewToken(tag.getId());
|
addNewToken(tag.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,15 +128,7 @@ public class DistributionTagToken extends AbstractTagToken {
|
|||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final DistributionTableEvent distributionTableEvent) {
|
void onEvent(final DistributionTableEvent distributionTableEvent) {
|
||||||
if (distributionTableEvent.getDistributionComponentEvent() != DistributionComponentEvent.ON_VALUE_CHANGE) {
|
onBaseEntityEvent(distributionTableEvent);
|
||||||
return;
|
|
||||||
}
|
|
||||||
UI.getCurrent().access(() -> {
|
|
||||||
if (distributionTableEvent.getDistributionSet() != null) {
|
|
||||||
selectedDS = distributionTableEvent.getDistributionSet();
|
|
||||||
repopulateToken();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
@@ -202,10 +188,4 @@ public class DistributionTagToken extends AbstractTagToken {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@PreDestroy
|
|
||||||
void destroy() {
|
|
||||||
eventBus.unsubscribe(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import org.eclipse.hawkbit.repository.model.TargetTag;
|
|||||||
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
|
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
|
||||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentEvent;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -32,7 +31,6 @@ import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
|||||||
import com.vaadin.data.Item;
|
import com.vaadin.data.Item;
|
||||||
import com.vaadin.spring.annotation.SpringComponent;
|
import com.vaadin.spring.annotation.SpringComponent;
|
||||||
import com.vaadin.spring.annotation.ViewScope;
|
import com.vaadin.spring.annotation.ViewScope;
|
||||||
import com.vaadin.ui.UI;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of Target tag token.
|
* Implementation of Target tag token.
|
||||||
@@ -41,7 +39,7 @@ import com.vaadin.ui.UI;
|
|||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
public class TargetTagToken extends AbstractTargetTagToken {
|
public class TargetTagToken extends AbstractTargetTagToken<Target> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 7124887018280196721L;
|
private static final long serialVersionUID = 7124887018280196721L;
|
||||||
|
|
||||||
@@ -54,8 +52,6 @@ public class TargetTagToken extends AbstractTargetTagToken {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private transient TargetManagement targetManagement;
|
private transient TargetManagement targetManagement;
|
||||||
|
|
||||||
private Target selectedTarget;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTagStyleName() {
|
protected String getTagStyleName() {
|
||||||
return "target-tag-";
|
return "target-tag-";
|
||||||
@@ -80,7 +76,7 @@ public class TargetTagToken extends AbstractTargetTagToken {
|
|||||||
|
|
||||||
private TargetTagAssignmentResult toggleAssignment(final String tagNameSelected) {
|
private TargetTagAssignmentResult toggleAssignment(final String tagNameSelected) {
|
||||||
final Set<String> targetList = new HashSet<>();
|
final Set<String> targetList = new HashSet<>();
|
||||||
targetList.add(selectedTarget.getControllerId());
|
targetList.add(selectedEntity.getControllerId());
|
||||||
final TargetTagAssignmentResult result = targetManagement.toggleTagAssignment(targetList, tagNameSelected);
|
final TargetTagAssignmentResult result = targetManagement.toggleTagAssignment(targetList, tagNameSelected);
|
||||||
uinotification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(tagNameSelected, result, i18n));
|
uinotification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(tagNameSelected, result, i18n));
|
||||||
return result;
|
return result;
|
||||||
@@ -114,8 +110,8 @@ public class TargetTagToken extends AbstractTargetTagToken {
|
|||||||
@Override
|
@Override
|
||||||
protected void displayAlreadyAssignedTags() {
|
protected void displayAlreadyAssignedTags() {
|
||||||
removePreviouslyAddedTokens();
|
removePreviouslyAddedTokens();
|
||||||
if (selectedTarget != null) {
|
if (selectedEntity != null) {
|
||||||
for (final TargetTag tag : selectedTarget.getTags()) {
|
for (final TargetTag tag : selectedEntity.getTags()) {
|
||||||
addNewToken(tag.getId());
|
addNewToken(tag.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,13 +170,7 @@ public class TargetTagToken extends AbstractTargetTagToken {
|
|||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final TargetTableEvent targetTableEvent) {
|
void onEvent(final TargetTableEvent targetTableEvent) {
|
||||||
if (targetTableEvent.getTargetComponentEvent() == TargetComponentEvent.SELECTED_TARGET
|
onBaseEntityEvent(targetTableEvent);
|
||||||
&& targetTableEvent.getTarget() != null) {
|
|
||||||
UI.getCurrent().access(() -> {
|
|
||||||
selectedTarget = targetTableEvent.getTarget();
|
|
||||||
repopulateToken();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.customrenderers.client;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.ui.customrenderers.renderers.LinkRenderer;
|
|
||||||
|
|
||||||
import com.vaadin.client.connectors.ButtonRendererConnector;
|
|
||||||
import com.vaadin.shared.ui.Connect;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* A connector for {@link LinkRenderer}.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Connect(org.eclipse.hawkbit.ui.customrenderers.renderers.LinkRenderer.class)
|
|
||||||
public class LinkRendererConnector extends ButtonRendererConnector {
|
|
||||||
private static final long serialVersionUID = 7987417436367399331L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public org.eclipse.hawkbit.ui.customrenderers.client.renderers.LinkRenderer getRenderer() {
|
|
||||||
return (org.eclipse.hawkbit.ui.customrenderers.client.renderers.LinkRenderer) super.getRenderer();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.eclipse.hawkbit.ui.customrenderers.client;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
|
||||||
|
|
||||||
|
import com.google.web.bindery.event.shared.HandlerRegistration;
|
||||||
|
import com.vaadin.client.connectors.ClickableRendererConnector;
|
||||||
|
import com.vaadin.client.renderers.ClickableRenderer.RendererClickHandler;
|
||||||
|
import com.vaadin.shared.ui.Connect;
|
||||||
|
|
||||||
|
import elemental.json.JsonObject;
|
||||||
|
/**
|
||||||
|
* A connector for {@link CustomObjectRenderer }.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Connect(org.eclipse.hawkbit.ui.customrenderers.renderers.RolloutRenderer.class)
|
||||||
|
public class RolloutRendererConnector extends ClickableRendererConnector<RolloutRendererData> {
|
||||||
|
private static final long serialVersionUID = 7734682321931830566L;
|
||||||
|
|
||||||
|
public org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRenderer getRenderer() {
|
||||||
|
return (org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRenderer) super.getRenderer();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected HandlerRegistration addClickHandler(
|
||||||
|
RendererClickHandler<JsonObject> handler) {
|
||||||
|
return getRenderer().addClickHandler(handler);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.customrenderers.client.renderers;
|
|
||||||
|
|
||||||
import com.google.gwt.user.client.ui.Button;
|
|
||||||
import com.vaadin.client.renderers.ButtonRenderer;
|
|
||||||
import com.vaadin.client.ui.VButton;
|
|
||||||
import com.vaadin.client.widget.grid.RendererCellReference;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Renders link with provided text.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class LinkRenderer extends ButtonRenderer {
|
|
||||||
@Override
|
|
||||||
public void render(RendererCellReference cell, String text, Button button) {
|
|
||||||
button.setText(text);
|
|
||||||
applystyle(button);
|
|
||||||
// this is to allow the button to disappear, if the text is null
|
|
||||||
button.setVisible(text != null);
|
|
||||||
button.getElement().setId(new StringBuilder("link").append(".").append(text).toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void applystyle(Button button) {
|
|
||||||
button.setStyleName(VButton.CLASSNAME);
|
|
||||||
button.addStyleName(getStyle("borderless"));
|
|
||||||
button.addStyleName(getStyle("small"));
|
|
||||||
button.addStyleName(getStyle("on-focus-no-border"));
|
|
||||||
button.addStyleName(getStyle("link"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getStyle(final String style) {
|
|
||||||
return new StringBuilder(style).append(" ").append(VButton.CLASSNAME).append("-").append(style).toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
/**
|
||||||
|
* 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.customrenderers.client.renderers;
|
||||||
|
|
||||||
|
import com.google.gwt.core.shared.GWT;
|
||||||
|
import com.vaadin.client.renderers.ClickableRenderer;
|
||||||
|
import com.vaadin.client.ui.VButton;
|
||||||
|
import com.vaadin.client.widget.grid.RendererCellReference;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders button with provided CustomObject.
|
||||||
|
* Used to display button with link.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class RolloutRenderer extends ClickableRenderer<RolloutRendererData, VButton> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VButton createWidget() {
|
||||||
|
VButton b = GWT.create(VButton.class);
|
||||||
|
b.addClickHandler(this);
|
||||||
|
b.setStylePrimaryName("v-nativebutton");
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(RendererCellReference cell, RolloutRendererData text, VButton button) {
|
||||||
|
final String creating = "CREATING";
|
||||||
|
button.setText(text.getName());
|
||||||
|
applystyle(button);
|
||||||
|
// this is to allow the button to disappear, if the text is null
|
||||||
|
button.setVisible(text.getName() != null);
|
||||||
|
button.getElement().setId(new StringBuilder("link").append(".").append(text.getName()).toString());
|
||||||
|
/*
|
||||||
|
* checking Rollout Status for applying button style. If Rollout status
|
||||||
|
* is not "CREATING", then the Rollout button is applying hyperlink
|
||||||
|
* style
|
||||||
|
*/
|
||||||
|
final boolean isStatusCreate = text.getStatus() != null && creating.equalsIgnoreCase(text.getStatus());
|
||||||
|
if (isStatusCreate) {
|
||||||
|
button.addStyleName(getStyle("boldhide"));
|
||||||
|
button.setEnabled(false);
|
||||||
|
} else {
|
||||||
|
button.setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applystyle(VButton button) {
|
||||||
|
button.setStyleName(VButton.CLASSNAME);
|
||||||
|
button.addStyleName(getStyle("borderless"));
|
||||||
|
button.addStyleName(getStyle("small"));
|
||||||
|
button.addStyleName(getStyle("on-focus-no-border"));
|
||||||
|
button.addStyleName(getStyle("link"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getStyle(final String style) {
|
||||||
|
return new StringBuilder(style).append(" ").append(VButton.CLASSNAME).append("-").append(style).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
/**
|
||||||
|
* 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.customrenderers.client.renderers;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RendererData class with Name and Status.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class RolloutRendererData implements Serializable {
|
||||||
|
private static final long serialVersionUID = -5018181529953620263L;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the RendererData.
|
||||||
|
*/
|
||||||
|
public RolloutRendererData() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the RendererData.
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* Name of the Rollout.
|
||||||
|
* @param status
|
||||||
|
* Status of Rollout.
|
||||||
|
*/
|
||||||
|
public RolloutRendererData(String name, String status) {
|
||||||
|
super();
|
||||||
|
this.name = name;
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.customrenderers.renderers;
|
|
||||||
|
|
||||||
import com.vaadin.ui.renderers.ButtonRenderer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Renders link with provided text.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class LinkRenderer extends ButtonRenderer {
|
|
||||||
private static final long serialVersionUID = -1242995370043404892L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Intialise link renderer.
|
|
||||||
*/
|
|
||||||
public LinkRenderer() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Intialise link renderer with {@link RendererClickListener}
|
|
||||||
*
|
|
||||||
* @param listener
|
|
||||||
* RendererClickListener
|
|
||||||
*/
|
|
||||||
public LinkRenderer(RendererClickListener listener) {
|
|
||||||
super(listener);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/**
|
||||||
|
* 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.customrenderers.renderers;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
|
||||||
|
|
||||||
|
import com.vaadin.ui.renderers.ClickableRenderer;
|
||||||
|
|
||||||
|
import elemental.json.JsonValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders button with provided CustomObject.
|
||||||
|
* Used to display button with link.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class RolloutRenderer extends ClickableRenderer<RolloutRendererData> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -8754180585906263554L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new custom object renderer.
|
||||||
|
*/
|
||||||
|
public RolloutRenderer() {
|
||||||
|
super(RolloutRendererData.class, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize custom object renderer with {@link Class<CustomObject>}
|
||||||
|
*
|
||||||
|
* @param presentationType
|
||||||
|
* Class<CustomObject>
|
||||||
|
*/
|
||||||
|
|
||||||
|
public RolloutRenderer(Class<RolloutRendererData> presentationType) {
|
||||||
|
super(presentationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new custom object renderer and adds the given click listener to it.
|
||||||
|
*
|
||||||
|
* @param listener
|
||||||
|
* the click listener to register
|
||||||
|
*/
|
||||||
|
public RolloutRenderer(RendererClickListener listener) {
|
||||||
|
this();
|
||||||
|
addClickListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JsonValue encode(RolloutRendererData resource) {
|
||||||
|
return super.encode(resource, RolloutRendererData.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,7 +13,7 @@ import javax.annotation.PreDestroy;
|
|||||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||||
import org.eclipse.hawkbit.ui.HawkbitUI;
|
import org.eclipse.hawkbit.ui.HawkbitUI;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.distributions.disttype.DSTypeFilterLayout;
|
import org.eclipse.hawkbit.ui.distributions.disttype.DSTypeFilterLayout;
|
||||||
import org.eclipse.hawkbit.ui.distributions.dstable.DistributionSetTableLayout;
|
import org.eclipse.hawkbit.ui.distributions.dstable.DistributionSetTableLayout;
|
||||||
import org.eclipse.hawkbit.ui.distributions.event.DragEvent;
|
import org.eclipse.hawkbit.ui.distributions.event.DragEvent;
|
||||||
@@ -22,7 +22,6 @@ import org.eclipse.hawkbit.ui.distributions.smtable.SwModuleTableLayout;
|
|||||||
import org.eclipse.hawkbit.ui.distributions.smtype.DistSMTypeFilterLayout;
|
import org.eclipse.hawkbit.ui.distributions.smtype.DistSMTypeFilterLayout;
|
||||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent.DistributionComponentEvent;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
@@ -160,18 +159,18 @@ public class DistributionsView extends VerticalLayout implements View, BrowserWi
|
|||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final DistributionTableEvent event) {
|
void onEvent(final DistributionTableEvent event) {
|
||||||
if (event.getDistributionComponentEvent() == DistributionComponentEvent.MINIMIZED) {
|
if (BaseEntityEventType.MINIMIZED == event.getEventType()) {
|
||||||
minimizeDistTable();
|
minimizeDistTable();
|
||||||
} else if (event.getDistributionComponentEvent() == DistributionComponentEvent.MAXIMIZED) {
|
} else if (BaseEntityEventType.MAXIMIZED == event.getEventType()) {
|
||||||
maximizeDistTable();
|
maximizeDistTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final SoftwareModuleEvent event) {
|
void onEvent(final SoftwareModuleEvent event) {
|
||||||
if (event.getSoftwareModuleEventType() == SoftwareModuleEventType.MINIMIZED) {
|
if (BaseEntityEventType.MINIMIZED == event.getEventType()) {
|
||||||
minimizeSwTable();
|
minimizeSwTable();
|
||||||
} else if (event.getSoftwareModuleEventType() == SoftwareModuleEventType.MAXIMIZED) {
|
} else if (BaseEntityEventType.MAXIMIZED == event.getEventType()) {
|
||||||
maximizeSwTable();
|
maximizeSwTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
|||||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleIdName;
|
import org.eclipse.hawkbit.repository.model.SoftwareModuleIdName;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
|
||||||
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractTableDetailsLayout;
|
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractNamedVersionedEntityTableDetailsLayout;
|
||||||
import org.eclipse.hawkbit.ui.common.detailslayout.SoftwareModuleDetailsTable;
|
import org.eclipse.hawkbit.ui.common.detailslayout.SoftwareModuleDetailsTable;
|
||||||
import org.eclipse.hawkbit.ui.common.tagdetails.DistributionTagToken;
|
import org.eclipse.hawkbit.ui.common.tagdetails.DistributionTagToken;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
@@ -31,7 +31,6 @@ import org.eclipse.hawkbit.ui.distributions.event.SoftwareModuleAssignmentDiscar
|
|||||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
import org.eclipse.hawkbit.ui.management.dstable.DistributionAddUpdateWindowLayout;
|
import org.eclipse.hawkbit.ui.management.dstable.DistributionAddUpdateWindowLayout;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent.DistributionComponentEvent;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -58,7 +57,7 @@ import com.vaadin.ui.Window;
|
|||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDetailsLayout<DistributionSet> {
|
||||||
|
|
||||||
private static final long serialVersionUID = -4595004466943546669L;
|
private static final long serialVersionUID = -4595004466943546669L;
|
||||||
|
|
||||||
@@ -85,10 +84,6 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
|||||||
|
|
||||||
private VerticalLayout tagsLayout;
|
private VerticalLayout tagsLayout;
|
||||||
|
|
||||||
private DistributionSet selectedDsModule;
|
|
||||||
|
|
||||||
private Long dsId;
|
|
||||||
|
|
||||||
Map<String, StringBuilder> assignedSWModule = new HashMap<>();
|
Map<String, StringBuilder> assignedSWModule = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -97,7 +92,8 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
|||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
softwareModuleTable = new SoftwareModuleDetailsTable();
|
softwareModuleTable = new SoftwareModuleDetailsTable();
|
||||||
softwareModuleTable.init(i18n, true, permissionChecker, distributionSetManagement, eventBus, manageDistUIState);
|
softwareModuleTable.init(getI18n(), true, getPermissionChecker(), distributionSetManagement, getEventBus(),
|
||||||
|
manageDistUIState);
|
||||||
super.init();
|
super.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,28 +102,15 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
|||||||
return tagsLayout;
|
return tagsLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateDetailsWidget(final DistributionSet ds) {
|
@Override
|
||||||
if (ds != null) {
|
protected void populateDetailsWidget() {
|
||||||
setDsId(ds.getId());
|
populateDetails();
|
||||||
setName(getDefaultCaption(), HawkbitCommonUtil.getFormattedNameVersion(ds.getName(), ds.getVersion()));
|
populateModule();
|
||||||
populateDetails(ds);
|
populateTags();
|
||||||
populateDescription(ds);
|
|
||||||
populateLog(ds);
|
|
||||||
populteModule(ds);
|
|
||||||
populateTags(ds);
|
|
||||||
} else {
|
|
||||||
setDsId(null);
|
|
||||||
setName(getDefaultCaption(), HawkbitCommonUtil.SP_STRING_EMPTY);
|
|
||||||
populateDetails(null);
|
|
||||||
populateDescription(null);
|
|
||||||
populteModule(null);
|
|
||||||
populateTags(null);
|
|
||||||
populateLog(null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populteModule(final DistributionSet distributionSet) {
|
private void populateModule() {
|
||||||
softwareModuleTable.populateModule(distributionSet);
|
softwareModuleTable.populateModule(getSelectedBaseEntity());
|
||||||
showUnsavedAssignment();
|
showUnsavedAssignment();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,12 +158,8 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param item
|
|
||||||
* @param entry
|
|
||||||
*/
|
|
||||||
private void assignSoftModuleButton(final Item item, final Map.Entry<String, StringBuilder> entry) {
|
private void assignSoftModuleButton(final Item item, final Map.Entry<String, StringBuilder> entry) {
|
||||||
if (permissionChecker.hasUpdateDistributionPermission() && distributionSetManagement
|
if (getPermissionChecker().hasUpdateDistributionPermission() && distributionSetManagement
|
||||||
.findDistributionSetById(manageDistUIState.getLastSelectedDistribution().get().getId())
|
.findDistributionSetById(manageDistUIState.getLastSelectedDistribution().get().getId())
|
||||||
.getAssignedTargets().isEmpty()) {
|
.getAssignedTargets().isEmpty()) {
|
||||||
final Button reassignSoftModule = SPUIComponentProvider.getButton(entry.getKey(), "", "", "", true,
|
final Button reassignSoftModule = SPUIComponentProvider.getButton(entry.getKey(), "", "", "", true,
|
||||||
@@ -243,69 +222,46 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
|||||||
return softwareLayout;
|
return softwareLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateTags(final DistributionSet ds) {
|
private void populateTags() {
|
||||||
tagsLayout.removeAllComponents();
|
tagsLayout.removeAllComponents();
|
||||||
if (null != ds) {
|
if (getSelectedBaseEntity() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
tagsLayout.addComponent(distributionTagToken.getTokenField());
|
tagsLayout.addComponent(distributionTagToken.getTokenField());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void populateLog(final DistributionSet ds) {
|
private void populateDetails() {
|
||||||
if (null != ds) {
|
if (getSelectedBaseEntity() != null) {
|
||||||
updateLogLayout(getLogLayout(), ds.getLastModifiedAt(), ds.getLastModifiedBy(), ds.getCreatedAt(),
|
updateDistributionSetDetailsLayout(getSelectedBaseEntity().getType().getName(),
|
||||||
ds.getCreatedBy(), i18n);
|
getSelectedBaseEntity().isRequiredMigrationStep());
|
||||||
} else {
|
|
||||||
updateLogLayout(getLogLayout(), null, HawkbitCommonUtil.SP_STRING_EMPTY, null, null, i18n);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void populateDetails(final DistributionSet ds) {
|
|
||||||
if (ds != null) {
|
|
||||||
updateDistributionSetDetailsLayout(ds.getType().getName(), ds.isRequiredMigrationStep());
|
|
||||||
} else {
|
} else {
|
||||||
updateDistributionSetDetailsLayout(null, null);
|
updateDistributionSetDetailsLayout(null, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateDescription(final DistributionSet ds) {
|
|
||||||
if (ds != null) {
|
|
||||||
updateDescriptionLayout(i18n.get("label.description"), ds.getDescription());
|
|
||||||
} else {
|
|
||||||
updateDescriptionLayout(i18n.get("label.description"), null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateDistributionSetDetailsLayout(final String type, final Boolean isMigrationRequired) {
|
private void updateDistributionSetDetailsLayout(final String type, final Boolean isMigrationRequired) {
|
||||||
final VerticalLayout detailsTabLayout = getDetailsLayout();
|
final VerticalLayout detailsTabLayout = getDetailsLayout();
|
||||||
detailsTabLayout.removeAllComponents();
|
detailsTabLayout.removeAllComponents();
|
||||||
|
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
final Label typeLabel = SPUIComponentProvider.createNameValueLabel(i18n.get("label.dist.details.type"),
|
final Label typeLabel = SPUIComponentProvider.createNameValueLabel(getI18n().get("label.dist.details.type"),
|
||||||
type);
|
type);
|
||||||
typeLabel.setId(SPUIComponetIdProvider.DETAILS_TYPE_LABEL_ID);
|
typeLabel.setId(SPUIComponetIdProvider.DETAILS_TYPE_LABEL_ID);
|
||||||
detailsTabLayout.addComponent(typeLabel);
|
detailsTabLayout.addComponent(typeLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isMigrationRequired != null) {
|
if (isMigrationRequired != null) {
|
||||||
detailsTabLayout.addComponent(
|
detailsTabLayout.addComponent(SPUIComponentProvider.createNameValueLabel(
|
||||||
SPUIComponentProvider.createNameValueLabel(i18n.get("checkbox.dist.migration.required"),
|
getI18n().get("checkbox.dist.migration.required"),
|
||||||
isMigrationRequired.equals(Boolean.TRUE) ? i18n.get("label.yes") : i18n.get("label.no")));
|
isMigrationRequired.equals(Boolean.TRUE) ? getI18n().get("label.yes") : getI18n().get("label.no")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getDsId() {
|
|
||||||
return dsId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDsId(final Long dsId) {
|
|
||||||
this.dsId = dsId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEdit(final ClickEvent event) {
|
protected void onEdit(final ClickEvent event) {
|
||||||
final Window newDistWindow = distributionAddUpdateWindowLayout.getWindow();
|
final Window newDistWindow = distributionAddUpdateWindowLayout.getWindow();
|
||||||
distributionAddUpdateWindowLayout.populateValuesOfDistribution(getDsId());
|
distributionAddUpdateWindowLayout.populateValuesOfDistribution(getSelectedBaseEntityId());
|
||||||
newDistWindow.setCaption(i18n.get("caption.update.dist"));
|
newDistWindow.setCaption(getI18n().get("caption.update.dist"));
|
||||||
UI.getCurrent().addWindow(newDistWindow);
|
UI.getCurrent().addWindow(newDistWindow);
|
||||||
newDistWindow.setVisible(Boolean.TRUE);
|
newDistWindow.setVisible(Boolean.TRUE);
|
||||||
}
|
}
|
||||||
@@ -326,78 +282,48 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
|||||||
return manageDistUIState.isDsTableMaximized();
|
return manageDistUIState.isDsTableMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void populateDetailsWidget() {
|
|
||||||
populateDetailsWidget(selectedDsModule);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getDefaultCaption() {
|
protected String getDefaultCaption() {
|
||||||
return i18n.get("distribution.details.header");
|
return getI18n().get("distribution.details.header");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addTabs(final TabSheet detailsTab) {
|
protected void addTabs(final TabSheet detailsTab) {
|
||||||
detailsTab.addTab(createDetailsLayout(), i18n.get("caption.tab.details"), null);
|
detailsTab.addTab(createDetailsLayout(), getI18n().get("caption.tab.details"), null);
|
||||||
detailsTab.addTab(createDescriptionLayout(), i18n.get("caption.tab.description"), null);
|
detailsTab.addTab(createDescriptionLayout(), getI18n().get("caption.tab.description"), null);
|
||||||
detailsTab.addTab(createSoftwareModuleTab(), i18n.get("caption.softwares.distdetail.tab"), null);
|
detailsTab.addTab(createSoftwareModuleTab(), getI18n().get("caption.softwares.distdetail.tab"), null);
|
||||||
detailsTab.addTab(createTagsLayout(), i18n.get("caption.tags.tab"), null);
|
detailsTab.addTab(createTagsLayout(), getI18n().get("caption.tags.tab"), null);
|
||||||
detailsTab.addTab(createLogLayout(), i18n.get("caption.logs.tab"), null);
|
detailsTab.addTab(createLogLayout(), getI18n().get("caption.logs.tab"), null);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void clearDetails() {
|
|
||||||
populateDetailsWidget(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean hasEditPermission() {
|
protected Boolean hasEditPermission() {
|
||||||
return permissionChecker.hasUpdateDistributionPermission();
|
return getPermissionChecker().hasUpdateDistributionPermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final SoftwareModuleEvent event) {
|
void onEvent(final SoftwareModuleEvent event) {
|
||||||
if (event.getSoftwareModuleEventType() == SoftwareModuleEventType.ASSIGN_SOFTWARE_MODULE) {
|
if (event.getSoftwareModuleEventType() == SoftwareModuleEventType.ASSIGN_SOFTWARE_MODULE) {
|
||||||
ui.access(() -> updateSoftwareModule(event.getSoftwareModule()));
|
UI.getCurrent().access(() -> updateSoftwareModule(event.getEntity()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final DistributionTableEvent distributionTableEvent) {
|
void onEvent(final DistributionTableEvent distributionTableEvent) {
|
||||||
if (distributionTableEvent.getDistributionComponentEvent() == DistributionComponentEvent.ON_VALUE_CHANGE
|
onBaseEntityEvent(distributionTableEvent);
|
||||||
|| distributionTableEvent
|
|
||||||
.getDistributionComponentEvent() == DistributionComponentEvent.EDIT_DISTRIBUTION) {
|
|
||||||
assignedSWModule.clear();
|
|
||||||
ui.access(() -> {
|
|
||||||
/**
|
|
||||||
* distributionTableEvent.getDistributionSet() is null when
|
|
||||||
* table has no data.
|
|
||||||
*/
|
|
||||||
if (distributionTableEvent.getDistributionSet() != null) {
|
|
||||||
selectedDsModule = distributionTableEvent.getDistributionSet();
|
|
||||||
populateData(true);
|
|
||||||
} else {
|
|
||||||
populateData(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (distributionTableEvent.getDistributionComponentEvent() == DistributionComponentEvent.MINIMIZED) {
|
|
||||||
ui.access(() -> showLayout());
|
|
||||||
} else if (distributionTableEvent.getDistributionComponentEvent() == DistributionComponentEvent.MAXIMIZED) {
|
|
||||||
ui.access(() -> hideLayout());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final SoftwareModuleAssignmentDiscardEvent softwareModuleAssignmentDiscardEvent) {
|
void onEvent(final SoftwareModuleAssignmentDiscardEvent softwareModuleAssignmentDiscardEvent) {
|
||||||
if (softwareModuleAssignmentDiscardEvent.getDistributionSetIdName() != null) {
|
if (softwareModuleAssignmentDiscardEvent.getDistributionSetIdName() != null) {
|
||||||
ui.access(() -> {
|
UI.getCurrent().access(() -> {
|
||||||
final DistributionSetIdName distIdName = softwareModuleAssignmentDiscardEvent
|
final DistributionSetIdName distIdName = softwareModuleAssignmentDiscardEvent
|
||||||
.getDistributionSetIdName();
|
.getDistributionSetIdName();
|
||||||
if (distIdName.getId().equals(selectedDsModule.getId())
|
if (distIdName.getId().equals(getSelectedBaseEntityId())
|
||||||
&& distIdName.getName().equals(selectedDsModule.getName())) {
|
&& distIdName.getName().equals(getSelectedBaseEntity().getName())) {
|
||||||
selectedDsModule = distributionSetManagement
|
setSelectedBaseEntity(
|
||||||
.findDistributionSetByIdWithDetails(selectedDsModule.getId());
|
distributionSetManagement.findDistributionSetByIdWithDetails(getSelectedBaseEntityId()));
|
||||||
populteModule(selectedDsModule);
|
populateModule();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -407,10 +333,11 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
|||||||
void onEvent(final SaveActionWindowEvent saveActionWindowEvent) {
|
void onEvent(final SaveActionWindowEvent saveActionWindowEvent) {
|
||||||
if ((saveActionWindowEvent == SaveActionWindowEvent.SAVED_ASSIGNMENTS
|
if ((saveActionWindowEvent == SaveActionWindowEvent.SAVED_ASSIGNMENTS
|
||||||
|| saveActionWindowEvent == SaveActionWindowEvent.DISCARD_ALL_ASSIGNMENTS)
|
|| saveActionWindowEvent == SaveActionWindowEvent.DISCARD_ALL_ASSIGNMENTS)
|
||||||
&& selectedDsModule != null) {
|
&& getSelectedBaseEntity() != null) {
|
||||||
assignedSWModule.clear();
|
assignedSWModule.clear();
|
||||||
selectedDsModule = distributionSetManagement.findDistributionSetByIdWithDetails(selectedDsModule.getId());
|
setSelectedBaseEntity(
|
||||||
ui.access(() -> populteModule(selectedDsModule));
|
distributionSetManagement.findDistributionSetByIdWithDetails(getSelectedBaseEntityId()));
|
||||||
|
UI.getCurrent().access(() -> populateModule());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,15 +12,11 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import javax.annotation.PreDestroy;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||||
@@ -32,23 +28,21 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
|||||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleIdName;
|
import org.eclipse.hawkbit.repository.model.SoftwareModuleIdName;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.AbstractNamedVersionTable;
|
||||||
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
|
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.distributions.event.DistributionsViewAcceptCriteria;
|
import org.eclipse.hawkbit.ui.distributions.event.DistributionsViewAcceptCriteria;
|
||||||
import org.eclipse.hawkbit.ui.distributions.event.DragEvent;
|
import org.eclipse.hawkbit.ui.distributions.event.DragEvent;
|
||||||
import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
|
import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
|
||||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
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.management.event.DistributionTableFilterEvent;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
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.SPUIComponetIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.TableColumn;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -56,7 +50,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
||||||
import org.vaadin.spring.events.EventBus;
|
|
||||||
import org.vaadin.spring.events.EventScope;
|
import org.vaadin.spring.events.EventScope;
|
||||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||||
|
|
||||||
@@ -77,7 +70,7 @@ import com.vaadin.ui.UI;
|
|||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
public class DistributionSetTable extends AbstractTable {
|
public class DistributionSetTable extends AbstractNamedVersionTable<DistributionSet, DistributionSetIdName> {
|
||||||
|
|
||||||
private static final long serialVersionUID = -7731776093470487988L;
|
private static final long serialVersionUID = -7731776093470487988L;
|
||||||
|
|
||||||
@@ -86,18 +79,12 @@ public class DistributionSetTable extends AbstractTable {
|
|||||||
private static final List<Object> DISPLAY_DROP_HINT_EVENTS = new ArrayList<>(
|
private static final List<Object> DISPLAY_DROP_HINT_EVENTS = new ArrayList<>(
|
||||||
Arrays.asList(DragEvent.SOFTWAREMODULE_DRAG));
|
Arrays.asList(DragEvent.SOFTWAREMODULE_DRAG));
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private I18N i18n;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SpPermissionChecker permissionChecker;
|
private SpPermissionChecker permissionChecker;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ManageDistUIState manageDistUIState;
|
private ManageDistUIState manageDistUIState;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private transient EventBus.SessionEventBus eventBus;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private transient DistributionSetManagement distributionSetManagement;
|
private transient DistributionSetManagement distributionSetManagement;
|
||||||
|
|
||||||
@@ -117,12 +104,9 @@ public class DistributionSetTable extends AbstractTable {
|
|||||||
* Initialize the component.
|
* Initialize the component.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@PostConstruct
|
|
||||||
protected void init() {
|
protected void init() {
|
||||||
super.init();
|
super.init();
|
||||||
addTableStyleGenerator();
|
addTableStyleGenerator();
|
||||||
setNoDataAvailable();
|
|
||||||
eventBus.subscribe(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
@@ -171,13 +155,6 @@ public class DistributionSetTable extends AbstractTable {
|
|||||||
Boolean.class, null, false, true);
|
Boolean.class, null, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addCustomGeneratedColumns() {
|
|
||||||
/**
|
|
||||||
* No generated columns.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isFirstRowSelectedOnLoad() {
|
protected boolean isFirstRowSelectedOnLoad() {
|
||||||
return !manageDistUIState.getSelectedDistributions().isPresent()
|
return !manageDistUIState.getSelectedDistributions().isPresent()
|
||||||
@@ -193,37 +170,19 @@ public class DistributionSetTable extends AbstractTable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onValueChange() {
|
protected DistributionSet findEntityByTableValue(final DistributionSetIdName entityTableId) {
|
||||||
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
return distributionSetManagement.findDistributionSetByIdWithDetails(entityTableId.getId());
|
||||||
@SuppressWarnings("unchecked")
|
}
|
||||||
final Set<DistributionSetIdName> values = (Set<DistributionSetIdName>) getValue();
|
|
||||||
DistributionSetIdName value = null;
|
|
||||||
if (values != null && !values.isEmpty()) {
|
|
||||||
final Iterator<DistributionSetIdName> iterator = values.iterator();
|
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
@Override
|
||||||
value = iterator.next();
|
protected ManageDistUIState getManagmentEntityState() {
|
||||||
|
return manageDistUIState;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Adding null check to make to avoid NPE.Its weird that at times
|
|
||||||
* getValue returns null.
|
|
||||||
*/
|
|
||||||
if (null != value) {
|
|
||||||
manageDistUIState.setSelectedDistributions(values);
|
|
||||||
manageDistUIState.setLastSelectedDistribution(value);
|
|
||||||
|
|
||||||
final DistributionSet lastSelectedDistSet = distributionSetManagement
|
@Override
|
||||||
.findDistributionSetByIdWithDetails(value.getId());
|
protected void publishEntityAfterValueChange(final DistributionSet distributionSet) {
|
||||||
eventBus.publish(this,
|
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.SELECTED_ENTITY, distributionSet));
|
||||||
new DistributionTableEvent(DistributionComponentEvent.ON_VALUE_CHANGE, lastSelectedDistSet));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
manageDistUIState.setSelectedDistributions(null);
|
|
||||||
manageDistUIState.setLastSelectedDistribution(null);
|
|
||||||
eventBus.publish(this, new DistributionTableEvent(DistributionComponentEvent.ON_VALUE_CHANGE, null));
|
|
||||||
}
|
|
||||||
eventBus.publish(this, DistributionsUIEvent.ORDER_BY_DISTRIBUTION);
|
eventBus.publish(this, DistributionsUIEvent.ORDER_BY_DISTRIBUTION);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -231,11 +190,6 @@ public class DistributionSetTable extends AbstractTable {
|
|||||||
return manageDistUIState.isDsTableMaximized();
|
return manageDistUIState.isDsTableMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected List<TableColumn> getTableVisibleColumns() {
|
|
||||||
return HawkbitCommonUtil.getTableVisibleColumns(isMaximized(), false, i18n);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DropHandler getTableDropHandler() {
|
protected DropHandler getTableDropHandler() {
|
||||||
return new DropHandler() {
|
return new DropHandler() {
|
||||||
@@ -257,15 +211,9 @@ public class DistributionSetTable extends AbstractTable {
|
|||||||
|
|
||||||
private void onDrop(final DragAndDropEvent event) {
|
private void onDrop(final DragAndDropEvent event) {
|
||||||
final TableTransferable transferable = (TableTransferable) event.getTransferable();
|
final TableTransferable transferable = (TableTransferable) event.getTransferable();
|
||||||
final Table source = transferable.getSourceComponent();
|
@SuppressWarnings("unchecked")
|
||||||
final Set<Long> softwareModuleSelected = (Set<Long>) source.getValue();
|
final AbstractTable<?, Long> source = (AbstractTable<SoftwareModule, Long>) transferable.getSourceComponent();
|
||||||
final Set<Long> softwareModulesIdList = new HashSet<>();
|
final Set<Long> softwareModulesIdList = source.getDeletedEntityByTransferable(transferable);
|
||||||
|
|
||||||
if (!softwareModuleSelected.contains(transferable.getData("itemId"))) {
|
|
||||||
softwareModulesIdList.add((Long) transferable.getData("itemId"));
|
|
||||||
} else {
|
|
||||||
softwareModulesIdList.addAll(softwareModuleSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
final AbstractSelectTargetDetails dropData = (AbstractSelectTargetDetails) event.getTargetDetails();
|
final AbstractSelectTargetDetails dropData = (AbstractSelectTargetDetails) event.getTargetDetails();
|
||||||
|
|
||||||
@@ -276,11 +224,6 @@ public class DistributionSetTable extends AbstractTable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param source
|
|
||||||
* @param softwareModulesIdList
|
|
||||||
* @param item
|
|
||||||
*/
|
|
||||||
private void handleDropEvent(final Table source, final Set<Long> softwareModulesIdList, final Item item) {
|
private void handleDropEvent(final Table source, final Set<Long> softwareModulesIdList, final Item item) {
|
||||||
final Long distId = (Long) item.getItemProperty("id").getValue();
|
final Long distId = (Long) item.getItemProperty("id").getValue();
|
||||||
final String distName = (String) item.getItemProperty("name").getValue();
|
final String distName = (String) item.getItemProperty("name").getValue();
|
||||||
@@ -331,10 +274,6 @@ public class DistributionSetTable extends AbstractTable {
|
|||||||
updateDropedDetails(distributionSetIdName, softwareModules);
|
updateDropedDetails(distributionSetIdName, softwareModules);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param distId
|
|
||||||
* @param softwareModule
|
|
||||||
*/
|
|
||||||
private void publishAssignEvent(final Long distId, final SoftwareModule softwareModule) {
|
private void publishAssignEvent(final Long distId, final SoftwareModule softwareModule) {
|
||||||
if (manageDistUIState.getLastSelectedDistribution().isPresent()
|
if (manageDistUIState.getLastSelectedDistribution().isPresent()
|
||||||
&& manageDistUIState.getLastSelectedDistribution().get().getId().equals(distId)) {
|
&& manageDistUIState.getLastSelectedDistribution().get().getId().equals(distId)) {
|
||||||
@@ -343,11 +282,6 @@ public class DistributionSetTable extends AbstractTable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param map
|
|
||||||
* @param softwareModule
|
|
||||||
* @param softwareModuleIdName
|
|
||||||
*/
|
|
||||||
private void handleFirmwareCase(final Map<Long, HashSet<SoftwareModuleIdName>> map,
|
private void handleFirmwareCase(final Map<Long, HashSet<SoftwareModuleIdName>> map,
|
||||||
final SoftwareModule softwareModule, final SoftwareModuleIdName softwareModuleIdName) {
|
final SoftwareModule softwareModule, final SoftwareModuleIdName softwareModuleIdName) {
|
||||||
if (softwareModule.getType().getMaxAssignments() == 1) {
|
if (softwareModule.getType().getMaxAssignments() == 1) {
|
||||||
@@ -361,11 +295,6 @@ public class DistributionSetTable extends AbstractTable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param map
|
|
||||||
* @param softwareModule
|
|
||||||
* @param softwareModuleIdName
|
|
||||||
*/
|
|
||||||
private void handleSoftwareCase(final Map<Long, HashSet<SoftwareModuleIdName>> map,
|
private void handleSoftwareCase(final Map<Long, HashSet<SoftwareModuleIdName>> map,
|
||||||
final SoftwareModule softwareModule, final SoftwareModuleIdName softwareModuleIdName) {
|
final SoftwareModule softwareModule, final SoftwareModuleIdName softwareModuleIdName) {
|
||||||
if (softwareModule.getType().getMaxAssignments() == Integer.MAX_VALUE) {
|
if (softwareModule.getType().getMaxAssignments() == Integer.MAX_VALUE) {
|
||||||
@@ -475,37 +404,6 @@ public class DistributionSetTable extends AbstractTable {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Add new software module to table.
|
|
||||||
*
|
|
||||||
* @param swModule
|
|
||||||
* new software module
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private void addDistributionSet(final DistributionSet distributionSet) {
|
|
||||||
final Object addItem = addItem();
|
|
||||||
final Item item = getItem(addItem);
|
|
||||||
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_NAME).setValue(distributionSet.getName());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.DIST_ID).setValue(distributionSet.getId());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_ID).setValue(distributionSet.getId());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_DESC).setValue(distributionSet.getDescription());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_VERSION).setValue(distributionSet.getVersion());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_CREATED_BY)
|
|
||||||
.setValue(HawkbitCommonUtil.getIMUser(distributionSet.getCreatedBy()));
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY)
|
|
||||||
.setValue(HawkbitCommonUtil.getIMUser(distributionSet.getLastModifiedBy()));
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_CREATED_DATE)
|
|
||||||
.setValue(SPDateTimeUtil.getFormattedDate(distributionSet.getCreatedAt()));
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE)
|
|
||||||
.setValue(SPDateTimeUtil.getFormattedDate(distributionSet.getLastModifiedAt()));
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_IS_DISTRIBUTION_COMPLETE).setValue(distributionSet.isComplete());
|
|
||||||
if (manageDistUIState.getSelectedDistributions().isPresent()) {
|
|
||||||
manageDistUIState.getSelectedDistributions().get().stream().forEach(dsNameId -> unselect(dsNameId));
|
|
||||||
}
|
|
||||||
select(distributionSet.getDistributionSetIdName());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addTableStyleGenerator() {
|
private void addTableStyleGenerator() {
|
||||||
setCellStyleGenerator((source, itemId, propertyId) -> {
|
setCellStyleGenerator((source, itemId, propertyId) -> {
|
||||||
if (propertyId == null) {
|
if (propertyId == null) {
|
||||||
@@ -525,13 +423,7 @@ public class DistributionSetTable extends AbstractTable {
|
|||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final DistributionTableEvent event) {
|
void onEvent(final DistributionTableEvent event) {
|
||||||
if (event.getDistributionComponentEvent() == DistributionComponentEvent.MINIMIZED) {
|
onBaseEntityEvent(event);
|
||||||
UI.getCurrent().access(() -> applyMinTableSettings());
|
|
||||||
} else if (event.getDistributionComponentEvent() == DistributionComponentEvent.MAXIMIZED) {
|
|
||||||
UI.getCurrent().access(() -> applyMaxTableSettings());
|
|
||||||
} else if (event.getDistributionComponentEvent() == DistributionComponentEvent.ADD_DISTRIBUTION) {
|
|
||||||
UI.getCurrent().access(() -> addDistributionSet(event.getDistributionSet()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
@@ -556,21 +448,28 @@ public class DistributionSetTable extends AbstractTable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreDestroy
|
@Override
|
||||||
void destroy() {
|
protected Item addEntity(final DistributionSet baseEntity) {
|
||||||
/*
|
final Item item = super.addEntity(baseEntity);
|
||||||
* It's good manners to do this, even though vaadin-spring will
|
if (manageDistUIState.getSelectedDistributions().isPresent()) {
|
||||||
* automatically unsubscribe when this UI is garbage collected.
|
manageDistUIState.getSelectedDistributions().get().stream().forEach(this::unselect);
|
||||||
*/
|
}
|
||||||
eventBus.unsubscribe(this);
|
select(baseEntity.getDistributionSetIdName());
|
||||||
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setNoDataAvailable() {
|
@Override
|
||||||
final int containerSize = getContainerDataSource().size();
|
@SuppressWarnings("unchecked")
|
||||||
if (containerSize == 0) {
|
protected void updateEntity(final DistributionSet baseEntity, final Item item) {
|
||||||
manageDistUIState.setNoDataAvailableDist(true);
|
item.getItemProperty(SPUILabelDefinitions.DIST_ID).setValue(baseEntity.getId());
|
||||||
} else {
|
item.getItemProperty(SPUILabelDefinitions.VAR_IS_DISTRIBUTION_COMPLETE).setValue(baseEntity.isComplete());
|
||||||
manageDistUIState.setNoDataAvailableDist(false);
|
super.updateEntity(baseEntity, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setDataAvailable(final boolean available) {
|
||||||
|
manageDistUIState.setNoDataAvailableDist(!available);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,12 @@
|
|||||||
package org.eclipse.hawkbit.ui.distributions.dstable;
|
package org.eclipse.hawkbit.ui.distributions.dstable;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.ui.common.table.AbstractTableHeader;
|
import org.eclipse.hawkbit.ui.common.table.AbstractTableHeader;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
|
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.distributions.event.DragEvent;
|
import org.eclipse.hawkbit.ui.distributions.event.DragEvent;
|
||||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
import org.eclipse.hawkbit.ui.management.dstable.DistributionAddUpdateWindowLayout;
|
import org.eclipse.hawkbit.ui.management.dstable.DistributionAddUpdateWindowLayout;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent.DistributionComponentEvent;
|
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableFilterEvent;
|
import org.eclipse.hawkbit.ui.management.event.DistributionTableFilterEvent;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -125,13 +125,13 @@ public class DistributionSetTableHeader extends AbstractTableHeader {
|
|||||||
@Override
|
@Override
|
||||||
public void maximizeTable() {
|
public void maximizeTable() {
|
||||||
manageDistUIstate.setDsTableMaximized(Boolean.TRUE);
|
manageDistUIstate.setDsTableMaximized(Boolean.TRUE);
|
||||||
eventbus.publish(this, new DistributionTableEvent(DistributionComponentEvent.MAXIMIZED, null));
|
eventbus.publish(this, new DistributionTableEvent(BaseEntityEventType.MAXIMIZED, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void minimizeTable() {
|
public void minimizeTable() {
|
||||||
manageDistUIstate.setDsTableMaximized(Boolean.FALSE);
|
manageDistUIstate.setDsTableMaximized(Boolean.FALSE);
|
||||||
eventbus.publish(this, new DistributionTableEvent(DistributionComponentEvent.MINIMIZED, null));
|
eventbus.publish(this, new DistributionTableEvent(BaseEntityEventType.MINIMIZED, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
|||||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleIdName;
|
import org.eclipse.hawkbit.repository.model.SoftwareModuleIdName;
|
||||||
import org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout;
|
import org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
||||||
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
|
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.distributions.event.DistributionsViewAcceptCriteria;
|
import org.eclipse.hawkbit.ui.distributions.event.DistributionsViewAcceptCriteria;
|
||||||
import org.eclipse.hawkbit.ui.distributions.event.DragEvent;
|
import org.eclipse.hawkbit.ui.distributions.event.DragEvent;
|
||||||
@@ -37,7 +38,6 @@ import com.vaadin.event.dd.DragAndDropEvent;
|
|||||||
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
|
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
|
||||||
import com.vaadin.spring.annotation.ViewScope;
|
import com.vaadin.spring.annotation.ViewScope;
|
||||||
import com.vaadin.ui.Component;
|
import com.vaadin.ui.Component;
|
||||||
import com.vaadin.ui.Label;
|
|
||||||
import com.vaadin.ui.Table;
|
import com.vaadin.ui.Table;
|
||||||
import com.vaadin.ui.Table.TableTransferable;
|
import com.vaadin.ui.Table.TableTransferable;
|
||||||
import com.vaadin.ui.UI;
|
import com.vaadin.ui.UI;
|
||||||
@@ -189,13 +189,8 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
|
|
||||||
private void addInDeleteDistributionList(final Table sourceTable, final TableTransferable transferable) {
|
private void addInDeleteDistributionList(final Table sourceTable, final TableTransferable transferable) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
final Set<DistributionSetIdName> distSelected = (Set<DistributionSetIdName>) sourceTable.getValue();
|
final AbstractTable<?, DistributionSetIdName> table = (AbstractTable<?, DistributionSetIdName>) sourceTable;
|
||||||
final Set<DistributionSetIdName> distributionIdNameSet = new HashSet<>();
|
final Set<DistributionSetIdName> distributionIdNameSet = table.getDeletedEntityByTransferable(transferable);
|
||||||
if (!distSelected.contains(transferable.getData(SPUIDefinitions.ITEMID))) {
|
|
||||||
distributionIdNameSet.add((DistributionSetIdName) transferable.getData(SPUIDefinitions.ITEMID));
|
|
||||||
} else {
|
|
||||||
distributionIdNameSet.addAll(distSelected);
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* Flags to identify whether all dropped distributions are already in
|
* Flags to identify whether all dropped distributions are already in
|
||||||
* the deleted list (or) some distributions are already in the deleted
|
* the deleted list (or) some distributions are already in the deleted
|
||||||
@@ -225,15 +220,10 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addToSWDeleteList(final Table sourceTable, final TableTransferable transferable) {
|
private void addToSWDeleteList(final Table sourceTable, final TableTransferable transferable) {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
final Set<Long> swModuleSelected = (Set<Long>) sourceTable.getValue();
|
final AbstractTable<?, Long> swTable = (AbstractTable<?, Long>) sourceTable;
|
||||||
final Set<Long> swModuleIdNameSet = new HashSet<>();
|
final Set<Long> swModuleIdNameSet = swTable.getDeletedEntityByTransferable(transferable);
|
||||||
if (!swModuleSelected.contains(transferable.getData(SPUIDefinitions.ITEMID))) {
|
|
||||||
swModuleIdNameSet.add((Long) transferable.getData(SPUIDefinitions.ITEMID));
|
|
||||||
} else {
|
|
||||||
swModuleIdNameSet.addAll(swModuleSelected);
|
|
||||||
}
|
|
||||||
swModuleIdNameSet.forEach(id -> {
|
swModuleIdNameSet.forEach(id -> {
|
||||||
final String swModuleName = (String) sourceTable.getContainerDataSource().getItem(id)
|
final String swModuleName = (String) sourceTable.getContainerDataSource().getItem(id)
|
||||||
.getItemProperty(SPUILabelDefinitions.NAME_VERSION).getValue();
|
.getItemProperty(SPUILabelDefinitions.NAME_VERSION).getValue();
|
||||||
@@ -296,7 +286,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Component getUnsavedActionsWindowContent() {
|
protected Component getUnsavedActionsWindowContent() {
|
||||||
distConfirmationWindowLayout.init();
|
distConfirmationWindowLayout.initialize();
|
||||||
return distConfirmationWindowLayout;
|
return distConfirmationWindowLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,35 +306,6 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
return unSavedActionsTables || unSavedActionsTypes;
|
return unSavedActionsTables || unSavedActionsTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean hasCountMessage() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Label getCountMessageLabel() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean hasBulkUploadPermission() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void showBulkUploadWindow() {
|
|
||||||
/**
|
|
||||||
* Bulk upload not supported No implementation required.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void restoreBulkUploadStatusCount() {
|
|
||||||
/**
|
|
||||||
* No implementation required.As no bulk upload in Distribution view.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
private DistributionSetType getCurrentDistributionSetType() {
|
private DistributionSetType getCurrentDistributionSetType() {
|
||||||
return systemManagement.getTenantMetadata().getDefaultDsType();
|
return systemManagement.getTenantMetadata().getDefaultDsType();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.distributions.footer;
|
package org.eclipse.hawkbit.ui.distributions.footer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -17,8 +16,6 @@ import java.util.Map.Entry;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
@@ -32,13 +29,11 @@ import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
|||||||
import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
|
import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
|
||||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
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.SPUIComponetIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.vaadin.spring.events.EventBus;
|
|
||||||
import org.vaadin.spring.events.EventScope;
|
import org.vaadin.spring.events.EventScope;
|
||||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||||
|
|
||||||
@@ -48,6 +43,7 @@ import com.vaadin.data.util.IndexedContainer;
|
|||||||
import com.vaadin.server.FontAwesome;
|
import com.vaadin.server.FontAwesome;
|
||||||
import com.vaadin.spring.annotation.ViewScope;
|
import com.vaadin.spring.annotation.ViewScope;
|
||||||
import com.vaadin.ui.Button;
|
import com.vaadin.ui.Button;
|
||||||
|
import com.vaadin.ui.Button.ClickListener;
|
||||||
import com.vaadin.ui.Table.Align;
|
import com.vaadin.ui.Table.Align;
|
||||||
import com.vaadin.ui.themes.ValoTheme;
|
import com.vaadin.ui.themes.ValoTheme;
|
||||||
|
|
||||||
@@ -83,12 +79,6 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
|
|||||||
|
|
||||||
private ConfirmationTab assignmnetTab;
|
private ConfirmationTab assignmnetTab;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private I18N i18n;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private transient EventBus.SessionEventBus eventBus;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private transient DistributionSetManagement dsManagement;
|
private transient DistributionSetManagement dsManagement;
|
||||||
|
|
||||||
@@ -98,20 +88,6 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ManageDistUIState manageDistUIState;
|
private ManageDistUIState manageDistUIState;
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialze the component.
|
|
||||||
*/
|
|
||||||
@PostConstruct
|
|
||||||
public void init() {
|
|
||||||
super.inittialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.confirmwindow.layout.
|
|
||||||
* AbstractConfirmationWindowLayout# getConfimrationTabs()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, ConfirmationTab> getConfimrationTabs() {
|
protected Map<String, ConfirmationTab> getConfimrationTabs() {
|
||||||
final Map<String, ConfirmationTab> tabs = new HashMap<>();
|
final Map<String, ConfirmationTab> tabs = new HashMap<>();
|
||||||
@@ -161,26 +137,13 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
|
|||||||
|
|
||||||
/* Add the discard action column */
|
/* Add the discard action column */
|
||||||
tab.getTable().addGeneratedColumn(SW_DISCARD_CHGS, (source, itemId, columnId) -> {
|
tab.getTable().addGeneratedColumn(SW_DISCARD_CHGS, (source, itemId, columnId) -> {
|
||||||
final Button deleteswIcon = SPUIComponentProvider.getButton("", "", SPUILabelDefinitions.DISCARD,
|
final ClickListener clickListener = event -> discardSoftwareDelete(event, itemId, tab);
|
||||||
ValoTheme.BUTTON_TINY + " " + SPUIStyleDefinitions.REDICON, true, FontAwesome.REPLY,
|
return createDiscardButton(itemId, clickListener);
|
||||||
SPUIButtonStyleSmallNoBorder.class);
|
|
||||||
deleteswIcon.setData(itemId);
|
|
||||||
deleteswIcon.setImmediate(true);
|
|
||||||
deleteswIcon.addClickListener(event -> discardSoftwareDelete(event, itemId, tab));
|
|
||||||
return deleteswIcon;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/* set the visible columns */
|
tab.getTable().setVisibleColumns(SW_MODULE_NAME_MSG, SW_DISCARD_CHGS);
|
||||||
final List<Object> visibleColumnIds = new ArrayList<>();
|
tab.getTable().setColumnHeaders(i18n.get("upload.swModuleTable.header"),
|
||||||
final List<String> visibleColumnLabels = new ArrayList<>();
|
i18n.get("header.second.deletetarget.table"));
|
||||||
if (visibleColumnIds.isEmpty() && visibleColumnLabels.isEmpty()) {
|
|
||||||
visibleColumnIds.add(SW_MODULE_NAME_MSG);
|
|
||||||
visibleColumnIds.add(SW_DISCARD_CHGS);
|
|
||||||
visibleColumnLabels.add(i18n.get("upload.swModuleTable.header"));
|
|
||||||
visibleColumnLabels.add(i18n.get("header.second.deletetarget.table"));
|
|
||||||
}
|
|
||||||
tab.getTable().setVisibleColumns(visibleColumnIds.toArray());
|
|
||||||
tab.getTable().setColumnHeaders(visibleColumnLabels.toArray(new String[0]));
|
|
||||||
|
|
||||||
tab.getTable().setColumnExpandRatio(SW_MODULE_NAME_MSG, SPUIDefinitions.TARGET_DISTRIBUTION_COLUMN_WIDTH);
|
tab.getTable().setColumnExpandRatio(SW_MODULE_NAME_MSG, SPUIDefinitions.TARGET_DISTRIBUTION_COLUMN_WIDTH);
|
||||||
tab.getTable().setColumnExpandRatio(SW_DISCARD_CHGS, SPUIDefinitions.DISCARD_COLUMN_WIDTH);
|
tab.getTable().setColumnExpandRatio(SW_DISCARD_CHGS, SPUIDefinitions.DISCARD_COLUMN_WIDTH);
|
||||||
@@ -295,18 +258,9 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
|
|||||||
return deleteIcon;
|
return deleteIcon;
|
||||||
});
|
});
|
||||||
|
|
||||||
// set the visible columns
|
tab.getTable().setVisibleColumns(SW_MODULE_TYPE_NAME, DISCARD);
|
||||||
final List<Object> visibleColumnIds = new ArrayList<>();
|
tab.getTable().setColumnHeaders(i18n.get("header.first.delete.swmodule.type.table"),
|
||||||
final List<String> visibleColumnLabels = new ArrayList<>();
|
i18n.get("header.second.delete.swmodule.type.table"));
|
||||||
if (visibleColumnIds.isEmpty() && visibleColumnLabels.isEmpty()) {
|
|
||||||
visibleColumnIds.add(SW_MODULE_TYPE_NAME);
|
|
||||||
visibleColumnIds.add(DISCARD);
|
|
||||||
visibleColumnLabels.add(i18n.get("header.first.delete.swmodule.type.table"));
|
|
||||||
visibleColumnLabels.add(i18n.get("header.second.delete.swmodule.type.table"));
|
|
||||||
|
|
||||||
}
|
|
||||||
tab.getTable().setVisibleColumns(visibleColumnIds.toArray());
|
|
||||||
tab.getTable().setColumnHeaders(visibleColumnLabels.toArray(new String[0]));
|
|
||||||
|
|
||||||
tab.getTable().setColumnExpandRatio(SW_MODULE_TYPE_NAME, 2);
|
tab.getTable().setColumnExpandRatio(SW_MODULE_TYPE_NAME, 2);
|
||||||
tab.getTable().setColumnExpandRatio(SW_DISCARD_CHGS, SPUIDefinitions.DISCARD_COLUMN_WIDTH);
|
tab.getTable().setColumnExpandRatio(SW_DISCARD_CHGS, SPUIDefinitions.DISCARD_COLUMN_WIDTH);
|
||||||
@@ -383,26 +337,14 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
|
|||||||
|
|
||||||
/* Add the discard action column */
|
/* Add the discard action column */
|
||||||
tab.getTable().addGeneratedColumn(DISCARD, (source, itemId, columnId) -> {
|
tab.getTable().addGeneratedColumn(DISCARD, (source, itemId, columnId) -> {
|
||||||
final Button deleteswIcon = SPUIComponentProvider.getButton("", "", SPUILabelDefinitions.DISCARD,
|
final ClickListener clickListener = event -> discardDistDelete(event, itemId, tab);
|
||||||
ValoTheme.BUTTON_TINY + " " + SPUIStyleDefinitions.REDICON, true, FontAwesome.REPLY,
|
return createDiscardButton(itemId, clickListener);
|
||||||
SPUIButtonStyleSmallNoBorder.class);
|
|
||||||
deleteswIcon.setData(itemId);
|
|
||||||
deleteswIcon.setImmediate(true);
|
|
||||||
deleteswIcon.addClickListener(event -> discardDistDelete(event, itemId, tab));
|
|
||||||
return deleteswIcon;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/* set the visible columns */
|
tab.getTable().setVisibleColumns(DIST_NAME, DISCARD);
|
||||||
final List<Object> visibleColumnIds = new ArrayList<>();
|
tab.getTable().setColumnHeaders(i18n.get("header.one.deletedist.table"),
|
||||||
final List<String> visibleColumnLabels = new ArrayList<>();
|
i18n.get("header.second.deletedist.table"));
|
||||||
if (visibleColumnIds.isEmpty() && visibleColumnLabels.isEmpty()) {
|
|
||||||
visibleColumnIds.add(DIST_NAME);
|
|
||||||
visibleColumnIds.add(DISCARD);
|
|
||||||
visibleColumnLabels.add(i18n.get("header.one.deletedist.table"));
|
|
||||||
visibleColumnLabels.add(i18n.get("header.second.deletedist.table"));
|
|
||||||
}
|
|
||||||
tab.getTable().setVisibleColumns(visibleColumnIds.toArray());
|
|
||||||
tab.getTable().setColumnHeaders(visibleColumnLabels.toArray(new String[0]));
|
|
||||||
|
|
||||||
tab.getTable().setColumnExpandRatio(DIST_NAME, SPUIDefinitions.TARGET_DISTRIBUTION_COLUMN_WIDTH);
|
tab.getTable().setColumnExpandRatio(DIST_NAME, SPUIDefinitions.TARGET_DISTRIBUTION_COLUMN_WIDTH);
|
||||||
tab.getTable().setColumnExpandRatio(DISCARD, SPUIDefinitions.DISCARD_COLUMN_WIDTH);
|
tab.getTable().setColumnExpandRatio(DISCARD, SPUIDefinitions.DISCARD_COLUMN_WIDTH);
|
||||||
@@ -495,30 +437,15 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
|
|||||||
|
|
||||||
// Add the discard action column
|
// Add the discard action column
|
||||||
tab.getTable().addGeneratedColumn(DISCARD, (source, itemId, columnId) -> {
|
tab.getTable().addGeneratedColumn(DISCARD, (source, itemId, columnId) -> {
|
||||||
final StringBuilder style = new StringBuilder(ValoTheme.BUTTON_TINY);
|
final ClickListener clickListener = event -> discardDistTypeDelete(
|
||||||
style.append(' ');
|
(String) ((Button) event.getComponent()).getData(), itemId, tab);
|
||||||
style.append(SPUIStyleDefinitions.REDICON);
|
return createDiscardButton(itemId, clickListener);
|
||||||
final Button deleteIcon = SPUIComponentProvider.getButton("", "", SPUILabelDefinitions.DISCARD,
|
|
||||||
style.toString(), true, FontAwesome.REPLY, SPUIButtonStyleSmallNoBorder.class);
|
|
||||||
deleteIcon.setData(itemId);
|
|
||||||
deleteIcon.setImmediate(true);
|
|
||||||
deleteIcon.addClickListener(
|
|
||||||
event -> discardDistTypeDelete((String) ((Button) event.getComponent()).getData(), itemId, tab));
|
|
||||||
return deleteIcon;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// set the visible columns
|
tab.getTable().setVisibleColumns(DIST_SET_NAME, DISCARD);
|
||||||
final List<Object> visibleColumnIds = new ArrayList<>();
|
tab.getTable().setColumnHeaders(i18n.get("header.first.delete.dist.type.table"),
|
||||||
final List<String> visibleColumnLabels = new ArrayList<>();
|
i18n.get("header.second.delete.dist.type.table"));
|
||||||
if (visibleColumnIds.isEmpty() && visibleColumnLabels.isEmpty()) {
|
|
||||||
visibleColumnIds.add(DIST_SET_NAME);
|
|
||||||
visibleColumnIds.add(DISCARD);
|
|
||||||
visibleColumnLabels.add(i18n.get("header.first.delete.dist.type.table"));
|
|
||||||
visibleColumnLabels.add(i18n.get("header.second.delete.dist.type.table"));
|
|
||||||
|
|
||||||
}
|
|
||||||
tab.getTable().setVisibleColumns(visibleColumnIds.toArray());
|
|
||||||
tab.getTable().setColumnHeaders(visibleColumnLabels.toArray(new String[0]));
|
|
||||||
|
|
||||||
tab.getTable().setColumnExpandRatio(DIST_SET_NAME, 2);
|
tab.getTable().setColumnExpandRatio(DIST_SET_NAME, 2);
|
||||||
tab.getTable().setColumnExpandRatio(DISCARD, SPUIDefinitions.DISCARD_COLUMN_WIDTH);
|
tab.getTable().setColumnExpandRatio(DISCARD, SPUIDefinitions.DISCARD_COLUMN_WIDTH);
|
||||||
@@ -610,20 +537,9 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
|
|||||||
return deleteIcon;
|
return deleteIcon;
|
||||||
});
|
});
|
||||||
|
|
||||||
// set the visible columns
|
assignmnetTab.getTable().setVisibleColumns(DIST_NAME, SOFTWARE_MODULE_NAME, DISCARD);
|
||||||
final List<Object> visibleColumnIds = new ArrayList<>();
|
assignmnetTab.getTable().setColumnHeaders(i18n.get("header.dist.first.assignment.table"),
|
||||||
final List<String> visibleColumnLabels = new ArrayList<>();
|
i18n.get("header.dist.second.assignment.table"), i18n.get("header.third.assignment.table"));
|
||||||
if (visibleColumnIds.isEmpty() && visibleColumnLabels.isEmpty()) {
|
|
||||||
visibleColumnIds.add(DIST_NAME);
|
|
||||||
visibleColumnIds.add(SOFTWARE_MODULE_NAME);
|
|
||||||
visibleColumnIds.add(DISCARD);
|
|
||||||
visibleColumnLabels.add(i18n.get("header.dist.first.assignment.table"));
|
|
||||||
visibleColumnLabels.add(i18n.get("header.dist.second.assignment.table"));
|
|
||||||
visibleColumnLabels.add(i18n.get("header.third.assignment.table"));
|
|
||||||
|
|
||||||
}
|
|
||||||
assignmnetTab.getTable().setVisibleColumns(visibleColumnIds.toArray());
|
|
||||||
assignmnetTab.getTable().setColumnHeaders(visibleColumnLabels.toArray(new String[0]));
|
|
||||||
|
|
||||||
assignmnetTab.getTable().setColumnExpandRatio(DIST_NAME, 2);
|
assignmnetTab.getTable().setColumnExpandRatio(DIST_NAME, 2);
|
||||||
assignmnetTab.getTable().setColumnExpandRatio(SOFTWARE_MODULE_NAME, 2);
|
assignmnetTab.getTable().setColumnExpandRatio(SOFTWARE_MODULE_NAME, 2);
|
||||||
|
|||||||
@@ -10,9 +10,8 @@ package org.eclipse.hawkbit.ui.distributions.smtable;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
|
|
||||||
import org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleAddUpdateWindow;
|
import org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleAddUpdateWindow;
|
||||||
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractTableDetailsLayout;
|
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractNamedVersionedEntityTableDetailsLayout;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
@@ -36,7 +35,7 @@ import com.vaadin.ui.Window;
|
|||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
public class SwModuleDetails extends AbstractTableDetailsLayout {
|
public class SwModuleDetails extends AbstractNamedVersionedEntityTableDetailsLayout<SoftwareModule> {
|
||||||
|
|
||||||
private static final long serialVersionUID = -1052279281066089812L;
|
private static final long serialVersionUID = -1052279281066089812L;
|
||||||
|
|
||||||
@@ -46,38 +45,16 @@ public class SwModuleDetails extends AbstractTableDetailsLayout {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ManageDistUIState manageDistUIState;
|
private ManageDistUIState manageDistUIState;
|
||||||
|
|
||||||
private Long swModuleId;
|
|
||||||
|
|
||||||
private SoftwareModule selectedSwModule;
|
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final SoftwareModuleEvent softwareModuleEvent) {
|
void onEvent(final SoftwareModuleEvent softwareModuleEvent) {
|
||||||
if (softwareModuleEvent.getSoftwareModuleEventType() == SoftwareModuleEventType.SELECTED_SOFTWARE_MODULE
|
onBaseEntityEvent(softwareModuleEvent);
|
||||||
|| softwareModuleEvent
|
|
||||||
.getSoftwareModuleEventType() == SoftwareModuleEventType.UPDATED_SOFTWARE_MODULE) {
|
|
||||||
ui.access(() -> {
|
|
||||||
/**
|
|
||||||
* softwareModuleEvent.getSoftwareModule() is null when table
|
|
||||||
* has no data.
|
|
||||||
*/
|
|
||||||
if (softwareModuleEvent.getSoftwareModule() != null) {
|
|
||||||
selectedSwModule = softwareModuleEvent.getSoftwareModule();
|
|
||||||
populateData(true);
|
|
||||||
} else {
|
|
||||||
populateData(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (softwareModuleEvent.getSoftwareModuleEventType() == SoftwareModuleEventType.MINIMIZED) {
|
|
||||||
showLayout();
|
|
||||||
} else if (softwareModuleEvent.getSoftwareModuleEventType() == SoftwareModuleEventType.MAXIMIZED) {
|
|
||||||
hideLayout();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEdit(final ClickEvent event) {
|
protected void onEdit(final ClickEvent event) {
|
||||||
final Window addSoftwareModule = softwareModuleAddUpdateWindow.createUpdateSoftwareModuleWindow(swModuleId);
|
final Window addSoftwareModule = softwareModuleAddUpdateWindow
|
||||||
addSoftwareModule.setCaption(i18n.get("upload.caption.update.swmodule"));
|
.createUpdateSoftwareModuleWindow(getSelectedBaseEntityId());
|
||||||
|
addSoftwareModule.setCaption(getI18n().get("upload.caption.update.swmodule"));
|
||||||
UI.getCurrent().addWindow(addSoftwareModule);
|
UI.getCurrent().addWindow(addSoftwareModule);
|
||||||
addSoftwareModule.setVisible(Boolean.TRUE);
|
addSoftwareModule.setVisible(Boolean.TRUE);
|
||||||
}
|
}
|
||||||
@@ -89,14 +66,14 @@ public class SwModuleDetails extends AbstractTableDetailsLayout {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addTabs(final TabSheet detailsTab) {
|
protected void addTabs(final TabSheet detailsTab) {
|
||||||
detailsTab.addTab(createDetailsLayout(), i18n.get("caption.tab.details"), null);
|
detailsTab.addTab(createDetailsLayout(), getI18n().get("caption.tab.details"), null);
|
||||||
detailsTab.addTab(createDescriptionLayout(), i18n.get("caption.tab.description"), null);
|
detailsTab.addTab(createDescriptionLayout(), getI18n().get("caption.tab.description"), null);
|
||||||
detailsTab.addTab(createLogLayout(), i18n.get("caption.logs.tab"), null);
|
detailsTab.addTab(createLogLayout(), getI18n().get("caption.logs.tab"), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getDefaultCaption() {
|
protected String getDefaultCaption() {
|
||||||
return i18n.get("upload.swModuleTable.header");
|
return getI18n().get("upload.swModuleTable.header");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -109,19 +86,9 @@ public class SwModuleDetails extends AbstractTableDetailsLayout {
|
|||||||
return manageDistUIState.isSwModuleTableMaximized();
|
return manageDistUIState.isSwModuleTableMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void populateDetailsWidget() {
|
|
||||||
populateDetailsWidget(selectedSwModule);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void clearDetails() {
|
|
||||||
populateDetailsWidget(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean hasEditPermission() {
|
protected Boolean hasEditPermission() {
|
||||||
return permissionChecker.hasUpdateDistributionPermission();
|
return getPermissionChecker().hasUpdateDistributionPermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -129,81 +96,49 @@ public class SwModuleDetails extends AbstractTableDetailsLayout {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateDetails(final SoftwareModule swModule) {
|
private void populateDetails() {
|
||||||
String maxAssign = HawkbitCommonUtil.SP_STRING_EMPTY;
|
String maxAssign = HawkbitCommonUtil.SP_STRING_EMPTY;
|
||||||
if (swModule != null) {
|
if (getSelectedBaseEntity() != null) {
|
||||||
if (swModule.getType().getMaxAssignments() == Integer.MAX_VALUE) {
|
if (getSelectedBaseEntity().getType().getMaxAssignments() == Integer.MAX_VALUE) {
|
||||||
maxAssign = i18n.get("label.multiAssign.type");
|
maxAssign = getI18n().get("label.multiAssign.type");
|
||||||
} else {
|
} else {
|
||||||
maxAssign = i18n.get("label.singleAssign.type");
|
maxAssign = getI18n().get("label.singleAssign.type");
|
||||||
}
|
}
|
||||||
updateSwModuleDetailsLayout(swModule.getType().getName(), swModule.getVendor(), maxAssign);
|
updateSwModuleDetailsLayout(getSelectedBaseEntity().getType().getName(),
|
||||||
|
getSelectedBaseEntity().getVendor(), maxAssign);
|
||||||
} else {
|
} else {
|
||||||
updateSwModuleDetailsLayout(HawkbitCommonUtil.SP_STRING_EMPTY, HawkbitCommonUtil.SP_STRING_EMPTY,
|
updateSwModuleDetailsLayout(HawkbitCommonUtil.SP_STRING_EMPTY, HawkbitCommonUtil.SP_STRING_EMPTY,
|
||||||
maxAssign);
|
maxAssign);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateDescription(final SoftwareModule sw) {
|
|
||||||
if (sw != null) {
|
|
||||||
updateDescriptionLayout(i18n.get("label.description"), sw.getDescription());
|
|
||||||
} else {
|
|
||||||
updateDescriptionLayout(i18n.get("label.description"), null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateSwModuleDetailsLayout(final String type, final String vendor, final String maxAssign) {
|
private void updateSwModuleDetailsLayout(final String type, final String vendor, final String maxAssign) {
|
||||||
|
|
||||||
final VerticalLayout detailsTabLayout = getDetailsLayout();
|
final VerticalLayout detailsTabLayout = getDetailsLayout();
|
||||||
detailsTabLayout.removeAllComponents();
|
detailsTabLayout.removeAllComponents();
|
||||||
|
|
||||||
final Label vendorLabel = SPUIComponentProvider.createNameValueLabel(i18n.get("label.dist.details.vendor"),
|
final Label vendorLabel = SPUIComponentProvider.createNameValueLabel(getI18n().get("label.dist.details.vendor"),
|
||||||
HawkbitCommonUtil.trimAndNullIfEmpty(vendor) == null ? "" : vendor);
|
HawkbitCommonUtil.trimAndNullIfEmpty(vendor) == null ? "" : vendor);
|
||||||
vendorLabel.setId(SPUIComponetIdProvider.DETAILS_VENDOR_LABEL_ID);
|
vendorLabel.setId(SPUIComponetIdProvider.DETAILS_VENDOR_LABEL_ID);
|
||||||
detailsTabLayout.addComponent(vendorLabel);
|
detailsTabLayout.addComponent(vendorLabel);
|
||||||
|
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
final Label typeLabel = SPUIComponentProvider.createNameValueLabel(i18n.get("label.dist.details.type"),
|
final Label typeLabel = SPUIComponentProvider.createNameValueLabel(getI18n().get("label.dist.details.type"),
|
||||||
type);
|
type);
|
||||||
typeLabel.setId(SPUIComponetIdProvider.DETAILS_TYPE_LABEL_ID);
|
typeLabel.setId(SPUIComponetIdProvider.DETAILS_TYPE_LABEL_ID);
|
||||||
detailsTabLayout.addComponent(typeLabel);
|
detailsTabLayout.addComponent(typeLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Label assignLabel = SPUIComponentProvider.createNameValueLabel(i18n.get("label.assigned.type"),
|
final Label assignLabel = SPUIComponentProvider.createNameValueLabel(getI18n().get("label.assigned.type"),
|
||||||
HawkbitCommonUtil.trimAndNullIfEmpty(maxAssign) == null ? "" : maxAssign);
|
HawkbitCommonUtil.trimAndNullIfEmpty(maxAssign) == null ? "" : maxAssign);
|
||||||
assignLabel.setId(SPUIComponetIdProvider.SWM_DTLS_MAX_ASSIGN);
|
assignLabel.setId(SPUIComponetIdProvider.SWM_DTLS_MAX_ASSIGN);
|
||||||
detailsTabLayout.addComponent(assignLabel);
|
detailsTabLayout.addComponent(assignLabel);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateLog(final SoftwareModule softwareModule) {
|
@Override
|
||||||
if (null != softwareModule) {
|
protected void populateDetailsWidget() {
|
||||||
updateLogLayout(getLogLayout(), softwareModule.getLastModifiedAt(), softwareModule.getLastModifiedBy(),
|
populateDetails();
|
||||||
softwareModule.getCreatedAt(), softwareModule.getCreatedBy(), i18n);
|
|
||||||
} else {
|
|
||||||
updateLogLayout(getLogLayout(), null, HawkbitCommonUtil.SP_STRING_EMPTY, null, null, i18n);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSwModuleId(final Long swModuleId) {
|
|
||||||
this.swModuleId = swModuleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void populateDetailsWidget(final SoftwareModule swModule) {
|
|
||||||
if (swModule != null) {
|
|
||||||
setSwModuleId(swModule.getId());
|
|
||||||
setName(getDefaultCaption(),
|
|
||||||
HawkbitCommonUtil.getFormattedNameVersion(swModule.getName(), swModule.getVersion()));
|
|
||||||
populateDetails(swModule);
|
|
||||||
populateDescription(swModule);
|
|
||||||
populateLog(swModule);
|
|
||||||
} else {
|
|
||||||
setSwModuleId(null);
|
|
||||||
setName(getDefaultCaption(), HawkbitCommonUtil.SP_STRING_EMPTY);
|
|
||||||
populateDetails(null);
|
|
||||||
populateDescription(null);
|
|
||||||
populateLog(null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -8,34 +8,26 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.distributions.smtable;
|
package org.eclipse.hawkbit.ui.distributions.smtable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import javax.annotation.PreDestroy;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.details.ArtifactDetailsLayout;
|
import org.eclipse.hawkbit.ui.artifacts.details.ArtifactDetailsLayout;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
|
import org.eclipse.hawkbit.ui.common.ManagmentEntityState;
|
||||||
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
import org.eclipse.hawkbit.ui.common.table.AbstractNamedVersionTable;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||||
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
|
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.distributions.event.DistributionsViewAcceptCriteria;
|
import org.eclipse.hawkbit.ui.distributions.event.DistributionsViewAcceptCriteria;
|
||||||
import org.eclipse.hawkbit.ui.distributions.event.DragEvent;
|
|
||||||
import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
|
import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
|
||||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
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.SPUIComponetIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
@@ -45,7 +37,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
||||||
import org.vaadin.spring.events.EventBus;
|
|
||||||
import org.vaadin.spring.events.EventScope;
|
import org.vaadin.spring.events.EventScope;
|
||||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||||
|
|
||||||
@@ -71,19 +62,13 @@ import com.vaadin.ui.Window;
|
|||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
public class SwModuleTable extends AbstractTable {
|
public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Long> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 6785314784507424750L;
|
private static final long serialVersionUID = 6785314784507424750L;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private I18N i18n;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ManageDistUIState manageDistUIState;
|
private ManageDistUIState manageDistUIState;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private transient EventBus.SessionEventBus eventBus;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private transient SoftwareManagement softwareManagement;
|
private transient SoftwareManagement softwareManagement;
|
||||||
|
|
||||||
@@ -97,21 +82,9 @@ public class SwModuleTable extends AbstractTable {
|
|||||||
* Initialize the filter layout.
|
* Initialize the filter layout.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@PostConstruct
|
|
||||||
protected void init() {
|
protected void init() {
|
||||||
super.init();
|
super.init();
|
||||||
eventBus.subscribe(this);
|
|
||||||
styleTableOnDistSelection();
|
styleTableOnDistSelection();
|
||||||
setNoDataAvailable();
|
|
||||||
}
|
|
||||||
|
|
||||||
@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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* All event Listeners */
|
/* All event Listeners */
|
||||||
@@ -148,13 +121,7 @@ public class SwModuleTable extends AbstractTable {
|
|||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final SoftwareModuleEvent event) {
|
void onEvent(final SoftwareModuleEvent event) {
|
||||||
if (event.getSoftwareModuleEventType() == SoftwareModuleEventType.MINIMIZED) {
|
onBaseEntityEvent(event);
|
||||||
UI.getCurrent().access(() -> applyMinTableSettings());
|
|
||||||
} else if (event.getSoftwareModuleEventType() == SoftwareModuleEventType.MAXIMIZED) {
|
|
||||||
UI.getCurrent().access(() -> applyMaxTableSettings());
|
|
||||||
} else if (event.getSoftwareModuleEventType() == SoftwareModuleEventType.NEW_SOFTWARE_MODULE) {
|
|
||||||
UI.getCurrent().access(() -> addSoftwareModule(event.getSoftwareModule()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -237,56 +204,43 @@ public class SwModuleTable extends AbstractTable {
|
|||||||
return manageDistUIState.isSwModuleTableMaximized();
|
return manageDistUIState.isSwModuleTableMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
|
||||||
@Override
|
@Override
|
||||||
protected void onValueChange() {
|
protected void publishEntityAfterValueChange(final SoftwareModule selectedLastEntity) {
|
||||||
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.SELECTED_ENTITY, selectedLastEntity));
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
final Set<Long> values = (Set) getValue();
|
|
||||||
if (values != null && !values.isEmpty()) {
|
|
||||||
final Iterator<Long> iterator = values.iterator();
|
|
||||||
Long value = null;
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
value = iterator.next();
|
|
||||||
}
|
}
|
||||||
if (null != value) {
|
|
||||||
manageDistUIState.setSelectedBaseSwModuleId(value);
|
@Override
|
||||||
final SoftwareModule baseSoftwareModule = softwareManagement.findSoftwareModuleById(value);
|
protected void setManagementEntitiyStateValues(final Set<Long> values, final Long lastId) {
|
||||||
|
manageDistUIState.setSelectedBaseSwModuleId(lastId);
|
||||||
manageDistUIState.setSelectedSoftwareModules(values);
|
manageDistUIState.setSelectedSoftwareModules(values);
|
||||||
eventBus.publish(this,
|
|
||||||
new SoftwareModuleEvent(SoftwareModuleEventType.SELECTED_SOFTWARE_MODULE, baseSoftwareModule));
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
manageDistUIState.setSelectedBaseSwModuleId(null);
|
@Override
|
||||||
manageDistUIState.setSelectedSoftwareModules(Collections.emptySet());
|
protected SoftwareModule findEntityByTableValue(final Long lastSelectedId) {
|
||||||
eventBus.publish(this, new SoftwareModuleEvent(SoftwareModuleEventType.SELECTED_SOFTWARE_MODULE, null));
|
return softwareManagement.findSoftwareModuleById(lastSelectedId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ManagmentEntityState<Long> getManagmentEntityState() {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<TableColumn> getTableVisibleColumns() {
|
protected List<TableColumn> getTableVisibleColumns() {
|
||||||
final List<TableColumn> columnList = new ArrayList<>();
|
final List<TableColumn> columnList = super.getTableVisibleColumns();
|
||||||
if (isMaximized()) {
|
if (isMaximized()) {
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get("header.name"), 0.2F));
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_VENDOR, i18n.get("header.vendor"), 0.1F));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_VERSION, i18n.get("header.version"), 0.1F));
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_VENDOR, i18n.get("header.vendor"), 0.1f));
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_BY, i18n.get("header.createdBy"), 0.1F));
|
|
||||||
columnList
|
|
||||||
.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_DATE, i18n.get("header.createdDate"), 0.1F));
|
|
||||||
columnList.add(
|
|
||||||
new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, i18n.get("header.modifiedBy"), 0.1F));
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, i18n.get("header.modifiedDate"),
|
|
||||||
0.1F));
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_DESC, i18n.get("header.description"), 0.2F));
|
|
||||||
} else {
|
} else {
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get("header.name"), 0.7F));
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_VERSION, i18n.get("header.version"), 0.2F));
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.ARTIFACT_ICON, "", 0.1F));
|
columnList.add(new TableColumn(SPUILabelDefinitions.ARTIFACT_ICON, "", 0.1F));
|
||||||
|
|
||||||
}
|
}
|
||||||
return columnList;
|
return columnList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected float getColumnNameMinimizedSize() {
|
||||||
|
return 0.7F;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DropHandler getTableDropHandler() {
|
protected DropHandler getTableDropHandler() {
|
||||||
return new DropHandler() {
|
return new DropHandler() {
|
||||||
@@ -369,30 +323,27 @@ public class SwModuleTable extends AbstractTable {
|
|||||||
return name + "." + version;
|
return name + "." + version;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@Override
|
||||||
private void addSoftwareModule(final SoftwareModule swModule) {
|
protected Item addEntity(final SoftwareModule baseEntity) {
|
||||||
final Object addItem = addItem();
|
final Item item = super.addEntity(baseEntity);
|
||||||
final Item item = getItem(addItem);
|
|
||||||
final String swNameVersion = HawkbitCommonUtil.concatStrings(":", swModule.getName(), swModule.getVersion());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.NAME_VERSION).setValue(swNameVersion);
|
|
||||||
item.getItemProperty("swId").setValue(swModule.getId());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_ID).setValue(swModule.getId());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_DESC).setValue(swModule.getDescription());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_VERSION).setValue(swModule.getVersion());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_NAME).setValue(swModule.getName());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_VENDOR).setValue(swModule.getVendor());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_CREATED_BY).setValue(swModule.getCreatedBy());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY).setValue(swModule.getLastModifiedBy());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_CREATED_DATE)
|
|
||||||
.setValue(SPDateTimeUtil.getFormattedDate(swModule.getCreatedAt()));
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE)
|
|
||||||
.setValue(SPDateTimeUtil.getFormattedDate(swModule.getLastModifiedAt()));
|
|
||||||
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_COLOR).setValue(swModule.getType().getColour());
|
|
||||||
if (!manageDistUIState.getSelectedSoftwareModules().isEmpty()) {
|
if (!manageDistUIState.getSelectedSoftwareModules().isEmpty()) {
|
||||||
manageDistUIState.getSelectedSoftwareModules().stream().forEach(swmNameId -> unselect(swmNameId));
|
manageDistUIState.getSelectedSoftwareModules().stream().forEach(this::unselect);
|
||||||
}
|
}
|
||||||
select(swModule.getId());
|
select(baseEntity.getId());
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
protected void updateEntity(final SoftwareModule baseEntity, final Item item) {
|
||||||
|
final String swNameVersion = HawkbitCommonUtil.concatStrings(":", baseEntity.getName(),
|
||||||
|
baseEntity.getVersion());
|
||||||
|
item.getItemProperty(SPUILabelDefinitions.NAME_VERSION).setValue(swNameVersion);
|
||||||
|
item.getItemProperty("swId").setValue(baseEntity.getId());
|
||||||
|
item.getItemProperty(SPUILabelDefinitions.VAR_VENDOR).setValue(baseEntity.getVendor());
|
||||||
|
item.getItemProperty(SPUILabelDefinitions.VAR_COLOR).setValue(baseEntity.getType().getColour());
|
||||||
|
super.updateEntity(baseEntity, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showArtifactDetailsWindow(final Long itemId, final String nameVersionStr) {
|
private void showArtifactDetailsWindow(final Long itemId, final String nameVersionStr) {
|
||||||
@@ -431,13 +382,10 @@ public class SwModuleTable extends AbstractTable {
|
|||||||
UI.getCurrent().addWindow(atrifactDtlsWindow);
|
UI.getCurrent().addWindow(atrifactDtlsWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setNoDataAvailable() {
|
@Override
|
||||||
final int conatinerSize = getContainerDataSource().size();
|
protected void setDataAvailable(final boolean available) {
|
||||||
if (conatinerSize == 0) {
|
manageDistUIState.setNoDataAvilableSwModule(!available);
|
||||||
manageDistUIState.setNoDataAvilableSwModule(true);
|
|
||||||
} else {
|
|
||||||
manageDistUIState.setNoDataAvilableSwModule(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ package org.eclipse.hawkbit.ui.distributions.smtable;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent.SoftwareModuleEventType;
|
|
||||||
import org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleAddUpdateWindow;
|
import org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleAddUpdateWindow;
|
||||||
import org.eclipse.hawkbit.ui.common.table.AbstractTableHeader;
|
import org.eclipse.hawkbit.ui.common.table.AbstractTableHeader;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
|
import org.eclipse.hawkbit.ui.distributions.event.DistributionsUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||||
@@ -37,7 +37,6 @@ public class SwModuleTableHeader extends AbstractTableHeader {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 242961845006626297L;
|
private static final long serialVersionUID = 242961845006626297L;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ManageDistUIState manageDistUIState;
|
private ManageDistUIState manageDistUIState;
|
||||||
|
|
||||||
@@ -123,14 +122,14 @@ public class SwModuleTableHeader extends AbstractTableHeader {
|
|||||||
@Override
|
@Override
|
||||||
public void maximizeTable() {
|
public void maximizeTable() {
|
||||||
manageDistUIState.setSwModuleTableMaximized(Boolean.TRUE);
|
manageDistUIState.setSwModuleTableMaximized(Boolean.TRUE);
|
||||||
eventbus.publish(this, new SoftwareModuleEvent(SoftwareModuleEventType.MAXIMIZED, null));
|
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MAXIMIZED, null));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void minimizeTable() {
|
public void minimizeTable() {
|
||||||
manageDistUIState.setSwModuleTableMaximized(Boolean.FALSE);
|
manageDistUIState.setSwModuleTableMaximized(Boolean.FALSE);
|
||||||
eventbus.publish(this, new SoftwareModuleEvent(SoftwareModuleEventType.MINIMIZED, null));
|
eventbus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.MINIMIZED, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleIdName;
|
import org.eclipse.hawkbit.repository.model.SoftwareModuleIdName;
|
||||||
|
import org.eclipse.hawkbit.ui.common.ManagmentEntityState;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import com.vaadin.spring.annotation.SpringComponent;
|
import com.vaadin.spring.annotation.SpringComponent;
|
||||||
@@ -30,7 +31,7 @@ import com.vaadin.spring.annotation.VaadinSessionScope;
|
|||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@VaadinSessionScope
|
@VaadinSessionScope
|
||||||
public class ManageDistUIState implements Serializable {
|
public class ManageDistUIState implements ManagmentEntityState<DistributionSetIdName>, Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -7569047247017742928L;
|
private static final long serialVersionUID = -7569047247017742928L;
|
||||||
|
|
||||||
@@ -101,26 +102,23 @@ public class ManageDistUIState implements Serializable {
|
|||||||
* @return the slectedDistributions
|
* @return the slectedDistributions
|
||||||
*/
|
*/
|
||||||
public Optional<Set<DistributionSetIdName>> getSelectedDistributions() {
|
public Optional<Set<DistributionSetIdName>> getSelectedDistributions() {
|
||||||
return selectedDistributions == null ? Optional.empty() : Optional.of(selectedDistributions);
|
return Optional.ofNullable(selectedDistributions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the lastSelectedDistribution
|
* @return the lastSelectedDistribution
|
||||||
*/
|
*/
|
||||||
public Optional<DistributionSetIdName> getLastSelectedDistribution() {
|
public Optional<DistributionSetIdName> getLastSelectedDistribution() {
|
||||||
return lastSelectedDistribution == null ? Optional.empty() : Optional.of(lastSelectedDistribution);
|
return Optional.ofNullable(lastSelectedDistribution);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @param lastSelectedDistribution
|
public void setLastSelectedEntity(final DistributionSetIdName value) {
|
||||||
* the lastSelectedDistribution to set
|
this.lastSelectedDistribution = value;
|
||||||
*/
|
|
||||||
public void setLastSelectedDistribution(final DistributionSetIdName lastSelectedDistribution) {
|
|
||||||
this.lastSelectedDistribution = lastSelectedDistribution;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSelectedDistributions(final Set<DistributionSetIdName> slectedDistributions) {
|
public void setSelectedEnitities(final Set<DistributionSetIdName> values) {
|
||||||
selectedDistributions = slectedDistributions;
|
selectedDistributions = values;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -141,7 +139,7 @@ public class ManageDistUIState implements Serializable {
|
|||||||
* @return the selectedBaseSwModuleId
|
* @return the selectedBaseSwModuleId
|
||||||
*/
|
*/
|
||||||
public Optional<Long> getSelectedBaseSwModuleId() {
|
public Optional<Long> getSelectedBaseSwModuleId() {
|
||||||
return selectedBaseSwModuleId != null ? Optional.of(selectedBaseSwModuleId) : Optional.empty();
|
return Optional.ofNullable(selectedBaseSwModuleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import javax.annotation.PreDestroy;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||||
import org.eclipse.hawkbit.ui.HawkbitUI;
|
import org.eclipse.hawkbit.ui.HawkbitUI;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.management.actionhistory.ActionHistoryComponent;
|
import org.eclipse.hawkbit.ui.management.actionhistory.ActionHistoryComponent;
|
||||||
import org.eclipse.hawkbit.ui.management.dstable.DistributionTableLayout;
|
import org.eclipse.hawkbit.ui.management.dstable.DistributionTableLayout;
|
||||||
import org.eclipse.hawkbit.ui.management.dstag.DistributionTagLayout;
|
import org.eclipse.hawkbit.ui.management.dstag.DistributionTagLayout;
|
||||||
@@ -108,19 +109,18 @@ public class DeploymentView extends VerticalLayout implements View, BrowserWindo
|
|||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final DistributionTableEvent event) {
|
void onEvent(final DistributionTableEvent event) {
|
||||||
if (event.getDistributionComponentEvent() == DistributionTableEvent.DistributionComponentEvent.MINIMIZED) {
|
if (BaseEntityEventType.MINIMIZED == event.getEventType()) {
|
||||||
minimizeDistTable();
|
minimizeDistTable();
|
||||||
} else if (event
|
} else if (BaseEntityEventType.MAXIMIZED == event.getEventType()) {
|
||||||
.getDistributionComponentEvent() == DistributionTableEvent.DistributionComponentEvent.MAXIMIZED) {
|
|
||||||
maximizeDistTable();
|
maximizeDistTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final TargetTableEvent event) {
|
void onEvent(final TargetTableEvent event) {
|
||||||
if (event.getTargetComponentEvent() == TargetTableEvent.TargetComponentEvent.MINIMIZED) {
|
if (BaseEntityEventType.MINIMIZED == event.getEventType()) {
|
||||||
minimizeTargetTable();
|
minimizeTargetTable();
|
||||||
} else if (event.getTargetComponentEvent() == TargetTableEvent.TargetComponentEvent.MAXIMIZED) {
|
} else if (BaseEntityEventType.MAXIMIZED == event.getEventType()) {
|
||||||
maximizeTargetTable();
|
maximizeTargetTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import javax.annotation.PostConstruct;
|
|||||||
import javax.annotation.PreDestroy;
|
import javax.annotation.PreDestroy;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentEvent;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.vaadin.spring.events.EventBus;
|
import org.vaadin.spring.events.EventBus;
|
||||||
@@ -62,9 +62,9 @@ public class ActionHistoryComponent extends VerticalLayout {
|
|||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final TargetTableEvent targetUIEvent) {
|
void onEvent(final TargetTableEvent targetUIEvent) {
|
||||||
if (targetUIEvent.getTargetComponentEvent() == TargetComponentEvent.SELECTED_TARGET) {
|
if (BaseEntityEventType.SELECTED_ENTITY == targetUIEvent.getEventType()) {
|
||||||
setData(SPUIDefinitions.DATA_AVAILABLE);
|
setData(SPUIDefinitions.DATA_AVAILABLE);
|
||||||
UI.getCurrent().access(() -> populateActionHistoryDetails(targetUIEvent.getTarget()));
|
UI.getCurrent().access(() -> populateActionHistoryDetails(targetUIEvent.getEntity()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ import org.eclipse.hawkbit.repository.model.ActionStatus;
|
|||||||
import org.eclipse.hawkbit.repository.model.ActionWithStatusCount;
|
import org.eclipse.hawkbit.repository.model.ActionWithStatusCount;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.ui.common.ConfirmationDialog;
|
import org.eclipse.hawkbit.ui.common.ConfirmationDialog;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.PinUnpinEvent;
|
import org.eclipse.hawkbit.ui.management.event.PinUnpinEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentEvent;
|
|
||||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||||
@@ -855,11 +855,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateTargetAndDsTable() {
|
private void updateTargetAndDsTable() {
|
||||||
/*
|
eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.UPDATED_ENTITY, target));
|
||||||
* Update the target status in the Target table and update the color
|
|
||||||
* settings for DS in DS table.
|
|
||||||
*/
|
|
||||||
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.EDIT_TARGET, target));
|
|
||||||
updateDistributionTableStyle();
|
updateDistributionTableStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
|
|||||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||||
import org.eclipse.hawkbit.repository.model.TenantMetaData;
|
import org.eclipse.hawkbit.repository.model.TenantMetaData;
|
||||||
import org.eclipse.hawkbit.ui.common.DistributionSetTypeBeanQuery;
|
import org.eclipse.hawkbit.ui.common.DistributionSetTypeBeanQuery;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent.DistributionComponentEvent;
|
|
||||||
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||||
@@ -260,8 +260,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
|
|||||||
notificationMessage.displaySuccess(i18n.get("message.new.dist.save.success",
|
notificationMessage.displaySuccess(i18n.get("message.new.dist.save.success",
|
||||||
new Object[] { currentDS.getName(), currentDS.getVersion() }));
|
new Object[] { currentDS.getName(), currentDS.getVersion() }));
|
||||||
// update table row+details layout
|
// update table row+details layout
|
||||||
eventBus.publish(this,
|
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.UPDATED_ENTITY, currentDS));
|
||||||
new DistributionTableEvent(DistributionComponentEvent.EDIT_DISTRIBUTION, currentDS));
|
|
||||||
} catch (final EntityAlreadyExistsException entityAlreadyExistsException) {
|
} catch (final EntityAlreadyExistsException entityAlreadyExistsException) {
|
||||||
LOG.error("Update distribution failed {}", entityAlreadyExistsException);
|
LOG.error("Update distribution failed {}", entityAlreadyExistsException);
|
||||||
notificationMessage.displayValidationError(
|
notificationMessage.displayValidationError(
|
||||||
@@ -307,7 +306,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
|
|||||||
/* close the window */
|
/* close the window */
|
||||||
closeThisWindow();
|
closeThisWindow();
|
||||||
|
|
||||||
eventBus.publish(this, new DistributionTableEvent(DistributionComponentEvent.ADD_DISTRIBUTION, newDist));
|
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.NEW_ENTITY, newDist));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,14 +9,12 @@
|
|||||||
package org.eclipse.hawkbit.ui.management.dstable;
|
package org.eclipse.hawkbit.ui.management.dstable;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractTableDetailsLayout;
|
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractNamedVersionedEntityTableDetailsLayout;
|
||||||
import org.eclipse.hawkbit.ui.common.detailslayout.SoftwareModuleDetailsTable;
|
import org.eclipse.hawkbit.ui.common.detailslayout.SoftwareModuleDetailsTable;
|
||||||
import org.eclipse.hawkbit.ui.common.tagdetails.DistributionTagToken;
|
import org.eclipse.hawkbit.ui.common.tagdetails.DistributionTagToken;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
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.management.state.ManagementUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.vaadin.spring.events.EventScope;
|
import org.vaadin.spring.events.EventScope;
|
||||||
@@ -36,11 +34,10 @@ import com.vaadin.ui.Window;
|
|||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
public class DistributionDetails extends AbstractTableDetailsLayout {
|
public class DistributionDetails extends AbstractNamedVersionedEntityTableDetailsLayout<DistributionSet> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 350360207334118826L;
|
private static final long serialVersionUID = 350360207334118826L;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ManagementUIState managementUIState;
|
private ManagementUIState managementUIState;
|
||||||
|
|
||||||
@@ -52,61 +49,37 @@ public class DistributionDetails extends AbstractTableDetailsLayout {
|
|||||||
|
|
||||||
private SoftwareModuleDetailsTable softwareModuleTable;
|
private SoftwareModuleDetailsTable softwareModuleTable;
|
||||||
|
|
||||||
private Long dsId;
|
|
||||||
|
|
||||||
private DistributionSet selectedDsModule;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
softwareModuleTable = new SoftwareModuleDetailsTable();
|
softwareModuleTable = new SoftwareModuleDetailsTable();
|
||||||
softwareModuleTable.init(i18n, false, permissionChecker, null, null, null);
|
softwareModuleTable.init(getI18n(), false, getPermissionChecker(), null, null, null);
|
||||||
super.init();
|
super.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final DistributionTableEvent distributionTableEvent) {
|
void onEvent(final DistributionTableEvent distributionTableEvent) {
|
||||||
if (distributionTableEvent.getDistributionComponentEvent() == DistributionComponentEvent.ON_VALUE_CHANGE
|
onBaseEntityEvent(distributionTableEvent);
|
||||||
|| distributionTableEvent
|
|
||||||
.getDistributionComponentEvent() == DistributionComponentEvent.EDIT_DISTRIBUTION) {
|
|
||||||
ui.access(() -> {
|
|
||||||
/**
|
|
||||||
* distributionTableEvent.getDistributionSet() is null when
|
|
||||||
* table has no data.
|
|
||||||
*/
|
|
||||||
if (distributionTableEvent.getDistributionSet() != null) {
|
|
||||||
selectedDsModule = distributionTableEvent.getDistributionSet();
|
|
||||||
populateData(true);
|
|
||||||
} else {
|
|
||||||
populateData(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (distributionTableEvent.getDistributionComponentEvent() == DistributionComponentEvent.MINIMIZED) {
|
|
||||||
ui.access(() -> showLayout());
|
|
||||||
} else if (distributionTableEvent.getDistributionComponentEvent() == DistributionComponentEvent.MAXIMIZED) {
|
|
||||||
ui.access(() -> hideLayout());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getDefaultCaption() {
|
protected String getDefaultCaption() {
|
||||||
return i18n.get("distribution.details.header");
|
return getI18n().get("distribution.details.header");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addTabs(final TabSheet detailsTab) {
|
protected void addTabs(final TabSheet detailsTab) {
|
||||||
detailsTab.addTab(createDetailsLayout(), i18n.get("caption.tab.details"), null);
|
detailsTab.addTab(createDetailsLayout(), getI18n().get("caption.tab.details"), null);
|
||||||
detailsTab.addTab(createDescriptionLayout(), i18n.get("caption.tab.description"), null);
|
detailsTab.addTab(createDescriptionLayout(), getI18n().get("caption.tab.description"), null);
|
||||||
detailsTab.addTab(createSoftwareModuleTab(), i18n.get("caption.softwares.distdetail.tab"), null);
|
detailsTab.addTab(createSoftwareModuleTab(), getI18n().get("caption.softwares.distdetail.tab"), null);
|
||||||
detailsTab.addTab(createTagsLayout(), i18n.get("caption.tags.tab"), null);
|
detailsTab.addTab(createTagsLayout(), getI18n().get("caption.tags.tab"), null);
|
||||||
detailsTab.addTab(createLogLayout(), i18n.get("caption.logs.tab"), null);
|
detailsTab.addTab(createLogLayout(), getI18n().get("caption.logs.tab"), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEdit(final ClickEvent event) {
|
protected void onEdit(final ClickEvent event) {
|
||||||
final Window newDistWindow = distributionAddUpdateWindowLayout.getWindow();
|
final Window newDistWindow = distributionAddUpdateWindowLayout.getWindow();
|
||||||
distributionAddUpdateWindowLayout.populateValuesOfDistribution(getDsId());
|
distributionAddUpdateWindowLayout.populateValuesOfDistribution(getSelectedBaseEntityId());
|
||||||
newDistWindow.setCaption(i18n.get("caption.update.dist"));
|
newDistWindow.setCaption(getI18n().get("caption.update.dist"));
|
||||||
UI.getCurrent().addWindow(newDistWindow);
|
UI.getCurrent().addWindow(newDistWindow);
|
||||||
newDistWindow.setVisible(Boolean.TRUE);
|
newDistWindow.setVisible(Boolean.TRUE);
|
||||||
}
|
}
|
||||||
@@ -127,19 +100,9 @@ public class DistributionDetails extends AbstractTableDetailsLayout {
|
|||||||
return managementUIState.isDsTableMaximized();
|
return managementUIState.isDsTableMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void populateDetailsWidget() {
|
|
||||||
populateDetailsWidget(selectedDsModule);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void clearDetails() {
|
|
||||||
populateDetailsWidget(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean hasEditPermission() {
|
protected Boolean hasEditPermission() {
|
||||||
return permissionChecker.hasUpdateDistributionPermission();
|
return getPermissionChecker().hasUpdateDistributionPermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -147,31 +110,11 @@ public class DistributionDetails extends AbstractTableDetailsLayout {
|
|||||||
return SPUIComponetIdProvider.DISTRIBUTION_DETAILS_TABSHEET;
|
return SPUIComponetIdProvider.DISTRIBUTION_DETAILS_TABSHEET;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateDetailsWidget(final DistributionSet dist) {
|
@Override
|
||||||
if (dist != null) {
|
protected void populateDetailsWidget() {
|
||||||
setDsId(dist.getId());
|
softwareModuleTable.populateModule(getSelectedBaseEntity());
|
||||||
setName(getDefaultCaption(), HawkbitCommonUtil.getFormattedNameVersion(dist.getName(), dist.getVersion()));
|
populateDetails(getSelectedBaseEntity());
|
||||||
populateDetails(dist);
|
|
||||||
populateDescription(dist);
|
|
||||||
populateLog(dist);
|
|
||||||
softwareModuleTable.populateModule(dist);
|
|
||||||
} else {
|
|
||||||
setDsId(null);
|
|
||||||
setName(getDefaultCaption(), HawkbitCommonUtil.SP_STRING_EMPTY);
|
|
||||||
populateDetails(null);
|
|
||||||
populateDescription(null);
|
|
||||||
softwareModuleTable.populateModule(null);
|
|
||||||
populateLog(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void populateLog(final DistributionSet ds) {
|
|
||||||
if (null != ds) {
|
|
||||||
updateLogLayout(getLogLayout(), ds.getLastModifiedAt(), ds.getLastModifiedBy(), ds.getCreatedAt(),
|
|
||||||
ds.getCreatedBy(), i18n);
|
|
||||||
} else {
|
|
||||||
updateLogLayout(getLogLayout(), null, HawkbitCommonUtil.SP_STRING_EMPTY, null, null, i18n);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateDetails(final DistributionSet ds) {
|
private void populateDetails(final DistributionSet ds) {
|
||||||
@@ -182,29 +125,21 @@ public class DistributionDetails extends AbstractTableDetailsLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateDescription(final DistributionSet ds) {
|
|
||||||
if (ds != null) {
|
|
||||||
updateDescriptionLayout(i18n.get("label.description"), ds.getDescription());
|
|
||||||
} else {
|
|
||||||
updateDescriptionLayout(i18n.get("label.description"), null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateDistributionDetailsLayout(final String type, final Boolean isMigrationRequired) {
|
private void updateDistributionDetailsLayout(final String type, final Boolean isMigrationRequired) {
|
||||||
final VerticalLayout detailsTabLayout = getDetailsLayout();
|
final VerticalLayout detailsTabLayout = getDetailsLayout();
|
||||||
detailsTabLayout.removeAllComponents();
|
detailsTabLayout.removeAllComponents();
|
||||||
|
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
final Label typeLabel = SPUIComponentProvider.createNameValueLabel(i18n.get("label.dist.details.type"),
|
final Label typeLabel = SPUIComponentProvider.createNameValueLabel(getI18n().get("label.dist.details.type"),
|
||||||
type);
|
type);
|
||||||
typeLabel.setId(SPUIComponetIdProvider.DETAILS_TYPE_LABEL_ID);
|
typeLabel.setId(SPUIComponetIdProvider.DETAILS_TYPE_LABEL_ID);
|
||||||
detailsTabLayout.addComponent(typeLabel);
|
detailsTabLayout.addComponent(typeLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isMigrationRequired != null) {
|
if (isMigrationRequired != null) {
|
||||||
detailsTabLayout.addComponent(
|
detailsTabLayout.addComponent(SPUIComponentProvider.createNameValueLabel(
|
||||||
SPUIComponentProvider.createNameValueLabel(i18n.get("checkbox.dist.migration.required"),
|
getI18n().get("checkbox.dist.migration.required"),
|
||||||
isMigrationRequired.equals(Boolean.TRUE) ? i18n.get("label.yes") : i18n.get("label.no")));
|
isMigrationRequired.equals(Boolean.TRUE) ? getI18n().get("label.yes") : getI18n().get("label.no")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,14 +156,6 @@ public class DistributionDetails extends AbstractTableDetailsLayout {
|
|||||||
return tagsLayout;
|
return tagsLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getDsId() {
|
|
||||||
return dsId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDsId(final Long dsId) {
|
|
||||||
this.dsId = dsId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getDetailsHeaderCaptionId() {
|
protected String getDetailsHeaderCaptionId() {
|
||||||
return SPUIComponetIdProvider.DISTRIBUTION_DETAILS_HEADER_LABEL_ID;
|
return SPUIComponetIdProvider.DISTRIBUTION_DETAILS_HEADER_LABEL_ID;
|
||||||
|
|||||||
@@ -11,15 +11,12 @@ package org.eclipse.hawkbit.ui.management.dstable;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import javax.annotation.PreDestroy;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||||
@@ -28,10 +25,11 @@ import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
|||||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
|
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.AbstractNamedVersionTable;
|
||||||
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
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.management.event.DistributionTableFilterEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||||
@@ -40,8 +38,6 @@ import org.eclipse.hawkbit.ui.management.event.PinUnpinEvent;
|
|||||||
import org.eclipse.hawkbit.ui.management.event.SaveActionWindowEvent;
|
import org.eclipse.hawkbit.ui.management.event.SaveActionWindowEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
@@ -52,7 +48,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
||||||
import org.vaadin.spring.events.EventBus;
|
|
||||||
import org.vaadin.spring.events.EventScope;
|
import org.vaadin.spring.events.EventScope;
|
||||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||||
|
|
||||||
@@ -76,22 +71,16 @@ import com.vaadin.ui.UI;
|
|||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
public class DistributionTable extends AbstractTable {
|
public class DistributionTable extends AbstractNamedVersionTable<DistributionSet, DistributionSetIdName> {
|
||||||
|
|
||||||
private static final long serialVersionUID = -1928335256399519494L;
|
private static final long serialVersionUID = -1928335256399519494L;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private I18N i18n;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SpPermissionChecker permissionChecker;
|
private SpPermissionChecker permissionChecker;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UINotification notification;
|
private UINotification notification;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private transient EventBus.SessionEventBus eventBus;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ManagementUIState managementUIState;
|
private ManagementUIState managementUIState;
|
||||||
|
|
||||||
@@ -111,17 +100,9 @@ public class DistributionTable extends AbstractTable {
|
|||||||
private Button distributinPinnedBtn;
|
private Button distributinPinnedBtn;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@PostConstruct
|
|
||||||
protected void init() {
|
protected void init() {
|
||||||
super.init();
|
super.init();
|
||||||
eventBus.subscribe(this);
|
|
||||||
notAllowedMsg = i18n.get("message.action.not.allowed");
|
notAllowedMsg = i18n.get("message.action.not.allowed");
|
||||||
setNoDataAvailable();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PreDestroy
|
|
||||||
void destroy() {
|
|
||||||
eventBus.unsubscribe(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -151,13 +132,12 @@ public class DistributionTable extends AbstractTable {
|
|||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final DistributionTableEvent event) {
|
void onEvent(final DistributionTableEvent event) {
|
||||||
if (event.getDistributionComponentEvent() == DistributionComponentEvent.MINIMIZED) {
|
onBaseEntityEvent(event);
|
||||||
UI.getCurrent().access(() -> applyMinTableSettings());
|
if (BaseEntityEventType.UPDATED_ENTITY != event.getEventType()) {
|
||||||
} else if (event.getDistributionComponentEvent() == DistributionComponentEvent.MAXIMIZED) {
|
return;
|
||||||
UI.getCurrent().access(() -> applyMaxTableSettings());
|
|
||||||
} else if (event.getDistributionComponentEvent() == DistributionComponentEvent.EDIT_DISTRIBUTION) {
|
|
||||||
UI.getCurrent().access(() -> updateDistributionInTable(event.getDistributionSet()));
|
|
||||||
}
|
}
|
||||||
|
UI.getCurrent().access(() -> updateDistributionInTable(event.getEntity()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
@@ -194,24 +174,11 @@ public class DistributionTable extends AbstractTable {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#getTableId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTableId() {
|
protected String getTableId() {
|
||||||
return SPUIComponetIdProvider.DIST_TABLE_ID;
|
return SPUIComponetIdProvider.DIST_TABLE_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#createContainer(
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Container createContainer() {
|
protected Container createContainer() {
|
||||||
final Map<String, Object> queryConfiguration = prepareQueryConfigFilters();
|
final Map<String, Object> queryConfiguration = prepareQueryConfigFilters();
|
||||||
@@ -272,31 +239,18 @@ public class DistributionTable extends AbstractTable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onValueChange() {
|
protected DistributionSet findEntityByTableValue(final DistributionSetIdName lastSelectedId) {
|
||||||
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
return distributionSetManagement.findDistributionSetByIdWithDetails(lastSelectedId.getId());
|
||||||
final Set<DistributionSetIdName> values = HawkbitCommonUtil.getSelectedDSDetails(this);
|
|
||||||
DistributionSetIdName value = null;
|
|
||||||
if (values != null && !values.isEmpty()) {
|
|
||||||
final Iterator<DistributionSetIdName> iterator = values.iterator();
|
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
value = iterator.next();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null != value) {
|
@Override
|
||||||
managementUIState.setSelectedDsIdName(values);
|
protected void publishEntityAfterValueChange(final DistributionSet selectedLastEntity) {
|
||||||
managementUIState.setLastSelectedDsIdName(value);
|
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.SELECTED_ENTITY, selectedLastEntity));
|
||||||
final DistributionSet lastSelectedDistSet = distributionSetManagement
|
|
||||||
.findDistributionSetByIdWithDetails(value.getId());
|
|
||||||
eventBus.publish(this,
|
|
||||||
new DistributionTableEvent(DistributionComponentEvent.ON_VALUE_CHANGE, lastSelectedDistSet));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
managementUIState.setSelectedDsIdName(null);
|
|
||||||
managementUIState.setLastSelectedDsIdName(null);
|
|
||||||
eventBus.publish(this, new DistributionTableEvent(DistributionComponentEvent.ON_VALUE_CHANGE, null));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ManagementUIState getManagmentEntityState() {
|
||||||
|
return managementUIState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -306,7 +260,17 @@ public class DistributionTable extends AbstractTable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<TableColumn> getTableVisibleColumns() {
|
protected List<TableColumn> getTableVisibleColumns() {
|
||||||
return HawkbitCommonUtil.getTableVisibleColumns(isMaximized(), true, i18n);
|
final List<TableColumn> columnList = super.getTableVisibleColumns();
|
||||||
|
if (isMaximized()) {
|
||||||
|
return columnList;
|
||||||
|
}
|
||||||
|
columnList.add(new TableColumn(SPUILabelDefinitions.PIN_COLUMN, StringUtils.EMPTY, 0.1F));
|
||||||
|
return columnList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected float getColumnNameMinimizedSize() {
|
||||||
|
return 0.7F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -345,7 +309,7 @@ public class DistributionTable extends AbstractTable {
|
|||||||
private void assignDsTag(final DragAndDropEvent event) {
|
private void assignDsTag(final DragAndDropEvent event) {
|
||||||
final com.vaadin.event.dd.TargetDetails taregtDet = event.getTargetDetails();
|
final com.vaadin.event.dd.TargetDetails taregtDet = event.getTargetDetails();
|
||||||
final Table distTable = (Table) taregtDet.getTarget();
|
final Table distTable = (Table) taregtDet.getTarget();
|
||||||
final Set<DistributionSetIdName> distsSelected = HawkbitCommonUtil.getSelectedDSDetails(distTable);
|
final Set<DistributionSetIdName> distsSelected = getTableValue(distTable);
|
||||||
final Set<Long> distList = new HashSet<>();
|
final Set<Long> distList = new HashSet<>();
|
||||||
|
|
||||||
final AbstractSelectTargetDetails dropData = (AbstractSelectTargetDetails) event.getTargetDetails();
|
final AbstractSelectTargetDetails dropData = (AbstractSelectTargetDetails) event.getTargetDetails();
|
||||||
@@ -387,17 +351,12 @@ public class DistributionTable extends AbstractTable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
private void assignTargetToDs(final DragAndDropEvent event) {
|
private void assignTargetToDs(final DragAndDropEvent event) {
|
||||||
final TableTransferable transferable = (TableTransferable) event.getTransferable();
|
final TableTransferable transferable = (TableTransferable) event.getTransferable();
|
||||||
final Table source = transferable.getSourceComponent();
|
final AbstractTable<?, TargetIdName> source = (AbstractTable<?, TargetIdName>) transferable
|
||||||
final Set<TargetIdName> targetsSelected = HawkbitCommonUtil.getSelectedTargetDetails(source);
|
.getSourceComponent();
|
||||||
final Set<TargetIdName> targetDetailsList = new HashSet<>();
|
final Set<TargetIdName> targetDetailsList = source.getDeletedEntityByTransferable(transferable);
|
||||||
|
|
||||||
if (!targetsSelected.contains(transferable.getData("itemId"))) {
|
|
||||||
targetDetailsList.add((TargetIdName) transferable.getData("itemId"));
|
|
||||||
} else {
|
|
||||||
targetDetailsList.addAll(targetsSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
final AbstractSelectTargetDetails dropData = (AbstractSelectTargetDetails) event.getTargetDetails();
|
final AbstractSelectTargetDetails dropData = (AbstractSelectTargetDetails) event.getTargetDetails();
|
||||||
|
|
||||||
@@ -502,17 +461,7 @@ public class DistributionTable extends AbstractTable {
|
|||||||
private void updateDistributionInTable(final DistributionSet editedDs) {
|
private void updateDistributionInTable(final DistributionSet editedDs) {
|
||||||
final Item item = getContainerDataSource()
|
final Item item = getContainerDataSource()
|
||||||
.getItem(new DistributionSetIdName(editedDs.getId(), editedDs.getName(), editedDs.getVersion()));
|
.getItem(new DistributionSetIdName(editedDs.getId(), editedDs.getName(), editedDs.getVersion()));
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_NAME).setValue(editedDs.getName());
|
updateEntity(editedDs, item);
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_VERSION).setValue(editedDs.getVersion());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_CREATED_BY)
|
|
||||||
.setValue(HawkbitCommonUtil.getIMUser(editedDs.getCreatedBy()));
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_CREATED_DATE)
|
|
||||||
.setValue(SPDateTimeUtil.getFormattedDate(editedDs.getCreatedAt()));
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY)
|
|
||||||
.setValue(HawkbitCommonUtil.getIMUser(editedDs.getLastModifiedBy()));
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE)
|
|
||||||
.setValue(SPDateTimeUtil.getFormattedDate(editedDs.getLastModifiedAt()));
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_DESC).setValue(editedDs.getDescription());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void restoreDistributionTableStyle() {
|
private void restoreDistributionTableStyle() {
|
||||||
@@ -703,12 +652,10 @@ public class DistributionTable extends AbstractTable {
|
|||||||
this.distributinPinnedBtn = distributinPinnedBtn;
|
this.distributinPinnedBtn = distributinPinnedBtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setNoDataAvailable() {
|
@Override
|
||||||
final int size = getContainerDataSource().size();
|
protected void setDataAvailable(final boolean available) {
|
||||||
if (size == 0) {
|
managementUIState.setNoDataAvailableDistribution(!available);
|
||||||
managementUIState.setNoDataAvailableDistribution(true);
|
|
||||||
} else {
|
|
||||||
managementUIState.setNoDataAvailableDistribution(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
package org.eclipse.hawkbit.ui.management.dstable;
|
package org.eclipse.hawkbit.ui.management.dstable;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.ui.common.table.AbstractTableHeader;
|
import org.eclipse.hawkbit.ui.common.table.AbstractTableHeader;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent.DistributionComponentEvent;
|
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableFilterEvent;
|
import org.eclipse.hawkbit.ui.management.event.DistributionTableFilterEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||||
@@ -127,13 +127,13 @@ public class DistributionTableHeader extends AbstractTableHeader {
|
|||||||
@Override
|
@Override
|
||||||
public void maximizeTable() {
|
public void maximizeTable() {
|
||||||
managementUIState.setDsTableMaximized(Boolean.TRUE);
|
managementUIState.setDsTableMaximized(Boolean.TRUE);
|
||||||
eventbus.publish(this, new DistributionTableEvent(DistributionComponentEvent.MAXIMIZED, null));
|
eventbus.publish(this, new DistributionTableEvent(BaseEntityEventType.MAXIMIZED, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void minimizeTable() {
|
public void minimizeTable() {
|
||||||
managementUIState.setDsTableMaximized(Boolean.FALSE);
|
managementUIState.setDsTableMaximized(Boolean.FALSE);
|
||||||
eventbus.publish(this, new DistributionTableEvent(DistributionComponentEvent.MINIMIZED, null));
|
eventbus.publish(this, new DistributionTableEvent(BaseEntityEventType.MINIMIZED, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -9,50 +9,26 @@
|
|||||||
package org.eclipse.hawkbit.ui.management.event;
|
package org.eclipse.hawkbit.ui.management.event;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEvent;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DistributionTableEvent {
|
public class DistributionTableEvent extends BaseEntityEvent<DistributionSet> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Constructor.
|
||||||
*
|
*
|
||||||
*
|
* @param eventType
|
||||||
|
* the event type
|
||||||
|
* @param entity
|
||||||
|
* the distribution set
|
||||||
*/
|
*/
|
||||||
public enum DistributionComponentEvent {
|
public DistributionTableEvent(final BaseEntityEventType eventType, final DistributionSet entity) {
|
||||||
ADD_DISTRIBUTION, EDIT_DISTRIBUTION, DELETE_DISTRIBUTION, ON_VALUE_CHANGE, MAXIMIZED, MINIMIZED
|
super(eventType, entity);
|
||||||
}
|
|
||||||
|
|
||||||
private DistributionComponentEvent distributionComponentEvent;
|
|
||||||
|
|
||||||
private DistributionSet distributionSet;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param distributionComponentEvent
|
|
||||||
* @param distributionSet
|
|
||||||
*/
|
|
||||||
public DistributionTableEvent(final DistributionComponentEvent distributionComponentEvent,
|
|
||||||
final DistributionSet distributionSet) {
|
|
||||||
this.distributionComponentEvent = distributionComponentEvent;
|
|
||||||
this.distributionSet = distributionSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DistributionComponentEvent getDistributionComponentEvent() {
|
|
||||||
return distributionComponentEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDistributionComponentEvent(final DistributionComponentEvent distributionComponentEvent) {
|
|
||||||
this.distributionComponentEvent = distributionComponentEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DistributionSet getDistributionSet() {
|
|
||||||
return distributionSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDistributionSet(final DistributionSet distributionSet) {
|
|
||||||
this.distributionSet = distributionSet;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.management.event;
|
package org.eclipse.hawkbit.ui.management.event;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -17,6 +16,7 @@ import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
|||||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
|
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
||||||
import org.eclipse.hawkbit.ui.management.state.DistributionTableFilters;
|
import org.eclipse.hawkbit.ui.management.state.DistributionTableFilters;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||||
@@ -68,8 +68,6 @@ public class DistributionTagDropEvent implements DropHandler {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ManagementViewAcceptCriteria managementViewAcceptCriteria;
|
private ManagementViewAcceptCriteria managementViewAcceptCriteria;
|
||||||
|
|
||||||
private static final String ITEMID = "itemId";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drop(final DragAndDropEvent event) {
|
public void drop(final DragAndDropEvent event) {
|
||||||
if (validate(event) && isNoTagAssigned(event)) {
|
if (validate(event) && isNoTagAssigned(event)) {
|
||||||
@@ -132,23 +130,20 @@ public class DistributionTagDropEvent implements DropHandler {
|
|||||||
final com.vaadin.event.dd.TargetDetails targetDetails = event.getTargetDetails();
|
final com.vaadin.event.dd.TargetDetails targetDetails = event.getTargetDetails();
|
||||||
|
|
||||||
final TableTransferable transferable = (TableTransferable) event.getTransferable();
|
final TableTransferable transferable = (TableTransferable) event.getTransferable();
|
||||||
final Table source = transferable.getSourceComponent();
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
final Set<DistributionSetIdName> distSelected = (Set<DistributionSetIdName>) source.getValue();
|
final AbstractTable<?, DistributionSetIdName> source = (AbstractTable<?, DistributionSetIdName>) transferable
|
||||||
final Set<Long> distributionList = new HashSet<>();
|
.getSourceComponent();
|
||||||
if (!distSelected.contains(transferable.getData(ITEMID))) {
|
|
||||||
distributionList.add(((DistributionSetIdName) transferable.getData(ITEMID)).getId());
|
final Set<DistributionSetIdName> distSelected = source.getDeletedEntityByTransferable(transferable);
|
||||||
} else {
|
final Set<Long> distributionList = distSelected.stream().map(entity -> entity.getId())
|
||||||
distributionList.addAll(distSelected.stream().map(t -> t.getId()).collect(Collectors.toList()));
|
.collect(Collectors.toSet());
|
||||||
}
|
|
||||||
|
|
||||||
final String distTagName = HawkbitCommonUtil.removePrefix(targetDetails.getTarget().getId(),
|
final String distTagName = HawkbitCommonUtil.removePrefix(targetDetails.getTarget().getId(),
|
||||||
SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS);
|
SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS);
|
||||||
|
|
||||||
final List<String> tagsClickedList = distFilterParameters.getDistSetTags();
|
final List<String> tagsClickedList = distFilterParameters.getDistSetTags();
|
||||||
final DistributionSetTagAssignmentResult result = distributionSetManagement.toggleTagAssignment(distributionList,
|
final DistributionSetTagAssignmentResult result = distributionSetManagement
|
||||||
distTagName);
|
.toggleTagAssignment(distributionList, distTagName);
|
||||||
|
|
||||||
notification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(distTagName, result, i18n));
|
notification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(distTagName, result, i18n));
|
||||||
if (result.getUnassigned() >= 1 && !tagsClickedList.isEmpty()) {
|
if (result.getUnassigned() >= 1 && !tagsClickedList.isEmpty()) {
|
||||||
|
|||||||
@@ -9,7 +9,8 @@
|
|||||||
package org.eclipse.hawkbit.ui.management.event;
|
package org.eclipse.hawkbit.ui.management.event;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentEvent;
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEvent;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -17,34 +18,18 @@ import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentE
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TargetAddUpdateWindowEvent {
|
public class TargetAddUpdateWindowEvent extends BaseEntityEvent<Target> {
|
||||||
|
|
||||||
private final TargetComponentEvent targetComponentEvent;
|
|
||||||
|
|
||||||
private final Target target;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
* @param eventType
|
* @param eventType
|
||||||
* the event type
|
* the event type
|
||||||
* @param target
|
* @param entity
|
||||||
* the target which has been created or modified
|
* the entity
|
||||||
*/
|
*/
|
||||||
public TargetAddUpdateWindowEvent(final TargetComponentEvent eventType, final Target target) {
|
public TargetAddUpdateWindowEvent(final BaseEntityEventType eventType, final Target entity) {
|
||||||
this.targetComponentEvent = eventType;
|
super(eventType, entity);
|
||||||
this.target = target;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the targetComponentEvent
|
|
||||||
*/
|
|
||||||
public TargetComponentEvent getTargetComponentEvent() {
|
|
||||||
return targetComponentEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the target
|
|
||||||
*/
|
|
||||||
public Target getTarget() {
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,77 +9,51 @@
|
|||||||
package org.eclipse.hawkbit.ui.management.event;
|
package org.eclipse.hawkbit.ui.management.event;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEvent;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TargetTableEvent {
|
public class TargetTableEvent extends BaseEntityEvent<Target> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Target table components events.
|
* Target table components events.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public enum TargetComponentEvent {
|
public enum TargetComponentEvent {
|
||||||
REFRESH_TARGETS, EDIT_TARGET, DELETE_TARGET, SELECTED_TARGET, MAXIMIZED, MINIMIZED, SELLECT_ALL, BULK_TARGET_CREATED, BULK_UPLOAD_COMPLETED, BULK_TARGET_UPLOAD_STARTED, BULK_UPLOAD_PROCESS_STARTED
|
REFRESH_TARGETS, SELLECT_ALL, BULK_TARGET_CREATED, BULK_UPLOAD_COMPLETED, BULK_TARGET_UPLOAD_STARTED, BULK_UPLOAD_PROCESS_STARTED
|
||||||
}
|
}
|
||||||
|
|
||||||
private TargetComponentEvent targetComponentEvent;
|
private TargetComponentEvent targetComponentEvent;
|
||||||
|
|
||||||
private Target target;
|
/**
|
||||||
|
* Constructor.
|
||||||
private TargetIdName targetIdName;
|
*
|
||||||
|
* @param eventType
|
||||||
|
* the event type.
|
||||||
|
* @param entity
|
||||||
|
* the entity
|
||||||
|
*/
|
||||||
|
public TargetTableEvent(final BaseEntityEventType eventType, final Target entity) {
|
||||||
|
super(eventType, entity);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* The component event.
|
||||||
|
*
|
||||||
* @param targetComponentEvent
|
* @param targetComponentEvent
|
||||||
|
* the target component event.
|
||||||
*/
|
*/
|
||||||
public TargetTableEvent(final TargetComponentEvent targetComponentEvent) {
|
public TargetTableEvent(final TargetComponentEvent targetComponentEvent) {
|
||||||
super();
|
super(null, null);
|
||||||
this.targetComponentEvent = targetComponentEvent;
|
this.targetComponentEvent = targetComponentEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param targetComponentEvent
|
|
||||||
* @param target
|
|
||||||
*/
|
|
||||||
public TargetTableEvent(final TargetComponentEvent targetComponentEvent, final Target target) {
|
|
||||||
this(targetComponentEvent);
|
|
||||||
this.target = target;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param targetComponentEvent
|
|
||||||
* @param targetIdName
|
|
||||||
*/
|
|
||||||
public TargetTableEvent(final TargetComponentEvent targetComponentEvent, final TargetIdName targetIdName) {
|
|
||||||
this(targetComponentEvent);
|
|
||||||
this.targetIdName = targetIdName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TargetComponentEvent getTargetComponentEvent() {
|
public TargetComponentEvent getTargetComponentEvent() {
|
||||||
return targetComponentEvent;
|
return targetComponentEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTargetComponentEvent(final TargetComponentEvent targetComponentEvent) {
|
|
||||||
this.targetComponentEvent = targetComponentEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Target getTarget() {
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTarget(final Target target) {
|
|
||||||
this.target = target;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TargetIdName getTargetIdName() {
|
|
||||||
return targetIdName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTargetIdName(final TargetIdName targetIdName) {
|
|
||||||
this.targetIdName = targetIdName;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,8 +95,8 @@ public class CountMessageLabel extends Label {
|
|||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final TargetTableEvent event) {
|
void onEvent(final TargetTableEvent event) {
|
||||||
if (event.getTargetComponentEvent() == TargetTableEvent.TargetComponentEvent.SELLECT_ALL
|
if (TargetTableEvent.TargetComponentEvent.SELLECT_ALL == event.getTargetComponentEvent()
|
||||||
|| event.getTargetComponentEvent() == TargetComponentEvent.REFRESH_TARGETS) {
|
|| TargetComponentEvent.REFRESH_TARGETS == event.getTargetComponentEvent()) {
|
||||||
displayTargetCountStatus();
|
displayTargetCountStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,13 +8,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.management.footer;
|
package org.eclipse.hawkbit.ui.management.footer;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.TagManagement;
|
import org.eclipse.hawkbit.repository.TagManagement;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||||
import org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout;
|
import org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
||||||
import org.eclipse.hawkbit.ui.management.event.BulkUploadPopupEvent;
|
import org.eclipse.hawkbit.ui.management.event.BulkUploadPopupEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||||
@@ -211,7 +211,7 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Component getUnsavedActionsWindowContent() {
|
protected Component getUnsavedActionsWindowContent() {
|
||||||
manangementConfirmationWindowLayout.init();
|
manangementConfirmationWindowLayout.initialize();
|
||||||
return manangementConfirmationWindowLayout;
|
return manangementConfirmationWindowLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,14 +257,9 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addInDeleteDistributionList(final Table sourceTable, final TableTransferable transferable) {
|
private void addInDeleteDistributionList(final Table sourceTable, final TableTransferable transferable) {
|
||||||
final Set<DistributionSetIdName> distSelected = HawkbitCommonUtil.getSelectedDSDetails(sourceTable);
|
@SuppressWarnings("unchecked")
|
||||||
final Set<DistributionSetIdName> distributionIdNameSet = new HashSet<>();
|
final AbstractTable<?, DistributionSetIdName> distTable = (AbstractTable<?, DistributionSetIdName>) sourceTable;
|
||||||
|
final Set<DistributionSetIdName> distributionIdNameSet = distTable.getDeletedEntityByTransferable(transferable);
|
||||||
if (!distSelected.contains(transferable.getData(SPUIDefinitions.ITEMID))) {
|
|
||||||
distributionIdNameSet.add((DistributionSetIdName) transferable.getData(SPUIDefinitions.ITEMID));
|
|
||||||
} else {
|
|
||||||
distributionIdNameSet.addAll(distSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
final DistributionSetIdName dsInBulkUpload = managementUIState.getTargetTableFilters().getBulkUpload()
|
final DistributionSetIdName dsInBulkUpload = managementUIState.getTargetTableFilters().getBulkUpload()
|
||||||
.getDsNameAndVersion();
|
.getDsNameAndVersion();
|
||||||
@@ -272,32 +267,38 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
distributionIdNameSet.remove(dsInBulkUpload);
|
distributionIdNameSet.remove(dsInBulkUpload);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!distributionIdNameSet.isEmpty()) {
|
if (distributionIdNameSet.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
checkDeletedDistributionSets(distributionIdNameSet);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
private void checkDeletedDistributionSets(final Set<DistributionSetIdName> distributionIdNameSet) {
|
||||||
* Flags to identify whether all dropped distributions are already
|
|
||||||
* in the deleted list (or) some distributions are already in the
|
|
||||||
* deleted distribution list.
|
|
||||||
*/
|
|
||||||
final int existingDeletedDistributionsSize = managementUIState.getDeletedDistributionList().size();
|
final int existingDeletedDistributionsSize = managementUIState.getDeletedDistributionList().size();
|
||||||
managementUIState.getDeletedDistributionList().addAll(distributionIdNameSet);
|
managementUIState.getDeletedDistributionList().addAll(distributionIdNameSet);
|
||||||
final int newDeletedDistributionsSize = managementUIState.getDeletedDistributionList().size();
|
final int newDeletedDistributionsSize = managementUIState.getDeletedDistributionList().size();
|
||||||
if (newDeletedDistributionsSize == existingDeletedDistributionsSize) {
|
|
||||||
/*
|
showAlreadyDeletedDistributionSetNotfication(existingDeletedDistributionsSize, newDeletedDistributionsSize,
|
||||||
* No new distributions are added, all distributions dropped now
|
"message.dists.already.deleted");
|
||||||
* are already available in the delete list. Hence display
|
showPendingDeletedNotifaction(distributionIdNameSet, existingDeletedDistributionsSize,
|
||||||
* warning message accordingly.
|
newDeletedDistributionsSize, "message.dist.deleted.pending");
|
||||||
*/
|
|
||||||
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
|
|
||||||
* list. There are some distributions are already there in the
|
|
||||||
* delete list. Hence display warning message accordingly.
|
|
||||||
*/
|
|
||||||
notification.displayValidationError(i18n.get("message.dist.deleted.pending"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showPendingDeletedNotifaction(final Set<?> currentValues, final int existingDeletedSize,
|
||||||
|
final int newDeletedSize, final String messageKey) {
|
||||||
|
if (newDeletedSize - existingDeletedSize == currentValues.size()) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
notification.displayValidationError(i18n.get(messageKey));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showAlreadyDeletedDistributionSetNotfication(final int existingDeletedSize, final int newDeletedSize,
|
||||||
|
final String messageKey) {
|
||||||
|
|
||||||
|
if (newDeletedSize != existingDeletedSize) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
notification.displayValidationError(i18n.get(messageKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isDsInUseInBulkUpload(final Set<DistributionSetIdName> distributionIdNameSet,
|
private boolean isDsInUseInBulkUpload(final Set<DistributionSetIdName> distributionIdNameSet,
|
||||||
@@ -311,38 +312,23 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addInDeleteTargetList(final Table sourceTable, final TableTransferable transferable) {
|
private void addInDeleteTargetList(final Table sourceTable, final TableTransferable transferable) {
|
||||||
final Set<TargetIdName> targetSelected = HawkbitCommonUtil.getSelectedTargetDetails(sourceTable);
|
@SuppressWarnings("unchecked")
|
||||||
|
final AbstractTable<?, TargetIdName> targetTable = (AbstractTable<?, TargetIdName>) sourceTable;
|
||||||
|
final Set<TargetIdName> targetIdNameSet = targetTable.getDeletedEntityByTransferable(transferable);
|
||||||
|
|
||||||
final Set<TargetIdName> targetIdNameSet = new HashSet<>();
|
checkDeletedTargets(targetIdNameSet);
|
||||||
if (!targetSelected.contains(transferable.getData(SPUIDefinitions.ITEMID))) {
|
|
||||||
targetIdNameSet.add((TargetIdName) transferable.getData(SPUIDefinitions.ITEMID));
|
|
||||||
} else {
|
|
||||||
targetIdNameSet.addAll(targetSelected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
private void checkDeletedTargets(final Set<TargetIdName> targetIdNameSet) {
|
||||||
* Flags to identify whether all dropped targets are already in the
|
|
||||||
* deleted list (or) some target are already in the deleted distribution
|
|
||||||
* list.
|
|
||||||
*/
|
|
||||||
final int existingDeletedTargetsSize = managementUIState.getDeletedTargetList().size();
|
final int existingDeletedTargetsSize = managementUIState.getDeletedTargetList().size();
|
||||||
managementUIState.getDeletedTargetList().addAll(targetIdNameSet);
|
managementUIState.getDeletedTargetList().addAll(targetIdNameSet);
|
||||||
final int newDeletedTargetsSize = managementUIState.getDeletedTargetList().size();
|
final int newDeletedTargetsSize = managementUIState.getDeletedTargetList().size();
|
||||||
if (newDeletedTargetsSize == existingDeletedTargetsSize) {
|
|
||||||
/*
|
showAlreadyDeletedDistributionSetNotfication(existingDeletedTargetsSize, newDeletedTargetsSize,
|
||||||
* No new targets are added, all targets dropped now are already
|
"message.targets.already.deleted");
|
||||||
* available in the delete list. Hence display warning message
|
|
||||||
* accordingly.
|
showPendingDeletedNotifaction(targetIdNameSet, existingDeletedTargetsSize, newDeletedTargetsSize,
|
||||||
*/
|
"message.target.deleted.pending");
|
||||||
notification.displayValidationError(i18n.get("message.targets.already.deleted"));
|
|
||||||
} else if (newDeletedTargetsSize - existingDeletedTargetsSize != targetIdNameSet.size()) {
|
|
||||||
/*
|
|
||||||
* Not the all targets dropped now are added to the delete list.
|
|
||||||
* There are some targets are already there in the delete list.
|
|
||||||
* Hence display warning message accordingly.
|
|
||||||
*/
|
|
||||||
notification.displayValidationError(i18n.get("message.target.deleted.pending"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateActionCount() {
|
private void updateActionCount() {
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ import java.util.Objects;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetAssignmentResult;
|
import org.eclipse.hawkbit.repository.DistributionSetAssignmentResult;
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
@@ -31,20 +29,15 @@ import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
|||||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||||
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.AbstractConfirmationWindowLayout;
|
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.AbstractConfirmationWindowLayout;
|
||||||
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.ConfirmationTab;
|
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.ConfirmationTab;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
|
||||||
import org.eclipse.hawkbit.ui.management.event.PinUnpinEvent;
|
import org.eclipse.hawkbit.ui.management.event.PinUnpinEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.SaveActionWindowEvent;
|
import org.eclipse.hawkbit.ui.management.event.SaveActionWindowEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.footer.ActionTypeOptionGroupLayout.ActionTypeOption;
|
import org.eclipse.hawkbit.ui.management.footer.ActionTypeOptionGroupLayout.ActionTypeOption;
|
||||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.vaadin.spring.events.EventBus;
|
|
||||||
|
|
||||||
import com.vaadin.data.Item;
|
import com.vaadin.data.Item;
|
||||||
import com.vaadin.data.util.IndexedContainer;
|
import com.vaadin.data.util.IndexedContainer;
|
||||||
@@ -52,8 +45,8 @@ import com.vaadin.server.FontAwesome;
|
|||||||
import com.vaadin.spring.annotation.SpringComponent;
|
import com.vaadin.spring.annotation.SpringComponent;
|
||||||
import com.vaadin.spring.annotation.ViewScope;
|
import com.vaadin.spring.annotation.ViewScope;
|
||||||
import com.vaadin.ui.Button;
|
import com.vaadin.ui.Button;
|
||||||
|
import com.vaadin.ui.Button.ClickListener;
|
||||||
import com.vaadin.ui.Table.Align;
|
import com.vaadin.ui.Table.Align;
|
||||||
import com.vaadin.ui.themes.ValoTheme;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Confirmation window for target/ds delete and assignment.
|
* Confirmation window for target/ds delete and assignment.
|
||||||
@@ -79,12 +72,6 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ManagementUIState managementUIState;
|
private ManagementUIState managementUIState;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private I18N i18n;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private transient EventBus.SessionEventBus eventBus;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private transient TargetManagement targetManagement;
|
private transient TargetManagement targetManagement;
|
||||||
|
|
||||||
@@ -99,14 +86,6 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
|||||||
|
|
||||||
private ConfirmationTab assignmnetTab;
|
private ConfirmationTab assignmnetTab;
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialze the component.
|
|
||||||
*/
|
|
||||||
@PostConstruct
|
|
||||||
public void init() {
|
|
||||||
super.inittialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, ConfirmationTab> getConfimrationTabs() {
|
protected Map<String, ConfirmationTab> getConfimrationTabs() {
|
||||||
final Map<String, ConfirmationTab> tabs = new HashMap<>();
|
final Map<String, ConfirmationTab> tabs = new HashMap<>();
|
||||||
@@ -130,6 +109,7 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
|||||||
assignmnetTab.getConfirmAll().setIcon(FontAwesome.SAVE);
|
assignmnetTab.getConfirmAll().setIcon(FontAwesome.SAVE);
|
||||||
assignmnetTab.getConfirmAll().setCaption(i18n.get("button.assign.all"));
|
assignmnetTab.getConfirmAll().setCaption(i18n.get("button.assign.all"));
|
||||||
assignmnetTab.getConfirmAll().addClickListener(event -> saveAllAssignments(assignmnetTab));
|
assignmnetTab.getConfirmAll().addClickListener(event -> saveAllAssignments(assignmnetTab));
|
||||||
|
|
||||||
assignmnetTab.getDiscardAll().setCaption(i18n.get(SPUILabelDefinitions.BUTTON_DISCARD_ALL));
|
assignmnetTab.getDiscardAll().setCaption(i18n.get(SPUILabelDefinitions.BUTTON_DISCARD_ALL));
|
||||||
assignmnetTab.getDiscardAll().setId(SPUIComponetIdProvider.DISCARD_ASSIGNMENT);
|
assignmnetTab.getDiscardAll().setId(SPUIComponetIdProvider.DISCARD_ASSIGNMENT);
|
||||||
assignmnetTab.getDiscardAll().addClickListener(event -> discardAllAssignments(assignmnetTab));
|
assignmnetTab.getDiscardAll().addClickListener(event -> discardAllAssignments(assignmnetTab));
|
||||||
@@ -139,35 +119,17 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
|||||||
|
|
||||||
// Add the discard action column
|
// Add the discard action column
|
||||||
assignmnetTab.getTable().addGeneratedColumn(DISCARD_CHANGES, (source, itemId, columnId) -> {
|
assignmnetTab.getTable().addGeneratedColumn(DISCARD_CHANGES, (source, itemId, columnId) -> {
|
||||||
final StringBuilder style = new StringBuilder(ValoTheme.BUTTON_TINY);
|
final ClickListener clickListener = event -> discardAssignment(
|
||||||
style.append(' ');
|
(TargetIdName) ((Button) event.getComponent()).getData(), assignmnetTab);
|
||||||
style.append(SPUIStyleDefinitions.REDICON);
|
return createDiscardButton(itemId, clickListener);
|
||||||
final Button deleteIcon = SPUIComponentProvider.getButton("", "", SPUILabelDefinitions.DISCARD,
|
|
||||||
style.toString(), true, FontAwesome.REPLY, SPUIButtonStyleSmallNoBorder.class);
|
|
||||||
deleteIcon.setData(itemId);
|
|
||||||
deleteIcon.setImmediate(true);
|
|
||||||
deleteIcon.addClickListener(event -> discardAssignment(
|
|
||||||
(TargetIdName) ((Button) event.getComponent()).getData(), assignmnetTab));
|
|
||||||
return deleteIcon;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// set the visible columns
|
|
||||||
final List<Object> visibleColumnIds = new ArrayList<>();
|
|
||||||
final List<String> visibleColumnLabels = new ArrayList<>();
|
|
||||||
if (visibleColumnIds.isEmpty() && visibleColumnLabels.isEmpty()) {
|
|
||||||
visibleColumnIds.add(TARGET_NAME);
|
|
||||||
visibleColumnIds.add(DISTRIBUTION_NAME);
|
|
||||||
visibleColumnIds.add(DISCARD_CHANGES);
|
|
||||||
visibleColumnLabels.add(i18n.get("header.first.assignment.table"));
|
|
||||||
visibleColumnLabels.add(i18n.get("header.second.assignment.table"));
|
|
||||||
visibleColumnLabels.add(i18n.get("header.third.assignment.table"));
|
|
||||||
}
|
|
||||||
|
|
||||||
assignmnetTab.getTable().setColumnExpandRatio(TARGET_NAME, 2);
|
assignmnetTab.getTable().setColumnExpandRatio(TARGET_NAME, 2);
|
||||||
assignmnetTab.getTable().setColumnExpandRatio(DISTRIBUTION_NAME, 2);
|
assignmnetTab.getTable().setColumnExpandRatio(DISTRIBUTION_NAME, 2);
|
||||||
assignmnetTab.getTable().setColumnExpandRatio(DISCARD_CHANGES, 1);
|
assignmnetTab.getTable().setColumnExpandRatio(DISCARD_CHANGES, 1);
|
||||||
assignmnetTab.getTable().setVisibleColumns(visibleColumnIds.toArray());
|
assignmnetTab.getTable().setVisibleColumns(TARGET_NAME, DISTRIBUTION_NAME, DISCARD_CHANGES);
|
||||||
assignmnetTab.getTable().setColumnHeaders(visibleColumnLabels.toArray(new String[0]));
|
assignmnetTab.getTable().setColumnHeaders(i18n.get("header.first.assignment.table"),
|
||||||
|
i18n.get("header.second.assignment.table"), i18n.get("header.third.assignment.table"));
|
||||||
assignmnetTab.getTable().setColumnAlignment(DISCARD_CHANGES, Align.CENTER);
|
assignmnetTab.getTable().setColumnAlignment(DISCARD_CHANGES, Align.CENTER);
|
||||||
|
|
||||||
actionTypeOptionGroupLayout.selectDefaultOption();
|
actionTypeOptionGroupLayout.selectDefaultOption();
|
||||||
@@ -326,27 +288,15 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
|||||||
|
|
||||||
/* Add the discard action column */
|
/* Add the discard action column */
|
||||||
tab.getTable().addGeneratedColumn(DISCARD_CHANGES, (source, itemId, columnId) -> {
|
tab.getTable().addGeneratedColumn(DISCARD_CHANGES, (source, itemId, columnId) -> {
|
||||||
final Button deletestargetIcon = SPUIComponentProvider.getButton("", "", SPUILabelDefinitions.DISCARD,
|
final ClickListener clickListener = event -> discardTargetDelete(
|
||||||
ValoTheme.BUTTON_TINY + " " + SPUIStyleDefinitions.REDICON, true, FontAwesome.REPLY,
|
(TargetIdName) ((Button) event.getComponent()).getData(), itemId, tab);
|
||||||
SPUIButtonStyleSmallNoBorder.class);
|
return createDiscardButton(itemId, clickListener);
|
||||||
deletestargetIcon.setData(itemId);
|
|
||||||
deletestargetIcon.setImmediate(true);
|
|
||||||
deletestargetIcon.addClickListener(event -> discardTargetDelete(
|
|
||||||
(TargetIdName) ((Button) event.getComponent()).getData(), itemId, tab));
|
|
||||||
return deletestargetIcon;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/* set the visible columns */
|
tab.getTable().setVisibleColumns(TARGET_NAME, DISCARD_CHANGES);
|
||||||
final List<Object> visibleColumnIds = new ArrayList<>();
|
tab.getTable().setColumnHeaders(i18n.get("header.first.deletetarget.table"),
|
||||||
final List<String> visibleColumnLabels = new ArrayList<>();
|
i18n.get("header.second.deletetarget.table"));
|
||||||
if (visibleColumnIds.isEmpty() && visibleColumnLabels.isEmpty()) {
|
|
||||||
visibleColumnIds.add(TARGET_NAME);
|
|
||||||
visibleColumnIds.add(DISCARD_CHANGES);
|
|
||||||
visibleColumnLabels.add(i18n.get("header.first.deletetarget.table"));
|
|
||||||
visibleColumnLabels.add(i18n.get("header.second.deletetarget.table"));
|
|
||||||
}
|
|
||||||
tab.getTable().setVisibleColumns(visibleColumnIds.toArray());
|
|
||||||
tab.getTable().setColumnHeaders(visibleColumnLabels.toArray(new String[0]));
|
|
||||||
|
|
||||||
tab.getTable().setColumnExpandRatio(TARGET_NAME, SPUIDefinitions.TARGET_DISTRIBUTION_COLUMN_WIDTH);
|
tab.getTable().setColumnExpandRatio(TARGET_NAME, SPUIDefinitions.TARGET_DISTRIBUTION_COLUMN_WIDTH);
|
||||||
tab.getTable().setColumnExpandRatio(DISCARD_CHANGES, SPUIDefinitions.DISCARD_COLUMN_WIDTH);
|
tab.getTable().setColumnExpandRatio(DISCARD_CHANGES, SPUIDefinitions.DISCARD_COLUMN_WIDTH);
|
||||||
@@ -371,30 +321,17 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
|||||||
|
|
||||||
/* Add the discard action column */
|
/* Add the discard action column */
|
||||||
tab.getTable().addGeneratedColumn(DISCARD_CHANGES, (source, itemId, columnId) -> {
|
tab.getTable().addGeneratedColumn(DISCARD_CHANGES, (source, itemId, columnId) -> {
|
||||||
final Button deletesDsIcon = SPUIComponentProvider.getButton("", "", SPUILabelDefinitions.DISCARD,
|
final ClickListener clickListener = event -> discardDSDelete(
|
||||||
ValoTheme.BUTTON_TINY + " " + SPUIStyleDefinitions.REDICON, true, FontAwesome.REPLY,
|
(DistributionSetIdName) ((Button) event.getComponent()).getData(), itemId, tab);
|
||||||
SPUIButtonStyleSmallNoBorder.class);
|
return createDiscardButton(itemId, clickListener);
|
||||||
deletesDsIcon.setData(itemId);
|
|
||||||
deletesDsIcon.setImmediate(true);
|
|
||||||
deletesDsIcon.addClickListener(event -> discardDSDelete(
|
|
||||||
(DistributionSetIdName) ((Button) event.getComponent()).getData(), itemId, tab));
|
|
||||||
return deletesDsIcon;
|
|
||||||
});
|
|
||||||
|
|
||||||
/* set the visible columns */
|
});
|
||||||
final List<Object> visibleColumnIds = new ArrayList<>();
|
|
||||||
final List<String> visibleColumnLabels = new ArrayList<>();
|
|
||||||
if (visibleColumnIds.isEmpty() && visibleColumnLabels.isEmpty()) {
|
|
||||||
visibleColumnIds.add(DISTRIBUTION_NAME);
|
|
||||||
visibleColumnIds.add(DISCARD_CHANGES);
|
|
||||||
visibleColumnLabels.add(i18n.get("header.one.deletedist.table"));
|
|
||||||
visibleColumnLabels.add(i18n.get("header.second.deletedist.table"));
|
|
||||||
}
|
|
||||||
|
|
||||||
tab.getTable().setColumnExpandRatio(DISTRIBUTION_NAME, SPUIDefinitions.TARGET_DISTRIBUTION_COLUMN_WIDTH);
|
tab.getTable().setColumnExpandRatio(DISTRIBUTION_NAME, SPUIDefinitions.TARGET_DISTRIBUTION_COLUMN_WIDTH);
|
||||||
tab.getTable().setColumnExpandRatio(DISCARD_CHANGES, SPUIDefinitions.DISCARD_COLUMN_WIDTH);
|
tab.getTable().setColumnExpandRatio(DISCARD_CHANGES, SPUIDefinitions.DISCARD_COLUMN_WIDTH);
|
||||||
tab.getTable().setVisibleColumns(visibleColumnIds.toArray());
|
tab.getTable().setVisibleColumns(DISTRIBUTION_NAME, DISCARD_CHANGES);
|
||||||
tab.getTable().setColumnHeaders(visibleColumnLabels.toArray(new String[0]));
|
tab.getTable().setColumnHeaders(i18n.get("header.one.deletedist.table"),
|
||||||
|
i18n.get("header.second.deletedist.table"));
|
||||||
tab.getTable().setColumnAlignment(DISCARD_CHANGES, Align.CENTER);
|
tab.getTable().setColumnAlignment(DISCARD_CHANGES, Align.CENTER);
|
||||||
return tab;
|
return tab;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import java.util.concurrent.atomic.AtomicLong;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||||
|
import org.eclipse.hawkbit.ui.common.ManagmentEntityState;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import com.vaadin.spring.annotation.SpringComponent;
|
import com.vaadin.spring.annotation.SpringComponent;
|
||||||
@@ -31,7 +32,7 @@ import com.vaadin.spring.annotation.VaadinSessionScope;
|
|||||||
*/
|
*/
|
||||||
@VaadinSessionScope
|
@VaadinSessionScope
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
public class ManagementUIState implements Serializable {
|
public class ManagementUIState implements ManagmentEntityState<DistributionSetIdName>, Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 7301409196969723794L;
|
private static final long serialVersionUID = 7301409196969723794L;
|
||||||
|
|
||||||
@@ -170,7 +171,7 @@ public class ManagementUIState implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Optional<Set<TargetIdName>> getSelectedTargetIdName() {
|
public Optional<Set<TargetIdName>> getSelectedTargetIdName() {
|
||||||
return selectedTargetIdName == null ? Optional.empty() : Optional.of(selectedTargetIdName);
|
return Optional.ofNullable(selectedTargetIdName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSelectedTargetIdName(final Set<TargetIdName> selectedTargetIdName) {
|
public void setSelectedTargetIdName(final Set<TargetIdName> selectedTargetIdName) {
|
||||||
@@ -266,16 +267,19 @@ public class ManagementUIState implements Serializable {
|
|||||||
return lastSelectedDsIdName;
|
return lastSelectedDsIdName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLastSelectedDsIdName(final DistributionSetIdName lastSelectedDsIdName) {
|
@Override
|
||||||
this.lastSelectedDsIdName = lastSelectedDsIdName;
|
public void setLastSelectedEntity(final DistributionSetIdName value) {
|
||||||
|
this.lastSelectedDsIdName = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSelectedDsIdName(final Set<DistributionSetIdName> selectedDsIdName) {
|
@Override
|
||||||
this.selectedDsIdName = selectedDsIdName;
|
public void setSelectedEnitities(final Set<DistributionSetIdName> values) {
|
||||||
|
this.selectedDsIdName = values;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<Set<DistributionSetIdName>> getSelectedDsIdName() {
|
public Optional<Set<DistributionSetIdName>> getSelectedDsIdName() {
|
||||||
return selectedDsIdName == null ? Optional.empty() : Optional.of(selectedDsIdName);
|
return Optional.ofNullable(selectedDsIdName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ import java.util.Set;
|
|||||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentEvent;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||||
@@ -56,6 +56,8 @@ import com.vaadin.ui.themes.ValoTheme;
|
|||||||
@SpringComponent
|
@SpringComponent
|
||||||
@VaadinSessionScope
|
@VaadinSessionScope
|
||||||
public class TargetAddUpdateWindowLayout extends CustomComponent {
|
public class TargetAddUpdateWindowLayout extends CustomComponent {
|
||||||
|
private static final long serialVersionUID = -6659290471705262389L;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private I18N i18n;
|
private I18N i18n;
|
||||||
|
|
||||||
@@ -68,7 +70,6 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private transient UINotification uINotification;
|
private transient UINotification uINotification;
|
||||||
|
|
||||||
private static final long serialVersionUID = -6659290471705262389L;
|
|
||||||
private TextField controllerIDTextField;
|
private TextField controllerIDTextField;
|
||||||
private TextField nameTextField;
|
private TextField nameTextField;
|
||||||
private TextArea descTextArea;
|
private TextArea descTextArea;
|
||||||
@@ -218,7 +219,7 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
|
|||||||
/* display success msg */
|
/* display success msg */
|
||||||
uINotification.displaySuccess(i18n.get("message.update.success", new Object[] { latestTarget.getName() }));
|
uINotification.displaySuccess(i18n.get("message.update.success", new Object[] { latestTarget.getName() }));
|
||||||
// publishing through event bus
|
// publishing through event bus
|
||||||
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.EDIT_TARGET, latestTarget));
|
eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.UPDATED_ENTITY, latestTarget));
|
||||||
|
|
||||||
/* close the window */
|
/* close the window */
|
||||||
closeThisWindow();
|
closeThisWindow();
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import org.eclipse.hawkbit.ui.common.detailslayout.AbstractTableDetailsLayout;
|
|||||||
import org.eclipse.hawkbit.ui.common.tagdetails.TargetTagToken;
|
import org.eclipse.hawkbit.ui.common.tagdetails.TargetTagToken;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentEvent;
|
|
||||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||||
@@ -44,13 +43,10 @@ import com.vaadin.ui.themes.ValoTheme;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Target details layout.
|
* Target details layout.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
public class TargetDetails extends AbstractTableDetailsLayout {
|
public class TargetDetails extends AbstractTableDetailsLayout<Target> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 4571732743399605843L;
|
private static final long serialVersionUID = 4571732743399605843L;
|
||||||
|
|
||||||
@@ -63,14 +59,9 @@ public class TargetDetails extends AbstractTableDetailsLayout {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private TargetTagToken targetTagToken;
|
private TargetTagToken targetTagToken;
|
||||||
|
|
||||||
private Target selectedTarget = null;
|
|
||||||
|
|
||||||
private VerticalLayout assignedDistLayout;
|
private VerticalLayout assignedDistLayout;
|
||||||
private VerticalLayout installedDistLayout;
|
private VerticalLayout installedDistLayout;
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the Target details.
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
super.init();
|
super.init();
|
||||||
@@ -79,18 +70,18 @@ public class TargetDetails extends AbstractTableDetailsLayout {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getDefaultCaption() {
|
protected String getDefaultCaption() {
|
||||||
return i18n.get("target.details.header");
|
return getI18n().get("target.details.header");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addTabs(final TabSheet detailsTab) {
|
protected void addTabs(final TabSheet detailsTab) {
|
||||||
detailsTab.addTab(createDetailsLayout(), i18n.get("caption.tab.details"), null);
|
detailsTab.addTab(createDetailsLayout(), getI18n().get("caption.tab.details"), null);
|
||||||
detailsTab.addTab(createDescriptionLayout(), i18n.get("caption.tab.description"), null);
|
detailsTab.addTab(createDescriptionLayout(), getI18n().get("caption.tab.description"), null);
|
||||||
detailsTab.addTab(createAttributesLayout(), i18n.get("caption.attributes.tab"), null);
|
detailsTab.addTab(createAttributesLayout(), getI18n().get("caption.attributes.tab"), null);
|
||||||
detailsTab.addTab(createAssignedDistLayout(), i18n.get("header.target.assigned"), null);
|
detailsTab.addTab(createAssignedDistLayout(), getI18n().get("header.target.assigned"), null);
|
||||||
detailsTab.addTab(createInstalledDistLayout(), i18n.get("header.target.installed"), null);
|
detailsTab.addTab(createInstalledDistLayout(), getI18n().get("header.target.installed"), null);
|
||||||
detailsTab.addTab(createTagsLayout(), i18n.get("caption.tags.tab"), null);
|
detailsTab.addTab(createTagsLayout(), getI18n().get("caption.tags.tab"), null);
|
||||||
detailsTab.addTab(createLogLayout(), i18n.get("caption.logs.tab"), null);
|
detailsTab.addTab(createLogLayout(), getI18n().get("caption.logs.tab"), null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,14 +103,15 @@ public class TargetDetails extends AbstractTableDetailsLayout {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEdit(final ClickEvent event) {
|
protected void onEdit(final ClickEvent event) {
|
||||||
if (selectedTarget != null) {
|
if (getSelectedBaseEntity() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
final Window newDistWindow = targetAddUpdateWindowLayout.getWindow();
|
final Window newDistWindow = targetAddUpdateWindowLayout.getWindow();
|
||||||
targetAddUpdateWindowLayout.populateValuesOfTarget(selectedTarget.getControllerId());
|
targetAddUpdateWindowLayout.populateValuesOfTarget(getSelectedBaseEntity().getControllerId());
|
||||||
newDistWindow.setCaption(i18n.get("caption.update.dist"));
|
newDistWindow.setCaption(getI18n().get("caption.update.dist"));
|
||||||
UI.getCurrent().addWindow(newDistWindow);
|
UI.getCurrent().addWindow(newDistWindow);
|
||||||
newDistWindow.setVisible(Boolean.TRUE);
|
newDistWindow.setVisible(Boolean.TRUE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getEditButtonId() {
|
protected String getEditButtonId() {
|
||||||
@@ -138,50 +130,24 @@ public class TargetDetails extends AbstractTableDetailsLayout {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void populateDetailsWidget() {
|
protected void populateDetailsWidget() {
|
||||||
if (selectedTarget != null) {
|
if (getSelectedBaseEntity() != null) {
|
||||||
setName(getDefaultCaption(), selectedTarget.getName());
|
updateDetailsLayout(getSelectedBaseEntity().getControllerId(),
|
||||||
}
|
getSelectedBaseEntity().getTargetInfo().getAddress(), getSelectedBaseEntity().getSecurityToken(),
|
||||||
populateDetailsWidget(selectedTarget);
|
SPDateTimeUtil.getFormattedDate(getSelectedBaseEntity().getTargetInfo().getLastTargetQuery()));
|
||||||
}
|
populateDistributionDtls(installedDistLayout,
|
||||||
|
getSelectedBaseEntity().getTargetInfo().getInstalledDistributionSet());
|
||||||
private void populateDetailsWidget(final Target target) {
|
populateDistributionDtls(assignedDistLayout, getSelectedBaseEntity().getAssignedDistributionSet());
|
||||||
if (target != null) {
|
|
||||||
setName(getDefaultCaption(), target.getName());
|
|
||||||
updateDetailsLayout(target.getControllerId(), target.getTargetInfo().getAddress(),
|
|
||||||
target.getSecurityToken(),
|
|
||||||
SPDateTimeUtil.getFormattedDate(target.getTargetInfo().getLastTargetQuery()));
|
|
||||||
populateDescription(target);
|
|
||||||
populateDistributionDtls(installedDistLayout, target.getTargetInfo().getInstalledDistributionSet());
|
|
||||||
populateDistributionDtls(assignedDistLayout, target.getAssignedDistributionSet());
|
|
||||||
updateLogLayout(getLogLayout(), target.getLastModifiedAt(), target.getLastModifiedBy(),
|
|
||||||
target.getCreatedAt(), target.getCreatedBy(), i18n);
|
|
||||||
populateAttributes(target);
|
|
||||||
} else {
|
} else {
|
||||||
setName(getDefaultCaption(), HawkbitCommonUtil.SP_STRING_EMPTY);
|
|
||||||
updateDetailsLayout(null, null, null, null);
|
updateDetailsLayout(null, null, null, null);
|
||||||
populateDescription(null);
|
|
||||||
populateDistributionDtls(installedDistLayout, null);
|
populateDistributionDtls(installedDistLayout, null);
|
||||||
populateDistributionDtls(assignedDistLayout, null);
|
populateDistributionDtls(assignedDistLayout, null);
|
||||||
updateLogLayout(getLogLayout(), null, HawkbitCommonUtil.SP_STRING_EMPTY, null, null, i18n);
|
|
||||||
populateAttributes(null);
|
|
||||||
}
|
}
|
||||||
|
updateAttributesLayout(getSelectedBaseEntity());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateAttributes(final Target target) {
|
@Override
|
||||||
if (target != null) {
|
protected String getName() {
|
||||||
|
return getSelectedBaseEntity().getName();
|
||||||
updateAttributesLayout(target);
|
|
||||||
} else {
|
|
||||||
updateAttributesLayout(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void populateDescription(final Target target) {
|
|
||||||
if (target != null) {
|
|
||||||
updateDescriptionLayout(i18n.get("label.description"), target.getDescription());
|
|
||||||
} else {
|
|
||||||
updateDescriptionLayout(i18n.get("label.description"), null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDetailsLayout(final String controllerId, final URI address, final String securityToken,
|
private void updateDetailsLayout(final String controllerId, final URI address, final String securityToken,
|
||||||
@@ -189,17 +155,18 @@ public class TargetDetails extends AbstractTableDetailsLayout {
|
|||||||
final VerticalLayout detailsTabLayout = getDetailsLayout();
|
final VerticalLayout detailsTabLayout = getDetailsLayout();
|
||||||
detailsTabLayout.removeAllComponents();
|
detailsTabLayout.removeAllComponents();
|
||||||
|
|
||||||
final Label controllerLabel = SPUIComponentProvider.createNameValueLabel(i18n.get("label.target.id"),
|
final Label controllerLabel = SPUIComponentProvider.createNameValueLabel(getI18n().get("label.target.id"),
|
||||||
HawkbitCommonUtil.trimAndNullIfEmpty(controllerId) == null ? "" : controllerId);
|
HawkbitCommonUtil.trimAndNullIfEmpty(controllerId) == null ? "" : controllerId);
|
||||||
controllerLabel.setId(SPUIComponetIdProvider.TARGET_CONTROLLER_ID);
|
controllerLabel.setId(SPUIComponetIdProvider.TARGET_CONTROLLER_ID);
|
||||||
detailsTabLayout.addComponent(controllerLabel);
|
detailsTabLayout.addComponent(controllerLabel);
|
||||||
|
|
||||||
final Label lastPollDtLabel = SPUIComponentProvider.createNameValueLabel(i18n.get("label.target.lastpolldate"),
|
final Label lastPollDtLabel = SPUIComponentProvider.createNameValueLabel(
|
||||||
|
getI18n().get("label.target.lastpolldate"),
|
||||||
HawkbitCommonUtil.trimAndNullIfEmpty(lastQueryDate) == null ? "" : lastQueryDate);
|
HawkbitCommonUtil.trimAndNullIfEmpty(lastQueryDate) == null ? "" : lastQueryDate);
|
||||||
lastPollDtLabel.setId(SPUIComponetIdProvider.TARGET_LAST_QUERY_DT);
|
lastPollDtLabel.setId(SPUIComponetIdProvider.TARGET_LAST_QUERY_DT);
|
||||||
detailsTabLayout.addComponent(lastPollDtLabel);
|
detailsTabLayout.addComponent(lastPollDtLabel);
|
||||||
|
|
||||||
final Label typeLabel = SPUIComponentProvider.createNameValueLabel(i18n.get("label.ip"),
|
final Label typeLabel = SPUIComponentProvider.createNameValueLabel(getI18n().get("label.ip"),
|
||||||
address == null ? StringUtils.EMPTY : address.toString());
|
address == null ? StringUtils.EMPTY : address.toString());
|
||||||
typeLabel.setId(SPUIComponetIdProvider.TARGET_IP_ADDRESS);
|
typeLabel.setId(SPUIComponetIdProvider.TARGET_IP_ADDRESS);
|
||||||
detailsTabLayout.addComponent(typeLabel);
|
detailsTabLayout.addComponent(typeLabel);
|
||||||
@@ -215,7 +182,7 @@ public class TargetDetails extends AbstractTableDetailsLayout {
|
|||||||
final HorizontalLayout securityTokenLayout = new HorizontalLayout();
|
final HorizontalLayout securityTokenLayout = new HorizontalLayout();
|
||||||
|
|
||||||
final Label securityTableLbl = new Label(
|
final Label securityTableLbl = new Label(
|
||||||
SPUIComponentProvider.getBoldHTMLText(i18n.get("label.target.security.token")), ContentMode.HTML);
|
SPUIComponentProvider.getBoldHTMLText(getI18n().get("label.target.security.token")), ContentMode.HTML);
|
||||||
securityTableLbl.addStyleName(SPUIDefinitions.TEXT_STYLE);
|
securityTableLbl.addStyleName(SPUIDefinitions.TEXT_STYLE);
|
||||||
securityTableLbl.addStyleName("label-style");
|
securityTableLbl.addStyleName("label-style");
|
||||||
|
|
||||||
@@ -235,19 +202,18 @@ public class TargetDetails extends AbstractTableDetailsLayout {
|
|||||||
|
|
||||||
private void populateDistributionDtls(final VerticalLayout layout, final DistributionSet distributionSet) {
|
private void populateDistributionDtls(final VerticalLayout layout, final DistributionSet distributionSet) {
|
||||||
layout.removeAllComponents();
|
layout.removeAllComponents();
|
||||||
if (distributionSet != null) {
|
if (distributionSet == null) {
|
||||||
// Display distribution set name
|
return;
|
||||||
layout.addComponent(SPUIComponentProvider.createNameValueLabel(i18n.get("label.dist.details.name"),
|
}
|
||||||
|
layout.addComponent(SPUIComponentProvider.createNameValueLabel(getI18n().get("label.dist.details.name"),
|
||||||
distributionSet.getName()));
|
distributionSet.getName()));
|
||||||
|
|
||||||
layout.addComponent(SPUIComponentProvider.createNameValueLabel(i18n.get("label.dist.details.version"),
|
layout.addComponent(SPUIComponentProvider.createNameValueLabel(getI18n().get("label.dist.details.version"),
|
||||||
distributionSet.getVersion()));
|
distributionSet.getVersion()));
|
||||||
|
|
||||||
/* Module info */
|
|
||||||
distributionSet.getModules()
|
distributionSet.getModules()
|
||||||
.forEach(module -> layout.addComponent(getSWModlabel(module.getType().getName(), module)));
|
.forEach(module -> layout.addComponent(getSWModlabel(module.getType().getName(), module)));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Label for SW Module.
|
* Create Label for SW Module.
|
||||||
@@ -262,37 +228,14 @@ public class TargetDetails extends AbstractTableDetailsLayout {
|
|||||||
return SPUIComponentProvider.createNameValueLabel(labelName + " : ", swModule.getName(), swModule.getVersion());
|
return SPUIComponentProvider.createNameValueLabel(labelName + " : ", swModule.getName(), swModule.getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void clearDetails() {
|
|
||||||
populateDetailsWidget(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean hasEditPermission() {
|
protected Boolean hasEditPermission() {
|
||||||
return permissionChecker.hasUpdateTargetPermission();
|
return getPermissionChecker().hasUpdateTargetPermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final TargetTableEvent targetTableEvent) {
|
void onEvent(final TargetTableEvent targetTableEvent) {
|
||||||
// Get the event type
|
onBaseEntityEvent(targetTableEvent);
|
||||||
final TargetComponentEvent event = targetTableEvent.getTargetComponentEvent();
|
|
||||||
|
|
||||||
if (event == TargetComponentEvent.SELECTED_TARGET || event == TargetComponentEvent.EDIT_TARGET) {
|
|
||||||
UI.getCurrent().access(() -> {
|
|
||||||
// If selected or edited, populate the fresh details.
|
|
||||||
if (targetTableEvent.getTarget() != null) {
|
|
||||||
selectedTarget = targetTableEvent.getTarget();
|
|
||||||
} else {
|
|
||||||
selectedTarget = null;
|
|
||||||
}
|
|
||||||
populateData(selectedTarget != null);
|
|
||||||
|
|
||||||
});
|
|
||||||
} else if (event == TargetComponentEvent.MINIMIZED) {
|
|
||||||
UI.getCurrent().access(() -> showLayout());
|
|
||||||
} else if (event == TargetComponentEvent.MAXIMIZED) {
|
|
||||||
UI.getCurrent().access(() -> hideLayout());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -18,9 +18,6 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import javax.annotation.PreDestroy;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.eventbus.event.TargetCreatedEvent;
|
import org.eclipse.hawkbit.eventbus.event.TargetCreatedEvent;
|
||||||
import org.eclipse.hawkbit.eventbus.event.TargetDeletedEvent;
|
import org.eclipse.hawkbit.eventbus.event.TargetDeletedEvent;
|
||||||
import org.eclipse.hawkbit.eventbus.event.TargetInfoUpdateEvent;
|
import org.eclipse.hawkbit.eventbus.event.TargetInfoUpdateEvent;
|
||||||
@@ -34,7 +31,9 @@ import org.eclipse.hawkbit.repository.model.TargetIdName;
|
|||||||
import org.eclipse.hawkbit.repository.model.TargetInfo;
|
import org.eclipse.hawkbit.repository.model.TargetInfo;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
|
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||||
|
import org.eclipse.hawkbit.ui.common.ManagmentEntityState;
|
||||||
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.filter.FilterExpression;
|
import org.eclipse.hawkbit.ui.filter.FilterExpression;
|
||||||
import org.eclipse.hawkbit.ui.filter.Filters;
|
import org.eclipse.hawkbit.ui.filter.Filters;
|
||||||
import org.eclipse.hawkbit.ui.filter.target.CustomTargetFilter;
|
import org.eclipse.hawkbit.ui.filter.target.CustomTargetFilter;
|
||||||
@@ -53,7 +52,6 @@ import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentE
|
|||||||
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
|
||||||
import org.eclipse.hawkbit.ui.management.state.TargetTableFilters;
|
import org.eclipse.hawkbit.ui.management.state.TargetTableFilters;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
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.SPDateTimeUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
@@ -69,7 +67,6 @@ import org.springframework.data.domain.Sort;
|
|||||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
|
||||||
import org.vaadin.spring.events.EventBus;
|
|
||||||
import org.vaadin.spring.events.EventScope;
|
import org.vaadin.spring.events.EventScope;
|
||||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||||
|
|
||||||
@@ -102,7 +99,7 @@ import com.vaadin.ui.themes.ValoTheme;
|
|||||||
*/
|
*/
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
@ViewScope
|
@ViewScope
|
||||||
public class TargetTable extends AbstractTable implements Handler {
|
public class TargetTable extends AbstractTable<Target, TargetIdName> implements Handler {
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(TargetTable.class);
|
private static final Logger LOG = LoggerFactory.getLogger(TargetTable.class);
|
||||||
private static final String TARGET_PINNED = "targetPinned";
|
private static final String TARGET_PINNED = "targetPinned";
|
||||||
@@ -110,15 +107,11 @@ public class TargetTable extends AbstractTable implements Handler {
|
|||||||
private static final long serialVersionUID = -2300392868806614568L;
|
private static final long serialVersionUID = -2300392868806614568L;
|
||||||
|
|
||||||
private static final int PROPERTY_DEPT = 3;
|
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";
|
private static final String ACTION_NOT_ALLOWED_MSG = "message.action.not.allowed";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private transient TargetManagement targetManagement;
|
private transient TargetManagement targetManagement;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private I18N i18n;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ManagementUIState managementUIState;
|
private ManagementUIState managementUIState;
|
||||||
|
|
||||||
@@ -128,9 +121,6 @@ public class TargetTable extends AbstractTable implements Handler {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private UINotification notification;
|
private UINotification notification;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private transient EventBus.SessionEventBus eventBus;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ManagementViewAcceptCriteria managementViewAcceptCriteria;
|
private ManagementViewAcceptCriteria managementViewAcceptCriteria;
|
||||||
|
|
||||||
@@ -141,19 +131,11 @@ public class TargetTable extends AbstractTable implements Handler {
|
|||||||
private ShortcutAction actionUnSelectAll;
|
private ShortcutAction actionUnSelectAll;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@PostConstruct
|
|
||||||
protected void init() {
|
protected void init() {
|
||||||
super.init();
|
super.init();
|
||||||
addActionHandler(this);
|
addActionHandler(this);
|
||||||
actionSelectAll = new ShortcutAction(i18n.get("action.target.table.selectall"));
|
actionSelectAll = new ShortcutAction(i18n.get("action.target.table.selectall"));
|
||||||
actionUnSelectAll = new ShortcutAction(i18n.get("action.target.table.clear"));
|
actionUnSelectAll = new ShortcutAction(i18n.get("action.target.table.clear"));
|
||||||
eventBus.subscribe(this);
|
|
||||||
setNoDataAvailable();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PreDestroy
|
|
||||||
void destroy() {
|
|
||||||
eventBus.unsubscribe(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -199,9 +181,10 @@ public class TargetTable extends AbstractTable implements Handler {
|
|||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void addOrEditEvent(final TargetAddUpdateWindowEvent targetUIEvent) {
|
void addOrEditEvent(final TargetAddUpdateWindowEvent targetUIEvent) {
|
||||||
if (targetUIEvent.getTargetComponentEvent() == TargetComponentEvent.EDIT_TARGET) {
|
if (BaseEntityEventType.UPDATED_ENTITY != targetUIEvent.getEventType()) {
|
||||||
UI.getCurrent().access(() -> updateTarget(targetUIEvent.getTarget()));
|
return;
|
||||||
}
|
}
|
||||||
|
UI.getCurrent().access(() -> updateTarget(targetUIEvent.getEntity()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
@@ -239,33 +222,14 @@ public class TargetTable extends AbstractTable implements Handler {
|
|||||||
|
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final TargetTableEvent event) {
|
void onEvent(final TargetTableEvent event) {
|
||||||
if (event.getTargetComponentEvent() == TargetComponentEvent.MINIMIZED) {
|
onBaseEntityEvent(event);
|
||||||
UI.getCurrent().access(() -> applyMinTableSettings());
|
|
||||||
} else if (event.getTargetComponentEvent() == TargetComponentEvent.MAXIMIZED) {
|
|
||||||
UI.getCurrent().access(() -> applyMaxTableSettings());
|
|
||||||
} else if (event.getTargetComponentEvent() == TargetComponentEvent.EDIT_TARGET) {
|
|
||||||
UI.getCurrent().access(() -> updateTarget(event.getTarget()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#getTableId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTableId() {
|
protected String getTableId() {
|
||||||
return SPUIComponetIdProvider.TARGET_TABLE_ID;
|
return SPUIComponetIdProvider.TARGET_TABLE_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#createContainer(
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Container createContainer() {
|
protected Container createContainer() {
|
||||||
// ADD all the filters to the query config
|
// ADD all the filters to the query config
|
||||||
@@ -311,12 +275,6 @@ public class TargetTable extends AbstractTable implements Handler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTable#
|
|
||||||
* addCustomGeneratedColumns ()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void addCustomGeneratedColumns() {
|
protected void addCustomGeneratedColumns() {
|
||||||
addGeneratedColumn(SPUIDefinitions.TARGET_STATUS_PIN_TOGGLE_ICON,
|
addGeneratedColumn(SPUIDefinitions.TARGET_STATUS_PIN_TOGGLE_ICON,
|
||||||
@@ -340,22 +298,24 @@ public class TargetTable extends AbstractTable implements Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onValueChange() {
|
protected void publishEntityAfterValueChange(final Target selectedLastEntity) {
|
||||||
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
|
eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.SELECTED_ENTITY, selectedLastEntity));
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
final Set<TargetIdName> values = HawkbitCommonUtil.getSelectedTargetDetails(this);
|
|
||||||
if (values != null && !values.isEmpty()) {
|
|
||||||
final TargetIdName lastSelectedItem = getLastSelectedItem(values);
|
|
||||||
managementUIState.setSelectedTargetIdName(values);
|
|
||||||
managementUIState.setLastSelectedTargetIdName(lastSelectedItem);
|
|
||||||
final Target target = targetManagement
|
|
||||||
.findTargetByControllerIDWithDetails(lastSelectedItem.getControllerId());
|
|
||||||
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.SELECTED_TARGET, target));
|
|
||||||
} else {
|
|
||||||
managementUIState.setSelectedTargetIdName(null);
|
|
||||||
managementUIState.setLastSelectedTargetIdName(null);
|
|
||||||
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.SELECTED_TARGET, (Target) null));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Target findEntityByTableValue(final TargetIdName lastSelectedId) {
|
||||||
|
return targetManagement.findTargetByControllerIDWithDetails(lastSelectedId.getControllerId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setManagementEntitiyStateValues(final Set<TargetIdName> values, final TargetIdName lastId) {
|
||||||
|
managementUIState.setSelectedTargetIdName(values);
|
||||||
|
managementUIState.setLastSelectedTargetIdName(lastId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ManagmentEntityState<TargetIdName> getManagmentEntityState() {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -365,30 +325,15 @@ public class TargetTable extends AbstractTable implements Handler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<TableColumn> getTableVisibleColumns() {
|
protected List<TableColumn> getTableVisibleColumns() {
|
||||||
final List<TableColumn> columnList = new ArrayList<>();
|
final List<TableColumn> columnList = super.getTableVisibleColumns();
|
||||||
if (isMaximized()) {
|
if (!isMaximized()) {
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get("header.name"), 0.2f));
|
columnList.add(new TableColumn(SPUIDefinitions.TARGET_STATUS_POLL_TIME, "", 0.0F));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_BY, i18n.get("header.createdBy"), 0.1f));
|
columnList.add(new TableColumn(SPUIDefinitions.TARGET_STATUS_PIN_TOGGLE_ICON, "", 0.0F));
|
||||||
columnList
|
|
||||||
.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_DATE, i18n.get("header.createdDate"), 0.1f));
|
|
||||||
columnList.add(
|
|
||||||
new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, i18n.get("header.modifiedBy"), 0.1f));
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, i18n.get("header.modifiedDate"),
|
|
||||||
0.1f));
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_DESC, i18n.get("header.description"), 0.2f));
|
|
||||||
} else {
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get("header.name"), 0.8f));
|
|
||||||
columnList.add(new TableColumn(SPUIDefinitions.TARGET_STATUS_POLL_TIME, "", 0.0f));
|
|
||||||
columnList.add(new TableColumn(SPUIDefinitions.TARGET_STATUS_PIN_TOGGLE_ICON, "", 0.0f));
|
|
||||||
}
|
}
|
||||||
return columnList;
|
return columnList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see hawkbit.server.ui.common.table.AbstractTable#getTableDropHandler()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected DropHandler getTableDropHandler() {
|
protected DropHandler getTableDropHandler() {
|
||||||
return new DropHandler() {
|
return new DropHandler() {
|
||||||
@@ -630,7 +575,7 @@ public class TargetTable extends AbstractTable implements Handler {
|
|||||||
private void tagAssignment(final DragAndDropEvent event) {
|
private void tagAssignment(final DragAndDropEvent event) {
|
||||||
final com.vaadin.event.dd.TargetDetails taregtDet = event.getTargetDetails();
|
final com.vaadin.event.dd.TargetDetails taregtDet = event.getTargetDetails();
|
||||||
final Table targetTable = (Table) taregtDet.getTarget();
|
final Table targetTable = (Table) taregtDet.getTarget();
|
||||||
final Set<TargetIdName> targetSelected = HawkbitCommonUtil.getSelectedTargetDetails(targetTable);
|
final Set<TargetIdName> targetSelected = getTableValue(targetTable);
|
||||||
final Set<String> targetList = new HashSet<>();
|
final Set<String> targetList = new HashSet<>();
|
||||||
final AbstractSelectTargetDetails dropData = (AbstractSelectTargetDetails) event.getTargetDetails();
|
final AbstractSelectTargetDetails dropData = (AbstractSelectTargetDetails) event.getTargetDetails();
|
||||||
final Object targetItemId = dropData.getItemIdOver();
|
final Object targetItemId = dropData.getItemIdOver();
|
||||||
@@ -688,14 +633,9 @@ public class TargetTable extends AbstractTable implements Handler {
|
|||||||
|
|
||||||
private static Set<DistributionSetIdName> getDraggedDistributionSet(final TableTransferable transferable,
|
private static Set<DistributionSetIdName> getDraggedDistributionSet(final TableTransferable transferable,
|
||||||
final Table source) {
|
final Table source) {
|
||||||
final Set<DistributionSetIdName> distSelected = HawkbitCommonUtil.getSelectedDSDetails(source);
|
@SuppressWarnings("unchecked")
|
||||||
final Set<DistributionSetIdName> distributionIdSet = new HashSet<>();
|
final AbstractTable<?, DistributionSetIdName> distTable = (AbstractTable<?, DistributionSetIdName>) source;
|
||||||
if (!distSelected.contains(transferable.getData(ITEMID))) {
|
return distTable.getDeletedEntityByTransferable(transferable);
|
||||||
distributionIdSet.add((DistributionSetIdName) transferable.getData(ITEMID));
|
|
||||||
} else {
|
|
||||||
distributionIdSet.addAll(distSelected);
|
|
||||||
}
|
|
||||||
return distributionIdSet;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Boolean validateDragAndDropWrapper(final Component compsource) {
|
private Boolean validateDragAndDropWrapper(final Component compsource) {
|
||||||
@@ -912,6 +852,7 @@ public class TargetTable extends AbstractTable implements Handler {
|
|||||||
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.REFRESH_TARGETS));
|
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.REFRESH_TARGETS));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
private void updateVisibleItemOnEvent(final TargetInfo targetInfo, final Target target,
|
private void updateVisibleItemOnEvent(final TargetInfo targetInfo, final Target target,
|
||||||
final TargetIdName targetIdName) {
|
final TargetIdName targetIdName) {
|
||||||
final LazyQueryContainer targetContainer = (LazyQueryContainer) getContainerDataSource();
|
final LazyQueryContainer targetContainer = (LazyQueryContainer) getContainerDataSource();
|
||||||
@@ -934,8 +875,8 @@ public class TargetTable extends AbstractTable implements Handler {
|
|||||||
* @param targetInfoUpdateEvents
|
* @param targetInfoUpdateEvents
|
||||||
* list of target info update event
|
* list of target info update event
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private void onTargetInfoUpdateEvents(final List<TargetInfoUpdateEvent> targetInfoUpdateEvents) {
|
private void onTargetInfoUpdateEvents(final List<TargetInfoUpdateEvent> targetInfoUpdateEvents) {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
final List<Object> visibleItemIds = (List<Object>) getVisibleItemIds();
|
final List<Object> visibleItemIds = (List<Object>) getVisibleItemIds();
|
||||||
boolean shoulTargetsUpdated = false;
|
boolean shoulTargetsUpdated = false;
|
||||||
Target lastSelectedTarget = null;
|
Target lastSelectedTarget = null;
|
||||||
@@ -962,7 +903,7 @@ public class TargetTable extends AbstractTable implements Handler {
|
|||||||
refreshTargets();
|
refreshTargets();
|
||||||
}
|
}
|
||||||
if (lastSelectedTarget != null) {
|
if (lastSelectedTarget != null) {
|
||||||
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.SELECTED_TARGET, lastSelectedTarget));
|
eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.SELECTED_ENTITY, lastSelectedTarget));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1042,13 +983,9 @@ public class TargetTable extends AbstractTable implements Handler {
|
|||||||
setValue(null);
|
setValue(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setNoDataAvailable() {
|
@Override
|
||||||
final int tableSize = getContainerDataSource().size();
|
protected void setDataAvailable(final boolean available) {
|
||||||
if (tableSize == 0) {
|
managementUIState.setNoDataAvilableTarget(!available);
|
||||||
managementUIState.setNoDataAvilableTarget(true);
|
|
||||||
} else {
|
|
||||||
managementUIState.setNoDataAvilableTarget(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,11 +8,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.management.targettable;
|
package org.eclipse.hawkbit.ui.management.targettable;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
||||||
import org.eclipse.hawkbit.ui.common.table.AbstractTableHeader;
|
import org.eclipse.hawkbit.ui.common.table.AbstractTableHeader;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||||
import org.eclipse.hawkbit.ui.management.event.BulkUploadPopupEvent;
|
import org.eclipse.hawkbit.ui.management.event.BulkUploadPopupEvent;
|
||||||
@@ -254,13 +255,13 @@ public class TargetTableHeader extends AbstractTableHeader {
|
|||||||
@Override
|
@Override
|
||||||
public void maximizeTable() {
|
public void maximizeTable() {
|
||||||
managementUIState.setTargetTableMaximized(Boolean.TRUE);
|
managementUIState.setTargetTableMaximized(Boolean.TRUE);
|
||||||
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.MAXIMIZED));
|
eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.MAXIMIZED,null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void minimizeTable() {
|
public void minimizeTable() {
|
||||||
managementUIState.setTargetTableMaximized(Boolean.FALSE);
|
managementUIState.setTargetTableMaximized(Boolean.FALSE);
|
||||||
eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.MINIMIZED));
|
eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.MINIMIZED,null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -377,16 +378,9 @@ public class TargetTableHeader extends AbstractTableHeader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Set<DistributionSetIdName> getDropppedDistributionDetails(final TableTransferable transferable) {
|
private Set<DistributionSetIdName> getDropppedDistributionDetails(final TableTransferable transferable) {
|
||||||
final Set<DistributionSetIdName> distSelected = HawkbitCommonUtil
|
@SuppressWarnings("unchecked")
|
||||||
.getSelectedDSDetails(transferable.getSourceComponent());
|
final AbstractTable<?, DistributionSetIdName> distTable = (AbstractTable<?, DistributionSetIdName>) transferable.getSourceComponent();
|
||||||
final Set<DistributionSetIdName> distributionIdSet = new HashSet<>();
|
return distTable.getDeletedEntityByTransferable(transferable);
|
||||||
if (!distSelected.contains(transferable.getData("itemId"))) {
|
|
||||||
distributionIdSet.add((DistributionSetIdName) transferable.getData("itemId"));
|
|
||||||
} else {
|
|
||||||
distributionIdSet.addAll(distSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
return distributionIdSet;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addFilterTextField(final DistributionSetIdName distributionSetIdName) {
|
private void addFilterTextField(final DistributionSetIdName distributionSetIdName) {
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.management.targettag;
|
package org.eclipse.hawkbit.ui.management.targettag;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -22,6 +21,7 @@ import org.eclipse.hawkbit.repository.model.TargetIdName;
|
|||||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
|
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
|
||||||
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtons;
|
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtons;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
import org.eclipse.hawkbit.ui.management.event.DragEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.management.event.ManagementViewAcceptCriteria;
|
import org.eclipse.hawkbit.ui.management.event.ManagementViewAcceptCriteria;
|
||||||
@@ -78,8 +78,6 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private transient TargetManagement targetManagement;
|
private transient TargetManagement targetManagement;
|
||||||
|
|
||||||
private static final String ITEMID = "itemId";
|
|
||||||
|
|
||||||
TargetTagFilterButtonClick filterButtonClickBehaviour;
|
TargetTagFilterButtonClick filterButtonClickBehaviour;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -212,35 +210,46 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void processTargetDrop(final DragAndDropEvent event) {
|
private void processTargetDrop(final DragAndDropEvent event) {
|
||||||
|
|
||||||
final com.vaadin.event.dd.TargetDetails targetDetails = event.getTargetDetails();
|
final com.vaadin.event.dd.TargetDetails targetDetails = event.getTargetDetails();
|
||||||
final TableTransferable transferable = (TableTransferable) event.getTransferable();
|
final TableTransferable transferable = (TableTransferable) event.getTransferable();
|
||||||
final Table source = transferable.getSourceComponent();
|
@SuppressWarnings("unchecked")
|
||||||
|
final AbstractTable<?, TargetIdName> targetTable = (AbstractTable<?, TargetIdName>) transferable
|
||||||
|
.getSourceComponent();
|
||||||
|
|
||||||
final Set<TargetIdName> targetSelected = HawkbitCommonUtil.getSelectedTargetDetails(source);
|
final Set<TargetIdName> targetSelected = targetTable.getDeletedEntityByTransferable(transferable);
|
||||||
final Set<String> targetList = new HashSet<>();
|
final Set<String> targetList = targetSelected.stream().map(t -> t.getControllerId())
|
||||||
if (transferable.getData(ITEMID) != null) {
|
.collect(Collectors.toSet());
|
||||||
if (!targetSelected.contains(transferable.getData(ITEMID))) {
|
|
||||||
targetList.add(((TargetIdName) transferable.getData(ITEMID)).getControllerId());
|
|
||||||
} else {
|
|
||||||
targetList.addAll(targetSelected.stream().map(t -> t.getControllerId()).collect(Collectors.toList()));
|
|
||||||
}
|
|
||||||
|
|
||||||
final String targTagName = HawkbitCommonUtil.removePrefix(targetDetails.getTarget().getId(),
|
final String targTagName = HawkbitCommonUtil.removePrefix(targetDetails.getTarget().getId(),
|
||||||
SPUIDefinitions.TARGET_TAG_ID_PREFIXS);
|
SPUIDefinitions.TARGET_TAG_ID_PREFIXS);
|
||||||
|
|
||||||
final List<String> tagsClickedList = managementUIState.getTargetTableFilters().getClickedTargetTags();
|
|
||||||
|
|
||||||
final TargetTagAssignmentResult result = targetManagement.toggleTagAssignment(targetList, targTagName);
|
final TargetTagAssignmentResult result = targetManagement.toggleTagAssignment(targetList, targTagName);
|
||||||
notification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(targTagName, result, i18n));
|
notification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(targTagName, result, i18n));
|
||||||
|
|
||||||
if (result.getAssigned() >= 1 && managementUIState.getTargetTableFilters().isNoTagSelected()) {
|
publishAssignTargetTagEvent(result);
|
||||||
eventBus.publish(this, ManagementUIEvent.ASSIGN_TARGET_TAG);
|
|
||||||
|
publishUnAssignTargetTagEvent(targTagName, result);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void publishUnAssignTargetTagEvent(final String targTagName, final TargetTagAssignmentResult result) {
|
||||||
|
final List<String> tagsClickedList = managementUIState.getTargetTableFilters().getClickedTargetTags();
|
||||||
|
final boolean isTargetTagUnAssigned = result.getUnassigned() >= 1 && !tagsClickedList.isEmpty()
|
||||||
|
&& tagsClickedList.contains(targTagName);
|
||||||
|
|
||||||
|
if (!isTargetTagUnAssigned) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (result.getUnassigned() >= 1 && !tagsClickedList.isEmpty() && tagsClickedList.contains(targTagName)) {
|
|
||||||
eventBus.publish(this, ManagementUIEvent.UNASSIGN_TARGET_TAG);
|
eventBus.publish(this, ManagementUIEvent.UNASSIGN_TARGET_TAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void publishAssignTargetTagEvent(final TargetTagAssignmentResult result) {
|
||||||
|
final boolean isNewTargetTagAssigned = result.getAssigned() >= 1
|
||||||
|
&& managementUIState.getTargetTableFilters().isNoTagSelected();
|
||||||
|
if (!isNewTargetTagAssigned) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
eventBus.publish(this, ManagementUIEvent.ASSIGN_TARGET_TAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean validateIfSourceisTargetTable(final Table source) {
|
private boolean validateIfSourceisTargetTable(final Table source) {
|
||||||
@@ -287,6 +296,7 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
private void addNewTargetTag(final TargetTag newTargetTag) {
|
private void addNewTargetTag(final TargetTag newTargetTag) {
|
||||||
final LazyQueryContainer targetTagContainer = (LazyQueryContainer) getContainerDataSource();
|
final LazyQueryContainer targetTagContainer = (LazyQueryContainer) getContainerDataSource();
|
||||||
final Object addItem = targetTagContainer.addItem();
|
final Object addItem = targetTagContainer.addItem();
|
||||||
|
|||||||
@@ -9,11 +9,12 @@
|
|||||||
package org.eclipse.hawkbit.ui.rollout.rollout;
|
package org.eclipse.hawkbit.ui.rollout.rollout;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||||
|
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
|
||||||
|
|
||||||
import com.vaadin.server.FontAwesome;
|
import com.vaadin.server.FontAwesome;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Proxy rollout with suctome properties.
|
* Proxy rollout with custom properties.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ProxyRollout extends Rollout {
|
public class ProxyRollout extends Rollout {
|
||||||
@@ -32,6 +33,17 @@ public class ProxyRollout extends Rollout {
|
|||||||
|
|
||||||
private String totalTargetsCount;
|
private String totalTargetsCount;
|
||||||
|
|
||||||
|
private RolloutRendererData rolloutRendererData;
|
||||||
|
|
||||||
|
|
||||||
|
public RolloutRendererData getRolloutRendererData() {
|
||||||
|
return rolloutRendererData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRolloutRendererData(RolloutRendererData rendererData) {
|
||||||
|
this.rolloutRendererData = rendererData;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the distributionSetNameVersion
|
* @return the distributionSetNameVersion
|
||||||
*/
|
*/
|
||||||
@@ -122,7 +134,6 @@ public class ProxyRollout extends Rollout {
|
|||||||
this.totalTargetsCount = totalTargetsCount;
|
this.totalTargetsCount = totalTargetsCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getAction() {
|
public String getAction() {
|
||||||
return FontAwesome.CIRCLE_O.getHtml();
|
return FontAwesome.CIRCLE_O.getHtml();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
|||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||||
|
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
|
||||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||||
@@ -119,8 +120,8 @@ public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
|
|||||||
proxyRollout.setName(rollout.getName());
|
proxyRollout.setName(rollout.getName());
|
||||||
proxyRollout.setDescription(rollout.getDescription());
|
proxyRollout.setDescription(rollout.getDescription());
|
||||||
final DistributionSet distributionSet = rollout.getDistributionSet();
|
final DistributionSet distributionSet = rollout.getDistributionSet();
|
||||||
proxyRollout.setDistributionSetNameVersion(HawkbitCommonUtil.getFormattedNameVersion(
|
proxyRollout.setDistributionSetNameVersion(
|
||||||
distributionSet.getName(), distributionSet.getVersion()));
|
HawkbitCommonUtil.getFormattedNameVersion(distributionSet.getName(), distributionSet.getVersion()));
|
||||||
proxyRollout.setDistributionSet(distributionSet);
|
proxyRollout.setDistributionSet(distributionSet);
|
||||||
proxyRollout.setNumberOfGroups(Long.valueOf(rollout.getRolloutGroups().size()));
|
proxyRollout.setNumberOfGroups(Long.valueOf(rollout.getRolloutGroups().size()));
|
||||||
proxyRollout.setCreatedDate(SPDateTimeUtil.getFormattedDate(rollout.getCreatedAt()));
|
proxyRollout.setCreatedDate(SPDateTimeUtil.getFormattedDate(rollout.getCreatedAt()));
|
||||||
@@ -130,6 +131,7 @@ public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
|
|||||||
proxyRollout.setForcedTime(rollout.getForcedTime());
|
proxyRollout.setForcedTime(rollout.getForcedTime());
|
||||||
proxyRollout.setId(rollout.getId());
|
proxyRollout.setId(rollout.getId());
|
||||||
proxyRollout.setStatus(rollout.getStatus());
|
proxyRollout.setStatus(rollout.getStatus());
|
||||||
|
proxyRollout.setRolloutRendererData(new RolloutRendererData(rollout.getName(), rollout.getStatus().toString()));
|
||||||
|
|
||||||
final TotalTargetCountStatus totalTargetCountActionStatus = rollout.getTotalTargetCountStatus();
|
final TotalTargetCountStatus totalTargetCountActionStatus = rollout.getTotalTargetCountStatus();
|
||||||
proxyRollout.setTotalTargetCountStatus(totalTargetCountActionStatus);
|
proxyRollout.setTotalTargetCountStatus(totalTargetCountActionStatus);
|
||||||
@@ -148,7 +150,8 @@ public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
|
|||||||
* .util.List, java.util.List, java.util.List)
|
* .util.List, java.util.List, java.util.List)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void saveBeans(final List<ProxyRollout> arg0, final List<ProxyRollout> arg1, final List<ProxyRollout> arg2) {
|
protected void saveBeans(final List<ProxyRollout> arg0, final List<ProxyRollout> arg1,
|
||||||
|
final List<ProxyRollout> arg2) {
|
||||||
/**
|
/**
|
||||||
* CRUD operations on Target will be done through repository methods
|
* CRUD operations on Target will be done through repository methods
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -22,9 +22,10 @@ import org.eclipse.hawkbit.repository.model.Rollout;
|
|||||||
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
|
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||||
import org.eclipse.hawkbit.ui.common.grid.AbstractGrid;
|
import org.eclipse.hawkbit.ui.common.grid.AbstractGrid;
|
||||||
|
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
|
||||||
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlButtonRenderer;
|
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlButtonRenderer;
|
||||||
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlLabelRenderer;
|
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlLabelRenderer;
|
||||||
import org.eclipse.hawkbit.ui.customrenderers.renderers.LinkRenderer;
|
import org.eclipse.hawkbit.ui.customrenderers.renderers.RolloutRenderer;
|
||||||
import org.eclipse.hawkbit.ui.rollout.DistributionBarHelper;
|
import org.eclipse.hawkbit.ui.rollout.DistributionBarHelper;
|
||||||
import org.eclipse.hawkbit.ui.rollout.StatusFontIcon;
|
import org.eclipse.hawkbit.ui.rollout.StatusFontIcon;
|
||||||
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
||||||
@@ -77,6 +78,7 @@ public class RolloutListGrid extends AbstractGrid {
|
|||||||
|
|
||||||
private static final String START_OPTION = "Start";
|
private static final String START_OPTION = "Start";
|
||||||
|
|
||||||
|
private static final String ROLLOUT_RENDERER_DATA = "rolloutRendererData";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private transient RolloutManagement rolloutManagement;
|
private transient RolloutManagement rolloutManagement;
|
||||||
@@ -95,7 +97,10 @@ public class RolloutListGrid extends AbstractGrid {
|
|||||||
|
|
||||||
private transient Map<RolloutStatus, StatusFontIcon> statusIconMap = new EnumMap<>(RolloutStatus.class);
|
private transient Map<RolloutStatus, StatusFontIcon> statusIconMap = new EnumMap<>(RolloutStatus.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the RolloutEvent to refresh Grid.
|
||||||
|
*
|
||||||
|
*/
|
||||||
@EventBusListenerMethod(scope = EventScope.SESSION)
|
@EventBusListenerMethod(scope = EventScope.SESSION)
|
||||||
void onEvent(final RolloutEvent event) {
|
void onEvent(final RolloutEvent event) {
|
||||||
switch (event) {
|
switch (event) {
|
||||||
@@ -132,10 +137,16 @@ public class RolloutListGrid extends AbstractGrid {
|
|||||||
item.getItemProperty(SPUILabelDefinitions.VAR_STATUS).setValue(rollout.getStatus());
|
item.getItemProperty(SPUILabelDefinitions.VAR_STATUS).setValue(rollout.getStatus());
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setValue(totalTargetCountStatus);
|
item.getItemProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setValue(totalTargetCountStatus);
|
||||||
final Long groupCount = (Long) item.getItemProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).getValue();
|
final Long groupCount = (Long) item.getItemProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).getValue();
|
||||||
if (rollout.getRolloutGroups() != null && groupCount != rollout.getRolloutGroups().size()) {
|
final int groupsCreated = rollout.getRolloutGroupsCreated();
|
||||||
|
if (groupsCreated != 0) {
|
||||||
|
item.getItemProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).setValue(Long.valueOf(groupsCreated));
|
||||||
|
} else if (rollout.getRolloutGroups() != null && groupCount != rollout.getRolloutGroups().size()) {
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS)
|
item.getItemProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS)
|
||||||
.setValue(Long.valueOf(rollout.getRolloutGroups().size()));
|
.setValue(Long.valueOf(rollout.getRolloutGroups().size()));
|
||||||
}
|
}
|
||||||
|
item.getItemProperty(ROLLOUT_RENDERER_DATA)
|
||||||
|
.setValue(new RolloutRendererData(rollout.getName(), rollout.getStatus().toString()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -149,6 +160,7 @@ public class RolloutListGrid extends AbstractGrid {
|
|||||||
protected void addContainerProperties() {
|
protected void addContainerProperties() {
|
||||||
final LazyQueryContainer rolloutGridContainer = (LazyQueryContainer) getContainerDataSource();
|
final LazyQueryContainer rolloutGridContainer = (LazyQueryContainer) getContainerDataSource();
|
||||||
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, "", false, false);
|
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, "", false, false);
|
||||||
|
rolloutGridContainer.addContainerProperty(ROLLOUT_RENDERER_DATA, RolloutRendererData.class, null, false, false);
|
||||||
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, null, false, false);
|
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, null, false, false);
|
||||||
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_STATUS, RolloutStatus.class, null, false,
|
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_STATUS, RolloutStatus.class, null, false,
|
||||||
false);
|
false);
|
||||||
@@ -163,7 +175,7 @@ public class RolloutListGrid extends AbstractGrid {
|
|||||||
false);
|
false);
|
||||||
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_BY, String.class, null, false,
|
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_BY, String.class, null, false,
|
||||||
false);
|
false);
|
||||||
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS, Integer.class, 0, false,
|
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS, Long.class, 0, false,
|
||||||
false);
|
false);
|
||||||
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS, String.class, "0", false,
|
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS, String.class, "0", false,
|
||||||
false);
|
false);
|
||||||
@@ -177,8 +189,9 @@ public class RolloutListGrid extends AbstractGrid {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setColumnExpandRatio() {
|
protected void setColumnExpandRatio() {
|
||||||
getColumn(SPUILabelDefinitions.VAR_NAME).setMinimumWidth(40);
|
|
||||||
getColumn(SPUILabelDefinitions.VAR_NAME).setMaximumWidth(150);
|
getColumn(ROLLOUT_RENDERER_DATA).setMinimumWidth(40);
|
||||||
|
getColumn(ROLLOUT_RENDERER_DATA).setMaximumWidth(150);
|
||||||
|
|
||||||
getColumn(SPUILabelDefinitions.VAR_DIST_NAME_VERSION).setMinimumWidth(40);
|
getColumn(SPUILabelDefinitions.VAR_DIST_NAME_VERSION).setMinimumWidth(40);
|
||||||
getColumn(SPUILabelDefinitions.VAR_DIST_NAME_VERSION).setMaximumWidth(150);
|
getColumn(SPUILabelDefinitions.VAR_DIST_NAME_VERSION).setMaximumWidth(150);
|
||||||
@@ -202,7 +215,7 @@ public class RolloutListGrid extends AbstractGrid {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setColumnHeaderNames() {
|
protected void setColumnHeaderNames() {
|
||||||
getColumn(SPUILabelDefinitions.VAR_NAME).setHeaderCaption(i18n.get("header.name"));
|
getColumn(ROLLOUT_RENDERER_DATA).setHeaderCaption(i18n.get("header.name"));
|
||||||
getColumn(SPUILabelDefinitions.VAR_DIST_NAME_VERSION).setHeaderCaption(i18n.get("header.distributionset"));
|
getColumn(SPUILabelDefinitions.VAR_DIST_NAME_VERSION).setHeaderCaption(i18n.get("header.distributionset"));
|
||||||
getColumn(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).setHeaderCaption(i18n.get("header.numberofgroups"));
|
getColumn(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).setHeaderCaption(i18n.get("header.numberofgroups"));
|
||||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setHeaderCaption(i18n.get("header.total.targets"));
|
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setHeaderCaption(i18n.get("header.total.targets"));
|
||||||
@@ -225,7 +238,7 @@ public class RolloutListGrid extends AbstractGrid {
|
|||||||
@Override
|
@Override
|
||||||
protected void setColumnProperties() {
|
protected void setColumnProperties() {
|
||||||
final List<Object> columnList = new ArrayList<>();
|
final List<Object> columnList = new ArrayList<>();
|
||||||
columnList.add(SPUILabelDefinitions.VAR_NAME);
|
columnList.add(ROLLOUT_RENDERER_DATA);
|
||||||
columnList.add(SPUILabelDefinitions.VAR_DIST_NAME_VERSION);
|
columnList.add(SPUILabelDefinitions.VAR_DIST_NAME_VERSION);
|
||||||
columnList.add(SPUILabelDefinitions.VAR_STATUS);
|
columnList.add(SPUILabelDefinitions.VAR_STATUS);
|
||||||
columnList.add(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS);
|
columnList.add(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS);
|
||||||
@@ -245,6 +258,7 @@ public class RolloutListGrid extends AbstractGrid {
|
|||||||
@Override
|
@Override
|
||||||
protected void setHiddenColumns() {
|
protected void setHiddenColumns() {
|
||||||
final List<Object> columnsToBeHidden = new ArrayList<>();
|
final List<Object> columnsToBeHidden = new ArrayList<>();
|
||||||
|
columnsToBeHidden.add(SPUILabelDefinitions.VAR_NAME);
|
||||||
columnsToBeHidden.add(SPUILabelDefinitions.VAR_CREATED_DATE);
|
columnsToBeHidden.add(SPUILabelDefinitions.VAR_CREATED_DATE);
|
||||||
columnsToBeHidden.add(SPUILabelDefinitions.VAR_CREATED_USER);
|
columnsToBeHidden.add(SPUILabelDefinitions.VAR_CREATED_USER);
|
||||||
columnsToBeHidden.add(SPUILabelDefinitions.VAR_MODIFIED_DATE);
|
columnsToBeHidden.add(SPUILabelDefinitions.VAR_MODIFIED_DATE);
|
||||||
@@ -263,6 +277,8 @@ public class RolloutListGrid extends AbstractGrid {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addColumnRenderes() {
|
protected void addColumnRenderes() {
|
||||||
|
getColumn(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS).setRenderer(new HtmlRenderer(),
|
||||||
|
new TotalTargetGroupsConverter());
|
||||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setRenderer(new HtmlRenderer(),
|
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setRenderer(new HtmlRenderer(),
|
||||||
new TotalTargetCountStatusConverter());
|
new TotalTargetCountStatusConverter());
|
||||||
|
|
||||||
@@ -270,7 +286,11 @@ public class RolloutListGrid extends AbstractGrid {
|
|||||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setRenderer(new HtmlLabelRenderer(), new RolloutStatusConverter());
|
getColumn(SPUILabelDefinitions.VAR_STATUS).setRenderer(new HtmlLabelRenderer(), new RolloutStatusConverter());
|
||||||
|
|
||||||
getColumn(SPUILabelDefinitions.ACTION).setRenderer(new HtmlButtonRenderer(event -> onClickOfActionBtn(event)));
|
getColumn(SPUILabelDefinitions.ACTION).setRenderer(new HtmlButtonRenderer(event -> onClickOfActionBtn(event)));
|
||||||
getColumn(SPUILabelDefinitions.VAR_NAME).setRenderer(new LinkRenderer(event -> onClickOfRolloutName(event)));
|
|
||||||
|
final RolloutRenderer customObjectRenderer = new RolloutRenderer(RolloutRendererData.class);
|
||||||
|
customObjectRenderer.addClickListener(event -> onClickOfRolloutName(event));
|
||||||
|
getColumn(ROLLOUT_RENDERER_DATA).setRenderer(customObjectRenderer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createRolloutStatusToFontMap() {
|
private void createRolloutStatusToFontMap() {
|
||||||
@@ -403,6 +423,9 @@ public class RolloutListGrid extends AbstractGrid {
|
|||||||
((LazyQueryContainer) getContainerDataSource()).refresh();
|
((LazyQueryContainer) getContainerDataSource()).refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generator to generate fontIcon by String.
|
||||||
|
*/
|
||||||
public final class FontIconGenerator extends PropertyValueGenerator<String> {
|
public final class FontIconGenerator extends PropertyValueGenerator<String> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 2544026030795375748L;
|
private static final long serialVersionUID = 2544026030795375748L;
|
||||||
@@ -428,8 +451,8 @@ public class RolloutListGrid extends AbstractGrid {
|
|||||||
return cell.getProperty().getValue().toString().toLowerCase();
|
return cell.getProperty().getValue().toString().toLowerCase();
|
||||||
} else if (SPUILabelDefinitions.ACTION.equals(cell.getPropertyId())) {
|
} else if (SPUILabelDefinitions.ACTION.equals(cell.getPropertyId())) {
|
||||||
return SPUILabelDefinitions.ACTION.toLowerCase();
|
return SPUILabelDefinitions.ACTION.toLowerCase();
|
||||||
} else if (SPUILabelDefinitions.VAR_NAME.equals(cell.getPropertyId())) {
|
} else if (ROLLOUT_RENDERER_DATA.equals(cell.getPropertyId())) {
|
||||||
return cell.getProperty().getValue().toString();
|
return ((RolloutRendererData) cell.getProperty().getValue()).getName();
|
||||||
} else if (SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS.equals(cell.getPropertyId())) {
|
} else if (SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS.equals(cell.getPropertyId())) {
|
||||||
return DistributionBarHelper
|
return DistributionBarHelper
|
||||||
.getTooltip(((TotalTargetCountStatus) cell.getValue()).getStatusTotalCountMap());
|
.getTooltip(((TotalTargetCountStatus) cell.getValue()).getStatusTotalCountMap());
|
||||||
@@ -568,4 +591,39 @@ public class RolloutListGrid extends AbstractGrid {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converter to convert 0 to empty, if total target groups is zero.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class TotalTargetGroupsConverter implements Converter<String, Long> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 6589305227035220369L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long convertToModel(final String value, final Class<? extends Long> targetType, final Locale locale)
|
||||||
|
throws com.vaadin.data.util.converter.Converter.ConversionException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String convertToPresentation(final Long value, final Class<? extends String> targetType,
|
||||||
|
final Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException {
|
||||||
|
if (value == 0) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return value.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<Long> getModelType() {
|
||||||
|
return Long.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<String> getPresentationType() {
|
||||||
|
return String.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,10 @@
|
|||||||
package org.eclipse.hawkbit.ui.rollout.rolloutgroup;
|
package org.eclipse.hawkbit.ui.rollout.rolloutgroup;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||||
|
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Proxy rollout group with suctome properties.
|
* Proxy rollout group with renderer properties.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ProxyRolloutGroup extends RolloutGroup {
|
public class ProxyRolloutGroup extends RolloutGroup {
|
||||||
@@ -40,6 +41,16 @@ public class ProxyRolloutGroup extends RolloutGroup {
|
|||||||
|
|
||||||
private String totalTargetsCount;
|
private String totalTargetsCount;
|
||||||
|
|
||||||
|
private RolloutRendererData rolloutRendererData;
|
||||||
|
|
||||||
|
public RolloutRendererData getRolloutRendererData() {
|
||||||
|
return rolloutRendererData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRolloutRendererData(RolloutRendererData rendererData) {
|
||||||
|
this.rolloutRendererData = rendererData;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the createdDate
|
* @return the createdDate
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import java.util.Map;
|
|||||||
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
||||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||||
|
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
|
||||||
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
import org.eclipse.hawkbit.ui.rollout.state.RolloutUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
|
||||||
@@ -122,6 +123,8 @@ public class RolloutGroupBeanQuery extends AbstractBeanQuery<ProxyRolloutGroup>
|
|||||||
proxyRolloutGroup.setSuccessConditionExp(rolloutGroup.getSuccessConditionExp());
|
proxyRolloutGroup.setSuccessConditionExp(rolloutGroup.getSuccessConditionExp());
|
||||||
proxyRolloutGroup.setFinishedPercentage(calculateFinishedPercentage(rolloutGroup));
|
proxyRolloutGroup.setFinishedPercentage(calculateFinishedPercentage(rolloutGroup));
|
||||||
|
|
||||||
|
proxyRolloutGroup.setRolloutRendererData(new RolloutRendererData(rolloutGroup.getName(), null));
|
||||||
|
|
||||||
proxyRolloutGroup.setTotalTargetsCount(String.valueOf(rolloutGroup.getTotalTargets()));
|
proxyRolloutGroup.setTotalTargetsCount(String.valueOf(rolloutGroup.getTotalTargets()));
|
||||||
proxyRolloutGroup.setTotalTargetCountStatus(rolloutGroup.getTotalTargetCountStatus());
|
proxyRolloutGroup.setTotalTargetCountStatus(rolloutGroup.getTotalTargetCountStatus());
|
||||||
|
|
||||||
|
|||||||
@@ -17,13 +17,15 @@ import java.util.Map;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.eventbus.event.RolloutGroupChangeEvent;
|
import org.eclipse.hawkbit.eventbus.event.RolloutGroupChangeEvent;
|
||||||
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
||||||
|
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||||
import org.eclipse.hawkbit.ui.common.grid.AbstractGrid;
|
import org.eclipse.hawkbit.ui.common.grid.AbstractGrid;
|
||||||
|
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
|
||||||
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlLabelRenderer;
|
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlLabelRenderer;
|
||||||
import org.eclipse.hawkbit.ui.customrenderers.renderers.LinkRenderer;
|
import org.eclipse.hawkbit.ui.customrenderers.renderers.RolloutRenderer;
|
||||||
import org.eclipse.hawkbit.ui.rollout.DistributionBarHelper;
|
import org.eclipse.hawkbit.ui.rollout.DistributionBarHelper;
|
||||||
import org.eclipse.hawkbit.ui.rollout.StatusFontIcon;
|
import org.eclipse.hawkbit.ui.rollout.StatusFontIcon;
|
||||||
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
import org.eclipse.hawkbit.ui.rollout.event.RolloutEvent;
|
||||||
@@ -59,9 +61,14 @@ import com.vaadin.ui.renderers.HtmlRenderer;
|
|||||||
public class RolloutGroupListGrid extends AbstractGrid {
|
public class RolloutGroupListGrid extends AbstractGrid {
|
||||||
private static final long serialVersionUID = 4060904914954370524L;
|
private static final long serialVersionUID = 4060904914954370524L;
|
||||||
|
|
||||||
|
private static final String ROLLOUT_RENDERER_DATA = "rolloutRendererData";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private transient RolloutGroupManagement rolloutGroupManagement;
|
private transient RolloutGroupManagement rolloutGroupManagement;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient RolloutManagement rolloutManagement;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private transient RolloutUIState rolloutUIState;
|
private transient RolloutUIState rolloutUIState;
|
||||||
|
|
||||||
@@ -103,6 +110,13 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
|||||||
item.getItemProperty(SPUILabelDefinitions.VAR_STATUS).setValue(rolloutGroup.getStatus());
|
item.getItemProperty(SPUILabelDefinitions.VAR_STATUS).setValue(rolloutGroup.getStatus());
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS)
|
item.getItemProperty(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS)
|
||||||
.setValue(rolloutGroup.getTotalTargetCountStatus());
|
.setValue(rolloutGroup.getTotalTargetCountStatus());
|
||||||
|
item.getItemProperty(SPUILabelDefinitions.ROLLOUT_GROUP_INSTALLED_PERCENTAGE)
|
||||||
|
.setValue(calculateFinishedPercentage(rolloutGroup));
|
||||||
|
}
|
||||||
|
|
||||||
|
private String calculateFinishedPercentage(final RolloutGroup rolloutGroup) {
|
||||||
|
return HawkbitCommonUtil.formattingFinishedPercentage(rolloutGroup,
|
||||||
|
rolloutManagement.getFinishedPercentForRunningGroup(rolloutGroup.getRollout().getId(), rolloutGroup));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -116,6 +130,9 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
|||||||
protected void addContainerProperties() {
|
protected void addContainerProperties() {
|
||||||
final LazyQueryContainer rolloutGroupGridContainer = (LazyQueryContainer) getContainerDataSource();
|
final LazyQueryContainer rolloutGroupGridContainer = (LazyQueryContainer) getContainerDataSource();
|
||||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, "", false, false);
|
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, "", false, false);
|
||||||
|
|
||||||
|
rolloutGroupGridContainer.addContainerProperty(ROLLOUT_RENDERER_DATA, RolloutRendererData.class, null, false,
|
||||||
|
false);
|
||||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, null, false, false);
|
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, null, false, false);
|
||||||
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_STATUS, RolloutGroupStatus.class, null,
|
rolloutGroupGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_STATUS, RolloutGroupStatus.class, null,
|
||||||
false, false);
|
false, false);
|
||||||
@@ -145,8 +162,8 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setColumnExpandRatio() {
|
protected void setColumnExpandRatio() {
|
||||||
getColumn(SPUILabelDefinitions.VAR_NAME).setMinimumWidth(40);
|
getColumn(ROLLOUT_RENDERER_DATA).setMinimumWidth(40);
|
||||||
getColumn(SPUILabelDefinitions.VAR_NAME).setMaximumWidth(200);
|
getColumn(ROLLOUT_RENDERER_DATA).setMaximumWidth(200);
|
||||||
|
|
||||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setMinimumWidth(40);
|
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setMinimumWidth(40);
|
||||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setMaximumWidth(100);
|
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS).setMaximumWidth(100);
|
||||||
@@ -170,7 +187,7 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setColumnHeaderNames() {
|
protected void setColumnHeaderNames() {
|
||||||
getColumn(SPUILabelDefinitions.VAR_NAME).setHeaderCaption(i18n.get("header.name"));
|
getColumn(ROLLOUT_RENDERER_DATA).setHeaderCaption(i18n.get("header.name"));
|
||||||
getColumn(SPUILabelDefinitions.VAR_STATUS).setHeaderCaption(i18n.get("header.status"));
|
getColumn(SPUILabelDefinitions.VAR_STATUS).setHeaderCaption(i18n.get("header.status"));
|
||||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS)
|
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS)
|
||||||
.setHeaderCaption(i18n.get("header.detail.status"));
|
.setHeaderCaption(i18n.get("header.detail.status"));
|
||||||
@@ -196,7 +213,7 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
|||||||
@Override
|
@Override
|
||||||
protected void setColumnProperties() {
|
protected void setColumnProperties() {
|
||||||
final List<Object> columnList = new ArrayList<>();
|
final List<Object> columnList = new ArrayList<>();
|
||||||
columnList.add(SPUILabelDefinitions.VAR_NAME);
|
columnList.add(ROLLOUT_RENDERER_DATA);
|
||||||
columnList.add(SPUILabelDefinitions.VAR_STATUS);
|
columnList.add(SPUILabelDefinitions.VAR_STATUS);
|
||||||
columnList.add(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS);
|
columnList.add(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS);
|
||||||
columnList.add(SPUILabelDefinitions.VAR_TOTAL_TARGETS);
|
columnList.add(SPUILabelDefinitions.VAR_TOTAL_TARGETS);
|
||||||
@@ -221,14 +238,15 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
|||||||
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setRenderer(new HtmlRenderer(),
|
getColumn(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS).setRenderer(new HtmlRenderer(),
|
||||||
new TotalTargetCountStatusConverter());
|
new TotalTargetCountStatusConverter());
|
||||||
if (permissionChecker.hasRolloutTargetsReadPermission()) {
|
if (permissionChecker.hasRolloutTargetsReadPermission()) {
|
||||||
getColumn(SPUILabelDefinitions.VAR_NAME)
|
getColumn(ROLLOUT_RENDERER_DATA)
|
||||||
.setRenderer(new LinkRenderer(event -> onClickOfRolloutGroupName(event)));
|
.setRenderer(new RolloutRenderer(event -> onClickOfRolloutGroupName(event)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setHiddenColumns() {
|
protected void setHiddenColumns() {
|
||||||
final List<Object> columnsToBeHidden = new ArrayList<>();
|
final List<Object> columnsToBeHidden = new ArrayList<>();
|
||||||
|
columnsToBeHidden.add(SPUILabelDefinitions.VAR_NAME);
|
||||||
columnsToBeHidden.add(SPUILabelDefinitions.VAR_CREATED_DATE);
|
columnsToBeHidden.add(SPUILabelDefinitions.VAR_CREATED_DATE);
|
||||||
columnsToBeHidden.add(SPUILabelDefinitions.VAR_CREATED_USER);
|
columnsToBeHidden.add(SPUILabelDefinitions.VAR_CREATED_USER);
|
||||||
columnsToBeHidden.add(SPUILabelDefinitions.VAR_MODIFIED_DATE);
|
columnsToBeHidden.add(SPUILabelDefinitions.VAR_MODIFIED_DATE);
|
||||||
@@ -268,8 +286,8 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
|||||||
return cell.getProperty().getValue().toString().toLowerCase();
|
return cell.getProperty().getValue().toString().toLowerCase();
|
||||||
} else if (SPUILabelDefinitions.ACTION.equals(cell.getPropertyId())) {
|
} else if (SPUILabelDefinitions.ACTION.equals(cell.getPropertyId())) {
|
||||||
return SPUILabelDefinitions.ACTION.toLowerCase();
|
return SPUILabelDefinitions.ACTION.toLowerCase();
|
||||||
} else if (SPUILabelDefinitions.VAR_NAME.equals(cell.getPropertyId())) {
|
} else if (ROLLOUT_RENDERER_DATA.equals(cell.getPropertyId())) {
|
||||||
return cell.getProperty().getValue().toString();
|
return ((RolloutRendererData) cell.getProperty().getValue()).getName();
|
||||||
} else if (SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS.equals(cell.getPropertyId())) {
|
} else if (SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS.equals(cell.getPropertyId())) {
|
||||||
return DistributionBarHelper
|
return DistributionBarHelper
|
||||||
.getTooltip(((TotalTargetCountStatus) cell.getValue()).getStatusTotalCountMap());
|
.getTooltip(((TotalTargetCountStatus) cell.getValue()).getStatusTotalCountMap());
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.ui.tenantconfiguration;
|
|||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
|
import org.eclipse.hawkbit.ui.tenantconfiguration.authentication.AnonymousDownloadAuthenticationConfigurationItem;
|
||||||
import org.eclipse.hawkbit.ui.tenantconfiguration.authentication.AuthenticationConfigurationItem;
|
import org.eclipse.hawkbit.ui.tenantconfiguration.authentication.AuthenticationConfigurationItem;
|
||||||
import org.eclipse.hawkbit.ui.tenantconfiguration.authentication.CertificateAuthenticationConfigurationItem;
|
import org.eclipse.hawkbit.ui.tenantconfiguration.authentication.CertificateAuthenticationConfigurationItem;
|
||||||
import org.eclipse.hawkbit.ui.tenantconfiguration.authentication.GatewaySecurityTokenAuthenticationConfigurationItem;
|
import org.eclipse.hawkbit.ui.tenantconfiguration.authentication.GatewaySecurityTokenAuthenticationConfigurationItem;
|
||||||
@@ -52,12 +53,17 @@ public class AuthenticationConfigurationView extends BaseConfigurationView
|
|||||||
@Autowired
|
@Autowired
|
||||||
private GatewaySecurityTokenAuthenticationConfigurationItem gatewaySecurityTokenAuthenticationConfigurationItem;
|
private GatewaySecurityTokenAuthenticationConfigurationItem gatewaySecurityTokenAuthenticationConfigurationItem;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AnonymousDownloadAuthenticationConfigurationItem anonymousDownloadAuthenticationConfigurationItem;
|
||||||
|
|
||||||
private CheckBox gatewaySecTokenCheckBox;
|
private CheckBox gatewaySecTokenCheckBox;
|
||||||
|
|
||||||
private CheckBox targetSecTokenCheckBox;
|
private CheckBox targetSecTokenCheckBox;
|
||||||
|
|
||||||
private CheckBox certificateAuthCheckbox;
|
private CheckBox certificateAuthCheckbox;
|
||||||
|
|
||||||
|
private CheckBox downloadAnonymousCheckBox;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize Authentication Configuration layout.
|
* Initialize Authentication Configuration layout.
|
||||||
*/
|
*/
|
||||||
@@ -77,7 +83,7 @@ public class AuthenticationConfigurationView extends BaseConfigurationView
|
|||||||
headerDisSetType.addStyleName("config-panel-header");
|
headerDisSetType.addStyleName("config-panel-header");
|
||||||
vLayout.addComponent(headerDisSetType);
|
vLayout.addComponent(headerDisSetType);
|
||||||
|
|
||||||
final GridLayout gridLayout = new GridLayout(2, 3);
|
final GridLayout gridLayout = new GridLayout(2, 4);
|
||||||
gridLayout.setSpacing(true);
|
gridLayout.setSpacing(true);
|
||||||
gridLayout.setImmediate(true);
|
gridLayout.setImmediate(true);
|
||||||
gridLayout.setColumnExpandRatio(1, 1.0F);
|
gridLayout.setColumnExpandRatio(1, 1.0F);
|
||||||
@@ -105,6 +111,14 @@ public class AuthenticationConfigurationView extends BaseConfigurationView
|
|||||||
gridLayout.addComponent(gatewaySecTokenCheckBox, 0, 2);
|
gridLayout.addComponent(gatewaySecTokenCheckBox, 0, 2);
|
||||||
gridLayout.addComponent(gatewaySecurityTokenAuthenticationConfigurationItem, 1, 2);
|
gridLayout.addComponent(gatewaySecurityTokenAuthenticationConfigurationItem, 1, 2);
|
||||||
|
|
||||||
|
downloadAnonymousCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
|
||||||
|
downloadAnonymousCheckBox.setId("downloadanonymouscheckbox");
|
||||||
|
downloadAnonymousCheckBox.setValue(targetSecurityTokenAuthenticationConfigurationItem.isConfigEnabled());
|
||||||
|
downloadAnonymousCheckBox.addValueChangeListener(this);
|
||||||
|
anonymousDownloadAuthenticationConfigurationItem.addChangeListener(this);
|
||||||
|
gridLayout.addComponent(downloadAnonymousCheckBox, 0, 3);
|
||||||
|
gridLayout.addComponent(anonymousDownloadAuthenticationConfigurationItem, 1, 3);
|
||||||
|
|
||||||
vLayout.addComponent(gridLayout);
|
vLayout.addComponent(gridLayout);
|
||||||
rootPanel.setContent(vLayout);
|
rootPanel.setContent(vLayout);
|
||||||
setCompositionRoot(rootPanel);
|
setCompositionRoot(rootPanel);
|
||||||
@@ -115,6 +129,7 @@ public class AuthenticationConfigurationView extends BaseConfigurationView
|
|||||||
certificateAuthenticationConfigurationItem.save();
|
certificateAuthenticationConfigurationItem.save();
|
||||||
targetSecurityTokenAuthenticationConfigurationItem.save();
|
targetSecurityTokenAuthenticationConfigurationItem.save();
|
||||||
gatewaySecurityTokenAuthenticationConfigurationItem.save();
|
gatewaySecurityTokenAuthenticationConfigurationItem.save();
|
||||||
|
anonymousDownloadAuthenticationConfigurationItem.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -122,9 +137,11 @@ public class AuthenticationConfigurationView extends BaseConfigurationView
|
|||||||
certificateAuthenticationConfigurationItem.undo();
|
certificateAuthenticationConfigurationItem.undo();
|
||||||
targetSecurityTokenAuthenticationConfigurationItem.undo();
|
targetSecurityTokenAuthenticationConfigurationItem.undo();
|
||||||
gatewaySecurityTokenAuthenticationConfigurationItem.undo();
|
gatewaySecurityTokenAuthenticationConfigurationItem.undo();
|
||||||
|
anonymousDownloadAuthenticationConfigurationItem.undo();
|
||||||
certificateAuthCheckbox.setValue(certificateAuthenticationConfigurationItem.isConfigEnabled());
|
certificateAuthCheckbox.setValue(certificateAuthenticationConfigurationItem.isConfigEnabled());
|
||||||
targetSecTokenCheckBox.setValue(targetSecurityTokenAuthenticationConfigurationItem.isConfigEnabled());
|
targetSecTokenCheckBox.setValue(targetSecurityTokenAuthenticationConfigurationItem.isConfigEnabled());
|
||||||
gatewaySecTokenCheckBox.setValue(gatewaySecurityTokenAuthenticationConfigurationItem.isConfigEnabled());
|
gatewaySecTokenCheckBox.setValue(gatewaySecurityTokenAuthenticationConfigurationItem.isConfigEnabled());
|
||||||
|
downloadAnonymousCheckBox.setValue(anonymousDownloadAuthenticationConfigurationItem.isConfigEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -150,6 +167,8 @@ public class AuthenticationConfigurationView extends BaseConfigurationView
|
|||||||
configurationItem = targetSecurityTokenAuthenticationConfigurationItem;
|
configurationItem = targetSecurityTokenAuthenticationConfigurationItem;
|
||||||
} else if (checkBox == certificateAuthCheckbox) {
|
} else if (checkBox == certificateAuthCheckbox) {
|
||||||
configurationItem = certificateAuthenticationConfigurationItem;
|
configurationItem = certificateAuthenticationConfigurationItem;
|
||||||
|
} else if (checkBox == downloadAnonymousCheckBox) {
|
||||||
|
configurationItem = anonymousDownloadAuthenticationConfigurationItem;
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,119 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.tenantconfiguration;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.model.TenantConfigurationValue;
|
|
||||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
|
|
||||||
import com.vaadin.spring.annotation.SpringComponent;
|
|
||||||
import com.vaadin.spring.annotation.ViewScope;
|
|
||||||
import com.vaadin.ui.Alignment;
|
|
||||||
import com.vaadin.ui.CheckBox;
|
|
||||||
import com.vaadin.ui.GridLayout;
|
|
||||||
import com.vaadin.ui.Label;
|
|
||||||
import com.vaadin.ui.Panel;
|
|
||||||
import com.vaadin.ui.VerticalLayout;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* View to enable anonymous download.
|
|
||||||
*/
|
|
||||||
@SpringComponent
|
|
||||||
@ViewScope
|
|
||||||
public class DownloadAnonymousConfigurationView extends BaseConfigurationView
|
|
||||||
implements ConfigurationItem.ConfigurationItemChangeListener {
|
|
||||||
|
|
||||||
private static final String DIST_CHECKBOX_STYLE = "dist-checkbox-style";
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private I18N i18n;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private transient TenantConfigurationManagement tenantConfigurationManagement;
|
|
||||||
|
|
||||||
boolean anonymousDownloadEnabled;
|
|
||||||
|
|
||||||
private CheckBox downloadAnonymousCheckBox;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize Default Download Anonymous layout.
|
|
||||||
*/
|
|
||||||
@PostConstruct
|
|
||||||
public void init() {
|
|
||||||
|
|
||||||
final TenantConfigurationValue<Boolean> value = tenantConfigurationManagement
|
|
||||||
.getConfigurationValue(TenantConfigurationKey.ANONYMOUS_DOWNLOAD_MODE_ENABLED, Boolean.class);
|
|
||||||
anonymousDownloadEnabled = value.getValue();
|
|
||||||
|
|
||||||
final Panel rootPanel = new Panel();
|
|
||||||
rootPanel.setSizeFull();
|
|
||||||
rootPanel.addStyleName("config-panel");
|
|
||||||
|
|
||||||
final VerticalLayout vLayout = new VerticalLayout();
|
|
||||||
vLayout.setMargin(true);
|
|
||||||
vLayout.setSizeFull();
|
|
||||||
|
|
||||||
final Label headerDisSetType = new Label(i18n.get("enonymous.download.title"));
|
|
||||||
headerDisSetType.addStyleName("config-panel-header");
|
|
||||||
vLayout.addComponent(headerDisSetType);
|
|
||||||
|
|
||||||
final GridLayout gridLayout = new GridLayout(2, 1);
|
|
||||||
gridLayout.setSpacing(true);
|
|
||||||
gridLayout.setImmediate(true);
|
|
||||||
gridLayout.setColumnExpandRatio(1, 1.0F);
|
|
||||||
gridLayout.setSizeFull();
|
|
||||||
|
|
||||||
downloadAnonymousCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
|
|
||||||
downloadAnonymousCheckBox.setValue(anonymousDownloadEnabled);
|
|
||||||
downloadAnonymousCheckBox.addValueChangeListener(event -> configurationHasChanged());
|
|
||||||
downloadAnonymousCheckBox.setId(SPUIComponetIdProvider.SYSTEM_CONFIGURATION_ANONYMOUS_DOWNLOAD_CHECKBOX);
|
|
||||||
|
|
||||||
gridLayout.addComponent(downloadAnonymousCheckBox);
|
|
||||||
|
|
||||||
final Label configurationLabel = SPUIComponentProvider.getLabel(i18n.get("enonymous.download.label"),
|
|
||||||
SPUILabelDefinitions.SP_LABEL_SIMPLE);
|
|
||||||
gridLayout.addComponent(configurationLabel);
|
|
||||||
gridLayout.setComponentAlignment(configurationLabel, Alignment.MIDDLE_LEFT);
|
|
||||||
|
|
||||||
vLayout.addComponent(gridLayout);
|
|
||||||
|
|
||||||
rootPanel.setContent(vLayout);
|
|
||||||
setCompositionRoot(rootPanel);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void configurationHasChanged() {
|
|
||||||
anonymousDownloadEnabled = downloadAnonymousCheckBox.getValue();
|
|
||||||
notifyConfigurationChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void save() {
|
|
||||||
tenantConfigurationManagement.addOrUpdateConfiguration(TenantConfigurationKey.ANONYMOUS_DOWNLOAD_MODE_ENABLED,
|
|
||||||
downloadAnonymousCheckBox.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void undo() {
|
|
||||||
final TenantConfigurationValue<Boolean> value = tenantConfigurationManagement
|
|
||||||
.getConfigurationValue(TenantConfigurationKey.ANONYMOUS_DOWNLOAD_MODE_ENABLED, Boolean.class);
|
|
||||||
anonymousDownloadEnabled = value.getValue();
|
|
||||||
downloadAnonymousCheckBox.setValue(anonymousDownloadEnabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -55,9 +55,6 @@ public class TenantConfigurationDashboardView extends CustomComponent implements
|
|||||||
@Autowired
|
@Autowired
|
||||||
private PollingConfigurationView pollingConfigurationView;
|
private PollingConfigurationView pollingConfigurationView;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private DownloadAnonymousConfigurationView downloadAnonymousConfigurationView;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private I18N i18n;
|
private I18N i18n;
|
||||||
|
|
||||||
@@ -80,7 +77,6 @@ public class TenantConfigurationDashboardView extends CustomComponent implements
|
|||||||
configurationViews.add(defaultDistributionSetTypeLayout);
|
configurationViews.add(defaultDistributionSetTypeLayout);
|
||||||
configurationViews.add(authenticationConfigurationView);
|
configurationViews.add(authenticationConfigurationView);
|
||||||
configurationViews.add(pollingConfigurationView);
|
configurationViews.add(pollingConfigurationView);
|
||||||
configurationViews.add(downloadAnonymousConfigurationView);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ import java.util.List;
|
|||||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import com.vaadin.ui.VerticalLayout;
|
import com.vaadin.ui.VerticalLayout;
|
||||||
|
|
||||||
@@ -30,6 +32,9 @@ abstract class AbstractAuthenticationTenantConfigurationItem extends VerticalLay
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private I18N i18n;
|
||||||
|
|
||||||
private final TenantConfigurationKey configurationKey;
|
private final TenantConfigurationKey configurationKey;
|
||||||
private final transient TenantConfigurationManagement tenantConfigurationManagement;
|
private final transient TenantConfigurationManagement tenantConfigurationManagement;
|
||||||
|
|
||||||
@@ -53,7 +58,7 @@ abstract class AbstractAuthenticationTenantConfigurationItem extends VerticalLay
|
|||||||
*/
|
*/
|
||||||
protected void init(final String labelText) {
|
protected void init(final String labelText) {
|
||||||
setImmediate(true);
|
setImmediate(true);
|
||||||
addComponent(SPUIComponentProvider.getLabel(labelText, SPUILabelDefinitions.SP_LABEL_SIMPLE));
|
addComponent(SPUIComponentProvider.getLabel(i18n.get(labelText), SPUILabelDefinitions.SP_LABEL_SIMPLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
/**
|
||||||
|
* 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.tenantconfiguration.authentication;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||||
|
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import com.vaadin.spring.annotation.SpringComponent;
|
||||||
|
import com.vaadin.spring.annotation.ViewScope;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class represents the UI item for the anonymous download by in the
|
||||||
|
* authentication configuration view.
|
||||||
|
*/
|
||||||
|
@SpringComponent
|
||||||
|
@ViewScope
|
||||||
|
public class AnonymousDownloadAuthenticationConfigurationItem extends AbstractAuthenticationTenantConfigurationItem {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private boolean configurationEnabled = false;
|
||||||
|
private boolean configurationEnabledChange = false;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public AnonymousDownloadAuthenticationConfigurationItem(
|
||||||
|
final TenantConfigurationManagement tenantConfigurationManagement) {
|
||||||
|
super(TenantConfigurationKey.ANONYMOUS_DOWNLOAD_MODE_ENABLED, tenantConfigurationManagement);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
super.init("label.configuration.anonymous.download");
|
||||||
|
configurationEnabled = isConfigEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configEnable() {
|
||||||
|
configurationEnabledChange = !configurationEnabled;
|
||||||
|
configurationEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configDisable() {
|
||||||
|
configurationEnabledChange = configurationEnabled;
|
||||||
|
configurationEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void save() {
|
||||||
|
if (!configurationEnabledChange) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
getTenantConfigurationManagement().addOrUpdateConfiguration(getConfigurationKey(), configurationEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void undo() {
|
||||||
|
configurationEnabledChange = false;
|
||||||
|
configurationEnabled = getTenantConfigurationManagement()
|
||||||
|
.getConfigurationValue(getConfigurationKey(), Boolean.class).getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -13,7 +13,6 @@ import javax.annotation.PostConstruct;
|
|||||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
@@ -35,9 +34,6 @@ public class CertificateAuthenticationConfigurationItem extends AbstractAuthenti
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private I18N i18n;
|
|
||||||
|
|
||||||
private boolean configurationEnabled = false;
|
private boolean configurationEnabled = false;
|
||||||
private boolean configurationEnabledChange = false;
|
private boolean configurationEnabledChange = false;
|
||||||
private boolean configurationCaRootAuthorityChanged = false;
|
private boolean configurationCaRootAuthorityChanged = false;
|
||||||
@@ -60,7 +56,7 @@ public class CertificateAuthenticationConfigurationItem extends AbstractAuthenti
|
|||||||
*/
|
*/
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
super.init(i18n.get("label.configuration.auth.header"));
|
super.init("label.configuration.auth.header");
|
||||||
configurationEnabled = isConfigEnabled();
|
configurationEnabled = isConfigEnabled();
|
||||||
|
|
||||||
detailLayout = new VerticalLayout();
|
detailLayout = new VerticalLayout();
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import org.eclipse.hawkbit.security.SecurityTokenGenerator;
|
|||||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmall;
|
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmall;
|
||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
@@ -41,8 +40,6 @@ public class GatewaySecurityTokenAuthenticationConfigurationItem extends Abstrac
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private transient SecurityTokenGenerator securityTokenGenerator;
|
private transient SecurityTokenGenerator securityTokenGenerator;
|
||||||
@Autowired
|
|
||||||
private I18N i18n;
|
|
||||||
|
|
||||||
private TextField gatewayTokenNameTextField;
|
private TextField gatewayTokenNameTextField;
|
||||||
|
|
||||||
@@ -72,7 +69,7 @@ public class GatewaySecurityTokenAuthenticationConfigurationItem extends Abstrac
|
|||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
|
|
||||||
super.init(i18n.get("label.configuration.auth.gatewaytoken"));
|
super.init("label.configuration.auth.gatewaytoken");
|
||||||
configurationEnabled = isConfigEnabled();
|
configurationEnabled = isConfigEnabled();
|
||||||
|
|
||||||
detailLayout = new VerticalLayout();
|
detailLayout = new VerticalLayout();
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import javax.annotation.PostConstruct;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import com.vaadin.spring.annotation.SpringComponent;
|
import com.vaadin.spring.annotation.SpringComponent;
|
||||||
@@ -28,9 +27,6 @@ public class TargetSecurityTokenAuthenticationConfigurationItem extends Abstract
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private I18N i18n;
|
|
||||||
|
|
||||||
private boolean configurationEnabled = false;
|
private boolean configurationEnabled = false;
|
||||||
private boolean configurationEnabledChange = false;
|
private boolean configurationEnabledChange = false;
|
||||||
|
|
||||||
@@ -49,7 +45,7 @@ public class TargetSecurityTokenAuthenticationConfigurationItem extends Abstract
|
|||||||
*/
|
*/
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
super.init(i18n.get("label.configuration.auth.targettoken"));
|
super.init("label.configuration.auth.targettoken");
|
||||||
configurationEnabled = isConfigEnabled();
|
configurationEnabled = isConfigEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,29 +14,23 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.eclipse.hawkbit.im.authentication.UserPrincipal;
|
import org.eclipse.hawkbit.im.authentication.UserPrincipal;
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.repository.model.AssignmentResult;
|
import org.eclipse.hawkbit.repository.model.AssignmentResult;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
|
||||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
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.TargetInfo.PollStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus.Status;
|
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus.Status;
|
||||||
import org.eclipse.hawkbit.ui.management.dstable.DistributionTable;
|
|
||||||
import org.eclipse.hawkbit.ui.management.targettable.TargetTable;
|
|
||||||
import org.eclipse.hawkbit.ui.rollout.StatusFontIcon;
|
import org.eclipse.hawkbit.ui.rollout.StatusFontIcon;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -96,8 +90,6 @@ public final class HawkbitCommonUtil {
|
|||||||
private static final String COUNT_STYLE = " countStyle = document.createElement('style'); ";
|
private static final String COUNT_STYLE = " countStyle = document.createElement('style'); ";
|
||||||
private static final String COUNT_STYLE_ID = " countStyle.id=\"sp-drag-count\"; ";
|
private static final String COUNT_STYLE_ID = " countStyle.id=\"sp-drag-count\"; ";
|
||||||
private static final String APPEND_CHILD = " document.head.appendChild(countStyle);";
|
private static final String APPEND_CHILD = " document.head.appendChild(countStyle);";
|
||||||
private static final String HEADER_VERSION = "header.version";
|
|
||||||
private static final String HEADER_NAME = "header.name";
|
|
||||||
private static final String SM_HIGHLIGHT_CREATE_SCRIPT = "smHighlight = document.createElement('style'); smHighlight.id=\"sm-table-highlight\"; document.head.appendChild(smHighlight); ";
|
private static final String SM_HIGHLIGHT_CREATE_SCRIPT = "smHighlight = document.createElement('style'); smHighlight.id=\"sm-table-highlight\"; document.head.appendChild(smHighlight); ";
|
||||||
private static final String SM_HIGHLIGHT_REMOVE_SCRIPT = "var y = document.getElementById('sm-table-highlight'); if(y) { document.head.removeChild(y); } ";
|
private static final String SM_HIGHLIGHT_REMOVE_SCRIPT = "var y = document.getElementById('sm-table-highlight'); if(y) { document.head.removeChild(y); } ";
|
||||||
private static final String SM_HIGHLIGHT_RESET_SCRIPT = SM_HIGHLIGHT_REMOVE_SCRIPT + SM_HIGHLIGHT_CREATE_SCRIPT
|
private static final String SM_HIGHLIGHT_RESET_SCRIPT = SM_HIGHLIGHT_REMOVE_SCRIPT + SM_HIGHLIGHT_CREATE_SCRIPT
|
||||||
@@ -879,8 +871,8 @@ public final class HawkbitCommonUtil {
|
|||||||
* I18N
|
* I18N
|
||||||
* @return message
|
* @return message
|
||||||
*/
|
*/
|
||||||
public static String createAssignmentMessage(final String tagName, final AssignmentResult<? extends NamedEntity> result,
|
public static String createAssignmentMessage(final String tagName,
|
||||||
final I18N i18n) {
|
final AssignmentResult<? extends NamedEntity> result, final I18N i18n) {
|
||||||
final StringBuilder formMsg = new StringBuilder();
|
final StringBuilder formMsg = new StringBuilder();
|
||||||
final int assignedCount = result.getAssigned();
|
final int assignedCount = result.getAssigned();
|
||||||
final int alreadyAssignedCount = result.getAlreadyAssigned();
|
final int alreadyAssignedCount = result.getAlreadyAssigned();
|
||||||
@@ -960,43 +952,6 @@ public final class HawkbitCommonUtil {
|
|||||||
lqc.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, String.class, null, false, true);
|
lqc.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, String.class, null, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get visible columns in table.
|
|
||||||
*
|
|
||||||
* @param isMaximized
|
|
||||||
* true if table is maximized
|
|
||||||
* @param isShowPinColumn
|
|
||||||
* if true pin column will be displayed.
|
|
||||||
* @param i18n
|
|
||||||
* I18N
|
|
||||||
* @return List<TableColumn> list of columns to be displayed.
|
|
||||||
*/
|
|
||||||
public static List<TableColumn> getTableVisibleColumns(final Boolean isMaximized, final Boolean isShowPinColumn,
|
|
||||||
final I18N i18n) {
|
|
||||||
final List<TableColumn> columnList = new ArrayList<>();
|
|
||||||
if (isMaximized) {
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get(HEADER_NAME), 0.2f));
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_VERSION, i18n.get(HEADER_VERSION), 0.1f));
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_BY, i18n.get("header.createdBy"), 0.1f));
|
|
||||||
columnList
|
|
||||||
.add(new TableColumn(SPUILabelDefinitions.VAR_CREATED_DATE, i18n.get("header.createdDate"), 0.1f));
|
|
||||||
columnList.add(
|
|
||||||
new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, i18n.get("header.modifiedBy"), 0.1f));
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, i18n.get("header.modifiedDate"),
|
|
||||||
0.1f));
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_DESC, i18n.get("header.description"), 0.2f));
|
|
||||||
} else if (isShowPinColumn) {
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get(HEADER_NAME), 0.7f));
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_VERSION, i18n.get(HEADER_VERSION), 0.2f));
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.PIN_COLUMN, SP_STRING_EMPTY, 0.1f));
|
|
||||||
} else {
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get(HEADER_NAME), 0.8f));
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_VERSION, i18n.get(HEADER_VERSION), 0.2f));
|
|
||||||
}
|
|
||||||
return columnList;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the software module table rows highlight css.
|
* Reset the software module table rows highlight css.
|
||||||
*
|
*
|
||||||
@@ -1103,36 +1058,6 @@ public final class HawkbitCommonUtil {
|
|||||||
return DELETE_TAG_DROP_REMOVE_SCRIPT;
|
return DELETE_TAG_DROP_REMOVE_SCRIPT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the details of selected rows of {@link TargetTable}.
|
|
||||||
*
|
|
||||||
* @param sourceTable
|
|
||||||
* @return set of {@link TargetIdName}
|
|
||||||
*/
|
|
||||||
public static Set<TargetIdName> getSelectedTargetDetails(final Table sourceTable) {
|
|
||||||
Set<TargetIdName> targetSelected = null;
|
|
||||||
if (sourceTable.getValue() != null) {
|
|
||||||
targetSelected = new LinkedHashSet<>((Set) sourceTable.getValue());
|
|
||||||
targetSelected.remove(null);
|
|
||||||
}
|
|
||||||
return targetSelected;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the details of selected rows of {@link DistributionTable}.
|
|
||||||
*
|
|
||||||
* @param sourceTable
|
|
||||||
* @return set of {@link DistributionSetIdName}
|
|
||||||
*/
|
|
||||||
public static Set<DistributionSetIdName> getSelectedDSDetails(final Table sourceTable) {
|
|
||||||
Set<DistributionSetIdName> distSelected = null;
|
|
||||||
if (sourceTable.getValue() != null) {
|
|
||||||
distSelected = new LinkedHashSet<>((Set) sourceTable.getValue());
|
|
||||||
distSelected.remove(null);
|
|
||||||
}
|
|
||||||
return distSelected;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Add target table container properties.
|
* Add target table container properties.
|
||||||
|
|||||||
@@ -19,12 +19,23 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.v-context-menu .v-context-menu-item-basic-icon-container{
|
.v-context-menu .v-context-menu-item-basic-icon-container{
|
||||||
height:0px !important;
|
height:0px !important;
|
||||||
width:0px !important;
|
width:0px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.v-context-menu, .v-context-menu .v-context-menu-item-basic{
|
.v-context-menu .v-context-menu-item-basic{
|
||||||
|
background-color: #feffff !important;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-family : $app-font-family;
|
||||||
|
font-size : $app-text-font-size;
|
||||||
|
font-weight : normal;
|
||||||
|
font-style : normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.v-context-menu{
|
||||||
background-color: #feffff !important;
|
background-color: #feffff !important;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
@@ -33,6 +44,7 @@
|
|||||||
@include valo-gradient($color: $hawkbit-primary-color);
|
@include valo-gradient($color: $hawkbit-primary-color);
|
||||||
background-color: $hawkbit-primary-color !important;
|
background-color: $hawkbit-primary-color !important;
|
||||||
color: #e8eef3;
|
color: #e8eef3;
|
||||||
|
height: 30px;
|
||||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05);
|
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,5 +89,9 @@
|
|||||||
border-left: $v-grid-border-size solid $widget-border-color ;
|
border-left: $v-grid-border-size solid $widget-border-color ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.v-button-boldhide{
|
||||||
|
text-decoration:none;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,6 +161,7 @@ label.tag.name = Tag name
|
|||||||
label.configuration.auth.header = Allow targets to authenticate via a certificate authenticated by an reverse proxy
|
label.configuration.auth.header = Allow targets to authenticate via a certificate authenticated by an reverse proxy
|
||||||
label.configuration.auth.gatewaytoken = Allow a gateway to authenticate and manage multiple targets through a gateway security token
|
label.configuration.auth.gatewaytoken = Allow a gateway to authenticate and manage multiple targets through a gateway security token
|
||||||
label.configuration.auth.targettoken = Allow targets to authenticate directly with their target security token
|
label.configuration.auth.targettoken = Allow targets to authenticate directly with their target security token
|
||||||
|
label.configuration.anonymous.download = Allow targets to download artifacts without security credentials
|
||||||
label.unsupported.browser.ie=Sorry! current browser is not supported. Please use Internet Explorer 11 and above
|
label.unsupported.browser.ie=Sorry! current browser is not supported. Please use Internet Explorer 11 and above
|
||||||
|
|
||||||
# Checkbox label prefix with - checkbox
|
# Checkbox label prefix with - checkbox
|
||||||
@@ -401,8 +402,6 @@ configuration.polling.title=Polling Configuration
|
|||||||
configuration.polling.time=Polling Time
|
configuration.polling.time=Polling Time
|
||||||
configuration.polling.overduetime=Polling Overdue Time
|
configuration.polling.overduetime=Polling Overdue Time
|
||||||
configuration.polling.custom.value=use a custom value
|
configuration.polling.custom.value=use a custom value
|
||||||
enonymous.download.title=Anonymous download
|
|
||||||
enonymous.download.label=Allow anonymous download. If you enable this option the download server will accept anonymous download requests.
|
|
||||||
|
|
||||||
#Calendar
|
#Calendar
|
||||||
calendar.year=year
|
calendar.year=year
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ label.tag.name = Tag name
|
|||||||
label.configuration.auth.header = Allow targets to authenticate via a certificate authenticated by an reverse proxy
|
label.configuration.auth.header = Allow targets to authenticate via a certificate authenticated by an reverse proxy
|
||||||
label.configuration.auth.gatewaytoken = Allow a gateway to authenticate and manage multiple targets through a gateway security token
|
label.configuration.auth.gatewaytoken = Allow a gateway to authenticate and manage multiple targets through a gateway security token
|
||||||
label.configuration.auth.targettoken = Allow targets to authenticate directly with their target security token
|
label.configuration.auth.targettoken = Allow targets to authenticate directly with their target security token
|
||||||
|
label.configuration.anonymous.download = Allow targets to download artifacts without security credentials
|
||||||
label.unsupported.browser.ie=Sorry! current browser is not supported. Please use Internet Explorer 11 and above
|
label.unsupported.browser.ie=Sorry! current browser is not supported. Please use Internet Explorer 11 and above
|
||||||
|
|
||||||
# Checkbox label prefix with - checkbox
|
# Checkbox label prefix with - checkbox
|
||||||
@@ -389,8 +390,7 @@ configuration.defaultdistributionset.select.label=Wahl des default Distribution
|
|||||||
configuration.savebutton.tooltip=Konfigurationen speichern
|
configuration.savebutton.tooltip=Konfigurationen speichern
|
||||||
configuration.cancellbutton.tooltip=Konfigurationen zur<75>cksetzen
|
configuration.cancellbutton.tooltip=Konfigurationen zur<75>cksetzen
|
||||||
configuration.authentication.title=Authentifikationseinstellungen
|
configuration.authentication.title=Authentifikationseinstellungen
|
||||||
enonymous.download.title=Anonymes herunterladen
|
|
||||||
enonymous.download.label=Erlaube anonymes herunterladen. When diese option aktivert ist, wird der download server anonyme download anfragen erlauben.
|
|
||||||
#Calendar
|
#Calendar
|
||||||
calendar.year=Jahr
|
calendar.year=Jahr
|
||||||
calendar.years=Jahre
|
calendar.years=Jahre
|
||||||
|
|||||||
@@ -160,6 +160,7 @@ label.tag.name = Tag name
|
|||||||
label.configuration.auth.header = Allow targets to authenticate via a certificate authenticated by an reverse proxy
|
label.configuration.auth.header = Allow targets to authenticate via a certificate authenticated by an reverse proxy
|
||||||
label.configuration.auth.gatewaytoken = Allow a gateway to authenticate and manage multiple targets through a gateway security token
|
label.configuration.auth.gatewaytoken = Allow a gateway to authenticate and manage multiple targets through a gateway security token
|
||||||
label.configuration.auth.targettoken = Allow targets to authenticate directly with their target security token
|
label.configuration.auth.targettoken = Allow targets to authenticate directly with their target security token
|
||||||
|
label.configuration.anonymous.download = Allow targets to download artifacts without security credentials
|
||||||
label.unsupported.browser.ie=Sorry! current browser is not supported. Please use Internet Explorer 11 and above
|
label.unsupported.browser.ie=Sorry! current browser is not supported. Please use Internet Explorer 11 and above
|
||||||
|
|
||||||
# Checkbox label prefix with - checkbox
|
# Checkbox label prefix with - checkbox
|
||||||
@@ -383,8 +384,6 @@ configuration.authentication.title=Authentication Configuration
|
|||||||
controller.polling.title=Polling Configuration
|
controller.polling.title=Polling Configuration
|
||||||
controller.polling.time=Polling Time
|
controller.polling.time=Polling Time
|
||||||
controller.polling.overduetime=Polling Overdue Time
|
controller.polling.overduetime=Polling Overdue Time
|
||||||
enonymous.download.title=Anonymous download
|
|
||||||
enonymous.download.label=Allow anonymous download. If you enable this option the download server will accept anonymous download requests.
|
|
||||||
|
|
||||||
#Calendar
|
#Calendar
|
||||||
calendar.year=year
|
calendar.year=year
|
||||||
|
|||||||
Reference in New Issue
Block a user