From fe10c727a14089be340d60c1cbe78d28fd12f29f Mon Sep 17 00:00:00 2001
From: Ugur Saglam <106508695+ugur-vaadin@users.noreply.github.com>
Date: Thu, 15 Aug 2024 15:14:59 +0300
Subject: [PATCH] feat: add dashboard packages (#6548)
* feat: add dashboard packages
* chore: use correct license
* refactor: comment out npm package temporarily
* refactor: add polymer legacy adapter
* chore: remove incorrect npm package
* fix: correct the inverted module names
* chore: add license to pom
* fix: add module to root level pom
* chore: run formatter
* feat: add packages for testbench and integration tests
* fix: update polymer legacy adapter version
* chore: remove unused dependency
---
pom.xml | 1 +
vaadin-dashboard-flow-parent/LICENSE | 3 +
vaadin-dashboard-flow-parent/README.md | 22 +++
vaadin-dashboard-flow-parent/pom.xml | 40 +++++
.../pom.xml | 150 ++++++++++++++++++
.../dashboard/tests/DashboardPage.java | 19 +++
.../dashboard/tests/DashboardIT.java | 19 +++
.../vite.config.ts | 23 +++
.../vaadin-dashboard-flow/pom.xml | 99 ++++++++++++
.../flow/component/dashboard/Dashboard.java | 25 +++
.../component/dashboard/DashboardWidget.java | 25 +++
.../tests/DashboardSerializableTest.java | 14 ++
.../dashboard/tests/DashboardTest.java | 12 ++
.../dashboard/tests/DashboardWidgetTest.java | 12 ++
.../vaadin-dashboard-testbench/pom.xml | 46 ++++++
.../dashboard/testbench/DashboardElement.java | 19 +++
.../testbench/DashboardWidgetElement.java | 19 +++
17 files changed, 548 insertions(+)
create mode 100644 vaadin-dashboard-flow-parent/LICENSE
create mode 100644 vaadin-dashboard-flow-parent/README.md
create mode 100644 vaadin-dashboard-flow-parent/pom.xml
create mode 100644 vaadin-dashboard-flow-parent/vaadin-dashboard-flow-integration-tests/pom.xml
create mode 100644 vaadin-dashboard-flow-parent/vaadin-dashboard-flow-integration-tests/src/main/java/com/vaadin/flow/component/dashboard/tests/DashboardPage.java
create mode 100644 vaadin-dashboard-flow-parent/vaadin-dashboard-flow-integration-tests/src/test/java/com/vaadin/flow/component/dashboard/tests/DashboardIT.java
create mode 100644 vaadin-dashboard-flow-parent/vaadin-dashboard-flow-integration-tests/vite.config.ts
create mode 100644 vaadin-dashboard-flow-parent/vaadin-dashboard-flow/pom.xml
create mode 100644 vaadin-dashboard-flow-parent/vaadin-dashboard-flow/src/main/java/com/vaadin/flow/component/dashboard/Dashboard.java
create mode 100644 vaadin-dashboard-flow-parent/vaadin-dashboard-flow/src/main/java/com/vaadin/flow/component/dashboard/DashboardWidget.java
create mode 100644 vaadin-dashboard-flow-parent/vaadin-dashboard-flow/src/test/java/com/vaadin/flow/component/dashboard/tests/DashboardSerializableTest.java
create mode 100644 vaadin-dashboard-flow-parent/vaadin-dashboard-flow/src/test/java/com/vaadin/flow/component/dashboard/tests/DashboardTest.java
create mode 100644 vaadin-dashboard-flow-parent/vaadin-dashboard-flow/src/test/java/com/vaadin/flow/component/dashboard/tests/DashboardWidgetTest.java
create mode 100644 vaadin-dashboard-flow-parent/vaadin-dashboard-testbench/pom.xml
create mode 100644 vaadin-dashboard-flow-parent/vaadin-dashboard-testbench/src/main/java/com/vaadin/flow/component/dashboard/testbench/DashboardElement.java
create mode 100644 vaadin-dashboard-flow-parent/vaadin-dashboard-testbench/src/main/java/com/vaadin/flow/component/dashboard/testbench/DashboardWidgetElement.java
diff --git a/pom.xml b/pom.xml
index 7ca32f665ea..d58e598c8d6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -56,6 +56,7 @@
vaadin-combo-box-flow-parent
vaadin-context-menu-flow-parent
vaadin-custom-field-flow-parent
+ vaadin-dashboard-flow-parent
vaadin-date-picker-flow-parent
vaadin-date-time-picker-flow-parent
vaadin-details-flow-parent
diff --git a/vaadin-dashboard-flow-parent/LICENSE b/vaadin-dashboard-flow-parent/LICENSE
new file mode 100644
index 00000000000..bb61b7d20cd
--- /dev/null
+++ b/vaadin-dashboard-flow-parent/LICENSE
@@ -0,0 +1,3 @@
+This program is available under Vaadin Commercial License and Service Terms.
+See https://vaadin.com/commercial-license-and-service-terms for the full
+license.
diff --git a/vaadin-dashboard-flow-parent/README.md b/vaadin-dashboard-flow-parent/README.md
new file mode 100644
index 00000000000..c50b30cacc9
--- /dev/null
+++ b/vaadin-dashboard-flow-parent/README.md
@@ -0,0 +1,22 @@
+# Dashboard component for Vaadin Flow
+
+This project is the Component wrapper implementation of [``](https://github.com/vaadin/web-components/tree/main/packages/dashboard)
+element for use from the server side with [Vaadin Flow](https://github.com/vaadin/flow).
+
+## Using the component in a Flow application
+
+To use the component in an application using maven,
+add the following dependency to your `pom.xml`:
+```
+
+ com.vaadin
+ vaadin-dashboard-flow
+ ${component.version}
+
+```
+
+## License
+
+This component is distributed under [Vaadin Commercial License and Service Terms](https://vaadin.com/commercial-license-and-service-terms).
+
+To purchase a license, visit http://vaadin.com/pricing
diff --git a/vaadin-dashboard-flow-parent/pom.xml b/vaadin-dashboard-flow-parent/pom.xml
new file mode 100644
index 00000000000..dd4c8c84672
--- /dev/null
+++ b/vaadin-dashboard-flow-parent/pom.xml
@@ -0,0 +1,40 @@
+
+
+ 4.0.0
+
+ com.vaadin
+ vaadin-flow-components
+ 24.5-SNAPSHOT
+
+ vaadin-dashboard-flow-parent
+ pom
+ Vaadin Dashboard Parent
+ Vaadin Dashboard Parent
+
+
+ Vaadin Commercial License and Service Terms
+ https://vaadin.com/commercial-license-and-service-terms
+
+
+
+ ${maven.multiModuleProjectDirectory}/scripts/templates/vaadin-commercial-license-header.txt
+
+
+ vaadin-dashboard-flow
+ vaadin-dashboard-testbench
+
+
+
+ default
+
+
+ !release
+
+
+
+ vaadin-dashboard-flow-integration-tests
+
+
+
+
+
diff --git a/vaadin-dashboard-flow-parent/vaadin-dashboard-flow-integration-tests/pom.xml b/vaadin-dashboard-flow-parent/vaadin-dashboard-flow-integration-tests/pom.xml
new file mode 100644
index 00000000000..59155d632aa
--- /dev/null
+++ b/vaadin-dashboard-flow-parent/vaadin-dashboard-flow-integration-tests/pom.xml
@@ -0,0 +1,150 @@
+
+
+ 4.0.0
+
+ com.vaadin
+ vaadin-dashboard-flow-parent
+ 24.5-SNAPSHOT
+
+ vaadin-dashboard-integration-tests
+ war
+ Vaadin Dashboard Integration Tests
+ Vaadin Dashboard Integration Tests
+
+
+ com.vaadin
+ vaadin-dev-server
+
+
+ com.vaadin
+ vaadin-testbench-core
+ test
+
+
+ com.vaadin
+ flow-client
+
+
+ com.vaadin
+ flow-data
+
+
+ com.vaadin
+ flow-html-components
+
+
+ com.vaadin
+ vaadin-lumo-theme
+
+
+ org.slf4j
+ slf4j-simple
+
+
+ com.vaadin
+ flow-test-util
+ test
+
+
+ com.vaadin
+ vaadin-flow-components-test-util
+ ${project.version}
+ test
+
+
+ com.vaadin
+ flow-lit-template
+
+
+ com.vaadin
+ flow-polymer-template
+
+
+
+
+
+ maven-clean-plugin
+
+
+
+ ${project.basedir}
+
+ package*.json
+ pnpm*
+ vite.generated.ts
+ types.d.ts
+ tsconfig.json
+ frontend/routes.tsx
+ frontend/App.tsx
+
+
+
+ ${project.basedir}/node_modules
+ ${project.basedir}/frontend/generated
+
+
+
+
+
+ maven-failsafe-plugin
+
+
+ maven-resources-plugin
+
+
+ org.sonatype.plugins
+ nexus-staging-maven-plugin
+
+ true
+
+
+
+ org.codehaus.mojo
+ properties-maven-plugin
+
+
+ maven-install-plugin
+
+ true
+
+
+
+
+
+
+ build-frontend
+
+
+ !skipFrontend
+
+
+
+
+
+ com.vaadin
+ flow-maven-plugin
+
+
+
+
+
+ run-jetty
+
+
+ !skipJetty
+
+
+
+
+
+ org.eclipse.jetty
+ jetty-maven-plugin
+
+ 5
+
+
+
+
+
+
+
diff --git a/vaadin-dashboard-flow-parent/vaadin-dashboard-flow-integration-tests/src/main/java/com/vaadin/flow/component/dashboard/tests/DashboardPage.java b/vaadin-dashboard-flow-parent/vaadin-dashboard-flow-integration-tests/src/main/java/com/vaadin/flow/component/dashboard/tests/DashboardPage.java
new file mode 100644
index 00000000000..c18f2554312
--- /dev/null
+++ b/vaadin-dashboard-flow-parent/vaadin-dashboard-flow-integration-tests/src/main/java/com/vaadin/flow/component/dashboard/tests/DashboardPage.java
@@ -0,0 +1,19 @@
+/**
+ * Copyright 2000-2024 Vaadin Ltd.
+ *
+ * This program is available under Vaadin Commercial License and Service Terms.
+ *
+ * See {@literal } for the full
+ * license.
+ */
+package com.vaadin.flow.component.dashboard.tests;
+
+import com.vaadin.flow.component.html.Div;
+import com.vaadin.flow.router.Route;
+
+/**
+ * @author Vaadin Ltd
+ */
+@Route("vaadin-dashboard")
+public class DashboardPage extends Div {
+}
diff --git a/vaadin-dashboard-flow-parent/vaadin-dashboard-flow-integration-tests/src/test/java/com/vaadin/flow/component/dashboard/tests/DashboardIT.java b/vaadin-dashboard-flow-parent/vaadin-dashboard-flow-integration-tests/src/test/java/com/vaadin/flow/component/dashboard/tests/DashboardIT.java
new file mode 100644
index 00000000000..d97c9463a62
--- /dev/null
+++ b/vaadin-dashboard-flow-parent/vaadin-dashboard-flow-integration-tests/src/test/java/com/vaadin/flow/component/dashboard/tests/DashboardIT.java
@@ -0,0 +1,19 @@
+/**
+ * Copyright 2000-2024 Vaadin Ltd.
+ *
+ * This program is available under Vaadin Commercial License and Service Terms.
+ *
+ * See {@literal } for the full
+ * license.
+ */
+package com.vaadin.flow.component.dashboard.tests;
+
+import com.vaadin.flow.testutil.TestPath;
+import com.vaadin.tests.AbstractComponentIT;
+
+/**
+ * @author Vaadin Ltd
+ */
+@TestPath("vaadin-dashboard")
+public class DashboardIT extends AbstractComponentIT {
+}
diff --git a/vaadin-dashboard-flow-parent/vaadin-dashboard-flow-integration-tests/vite.config.ts b/vaadin-dashboard-flow-parent/vaadin-dashboard-flow-integration-tests/vite.config.ts
new file mode 100644
index 00000000000..d8518d74ada
--- /dev/null
+++ b/vaadin-dashboard-flow-parent/vaadin-dashboard-flow-integration-tests/vite.config.ts
@@ -0,0 +1,23 @@
+// @ts-ignore can not be resolved until NPM packages are installed
+import { UserConfigFn } from 'vite';
+// @ts-ignore can not be resolved until Flow generates base Vite config
+import { overrideVaadinConfig } from './vite.generated';
+// import { useLocalWebComponents } from '../../shared/web-components-vite-plugin';
+
+const customConfig: UserConfigFn = (env) => ({
+ // Here you can add custom Vite parameters
+ // https://vitejs.dev/config/
+
+ // Use local version of web-components, disabled by default
+ // To use this un-comment the lines below and change the path to
+ // the absolute path of your web-components repo's node_modules
+ // folder
+ // DO NOT COMMIT THESE CHANGES!
+ /*
+ plugins: [
+ useLocalWebComponents('/path/to/web-components/node_modules')
+ ]
+ */
+});
+
+export default overrideVaadinConfig(customConfig);
diff --git a/vaadin-dashboard-flow-parent/vaadin-dashboard-flow/pom.xml b/vaadin-dashboard-flow-parent/vaadin-dashboard-flow/pom.xml
new file mode 100644
index 00000000000..3c9778e08dc
--- /dev/null
+++ b/vaadin-dashboard-flow-parent/vaadin-dashboard-flow/pom.xml
@@ -0,0 +1,99 @@
+
+
+ 4.0.0
+
+ com.vaadin
+ vaadin-dashboard-flow-parent
+ 24.5-SNAPSHOT
+
+ vaadin-dashboard-flow
+ jar
+ Vaadin Dashboard
+ Vaadin Dashboard
+
+
+ com.vaadin
+ vaadin-flow-components-base
+ ${project.version}
+
+
+ jakarta.servlet
+ jakarta.servlet-api
+
+
+ com.vaadin
+ flow-server
+ provided
+
+
+ junit
+ junit
+ test
+
+
+ org.mockito
+ mockito-core
+ test
+
+
+ com.vaadin
+ flow-test-generic
+ test
+
+
+ org.slf4j
+ slf4j-simple
+ test
+
+
+ jakarta.platform
+ jakarta.jakartaee-web-api
+ test
+
+
+
+
+
+ biz.aQute.bnd
+ bnd-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+
+ ${project.build.outputDirectory}/META-INF/MANIFEST.MF
+
+
+
+
+
+
+
+
+ attach-docs
+
+
+ with-docs
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+
+
+
+
+
+
diff --git a/vaadin-dashboard-flow-parent/vaadin-dashboard-flow/src/main/java/com/vaadin/flow/component/dashboard/Dashboard.java b/vaadin-dashboard-flow-parent/vaadin-dashboard-flow/src/main/java/com/vaadin/flow/component/dashboard/Dashboard.java
new file mode 100644
index 00000000000..9ac14d04e14
--- /dev/null
+++ b/vaadin-dashboard-flow-parent/vaadin-dashboard-flow/src/main/java/com/vaadin/flow/component/dashboard/Dashboard.java
@@ -0,0 +1,25 @@
+/**
+ * Copyright 2000-2024 Vaadin Ltd.
+ *
+ * This program is available under Vaadin Commercial License and Service Terms.
+ *
+ * See {@literal } for the full
+ * license.
+ */
+package com.vaadin.flow.component.dashboard;
+
+import com.vaadin.flow.component.Component;
+import com.vaadin.flow.component.Tag;
+import com.vaadin.flow.component.dependency.JsModule;
+import com.vaadin.flow.component.dependency.NpmPackage;
+
+/**
+ * @author Vaadin Ltd
+ */
+@Tag("vaadin-dashboard")
+@NpmPackage(value = "@vaadin/polymer-legacy-adapter", version = "24.5.0-alpha8")
+@JsModule("@vaadin/polymer-legacy-adapter/style-modules.js")
+@JsModule("@vaadin/dashboard/src/vaadin-dashboard.js")
+// @NpmPackage(value = "@vaadin/dashboard", version = "24.6.0-alpha0")
+public class Dashboard extends Component {
+}
diff --git a/vaadin-dashboard-flow-parent/vaadin-dashboard-flow/src/main/java/com/vaadin/flow/component/dashboard/DashboardWidget.java b/vaadin-dashboard-flow-parent/vaadin-dashboard-flow/src/main/java/com/vaadin/flow/component/dashboard/DashboardWidget.java
new file mode 100644
index 00000000000..9198a9d8dcf
--- /dev/null
+++ b/vaadin-dashboard-flow-parent/vaadin-dashboard-flow/src/main/java/com/vaadin/flow/component/dashboard/DashboardWidget.java
@@ -0,0 +1,25 @@
+/**
+ * Copyright 2000-2024 Vaadin Ltd.
+ *
+ * This program is available under Vaadin Commercial License and Service Terms.
+ *
+ * See {@literal } for the full
+ * license.
+ */
+package com.vaadin.flow.component.dashboard;
+
+import com.vaadin.flow.component.Component;
+import com.vaadin.flow.component.Tag;
+import com.vaadin.flow.component.dependency.JsModule;
+import com.vaadin.flow.component.dependency.NpmPackage;
+
+/**
+ * @author Vaadin Ltd
+ */
+@Tag("vaadin-dashboard-widget")
+@NpmPackage(value = "@vaadin/polymer-legacy-adapter", version = "24.5.0-alpha8")
+@JsModule("@vaadin/polymer-legacy-adapter/style-modules.js")
+@JsModule("@vaadin/dashboard/src/vaadin-dashboard-widget.js")
+// @NpmPackage(value = "@vaadin/dashboard", version = "24.6.0-alpha0")
+public class DashboardWidget extends Component {
+}
diff --git a/vaadin-dashboard-flow-parent/vaadin-dashboard-flow/src/test/java/com/vaadin/flow/component/dashboard/tests/DashboardSerializableTest.java b/vaadin-dashboard-flow-parent/vaadin-dashboard-flow/src/test/java/com/vaadin/flow/component/dashboard/tests/DashboardSerializableTest.java
new file mode 100644
index 00000000000..8eac521aa14
--- /dev/null
+++ b/vaadin-dashboard-flow-parent/vaadin-dashboard-flow/src/test/java/com/vaadin/flow/component/dashboard/tests/DashboardSerializableTest.java
@@ -0,0 +1,14 @@
+/**
+ * Copyright 2000-2024 Vaadin Ltd.
+ *
+ * This program is available under Vaadin Commercial License and Service Terms.
+ *
+ * See {@literal } for the full
+ * license.
+ */
+package com.vaadin.flow.component.dashboard.tests;
+
+import com.vaadin.flow.testutil.ClassesSerializableTest;
+
+public class DashboardSerializableTest extends ClassesSerializableTest {
+}
diff --git a/vaadin-dashboard-flow-parent/vaadin-dashboard-flow/src/test/java/com/vaadin/flow/component/dashboard/tests/DashboardTest.java b/vaadin-dashboard-flow-parent/vaadin-dashboard-flow/src/test/java/com/vaadin/flow/component/dashboard/tests/DashboardTest.java
new file mode 100644
index 00000000000..883a15383fb
--- /dev/null
+++ b/vaadin-dashboard-flow-parent/vaadin-dashboard-flow/src/test/java/com/vaadin/flow/component/dashboard/tests/DashboardTest.java
@@ -0,0 +1,12 @@
+/**
+ * Copyright 2000-2024 Vaadin Ltd.
+ *
+ * This program is available under Vaadin Commercial License and Service Terms.
+ *
+ * See {@literal } for the full
+ * license.
+ */
+package com.vaadin.flow.component.dashboard.tests;
+
+public class DashboardTest {
+}
diff --git a/vaadin-dashboard-flow-parent/vaadin-dashboard-flow/src/test/java/com/vaadin/flow/component/dashboard/tests/DashboardWidgetTest.java b/vaadin-dashboard-flow-parent/vaadin-dashboard-flow/src/test/java/com/vaadin/flow/component/dashboard/tests/DashboardWidgetTest.java
new file mode 100644
index 00000000000..bea69c56ff2
--- /dev/null
+++ b/vaadin-dashboard-flow-parent/vaadin-dashboard-flow/src/test/java/com/vaadin/flow/component/dashboard/tests/DashboardWidgetTest.java
@@ -0,0 +1,12 @@
+/**
+ * Copyright 2000-2024 Vaadin Ltd.
+ *
+ * This program is available under Vaadin Commercial License and Service Terms.
+ *
+ * See {@literal } for the full
+ * license.
+ */
+package com.vaadin.flow.component.dashboard.tests;
+
+public class DashboardWidgetTest {
+}
diff --git a/vaadin-dashboard-flow-parent/vaadin-dashboard-testbench/pom.xml b/vaadin-dashboard-flow-parent/vaadin-dashboard-testbench/pom.xml
new file mode 100644
index 00000000000..462cb444062
--- /dev/null
+++ b/vaadin-dashboard-flow-parent/vaadin-dashboard-testbench/pom.xml
@@ -0,0 +1,46 @@
+
+
+ 4.0.0
+
+ vaadin-dashboard-flow-parent
+ com.vaadin
+ 24.5-SNAPSHOT
+
+ vaadin-dashboard-testbench
+ jar
+ Vaadin Dashboard Testbench API
+ Vaadin Dashboard Testbench API
+
+
+ com.vaadin
+ vaadin-testbench-shared
+ provided
+
+
+
+
+
+
+
+
+ attach-docs
+
+
+ with-docs
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+
+
+
+
+
diff --git a/vaadin-dashboard-flow-parent/vaadin-dashboard-testbench/src/main/java/com/vaadin/flow/component/dashboard/testbench/DashboardElement.java b/vaadin-dashboard-flow-parent/vaadin-dashboard-testbench/src/main/java/com/vaadin/flow/component/dashboard/testbench/DashboardElement.java
new file mode 100644
index 00000000000..3f86d9d7ba4
--- /dev/null
+++ b/vaadin-dashboard-flow-parent/vaadin-dashboard-testbench/src/main/java/com/vaadin/flow/component/dashboard/testbench/DashboardElement.java
@@ -0,0 +1,19 @@
+/**
+ * Copyright 2000-2024 Vaadin Ltd.
+ *
+ * This program is available under Vaadin Commercial License and Service Terms.
+ *
+ * See {@literal } for the full
+ * license.
+ */
+package com.vaadin.flow.component.dashboard.testbench;
+
+import com.vaadin.testbench.TestBenchElement;
+import com.vaadin.testbench.elementsbase.Element;
+
+/**
+ * @author Vaadin Ltd
+ */
+@Element("vaadin-dashboard")
+public class DashboardElement extends TestBenchElement {
+}
diff --git a/vaadin-dashboard-flow-parent/vaadin-dashboard-testbench/src/main/java/com/vaadin/flow/component/dashboard/testbench/DashboardWidgetElement.java b/vaadin-dashboard-flow-parent/vaadin-dashboard-testbench/src/main/java/com/vaadin/flow/component/dashboard/testbench/DashboardWidgetElement.java
new file mode 100644
index 00000000000..8dd67498b6e
--- /dev/null
+++ b/vaadin-dashboard-flow-parent/vaadin-dashboard-testbench/src/main/java/com/vaadin/flow/component/dashboard/testbench/DashboardWidgetElement.java
@@ -0,0 +1,19 @@
+/**
+ * Copyright 2000-2024 Vaadin Ltd.
+ *
+ * This program is available under Vaadin Commercial License and Service Terms.
+ *
+ * See {@literal } for the full
+ * license.
+ */
+package com.vaadin.flow.component.dashboard.testbench;
+
+import com.vaadin.testbench.TestBenchElement;
+import com.vaadin.testbench.elementsbase.Element;
+
+/**
+ * @author Vaadin Ltd
+ */
+@Element("vaadin-dashboard-widget")
+public class DashboardWidgetElement extends TestBenchElement {
+}