Merge pull request #84 from bsinno/doc-links-configurable

Migrated hardcoded doc links to configurable setup.
This commit is contained in:
Kai Zimmermann
2016-03-12 20:33:24 +01:00
12 changed files with 196 additions and 158 deletions

View File

@@ -24,3 +24,18 @@ spring.rabbitmq.port=5672
hawkbit.dmf.rabbitmq.deadLetterQueue=dmf_connector_deadletter
hawkbit.dmf.rabbitmq.deadLetterExchange=dmf.connector.deadletter
hawkbit.dmf.rabbitmq.receiverQueue=dmf_receiver
# UI demo account
hawkbit.server.ui.demo.password=admin
hawkbit.server.ui.demo.user=admin
hawkbit.server.ui.demo.tenant=DEFAULT
# UI help links
hawkbit.server.ui.links.documentation.root=https://github.com/eclipse/hawkbit
hawkbit.server.ui.links.documentation.deployment-view=https://github.com/eclipse/hawkbit
hawkbit.server.ui.links.documentation.distribution-view=https://github.com/eclipse/hawkbit
hawkbit.server.ui.links.documentation.rollout-view=https://github.com/eclipse/hawkbit
hawkbit.server.ui.links.documentation.security=https://github.com/eclipse/hawkbit
hawkbit.server.ui.links.documentation.system-configuration-view=https://github.com/eclipse/hawkbit
hawkbit.server.ui.links.documentation.targetfilter-view=https://github.com/eclipse/hawkbit
hawkbit.server.ui.links.documentation.upload-view=https://github.com/eclipse/hawkbit

View File

@@ -37,7 +37,7 @@ hawkbit.threadpool.queuesize=20000
hawkbit.controller.pollingTime=00:05:00
hawkbit.controller.pollingOverdueTime=00:05:00
## Configuration for RabbitMQ integration
# Configuration for RabbitMQ integration
hawkbit.dmf.rabbitmq.deadLetterQueue=dmf_connector_deadletter
hawkbit.dmf.rabbitmq.deadLetterExchange=dmf.connector.deadletter
hawkbit.dmf.rabbitmq.receiverQueue=dmf_receiver
hawkbit.dmf.rabbitmq.receiverQueue=dmf_receiver

View File

