From 28c1483cf1fa49d799c95f1dca728eabf26c8630 Mon Sep 17 00:00:00 2001 From: f43nd1r Date: Wed, 27 Nov 2019 22:29:24 +0100 Subject: [PATCH] perform migration to vaadin 14 styles, add banner --- .gitignore | 1 - .../styles/shared-styles.js} | 31 +++++----------- .../com/faendir/acra/ui/view/MainView.java | 5 +-- .../acra/ui/view/user/UserManager.java | 1 - acrarium/src/main/resources/banner.txt | 6 +++ acrarium/webpack.config.js | 37 +++++++++++++++++++ 6 files changed, 54 insertions(+), 27 deletions(-) rename acrarium/{src/main/resources/META-INF/resources/frontend/styles/shared-styles.html => frontend/styles/shared-styles.js} (56%) create mode 100644 acrarium/src/main/resources/banner.txt create mode 100644 acrarium/webpack.config.js diff --git a/.gitignore b/.gitignore index b8f2506..ddcbebf 100644 --- a/.gitignore +++ b/.gitignore @@ -34,7 +34,6 @@ nbdist/ **/node_modules package-lock.json package.json -webpack.config.js webpack.generated.js ### Maven ### diff --git a/acrarium/src/main/resources/META-INF/resources/frontend/styles/shared-styles.html b/acrarium/frontend/styles/shared-styles.js similarity index 56% rename from acrarium/src/main/resources/META-INF/resources/frontend/styles/shared-styles.html rename to acrarium/frontend/styles/shared-styles.js index bef3989..08c1659 100644 --- a/acrarium/src/main/resources/META-INF/resources/frontend/styles/shared-styles.html +++ b/acrarium/frontend/styles/shared-styles.js @@ -1,4 +1,4 @@ - - - - + */ +import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js'; - - - + [part="form-title"] { + display: none; + } +`); diff --git a/acrarium/src/main/java/com/faendir/acra/ui/view/MainView.java b/acrarium/src/main/java/com/faendir/acra/ui/view/MainView.java index 76809b9..7356f76 100644 --- a/acrarium/src/main/java/com/faendir/acra/ui/view/MainView.java +++ b/acrarium/src/main/java/com/faendir/acra/ui/view/MainView.java @@ -37,7 +37,7 @@ import com.vaadin.flow.component.applayout.AppLayout; import com.vaadin.flow.component.applayout.DrawerToggle; import com.vaadin.flow.component.button.Button; import com.vaadin.flow.component.button.ButtonVariant; -import com.vaadin.flow.component.dependency.HtmlImport; +import com.vaadin.flow.component.dependency.JsModule; import com.vaadin.flow.component.html.Div; import com.vaadin.flow.component.html.Image; import com.vaadin.flow.component.icon.VaadinIcon; @@ -65,7 +65,7 @@ import java.util.Map; * @author lukas * @since 13.07.18 */ -@HtmlImport("frontend://styles/shared-styles.html") +@JsModule("./styles/shared-styles.js") @UIScope @SpringComponent public class MainView extends ParentLayout { @@ -147,7 +147,6 @@ public class MainView extends ParentLayout { private void showLogin() { Translatable logo = Translatable.createImage("frontend/logo.png", Messages.ACRARIUM); logo.setWidth(0, Unit.PIXEL); - logo.setPadding(1, Unit.REM); FlexLayout logoWrapper = new FlexLayout(logo); logoWrapper.expand(logo); LoginI18n loginI18n = LoginI18n.createDefault(); diff --git a/acrarium/src/main/java/com/faendir/acra/ui/view/user/UserManager.java b/acrarium/src/main/java/com/faendir/acra/ui/view/user/UserManager.java index fab9d53..32ade6a 100644 --- a/acrarium/src/main/java/com/faendir/acra/ui/view/user/UserManager.java +++ b/acrarium/src/main/java/com/faendir/acra/ui/view/user/UserManager.java @@ -70,7 +70,6 @@ public class UserManager extends Composite implements HasAcrariumTit protected void onAttach(AttachEvent attachEvent) { super.onAttach(attachEvent); getContent().removeAll(); - getContent().add(Translatable.createLabel(Messages.USERS)); MyGrid userGrid = new MyGrid<>(userService.getUserProvider()); userGrid.setWidthFull(); userGrid.setSelectionMode(Grid.SelectionMode.NONE); diff --git a/acrarium/src/main/resources/banner.txt b/acrarium/src/main/resources/banner.txt new file mode 100644 index 0000000..5d4fafd --- /dev/null +++ b/acrarium/src/main/resources/banner.txt @@ -0,0 +1,6 @@ + _ + /\ (_) + / \ ___ _ __ __ _ _ __ _ _ _ _ __ ___ + / /\ \ / __| | '__| / _` | | '__| | | | | | | | '_ ` _ \ + / ____ \ | (__ | | | (_| | | | | | | |_| | | | | | | | + /_/ \_\ \___| |_| \__,_| |_| |_| \__,_| |_| |_| |_| diff --git a/acrarium/webpack.config.js b/acrarium/webpack.config.js new file mode 100644 index 0000000..fec9643 --- /dev/null +++ b/acrarium/webpack.config.js @@ -0,0 +1,37 @@ +/** + * This file has been autogenerated as it didn't exist or was made for an older incompatible version. + * This file can be used for manual configuration will not be modified if the flowDefaults constant exists. + */ +const merge = require('webpack-merge'); +const flowDefaults = require('./webpack.generated.js'); + +module.exports = merge(flowDefaults, { + +}); + +/** + * This file can be used to configure the flow plugin defaults. + * + * // Add a custom plugin + * flowDefaults.plugins.push(new MyPlugin()); + * + * // Update the rules to also transpile `.mjs` files + * if (!flowDefaults.module.rules[0].test) { + * throw "Unexpected structure in generated webpack config"; + * } + * flowDefaults.module.rules[0].test = /\.m?js$/ + * + * // Include a custom JS in the entry point in addition to generated-flow-imports.js + * if (typeof flowDefaults.entry.index != "string") { + * throw "Unexpected structure in generated webpack config"; + * } + * flowDefaults.entry.index = [flowDefaults.entry.index, "myCustomFile.js"]; + * + * or add new configuration in the merge block. + * + * module.exports = merge(flowDefaults, { + * mode: 'development', + * devtool: 'inline-source-map' + * }); + * + */