Merge remote-tracking branch 'origin/master' into fix_Consitent_breadcrumb_usage
This commit is contained in:
0
3rd-dependencies/listDeps.sh
Executable file → Normal file
0
3rd-dependencies/listDeps.sh
Executable file → Normal file
@@ -139,7 +139,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.vaadin</groupId>
|
<groupId>com.vaadin</groupId>
|
||||||
<artifactId>vaadin-bom</artifactId>
|
<artifactId>vaadin-bom</artifactId>
|
||||||
<version>7.6.3</version>
|
<version>${vaadin.version}</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
@@ -86,7 +86,10 @@ 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));
|
||||||
spSenderService.createOrUpdateThing(tenant, deviceId);
|
|
||||||
|
if (protocol == Protocol.DMF_AMQP) {
|
||||||
|
spSenderService.createOrUpdateThing(tenant, deviceId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseEntity.ok("Updated " + amount + " DMF connected targets!");
|
return ResponseEntity.ok("Updated " + amount + " DMF connected targets!");
|
||||||
|
|||||||
@@ -11,10 +11,12 @@ 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;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.context.ApplicationListener;
|
import org.springframework.context.ApplicationListener;
|
||||||
import org.springframework.context.event.ContextRefreshedEvent;
|
import org.springframework.context.event.ContextRefreshedEvent;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -24,6 +26,7 @@ import org.springframework.stereotype.Component;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
|
@ConditionalOnProperty(prefix = "hawkbit.device.simulator", name = "autostart", matchIfMissing = true)
|
||||||
public class SimulatorStartup implements ApplicationListener<ContextRefreshedEvent> {
|
public class SimulatorStartup implements ApplicationListener<ContextRefreshedEvent> {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(SimulatorStartup.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(SimulatorStartup.class);
|
||||||
|
|
||||||
@@ -52,7 +55,9 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
spSenderService.createOrUpdateThing(autostart.getTenant(), deviceId);
|
if (autostart.getApi() == Protocol.DMF_AMQP) {
|
||||||
|
spSenderService.createOrUpdateThing(autostart.getTenant(), deviceId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,12 @@ public class AmqpProperties {
|
|||||||
*/
|
*/
|
||||||
private String deadLetterExchange = "simulator.deadletter";
|
private String deadLetterExchange = "simulator.deadletter";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Message time to live (ttl) for the deadletter queue. Default ttl is 1
|
||||||
|
* hour.
|
||||||
|
*/
|
||||||
|
private int deadLetterTtl = 60_000;
|
||||||
|
|
||||||
public String getReceiverConnectorQueueFromSp() {
|
public String getReceiverConnectorQueueFromSp() {
|
||||||
return receiverConnectorQueueFromSp;
|
return receiverConnectorQueueFromSp;
|
||||||
}
|
}
|
||||||
@@ -70,4 +76,12 @@ public class AmqpProperties {
|
|||||||
public void setSenderForSpExchange(final String senderForSpExchange) {
|
public void setSenderForSpExchange(final String senderForSpExchange) {
|
||||||
this.senderForSpExchange = senderForSpExchange;
|
this.senderForSpExchange = senderForSpExchange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getDeadLetterTtl() {
|
||||||
|
return deadLetterTtl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeadLetterTtl(final int deadLetterTtl) {
|
||||||
|
this.deadLetterTtl = deadLetterTtl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ spring.rabbitmq.password=guest
|
|||||||
spring.rabbitmq.virtualHost=/
|
spring.rabbitmq.virtualHost=/
|
||||||
spring.rabbitmq.host=localhost
|
spring.rabbitmq.host=localhost
|
||||||
spring.rabbitmq.port=5672
|
spring.rabbitmq.port=5672
|
||||||
hawkbit.dmf.rabbitmq.deadLetterQueue=dmf_connector_deadletter
|
hawkbit.dmf.rabbitmq.deadLetterQueue=dmf_connector_deadletter_ttl
|
||||||
hawkbit.dmf.rabbitmq.deadLetterExchange=dmf.connector.deadletter
|
hawkbit.dmf.rabbitmq.deadLetterExchange=dmf.connector.deadletter
|
||||||
hawkbit.dmf.rabbitmq.receiverQueue=dmf_receiver
|
hawkbit.dmf.rabbitmq.receiverQueue=dmf_receiver
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,6 @@ hawkbit.controller.minPollingTime=00:00:30
|
|||||||
|
|
||||||
|
|
||||||
# Configuration for RabbitMQ integration
|
# Configuration for RabbitMQ integration
|
||||||
hawkbit.dmf.rabbitmq.deadLetterQueue=dmf_connector_deadletter
|
hawkbit.dmf.rabbitmq.deadLetterQueue=dmf_connector_deadletter_ttl
|
||||||
hawkbit.dmf.rabbitmq.deadLetterExchange=dmf.connector.deadletter
|
hawkbit.dmf.rabbitmq.deadLetterExchange=dmf.connector.deadletter
|
||||||
hawkbit.dmf.rabbitmq.receiverQueue=dmf_receiver
|
hawkbit.dmf.rabbitmq.receiverQueue=dmf_receiver
|
||||||
@@ -8,9 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.amqp;
|
package org.eclipse.hawkbit.amqp;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.dmf.amqp.api.AmqpSettings;
|
import org.eclipse.hawkbit.dmf.amqp.api.AmqpSettings;
|
||||||
import org.springframework.amqp.core.Binding;
|
import org.springframework.amqp.core.Binding;
|
||||||
import org.springframework.amqp.core.BindingBuilder;
|
import org.springframework.amqp.core.BindingBuilder;
|
||||||
@@ -18,6 +15,7 @@ import org.springframework.amqp.core.FanoutExchange;
|
|||||||
import org.springframework.amqp.core.Queue;
|
import org.springframework.amqp.core.Queue;
|
||||||
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
|
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
|
||||||
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitAdmin;
|
||||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
|
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
|
||||||
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
|
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
|
||||||
@@ -31,15 +29,31 @@ import org.springframework.context.annotation.Bean;
|
|||||||
* {@code amqp} to use a AMQP for communication with SP enabled devices.
|
* {@code amqp} to use a AMQP for communication with SP enabled devices.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@EnableConfigurationProperties(AmqpProperties.class)
|
@EnableConfigurationProperties({ AmqpProperties.class, AmqpDeadletterProperties.class })
|
||||||
public class AmqpConfiguration {
|
public class AmqpConfiguration {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
protected AmqpProperties amqpProperties;
|
protected AmqpProperties amqpProperties;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
protected AmqpDeadletterProperties amqpDeadletterProperties;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ConnectionFactory connectionFactory;
|
private ConnectionFactory connectionFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a {@link RabbitAdmin} and ignore declaration exceptions.
|
||||||
|
* {@link RabbitAdmin#setIgnoreDeclarationExceptions(boolean)}
|
||||||
|
*
|
||||||
|
* @return the bean
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public RabbitAdmin rabbitAdmin() {
|
||||||
|
final RabbitAdmin rabbitAdmin = new RabbitAdmin(connectionFactory);
|
||||||
|
rabbitAdmin.setIgnoreDeclarationExceptions(true);
|
||||||
|
return rabbitAdmin;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to set the Jackson2JsonMessageConverter.
|
* Method to set the Jackson2JsonMessageConverter.
|
||||||
*
|
*
|
||||||
@@ -59,7 +73,8 @@ public class AmqpConfiguration {
|
|||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public Queue receiverQueue() {
|
public Queue receiverQueue() {
|
||||||
return new Queue(amqpProperties.getReceiverQueue(), true, false, false, getDeadLetterExchangeArgs());
|
return new Queue(amqpProperties.getReceiverQueue(), true, false, false,
|
||||||
|
amqpDeadletterProperties.getDeadLetterExchangeArgs(amqpProperties.getDeadLetterExchange()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -79,7 +94,7 @@ public class AmqpConfiguration {
|
|||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public Queue deadLetterQueue() {
|
public Queue deadLetterQueue() {
|
||||||
return new Queue(amqpProperties.getDeadLetterQueue());
|
return amqpDeadletterProperties.createDeadletterQueue(amqpProperties.getDeadLetterQueue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -149,10 +164,4 @@ public class AmqpConfiguration {
|
|||||||
return containerFactory;
|
return containerFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> getDeadLetterExchangeArgs() {
|
|
||||||
final Map<String, Object> args = new HashMap<>();
|
|
||||||
args.put("x-dead-letter-exchange", amqpProperties.getDeadLetterExchange());
|
|
||||||
return args;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
/**
|
||||||
|
* 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.amqp;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.springframework.amqp.core.Queue;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bean which holds the necessary properties for configuring the AMQP deadletter
|
||||||
|
* queue.
|
||||||
|
*/
|
||||||
|
@ConfigurationProperties("hawkbit.dmf.rabbitmq.deadLetter")
|
||||||
|
public class AmqpDeadletterProperties {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Message time to live (ttl) for the deadletter queue. Default ttl is 3
|
||||||
|
* weeks.
|
||||||
|
*/
|
||||||
|
private long ttl = Duration.ofDays(21).toMillis();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the deadletter arguments.
|
||||||
|
*
|
||||||
|
* @param exchange
|
||||||
|
* the deadletter exchange
|
||||||
|
* @return map which holds the properties
|
||||||
|
*/
|
||||||
|
public Map<String, Object> getDeadLetterExchangeArgs(final String exchange) {
|
||||||
|
final Map<String, Object> args = new HashMap<>();
|
||||||
|
args.put("x-dead-letter-exchange", exchange);
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a deadletter queue with ttl for messages
|
||||||
|
*
|
||||||
|
* @param queueName
|
||||||
|
* the deadlette queue name
|
||||||
|
* @return the deadletter queue
|
||||||
|
*/
|
||||||
|
public Queue createDeadletterQueue(final String queueName) {
|
||||||
|
return new Queue(queueName, true, false, false, getTTLArgs());
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, Object> getTTLArgs() {
|
||||||
|
final Map<String, Object> args = new HashMap<>();
|
||||||
|
args.put("x-message-ttl", getTtl());
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getTtl() {
|
||||||
|
return ttl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTtl(final long ttl) {
|
||||||
|
this.ttl = ttl;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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());
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class AmqpProperties {
|
|||||||
/**
|
/**
|
||||||
* DMF API dead letter queue.
|
* DMF API dead letter queue.
|
||||||
*/
|
*/
|
||||||
private String deadLetterQueue = "dmf_connector_deadletter";
|
private String deadLetterQueue = "dmf_connector_deadletter_ttl";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DMF API dead letter exchange.
|
* DMF API dead letter exchange.
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -11,9 +11,6 @@ package org.eclipse.hawkbit;
|
|||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.transaction.Transaction;
|
import javax.transaction.Transaction;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.SystemManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.exception.TenantNotExistException;
|
|
||||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
import org.eclipse.hawkbit.tenancy.TenantAware;
|
||||||
import org.eclipse.persistence.config.PersistenceUnitProperties;
|
import org.eclipse.persistence.config.PersistenceUnitProperties;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -38,38 +35,12 @@ public class MultiTenantJpaTransactionManager extends JpaTransactionManager {
|
|||||||
protected void doBegin(final Object transaction, final TransactionDefinition definition) {
|
protected void doBegin(final Object transaction, final TransactionDefinition definition) {
|
||||||
super.doBegin(transaction, definition);
|
super.doBegin(transaction, definition);
|
||||||
|
|
||||||
final EntityManagerHolder emHolder = (EntityManagerHolder) TransactionSynchronizationManager
|
final String currentTenant = tenantAware.getCurrentTenant();
|
||||||
.getResource(getEntityManagerFactory());
|
if (currentTenant != null) {
|
||||||
final EntityManager em = emHolder.getEntityManager();
|
final EntityManagerHolder emHolder = (EntityManagerHolder) TransactionSynchronizationManager
|
||||||
|
.getResource(getEntityManagerFactory());
|
||||||
if (notTenantManagement(definition) && notCurrentTenantKeyGenerator(definition)
|
final EntityManager em = emHolder.getEntityManager();
|
||||||
&& notRolloutScheduler(definition) && notGetOrCreateTenantMetadata(definition)) {
|
|
||||||
|
|
||||||
final String currentTenant = tenantAware.getCurrentTenant();
|
|
||||||
if (currentTenant == null) {
|
|
||||||
throw new TenantNotExistException("Tenant Unknown. Canceling transaction.");
|
|
||||||
}
|
|
||||||
|
|
||||||
em.setProperty(PersistenceUnitProperties.MULTITENANT_PROPERTY_DEFAULT, currentTenant.toUpperCase());
|
em.setProperty(PersistenceUnitProperties.MULTITENANT_PROPERTY_DEFAULT, currentTenant.toUpperCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean notGetOrCreateTenantMetadata(final TransactionDefinition definition) {
|
|
||||||
return !definition.getName()
|
|
||||||
.startsWith(SystemManagement.class.getCanonicalName() + ".getOrCreateTenantMetadata");
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean notRolloutScheduler(final TransactionDefinition definition) {
|
|
||||||
return !definition.getName().startsWith(RolloutManagement.class.getCanonicalName() + ".rolloutScheduler");
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean notCurrentTenantKeyGenerator(final TransactionDefinition definition) {
|
|
||||||
return !definition.getName()
|
|
||||||
.startsWith(SystemManagement.class.getCanonicalName() + ".currentTenantKeyGenerator");
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean notTenantManagement(final TransactionDefinition definition) {
|
|
||||||
return !definition.getName().startsWith(SystemManagement.class.getCanonicalName() + ".deleteTenant")
|
|
||||||
&& !definition.getName().startsWith(SystemManagement.class.getCanonicalName() + ".findTenants");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -166,6 +168,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.
|
||||||
|
|||||||
@@ -58,6 +58,8 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.PlatformTransactionManager;
|
import org.springframework.transaction.PlatformTransactionManager;
|
||||||
import org.springframework.transaction.TransactionDefinition;
|
import org.springframework.transaction.TransactionDefinition;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
||||||
import org.springframework.transaction.support.TransactionTemplate;
|
import org.springframework.transaction.support.TransactionTemplate;
|
||||||
@@ -259,13 +261,7 @@ public class RolloutManagement {
|
|||||||
entityManager.flush();
|
entityManager.flush();
|
||||||
executor.execute(() -> {
|
executor.execute(() -> {
|
||||||
try {
|
try {
|
||||||
final DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
createRolloutGroupsInNewTransaction(amountGroup, conditions, savedRollout);
|
||||||
def.setName("creatingRollout");
|
|
||||||
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
|
|
||||||
new TransactionTemplate(txManager, def).execute(status -> {
|
|
||||||
createRolloutGroups(amountGroup, conditions, savedRollout);
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
} finally {
|
} finally {
|
||||||
creatingRollouts.remove(savedRollout.getName());
|
creatingRollouts.remove(savedRollout.getName());
|
||||||
}
|
}
|
||||||
@@ -288,13 +284,22 @@ public class RolloutManagement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Rollout createRolloutGroupsInNewTransaction(final int amountOfGroups, final RolloutGroupConditions conditions,
|
||||||
|
final Rollout savedRollout) {
|
||||||
|
final DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
||||||
|
def.setName("creatingRollout");
|
||||||
|
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
|
||||||
|
return new TransactionTemplate(txManager, def)
|
||||||
|
.execute(status -> createRolloutGroups(amountOfGroups, conditions, savedRollout));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method for creating rollout groups and calculating group sizes. Group
|
* Method for creating rollout groups and calculating group sizes. Group
|
||||||
* sizes are calculated by dividing the total count of targets through the
|
* sizes are calculated by dividing the total count of targets through the
|
||||||
* amount of given groups. In same cases this will lead to less rollout
|
* amount of given groups. In same cases this will lead to less rollout
|
||||||
* groups than given by client.
|
* groups than given by client.
|
||||||
*
|
*
|
||||||
* @param amountGroup
|
* @param amountOfGroups
|
||||||
* the amount of groups
|
* the amount of groups
|
||||||
* @param conditions
|
* @param conditions
|
||||||
* the rollout group conditions
|
* the rollout group conditions
|
||||||
@@ -302,17 +307,17 @@ public class RolloutManagement {
|
|||||||
* the rollout
|
* the rollout
|
||||||
* @return the rollout with created groups
|
* @return the rollout with created groups
|
||||||
*/
|
*/
|
||||||
private Rollout createRolloutGroups(final int amountGroup, final RolloutGroupConditions conditions,
|
private Rollout createRolloutGroups(final int amountOfGroups, final RolloutGroupConditions conditions,
|
||||||
final Rollout savedRollout) {
|
final Rollout savedRollout) {
|
||||||
int pageIndex = 0;
|
int pageIndex = 0;
|
||||||
int groupIndex = 0;
|
int groupIndex = 0;
|
||||||
final Long totalCount = savedRollout.getTotalTargets();
|
final Long totalCount = savedRollout.getTotalTargets();
|
||||||
final int groupSize = (int) Math.ceil((double) totalCount / (double) amountGroup);
|
final int groupSize = (int) Math.ceil((double) totalCount / (double) amountOfGroups);
|
||||||
// validate if the amount of groups that will be created are the amount
|
// validate if the amount of groups that will be created are the amount
|
||||||
// of groups that the client what's to have created.
|
// of groups that the client what's to have created.
|
||||||
int amountGroupValidated = amountGroup;
|
int amountGroupValidated = amountOfGroups;
|
||||||
final int amountGroupCreation = (int) (Math.ceil((double) totalCount / (double) groupSize));
|
final int amountGroupCreation = (int) (Math.ceil((double) totalCount / (double) groupSize));
|
||||||
if (amountGroupCreation == (amountGroup - 1)) {
|
if (amountGroupCreation == (amountOfGroups - 1)) {
|
||||||
amountGroupValidated--;
|
amountGroupValidated--;
|
||||||
}
|
}
|
||||||
RolloutGroup lastSavedGroup = null;
|
RolloutGroup lastSavedGroup = null;
|
||||||
@@ -540,7 +545,7 @@ public class RolloutManagement {
|
|||||||
* this check. This check is only applied if the last check is
|
* this check. This check is only applied if the last check is
|
||||||
* less than (lastcheck-delay).
|
* less than (lastcheck-delay).
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Modifying
|
@Modifying
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE + SpringEvalExpressions.HAS_AUTH_OR
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_WRITE + SpringEvalExpressions.HAS_AUTH_OR
|
||||||
+ SpringEvalExpressions.IS_SYSTEM_CODE)
|
+ SpringEvalExpressions.IS_SYSTEM_CODE)
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ public class SystemManagement {
|
|||||||
* @return the {@link CurrentTenantKeyGenerator}
|
* @return the {@link CurrentTenantKeyGenerator}
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
|
@Transactional(propagation = Propagation.SUPPORTS)
|
||||||
public CurrentTenantKeyGenerator currentTenantKeyGenerator() {
|
public CurrentTenantKeyGenerator currentTenantKeyGenerator() {
|
||||||
return new CurrentTenantKeyGenerator();
|
return new CurrentTenantKeyGenerator();
|
||||||
}
|
}
|
||||||
@@ -206,7 +207,6 @@ public class SystemManagement {
|
|||||||
@NotNull
|
@NotNull
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_SYSTEM_ADMIN + SpringEvalExpressions.HAS_AUTH_OR
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_SYSTEM_ADMIN + SpringEvalExpressions.HAS_AUTH_OR
|
||||||
+ SpringEvalExpressions.IS_SYSTEM_CODE)
|
+ SpringEvalExpressions.IS_SYSTEM_CODE)
|
||||||
// tenant independent
|
|
||||||
public List<String> findTenants() {
|
public List<String> findTenants() {
|
||||||
return tenantMetaDataRepository.findAll().stream().map(md -> md.getTenant()).collect(Collectors.toList());
|
return tenantMetaDataRepository.findAll().stream().map(md -> md.getTenant()).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
@@ -221,7 +221,6 @@ public class SystemManagement {
|
|||||||
@Transactional
|
@Transactional
|
||||||
@Modifying
|
@Modifying
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_SYSTEM_ADMIN)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_SYSTEM_ADMIN)
|
||||||
// tenant independent
|
|
||||||
public void deleteTenant(@NotNull final String tenant) {
|
public void deleteTenant(@NotNull final String tenant) {
|
||||||
cacheManager.evictCaches(tenant);
|
cacheManager.evictCaches(tenant);
|
||||||
cacheManager.getCache("currentTenant").evict(currentTenantKeyGenerator().generate(null, null));
|
cacheManager.getCache("currentTenant").evict(currentTenantKeyGenerator().generate(null, null));
|
||||||
|
|||||||
@@ -24,13 +24,18 @@ import javax.persistence.ManyToOne;
|
|||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import org.eclipse.persistence.annotations.ExistenceChecking;
|
||||||
|
import org.eclipse.persistence.annotations.ExistenceType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Michael Hirsch
|
* Entity with JPA annotation to store the information which {@link Target} is
|
||||||
|
* in a specific {@link RolloutGroup}.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@IdClass(RolloutTargetGroupId.class)
|
@IdClass(RolloutTargetGroupId.class)
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "sp_rollouttargetgroup")
|
@Table(name = "sp_rollouttargetgroup")
|
||||||
|
@ExistenceChecking(ExistenceType.ASSUME_NON_EXISTENCE)
|
||||||
public class RolloutTargetGroup implements Serializable {
|
public class RolloutTargetGroup implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
@@ -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));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -78,6 +78,22 @@ public class MultiTenancyEntityTest extends AbstractIntegrationTest {
|
|||||||
assertThat(findTargetsForTenant).hasSize(1);
|
assertThat(findTargetsForTenant).hasSize(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Description(value = "Ensures that tenant with proper permissions can read and delete other tenants.")
|
||||||
|
@WithUser(tenantId = "mytenant", allSpPermissions = true)
|
||||||
|
public void deleteAnotherTenantPossible() throws Exception {
|
||||||
|
// create target for another tenant
|
||||||
|
final String anotherTenant = "anotherTenant";
|
||||||
|
final String controllerAnotherTenant = "anotherController";
|
||||||
|
createTargetForTenant(controllerAnotherTenant, anotherTenant);
|
||||||
|
|
||||||
|
assertThat(systemManagement.findTenants()).as("Expected number if tenants before deletion is").hasSize(3);
|
||||||
|
|
||||||
|
systemManagement.deleteTenant(anotherTenant);
|
||||||
|
|
||||||
|
assertThat(systemManagement.findTenants()).as("Expected number if tenants after deletion is").hasSize(2);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description(value = "Ensures that tenant metadata is retrieved for the current tenant.")
|
@Description(value = "Ensures that tenant metadata is retrieved for the current tenant.")
|
||||||
@WithUser(tenantId = "mytenant", autoCreateTenant = false, allSpPermissions = true)
|
@WithUser(tenantId = "mytenant", autoCreateTenant = false, allSpPermissions = true)
|
||||||
|
|||||||
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);
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -155,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();
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
|||||||
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.repository.model.SoftwareModuleType;
|
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||||
|
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||||
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;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
@@ -101,8 +102,8 @@ public class BaseSwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSoftwareMo
|
|||||||
proxy.setVersion(bean.getVersion());
|
proxy.setVersion(bean.getVersion());
|
||||||
proxy.setVendor(bean.getVendor());
|
proxy.setVendor(bean.getVendor());
|
||||||
proxy.setDescription(bean.getDescription());
|
proxy.setDescription(bean.getDescription());
|
||||||
proxy.setCreatedByUser(HawkbitCommonUtil.getIMUser(bean.getCreatedBy()));
|
proxy.setCreatedByUser(UserDetailsFormatter.loadAndFormatCreatedBy(bean));
|
||||||
proxy.setModifiedByUser(HawkbitCommonUtil.getIMUser(bean.getLastModifiedBy()));
|
proxy.setModifiedByUser(UserDetailsFormatter.loadAndFormatLastModifiedBy(bean));
|
||||||
return proxy;
|
return proxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -240,6 +240,7 @@ public class SoftwareModuleAddUpdateWindow implements Serializable {
|
|||||||
SPUIDefinitions.CREATE_UPDATE_WINDOW);
|
SPUIDefinitions.CREATE_UPDATE_WINDOW);
|
||||||
window.setContent(mainLayout);
|
window.setContent(mainLayout);
|
||||||
window.setModal(true);
|
window.setModal(true);
|
||||||
|
nameTextField.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addDescriptionTextChangeListener() {
|
private void addDescriptionTextChangeListener() {
|
||||||
|
|||||||
@@ -157,16 +157,9 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
protected Item addEntity(final SoftwareModule baseEntity) {
|
protected Item addEntity(final SoftwareModule baseEntity) {
|
||||||
final Item item = super.addEntity(baseEntity);
|
final Item item = super.addEntity(baseEntity);
|
||||||
|
|
||||||
final String swNameVersion = HawkbitCommonUtil.concatStrings(":", baseEntity.getName(),
|
|
||||||
baseEntity.getVersion());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.NAME_VERSION).setValue(swNameVersion);
|
|
||||||
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_VENDOR).setValue(baseEntity.getVendor());
|
|
||||||
if (!artifactUploadState.getSelectedSoftwareModules().isEmpty()) {
|
if (!artifactUploadState.getSelectedSoftwareModules().isEmpty()) {
|
||||||
artifactUploadState.getSelectedSoftwareModules().stream().forEach(this::unselect);
|
artifactUploadState.getSelectedSoftwareModules().stream().forEach(this::unselect);
|
||||||
}
|
}
|
||||||
@@ -175,6 +168,17 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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 = super.getTableVisibleColumns();
|
final List<TableColumn> columnList = super.getTableVisibleColumns();
|
||||||
|
|||||||
@@ -257,6 +257,7 @@ public class CreateUpdateSoftwareTypeLayout extends CustomComponent implements C
|
|||||||
mainLayout = new HorizontalLayout();
|
mainLayout = new HorizontalLayout();
|
||||||
mainLayout.addComponent(fieldButtonLayout);
|
mainLayout.addComponent(fieldButtonLayout);
|
||||||
setCompositionRoot(mainLayout);
|
setCompositionRoot(mainLayout);
|
||||||
|
typeName.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addListeners() {
|
private void addListeners() {
|
||||||
|
|||||||
@@ -0,0 +1,185 @@
|
|||||||
|
/**
|
||||||
|
* 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.Collections;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.eclipse.hawkbit.im.authentication.UserPrincipal;
|
||||||
|
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
||||||
|
import org.springframework.security.core.context.SecurityContext;
|
||||||
|
import org.springframework.security.core.userdetails.User;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||||
|
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||||
|
import org.springframework.security.web.context.HttpSessionSecurityContextRepository;
|
||||||
|
|
||||||
|
import com.vaadin.server.VaadinService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Utility class to user details e.g. username
|
||||||
|
*/
|
||||||
|
public final class UserDetailsFormatter {
|
||||||
|
|
||||||
|
private static final String TRIM_APPENDIX = "...";
|
||||||
|
private static final String DETAIL_SEPERATOR = ", ";
|
||||||
|
|
||||||
|
private UserDetailsFormatter() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load user details by the user name and format the user name to max 100
|
||||||
|
* characters.
|
||||||
|
*
|
||||||
|
* @see {@link UserDetailsFormatter#loadAndFormatUsername(String, int)}
|
||||||
|
*
|
||||||
|
* @param username
|
||||||
|
* the user name
|
||||||
|
* @return the formatted user name (max 100 characters) cannot be <null>
|
||||||
|
*/
|
||||||
|
public static String loadAndFormatUsername(final String username) {
|
||||||
|
return loadAndFormatUsername(username, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load user details by {@link BaseEntity#getCreatedBy()} and format the
|
||||||
|
* user name. Use {@link UserDetailsFormatter#loadAndFormatUsername(String)}
|
||||||
|
*
|
||||||
|
* @param baseEntity
|
||||||
|
* the entity
|
||||||
|
* @return the formatted 'created at user name' (max 100 characters) cannot
|
||||||
|
* be <null>
|
||||||
|
*/
|
||||||
|
public static String loadAndFormatCreatedBy(final BaseEntity baseEntity) {
|
||||||
|
if (baseEntity == null || baseEntity.getCreatedBy() == null) {
|
||||||
|
return StringUtils.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
return loadAndFormatUsername(baseEntity.getCreatedBy());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load user details by {@link BaseEntity#getLastModifiedBy()} and format
|
||||||
|
* the user name. Use
|
||||||
|
* {@link UserDetailsFormatter#loadAndFormatUsername(String)}
|
||||||
|
*
|
||||||
|
* @param baseEntity
|
||||||
|
* the entity
|
||||||
|
* @return the formatted 'last modefied by user name' (max 100 characters)
|
||||||
|
* cannot be <null>
|
||||||
|
*/
|
||||||
|
public static String loadAndFormatLastModifiedBy(final BaseEntity baseEntity) {
|
||||||
|
if (baseEntity == null || baseEntity.getLastModifiedBy() == null) {
|
||||||
|
return StringUtils.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
return loadAndFormatUsername(baseEntity.getLastModifiedBy());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load user details by the current session information and format the user
|
||||||
|
* name to max 12 characters. @see
|
||||||
|
* {@link UserDetailsFormatter#loadAndFormatUsername(String, int)}
|
||||||
|
*
|
||||||
|
* @return the formatted user name (max 12 characters) cannot be <null>
|
||||||
|
*/
|
||||||
|
public static String formatCurrentUsername() {
|
||||||
|
return loadAndFormatUsername(getCurrentUser().getUsername(), 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load user details by the user name and format the user name. If the
|
||||||
|
* loaded {@link UserDetails} is not an instance of a {@link UserPrincipal},
|
||||||
|
* then just the {@link UserDetails#getUsername()} will return.
|
||||||
|
*
|
||||||
|
* If first and last name available, they will combined. Otherwise the
|
||||||
|
* {@link UserPrincipal#getLoginname()} will formatted. The formatted name
|
||||||
|
* is reduced to 100 characters.
|
||||||
|
*
|
||||||
|
* @param username
|
||||||
|
* the user name
|
||||||
|
* @param expectedNameLength
|
||||||
|
* the name size of each name part
|
||||||
|
* @return the formatted user name (max expectedNameLength characters)
|
||||||
|
* cannot be <null>
|
||||||
|
*/
|
||||||
|
public static String loadAndFormatUsername(final String username, final int expectedNameLength) {
|
||||||
|
final UserDetails userDetails = loadUserByUsername(username);
|
||||||
|
return formatUserName(expectedNameLength, userDetails);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String formatUserName(final int expectedNameLength, final UserDetails userDetails) {
|
||||||
|
if (!(userDetails instanceof UserPrincipal)) {
|
||||||
|
return userDetails.getUsername();
|
||||||
|
}
|
||||||
|
|
||||||
|
final UserPrincipal userPrincipal = (UserPrincipal) userDetails;
|
||||||
|
|
||||||
|
String firstname = StringUtils.defaultIfEmpty(userPrincipal.getFirstname(), StringUtils.EMPTY);
|
||||||
|
|
||||||
|
if (!StringUtils.isEmpty(firstname)) {
|
||||||
|
firstname += DETAIL_SEPERATOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String firstAndLastname = firstname
|
||||||
|
+ StringUtils.defaultIfEmpty(userPrincipal.getLastname(), StringUtils.EMPTY);
|
||||||
|
|
||||||
|
final String trimmedUsername = trimAndFormatDetail(firstAndLastname, expectedNameLength);
|
||||||
|
|
||||||
|
if (StringUtils.isEmpty(trimmedUsername)) {
|
||||||
|
return trimAndFormatDetail(userPrincipal.getLoginname(), expectedNameLength);
|
||||||
|
}
|
||||||
|
return trimmedUsername;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format the current tenant. The information is loaded by the current
|
||||||
|
* session information.
|
||||||
|
*
|
||||||
|
* @return the formatted user name (max 8 characters) can be <null>
|
||||||
|
*/
|
||||||
|
public static String formatCurrentTenant() {
|
||||||
|
final UserDetails userDetails = getCurrentUser();
|
||||||
|
if (!(userDetails instanceof UserPrincipal)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
final UserPrincipal userPrincipal = (UserPrincipal) userDetails;
|
||||||
|
return trimAndFormatDetail(userPrincipal.getTenant(), 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static UserDetails getCurrentUser() {
|
||||||
|
final SecurityContext context = (SecurityContext) VaadinService.getCurrentRequest().getWrappedSession()
|
||||||
|
.getAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY);
|
||||||
|
return (UserDetails) context.getAuthentication().getPrincipal();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String trimAndFormatDetail(final String formatString, final int expectedDetailLength) {
|
||||||
|
final String detail = StringUtils.defaultIfEmpty(formatString, StringUtils.EMPTY);
|
||||||
|
final String trimmedDetail = StringUtils.substring(detail, 0, expectedDetailLength);
|
||||||
|
if (StringUtils.length(detail) > expectedDetailLength) {
|
||||||
|
return trimmedDetail + TRIM_APPENDIX;
|
||||||
|
}
|
||||||
|
return trimmedDetail;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static UserDetails loadUserByUsername(final String username) {
|
||||||
|
final UserDetailsService userDetailsService = SpringContextHelper.getBean(UserDetailsService.class);
|
||||||
|
try {
|
||||||
|
final UserDetails loadUserByUsername = userDetailsService.loadUserByUsername(username);
|
||||||
|
if (loadUserByUsername == null) {
|
||||||
|
throw new UsernameNotFoundException("User not found " + username);
|
||||||
|
}
|
||||||
|
return loadUserByUsername;
|
||||||
|
} catch (final UsernameNotFoundException e) {
|
||||||
|
return new User(username, "", Collections.emptyList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -171,9 +171,7 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Label createHeaderCaption() {
|
private Label createHeaderCaption() {
|
||||||
final Label captionLabel = SPUIComponentProvider.getLabel(getDefaultCaption(),
|
return SPUIComponentProvider.getLabel(getDefaultCaption(), SPUILabelDefinitions.SP_WIDGET_CAPTION);
|
||||||
SPUILabelDefinitions.SP_WIDGET_CAPTION);
|
|
||||||
return captionLabel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected VerticalLayout getTabLayout() {
|
protected VerticalLayout getTabLayout() {
|
||||||
@@ -213,22 +211,22 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
|
|||||||
populateDetailsWidget();
|
populateDetailsWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateLogLayout(final VerticalLayout changeLogLayout, final Long lastModifiedAt,
|
protected void populateLog() {
|
||||||
final String lastModifiedBy, final Long createdAt, final String createdBy, final I18N i18n) {
|
logLayout.removeAllComponents();
|
||||||
changeLogLayout.removeAllComponents();
|
|
||||||
changeLogLayout.addComponent(SPUIComponentProvider.createNameValueLabel(i18n.get("label.created.at"),
|
|
||||||
createdAt == null ? "" : SPDateTimeUtil.getFormattedDate(createdAt)));
|
|
||||||
|
|
||||||
changeLogLayout.addComponent(SPUIComponentProvider.createNameValueLabel(i18n.get("label.created.by"),
|
logLayout.addComponent(SPUIComponentProvider.createNameValueLabel(i18n.get("label.created.at"),
|
||||||
createdBy == null ? "" : HawkbitCommonUtil.getIMUser(createdBy)));
|
SPDateTimeUtil.formatCreatedAt(selectedBaseEntity)));
|
||||||
|
|
||||||
if (null != lastModifiedAt) {
|
logLayout.addComponent(SPUIComponentProvider.createCreatedByLabel(i18n, selectedBaseEntity));
|
||||||
changeLogLayout.addComponent(SPUIComponentProvider.createNameValueLabel(i18n.get("label.modified.date"),
|
|
||||||
SPDateTimeUtil.getFormattedDate(lastModifiedAt)));
|
|
||||||
|
|
||||||
changeLogLayout.addComponent(SPUIComponentProvider.createNameValueLabel(i18n.get("label.modified.by"),
|
if (selectedBaseEntity == null || selectedBaseEntity.getLastModifiedAt() == null) {
|
||||||
lastModifiedBy == null ? "" : HawkbitCommonUtil.getIMUser(lastModifiedBy)));
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logLayout.addComponent(SPUIComponentProvider.createNameValueLabel(i18n.get("label.modified.date"),
|
||||||
|
SPDateTimeUtil.formatLastModifiedAt(selectedBaseEntity)));
|
||||||
|
|
||||||
|
logLayout.addComponent(SPUIComponentProvider.createLastModifiedByLabel(i18n, selectedBaseEntity));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateDescriptionLayout(final String descriptionLabel, final String description) {
|
protected void updateDescriptionLayout(final String descriptionLabel, final String description) {
|
||||||
@@ -320,19 +318,6 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
|
|||||||
return detailsLayout;
|
return detailsLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
public VerticalLayout getLogLayout() {
|
|
||||||
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() {
|
private void populateDescription() {
|
||||||
if (selectedBaseEntity != null) {
|
if (selectedBaseEntity != null) {
|
||||||
updateDescriptionLayout(i18n.get("label.description"), selectedBaseEntity.getDescription());
|
updateDescriptionLayout(i18n.get("label.description"), selectedBaseEntity.getDescription());
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ package org.eclipse.hawkbit.ui.common.table;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@@ -19,7 +20,7 @@ import javax.annotation.PreDestroy;
|
|||||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.common.ManagmentEntityState;
|
import org.eclipse.hawkbit.ui.common.ManagmentEntityState;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
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.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
@@ -211,9 +212,9 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table {
|
|||||||
item.getItemProperty(SPUILabelDefinitions.VAR_ID).setValue(baseEntity.getId());
|
item.getItemProperty(SPUILabelDefinitions.VAR_ID).setValue(baseEntity.getId());
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_DESC).setValue(baseEntity.getDescription());
|
item.getItemProperty(SPUILabelDefinitions.VAR_DESC).setValue(baseEntity.getDescription());
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_CREATED_BY)
|
item.getItemProperty(SPUILabelDefinitions.VAR_CREATED_BY)
|
||||||
.setValue(HawkbitCommonUtil.getIMUser(baseEntity.getCreatedBy()));
|
.setValue(UserDetailsFormatter.loadAndFormatCreatedBy(baseEntity));
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY)
|
item.getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY)
|
||||||
.setValue(HawkbitCommonUtil.getIMUser(baseEntity.getLastModifiedBy()));
|
.setValue(UserDetailsFormatter.loadAndFormatLastModifiedBy(baseEntity));
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_CREATED_DATE)
|
item.getItemProperty(SPUILabelDefinitions.VAR_CREATED_DATE)
|
||||||
.setValue(SPDateTimeUtil.getFormattedDate(baseEntity.getCreatedAt()));
|
.setValue(SPDateTimeUtil.getFormattedDate(baseEntity.getCreatedAt()));
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE)
|
item.getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE)
|
||||||
@@ -231,6 +232,30 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 E findEntityByTableValue(I lastSelectedId);
|
||||||
|
|
||||||
protected abstract void publishEntityAfterValueChange(E selectedLastEntity);
|
protected abstract void publishEntityAfterValueChange(E selectedLastEntity);
|
||||||
@@ -304,6 +329,17 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table {
|
|||||||
columnList.add(
|
columnList.add(
|
||||||
new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, i18n.get("header.modifiedDate"), 0.1F));
|
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));
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_DESC, i18n.get("header.description"), 0.2F));
|
||||||
|
setItemDescriptionGenerator((source, itemId, propertyId) -> {
|
||||||
|
|
||||||
|
if (SPUILabelDefinitions.VAR_CREATED_BY.equals(propertyId)) {
|
||||||
|
return getItem(itemId).getItemProperty(SPUILabelDefinitions.VAR_CREATED_BY).getValue().toString();
|
||||||
|
}
|
||||||
|
if (SPUILabelDefinitions.VAR_LAST_MODIFIED_BY.equals(propertyId)) {
|
||||||
|
return getItem(itemId).getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY).getValue().toString();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
|
||||||
return columnList;
|
return columnList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ public class ProxyTarget extends Target {
|
|||||||
|
|
||||||
private DistributionSet installedDistributionSet;
|
private DistributionSet installedDistributionSet;
|
||||||
|
|
||||||
|
private DistributionSet assignedDistributionSet;
|
||||||
|
|
||||||
private TargetIdName targetIdName;
|
private TargetIdName targetIdName;
|
||||||
|
|
||||||
private String assignedDistNameVersion;
|
private String assignedDistNameVersion;
|
||||||
@@ -249,6 +251,21 @@ public class ProxyTarget extends Target {
|
|||||||
this.installedDistributionSet = installedDistributionSet;
|
this.installedDistributionSet = installedDistributionSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the assignedDistributionSet
|
||||||
|
*/
|
||||||
|
public DistributionSet getAssignedDistributionSet() {
|
||||||
|
return assignedDistributionSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param assignedDistributionSet
|
||||||
|
* the assignedDistributionSet to set
|
||||||
|
*/
|
||||||
|
public void setAssignedDistributionSet(DistributionSet assignedDistributionSet) {
|
||||||
|
this.assignedDistributionSet = assignedDistributionSet;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the targetIdName
|
* @return the targetIdName
|
||||||
*/
|
*/
|
||||||
@@ -297,4 +314,5 @@ public class ProxyTarget extends Target {
|
|||||||
public void setStatus(final Status status) {
|
public void setStatus(final Status status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ import java.util.Arrays;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
|
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonDecorator;
|
import org.eclipse.hawkbit.ui.decorators.SPUIButtonDecorator;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIComboBoxDecorator;
|
import org.eclipse.hawkbit.ui.decorators.SPUIComboBoxDecorator;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIHeaderLayoutDecorator;
|
import org.eclipse.hawkbit.ui.decorators.SPUIHeaderLayoutDecorator;
|
||||||
@@ -20,6 +22,7 @@ import org.eclipse.hawkbit.ui.decorators.SPUILabelDecorator;
|
|||||||
import org.eclipse.hawkbit.ui.decorators.SPUITextAreaDecorator;
|
import org.eclipse.hawkbit.ui.decorators.SPUITextAreaDecorator;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUITextFieldDecorator;
|
import org.eclipse.hawkbit.ui.decorators.SPUITextFieldDecorator;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIWindowDecorator;
|
import org.eclipse.hawkbit.ui.decorators.SPUIWindowDecorator;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -328,6 +331,50 @@ public final class SPUIComponentProvider {
|
|||||||
return nameValueLabel;
|
return nameValueLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Label createUsernameLabel(final String label, final String username) {
|
||||||
|
String loadAndFormatUsername = StringUtils.EMPTY;
|
||||||
|
if (!StringUtils.isEmpty(username)) {
|
||||||
|
loadAndFormatUsername = UserDetailsFormatter.loadAndFormatUsername(username);
|
||||||
|
}
|
||||||
|
|
||||||
|
final Label nameValueLabel = new Label(getBoldHTMLText(label) + loadAndFormatUsername, ContentMode.HTML);
|
||||||
|
nameValueLabel.setSizeFull();
|
||||||
|
nameValueLabel.addStyleName(SPUIDefinitions.TEXT_STYLE);
|
||||||
|
nameValueLabel.addStyleName("label-style");
|
||||||
|
nameValueLabel.setDescription(loadAndFormatUsername);
|
||||||
|
return nameValueLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create label which represents the {@link BaseEntity#getCreatedBy()} by
|
||||||
|
* user name
|
||||||
|
*
|
||||||
|
* @param i18n
|
||||||
|
* the i18n
|
||||||
|
* @param baseEntity
|
||||||
|
* the entity
|
||||||
|
* @return the label
|
||||||
|
*/
|
||||||
|
public static Label createCreatedByLabel(final I18N i18n, final BaseEntity baseEntity) {
|
||||||
|
return createUsernameLabel(i18n.get("label.created.by"),
|
||||||
|
baseEntity == null ? StringUtils.EMPTY : baseEntity.getCreatedBy());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create label which represents the
|
||||||
|
* {@link BaseEntity#getLastModifiedBy()()} by user name
|
||||||
|
*
|
||||||
|
* @param i18n
|
||||||
|
* the i18n
|
||||||
|
* @param baseEntity
|
||||||
|
* the entity
|
||||||
|
* @return the label
|
||||||
|
*/
|
||||||
|
public static Label createLastModifiedByLabel(final I18N i18n, final BaseEntity baseEntity) {
|
||||||
|
return createUsernameLabel(i18n.get("label.modified.by"),
|
||||||
|
baseEntity == null ? StringUtils.EMPTY : baseEntity.getLastModifiedBy());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Bold Text.
|
* Get Bold Text.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -299,6 +299,7 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
|
|||||||
mainWindowLayout.addComponent(colorLayout);
|
mainWindowLayout.addComponent(colorLayout);
|
||||||
mainWindowLayout.addComponent(buttonLayout);
|
mainWindowLayout.addComponent(buttonLayout);
|
||||||
setCompositionRoot(mainWindowLayout);
|
setCompositionRoot(mainWindowLayout);
|
||||||
|
typeName.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
private HorizontalLayout createTwinColumnLayout() {
|
private HorizontalLayout createTwinColumnLayout() {
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ 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.AbstractNamedVersionTable;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
||||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
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;
|
||||||
@@ -210,15 +211,9 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
|
|||||||
|
|
||||||
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();
|
||||||
|
|
||||||
@@ -229,11 +224,6 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @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();
|
||||||
@@ -459,12 +449,8 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
protected Item addEntity(final DistributionSet baseEntity) {
|
protected Item addEntity(final DistributionSet baseEntity) {
|
||||||
final Item item = super.addEntity(baseEntity);
|
final Item item = super.addEntity(baseEntity);
|
||||||
item.getItemProperty(SPUILabelDefinitions.DIST_ID).setValue(baseEntity.getId());
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_IS_DISTRIBUTION_COMPLETE).setValue(baseEntity.isComplete());
|
|
||||||
|
|
||||||
if (manageDistUIState.getSelectedDistributions().isPresent()) {
|
if (manageDistUIState.getSelectedDistributions().isPresent()) {
|
||||||
manageDistUIState.getSelectedDistributions().get().stream().forEach(this::unselect);
|
manageDistUIState.getSelectedDistributions().get().stream().forEach(this::unselect);
|
||||||
}
|
}
|
||||||
@@ -472,6 +458,14 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
protected void updateEntity(final DistributionSet baseEntity, final Item item) {
|
||||||
|
item.getItemProperty(SPUILabelDefinitions.DIST_ID).setValue(baseEntity.getId());
|
||||||
|
item.getItemProperty(SPUILabelDefinitions.VAR_IS_DISTRIBUTION_COMPLETE).setValue(baseEntity.isComplete());
|
||||||
|
super.updateEntity(baseEntity, item);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setDataAvailable(final boolean available) {
|
protected void setDataAvailable(final boolean available) {
|
||||||
manageDistUIState.setNoDataAvailableDist(!available);
|
manageDistUIState.setNoDataAvailableDist(!available);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
|||||||
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
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.ui.common.UserDetailsFormatter;
|
||||||
import org.eclipse.hawkbit.ui.components.ProxyDistribution;
|
import org.eclipse.hawkbit.ui.components.ProxyDistribution;
|
||||||
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;
|
||||||
@@ -113,8 +114,8 @@ public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
|
|||||||
proxyDistribution.setCreatedDate(SPDateTimeUtil.getFormattedDate(distributionSet.getCreatedAt()));
|
proxyDistribution.setCreatedDate(SPDateTimeUtil.getFormattedDate(distributionSet.getCreatedAt()));
|
||||||
proxyDistribution.setLastModifiedDate(SPDateTimeUtil.getFormattedDate(distributionSet.getLastModifiedAt()));
|
proxyDistribution.setLastModifiedDate(SPDateTimeUtil.getFormattedDate(distributionSet.getLastModifiedAt()));
|
||||||
proxyDistribution.setDescription(distributionSet.getDescription());
|
proxyDistribution.setDescription(distributionSet.getDescription());
|
||||||
proxyDistribution.setCreatedByUser(HawkbitCommonUtil.getIMUser(distributionSet.getCreatedBy()));
|
proxyDistribution.setCreatedByUser(UserDetailsFormatter.loadAndFormatCreatedBy(distributionSet));
|
||||||
proxyDistribution.setModifiedByUser(HawkbitCommonUtil.getIMUser(distributionSet.getLastModifiedBy()));
|
proxyDistribution.setModifiedByUser(UserDetailsFormatter.loadAndFormatLastModifiedBy(distributionSet));
|
||||||
proxyDistribution.setIsComplete(distributionSet.isComplete());
|
proxyDistribution.setIsComplete(distributionSet.isComplete());
|
||||||
proxyDistributions.add(proxyDistribution);
|
proxyDistributions.add(proxyDistribution);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -188,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
|
||||||
@@ -224,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();
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import org.eclipse.hawkbit.repository.SoftwareManagement;
|
|||||||
import org.eclipse.hawkbit.repository.model.CustomSoftwareModule;
|
import org.eclipse.hawkbit.repository.model.CustomSoftwareModule;
|
||||||
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.UserDetailsFormatter;
|
||||||
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;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
@@ -99,8 +100,8 @@ public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem>
|
|||||||
proxyItem.setVersion(bean.getVersion());
|
proxyItem.setVersion(bean.getVersion());
|
||||||
proxyItem.setVendor(bean.getVendor());
|
proxyItem.setVendor(bean.getVendor());
|
||||||
proxyItem.setDescription(bean.getDescription());
|
proxyItem.setDescription(bean.getDescription());
|
||||||
proxyItem.setCreatedByUser(HawkbitCommonUtil.getIMUser(bean.getCreatedBy()));
|
proxyItem.setCreatedByUser(UserDetailsFormatter.loadAndFormatCreatedBy(bean));
|
||||||
proxyItem.setModifiedByUser(HawkbitCommonUtil.getIMUser(bean.getLastModifiedBy()));
|
proxyItem.setModifiedByUser(UserDetailsFormatter.loadAndFormatLastModifiedBy(bean));
|
||||||
proxyItem.setAssigned(customSoftwareModule.isAssigned());
|
proxyItem.setAssigned(customSoftwareModule.isAssigned());
|
||||||
proxyItem.setColour(bean.getType().getColour());
|
proxyItem.setColour(bean.getType().getColour());
|
||||||
proxyItem.setTypeId(bean.getType().getId());
|
proxyItem.setTypeId(bean.getType().getId());
|
||||||
|
|||||||
@@ -324,17 +324,9 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
protected Item addEntity(final SoftwareModule baseEntity) {
|
protected Item addEntity(final SoftwareModule baseEntity) {
|
||||||
final Item item = super.addEntity(baseEntity);
|
final Item item = super.addEntity(baseEntity);
|
||||||
|
|
||||||
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());
|
|
||||||
|
|
||||||
if (!manageDistUIState.getSelectedSoftwareModules().isEmpty()) {
|
if (!manageDistUIState.getSelectedSoftwareModules().isEmpty()) {
|
||||||
manageDistUIState.getSelectedSoftwareModules().stream().forEach(this::unselect);
|
manageDistUIState.getSelectedSoftwareModules().stream().forEach(this::unselect);
|
||||||
}
|
}
|
||||||
@@ -342,6 +334,18 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
|
|||||||
return item;
|
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) {
|
||||||
final Window atrifactDtlsWindow = new Window();
|
final Window atrifactDtlsWindow = new Window();
|
||||||
atrifactDtlsWindow.setCaption(HawkbitCommonUtil.getArtifactoryDetailsLabelId(nameVersionStr));
|
atrifactDtlsWindow.setCaption(HawkbitCommonUtil.getArtifactoryDetailsLabelId(nameVersionStr));
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.filtermanagement;
|
package org.eclipse.hawkbit.ui.filtermanagement;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -17,10 +18,12 @@ import java.util.Map;
|
|||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.annotation.PreDestroy;
|
import javax.annotation.PreDestroy;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.filtermanagement.event.CustomFilterUIEvent;
|
import org.eclipse.hawkbit.ui.filtermanagement.event.CustomFilterUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.filtermanagement.state.FilterManagementUIState;
|
import org.eclipse.hawkbit.ui.filtermanagement.state.FilterManagementUIState;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.AssignInstalledDSTooltipGenerator;
|
||||||
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;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
@@ -69,6 +72,10 @@ public class CreateOrUpdateFilterTable extends Table {
|
|||||||
|
|
||||||
private static final int PROPERTY_DEPT = 3;
|
private static final int PROPERTY_DEPT = 3;
|
||||||
|
|
||||||
|
private static final String ASSIGN_DIST_SET = "assignedDistributionSet";
|
||||||
|
|
||||||
|
private static final String INSTALL_DIST_SET = "installedDistributionSet";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the Action History Table.
|
* Initialize the Action History Table.
|
||||||
*/
|
*/
|
||||||
@@ -87,6 +94,7 @@ public class CreateOrUpdateFilterTable extends Table {
|
|||||||
setId(SPUIComponetIdProvider.CUSTOM_FILTER_TARGET_TABLE_ID);
|
setId(SPUIComponetIdProvider.CUSTOM_FILTER_TARGET_TABLE_ID);
|
||||||
setSelectable(false);
|
setSelectable(false);
|
||||||
eventBus.subscribe(this);
|
eventBus.subscribe(this);
|
||||||
|
setItemDescriptionGenerator(new AssignInstalledDSTooltipGenerator());
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreDestroy
|
@PreDestroy
|
||||||
@@ -160,6 +168,9 @@ public class CreateOrUpdateFilterTable extends Table {
|
|||||||
private void setCollapsibleColumns() {
|
private void setCollapsibleColumns() {
|
||||||
setColumnCollapsed(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, true);
|
setColumnCollapsed(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, true);
|
||||||
setColumnCollapsed(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, true);
|
setColumnCollapsed(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, true);
|
||||||
|
|
||||||
|
setColumnCollapsed(ASSIGN_DIST_SET, true);
|
||||||
|
setColumnCollapsed(INSTALL_DIST_SET, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -172,10 +183,13 @@ public class CreateOrUpdateFilterTable extends Table {
|
|||||||
container.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, Date.class, null);
|
container.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, Date.class, null);
|
||||||
container.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, String.class, null, false, true);
|
container.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, String.class, null, false, true);
|
||||||
container.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, String.class, null, false, true);
|
container.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, String.class, null, false, true);
|
||||||
container.addContainerProperty(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER, String.class, "");
|
|
||||||
container.addContainerProperty(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER, String.class, null);
|
|
||||||
container.addContainerProperty(SPUILabelDefinitions.VAR_TARGET_STATUS, TargetUpdateStatus.class, null);
|
container.addContainerProperty(SPUILabelDefinitions.VAR_TARGET_STATUS, TargetUpdateStatus.class, null);
|
||||||
container.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, "", false, true);
|
container.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, "", false, true);
|
||||||
|
|
||||||
|
container.addContainerProperty(ASSIGN_DIST_SET, DistributionSet.class, null, false, true);
|
||||||
|
container.addContainerProperty(INSTALL_DIST_SET, DistributionSet.class, null, false, true);
|
||||||
|
container.addContainerProperty(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER, String.class, "");
|
||||||
|
container.addContainerProperty(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER, String.class, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<TableColumn> getVisbleColumns() {
|
private List<TableColumn> getVisbleColumns() {
|
||||||
@@ -186,12 +200,12 @@ public class CreateOrUpdateFilterTable extends Table {
|
|||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, i18n.get("header.modifiedBy"), 0.1F));
|
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, i18n.get("header.modifiedBy"), 0.1F));
|
||||||
columnList.add(
|
columnList.add(
|
||||||
new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, i18n.get("header.modifiedDate"), 0.1F));
|
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.1F));
|
||||||
|
columnList.add(new TableColumn(SPUILabelDefinitions.STATUS_ICON, i18n.get("header.status"), 0.1F));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER,
|
columnList.add(new TableColumn(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER,
|
||||||
i18n.get("header.assigned.ds"), 0.125F));
|
i18n.get("header.assigned.ds"), 0.125F));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER,
|
columnList.add(new TableColumn(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER,
|
||||||
i18n.get("header.installed.ds"), 0.125F));
|
i18n.get("header.installed.ds"), 0.125F));
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_DESC, i18n.get("header.description"), 0.1F));
|
|
||||||
columnList.add(new TableColumn(SPUILabelDefinitions.STATUS_ICON, i18n.get("header.status"), 0.1F));
|
|
||||||
return columnList;
|
return columnList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,4 +258,5 @@ public class CreateOrUpdateFilterTable extends Table {
|
|||||||
populateTableData();
|
populateTableData();
|
||||||
eventBus.publish(this, CustomFilterUIEvent.UPDATE_TARGET_FILTER_SEARCH_ICON);
|
eventBus.publish(this, CustomFilterUIEvent.UPDATE_TARGET_FILTER_SEARCH_ICON);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import java.util.Map;
|
|||||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
|
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||||
import org.eclipse.hawkbit.ui.components.ProxyTarget;
|
import org.eclipse.hawkbit.ui.components.ProxyTarget;
|
||||||
import org.eclipse.hawkbit.ui.filtermanagement.state.FilterManagementUIState;
|
import org.eclipse.hawkbit.ui.filtermanagement.state.FilterManagementUIState;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
@@ -118,8 +119,8 @@ public class CustomTargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
|
|||||||
prxyTarget.setLastModifiedDate(SPDateTimeUtil.getFormattedDate(targ.getLastModifiedAt()));
|
prxyTarget.setLastModifiedDate(SPDateTimeUtil.getFormattedDate(targ.getLastModifiedAt()));
|
||||||
prxyTarget.setCreatedDate(SPDateTimeUtil.getFormattedDate(targ.getCreatedAt()));
|
prxyTarget.setCreatedDate(SPDateTimeUtil.getFormattedDate(targ.getCreatedAt()));
|
||||||
prxyTarget.setCreatedAt(targ.getCreatedAt());
|
prxyTarget.setCreatedAt(targ.getCreatedAt());
|
||||||
prxyTarget.setCreatedByUser(HawkbitCommonUtil.getIMUser(targ.getCreatedBy()));
|
prxyTarget.setCreatedByUser(UserDetailsFormatter.loadAndFormatCreatedBy(targ));
|
||||||
prxyTarget.setModifiedByUser(HawkbitCommonUtil.getIMUser(targ.getLastModifiedBy()));
|
prxyTarget.setModifiedByUser(UserDetailsFormatter.loadAndFormatLastModifiedBy(targ));
|
||||||
final Target target = getTargetManagement().findTargetByControllerIDWithDetails(targ.getControllerId());
|
final Target target = getTargetManagement().findTargetByControllerIDWithDetails(targ.getControllerId());
|
||||||
final DistributionSet installedDistributionSet = target.getTargetInfo().getInstalledDistributionSet();
|
final DistributionSet installedDistributionSet = target.getTargetInfo().getInstalledDistributionSet();
|
||||||
prxyTarget.setInstalledDistributionSet(installedDistributionSet);
|
prxyTarget.setInstalledDistributionSet(installedDistributionSet);
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||||
|
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||||
import org.eclipse.hawkbit.ui.components.ProxyTargetFilter;
|
import org.eclipse.hawkbit.ui.components.ProxyTargetFilter;
|
||||||
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;
|
||||||
@@ -93,9 +94,9 @@ public class TargetFilterBeanQuery extends AbstractBeanQuery<ProxyTargetFilter>
|
|||||||
proxyTarFilter.setName(tarFilterQuery.getName());
|
proxyTarFilter.setName(tarFilterQuery.getName());
|
||||||
proxyTarFilter.setId(tarFilterQuery.getId());
|
proxyTarFilter.setId(tarFilterQuery.getId());
|
||||||
proxyTarFilter.setCreatedDate(SPDateTimeUtil.getFormattedDate(tarFilterQuery.getCreatedAt()));
|
proxyTarFilter.setCreatedDate(SPDateTimeUtil.getFormattedDate(tarFilterQuery.getCreatedAt()));
|
||||||
proxyTarFilter.setCreatedBy(HawkbitCommonUtil.getIMUser(tarFilterQuery.getCreatedBy()));
|
proxyTarFilter.setCreatedBy(UserDetailsFormatter.loadAndFormatCreatedBy(tarFilterQuery));
|
||||||
proxyTarFilter.setModifiedDate(SPDateTimeUtil.getFormattedDate(tarFilterQuery.getLastModifiedAt()));
|
proxyTarFilter.setModifiedDate(SPDateTimeUtil.getFormattedDate(tarFilterQuery.getLastModifiedAt()));
|
||||||
proxyTarFilter.setLastModifiedBy(HawkbitCommonUtil.getIMUser(tarFilterQuery.getLastModifiedBy()));
|
proxyTarFilter.setLastModifiedBy(UserDetailsFormatter.loadAndFormatLastModifiedBy(tarFilterQuery));
|
||||||
proxyTarFilter.setQuery(tarFilterQuery.getQuery());
|
proxyTarFilter.setQuery(tarFilterQuery.getQuery());
|
||||||
proxyTargetFilter.add(proxyTarFilter);
|
proxyTargetFilter.add(proxyTarFilter);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,8 +148,9 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
|
|||||||
|
|
||||||
addComponent(buttonsLayout);
|
addComponent(buttonsLayout);
|
||||||
setComponentAlignment(madatoryLabel, Alignment.MIDDLE_LEFT);
|
setComponentAlignment(madatoryLabel, Alignment.MIDDLE_LEFT);
|
||||||
|
distNameTextField.focus();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create required UI components.
|
* Create required UI components.
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import org.eclipse.hawkbit.repository.DistributionSetFilter.DistributionSetFilte
|
|||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
|
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||||
import org.eclipse.hawkbit.ui.components.ProxyDistribution;
|
import org.eclipse.hawkbit.ui.components.ProxyDistribution;
|
||||||
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;
|
||||||
@@ -129,8 +130,8 @@ public class DistributionBeanQuery extends AbstractBeanQuery<ProxyDistribution>
|
|||||||
proxyDistribution.setCreatedDate(SPDateTimeUtil.getFormattedDate(distributionSet.getCreatedAt()));
|
proxyDistribution.setCreatedDate(SPDateTimeUtil.getFormattedDate(distributionSet.getCreatedAt()));
|
||||||
proxyDistribution.setLastModifiedDate(SPDateTimeUtil.getFormattedDate(distributionSet.getLastModifiedAt()));
|
proxyDistribution.setLastModifiedDate(SPDateTimeUtil.getFormattedDate(distributionSet.getLastModifiedAt()));
|
||||||
proxyDistribution.setDescription(distributionSet.getDescription());
|
proxyDistribution.setDescription(distributionSet.getDescription());
|
||||||
proxyDistribution.setCreatedByUser(HawkbitCommonUtil.getIMUser(distributionSet.getCreatedBy()));
|
proxyDistribution.setCreatedByUser(UserDetailsFormatter.loadAndFormatCreatedBy(distributionSet));
|
||||||
proxyDistribution.setModifiedByUser(HawkbitCommonUtil.getIMUser(distributionSet.getLastModifiedBy()));
|
proxyDistribution.setModifiedByUser(UserDetailsFormatter.loadAndFormatLastModifiedBy(distributionSet));
|
||||||
proxyDistribution.setNameVersion(
|
proxyDistribution.setNameVersion(
|
||||||
HawkbitCommonUtil.getFormattedNameVersion(distributionSet.getName(), distributionSet.getVersion()));
|
HawkbitCommonUtil.getFormattedNameVersion(distributionSet.getName(), distributionSet.getVersion()));
|
||||||
proxyDistributions.add(proxyDistribution);
|
proxyDistributions.add(proxyDistribution);
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ 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.AbstractNamedVersionTable;
|
||||||
|
import org.eclipse.hawkbit.ui.common.table.AbstractTable;
|
||||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
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;
|
||||||
@@ -350,17 +351,12 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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 = getTableValue(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();
|
||||||
|
|
||||||
|
|||||||
@@ -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()) {
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
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;
|
||||||
@@ -258,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 = AbstractTable.getTableValue(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();
|
||||||
@@ -273,32 +267,38 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
|
|||||||
distributionIdNameSet.remove(dsInBulkUpload);
|
distributionIdNameSet.remove(dsInBulkUpload);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!distributionIdNameSet.isEmpty()) {
|
if (distributionIdNameSet.isEmpty()) {
|
||||||
|
return;
|
||||||
/*
|
|
||||||
* 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();
|
|
||||||
managementUIState.getDeletedDistributionList().addAll(distributionIdNameSet);
|
|
||||||
final int newDeletedDistributionsSize = managementUIState.getDeletedDistributionList().size();
|
|
||||||
if (newDeletedDistributionsSize == existingDeletedDistributionsSize) {
|
|
||||||
/*
|
|
||||||
* No new distributions are added, all distributions dropped now
|
|
||||||
* are already available in the delete list. Hence display
|
|
||||||
* warning message accordingly.
|
|
||||||
*/
|
|
||||||
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"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
checkDeletedDistributionSets(distributionIdNameSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkDeletedDistributionSets(final Set<DistributionSetIdName> distributionIdNameSet) {
|
||||||
|
final int existingDeletedDistributionsSize = managementUIState.getDeletedDistributionList().size();
|
||||||
|
managementUIState.getDeletedDistributionList().addAll(distributionIdNameSet);
|
||||||
|
final int newDeletedDistributionsSize = managementUIState.getDeletedDistributionList().size();
|
||||||
|
|
||||||
|
showAlreadyDeletedDistributionSetNotfication(existingDeletedDistributionsSize, newDeletedDistributionsSize,
|
||||||
|
"message.dists.already.deleted");
|
||||||
|
showPendingDeletedNotifaction(distributionIdNameSet, existingDeletedDistributionsSize,
|
||||||
|
newDeletedDistributionsSize, "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,
|
||||||
@@ -312,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 = AbstractTable.getTableValue(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() {
|
||||||
|
|||||||
@@ -238,6 +238,7 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
|
|||||||
fieldLayout.addComponent(tagName);
|
fieldLayout.addComponent(tagName);
|
||||||
fieldLayout.addComponent(tagDesc);
|
fieldLayout.addComponent(tagDesc);
|
||||||
|
|
||||||
|
|
||||||
final HorizontalLayout colorLabelLayout = new HorizontalLayout();
|
final HorizontalLayout colorLabelLayout = new HorizontalLayout();
|
||||||
colorLabelLayout.addComponents(colorLabel, tagColorPreviewBtn);
|
colorLabelLayout.addComponents(colorLabel, tagColorPreviewBtn);
|
||||||
fieldLayout.addComponent(colorLabelLayout);
|
fieldLayout.addComponent(colorLabelLayout);
|
||||||
@@ -257,8 +258,8 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
|
|||||||
|
|
||||||
mainLayout = new HorizontalLayout();
|
mainLayout = new HorizontalLayout();
|
||||||
mainLayout.addComponent(fieldButtonLayout);
|
mainLayout.addComponent(fieldButtonLayout);
|
||||||
|
|
||||||
setCompositionRoot(mainLayout);
|
setCompositionRoot(mainLayout);
|
||||||
|
tagName.focus();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
|
|||||||
madatoryLabel.setVisible(Boolean.FALSE);
|
madatoryLabel.setVisible(Boolean.FALSE);
|
||||||
}
|
}
|
||||||
mainLayout.addComponents(madatoryLabel, controllerIDTextField, nameTextField, descTextArea, buttonsLayout);
|
mainLayout.addComponents(madatoryLabel, controllerIDTextField, nameTextField, descTextArea, buttonsLayout);
|
||||||
|
nameTextField.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addListeners() {
|
private void addListeners() {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
|
|||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||||
|
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||||
import org.eclipse.hawkbit.ui.components.ProxyTarget;
|
import org.eclipse.hawkbit.ui.components.ProxyTarget;
|
||||||
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;
|
||||||
@@ -130,20 +131,24 @@ public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
|
|||||||
prxyTarget.setLastModifiedDate(SPDateTimeUtil.getFormattedDate(targ.getLastModifiedAt()));
|
prxyTarget.setLastModifiedDate(SPDateTimeUtil.getFormattedDate(targ.getLastModifiedAt()));
|
||||||
prxyTarget.setCreatedDate(SPDateTimeUtil.getFormattedDate(targ.getCreatedAt()));
|
prxyTarget.setCreatedDate(SPDateTimeUtil.getFormattedDate(targ.getCreatedAt()));
|
||||||
prxyTarget.setCreatedAt(targ.getCreatedAt());
|
prxyTarget.setCreatedAt(targ.getCreatedAt());
|
||||||
prxyTarget.setCreatedByUser(HawkbitCommonUtil.getIMUser(targ.getCreatedBy()));
|
prxyTarget.setCreatedByUser(UserDetailsFormatter.loadAndFormatCreatedBy(targ));
|
||||||
prxyTarget.setModifiedByUser(HawkbitCommonUtil.getIMUser(targ.getLastModifiedBy()));
|
prxyTarget.setModifiedByUser(UserDetailsFormatter.loadAndFormatLastModifiedBy(targ));
|
||||||
|
|
||||||
if (pinnedDistId == null) {
|
final Target target = getTargetManagement().findTargetByControllerIDWithDetails(targ.getControllerId());
|
||||||
prxyTarget.setInstalledDistributionSet(null);
|
final DistributionSet installedDistributionSet = target.getTargetInfo().getInstalledDistributionSet();
|
||||||
prxyTarget.setAssignedDistributionSet(null);
|
final DistributionSet assignedDistributionSet = target.getAssignedDistributionSet();
|
||||||
} else {
|
|
||||||
final Target target = getTargetManagement().findTargetByControllerIDWithDetails(targ.getControllerId());
|
prxyTarget.setInstalledDistributionSet(installedDistributionSet);
|
||||||
final DistributionSet installedDistributionSet = target.getTargetInfo().getInstalledDistributionSet();
|
prxyTarget.setAssignedDistributionSet(assignedDistributionSet);
|
||||||
prxyTarget.setInstalledDistributionSet(installedDistributionSet);
|
|
||||||
final DistributionSet assignedDistributionSet = target.getAssignedDistributionSet();
|
if (installedDistributionSet != null) {
|
||||||
prxyTarget.setAssignedDistributionSet(assignedDistributionSet);
|
prxyTarget.setInstalledDistNameVersion(HawkbitCommonUtil.getFormattedNameVersion(
|
||||||
|
installedDistributionSet.getName(), installedDistributionSet.getVersion()));
|
||||||
|
}
|
||||||
|
if (assignedDistributionSet != null) {
|
||||||
|
prxyTarget.setAssignedDistNameVersion(HawkbitCommonUtil.getFormattedNameVersion(
|
||||||
|
assignedDistributionSet.getName(), assignedDistributionSet.getVersion()));
|
||||||
}
|
}
|
||||||
|
|
||||||
prxyTarget.setUpdateStatus(targ.getTargetInfo().getUpdateStatus());
|
prxyTarget.setUpdateStatus(targ.getTargetInfo().getUpdateStatus());
|
||||||
prxyTarget.setLastTargetQuery(targ.getTargetInfo().getLastTargetQuery());
|
prxyTarget.setLastTargetQuery(targ.getTargetInfo().getLastTargetQuery());
|
||||||
prxyTarget.setTargetInfo(targ.getTargetInfo());
|
prxyTarget.setTargetInfo(targ.getTargetInfo());
|
||||||
|
|||||||
@@ -24,7 +24,9 @@ import org.eclipse.hawkbit.eventbus.event.TargetInfoUpdateEvent;
|
|||||||
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
||||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||||
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
|
||||||
|
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.TargetFilterQuery;
|
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||||
@@ -32,6 +34,7 @@ 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.ManagmentEntityState;
|
||||||
|
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||||
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.common.table.BaseEntityEventType;
|
||||||
import org.eclipse.hawkbit.ui.filter.FilterExpression;
|
import org.eclipse.hawkbit.ui.filter.FilterExpression;
|
||||||
@@ -51,6 +54,7 @@ import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
|||||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentEvent;
|
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.management.state.TargetTableFilters;
|
import org.eclipse.hawkbit.ui.management.state.TargetTableFilters;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.AssignInstalledDSTooltipGenerator;
|
||||||
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;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||||
@@ -107,9 +111,9 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> implements
|
|||||||
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;
|
||||||
|
|
||||||
@@ -137,6 +141,7 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> implements
|
|||||||
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"));
|
||||||
|
setItemDescriptionGenerator(new AssignInstalledDSTooltipGenerator());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -330,6 +335,11 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> implements
|
|||||||
if (!isMaximized()) {
|
if (!isMaximized()) {
|
||||||
columnList.add(new TableColumn(SPUIDefinitions.TARGET_STATUS_POLL_TIME, "", 0.0F));
|
columnList.add(new TableColumn(SPUIDefinitions.TARGET_STATUS_POLL_TIME, "", 0.0F));
|
||||||
columnList.add(new TableColumn(SPUIDefinitions.TARGET_STATUS_PIN_TOGGLE_ICON, "", 0.0F));
|
columnList.add(new TableColumn(SPUIDefinitions.TARGET_STATUS_PIN_TOGGLE_ICON, "", 0.0F));
|
||||||
|
}else{
|
||||||
|
columnList.add(new TableColumn(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER,
|
||||||
|
i18n.get("header.assigned.ds"), 0.1F));
|
||||||
|
columnList.add(new TableColumn(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER,
|
||||||
|
i18n.get("header.installed.ds"), 0.1F));
|
||||||
}
|
}
|
||||||
return columnList;
|
return columnList;
|
||||||
|
|
||||||
@@ -634,14 +644,9 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> implements
|
|||||||
|
|
||||||
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 = getTableValue(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) {
|
||||||
@@ -745,7 +750,7 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> implements
|
|||||||
.setValue(updatedTarget.getTargetInfo().getLastTargetQuery());
|
.setValue(updatedTarget.getTargetInfo().getLastTargetQuery());
|
||||||
|
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY)
|
item.getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY)
|
||||||
.setValue(HawkbitCommonUtil.getIMUser(updatedTarget.getLastModifiedBy()));
|
.setValue(UserDetailsFormatter.loadAndFormatLastModifiedBy(updatedTarget));
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE)
|
item.getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE)
|
||||||
.setValue(SPDateTimeUtil.getFormattedDate(updatedTarget.getLastModifiedAt()));
|
.setValue(SPDateTimeUtil.getFormattedDate(updatedTarget.getLastModifiedAt()));
|
||||||
item.getItemProperty(SPUILabelDefinitions.VAR_DESC).setValue(updatedTarget.getDescription());
|
item.getItemProperty(SPUILabelDefinitions.VAR_DESC).setValue(updatedTarget.getDescription());
|
||||||
@@ -858,6 +863,7 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> implements
|
|||||||
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();
|
||||||
@@ -880,8 +886,8 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> implements
|
|||||||
* @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;
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
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;
|
||||||
@@ -379,15 +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 = AbstractTable.getTableValue(transferable.getSourceComponent());
|
@SuppressWarnings("unchecked")
|
||||||
final Set<DistributionSetIdName> distributionIdSet = new HashSet<>();
|
final AbstractTable<?, DistributionSetIdName> distTable = (AbstractTable<?, DistributionSetIdName>) transferable.getSourceComponent();
|
||||||
if (!distSelected.contains(transferable.getData("itemId"))) {
|
return distTable.getDeletedEntityByTransferable(transferable);
|
||||||
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;
|
||||||
@@ -79,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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -213,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 = AbstractTable.getTableValue(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);
|
||||||
|
notification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(targTagName, result, i18n));
|
||||||
|
|
||||||
final TargetTagAssignmentResult result = targetManagement.toggleTagAssignment(targetList, targTagName);
|
publishAssignTargetTagEvent(result);
|
||||||
notification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(targTagName, result, i18n));
|
|
||||||
|
|
||||||
if (result.getAssigned() >= 1 && managementUIState.getTargetTableFilters().isNoTagSelected()) {
|
publishUnAssignTargetTagEvent(targTagName, result);
|
||||||
eventBus.publish(this, ManagementUIEvent.ASSIGN_TARGET_TAG);
|
|
||||||
}
|
}
|
||||||
if (result.getUnassigned() >= 1 && !tagsClickedList.isEmpty() && tagsClickedList.contains(targTagName)) {
|
|
||||||
eventBus.publish(this, ManagementUIEvent.UNASSIGN_TARGET_TAG);
|
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;
|
||||||
}
|
}
|
||||||
|
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) {
|
||||||
@@ -288,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();
|
||||||
|
|||||||
@@ -18,23 +18,20 @@ import java.util.List;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.eclipse.hawkbit.HawkbitServerProperties;
|
import org.eclipse.hawkbit.HawkbitServerProperties;
|
||||||
import org.eclipse.hawkbit.im.authentication.PermissionService;
|
import org.eclipse.hawkbit.im.authentication.PermissionService;
|
||||||
import org.eclipse.hawkbit.im.authentication.UserPrincipal;
|
|
||||||
import org.eclipse.hawkbit.ui.UiProperties;
|
import org.eclipse.hawkbit.ui.UiProperties;
|
||||||
|
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.menu.DashboardEvent.PostViewChangeEvent;
|
import org.eclipse.hawkbit.ui.menu.DashboardEvent.PostViewChangeEvent;
|
||||||
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;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.core.context.SecurityContext;
|
|
||||||
import org.springframework.security.core.userdetails.UserDetails;
|
|
||||||
import org.springframework.security.web.context.HttpSessionSecurityContextRepository;
|
|
||||||
|
|
||||||
import com.vaadin.server.FontAwesome;
|
import com.vaadin.server.FontAwesome;
|
||||||
import com.vaadin.server.Page;
|
import com.vaadin.server.Page;
|
||||||
import com.vaadin.server.ThemeResource;
|
import com.vaadin.server.ThemeResource;
|
||||||
import com.vaadin.server.VaadinService;
|
|
||||||
import com.vaadin.shared.ui.label.ContentMode;
|
import com.vaadin.shared.ui.label.ContentMode;
|
||||||
import com.vaadin.spring.annotation.SpringComponent;
|
import com.vaadin.spring.annotation.SpringComponent;
|
||||||
import com.vaadin.spring.annotation.UIScope;
|
import com.vaadin.spring.annotation.UIScope;
|
||||||
@@ -189,63 +186,27 @@ public final class DashboardMenu extends CustomComponent {
|
|||||||
return links;
|
return links;
|
||||||
}
|
}
|
||||||
|
|
||||||
private UserDetails getCurrentUser() {
|
|
||||||
final SecurityContext context = (SecurityContext) VaadinService.getCurrentRequest().getWrappedSession()
|
|
||||||
.getAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY);
|
|
||||||
return (UserDetails) context.getAuthentication().getPrincipal();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Component buildUserMenu() {
|
private Component buildUserMenu() {
|
||||||
final MenuBar settings = new MenuBar();
|
final MenuBar settings = new MenuBar();
|
||||||
settings.addStyleName("user-menu");
|
settings.addStyleName("user-menu");
|
||||||
final UserDetails user = getCurrentUser();
|
settings.setHtmlContentAllowed(true);
|
||||||
final MenuItem settingsItem = settings.addItem("", new ThemeResource("images/profile-pic-57px.jpg"), null);
|
final MenuItem settingsItem = settings.addItem("", new ThemeResource("images/profile-pic-57px.jpg"), null);
|
||||||
if (user instanceof UserPrincipal
|
|
||||||
&& (((UserPrincipal) user).getFirstname() != null || ((UserPrincipal) user).getLastname() != null)) {
|
final String formattedTenant = UserDetailsFormatter.formatCurrentTenant();
|
||||||
settingsItem.setText(trimTanent(((UserPrincipal) user).getTenant()) + "\n"
|
final String formattedUsername = UserDetailsFormatter.formatCurrentUsername();
|
||||||
+ concateFNameLName(((UserPrincipal) user).getFirstname(), ((UserPrincipal) user).getLastname()));
|
String tenantAndUsernameHtml = "";
|
||||||
settingsItem.setDescription(
|
if (!StringUtils.isEmpty(formattedTenant)) {
|
||||||
((UserPrincipal) user).getFirstname() + " / " + ((UserPrincipal) user).getLastname());
|
tenantAndUsernameHtml += formattedTenant + "<br>";
|
||||||
} else if (user instanceof UserPrincipal) {
|
|
||||||
if (((UserPrincipal) user).getLoginname().length() > 10) {
|
|
||||||
settingsItem.setText(trimTanent(((UserPrincipal) user).getTenant()) + "\n"
|
|
||||||
+ ((UserPrincipal) user).getLoginname().substring(0, 10) + "..");
|
|
||||||
} else {
|
|
||||||
settingsItem.setText(
|
|
||||||
trimTanent(((UserPrincipal) user).getTenant()) + "\n" + ((UserPrincipal) user).getLoginname());
|
|
||||||
}
|
|
||||||
settingsItem.setDescription(((UserPrincipal) user).getLoginname());
|
|
||||||
} else if (user != null) {
|
|
||||||
settingsItem.setText(user.getUsername());
|
|
||||||
settingsItem.setDescription(user.getUsername());
|
|
||||||
}
|
}
|
||||||
|
tenantAndUsernameHtml += formattedUsername;
|
||||||
|
settingsItem.setText(tenantAndUsernameHtml);
|
||||||
|
settingsItem.setDescription(formattedUsername);
|
||||||
|
settingsItem.setStyleName("user-menuitem");
|
||||||
|
|
||||||
settingsItem.addItem("Sign Out", selectedItem -> Page.getCurrent().setLocation("/UI/logout"));
|
settingsItem.addItem("Sign Out", selectedItem -> Page.getCurrent().setLocation("/UI/logout"));
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String concateFNameLName(final String fName, final String lName) {
|
|
||||||
final StringBuilder userName = new StringBuilder();
|
|
||||||
if (fName != null && fName.length() > 6) {
|
|
||||||
userName.append(fName.substring(0, 6) + ".." + ", ");
|
|
||||||
} else {
|
|
||||||
userName.append(fName).append(", ");
|
|
||||||
}
|
|
||||||
if (lName != null && lName.length() > 6) {
|
|
||||||
userName.append(lName.substring(0, 6) + "..");
|
|
||||||
} else {
|
|
||||||
userName.append(lName);
|
|
||||||
}
|
|
||||||
return userName.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private String trimTanent(final String tanent) {
|
|
||||||
if (tanent != null && tanent.length() > 8) {
|
|
||||||
return tanent.substring(0, 8) + "..";
|
|
||||||
}
|
|
||||||
return tanent;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Component buildToggleButton() {
|
private Component buildToggleButton() {
|
||||||
final Button valoMenuToggleButton = new Button("Menu", (ClickListener) event -> {
|
final Button valoMenuToggleButton = new Button("Menu", (ClickListener) event -> {
|
||||||
if (getCompositionRoot().getStyleName().contains(STYLE_VISIBLE)) {
|
if (getCompositionRoot().getStyleName().contains(STYLE_VISIBLE)) {
|
||||||
|
|||||||
@@ -209,6 +209,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
|
|||||||
actionTypeOptionGroupLayout, linkToHelp, getSaveDiscardButtonLayout());
|
actionTypeOptionGroupLayout, linkToHelp, getSaveDiscardButtonLayout());
|
||||||
mainLayout.setComponentAlignment(linkToHelp, Alignment.BOTTOM_RIGHT);
|
mainLayout.setComponentAlignment(linkToHelp, Alignment.BOTTOM_RIGHT);
|
||||||
setCompositionRoot(mainLayout);
|
setCompositionRoot(mainLayout);
|
||||||
|
rolloutName.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
private HorizontalLayout getGroupDetailsLayout() {
|
private HorizontalLayout getGroupDetailsLayout() {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import org.eclipse.hawkbit.repository.DistributionSetFilter;
|
|||||||
import org.eclipse.hawkbit.repository.DistributionSetFilter.DistributionSetFilterBuilder;
|
import org.eclipse.hawkbit.repository.DistributionSetFilter.DistributionSetFilterBuilder;
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
|
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||||
import org.eclipse.hawkbit.ui.components.ProxyDistribution;
|
import org.eclipse.hawkbit.ui.components.ProxyDistribution;
|
||||||
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;
|
||||||
@@ -62,7 +63,8 @@ public class DistributionBeanQuery extends AbstractBeanQuery<ProxyDistribution>
|
|||||||
sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortPropertyIds[0]);
|
sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortPropertyIds[0]);
|
||||||
// Add sort
|
// Add sort
|
||||||
for (int distId = 1; distId < sortPropertyIds.length; distId++) {
|
for (int distId = 1; distId < sortPropertyIds.length; distId++) {
|
||||||
sort.and(new Sort(sortStates[distId] ? Direction.ASC : Direction.DESC, (String) sortPropertyIds[distId]));
|
sort.and(new Sort(sortStates[distId] ? Direction.ASC : Direction.DESC,
|
||||||
|
(String) sortPropertyIds[distId]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,8 +105,8 @@ public class DistributionBeanQuery extends AbstractBeanQuery<ProxyDistribution>
|
|||||||
final List<ProxyDistribution> proxyDistributions = new ArrayList<>();
|
final List<ProxyDistribution> proxyDistributions = new ArrayList<>();
|
||||||
for (final DistributionSet distributionSet : distBeans) {
|
for (final DistributionSet distributionSet : distBeans) {
|
||||||
final ProxyDistribution proxyDistribution = new ProxyDistribution();
|
final ProxyDistribution proxyDistribution = new ProxyDistribution();
|
||||||
proxyDistribution.setName(HawkbitCommonUtil.getFormattedNameVersion(distributionSet.getName(),
|
proxyDistribution.setName(
|
||||||
distributionSet.getVersion()));
|
HawkbitCommonUtil.getFormattedNameVersion(distributionSet.getName(), distributionSet.getVersion()));
|
||||||
proxyDistribution.setDescription(distributionSet.getDescription());
|
proxyDistribution.setDescription(distributionSet.getDescription());
|
||||||
proxyDistribution.setDistId(distributionSet.getId());
|
proxyDistribution.setDistId(distributionSet.getId());
|
||||||
proxyDistribution.setId(distributionSet.getId());
|
proxyDistribution.setId(distributionSet.getId());
|
||||||
@@ -112,8 +114,8 @@ public class DistributionBeanQuery extends AbstractBeanQuery<ProxyDistribution>
|
|||||||
proxyDistribution.setCreatedDate(SPDateTimeUtil.getFormattedDate(distributionSet.getCreatedAt()));
|
proxyDistribution.setCreatedDate(SPDateTimeUtil.getFormattedDate(distributionSet.getCreatedAt()));
|
||||||
proxyDistribution.setLastModifiedDate(SPDateTimeUtil.getFormattedDate(distributionSet.getLastModifiedAt()));
|
proxyDistribution.setLastModifiedDate(SPDateTimeUtil.getFormattedDate(distributionSet.getLastModifiedAt()));
|
||||||
proxyDistribution.setDescription(distributionSet.getDescription());
|
proxyDistribution.setDescription(distributionSet.getDescription());
|
||||||
proxyDistribution.setCreatedByUser(HawkbitCommonUtil.getIMUser(distributionSet.getCreatedBy()));
|
proxyDistribution.setCreatedByUser(UserDetailsFormatter.loadAndFormatCreatedBy(distributionSet));
|
||||||
proxyDistribution.setModifiedByUser(HawkbitCommonUtil.getIMUser(distributionSet.getLastModifiedBy()));
|
proxyDistribution.setModifiedByUser(UserDetailsFormatter.loadAndFormatLastModifiedBy(distributionSet));
|
||||||
proxyDistribution.setIsComplete(distributionSet.isComplete());
|
proxyDistribution.setIsComplete(distributionSet.isComplete());
|
||||||
proxyDistributions.add(proxyDistribution);
|
proxyDistributions.add(proxyDistribution);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,12 +8,16 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.rollout.rollout;
|
package org.eclipse.hawkbit.ui.rollout.rollout;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||||
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
|
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 {
|
||||||
@@ -30,8 +34,92 @@ public class ProxyRollout extends Rollout {
|
|||||||
|
|
||||||
private Boolean isActionRecieved = Boolean.FALSE;
|
private Boolean isActionRecieved = Boolean.FALSE;
|
||||||
|
|
||||||
|
private Boolean isRequiredMigrationStep = Boolean.FALSE;
|
||||||
|
|
||||||
private String totalTargetsCount;
|
private String totalTargetsCount;
|
||||||
|
|
||||||
|
private RolloutRendererData rolloutRendererData;
|
||||||
|
|
||||||
|
private String discription;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
private Set<SoftwareModule> swModules;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the isRequiredMigrationStep
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Boolean getIsRequiredMigrationStep() {
|
||||||
|
return isRequiredMigrationStep;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isRequiredMigrationStep
|
||||||
|
* the isRequiredMigrationStep to set
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void setIsRequiredMigrationStep(Boolean isRequiredMigrationStep) {
|
||||||
|
this.isRequiredMigrationStep = isRequiredMigrationStep;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the discription
|
||||||
|
*/
|
||||||
|
|
||||||
|
public String getDiscription() {
|
||||||
|
return discription;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param discription
|
||||||
|
* the discription to set
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void setDiscription(String discription) {
|
||||||
|
this.discription = discription;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the type
|
||||||
|
*/
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param type
|
||||||
|
* the type to set
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return the Set of Software modules
|
||||||
|
*/
|
||||||
|
public Set<SoftwareModule> getSwModules() {
|
||||||
|
return swModules;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param swModules
|
||||||
|
* Set<SoftwareModule> to set
|
||||||
|
*/
|
||||||
|
public void setSwModules(Set<SoftwareModule> swModules) {
|
||||||
|
this.swModules = swModules;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RolloutRendererData getRolloutRendererData() {
|
||||||
|
return rolloutRendererData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRolloutRendererData(RolloutRendererData rendererData) {
|
||||||
|
this.rolloutRendererData = rendererData;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the distributionSetNameVersion
|
* @return the distributionSetNameVersion
|
||||||
*/
|
*/
|
||||||
@@ -122,7 +210,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,8 @@ 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.common.UserDetailsFormatter;
|
||||||
|
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,22 +121,29 @@ 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()));
|
||||||
proxyRollout.setModifiedDate(SPDateTimeUtil.getFormattedDate(rollout.getLastModifiedAt()));
|
proxyRollout.setModifiedDate(SPDateTimeUtil.getFormattedDate(rollout.getLastModifiedAt()));
|
||||||
proxyRollout.setCreatedBy(HawkbitCommonUtil.getIMUser(rollout.getCreatedBy()));
|
proxyRollout.setCreatedBy(UserDetailsFormatter.loadAndFormatCreatedBy(rollout));
|
||||||
proxyRollout.setLastModifiedBy(HawkbitCommonUtil.getIMUser(rollout.getLastModifiedBy()));
|
proxyRollout.setLastModifiedBy(UserDetailsFormatter.loadAndFormatLastModifiedBy(rollout));
|
||||||
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);
|
||||||
proxyRollout.setTotalTargetsCount(String.valueOf(rollout.getTotalTargets()));
|
proxyRollout.setTotalTargetsCount(String.valueOf(rollout.getTotalTargets()));
|
||||||
|
|
||||||
|
proxyRollout.setDescription(distributionSet.getDescription());
|
||||||
|
proxyRollout.setType(distributionSet.getType().getName());
|
||||||
|
proxyRollout.setIsRequiredMigrationStep(distributionSet.isRequiredMigrationStep());
|
||||||
|
proxyRollout.setSwModules(distributionSet.getModules());
|
||||||
|
|
||||||
proxyRolloutList.add(proxyRollout);
|
proxyRolloutList.add(proxyRollout);
|
||||||
}
|
}
|
||||||
return proxyRolloutList;
|
return proxyRolloutList;
|
||||||
@@ -148,7 +157,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
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -8,23 +8,31 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.rollout.rollout;
|
package org.eclipse.hawkbit.ui.rollout.rollout;
|
||||||
|
|
||||||
|
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_LI_CLOSE_TAG;
|
||||||
|
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_LI_OPEN_TAG;
|
||||||
|
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_UL_CLOSE_TAG;
|
||||||
|
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_UL_OPEN_TAG;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.eventbus.event.RolloutChangeEvent;
|
import org.eclipse.hawkbit.eventbus.event.RolloutChangeEvent;
|
||||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
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.SoftwareModule;
|
||||||
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 +85,13 @@ public class RolloutListGrid extends AbstractGrid {
|
|||||||
|
|
||||||
private static final String START_OPTION = "Start";
|
private static final String START_OPTION = "Start";
|
||||||
|
|
||||||
|
private static final String DS_TYPE = "type";
|
||||||
|
|
||||||
|
private static final String SW_MODULES = "swModules";
|
||||||
|
|
||||||
|
private static final String IS_REQUIRED_MIGRATION_STEP = "isRequiredMigrationStep";
|
||||||
|
|
||||||
|
private static final String ROLLOUT_RENDERER_DATA = "rolloutRendererData";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private transient RolloutManagement rolloutManagement;
|
private transient RolloutManagement rolloutManagement;
|
||||||
@@ -95,7 +110,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 +150,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,7 +173,11 @@ 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(DS_TYPE, String.class, null, false, false);
|
||||||
|
rolloutGridContainer.addContainerProperty(SW_MODULES, Set.class, null, 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(IS_REQUIRED_MIGRATION_STEP, boolean.class, null, false, false);
|
||||||
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_STATUS, RolloutStatus.class, null, false,
|
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_STATUS, RolloutStatus.class, null, false,
|
||||||
false);
|
false);
|
||||||
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_DIST_NAME_VERSION, String.class, null, false,
|
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_DIST_NAME_VERSION, String.class, null, false,
|
||||||
@@ -163,7 +191,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 +205,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 +231,10 @@ 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(DS_TYPE).setHeaderCaption("Type");
|
||||||
|
getColumn(SW_MODULES).setHeaderCaption("swModules");
|
||||||
|
getColumn(IS_REQUIRED_MIGRATION_STEP).setHeaderCaption("IsRequiredMigrationStep");
|
||||||
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,8 +257,11 @@ 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(DS_TYPE);
|
||||||
|
columnList.add(SW_MODULES);
|
||||||
|
columnList.add(IS_REQUIRED_MIGRATION_STEP);
|
||||||
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_NUMBER_OF_GROUPS);
|
columnList.add(SPUILabelDefinitions.VAR_NUMBER_OF_GROUPS);
|
||||||
@@ -245,11 +280,15 @@ 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);
|
||||||
columnsToBeHidden.add(SPUILabelDefinitions.VAR_MODIFIED_BY);
|
columnsToBeHidden.add(SPUILabelDefinitions.VAR_MODIFIED_BY);
|
||||||
columnsToBeHidden.add(SPUILabelDefinitions.VAR_DESC);
|
columnsToBeHidden.add(SPUILabelDefinitions.VAR_DESC);
|
||||||
|
columnsToBeHidden.add(IS_REQUIRED_MIGRATION_STEP);
|
||||||
|
columnsToBeHidden.add(DS_TYPE);
|
||||||
|
columnsToBeHidden.add(SW_MODULES);
|
||||||
for (final Object propertyId : columnsToBeHidden) {
|
for (final Object propertyId : columnsToBeHidden) {
|
||||||
getColumn(propertyId).setHidden(true);
|
getColumn(propertyId).setHidden(true);
|
||||||
}
|
}
|
||||||
@@ -263,6 +302,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 +311,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 +448,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,15 +476,54 @@ 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());
|
||||||
|
} else if (SPUILabelDefinitions.VAR_DIST_NAME_VERSION.equals(cell.getPropertyId())) {
|
||||||
|
return getDSDetails(cell.getItem());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDSDetails(final Item rolloutItem) {
|
||||||
|
final StringBuilder swModuleNames = new StringBuilder();
|
||||||
|
final StringBuilder swModuleVendors = new StringBuilder();
|
||||||
|
final Set<SoftwareModule> swModules = (Set<SoftwareModule>) rolloutItem.getItemProperty(SW_MODULES).getValue();
|
||||||
|
swModules.forEach(swModule -> {
|
||||||
|
swModuleNames.append(swModule.getName());
|
||||||
|
swModuleNames.append(" , ");
|
||||||
|
swModuleVendors.append(swModule.getVendor());
|
||||||
|
swModuleVendors.append(" , ");
|
||||||
|
});
|
||||||
|
final StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
stringBuilder.append(HTML_UL_OPEN_TAG);
|
||||||
|
stringBuilder.append(HTML_LI_OPEN_TAG);
|
||||||
|
stringBuilder.append(" DistributionSet Description : ")
|
||||||
|
.append((String) rolloutItem.getItemProperty(SPUILabelDefinitions.VAR_DESC).getValue());
|
||||||
|
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
||||||
|
stringBuilder.append(HTML_LI_OPEN_TAG);
|
||||||
|
stringBuilder.append(" DistributionSet Type : ")
|
||||||
|
.append((String) rolloutItem.getItemProperty(DS_TYPE).getValue());
|
||||||
|
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
||||||
|
stringBuilder.append(HTML_LI_OPEN_TAG);
|
||||||
|
stringBuilder.append("Required Migration step : ")
|
||||||
|
.append((boolean) rolloutItem.getItemProperty(IS_REQUIRED_MIGRATION_STEP).getValue() ? "Yes" : "No");
|
||||||
|
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
||||||
|
|
||||||
|
stringBuilder.append(HTML_LI_OPEN_TAG);
|
||||||
|
stringBuilder.append("SoftWare Modules : ").append(swModuleNames.toString());
|
||||||
|
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
||||||
|
|
||||||
|
stringBuilder.append(HTML_LI_OPEN_TAG);
|
||||||
|
stringBuilder.append("Vendor(s) : ").append(swModuleVendors.toString());
|
||||||
|
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
||||||
|
|
||||||
|
stringBuilder.append(HTML_UL_CLOSE_TAG);
|
||||||
|
return stringBuilder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
enum ACTION {
|
enum ACTION {
|
||||||
PAUSE, RESUME, START, UPDATE
|
PAUSE, RESUME, START, UPDATE
|
||||||
}
|
}
|
||||||
@@ -568,4 +655,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,200 +9,211 @@
|
|||||||
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 {
|
||||||
|
|
||||||
private static final long serialVersionUID = -2745056813306692356L;
|
private static final long serialVersionUID = -2745056813306692356L;
|
||||||
|
|
||||||
private String createdDate;
|
private String createdDate;
|
||||||
|
|
||||||
private String modifiedDate;
|
private String modifiedDate;
|
||||||
|
|
||||||
private String finishedPercentage;
|
private String finishedPercentage;
|
||||||
|
|
||||||
private Long runningTargetsCount;
|
private Long runningTargetsCount;
|
||||||
|
|
||||||
private Long scheduledTargetsCount;
|
private Long scheduledTargetsCount;
|
||||||
|
|
||||||
private Long cancelledTargetsCount;
|
private Long cancelledTargetsCount;
|
||||||
|
|
||||||
private Long errorTargetsCount;
|
private Long errorTargetsCount;
|
||||||
|
|
||||||
private Long finishedTargetsCount;
|
private Long finishedTargetsCount;
|
||||||
|
|
||||||
private Long notStartedTargetsCount;
|
private Long notStartedTargetsCount;
|
||||||
|
|
||||||
private Boolean isActionRecieved = Boolean.FALSE;
|
private Boolean isActionRecieved = Boolean.FALSE;
|
||||||
|
|
||||||
private String totalTargetsCount;
|
private String totalTargetsCount;
|
||||||
|
|
||||||
/**
|
private RolloutRendererData rolloutRendererData;
|
||||||
* @return the createdDate
|
|
||||||
*/
|
|
||||||
public String getCreatedDate() {
|
|
||||||
return createdDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public RolloutRendererData getRolloutRendererData() {
|
||||||
* @param createdDate
|
return rolloutRendererData;
|
||||||
* the createdDate to set
|
}
|
||||||
*/
|
|
||||||
public void setCreatedDate(final String createdDate) {
|
|
||||||
this.createdDate = createdDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public void setRolloutRendererData(RolloutRendererData rendererData) {
|
||||||
* @return the modifiedDate
|
this.rolloutRendererData = rendererData;
|
||||||
*/
|
}
|
||||||
public String getModifiedDate() {
|
|
||||||
return modifiedDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param modifiedDate
|
* @return the createdDate
|
||||||
* the modifiedDate to set
|
*/
|
||||||
*/
|
public String getCreatedDate() {
|
||||||
public void setModifiedDate(final String modifiedDate) {
|
return createdDate;
|
||||||
this.modifiedDate = modifiedDate;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the finishedPercentage
|
* @param createdDate
|
||||||
*/
|
* the createdDate to set
|
||||||
public String getFinishedPercentage() {
|
*/
|
||||||
return finishedPercentage;
|
public void setCreatedDate(final String createdDate) {
|
||||||
}
|
this.createdDate = createdDate;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param finishedPercentage
|
* @return the modifiedDate
|
||||||
* the finishedPercentage to set
|
*/
|
||||||
*/
|
public String getModifiedDate() {
|
||||||
public void setFinishedPercentage(final String finishedPercentage) {
|
return modifiedDate;
|
||||||
this.finishedPercentage = finishedPercentage;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the runningTargetsCount
|
* @param modifiedDate
|
||||||
*/
|
* the modifiedDate to set
|
||||||
public Long getRunningTargetsCount() {
|
*/
|
||||||
return runningTargetsCount;
|
public void setModifiedDate(final String modifiedDate) {
|
||||||
}
|
this.modifiedDate = modifiedDate;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param runningTargetsCount
|
* @return the finishedPercentage
|
||||||
* the runningTargetsCount to set
|
*/
|
||||||
*/
|
public String getFinishedPercentage() {
|
||||||
public void setRunningTargetsCount(final Long runningTargetsCount) {
|
return finishedPercentage;
|
||||||
this.runningTargetsCount = runningTargetsCount;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the scheduledTargetsCount
|
* @param finishedPercentage
|
||||||
*/
|
* the finishedPercentage to set
|
||||||
public Long getScheduledTargetsCount() {
|
*/
|
||||||
return scheduledTargetsCount;
|
public void setFinishedPercentage(final String finishedPercentage) {
|
||||||
}
|
this.finishedPercentage = finishedPercentage;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param scheduledTargetsCount
|
* @return the runningTargetsCount
|
||||||
* the scheduledTargetsCount to set
|
*/
|
||||||
*/
|
public Long getRunningTargetsCount() {
|
||||||
public void setScheduledTargetsCount(final Long scheduledTargetsCount) {
|
return runningTargetsCount;
|
||||||
this.scheduledTargetsCount = scheduledTargetsCount;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the cancelledTargetsCount
|
* @param runningTargetsCount
|
||||||
*/
|
* the runningTargetsCount to set
|
||||||
public Long getCancelledTargetsCount() {
|
*/
|
||||||
return cancelledTargetsCount;
|
public void setRunningTargetsCount(final Long runningTargetsCount) {
|
||||||
}
|
this.runningTargetsCount = runningTargetsCount;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param cancelledTargetsCount
|
* @return the scheduledTargetsCount
|
||||||
* the cancelledTargetsCount to set
|
*/
|
||||||
*/
|
public Long getScheduledTargetsCount() {
|
||||||
public void setCancelledTargetsCount(final Long cancelledTargetsCount) {
|
return scheduledTargetsCount;
|
||||||
this.cancelledTargetsCount = cancelledTargetsCount;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the errorTargetsCount
|
* @param scheduledTargetsCount
|
||||||
*/
|
* the scheduledTargetsCount to set
|
||||||
public Long getErrorTargetsCount() {
|
*/
|
||||||
return errorTargetsCount;
|
public void setScheduledTargetsCount(final Long scheduledTargetsCount) {
|
||||||
}
|
this.scheduledTargetsCount = scheduledTargetsCount;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param errorTargetsCount
|
* @return the cancelledTargetsCount
|
||||||
* the errorTargetsCount to set
|
*/
|
||||||
*/
|
public Long getCancelledTargetsCount() {
|
||||||
public void setErrorTargetsCount(final Long errorTargetsCount) {
|
return cancelledTargetsCount;
|
||||||
this.errorTargetsCount = errorTargetsCount;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the finishedTargetsCount
|
* @param cancelledTargetsCount
|
||||||
*/
|
* the cancelledTargetsCount to set
|
||||||
public Long getFinishedTargetsCount() {
|
*/
|
||||||
return finishedTargetsCount;
|
public void setCancelledTargetsCount(final Long cancelledTargetsCount) {
|
||||||
}
|
this.cancelledTargetsCount = cancelledTargetsCount;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param finishedTargetsCount
|
* @return the errorTargetsCount
|
||||||
* the finishedTargetsCount to set
|
*/
|
||||||
*/
|
public Long getErrorTargetsCount() {
|
||||||
public void setFinishedTargetsCount(final Long finishedTargetsCount) {
|
return errorTargetsCount;
|
||||||
this.finishedTargetsCount = finishedTargetsCount;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the notStartedTargetsCount
|
* @param errorTargetsCount
|
||||||
*/
|
* the errorTargetsCount to set
|
||||||
public Long getNotStartedTargetsCount() {
|
*/
|
||||||
return notStartedTargetsCount;
|
public void setErrorTargetsCount(final Long errorTargetsCount) {
|
||||||
}
|
this.errorTargetsCount = errorTargetsCount;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param notStartedTargetsCount
|
* @return the finishedTargetsCount
|
||||||
* the notStartedTargetsCount to set
|
*/
|
||||||
*/
|
public Long getFinishedTargetsCount() {
|
||||||
public void setNotStartedTargetsCount(final Long notStartedTargetsCount) {
|
return finishedTargetsCount;
|
||||||
this.notStartedTargetsCount = notStartedTargetsCount;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the isActionRecieved
|
* @param finishedTargetsCount
|
||||||
*/
|
* the finishedTargetsCount to set
|
||||||
public Boolean getIsActionRecieved() {
|
*/
|
||||||
return isActionRecieved;
|
public void setFinishedTargetsCount(final Long finishedTargetsCount) {
|
||||||
}
|
this.finishedTargetsCount = finishedTargetsCount;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param isActionRecieved
|
* @return the notStartedTargetsCount
|
||||||
* the isActionRecieved to set
|
*/
|
||||||
*/
|
public Long getNotStartedTargetsCount() {
|
||||||
public void setIsActionRecieved(final Boolean isActionRecieved) {
|
return notStartedTargetsCount;
|
||||||
this.isActionRecieved = isActionRecieved;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the totalTargetsCount
|
* @param notStartedTargetsCount
|
||||||
*/
|
* the notStartedTargetsCount to set
|
||||||
public String getTotalTargetsCount() {
|
*/
|
||||||
return totalTargetsCount;
|
public void setNotStartedTargetsCount(final Long notStartedTargetsCount) {
|
||||||
}
|
this.notStartedTargetsCount = notStartedTargetsCount;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param totalTargetsCount
|
* @return the isActionRecieved
|
||||||
* the totalTargetsCount to set
|
*/
|
||||||
*/
|
public Boolean getIsActionRecieved() {
|
||||||
public void setTotalTargetsCount(final String totalTargetsCount) {
|
return isActionRecieved;
|
||||||
this.totalTargetsCount = totalTargetsCount;
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* @param isActionRecieved
|
||||||
|
* the isActionRecieved to set
|
||||||
|
*/
|
||||||
|
public void setIsActionRecieved(final Boolean isActionRecieved) {
|
||||||
|
this.isActionRecieved = isActionRecieved;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the totalTargetsCount
|
||||||
|
*/
|
||||||
|
public String getTotalTargetsCount() {
|
||||||
|
return totalTargetsCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param totalTargetsCount
|
||||||
|
* the totalTargetsCount to set
|
||||||
|
*/
|
||||||
|
public void setTotalTargetsCount(final String totalTargetsCount) {
|
||||||
|
this.totalTargetsCount = totalTargetsCount;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ 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.common.UserDetailsFormatter;
|
||||||
|
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;
|
||||||
@@ -110,8 +112,8 @@ public class RolloutGroupBeanQuery extends AbstractBeanQuery<ProxyRolloutGroup>
|
|||||||
proxyRolloutGroup.setDescription(rolloutGroup.getDescription());
|
proxyRolloutGroup.setDescription(rolloutGroup.getDescription());
|
||||||
proxyRolloutGroup.setCreatedDate(SPDateTimeUtil.getFormattedDate(rolloutGroup.getCreatedAt()));
|
proxyRolloutGroup.setCreatedDate(SPDateTimeUtil.getFormattedDate(rolloutGroup.getCreatedAt()));
|
||||||
proxyRolloutGroup.setModifiedDate(SPDateTimeUtil.getFormattedDate(rolloutGroup.getLastModifiedAt()));
|
proxyRolloutGroup.setModifiedDate(SPDateTimeUtil.getFormattedDate(rolloutGroup.getLastModifiedAt()));
|
||||||
proxyRolloutGroup.setCreatedBy(HawkbitCommonUtil.getIMUser(rolloutGroup.getCreatedBy()));
|
proxyRolloutGroup.setCreatedBy(UserDetailsFormatter.loadAndFormatCreatedBy(rolloutGroup));
|
||||||
proxyRolloutGroup.setLastModifiedBy(HawkbitCommonUtil.getIMUser(rolloutGroup.getLastModifiedBy()));
|
proxyRolloutGroup.setLastModifiedBy(UserDetailsFormatter.loadAndFormatLastModifiedBy(rolloutGroup));
|
||||||
proxyRolloutGroup.setId(rolloutGroup.getId());
|
proxyRolloutGroup.setId(rolloutGroup.getId());
|
||||||
proxyRolloutGroup.setStatus(rolloutGroup.getStatus());
|
proxyRolloutGroup.setStatus(rolloutGroup.getStatus());
|
||||||
proxyRolloutGroup.setErrorAction(rolloutGroup.getErrorAction());
|
proxyRolloutGroup.setErrorAction(rolloutGroup.getErrorAction());
|
||||||
@@ -122,6 +124,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());
|
||||||
@@ -306,14 +324,14 @@ public class RolloutGroupListGrid extends AbstractGrid {
|
|||||||
@Override
|
@Override
|
||||||
public TotalTargetCountStatus convertToModel(final String value,
|
public TotalTargetCountStatus convertToModel(final String value,
|
||||||
final Class<? extends TotalTargetCountStatus> targetType, final Locale locale)
|
final Class<? extends TotalTargetCountStatus> targetType, final Locale locale)
|
||||||
throws com.vaadin.data.util.converter.Converter.ConversionException {
|
throws com.vaadin.data.util.converter.Converter.ConversionException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String convertToPresentation(final TotalTargetCountStatus value,
|
public String convertToPresentation(final TotalTargetCountStatus value,
|
||||||
final Class<? extends String> targetType, final Locale locale)
|
final Class<? extends String> targetType, final Locale locale)
|
||||||
throws com.vaadin.data.util.converter.Converter.ConversionException {
|
throws com.vaadin.data.util.converter.Converter.ConversionException {
|
||||||
return DistributionBarHelper.getDistributionBarAsHTMLString(value.getStatusTotalCountMap());
|
return DistributionBarHelper.getDistributionBarAsHTMLString(value.getStatusTotalCountMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import org.eclipse.hawkbit.repository.RolloutManagement;
|
|||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetWithActionStatus;
|
import org.eclipse.hawkbit.repository.model.TargetWithActionStatus;
|
||||||
|
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||||
import org.eclipse.hawkbit.ui.components.ProxyTarget;
|
import org.eclipse.hawkbit.ui.components.ProxyTarget;
|
||||||
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;
|
||||||
@@ -105,8 +106,8 @@ public class RolloutGroupTargetsBeanQuery extends AbstractBeanQuery<ProxyTarget>
|
|||||||
prxyTarget.setLastModifiedDate(SPDateTimeUtil.getFormattedDate(targ.getLastModifiedAt()));
|
prxyTarget.setLastModifiedDate(SPDateTimeUtil.getFormattedDate(targ.getLastModifiedAt()));
|
||||||
prxyTarget.setCreatedDate(SPDateTimeUtil.getFormattedDate(targ.getCreatedAt()));
|
prxyTarget.setCreatedDate(SPDateTimeUtil.getFormattedDate(targ.getCreatedAt()));
|
||||||
prxyTarget.setCreatedAt(targ.getCreatedAt());
|
prxyTarget.setCreatedAt(targ.getCreatedAt());
|
||||||
prxyTarget.setCreatedByUser(HawkbitCommonUtil.getIMUser(targ.getCreatedBy()));
|
prxyTarget.setCreatedByUser(UserDetailsFormatter.loadAndFormatCreatedBy(targ));
|
||||||
prxyTarget.setModifiedByUser(HawkbitCommonUtil.getIMUser(targ.getLastModifiedBy()));
|
prxyTarget.setModifiedByUser(UserDetailsFormatter.loadAndFormatLastModifiedBy(targ));
|
||||||
if (targetWithActionStatus.getStatus() != null) {
|
if (targetWithActionStatus.getStatus() != null) {
|
||||||
prxyTarget.setStatus(targetWithActionStatus.getStatus());
|
prxyTarget.setStatus(targetWithActionStatus.getStatus());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ public class AuthenticationConfigurationView extends BaseConfigurationView
|
|||||||
|
|
||||||
downloadAnonymousCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
|
downloadAnonymousCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
|
||||||
downloadAnonymousCheckBox.setId("downloadanonymouscheckbox");
|
downloadAnonymousCheckBox.setId("downloadanonymouscheckbox");
|
||||||
downloadAnonymousCheckBox.setValue(targetSecurityTokenAuthenticationConfigurationItem.isConfigEnabled());
|
downloadAnonymousCheckBox.setValue(anonymousDownloadAuthenticationConfigurationItem.isConfigEnabled());
|
||||||
downloadAnonymousCheckBox.addValueChangeListener(this);
|
downloadAnonymousCheckBox.addValueChangeListener(this);
|
||||||
anonymousDownloadAuthenticationConfigurationItem.addChangeListener(this);
|
anonymousDownloadAuthenticationConfigurationItem.addChangeListener(this);
|
||||||
gridLayout.addComponent(downloadAnonymousCheckBox, 0, 3);
|
gridLayout.addComponent(downloadAnonymousCheckBox, 0, 3);
|
||||||
|
|||||||
@@ -0,0 +1,83 @@
|
|||||||
|
/**
|
||||||
|
* 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.utils;
|
||||||
|
|
||||||
|
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_LI_CLOSE_TAG;
|
||||||
|
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_LI_OPEN_TAG;
|
||||||
|
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_UL_CLOSE_TAG;
|
||||||
|
import static org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.HTML_UL_OPEN_TAG;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
|
|
||||||
|
import com.vaadin.data.Item;
|
||||||
|
import com.vaadin.ui.AbstractSelect.ItemDescriptionGenerator;
|
||||||
|
import com.vaadin.ui.Component;
|
||||||
|
import com.vaadin.ui.Table;
|
||||||
|
|
||||||
|
public class AssignInstalledDSTooltipGenerator implements ItemDescriptionGenerator {
|
||||||
|
private static final long serialVersionUID = 688730421728162456L;
|
||||||
|
|
||||||
|
private static final String ASSIGN_DIST_SET = "assignedDistributionSet";
|
||||||
|
private static final String INSTALL_DIST_SET = "installedDistributionSet";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String generateDescription(final Component source, final Object itemId, final Object propertyId) {
|
||||||
|
final DistributionSet distributionSet;
|
||||||
|
final Item item = ((Table) source).getItem(itemId);
|
||||||
|
if (propertyId != null) {
|
||||||
|
if (propertyId.equals(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER)) {
|
||||||
|
distributionSet = (DistributionSet) item.getItemProperty(ASSIGN_DIST_SET).getValue();
|
||||||
|
return getDSDetails(distributionSet);
|
||||||
|
} else if (propertyId.equals(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER)) {
|
||||||
|
distributionSet = (DistributionSet) item.getItemProperty(INSTALL_DIST_SET).getValue();
|
||||||
|
return getDSDetails(distributionSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getDSDetails(final DistributionSet distributionSet) {
|
||||||
|
if (distributionSet == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
final StringBuilder swModuleNames = new StringBuilder();
|
||||||
|
final StringBuilder swModuleVendors = new StringBuilder();
|
||||||
|
final Set<SoftwareModule> swModules = distributionSet.getModules();
|
||||||
|
swModules.forEach(swModule -> {
|
||||||
|
swModuleNames.append(swModule.getName());
|
||||||
|
swModuleNames.append(" , ");
|
||||||
|
swModuleVendors.append(swModule.getVendor());
|
||||||
|
swModuleVendors.append(" , ");
|
||||||
|
});
|
||||||
|
final StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
stringBuilder.append(HTML_UL_OPEN_TAG);
|
||||||
|
stringBuilder.append(HTML_LI_OPEN_TAG);
|
||||||
|
stringBuilder.append(" DistributionSet Description : ").append(distributionSet.getDescription());
|
||||||
|
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
||||||
|
stringBuilder.append(HTML_LI_OPEN_TAG);
|
||||||
|
stringBuilder.append(" DistributionSet Type : ").append((distributionSet.getType()).getName());
|
||||||
|
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
||||||
|
stringBuilder.append(HTML_LI_OPEN_TAG);
|
||||||
|
stringBuilder.append(" Required Migration step : ")
|
||||||
|
.append(distributionSet.isRequiredMigrationStep() ? "Yes" : "No");
|
||||||
|
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
||||||
|
stringBuilder.append(HTML_LI_OPEN_TAG);
|
||||||
|
stringBuilder.append("SoftWare Modules : ").append(swModuleNames.toString());
|
||||||
|
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
||||||
|
stringBuilder.append(HTML_LI_OPEN_TAG);
|
||||||
|
stringBuilder.append("Vendor(s) : ").append(swModuleVendors.toString());
|
||||||
|
stringBuilder.append(HTML_LI_CLOSE_TAG);
|
||||||
|
stringBuilder.append(HTML_UL_CLOSE_TAG);
|
||||||
|
return stringBuilder.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,9 +20,9 @@ import java.util.Map.Entry;
|
|||||||
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.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.DistributionSet;
|
||||||
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;
|
||||||
@@ -34,9 +34,6 @@ import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus.Status;
|
|||||||
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;
|
||||||
import org.springframework.security.core.userdetails.UserDetails;
|
|
||||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
|
||||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
|
||||||
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
|
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
|
||||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||||
@@ -76,6 +73,11 @@ public final class HawkbitCommonUtil {
|
|||||||
*/
|
*/
|
||||||
public static final String SPAN_CLOSE = "</span>";
|
public static final String SPAN_CLOSE = "</span>";
|
||||||
|
|
||||||
|
public static final String HTML_LI_CLOSE_TAG = "</li>";
|
||||||
|
public static final String HTML_LI_OPEN_TAG = "<li>";
|
||||||
|
public static final String HTML_UL_CLOSE_TAG = "</ul>";
|
||||||
|
public static final String HTML_UL_OPEN_TAG = "<ul>";
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(HawkbitCommonUtil.class);
|
private static final Logger LOG = LoggerFactory.getLogger(HawkbitCommonUtil.class);
|
||||||
|
|
||||||
private static final String JS_DRAG_COUNT_REM_CHILD = " if(x) { document.head.removeChild(x); } ";
|
private static final String JS_DRAG_COUNT_REM_CHILD = " if(x) { document.head.removeChild(x); } ";
|
||||||
@@ -107,6 +109,9 @@ public final class HawkbitCommonUtil {
|
|||||||
private static final String DELETE_DROP_CREATE_SCRIPT = "var q = document.getElementById('show-delete-drop-hint'); if(q) { } else { showDeleteDrop = document.createElement('style'); showDeleteDrop.id=\"show-delete-drop-hint\"; document.head.appendChild(showDeleteDrop); }";
|
private static final String DELETE_DROP_CREATE_SCRIPT = "var q = document.getElementById('show-delete-drop-hint'); if(q) { } else { showDeleteDrop = document.createElement('style'); showDeleteDrop.id=\"show-delete-drop-hint\"; document.head.appendChild(showDeleteDrop); }";
|
||||||
private static final String DELETE_TAG_DROP_REMOVE_SCRIPT = "var o = document.getElementById('show-delete-drop-hint'); if(o) { document.head.removeChild(o); } ";
|
private static final String DELETE_TAG_DROP_REMOVE_SCRIPT = "var o = document.getElementById('show-delete-drop-hint'); if(o) { document.head.removeChild(o); } ";
|
||||||
|
|
||||||
|
private static final String ASSIGN_DIST_SET = "assignedDistributionSet";
|
||||||
|
private static final String INSTALL_DIST_SET = "installedDistributionSet";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define empty string.
|
* Define empty string.
|
||||||
*/
|
*/
|
||||||
@@ -605,31 +610,6 @@ public final class HawkbitCommonUtil {
|
|||||||
return requiredExtraWidth + minTableWidth;
|
return requiredExtraWidth + minTableWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* get formatted name - lastname,firstname.
|
|
||||||
*
|
|
||||||
* @param user
|
|
||||||
* user name
|
|
||||||
* @return String formatted name
|
|
||||||
*/
|
|
||||||
public static String getFormattedName(final UserDetails user) {
|
|
||||||
final StringBuilder formattedName = new StringBuilder();
|
|
||||||
if (user instanceof UserPrincipal) {
|
|
||||||
if (trimAndNullIfEmpty(((UserPrincipal) user).getLastname()) != null) {
|
|
||||||
formattedName.append(((UserPrincipal) user).getLastname());
|
|
||||||
}
|
|
||||||
if (trimAndNullIfEmpty(((UserPrincipal) user).getFirstname()) != null) {
|
|
||||||
if (formattedName.length() > 0) {
|
|
||||||
formattedName.append(", ");
|
|
||||||
}
|
|
||||||
formattedName.append(((UserPrincipal) user).getFirstname());
|
|
||||||
}
|
|
||||||
} else if (user != null) {
|
|
||||||
formattedName.append(user.getUsername());
|
|
||||||
}
|
|
||||||
return formattedName.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the Last sequence of string which is after last dot in String.
|
* get the Last sequence of string which is after last dot in String.
|
||||||
*
|
*
|
||||||
@@ -686,30 +666,6 @@ public final class HawkbitCommonUtil {
|
|||||||
return exeJS.toString();
|
return exeJS.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get IM User for user UUID.
|
|
||||||
*
|
|
||||||
* @param uuid
|
|
||||||
* @return imReslovedUser user details
|
|
||||||
*/
|
|
||||||
public static String getIMUser(final String uuid) {
|
|
||||||
// Get modifed user
|
|
||||||
String imReslovedUser = HawkbitCommonUtil.SP_STRING_SPACE;
|
|
||||||
if (HawkbitCommonUtil.trimAndNullIfEmpty(uuid) != null) {
|
|
||||||
final UserDetailsService idManagement = SpringContextHelper.getBean(UserDetailsService.class);
|
|
||||||
try {
|
|
||||||
imReslovedUser = HawkbitCommonUtil.getFormattedName(idManagement.loadUserByUsername(uuid));
|
|
||||||
} catch (final UsernameNotFoundException e) { // NOSONAR
|
|
||||||
// nope not need to handle
|
|
||||||
}
|
|
||||||
// If Null display the UID
|
|
||||||
if (HawkbitCommonUtil.trimAndNullIfEmpty(imReslovedUser) == null) {
|
|
||||||
imReslovedUser = uuid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return imReslovedUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get formatted label.Appends ellipses if content does not fit the label.
|
* Get formatted label.Appends ellipses if content does not fit the label.
|
||||||
*
|
*
|
||||||
@@ -1090,6 +1046,10 @@ public final class HawkbitCommonUtil {
|
|||||||
targetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_POLL_STATUS_TOOL_TIP, String.class, null,
|
targetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_POLL_STATUS_TOOL_TIP, String.class, null,
|
||||||
false, true);
|
false, true);
|
||||||
targetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, "", false, true);
|
targetTableContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, "", false, true);
|
||||||
|
|
||||||
|
targetTableContainer.addContainerProperty(ASSIGN_DIST_SET, DistributionSet.class, null, false, true);
|
||||||
|
targetTableContainer.addContainerProperty(INSTALL_DIST_SET, DistributionSet.class, null, false, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -15,7 +15,9 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang3.time.DurationFormatUtils;
|
import org.apache.commons.lang3.time.DurationFormatUtils;
|
||||||
|
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||||
|
|
||||||
import com.vaadin.server.WebBrowser;
|
import com.vaadin.server.WebBrowser;
|
||||||
|
|
||||||
@@ -80,14 +82,45 @@ public final class SPDateTimeUtil {
|
|||||||
* @param lastQueryDate
|
* @param lastQueryDate
|
||||||
* @return String formatted date
|
* @return String formatted date
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static String getFormattedDate(final Long lastQueryDate) {
|
public static String getFormattedDate(final Long lastQueryDate) {
|
||||||
|
return formatDate(lastQueryDate, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get formatted date 'created at' by entity.
|
||||||
|
*
|
||||||
|
* @param baseEntity
|
||||||
|
* the entity
|
||||||
|
* @return String formatted date
|
||||||
|
*/
|
||||||
|
public static String formatCreatedAt(final BaseEntity baseEntity) {
|
||||||
|
if (baseEntity == null) {
|
||||||
|
return StringUtils.EMPTY;
|
||||||
|
}
|
||||||
|
return formatDate(baseEntity.getCreatedAt(), StringUtils.EMPTY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get formatted date 'last modified at' by entity.
|
||||||
|
*
|
||||||
|
* @param baseEntity
|
||||||
|
* the entity
|
||||||
|
* @return String formatted date
|
||||||
|
*/
|
||||||
|
public static String formatLastModifiedAt(final BaseEntity baseEntity) {
|
||||||
|
if (baseEntity == null) {
|
||||||
|
return StringUtils.EMPTY;
|
||||||
|
}
|
||||||
|
return formatDate(baseEntity.getLastModifiedAt(), StringUtils.EMPTY);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String formatDate(final Long lastQueryDate, final String defaultString) {
|
||||||
if (lastQueryDate != null) {
|
if (lastQueryDate != null) {
|
||||||
final SimpleDateFormat format = new SimpleDateFormat(SPUIDefinitions.LAST_QUERY_DATE_FORMAT);
|
final SimpleDateFormat format = new SimpleDateFormat(SPUIDefinitions.LAST_QUERY_DATE_FORMAT);
|
||||||
format.setTimeZone(getBrowserTimeZone());
|
format.setTimeZone(getBrowserTimeZone());
|
||||||
return format.format(new Date(lastQueryDate));
|
return format.format(new Date(lastQueryDate));
|
||||||
}
|
}
|
||||||
return null;
|
return defaultString;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -143,9 +143,15 @@
|
|||||||
.valo-menu-title {
|
.valo-menu-title {
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.v-menubar-user-menu:after {
|
.v-menubar-user-menu:after {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.v-menubar-menuitem-user-menuitem {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.v-menubar-user-menu > .v-menubar-menuitem {
|
.v-menubar-user-menu > .v-menubar-menuitem {
|
||||||
white-space: normal !important;
|
white-space: normal !important;
|
||||||
.v-icon {
|
.v-icon {
|
||||||
|
|||||||
@@ -19,20 +19,32 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.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;
|
background-color: #feffff !important;
|
||||||
border-radius: 4px;
|
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;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
.v-context-menu .v-context-menu-item-basic:focus, .v-context-menu .v-context-menu-item-basic-submenu:focus, .v-context-menu .v-context-menu-item-basic-open {
|
.v-context-menu .v-context-menu-item-basic:focus, .v-context-menu .v-context-menu-item-basic-submenu:focus, .v-context-menu .v-context-menu-item-basic-open {
|
||||||
@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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
4
pom.xml
4
pom.xml
@@ -74,7 +74,7 @@
|
|||||||
<!-- Vaadin versions - START -->
|
<!-- Vaadin versions - START -->
|
||||||
<vaadin.spring.version>1.0.0</vaadin.spring.version>
|
<vaadin.spring.version>1.0.0</vaadin.spring.version>
|
||||||
<vaadin.spring.addon.version>0.0.6.RELEASE</vaadin.spring.addon.version>
|
<vaadin.spring.addon.version>0.0.6.RELEASE</vaadin.spring.addon.version>
|
||||||
<vaadin.version>7.6.4</vaadin.version>
|
<vaadin.version>7.6.5</vaadin.version>
|
||||||
<vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version>
|
<vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version>
|
||||||
<vaadin.addon.vaadin-lazyquerycontainer.version>7.4.0.1</vaadin.addon.vaadin-lazyquerycontainer.version>
|
<vaadin.addon.vaadin-lazyquerycontainer.version>7.4.0.1</vaadin.addon.vaadin-lazyquerycontainer.version>
|
||||||
<vaadin.addon.flexibleoptiongroup.version>2.2.0</vaadin.addon.flexibleoptiongroup.version>
|
<vaadin.addon.flexibleoptiongroup.version>2.2.0</vaadin.addon.flexibleoptiongroup.version>
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
<json-path.version>0.9.1</json-path.version>
|
<json-path.version>0.9.1</json-path.version>
|
||||||
<aspectj.version>1.8.5</aspectj.version>
|
<aspectj.version>1.8.5</aspectj.version>
|
||||||
<guava.version>19.0</guava.version>
|
<guava.version>19.0</guava.version>
|
||||||
<mariadb-java-client.version>1.3.5</mariadb-java-client.version>
|
<mariadb-java-client.version>1.4.3</mariadb-java-client.version>
|
||||||
<embedded-mongo.version>1.50.2</embedded-mongo.version>
|
<embedded-mongo.version>1.50.2</embedded-mongo.version>
|
||||||
<jersey-client.version>1.18.1</jersey-client.version>
|
<jersey-client.version>1.18.1</jersey-client.version>
|
||||||
<javax.el-api.version>2.2.4</javax.el-api.version>
|
<javax.el-api.version>2.2.4</javax.el-api.version>
|
||||||
|
|||||||
Reference in New Issue
Block a user