@@ -44,16 +44,16 @@ public class UiProperties {
/**
* Demo tenant.
*/
private String tenant = "DEFAULT";
private String tenant = "";
/**
* Demo user name.
*/
private String user = "admin";
private String user = "";
/**
* Demo user password.
*/
private String password = "admin";
private String password = "";
public String getTenant() {
return tenant;
@@ -82,10 +82,13 @@ public class UiProperties {
}
/**
* Links to potentially other systems (e.g. support, user management etc.).
* Links to potentially other systems (e.g. support, user management,
* documentation etc.).
*
*/
public static class Links {
private final Documentation documentation = new Documentation();
/**
* Link to product support.
*/
@@ -96,6 +99,121 @@ public class UiProperties {
*/
private String requestAccount = "";
public Documentation getDocumentation() {
return documentation;
}
/**
* Configuration of UI documentation links.
*
*/
public static class Documentation {
/**
* Link to root of documentation and user guides.
*/
private String root = "";
/**
* Link to documentation of deployment view.
*/
private String deploymentView = "";
/**
* Link to documentation of distribution view.
*/
private String distributionView = "";
/**
* Link to documentation of upload view.
*/
private String uploadView = "";
/**
* Link to documentation of system configuration view.
*/
private String systemConfigurationView = "";
/**
* Link to security related documentation.
*/
private String security = "";
/**
* Link to target filter view.
*/
private String targetfilterView = "";
/**
* Link to documentation of rollout view.
*/
private String rolloutView = "";
public String getDeploymentView() {
return deploymentView;
}
public void setDeploymentView(final String deploymentView) {
this.deploymentView = deploymentView;
}
public String getDistributionView() {
return distributionView;
}
public void setDistributionView(final String distributionView) {
this.distributionView = distributionView;
}
public String getUploadView() {
return uploadView;
}
public void setUploadView(final String uploadView) {
this.uploadView = uploadView;
}
public String getSystemConfigurationView() {
return systemConfigurationView;
}
public void setSystemConfigurationView(final String systemConfigurationView) {
this.systemConfigurationView = systemConfigurationView;
}
public String getSecurity() {
return security;
}
public void setSecurity(final String security) {
this.security = security;
}
public String getTargetfilterView() {
return targetfilterView;
}
public void setTargetfilterView(final String targetfilterView) {
this.targetfilterView = targetfilterView;
}
public String getRolloutView() {
return rolloutView;
}
public void setRolloutView(final String rolloutView) {
this.rolloutView = rolloutView;
}
public String getRoot() {
return root;
}
public void setRoot(final String root) {
this.root = root;
}
}
/**
* Link to user management.
*/

View File

@@ -47,10 +47,6 @@ import com.vaadin.ui.themes.ValoTheme;
* Approach to create necessary UI component which are decorated Aspect of fine
* tuning the component or extending the component is separated.
*
*
*
*
*
*/
public final class SPUIComponentProvider {
private static final Logger LOG = LoggerFactory.getLogger(SPUIComponentProvider.class);
@@ -411,4 +407,22 @@ public final class SPUIComponentProvider {
return link;
}
/**
* Generates help/documentation links from within management UI.
*
* @param uri
* to documentation site
*
* @return generated link
*/
public static Link getHelpLink(final String uri) {
final Link link = new Link("", new ExternalResource(uri));
link.setTargetName("_blank");
link.setIcon(FontAwesome.QUESTION_CIRCLE);
link.setDescription("Documentation");
return link;
}
}

View File

@@ -1,79 +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.documentation;
import com.vaadin.server.ExternalResource;
import com.vaadin.server.FontAwesome;
import com.vaadin.ui.Link;
/**
* enum declaration which contains all documentation links to the documenation
* which can be used to create the links to a specific documentation from a UI
* view.
*
*
*
*
*/
public enum DocumentationPageLink {
// Root URL to index.html
ROOT_VIEW(""),
// userguide/deployment
DEPLOYMENT_VIEW("deployment.html", DocumentationUtil.USERGUIDE),
// userguide/distribution
DISTRIBUTION_VIEW("distribution.html", DocumentationUtil.USERGUIDE),
// userguide/upload
UPLOAD_VIEW("upload.html", DocumentationUtil.USERGUIDE),
// userguide/statistics
STATISTICS_VIEW("statistics.html", DocumentationUtil.USERGUIDE),
// userguide
SYSTEM_CONFIGURATION_VIEW("systemconfiguration.html", DocumentationUtil.USERGUIDE),
// authentication/security
TARGET_SECURITY_TOKEN("security.html", DocumentationUtil.DEVELOPERGUIDE, "concepts"),
// userguide/targetfilter
TARGET_FILTER_VIEW("targetfilter.html", DocumentationUtil.USERGUIDE),
// userguide/ROLLOUT
ROLLOUT_VIEW("rollout.html", DocumentationUtil.USERGUIDE);
private static final String ROOT_PATH = "../documentation";
private final String[] path;
private final String page;
private DocumentationPageLink(final String page, final String... path) {
this.path = path;
this.page = page;
}
public String getPath() {
final StringBuilder builder = new StringBuilder(ROOT_PATH);
for (final String string : path) {
builder.append('/').append(string);
}
return builder.append('/').append(page).toString();
}
public Link getLink() {
final Link link = new Link("", new ExternalResource(getPath()));
link.setTargetName("_blank");
link.setIcon(FontAwesome.QUESTION_CIRCLE);
link.setDescription("Documentation");
return link;
}
}

View File

@@ -1,47 +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.documentation;
/**
* Constants for documentation navigation.
*
*
*
*/
public final class DocumentationUtil {
/**
* Navigation string to introduction folder.
*/
public static final String INTRODUCTION = "introduction";
/**
* Navigation string to userguide folder.
*/
public static final String USERGUIDE = "userguide";
/**
* Navigation string to developerguide folder.
*/
public static final String DEVELOPERGUIDE = "developerguide";
/**
* Navigation string to releasenotes folder.
*/
public static final String RELEASENOTES = "releasenotes";
/**
* Navigation string to glossary folder.
*/
public static final String GLOSSARY = "glossary";
private DocumentationUtil() {
}
}

View File

@@ -16,10 +16,10 @@ import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
import org.eclipse.hawkbit.ui.UiProperties;
import org.eclipse.hawkbit.ui.components.SPUIButton;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
import org.eclipse.hawkbit.ui.documentation.DocumentationPageLink;
import org.eclipse.hawkbit.ui.filtermanagement.event.CustomFilterUIEvent;
import org.eclipse.hawkbit.ui.filtermanagement.state.FilterManagementUIState;
import org.eclipse.hawkbit.ui.utils.I18N;
@@ -86,6 +86,9 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
@Autowired
private UINotification notification;
@Autowired
private transient UiProperties uiProperties;
@Autowired
@Qualifier("uiExecutor")
private transient Executor executor;
@@ -212,7 +215,7 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
validationIcon = createStatusIcon();
saveButton = createSaveButton();
helpLink = DocumentationPageLink.TARGET_FILTER_VIEW.getLink();
helpLink = SPUIComponentProvider.getHelpLink(uiProperties.getLinks().getDocumentation().getTargetfilterView());
closeIcon = createSearchResetIcon();
}

View File

@@ -17,7 +17,6 @@ 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.slf4j.Logger;
@@ -225,11 +224,13 @@ public class LoginView extends VerticalLayout implements View {
links.addStyleName("links");
final String linkStyle = "v-link";
final Link docuLink = SPUIComponentProvider.getLink(SPUIComponetIdProvider.LINK_DOCUMENATION,
i18n.get("link.documentation.name"), "../" + DocumentationPageLink.ROOT_VIEW.getPath(),
FontAwesome.QUESTION_CIRCLE, "_blank", linkStyle, true);
links.addComponent(docuLink);
docuLink.addStyleName(ValoTheme.LINK_SMALL);
if (!uiProperties.getLinks().getDocumentation().getRoot().isEmpty()) {
final Link docuLink = SPUIComponentProvider.getLink(SPUIComponetIdProvider.LINK_DOCUMENATION,
i18n.get("link.documentation.name"), uiProperties.getLinks().getDocumentation().getRoot(),
FontAwesome.QUESTION_CIRCLE, "_blank", linkStyle, true);
links.addComponent(docuLink);
docuLink.addStyleName(ValoTheme.LINK_SMALL);
}
if (!uiProperties.getDemo().getUser().isEmpty()) {
final Link demoLink = SPUIComponentProvider.getLink(SPUIComponetIdProvider.LINK_DEMO,

View File

@@ -18,9 +18,9 @@ import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.repository.DeploymentManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
import org.eclipse.hawkbit.ui.UiProperties;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
import org.eclipse.hawkbit.ui.documentation.DocumentationPageLink;
import org.eclipse.hawkbit.ui.management.dstable.DistributionBeanQuery;
import org.eclipse.hawkbit.ui.management.event.BulkUploadPopupEvent;
import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
@@ -88,6 +88,9 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
@Autowired
private transient DeploymentManagement deploymentManagement;
@Autowired
private transient UiProperties uiproperties;
private static final long serialVersionUID = -6659290471705262389L;
private VerticalLayout tokenVerticalLayout;
private TextArea descTextArea;
@@ -141,7 +144,8 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
progressBar = creatreProgressBar();
targetsCountLabel = getStatusCountLabel();
bulkUploader = getBulkUploadHandler();
linkToSystemConfigHelp = DocumentationPageLink.DEPLOYMENT_VIEW.getLink();
linkToSystemConfigHelp = SPUIComponentProvider
.getHelpLink(uiproperties.getLinks().getDocumentation().getDeploymentView());
windowCaption = new Label(i18n.get("caption.bulk.upload.targets"));
minimizeButton = getMinimizeButton();
closeButton = getCloseButton();

View File

@@ -23,7 +23,6 @@ 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;
@@ -151,13 +150,15 @@ public final class DashboardMenu extends CustomComponent {
links.addStyleName("links");
final String linkStyle = "v-link";
final Link docuLink = SPUIComponentProvider.getLink(SPUIComponetIdProvider.LINK_DOCUMENATION,
i18n.get("link.documentation.name"), "../" + DocumentationPageLink.ROOT_VIEW.getPath(),
FontAwesome.QUESTION_CIRCLE, "_blank", linkStyle, true);
docuLink.setDescription(i18n.get("link.documentation.name"));
docuLink.setSizeFull();
links.addComponent(docuLink);
links.setComponentAlignment(docuLink, Alignment.BOTTOM_CENTER);
if (!uiProperties.getLinks().getDocumentation().getRoot().isEmpty()) {
final Link docuLink = SPUIComponentProvider.getLink(SPUIComponetIdProvider.LINK_DOCUMENATION,
i18n.get("link.documentation.name"), uiProperties.getLinks().getDocumentation().getRoot(),
FontAwesome.QUESTION_CIRCLE, "_blank", linkStyle, true);
docuLink.setDescription(i18n.get("link.documentation.name"));
docuLink.setSizeFull();
links.addComponent(docuLink);
links.setComponentAlignment(docuLink, Alignment.BOTTOM_CENTER);
}
if (!uiProperties.getLinks().getUserManagement().isEmpty()) {
final Link userManagementLink = SPUIComponentProvider.getLink(SPUIComponetIdProvider.LINK_USERMANAGEMENT,

View File

@@ -26,9 +26,9 @@ import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupErrorAction
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupErrorCondition;
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessAction;
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessCondition;
import org.eclipse.hawkbit.ui.UiProperties;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
import org.eclipse.hawkbit.ui.documentation.DocumentationPageLink;
import org.eclipse.hawkbit.ui.filtermanagement.TargetFilterBeanQuery;
import org.eclipse.hawkbit.ui.management.footer.ActionTypeOptionGroupLayout;
import org.eclipse.hawkbit.ui.management.footer.ActionTypeOptionGroupLayout.ActionTypeOption;
@@ -104,6 +104,9 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
@Autowired
private UINotification uiNotification;
@Autowired
private transient UiProperties uiProperties;
@Autowired
private I18N i18n;
@@ -284,7 +287,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
totalTargetsLabel = createTotalTargetsLabel();
targetFilterQuery = createTargetFilterQuery();
linkToHelp = DocumentationPageLink.ROLLOUT_VIEW.getLink();
linkToHelp = SPUIComponentProvider.getHelpLink(uiProperties.getLinks().getDocumentation().getRolloutView());
actionTypeOptionGroupLayout.addStyleName(SPUIStyleDefinitions.ROLLOUT_ACTION_TYPE_LAYOUT);
}

View File

@@ -9,9 +9,9 @@
package org.eclipse.hawkbit.ui.tenantconfiguration;
import org.eclipse.hawkbit.ui.HawkbitUI;
import org.eclipse.hawkbit.ui.UiProperties;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
import org.eclipse.hawkbit.ui.documentation.DocumentationPageLink;
import org.eclipse.hawkbit.ui.tenantconfiguration.ConfigurationGroup.ConfigurationGroupChangeListener;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
@@ -54,6 +54,9 @@ public class TenantConfigurationDashboardView extends CustomComponent
@Autowired
private I18N i18n;
@Autowired
private transient UiProperties uiProperties;
@Autowired
private transient UINotification uINotification;
@@ -101,7 +104,9 @@ public class TenantConfigurationDashboardView extends CustomComponent
undoConfigurationBtn.addClickListener(event -> undoConfiguration());
hlayout.addComponent(undoConfigurationBtn);
final Link linkToSystemConfigHelp = DocumentationPageLink.SYSTEM_CONFIGURATION_VIEW.getLink();
final Link linkToSystemConfigHelp = SPUIComponentProvider
.getHelpLink(uiProperties.getLinks().getDocumentation().getSystemConfigurationView());
;
hlayout.addComponent(linkToSystemConfigHelp);
return hlayout;