Merge branch 'master' into Stabilise_tests
This commit is contained in:
@@ -14,12 +14,11 @@ import java.util.Set;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.EntityEvent;
|
||||
import org.eclipse.hawkbit.im.authentication.TenantAwareAuthenticationDetails;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIErrorHandler;
|
||||
import org.eclipse.hawkbit.ui.menu.DashboardEvent.PostViewChangeEvent;
|
||||
import org.eclipse.hawkbit.ui.menu.DashboardMenu;
|
||||
import org.eclipse.hawkbit.ui.menu.DashboardMenuItem;
|
||||
import org.eclipse.hawkbit.ui.push.EventPushStrategy;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
||||
@@ -28,14 +27,8 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.security.core.context.SecurityContext;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.web.context.HttpSessionSecurityContextRepository;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventBus.SessionEventBus;
|
||||
|
||||
import com.google.common.eventbus.AllowConcurrentEvents;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.vaadin.annotations.Title;
|
||||
import com.vaadin.navigator.Navigator;
|
||||
import com.vaadin.navigator.View;
|
||||
@@ -45,9 +38,6 @@ import com.vaadin.server.ClientConnector.DetachListener;
|
||||
import com.vaadin.server.Responsive;
|
||||
import com.vaadin.server.VaadinRequest;
|
||||
import com.vaadin.server.VaadinService;
|
||||
import com.vaadin.server.VaadinSession;
|
||||
import com.vaadin.server.VaadinSession.State;
|
||||
import com.vaadin.server.WrappedSession;
|
||||
import com.vaadin.spring.navigator.SpringViewProvider;
|
||||
import com.vaadin.ui.Component;
|
||||
import com.vaadin.ui.CssLayout;
|
||||
@@ -71,6 +61,8 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
|
||||
|
||||
private static final String EMPTY_VIEW = "";
|
||||
|
||||
private EventPushStrategy pushStrategy;
|
||||
|
||||
@Autowired
|
||||
private SpringViewProvider viewProvider;
|
||||
|
||||
@@ -92,69 +84,37 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
|
||||
protected transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
/**
|
||||
* An {@link com.google.common.eventbus.EventBus} subscriber which
|
||||
* subscribes {@link EntityEvent} from the repository to dispatch these
|
||||
* events to the UI {@link SessionEventBus}.
|
||||
*
|
||||
* @param event
|
||||
* the entity event which has been published from the repository
|
||||
* Default constructor.
|
||||
*/
|
||||
@Subscribe
|
||||
@AllowConcurrentEvents
|
||||
public void dispatch(final org.eclipse.hawkbit.eventbus.event.Event event) {
|
||||
final VaadinSession session = getSession();
|
||||
if (session == null || session.getState() != State.OPEN) {
|
||||
return;
|
||||
}
|
||||
|
||||
final WrappedSession wrappedSession = session.getSession();
|
||||
if (wrappedSession == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final SecurityContext userContext = (SecurityContext) wrappedSession
|
||||
.getAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY);
|
||||
if (!eventSecurityCheck(userContext, event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final SecurityContext oldContext = SecurityContextHolder.getContext();
|
||||
try {
|
||||
access(new DispatcherRunnable(eventBus, session, userContext, event));
|
||||
} finally {
|
||||
SecurityContextHolder.setContext(oldContext);
|
||||
}
|
||||
|
||||
public HawkbitUI() {
|
||||
// is empty, is ok.
|
||||
}
|
||||
|
||||
protected boolean eventSecurityCheck(final SecurityContext userContext,
|
||||
final org.eclipse.hawkbit.eventbus.event.Event event) {
|
||||
if (userContext != null && userContext.getAuthentication() != null) {
|
||||
final Object tenantAuthenticationDetails = userContext.getAuthentication().getDetails();
|
||||
if (tenantAuthenticationDetails instanceof TenantAwareAuthenticationDetails) {
|
||||
return ((TenantAwareAuthenticationDetails) tenantAuthenticationDetails).getTenant()
|
||||
.equalsIgnoreCase(event.getTenant());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
/**
|
||||
* Constructor taking the push strategy.
|
||||
*
|
||||
* @param pushStrategy
|
||||
* the strategy to push events from the backend to the UI
|
||||
*/
|
||||
public HawkbitUI(final EventPushStrategy pushStrategy) {
|
||||
this.pushStrategy = pushStrategy;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.vaadin.server.ClientConnector.DetachListener#detach(com.vaadin.server
|
||||
* .ClientConnector. DetachEvent)
|
||||
*/
|
||||
@Override
|
||||
public void detach(final DetachEvent event) {
|
||||
LOG.info("ManagementUI is detached uiid - {}", getUIId());
|
||||
|
||||
eventBus.unsubscribe(this);
|
||||
if (pushStrategy != null) {
|
||||
pushStrategy.clean();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init(final VaadinRequest vaadinRequest) {
|
||||
LOG.info("ManagementUI init starts uiid - {}", getUI().getUIId());
|
||||
if (pushStrategy != null) {
|
||||
pushStrategy.init(getUI());
|
||||
}
|
||||
addDetachListener(this);
|
||||
SpringContextHelper.setContext(context);
|
||||
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Properties for Management UI customization.
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties("hawkbit.server.ui")
|
||||
public class UiProperties {
|
||||
|
||||
private final Links links = new Links();
|
||||
private final Login login = new Login();
|
||||
private final Demo demo = new Demo();
|
||||
|
||||
public Login getLogin() {
|
||||
return login;
|
||||
}
|
||||
|
||||
public Links getLinks() {
|
||||
return links;
|
||||
}
|
||||
|
||||
public Demo getDemo() {
|
||||
return demo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Demo account login information.
|
||||
*
|
||||
*/
|
||||
public static class Demo {
|
||||
|
||||
/**
|
||||
* Demo tenant.
|
||||
*/
|
||||
private String tenant = "DEFAULT";
|
||||
/**
|
||||
* Demo user name.
|
||||
*/
|
||||
private String user = "admin";
|
||||
|
||||
/**
|
||||
* Demo user password.
|
||||
*/
|
||||
private String password = "admin";
|
||||
|
||||
public String getTenant() {
|
||||
return tenant;
|
||||
}
|
||||
|
||||
public void setTenant(final String tenant) {
|
||||
this.tenant = tenant;
|
||||
}
|
||||
|
||||
public String getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(final String user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(final String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Links to potentially other systems (e.g. support, user management etc.).
|
||||
*
|
||||
*/
|
||||
public static class Links {
|
||||
/**
|
||||
* Link to product support.
|
||||
*/
|
||||
private String support = "";
|
||||
|
||||
/**
|
||||
* Link to request a system account, access.
|
||||
*/
|
||||
private String requestAccount = "";
|
||||
|
||||
/**
|
||||
* Link to user management.
|
||||
*/
|
||||
private String userManagement = "";
|
||||
|
||||
public String getSupport() {
|
||||
return support;
|
||||
}
|
||||
|
||||
public void setSupport(final String support) {
|
||||
this.support = support;
|
||||
}
|
||||
|
||||
public String getRequestAccount() {
|
||||
return requestAccount;
|
||||
}
|
||||
|
||||
public void setRequestAccount(final String requestAccount) {
|
||||
this.requestAccount = requestAccount;
|
||||
}
|
||||
|
||||
public String getUserManagement() {
|
||||
return userManagement;
|
||||
}
|
||||
|
||||
public void setUserManagement(final String userManagement) {
|
||||
this.userManagement = userManagement;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration of login view.
|
||||
*
|
||||
*/
|
||||
public static class Login {
|
||||
|
||||
private final Cookie cookie = new Cookie();
|
||||
|
||||
public Cookie getCookie() {
|
||||
return cookie;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cookie configuration for login credential cookie.
|
||||
*
|
||||
*/
|
||||
public static class Cookie {
|
||||
/**
|
||||
* Secure cookie enabled.
|
||||
*/
|
||||
private boolean secure = true;
|
||||
|
||||
public boolean isSecure() {
|
||||
return secure;
|
||||
}
|
||||
|
||||
public void setSecure(final boolean secure) {
|
||||
this.secure = secure;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -78,7 +78,7 @@ public class TargetTagToken extends AbstractTargetTagToken {
|
||||
}
|
||||
|
||||
private TargetTagAssigmentResult toggleAssignment(final String tagNameSelected) {
|
||||
final Set<String> targetList = new HashSet<String>();
|
||||
final Set<String> targetList = new HashSet<>();
|
||||
targetList.add(selectedTarget.getControllerId());
|
||||
final TargetTagAssigmentResult result = targetManagement.toggleTagAssignment(targetList, tagNameSelected);
|
||||
uinotification.displaySuccess(HawkbitCommonUtil.getTargetTagAssigmentMsg(tagNameSelected, result, i18n));
|
||||
@@ -102,7 +102,7 @@ public class TargetTagToken extends AbstractTargetTagToken {
|
||||
|
||||
/* To Be Done : this implementation will vary in views */
|
||||
private List<String> getClickedTagList() {
|
||||
return new ArrayList<String>();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,16 +15,14 @@ import javax.servlet.http.Cookie;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.MultitenancyIndicator;
|
||||
import org.eclipse.hawkbit.im.authentication.TenantUserPasswordAuthenticationToken;
|
||||
import org.eclipse.hawkbit.ui.UiProperties;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.documentation.DocumentationPageLink;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.eclipse.hawkbit.util.SPInfo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.EnvironmentAware;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.security.authentication.CredentialsExpiredException;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
@@ -61,7 +59,7 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
*/
|
||||
@SpringView(name = "")
|
||||
@UIScope
|
||||
public class LoginView extends VerticalLayout implements View, EnvironmentAware {
|
||||
public class LoginView extends VerticalLayout implements View {
|
||||
private static final String LOGIN_TEXTFIELD = "login-textfield";
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(LoginView.class);
|
||||
@@ -76,7 +74,7 @@ public class LoginView extends VerticalLayout implements View, EnvironmentAware
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private transient SPInfo spInfo;
|
||||
private transient UiProperties uiProperties;
|
||||
|
||||
@Autowired
|
||||
private transient MultitenancyIndicator multiTenancyIndicator;
|
||||
@@ -86,9 +84,6 @@ public class LoginView extends VerticalLayout implements View, EnvironmentAware
|
||||
private PasswordField password;
|
||||
private Button signin;
|
||||
|
||||
private Boolean secureCookie = Boolean.TRUE;
|
||||
private String userManagementLoginUrl;
|
||||
|
||||
void loginAuthenticationFailedNotification() {
|
||||
final Notification notification = new Notification(i18n.get("notification.login.failed.title"));
|
||||
notification.setDescription(i18n.get("notification.login.failed.description"));
|
||||
@@ -119,7 +114,8 @@ public class LoginView extends VerticalLayout implements View, EnvironmentAware
|
||||
final URI spURI = Page.getCurrent().getLocation();
|
||||
final String lookForDemoFragment = spURI.toString();
|
||||
if (lookForDemoFragment.contains("?demo")) {
|
||||
login(spInfo.getDemoTenant(), spInfo.getDemoUser(), spInfo.getDemoPassword(), false);
|
||||
login(uiProperties.getDemo().getTenant(), uiProperties.getDemo().getUser(),
|
||||
uiProperties.getDemo().getPassword(), false);
|
||||
}
|
||||
|
||||
final Component loginForm = buildLoginForm();
|
||||
@@ -243,18 +239,18 @@ public class LoginView extends VerticalLayout implements View, EnvironmentAware
|
||||
links.addComponent(demoLink);
|
||||
demoLink.addStyleName(ValoTheme.LINK_SMALL);
|
||||
|
||||
if (spInfo.getRequestAccountEmail() != null) {
|
||||
if (!uiProperties.getLinks().getRequestAccount().isEmpty()) {
|
||||
final Link requestAccountLink = SPUIComponentProvider.getLink(SPUIComponetIdProvider.LINK_REQUESTACCOUNT,
|
||||
i18n.get("link.requestaccount.name"), spInfo.getRequestAccountEmail(), FontAwesome.SHOPPING_CART,
|
||||
"", linkStyle, true);
|
||||
i18n.get("link.requestaccount.name"), uiProperties.getLinks().getRequestAccount(),
|
||||
FontAwesome.SHOPPING_CART, "", linkStyle, true);
|
||||
links.addComponent(requestAccountLink);
|
||||
requestAccountLink.addStyleName(ValoTheme.LINK_SMALL);
|
||||
}
|
||||
|
||||
if (userManagementLoginUrl != null) {
|
||||
if (!uiProperties.getLinks().getUserManagement().isEmpty()) {
|
||||
final Link userManagementLink = SPUIComponentProvider.getLink(SPUIComponetIdProvider.LINK_USERMANAGEMENT,
|
||||
i18n.get("link.usermanagement.name"), userManagementLoginUrl, FontAwesome.USERS, "_blank",
|
||||
linkStyle, true);
|
||||
i18n.get("link.usermanagement.name"), uiProperties.getLinks().getUserManagement(),
|
||||
FontAwesome.USERS, "_blank", linkStyle, true);
|
||||
links.addComponent(userManagementLink);
|
||||
userManagementLink.addStyleName(ValoTheme.LINK_SMALL);
|
||||
}
|
||||
@@ -315,7 +311,7 @@ public class LoginView extends VerticalLayout implements View, EnvironmentAware
|
||||
// 100 days
|
||||
tenantCookie.setMaxAge(3600 * 24 * 100);
|
||||
tenantCookie.setHttpOnly(true);
|
||||
tenantCookie.setSecure(secureCookie);
|
||||
tenantCookie.setSecure(uiProperties.getLogin().getCookie().isSecure());
|
||||
VaadinService.getCurrentResponse().addCookie(tenantCookie);
|
||||
}
|
||||
|
||||
@@ -324,7 +320,7 @@ public class LoginView extends VerticalLayout implements View, EnvironmentAware
|
||||
// 100 days
|
||||
usernameCookie.setMaxAge(3600 * 24 * 100);
|
||||
usernameCookie.setHttpOnly(true);
|
||||
usernameCookie.setSecure(secureCookie);
|
||||
usernameCookie.setSecure(uiProperties.getLogin().getCookie().isSecure());
|
||||
VaadinService.getCurrentResponse().addCookie(usernameCookie);
|
||||
}
|
||||
|
||||
@@ -368,16 +364,4 @@ public class LoginView extends VerticalLayout implements View, EnvironmentAware
|
||||
loginAuthenticationFailedNotification();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.springframework.context.EnvironmentAware#setEnvironment(org.
|
||||
* springframework.core.env. Environment)
|
||||
*/
|
||||
@Override
|
||||
public void setEnvironment(final Environment environment) {
|
||||
secureCookie = environment.getProperty("hawkbit.server.ui.login.cookie.secure", Boolean.class, Boolean.TRUE);
|
||||
userManagementLoginUrl = environment.getProperty("hawkbit.server.im.login.url", String.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.StringJoiner;
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.eclipse.hawkbit.repository.ActionStatusFields;
|
||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||
import org.eclipse.hawkbit.repository.exception.CancelActionNotAllowedException;
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
@@ -43,6 +44,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
@@ -417,10 +420,10 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
|
||||
final org.eclipse.hawkbit.repository.model.Action action = deploymentManagement
|
||||
.findActionWithDetails(actionId);
|
||||
final Pageable pageReq = new PageRequest(0, 1000);
|
||||
final Page<ActionStatus> actionStatusList = deploymentManagement
|
||||
.findActionStatusMessagesByActionInDescOrder(pageReq, action,
|
||||
managementUIState.isActionHistoryMaximized());
|
||||
final Pageable pageReq = new PageRequest(0, 1000,
|
||||
new Sort(Direction.DESC, ActionStatusFields.ID.getFieldName()));
|
||||
final Page<ActionStatus> actionStatusList = deploymentManagement.findActionStatusByAction(pageReq, action,
|
||||
managementUIState.isActionHistoryMaximized());
|
||||
final List<ActionStatus> content = actionStatusList.getContent();
|
||||
/*
|
||||
* Since the recent action status and messages are already
|
||||
|
||||
@@ -107,32 +107,15 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
||||
super.inittialize();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.confirmwindow.layout.
|
||||
* AbstractConfirmationWindowLayout# getConfimrationTabs()
|
||||
*/
|
||||
@Override
|
||||
protected Map<String, ConfirmationTab> getConfimrationTabs() {
|
||||
final Map<String, ConfirmationTab> tabs = new HashMap<String, ConfirmationTab>();
|
||||
/**
|
||||
* create tab for deleted distribution.
|
||||
*/
|
||||
|
||||
/* Create tab for SW Module Type delete */
|
||||
final Map<String, ConfirmationTab> tabs = new HashMap<>();
|
||||
if (!managementUIState.getDeletedDistributionList().isEmpty()) {
|
||||
tabs.put(i18n.get("caption.delete.dist.accordion.tab"), createDeletedDistributionTab());
|
||||
}
|
||||
/**
|
||||
* create tab for deleted target.
|
||||
*/
|
||||
if (!managementUIState.getDeletedTargetList().isEmpty()) {
|
||||
tabs.put(i18n.get("caption.delete.target.accordion.tab"), createDeletedTargetTab());
|
||||
}
|
||||
/**
|
||||
* create tab for assignment.
|
||||
*/
|
||||
if (!managementUIState.getAssignedList().isEmpty()) {
|
||||
tabs.put(i18n.get("caption.assign.dist.accordion.tab"), createAssignmentTab());
|
||||
}
|
||||
@@ -196,8 +179,8 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
||||
private void saveAllAssignments(final ConfirmationTab tab) {
|
||||
final Set<TargetIdName> itemIds = managementUIState.getAssignedList().keySet();
|
||||
Long distId;
|
||||
List<TargetIdName> targetIdSetList = null;
|
||||
List<TargetIdName> tempIdList = null;
|
||||
List<TargetIdName> targetIdSetList;
|
||||
List<TargetIdName> tempIdList;
|
||||
final ActionType actionType = ((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout
|
||||
.getActionTypeOptionGroup().getValue()).getActionType();
|
||||
final long forcedTimeStamp = (((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout
|
||||
@@ -205,7 +188,7 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
||||
? actionTypeOptionGroupLayout.getForcedTimeDateField().getValue().getTime()
|
||||
: Action.NO_FORCE_TIME;
|
||||
|
||||
final Map<Long, ArrayList<TargetIdName>> saveAssignedList = new HashMap<Long, ArrayList<TargetIdName>>();
|
||||
final Map<Long, ArrayList<TargetIdName>> saveAssignedList = new HashMap<>();
|
||||
|
||||
int successAssignmentCount = 0;
|
||||
int duplicateAssignmentCount = 0;
|
||||
@@ -216,7 +199,7 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
||||
if (saveAssignedList.containsKey(distId)) {
|
||||
targetIdSetList = saveAssignedList.get(distId);
|
||||
} else {
|
||||
targetIdSetList = new ArrayList<TargetIdName>();
|
||||
targetIdSetList = new ArrayList<>();
|
||||
}
|
||||
targetIdSetList.add(itemId);
|
||||
saveAssignedList.put(distId, (ArrayList<TargetIdName>) targetIdSetList);
|
||||
@@ -275,15 +258,13 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
||||
}
|
||||
|
||||
private String getAssigmentSuccessMessage(final int assignedCount) {
|
||||
final String assignment = FontAwesome.TASKS.getHtml() + SPUILabelDefinitions.HTML_SPACE
|
||||
return FontAwesome.TASKS.getHtml() + SPUILabelDefinitions.HTML_SPACE
|
||||
+ i18n.get("message.target.assignment", new Object[] { assignedCount });
|
||||
return assignment;
|
||||
}
|
||||
|
||||
private String getDuplicateAssignmentMessage(final int alreadyAssignedCount) {
|
||||
final String alreadyAssigned = FontAwesome.TASKS.getHtml() + SPUILabelDefinitions.HTML_SPACE
|
||||
return FontAwesome.TASKS.getHtml() + SPUILabelDefinitions.HTML_SPACE
|
||||
+ i18n.get("message.target.alreadyAssigned", new Object[] { alreadyAssignedCount });
|
||||
return alreadyAssigned;
|
||||
}
|
||||
|
||||
private void discardAllAssignments(final ConfirmationTab tab) {
|
||||
@@ -456,7 +437,7 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
||||
}
|
||||
|
||||
private void deleteAllDistributions(final ConfirmationTab tab) {
|
||||
final Set<Long> deletedIds = new HashSet<Long>();
|
||||
final Set<Long> deletedIds = new HashSet<>();
|
||||
managementUIState.getDeletedDistributionList().forEach(distIdName -> deletedIds.add(distIdName.getId()));
|
||||
distributionSetManagement.deleteDistributionSet(deletedIds.toArray(new Long[deletedIds.size()]));
|
||||
addToConsolitatedMsg(FontAwesome.TRASH_O.getHtml() + SPUILabelDefinitions.HTML_SPACE
|
||||
@@ -516,7 +497,7 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
||||
final IndexedContainer contactContainer = new IndexedContainer();
|
||||
contactContainer.addContainerProperty(TARGET_ID, String.class, "");
|
||||
contactContainer.addContainerProperty(TARGET_NAME, String.class, "");
|
||||
Item item = null;
|
||||
Item item;
|
||||
for (final TargetIdName targteId : managementUIState.getDeletedTargetList()) {
|
||||
item = contactContainer.addItem(targteId);
|
||||
item.getItemProperty(TARGET_ID).setValue(targteId.getControllerId());
|
||||
|
||||
@@ -18,17 +18,16 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.hawkbit.HawkbitServerProperties;
|
||||
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.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.documentation.DocumentationPageLink;
|
||||
import org.eclipse.hawkbit.ui.menu.DashboardEvent.PostViewChangeEvent;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.eclipse.hawkbit.util.SPInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.EnvironmentAware;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.security.core.context.SecurityContext;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.web.context.HttpSessionSecurityContextRepository;
|
||||
@@ -42,7 +41,6 @@ import com.vaadin.spring.annotation.SpringComponent;
|
||||
import com.vaadin.spring.annotation.UIScope;
|
||||
import com.vaadin.ui.Alignment;
|
||||
import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.Button.ClickEvent;
|
||||
import com.vaadin.ui.Button.ClickListener;
|
||||
import com.vaadin.ui.Component;
|
||||
import com.vaadin.ui.CustomComponent;
|
||||
@@ -50,7 +48,6 @@ import com.vaadin.ui.HorizontalLayout;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.Link;
|
||||
import com.vaadin.ui.MenuBar;
|
||||
import com.vaadin.ui.MenuBar.Command;
|
||||
import com.vaadin.ui.MenuBar.MenuItem;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
@@ -61,11 +58,17 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
*/
|
||||
@SpringComponent
|
||||
@UIScope
|
||||
public final class DashboardMenu extends CustomComponent implements EnvironmentAware {
|
||||
public final class DashboardMenu extends CustomComponent {
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private transient UiProperties uiProperties;
|
||||
|
||||
@Autowired
|
||||
private transient HawkbitServerProperties serverProperties;
|
||||
|
||||
private static final long serialVersionUID = 5394474618559481462L;
|
||||
|
||||
public static final String ID = "dashboard-menu";
|
||||
@@ -74,16 +77,12 @@ public final class DashboardMenu extends CustomComponent implements EnvironmentA
|
||||
private static final String STYLE_VISIBLE = "valo-menu-visible";
|
||||
|
||||
// this should be resolved when we introduce event bus on UI to just inform
|
||||
// the buttons directly
|
||||
// via events
|
||||
// the buttons directly via events
|
||||
private final List<ValoMenuItemButton> menuButtons = new ArrayList<>();
|
||||
|
||||
@Autowired
|
||||
private transient PermissionService permissionService;
|
||||
|
||||
@Autowired
|
||||
private transient SPInfo spInfo;
|
||||
|
||||
@Autowired
|
||||
private final List<DashboardMenuItem> dashboardVaadinViews = new ArrayList<>();
|
||||
|
||||
@@ -91,12 +90,10 @@ public final class DashboardMenu extends CustomComponent implements EnvironmentA
|
||||
|
||||
private boolean accessibleViewsEmpty;
|
||||
|
||||
private String userManagementLoginUrl;
|
||||
|
||||
/**
|
||||
* initializing the view and creating the layout, cannot be done in the
|
||||
* custructor because the constructor will be called by spring and the
|
||||
* dashabord must be initialized when the dashboard UI is creating.
|
||||
* constructor because the constructor will be called by spring and the
|
||||
* dashboard must be initialized when the dashboard UI is creating.
|
||||
*/
|
||||
public void init() {
|
||||
initialViewName = "";
|
||||
@@ -162,20 +159,20 @@ public final class DashboardMenu extends CustomComponent implements EnvironmentA
|
||||
links.addComponent(docuLink);
|
||||
links.setComponentAlignment(docuLink, Alignment.BOTTOM_CENTER);
|
||||
|
||||
if (userManagementLoginUrl != null) {
|
||||
if (!uiProperties.getLinks().getUserManagement().isEmpty()) {
|
||||
final Link userManagementLink = SPUIComponentProvider.getLink(SPUIComponetIdProvider.LINK_USERMANAGEMENT,
|
||||
i18n.get("link.usermanagement.name"), userManagementLoginUrl, FontAwesome.USERS, "_blank",
|
||||
linkStyle, true);
|
||||
i18n.get("link.usermanagement.name"), uiProperties.getLinks().getUserManagement(),
|
||||
FontAwesome.USERS, "_blank", linkStyle, true);
|
||||
userManagementLink.setDescription(i18n.get("link.usermanagement.name"));
|
||||
links.addComponent(userManagementLink);
|
||||
userManagementLink.setSizeFull();
|
||||
links.setComponentAlignment(userManagementLink, Alignment.BOTTOM_CENTER);
|
||||
}
|
||||
|
||||
if (spInfo.getSupportEmail() != null) {
|
||||
if (!uiProperties.getLinks().getSupport().isEmpty()) {
|
||||
final Link supportLink = SPUIComponentProvider.getLink(SPUIComponetIdProvider.LINK_SUPPORT,
|
||||
i18n.get("link.support.name"), spInfo.getSupportEmail(), FontAwesome.ENVELOPE_O, "", linkStyle,
|
||||
true);
|
||||
i18n.get("link.support.name"), uiProperties.getLinks().getSupport(), FontAwesome.ENVELOPE_O, "",
|
||||
linkStyle, true);
|
||||
supportLink.setDescription(i18n.get("link.support.name"));
|
||||
supportLink.setSizeFull();
|
||||
links.addComponent(supportLink);
|
||||
@@ -222,12 +219,7 @@ public final class DashboardMenu extends CustomComponent implements EnvironmentA
|
||||
settingsItem.setDescription(user.getUsername());
|
||||
}
|
||||
|
||||
settingsItem.addItem("Sign Out", new Command() {
|
||||
@Override
|
||||
public void menuSelected(final MenuItem selectedItem) {
|
||||
Page.getCurrent().setLocation("/UI/logout");
|
||||
}
|
||||
});
|
||||
settingsItem.addItem("Sign Out", selectedItem -> Page.getCurrent().setLocation("/UI/logout"));
|
||||
return settings;
|
||||
}
|
||||
|
||||
@@ -254,14 +246,11 @@ public final class DashboardMenu extends CustomComponent implements EnvironmentA
|
||||
}
|
||||
|
||||
private Component buildToggleButton() {
|
||||
final Button valoMenuToggleButton = new Button("Menu", new ClickListener() {
|
||||
@Override
|
||||
public void buttonClick(final ClickEvent event) {
|
||||
if (getCompositionRoot().getStyleName().contains(STYLE_VISIBLE)) {
|
||||
getCompositionRoot().removeStyleName(STYLE_VISIBLE);
|
||||
} else {
|
||||
getCompositionRoot().addStyleName(STYLE_VISIBLE);
|
||||
}
|
||||
final Button valoMenuToggleButton = new Button("Menu", (ClickListener) event -> {
|
||||
if (getCompositionRoot().getStyleName().contains(STYLE_VISIBLE)) {
|
||||
getCompositionRoot().removeStyleName(STYLE_VISIBLE);
|
||||
} else {
|
||||
getCompositionRoot().addStyleName(STYLE_VISIBLE);
|
||||
}
|
||||
});
|
||||
valoMenuToggleButton.setIcon(FontAwesome.LIST);
|
||||
@@ -307,7 +296,7 @@ public final class DashboardMenu extends CustomComponent implements EnvironmentA
|
||||
final Label label = new Label();
|
||||
label.setSizeFull();
|
||||
label.setStyleName("version-layout");
|
||||
label.setValue(spInfo.getVersion());
|
||||
label.setValue(serverProperties.getBuild().getVersion());
|
||||
return label;
|
||||
}
|
||||
|
||||
@@ -341,11 +330,6 @@ public final class DashboardMenu extends CustomComponent implements EnvironmentA
|
||||
menuButtons.forEach(button -> button.postViewChange(event));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnvironment(final Environment environment) {
|
||||
userManagementLoginUrl = environment.getProperty("hawkbit.server.im.login.url", String.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the dashboard view type by a given view name.
|
||||
*
|
||||
@@ -411,12 +395,7 @@ public final class DashboardMenu extends CustomComponent implements EnvironmentA
|
||||
setDescription(view.getDashboardCaptionLong());
|
||||
/* Avoid double click */
|
||||
setDisableOnClick(true);
|
||||
addClickListener(new ClickListener() {
|
||||
@Override
|
||||
public void buttonClick(final ClickEvent event) {
|
||||
event.getComponent().getUI().getNavigator().navigateTo(view.getViewName());
|
||||
}
|
||||
});
|
||||
addClickListener(event -> event.getComponent().getUI().getNavigator().navigateTo(view.getViewName()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,244 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.push;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.BlockingDeque;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.LinkedBlockingDeque;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagCreatedBulkEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.EntityEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.RolloutChangeEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.RolloutGroupChangeEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetCreatedEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetDeletedEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetInfoUpdateEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.TargetTagCreatedBulkEvent;
|
||||
import org.eclipse.hawkbit.im.authentication.TenantAwareAuthenticationDetails;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.security.core.context.SecurityContext;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.web.context.HttpSessionSecurityContextRepository;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
import org.vaadin.spring.events.EventBus.SessionEventBus;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.eventbus.AllowConcurrentEvents;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.vaadin.server.VaadinSession;
|
||||
import com.vaadin.server.VaadinSession.State;
|
||||
import com.vaadin.server.WrappedSession;
|
||||
import com.vaadin.ui.UI;
|
||||
|
||||
/**
|
||||
* A {@link EventPushStrategy} implementation which retrieves events from
|
||||
* {@link com.google.common.eventbus.EventBus} and store them first in an queue
|
||||
* where they will dispatched every 2 seconds to the {@link EventBus} in a
|
||||
* Vaadin access thread {@link UI#access(Runnable)}.
|
||||
*
|
||||
* This strategy avoids blocking UIs when too many events are fired and
|
||||
* dispatched to the UI thread. The UI will freeze in the time. To avoid that
|
||||
* all events are collected first and same events are merged to a list of events
|
||||
* before they dispatched to the UI thread.
|
||||
*
|
||||
* The strategy also verifies the current tenant in the session with the tenant
|
||||
* in the event and only forwards event from the right tenant to the UI.
|
||||
*
|
||||
*/
|
||||
public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DelayedEventBusPushStrategy.class);
|
||||
|
||||
private static final int BLOCK_SIZE = 10_000;
|
||||
private final ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
|
||||
private final BlockingDeque<org.eclipse.hawkbit.eventbus.event.Event> queue = new LinkedBlockingDeque<>(BLOCK_SIZE);
|
||||
private final EventBus.SessionEventBus eventBus;
|
||||
private final com.google.common.eventbus.EventBus systemEventBus;
|
||||
|
||||
private ScheduledFuture<?> jobHandle;
|
||||
|
||||
/**
|
||||
* only events defined in the set are dispatched to the session event bus.
|
||||
*/
|
||||
private static final Set<Class<?>> UI_EVENTS = Sets.newHashSet(TargetInfoUpdateEvent.class,
|
||||
TargetCreatedEvent.class, TargetDeletedEvent.class, RolloutChangeEvent.class, RolloutGroupChangeEvent.class,
|
||||
TargetTagCreatedBulkEvent.class, DistributionSetTagCreatedBulkEvent.class);
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param eventBus
|
||||
* the session event bus to where the events should be dispatched
|
||||
* @param systemEventBus
|
||||
* the system event bus where to retrieve the events from the
|
||||
* back-end
|
||||
*/
|
||||
public DelayedEventBusPushStrategy(final SessionEventBus eventBus,
|
||||
final com.google.common.eventbus.EventBus systemEventBus) {
|
||||
this.eventBus = eventBus;
|
||||
this.systemEventBus = systemEventBus;
|
||||
}
|
||||
|
||||
/**
|
||||
* An {@link com.google.common.eventbus.EventBus} subscriber which
|
||||
* subscribes {@link EntityEvent} from the repository to dispatch these
|
||||
* events to the UI {@link SessionEventBus}.
|
||||
*
|
||||
* @param event
|
||||
* the entity event which has been published from the repository
|
||||
*/
|
||||
@Subscribe
|
||||
@AllowConcurrentEvents
|
||||
public void dispatch(final org.eclipse.hawkbit.eventbus.event.Event event) {
|
||||
// to dispatch too many events which are not interested on the UI
|
||||
if (UI_EVENTS.contains(event.getClass()) && !queue.offer(event)) {
|
||||
LOG.warn("Deque limit is reached, cannot add more events!!! Dropped event is {}", event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(final UI vaadinUI) {
|
||||
LOG.debug("Initialize delayed event push strategy");
|
||||
jobHandle = executorService.scheduleWithFixedDelay(new DispatchRunnable(vaadinUI, vaadinUI.getSession()), 500,
|
||||
2000, TimeUnit.MILLISECONDS);
|
||||
systemEventBus.register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clean() {
|
||||
LOG.debug("Cleanup resources");
|
||||
jobHandle.cancel(true);
|
||||
systemEventBus.unregister(this);
|
||||
executorService.shutdownNow();
|
||||
queue.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the tenant within the event is equal with the current tenant in
|
||||
* the context.
|
||||
*
|
||||
* @param userContext
|
||||
* the security context of the current session
|
||||
* @param event
|
||||
* the event to dispatch to the UI
|
||||
* @return {@code true} if the event can be dispatched to the UI otherwise
|
||||
* {@code false}
|
||||
*/
|
||||
protected boolean eventSecurityCheck(final SecurityContext userContext,
|
||||
final org.eclipse.hawkbit.eventbus.event.Event event) {
|
||||
if (userContext == null || userContext.getAuthentication() == null) {
|
||||
return false;
|
||||
}
|
||||
final Object tenantAuthenticationDetails = userContext.getAuthentication().getDetails();
|
||||
if (tenantAuthenticationDetails instanceof TenantAwareAuthenticationDetails) {
|
||||
return ((TenantAwareAuthenticationDetails) tenantAuthenticationDetails).getTenant()
|
||||
.equalsIgnoreCase(event.getTenant());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private final class DispatchRunnable implements Runnable {
|
||||
|
||||
private final UI vaadinUI;
|
||||
private final VaadinSession vaadinSession;
|
||||
|
||||
private DispatchRunnable(final UI ui, final VaadinSession session) {
|
||||
vaadinUI = ui;
|
||||
vaadinSession = session;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
LOG.debug("UI EventBus aggregator started");
|
||||
final long timestamp = System.currentTimeMillis();
|
||||
final List<org.eclipse.hawkbit.eventbus.event.Event> events = new LinkedList<>();
|
||||
for (int i = 0; i < BLOCK_SIZE; i++) {
|
||||
final org.eclipse.hawkbit.eventbus.event.Event pollEvent = queue.poll();
|
||||
if (pollEvent == null) {
|
||||
continue;
|
||||
}
|
||||
events.add(pollEvent);
|
||||
}
|
||||
|
||||
if (events.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (vaadinSession == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG.debug("UI EventBus aggregator session: {}", vaadinSession);
|
||||
|
||||
final WrappedSession wrappedSession = vaadinSession.getSession();
|
||||
if (wrappedSession == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int eventsSize = events.size();
|
||||
|
||||
doDispatch(events, wrappedSession);
|
||||
|
||||
LOG.debug("UI EventBus aggregator done with sending {} events in {} ms", eventsSize,
|
||||
System.currentTimeMillis() - timestamp);
|
||||
|
||||
}
|
||||
|
||||
private void doDispatch(final List<org.eclipse.hawkbit.eventbus.event.Event> events,
|
||||
final WrappedSession wrappedSession) {
|
||||
final SecurityContext userContext = (SecurityContext) wrappedSession
|
||||
.getAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY);
|
||||
final SecurityContext oldContext = SecurityContextHolder.getContext();
|
||||
try {
|
||||
SecurityContextHolder.setContext(userContext);
|
||||
vaadinUI.access(() -> {
|
||||
if (vaadinSession.getState() != State.OPEN) {
|
||||
return;
|
||||
}
|
||||
fowardEvents(events, userContext);
|
||||
|
||||
// send a list of events, because ui performance issues
|
||||
publishEventAsList(events, userContext, TargetInfoUpdateEvent.class);
|
||||
publishEventAsList(events, userContext, TargetCreatedEvent.class);
|
||||
publishEventAsList(events, userContext, TargetDeletedEvent.class);
|
||||
});
|
||||
} finally {
|
||||
SecurityContextHolder.setContext(oldContext);
|
||||
}
|
||||
}
|
||||
|
||||
private void publishEventAsList(final List<org.eclipse.hawkbit.eventbus.event.Event> events,
|
||||
final SecurityContext userContext, final Class<?> eventType) {
|
||||
final List<org.eclipse.hawkbit.eventbus.event.Event> bulkEvents = events.stream()
|
||||
.filter(event -> DelayedEventBusPushStrategy.this.eventSecurityCheck(userContext, event)
|
||||
&& eventType.isInstance(event))
|
||||
.collect(Collectors.toList());
|
||||
if (bulkEvents.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
eventBus.publish(vaadinUI, bulkEvents);
|
||||
}
|
||||
|
||||
private void fowardEvents(final List<org.eclipse.hawkbit.eventbus.event.Event> events,
|
||||
final SecurityContext userContext) {
|
||||
events.stream().filter(event -> DelayedEventBusPushStrategy.this.eventSecurityCheck(userContext, event))
|
||||
.forEach(event -> eventBus.publish(vaadinUI, event));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.push;
|
||||
|
||||
import com.vaadin.ui.UI;
|
||||
|
||||
/**
|
||||
* Interface declaring a strategy to push events from the back-end to the UI.
|
||||
*
|
||||
*/
|
||||
public interface EventPushStrategy {
|
||||
|
||||
/**
|
||||
* Initialize the event push strategy, this is bound to the life-cycle of
|
||||
* the {@link UI} so the strategy can be initialized based a {@link UI}.
|
||||
*
|
||||
* @param vaadinUI
|
||||
* the {@link UI}
|
||||
*/
|
||||
void init(UI vaadinUI);
|
||||
|
||||
/**
|
||||
* Cleans up resources when the strategy is not be used anymore e.g.
|
||||
* {@link UI#detach()}.
|
||||
*/
|
||||
void clean();
|
||||
}
|
||||
@@ -84,8 +84,7 @@ public class GatewaySecurityTokenAuthenticationConfigurationItem extends Abstrac
|
||||
gatewayTokenNameTextField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, false, null, "",
|
||||
true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
gatewayTokenNameTextField.setImmediate(true);
|
||||
// hide text field until we support multiple gateway tokens for a tenant
|
||||
// MECS-830
|
||||
// hide text field until we support multiple gateway tokens for a tenan
|
||||
gatewayTokenNameTextField.setVisible(false);
|
||||
gatewayTokenNameTextField.addTextChangeListener(event -> keyNameChanged());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user