From 2b4b715472f7c5961e557541a93a0c9e06982339 Mon Sep 17 00:00:00 2001 From: Kai Zimmermann Date: Wed, 30 Mar 2016 14:31:03 +0200 Subject: [PATCH] Created another hawkBit app example that demonstrates theme custimization. Signed-off-by: Kai Zimmermann --- .../hawkbit-custom-theme-example/README.md | 1 + examples/hawkbit-custom-theme-example/pom.xml | 112 ++++++++++++++++++ .../org/eclipse/hawkbit/app/MyLoginUI.java | 34 ++++++ .../java/org/eclipse/hawkbit/app/MyUI.java | 45 +++++++ .../java/org/eclipse/hawkbit/app/Start.java | 36 ++++++ .../VAADIN/themes/exampletheme/.gitignore | 2 + .../customstyles/examplevariables.scss | 24 ++++ .../exampletheme/images/profile-pic-57px.jpg | Bin 0 -> 1189 bytes .../themes/exampletheme/layouts/footer.html | 29 +++++ .../VAADIN/themes/exampletheme/styles.scss | 10 ++ .../src/main/resources/application.properties | 16 +++ hawkbit-repository/pom.xml | 4 + hawkbit-rest-api/pom.xml | 1 - .../hawkbit/images/profile-pic-300px.jpg | Bin 1793 -> 0 bytes pom.xml | 6 + 15 files changed, 319 insertions(+), 1 deletion(-) create mode 100644 examples/hawkbit-custom-theme-example/README.md create mode 100644 examples/hawkbit-custom-theme-example/pom.xml create mode 100644 examples/hawkbit-custom-theme-example/src/main/java/org/eclipse/hawkbit/app/MyLoginUI.java create mode 100644 examples/hawkbit-custom-theme-example/src/main/java/org/eclipse/hawkbit/app/MyUI.java create mode 100644 examples/hawkbit-custom-theme-example/src/main/java/org/eclipse/hawkbit/app/Start.java create mode 100644 examples/hawkbit-custom-theme-example/src/main/resources/VAADIN/themes/exampletheme/.gitignore create mode 100644 examples/hawkbit-custom-theme-example/src/main/resources/VAADIN/themes/exampletheme/customstyles/examplevariables.scss create mode 100644 examples/hawkbit-custom-theme-example/src/main/resources/VAADIN/themes/exampletheme/images/profile-pic-57px.jpg create mode 100644 examples/hawkbit-custom-theme-example/src/main/resources/VAADIN/themes/exampletheme/layouts/footer.html create mode 100644 examples/hawkbit-custom-theme-example/src/main/resources/VAADIN/themes/exampletheme/styles.scss create mode 100644 examples/hawkbit-custom-theme-example/src/main/resources/application.properties delete mode 100644 hawkbit-ui/src/main/resources/VAADIN/themes/hawkbit/images/profile-pic-300px.jpg diff --git a/examples/hawkbit-custom-theme-example/README.md b/examples/hawkbit-custom-theme-example/README.md new file mode 100644 index 000000000..5a6a571c8 --- /dev/null +++ b/examples/hawkbit-custom-theme-example/README.md @@ -0,0 +1 @@ +Theme customization example for Eclipse hawkBit. See wiki for the theme customization guide. \ No newline at end of file diff --git a/examples/hawkbit-custom-theme-example/pom.xml b/examples/hawkbit-custom-theme-example/pom.xml new file mode 100644 index 000000000..7caa99ba2 --- /dev/null +++ b/examples/hawkbit-custom-theme-example/pom.xml @@ -0,0 +1,112 @@ + + + 4.0.0 + + org.eclipse.hawkbit + hawkbit-examples-parent + 0.2.0-SNAPSHOT + + hawkbit-custom-theme-example + hawkBit :: Custom Theme Example App + + + + + com.vaadin + vaadin-maven-plugin + ${vaadin.plugin.version} + + src/main/resources + + + + + update-theme + compile-theme + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + ${baseDir} + false + org.eclipse.hawkbit.app.Start + JAR + + + + + + + + + + + org.eclipse.hawkbit + hawkbit-autoconfigure + ${project.version} + + + org.eclipse.hawkbit + hawkbit-ui + ${project.version} + + + org.eclipse.hawkbit + hawkbit-security-integration + ${project.version} + + + org.eclipse.hawkbit + hawkbit-http-security + ${project.version} + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter + + + org.springframework.boot + spring-boot-starter-logging + + + + + org.springframework.boot + spring-boot-starter-log4j2 + + + org.springframework.security + spring-security-aspects + + + com.h2database + h2 + + + + diff --git a/examples/hawkbit-custom-theme-example/src/main/java/org/eclipse/hawkbit/app/MyLoginUI.java b/examples/hawkbit-custom-theme-example/src/main/java/org/eclipse/hawkbit/app/MyLoginUI.java new file mode 100644 index 000000000..c31086a70 --- /dev/null +++ b/examples/hawkbit-custom-theme-example/src/main/java/org/eclipse/hawkbit/app/MyLoginUI.java @@ -0,0 +1,34 @@ +/** + * 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.app; + +import org.eclipse.hawkbit.ui.login.HawkbitLoginUI; +import org.eclipse.hawkbit.ui.themes.HawkbitTheme; + +import com.vaadin.annotations.Theme; +import com.vaadin.annotations.Title; +import com.vaadin.spring.annotation.SpringUI; + +/** + * Example hawkBit login UI implementation. + * + * A {@link SpringUI} annotated class must be present in the classpath for the + * login path. The easiest way to get an hawkBit login UI running is to extend + * the {@link HawkbitLoginUI} and to annotated it with {@link SpringUI} as in + * this example to the defined {@link HawkbitTheme#LOGIN_UI_PATH}. + * + */ +@SpringUI(path = HawkbitTheme.LOGIN_UI_PATH) +@Title("hawkBit Theme example") +@Theme(value = "exampletheme") +public class MyLoginUI extends HawkbitLoginUI { + + private static final long serialVersionUID = 1L; + +} diff --git a/examples/hawkbit-custom-theme-example/src/main/java/org/eclipse/hawkbit/app/MyUI.java b/examples/hawkbit-custom-theme-example/src/main/java/org/eclipse/hawkbit/app/MyUI.java new file mode 100644 index 000000000..5ef632d10 --- /dev/null +++ b/examples/hawkbit-custom-theme-example/src/main/java/org/eclipse/hawkbit/app/MyUI.java @@ -0,0 +1,45 @@ +package org.eclipse.hawkbit.app; +/** + * 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 + */ + +import org.eclipse.hawkbit.ui.HawkbitUI; +import org.eclipse.hawkbit.ui.UIEventProvider; +import org.eclipse.hawkbit.ui.push.DelayedEventBusPushStrategy; +import org.springframework.beans.factory.annotation.Autowired; + +import com.google.common.eventbus.EventBus; +import com.vaadin.annotations.Push; +import com.vaadin.annotations.Theme; +import com.vaadin.annotations.Title; +import com.vaadin.shared.communication.PushMode; +import com.vaadin.shared.ui.ui.Transport; +import com.vaadin.spring.annotation.SpringUI; + +/** + * Example hawkBit UI implementation. + * + * A {@link SpringUI} annotated class must be present in the classpath. The + * easiest way to get an hawkBit UI running is to extend the {@link HawkbitUI} + * and to annotated it with {@link SpringUI} as in this example. + * + */ +@SpringUI +@Push(value = PushMode.AUTOMATIC, transport = Transport.WEBSOCKET) +@Title("hawkBit Theme example") +@Theme(value = "exampletheme") +public class MyUI extends HawkbitUI { + + private static final long serialVersionUID = 1L; + + @Autowired + public MyUI(final EventBus systemEventBus, final org.vaadin.spring.events.EventBus.SessionEventBus eventBus, + final UIEventProvider provider) { + super(new DelayedEventBusPushStrategy(eventBus, systemEventBus, provider)); + } +} diff --git a/examples/hawkbit-custom-theme-example/src/main/java/org/eclipse/hawkbit/app/Start.java b/examples/hawkbit-custom-theme-example/src/main/java/org/eclipse/hawkbit/app/Start.java new file mode 100644 index 000000000..1c4c5d32d --- /dev/null +++ b/examples/hawkbit-custom-theme-example/src/main/java/org/eclipse/hawkbit/app/Start.java @@ -0,0 +1,36 @@ +package org.eclipse.hawkbit.app; +/** + * 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 + */ + +import org.eclipse.hawkbit.RepositoryApplicationConfiguration; +import org.eclipse.hawkbit.autoconfigure.security.EnableHawkbitManagedSecurityConfiguration; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Import; + +/** + * A {@link SpringBootApplication} annotated class with a main method to start. + * The minimal configuration for the stand alone hawkBit server. + * + */ +@SpringBootApplication +@Import({ RepositoryApplicationConfiguration.class }) +@EnableHawkbitManagedSecurityConfiguration +public class Start { + + /** + * Main method to start the spring-boot application. + * + * @param args + * the VM arguments. + */ + public static void main(final String[] args) { + SpringApplication.run(Start.class, args); + } +} diff --git a/examples/hawkbit-custom-theme-example/src/main/resources/VAADIN/themes/exampletheme/.gitignore b/examples/hawkbit-custom-theme-example/src/main/resources/VAADIN/themes/exampletheme/.gitignore new file mode 100644 index 000000000..1cdd02b74 --- /dev/null +++ b/examples/hawkbit-custom-theme-example/src/main/resources/VAADIN/themes/exampletheme/.gitignore @@ -0,0 +1,2 @@ +/addons.scss +/styles.css diff --git a/examples/hawkbit-custom-theme-example/src/main/resources/VAADIN/themes/exampletheme/customstyles/examplevariables.scss b/examples/hawkbit-custom-theme-example/src/main/resources/VAADIN/themes/exampletheme/customstyles/examplevariables.scss new file mode 100644 index 000000000..6bf201f9c --- /dev/null +++ b/examples/hawkbit-custom-theme-example/src/main/resources/VAADIN/themes/exampletheme/customstyles/examplevariables.scss @@ -0,0 +1,24 @@ +/** + * 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 + */ + +$dark-gray: #848484; + +//Example color change +$hawkbit-primary-color: $dark-gray; +$hawkbit-primary-color-light: #D8D8D8; +$app-selection-item-selection-color: $dark-gray; +$app-focus-color: $dark-gray; +$app-selection-color: $dark-gray; +$tag-text-color: $dark-gray; +$tab-sheet-caption-color: $dark-gray; +$table-details-tab-font-color: $dark-gray; +$widget-caption-color: $dark-gray; +$accordion-action-history-title-color: $dark-gray; +$menu-title-bg-color: $dark-gray; +$button-icon-color: $dark-gray; \ No newline at end of file diff --git a/examples/hawkbit-custom-theme-example/src/main/resources/VAADIN/themes/exampletheme/images/profile-pic-57px.jpg b/examples/hawkbit-custom-theme-example/src/main/resources/VAADIN/themes/exampletheme/images/profile-pic-57px.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d730cb5f67e12741e3e50df31315a81d0e1ceab6 GIT binary patch literal 1189 zcmex=3RdL56^| zgLDBA4+lF3NCj!&{{aR;4hBmGOJ+tT1|~s9W31L-*^|&n?(5RLW_pFY_v2QRTR`%g#5e%KD%Fx+cp| z%lOc~qbj~fDSorx%7U9`_q6CNmaRB%9~eFL^ZCZK>Uyb6U&+I@t4tqX*uefpZC~30 zrY;RI=AZXZ!Ed{q`PIna(@Za~%RP87|H$Vb*KEuFGsxJe$~CV)UMtf&JtV!%X@6nc zozL&*To-f@|D(U6SN+H|bD!PUI4_?1)!1Ph} z=vFUf5D9c;5D6E4biVgjU9-)!ZyQh67D{S)&E2?~@8G`VU(}!zx_ + + + + diff --git a/examples/hawkbit-custom-theme-example/src/main/resources/VAADIN/themes/exampletheme/styles.scss b/examples/hawkbit-custom-theme-example/src/main/resources/VAADIN/themes/exampletheme/styles.scss new file mode 100644 index 000000000..2407a73fb --- /dev/null +++ b/examples/hawkbit-custom-theme-example/src/main/resources/VAADIN/themes/exampletheme/styles.scss @@ -0,0 +1,10 @@ +@import "../hawkbit/customstyles/hawkbitvariables"; +@import "customstyles/examplevariables"; +@import "../hawkbit/hawkbittheme"; +@import "addons"; + +// This file prefixes all rules with the theme name to avoid causing conflicts with other themes. +.exampletheme { + @include addons; + @include hawkbittheme; +} diff --git a/examples/hawkbit-custom-theme-example/src/main/resources/application.properties b/examples/hawkbit-custom-theme-example/src/main/resources/application.properties new file mode 100644 index 000000000..3ffb51bd0 --- /dev/null +++ b/examples/hawkbit-custom-theme-example/src/main/resources/application.properties @@ -0,0 +1,16 @@ +# +# 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 +# + +# 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 diff --git a/hawkbit-repository/pom.xml b/hawkbit-repository/pom.xml index 7259262de..b70e00f28 100644 --- a/hawkbit-repository/pom.xml +++ b/hawkbit-repository/pom.xml @@ -67,6 +67,10 @@ org.hibernate hibernate-validator + + javax.validation + validation-api + com.google.guava guava diff --git a/hawkbit-rest-api/pom.xml b/hawkbit-rest-api/pom.xml index be9abafac..703d6caf3 100644 --- a/hawkbit-rest-api/pom.xml +++ b/hawkbit-rest-api/pom.xml @@ -24,7 +24,6 @@ javax.validation validation-api - 1.1.0.Final org.springframework.hateoas diff --git a/hawkbit-ui/src/main/resources/VAADIN/themes/hawkbit/images/profile-pic-300px.jpg b/hawkbit-ui/src/main/resources/VAADIN/themes/hawkbit/images/profile-pic-300px.jpg deleted file mode 100644 index 664afaa35aa45a62b717447b59410f333706503d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1793 zcmb_ddoRSq&;=X}yY29#D&UApL?S_nKu{*Bl9fpm5`jQg zBU7j}I-O2bQP)tTX{gfZv=t`^8m_@$@mMULrc6+#{cDo9016H`PGgP`&9VSrnme!u^t4FHmnho3*xDW<_BE>lnq#Wi9anc%dL0sz`j z2sAI20ze-f2SyS$02@tRKwcjdI>wq%i5v(qNCWuy>j5AR1F+fS$tpxDgOGBUB-E4u zLd=o?=~^6wq>6#27;drcMl}d^Z2};FfQ{6^)cW+WKX^m@x|;~BkqWqoF#*C@&>gYT z5UH9^0$}^w8<@&s06-M~V!ml5G@-7t=T!{Vm-FEo#mNv-3Y3 zUGR6=AU0rG#<3*A#D08*P1n>dc)6gxF=RU1?M3R_ zC=Rn>bN{hg->hbGXU?G-d_@53iB}_|I6Lj7ov0?NL1OASrD-Lu-C#$o9mDavN`qo{ zA88iuo1W_0Z|;WANWAy5*sMzEppjAE8`c$u86Iubx~=6gx;XpW`QpZzicso3kF8E} zkb|3P8(3s5T|dICV>yNUzHxYFnzDADVKH3$l=H@^t=cm97SF~z+%L=LIe*$~jy5DC z2)LQDpK?VD_UDV9F@tQ3wNrmcotT|}_#-|2&SqJP$-B#i6AQ`oy#Z8Nnoev><&ZG2 zEB#gI_5Pw@R#97lvwEFX_sMG67ZOL^(ZGh-h_q_Y*li*$lBoBfkAfZEtNlWu?;k`K zI4ql|?=gruQl?^K+|8>^KW!#5mfbH*?3fe4z0T+pbL!*idsQ=MoDB4OU&QVcYgzcm zqZJ#brgPn=QxBwsL~j%fi|VjtCF~w0;tqG+Af}J*ffxV_;Mg<#JB7sEHbF zFo!%SVY(KQ10Fm@seP-ID{#&!?6h_8*-?Bq#(3~GpPG7gGLY+DR}om=IAC6MGQrFG zaqAe4$H+RNsd;I4937_}mKD__$dDG8pHuZqQLnHwDCLIES?QGT8uxOuHPzd4M)gag zbDu(qk#2FnJ)``RQa}VV=FO=tu{7-dfNSiyciEk|sO7e>zC{kH=H}g+t0}Wm+qHO= zGkR0XUhRGk+@?^;#POzMh0@N3kiH0_z4IClS1_)#yonUww$| z#M)e;@>qN3T}uLwM>DAbghv%7>HP5C&MR4JC)9gWj|KbXzVy=X)R%*!kBh9L?Uo(} z)P5b+{LR4xp{%7-A<{>5d6{ + 1.1.0.Final 1.4 2.0M10 1.4.22 @@ -419,6 +420,11 @@ + + javax.validation + validation-api + ${validation-api.version} + javax.el javax.el-api