Generated project
This commit is contained in:
commit
6e3f448aa3
19
.gitignore
vendored
Normal file
19
.gitignore
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/target/
|
||||||
|
.idea/
|
||||||
|
.settings
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
|
||||||
|
*.iml
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# The following files are generated/updated by vaadin-maven-plugin
|
||||||
|
node_modules/
|
||||||
|
frontend/generated/
|
||||||
|
pnpmfile.js
|
||||||
|
|
||||||
|
# Browser drivers for local integration tests
|
||||||
|
drivers/
|
||||||
|
# Error screenshots generated by TestBench for failed integration tests
|
||||||
|
error-screenshots/
|
||||||
|
webpack.generated.js
|
118
.mvn/wrapper/MavenWrapperDownloader.java
vendored
Normal file
118
.mvn/wrapper/MavenWrapperDownloader.java
vendored
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2007-present the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
import java.net.*;
|
||||||
|
import java.io.*;
|
||||||
|
import java.nio.channels.*;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
public class MavenWrapperDownloader {
|
||||||
|
|
||||||
|
private static final String WRAPPER_VERSION = "0.5.6";
|
||||||
|
/**
|
||||||
|
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is
|
||||||
|
* provided.
|
||||||
|
*/
|
||||||
|
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
|
||||||
|
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path to the maven-wrapper.properties file, which might contain a downloadUrl
|
||||||
|
* property to use instead of the default one.
|
||||||
|
*/
|
||||||
|
private static final String MAVEN_WRAPPER_PROPERTIES_PATH = ".mvn/wrapper/maven-wrapper.properties";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path where the maven-wrapper.jar will be saved to.
|
||||||
|
*/
|
||||||
|
private static final String MAVEN_WRAPPER_JAR_PATH = ".mvn/wrapper/maven-wrapper.jar";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the property which should be used to override the default download
|
||||||
|
* url for the wrapper.
|
||||||
|
*/
|
||||||
|
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
|
||||||
|
|
||||||
|
public static void main(String args[]) {
|
||||||
|
System.out.println("- Downloader started");
|
||||||
|
File baseDirectory = new File(args[0]);
|
||||||
|
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
|
||||||
|
|
||||||
|
// If the maven-wrapper.properties exists, read it and check if it contains a
|
||||||
|
// custom
|
||||||
|
// wrapperUrl parameter.
|
||||||
|
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
|
||||||
|
String url = DEFAULT_DOWNLOAD_URL;
|
||||||
|
if (mavenWrapperPropertyFile.exists()) {
|
||||||
|
FileInputStream mavenWrapperPropertyFileInputStream = null;
|
||||||
|
try {
|
||||||
|
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
|
||||||
|
Properties mavenWrapperProperties = new Properties();
|
||||||
|
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
|
||||||
|
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (mavenWrapperPropertyFileInputStream != null) {
|
||||||
|
mavenWrapperPropertyFileInputStream.close();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
// Ignore ...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("- Downloading from: " + url);
|
||||||
|
|
||||||
|
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
|
||||||
|
if (!outputFile.getParentFile().exists()) {
|
||||||
|
if (!outputFile.getParentFile().mkdirs()) {
|
||||||
|
System.out.println(
|
||||||
|
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
|
||||||
|
try {
|
||||||
|
downloadFileFromURL(url, outputFile);
|
||||||
|
System.out.println("Done");
|
||||||
|
System.exit(0);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
System.out.println("- Error downloading");
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
|
||||||
|
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
|
||||||
|
String username = System.getenv("MVNW_USERNAME");
|
||||||
|
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
|
||||||
|
Authenticator.setDefault(new Authenticator() {
|
||||||
|
@Override
|
||||||
|
protected PasswordAuthentication getPasswordAuthentication() {
|
||||||
|
return new PasswordAuthentication(username, password);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
URL website = new URL(urlString);
|
||||||
|
ReadableByteChannel rbc;
|
||||||
|
rbc = Channels.newChannel(website.openStream());
|
||||||
|
FileOutputStream fos = new FileOutputStream(destination);
|
||||||
|
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
|
||||||
|
fos.close();
|
||||||
|
rbc.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
BIN
.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
BIN
.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
Binary file not shown.
2
.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
2
.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip
|
||||||
|
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
|
6
.npmrc
Normal file
6
.npmrc
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#
|
||||||
|
# NOTICE: this is an auto-generated file
|
||||||
|
#
|
||||||
|
# This file sets the default parameters for manual `pnpm install`.
|
||||||
|
#
|
||||||
|
shamefully-hoist=true
|
4
.prettierrc.js
Normal file
4
.prettierrc.js
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
module.exports = {
|
||||||
|
singleQuote: true,
|
||||||
|
printWidth: 120,
|
||||||
|
};
|
9
.vscode/extensions.json
vendored
Normal file
9
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"recommendations": [
|
||||||
|
"runem.lit-plugin",
|
||||||
|
"vscjava.vscode-java-pack",
|
||||||
|
"pivotal.vscode-spring-boot",
|
||||||
|
"vaadin.studio"
|
||||||
|
],
|
||||||
|
"unwantedRecommendations": []
|
||||||
|
}
|
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"lit-plugin.strict": true
|
||||||
|
}
|
34
Dockerfile
Normal file
34
Dockerfile
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# Stage that builds the application, a prerequisite for the running stage
|
||||||
|
FROM maven:3-openjdk-16-slim as build
|
||||||
|
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
|
||||||
|
RUN apt-get update -qq && apt-get install -qq --no-install-recommends nodejs
|
||||||
|
|
||||||
|
# Stop running as root at this point
|
||||||
|
RUN useradd -m myuser
|
||||||
|
WORKDIR /usr/src/app/
|
||||||
|
RUN chown myuser:myuser /usr/src/app/
|
||||||
|
USER myuser
|
||||||
|
|
||||||
|
# Copy pom.xml and prefetch dependencies so a repeated build can continue from the next step with existing dependencies
|
||||||
|
COPY --chown=myuser pom.xml ./
|
||||||
|
RUN mvn dependency:go-offline -Pproduction
|
||||||
|
|
||||||
|
# Copy all needed project files to a folder
|
||||||
|
COPY --chown=myuser:myuser src src
|
||||||
|
COPY --chown=myuser:myuser frontend frontend
|
||||||
|
COPY --chown=myuser:myuser package.json ./
|
||||||
|
|
||||||
|
# Using * after the files that are autogenerated so that so build won't fail if they are not yet created
|
||||||
|
COPY --chown=myuser:myuser package-lock.json* pnpm-lock.yaml* webpack.config.js* ./
|
||||||
|
|
||||||
|
|
||||||
|
# Build the production package, assuming that we validated the version before so no need for running tests again
|
||||||
|
RUN mvn clean package -DskipTests -Pproduction
|
||||||
|
|
||||||
|
# Running stage: the part that is used for running the application
|
||||||
|
FROM openjdk:16-jdk-slim
|
||||||
|
COPY --from=build /usr/src/app/target/*.jar /usr/app/app.jar
|
||||||
|
RUN useradd -m myuser
|
||||||
|
USER myuser
|
||||||
|
EXPOSE 8080
|
||||||
|
CMD java -jar /usr/app/app.jar
|
24
LICENSE.md
Normal file
24
LICENSE.md
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
This is free and unencumbered software released into the public domain.
|
||||||
|
|
||||||
|
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||||
|
distribute this software, either in source code form or as a compiled
|
||||||
|
binary, for any purpose, commercial or non-commercial, and by any
|
||||||
|
means.
|
||||||
|
|
||||||
|
In jurisdictions that recognize copyright laws, the author or authors
|
||||||
|
of this software dedicate any and all copyright interest in the
|
||||||
|
software to the public domain. We make this dedication for the benefit
|
||||||
|
of the public at large and to the detriment of our heirs and
|
||||||
|
successors. We intend this dedication to be an overt act of
|
||||||
|
relinquishment in perpetuity of all present and future rights to this
|
||||||
|
software under copyright law.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
For more information, please refer to <http://unlicense.org>
|
63
README.md
Normal file
63
README.md
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
# Custom project from start.vaadin.com
|
||||||
|
|
||||||
|
This project can be used as a starting point to create your own Vaadin application with Spring Boot.
|
||||||
|
It contains all the necessary configuration and some placeholder files to get you started.
|
||||||
|
|
||||||
|
## Running the application
|
||||||
|
The project is a standard Maven project. To run it from the command line,
|
||||||
|
type `mvnw` (Windows), or `./mvnw` (Mac & Linux), then open
|
||||||
|
http://localhost:8080 in your browser.
|
||||||
|
|
||||||
|
You can also import the project to your IDE of choice as you would with any
|
||||||
|
Maven project. Read more on [how to set up a development environment for
|
||||||
|
Vaadin projects](https://vaadin.com/docs/latest/guide/install) (Windows, Linux, macOS).
|
||||||
|
|
||||||
|
## Deploying to Production
|
||||||
|
To create a production build, call `mvnw clean package -Pproduction` (Windows),
|
||||||
|
or `./mvnw clean package -Pproduction` (Mac & Linux).
|
||||||
|
This will build a JAR file with all the dependencies and front-end resources,
|
||||||
|
ready to be deployed. The file can be found in the `target` folder after the build completes.
|
||||||
|
|
||||||
|
Once the JAR file is built, you can run it using
|
||||||
|
`java -jar target/myapp-1.0-SNAPSHOT.jar` (NOTE, replace
|
||||||
|
`myapp-1.0-SNAPSHOT.jar` with the name of your jar).
|
||||||
|
|
||||||
|
## Project structure
|
||||||
|
|
||||||
|
<table style="width:100%; text-align: left;">
|
||||||
|
<tr><th>Directory</th><th>Description</th></tr>
|
||||||
|
<tr><td><code>frontend/</code></td><td>Client-side source directory</td></tr>
|
||||||
|
<tr><td> <code>index.html</code></td><td>HTML template</td></tr>
|
||||||
|
<tr><td> <code>index.ts</code></td><td>Frontend entrypoint, contains the client-side routing setup using <a href="https://vaadin.com/router">Vaadin Router</a></td></tr>
|
||||||
|
<tr><td> <code>main-layout.ts</code></td><td>Main layout Web Component, contains the navigation menu, uses <a href="https://vaadin.com/components/vaadin-app-layout">App Layout</a></td></tr>
|
||||||
|
<tr><td> <code>views/</code></td><td>UI views Web Components (TypeScript)</td></tr>
|
||||||
|
<tr><td> <code>themes/</code></td><td>Custom
|
||||||
|
CSS styles</td></tr>
|
||||||
|
<tr><td><code>src/main/java/<groupId>/</code></td><td>Server-side
|
||||||
|
source directory, contains the server-side Java views</td></tr>
|
||||||
|
<tr><td> <code>Application.java</code></td><td>Server entry-point</td></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
## Useful links
|
||||||
|
|
||||||
|
- Read the documentation at [vaadin.com/docs](https://vaadin.com/docs/latest/).
|
||||||
|
- Create new projects at [start.vaadin.com](https://start.vaadin.com/).
|
||||||
|
- Search UI components and their usage examples at [vaadin.com/components](https://vaadin.com/components).
|
||||||
|
- Find a collection of solutions to common use cases in [Vaadin Cookbook](https://cookbook.vaadin.com/).
|
||||||
|
- Find Add-ons at [vaadin.com/directory](https://vaadin.com/directory).
|
||||||
|
- Ask questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/vaadin) or join our [Discord channel](https://discord.gg/MYFq5RTbBn).
|
||||||
|
- Report issues, create pull requests in [GitHub](https://github.com/vaadin/).
|
||||||
|
|
||||||
|
## Deploying using Docker
|
||||||
|
|
||||||
|
To build the Dockerized version of the project, run
|
||||||
|
|
||||||
|
```
|
||||||
|
docker build . -t myapp:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
Once the Docker image is correctly built, you can test it locally using
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run -p 8080:8080 myapp:latest
|
||||||
|
```
|
74
frontend/auth.ts
Normal file
74
frontend/auth.ts
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
import { login as loginImpl, LoginResult, logout as logoutImpl } from '@vaadin/flow-frontend';
|
||||||
|
import { appStore } from './stores/app-store';
|
||||||
|
|
||||||
|
interface Authentication {
|
||||||
|
timestamp: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
let authentication: Authentication | undefined = undefined;
|
||||||
|
|
||||||
|
const AUTHENTICATION_KEY = 'authentication';
|
||||||
|
const THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1000;
|
||||||
|
|
||||||
|
// Get authentication from local storage
|
||||||
|
const storedAuthenticationJson = localStorage.getItem(AUTHENTICATION_KEY);
|
||||||
|
if (storedAuthenticationJson !== null) {
|
||||||
|
const storedAuthentication = JSON.parse(storedAuthenticationJson) as Authentication;
|
||||||
|
// Check that the stored timestamp is not older than 30 days
|
||||||
|
const hasRecentAuthenticationTimestamp = new Date().getTime() - storedAuthentication.timestamp < THIRTY_DAYS_MS;
|
||||||
|
if (hasRecentAuthenticationTimestamp) {
|
||||||
|
// Use loaded authentication
|
||||||
|
authentication = storedAuthentication;
|
||||||
|
} else {
|
||||||
|
// Delete expired stored authentication
|
||||||
|
setSessionExpired();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Forces the session to expire and removes user information stored in
|
||||||
|
* `localStorage`.
|
||||||
|
*/
|
||||||
|
export function setSessionExpired() {
|
||||||
|
authentication = undefined;
|
||||||
|
|
||||||
|
// Delete the authentication from the local storage
|
||||||
|
localStorage.removeItem(AUTHENTICATION_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isAuthenticated() {
|
||||||
|
return !!authentication;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Login wrapper method that retrieves user information.
|
||||||
|
*
|
||||||
|
* Uses `localStorage` for offline support.
|
||||||
|
*/
|
||||||
|
export async function login(username: string, password: string): Promise<LoginResult> {
|
||||||
|
const result = await loginImpl(username, password);
|
||||||
|
if (!result.error) {
|
||||||
|
// Get user info from endpoint
|
||||||
|
await appStore.fetchUserInfo();
|
||||||
|
authentication = {
|
||||||
|
timestamp: new Date().getTime(),
|
||||||
|
};
|
||||||
|
|
||||||
|
// Save the authentication to local storage
|
||||||
|
localStorage.setItem(AUTHENTICATION_KEY, JSON.stringify(authentication));
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Login wrapper method that retrieves user information.
|
||||||
|
*
|
||||||
|
* Uses `localStorage` for offline support.
|
||||||
|
*/
|
||||||
|
export async function logout() {
|
||||||
|
setSessionExpired();
|
||||||
|
await logoutImpl();
|
||||||
|
appStore.clearUserInfo();
|
||||||
|
location.href = '';
|
||||||
|
}
|
24
frontend/index.html
Normal file
24
frontend/index.html
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<title>Fusion Management</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
#outlet {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<!-- index.ts is included here automatically (either by the dev server or during the build) -->
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="outlet"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
20
frontend/index.ts
Normal file
20
frontend/index.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { Router } from '@vaadin/router';
|
||||||
|
import { routes } from './routes';
|
||||||
|
import { appStore } from './stores/app-store';
|
||||||
|
|
||||||
|
export const router = new Router(document.querySelector('#outlet'));
|
||||||
|
|
||||||
|
appStore.fetchUserInfo().finally(() => {
|
||||||
|
// Ensure router access checks are not done before we know if we are logged in
|
||||||
|
router.setRoutes(routes);
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener('vaadin-router-location-changed', (e) => {
|
||||||
|
appStore.setLocation((e as CustomEvent).detail.location);
|
||||||
|
const title = appStore.currentViewTitle;
|
||||||
|
if (title) {
|
||||||
|
document.title = title + ' | ' + appStore.applicationName;
|
||||||
|
} else {
|
||||||
|
document.title = appStore.applicationName;
|
||||||
|
}
|
||||||
|
});
|
80
frontend/routes.ts
Normal file
80
frontend/routes.ts
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
import { Route } from '@vaadin/router';
|
||||||
|
import Role from './generated/com/example/application/data/Role';
|
||||||
|
import { appStore } from './stores/app-store';
|
||||||
|
import './views/home/home-view';
|
||||||
|
import './views/main-layout';
|
||||||
|
|
||||||
|
export type ViewRoute = Route & {
|
||||||
|
title?: string;
|
||||||
|
icon?: string;
|
||||||
|
requiresLogin?: boolean;
|
||||||
|
rolesAllowed?: Role[];
|
||||||
|
children?: ViewRoute[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export const hasAccess = (route: Route) => {
|
||||||
|
const viewRoute = route as ViewRoute;
|
||||||
|
if (viewRoute.requiresLogin && !appStore.loggedIn) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (viewRoute.rolesAllowed) {
|
||||||
|
return viewRoute.rolesAllowed.some((role) => appStore.isUserInRole(role));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const views: ViewRoute[] = [
|
||||||
|
// place routes below (more info https://vaadin.com/docs/latest/fusion/routing/overview)
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: 'home-view',
|
||||||
|
icon: 'la la-home',
|
||||||
|
title: 'Home',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'profile',
|
||||||
|
component: 'profile-view',
|
||||||
|
requiresLogin: true,
|
||||||
|
icon: 'la la-user',
|
||||||
|
title: 'Profile',
|
||||||
|
action: async (_context, _command) => {
|
||||||
|
if (!hasAccess(_context.route)) {
|
||||||
|
return _command.redirect('login');
|
||||||
|
}
|
||||||
|
await import('./views/profile/profile-view');
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'admin',
|
||||||
|
component: 'admin-view',
|
||||||
|
rolesAllowed: [Role.ADMIN],
|
||||||
|
icon: 'la la-user-lock',
|
||||||
|
title: 'Admin',
|
||||||
|
action: async (_context, _command) => {
|
||||||
|
if (!hasAccess(_context.route)) {
|
||||||
|
return _command.redirect('login');
|
||||||
|
}
|
||||||
|
await import('./views/admin/admin-view');
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
export const routes: ViewRoute[] = [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: 'main-layout',
|
||||||
|
children: [...views],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'login',
|
||||||
|
component: 'login-view',
|
||||||
|
icon: '',
|
||||||
|
title: 'Login',
|
||||||
|
action: async (_context, _command) => {
|
||||||
|
await import('./views/login/login-view');
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
48
frontend/stores/app-store.ts
Normal file
48
frontend/stores/app-store.ts
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
import { RouterLocation } from '@vaadin/router';
|
||||||
|
import User from 'Frontend/generated/com/cubetiqs/fusion/data/entity/User';
|
||||||
|
import Role from 'Frontend/generated/com/cubetiqs/fusion/data/Role';
|
||||||
|
import { UserEndpoint } from 'Frontend/generated/UserEndpoint';
|
||||||
|
import { makeAutoObservable } from 'mobx';
|
||||||
|
|
||||||
|
export class AppStore {
|
||||||
|
applicationName = 'Fusion Management';
|
||||||
|
|
||||||
|
// The location, relative to the base path, e.g. "hello" when viewing "/hello"
|
||||||
|
location = '';
|
||||||
|
|
||||||
|
currentViewTitle = '';
|
||||||
|
|
||||||
|
user: User | undefined = undefined;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
makeAutoObservable(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
setLocation(location: RouterLocation) {
|
||||||
|
if (location.route) {
|
||||||
|
this.location = location.route.path;
|
||||||
|
} else if (location.pathname.startsWith(location.baseUrl)) {
|
||||||
|
this.location = location.pathname.substr(location.baseUrl.length);
|
||||||
|
} else {
|
||||||
|
this.location = location.pathname;
|
||||||
|
}
|
||||||
|
this.currentViewTitle = (location?.route as any)?.title || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
async fetchUserInfo() {
|
||||||
|
this.user = await UserEndpoint.getAuthenticatedUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
clearUserInfo() {
|
||||||
|
this.user = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
get loggedIn() {
|
||||||
|
return !!this.user;
|
||||||
|
}
|
||||||
|
|
||||||
|
isUserInRole(role: Role) {
|
||||||
|
return this.user?.roles?.includes(role);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export const appStore = new AppStore();
|
50
frontend/themes/fusionmanagement/main-layout.css
Normal file
50
frontend/themes/fusionmanagement/main-layout.css
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
.sidemenu-header {
|
||||||
|
align-items: center;
|
||||||
|
box-shadow: var(--lumo-box-shadow-s);
|
||||||
|
display: flex;
|
||||||
|
height: var(--lumo-size-xl);
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidemenu-header h1 {
|
||||||
|
font-size: var(--lumo-font-size-l);
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidemenu-menu #logo {
|
||||||
|
align-items: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: flex;
|
||||||
|
padding: var(--lumo-space-s) var(--lumo-space-m);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidemenu-menu #logo img {
|
||||||
|
height: calc(var(--lumo-size-l) * 1.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidemenu-menu #logo span {
|
||||||
|
font-size: var(--lumo-font-size-xl);
|
||||||
|
font-weight: 600;
|
||||||
|
margin: 0 var(--lumo-space-s);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidemenu-menu vaadin-tab {
|
||||||
|
font-size: var(--lumo-font-size-s);
|
||||||
|
height: var(--lumo-size-l);
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--lumo-body-text-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidemenu-menu vaadin-tab:hover {
|
||||||
|
background-color: var(--lumo-contrast-5pct);
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidemenu-menu vaadin-tab[selected] {
|
||||||
|
background-color: var(--lumo-primary-color-10pct);
|
||||||
|
color: var(--lumo-primary-text-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
margin: 0;
|
||||||
|
}
|
9
frontend/themes/fusionmanagement/styles.css
Normal file
9
frontend/themes/fusionmanagement/styles.css
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
@import url('./main-layout.css');
|
||||||
|
@import url('./views/home-view.css');
|
||||||
|
@import url('./views/profile-view.css');
|
||||||
|
@import url('./views/admin-view.css');
|
||||||
|
@import url('line-awesome/dist/line-awesome/css/line-awesome.min.css');
|
||||||
|
@import url('@fontsource/roboto'); html {
|
||||||
|
--lumo-font-family: Roboto;
|
||||||
|
|
||||||
|
}
|
1
frontend/themes/fusionmanagement/theme.json
Normal file
1
frontend/themes/fusionmanagement/theme.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"lumoImports":["typography","color","spacing","badge","utility"]}
|
3
frontend/themes/fusionmanagement/views/admin-view.css
Normal file
3
frontend/themes/fusionmanagement/views/admin-view.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
admin-view {
|
||||||
|
display: block;
|
||||||
|
}
|
3
frontend/themes/fusionmanagement/views/home-view.css
Normal file
3
frontend/themes/fusionmanagement/views/home-view.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
home-view {
|
||||||
|
display: block;
|
||||||
|
}
|
3
frontend/themes/fusionmanagement/views/profile-view.css
Normal file
3
frontend/themes/fusionmanagement/views/profile-view.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
profile-view {
|
||||||
|
display: block;
|
||||||
|
}
|
10
frontend/views/admin/admin-view.ts
Normal file
10
frontend/views/admin/admin-view.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { html } from 'lit';
|
||||||
|
import { customElement } from 'lit/decorators.js';
|
||||||
|
import { View } from '../../views/view';
|
||||||
|
|
||||||
|
@customElement('admin-view')
|
||||||
|
export class AdminView extends View {
|
||||||
|
render() {
|
||||||
|
return html`<div>Content placeholder</div>`;
|
||||||
|
}
|
||||||
|
}
|
10
frontend/views/home/home-view.ts
Normal file
10
frontend/views/home/home-view.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { html } from 'lit';
|
||||||
|
import { customElement } from 'lit/decorators.js';
|
||||||
|
import { View } from '../../views/view';
|
||||||
|
|
||||||
|
@customElement('home-view')
|
||||||
|
export class HomeView extends View {
|
||||||
|
render() {
|
||||||
|
return html`<div>Content placeholder</div>`;
|
||||||
|
}
|
||||||
|
}
|
40
frontend/views/login/login-view.ts
Normal file
40
frontend/views/login/login-view.ts
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import '@vaadin/vaadin-login';
|
||||||
|
import { LoginI18n } from '@vaadin/vaadin-login';
|
||||||
|
import { html } from 'lit';
|
||||||
|
import { customElement, state } from 'lit/decorators';
|
||||||
|
import { View } from '../../views/view';
|
||||||
|
|
||||||
|
const loginI18nDefault: LoginI18n = {
|
||||||
|
form: {
|
||||||
|
title: 'Log in',
|
||||||
|
username: 'Username',
|
||||||
|
password: 'Password',
|
||||||
|
submit: 'Log in',
|
||||||
|
forgotPassword: 'Forgot password',
|
||||||
|
},
|
||||||
|
errorMessage: {
|
||||||
|
title: 'Incorrect username or password',
|
||||||
|
message: 'Check that you have entered the correct username and password and try again.',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
@customElement('login-view')
|
||||||
|
export class LoginView extends View {
|
||||||
|
@state()
|
||||||
|
private error = false;
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return html`
|
||||||
|
<vaadin-login-overlay
|
||||||
|
opened
|
||||||
|
.error=${this.error}
|
||||||
|
action="login"
|
||||||
|
no-forgot-password
|
||||||
|
.i18n=${Object.assign(
|
||||||
|
{ header: { title: 'Fusion Management', description: 'Login using user/user or admin/admin' } },
|
||||||
|
loginI18nDefault
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
</vaadin-login-overlay>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
}
|
83
frontend/views/main-layout.ts
Normal file
83
frontend/views/main-layout.ts
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
import '@vaadin/vaadin-app-layout';
|
||||||
|
import { AppLayoutElement } from '@vaadin/vaadin-app-layout';
|
||||||
|
import '@vaadin/vaadin-app-layout/vaadin-drawer-toggle';
|
||||||
|
import '@vaadin/vaadin-avatar/vaadin-avatar';
|
||||||
|
import '@vaadin/vaadin-context-menu';
|
||||||
|
import '@vaadin/vaadin-tabs';
|
||||||
|
import '@vaadin/vaadin-tabs/vaadin-tab';
|
||||||
|
import '@vaadin/vaadin-template-renderer';
|
||||||
|
import { html, render } from 'lit';
|
||||||
|
import { customElement } from 'lit/decorators.js';
|
||||||
|
import { logout } from '../auth';
|
||||||
|
import { router } from '../index';
|
||||||
|
import { hasAccess, views } from '../routes';
|
||||||
|
import { appStore } from '../stores/app-store';
|
||||||
|
import { Layout } from './view';
|
||||||
|
|
||||||
|
interface RouteInfo {
|
||||||
|
path: string;
|
||||||
|
title: string;
|
||||||
|
icon: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
@customElement('main-layout')
|
||||||
|
export class MainLayout extends Layout {
|
||||||
|
render() {
|
||||||
|
return html`
|
||||||
|
<vaadin-app-layout primary-section="drawer">
|
||||||
|
<header slot="navbar" theme="dark" class="sidemenu-header">
|
||||||
|
<vaadin-drawer-toggle></vaadin-drawer-toggle>
|
||||||
|
<h1>${appStore.currentViewTitle}</h1>
|
||||||
|
${appStore.user
|
||||||
|
? html` <vaadin-context-menu class="ms-auto me-m" open-on="click" .renderer="${this.renderLogoutOptions}">
|
||||||
|
<vaadin-avatar img="${appStore.user.profilePictureUrl}" name="${appStore.user.name}"></vaadin-avatar
|
||||||
|
></vaadin-context-menu>`
|
||||||
|
: html`<a class="ms-auto me-m" router-ignore href="login">Sign in</a>`}
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div slot="drawer" class="sidemenu-menu">
|
||||||
|
<div id="logo">
|
||||||
|
<img src="images/logo.png" alt="${appStore.applicationName} logo" />
|
||||||
|
<span>${appStore.applicationName}</span>
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
<vaadin-tabs orientation="vertical" theme="minimal" .selected=${this.getSelectedViewRoute()}>
|
||||||
|
${this.getMenuRoutes().map(
|
||||||
|
(viewRoute) => html`
|
||||||
|
<vaadin-tab>
|
||||||
|
<span class="${viewRoute.icon} pr-s"></span>
|
||||||
|
<a href=${router.urlForPath(viewRoute.path)} tabindex="-1">${viewRoute.title}</a>
|
||||||
|
</vaadin-tab>
|
||||||
|
`
|
||||||
|
)}
|
||||||
|
</vaadin-tabs>
|
||||||
|
</div>
|
||||||
|
<slot></slot>
|
||||||
|
</vaadin-app-layout>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
connectedCallback() {
|
||||||
|
super.connectedCallback();
|
||||||
|
this.classList.add('block', 'h-full');
|
||||||
|
this.reaction(
|
||||||
|
() => appStore.location,
|
||||||
|
() => {
|
||||||
|
AppLayoutElement.dispatchCloseOverlayDrawerEvent();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private renderLogoutOptions(root: HTMLElement) {
|
||||||
|
render(html`<vaadin-list-box><vaadin-item @click=${() => logout()}>Logout</vaadin-item></vaadin-list-box>`, root);
|
||||||
|
}
|
||||||
|
|
||||||
|
private getMenuRoutes(): RouteInfo[] {
|
||||||
|
return views.filter((route) => route.title).filter((route) => hasAccess(route)) as RouteInfo[];
|
||||||
|
}
|
||||||
|
|
||||||
|
private getSelectedViewRoute(): number {
|
||||||
|
const path = appStore.location;
|
||||||
|
return this.getMenuRoutes().findIndex((viewRoute) => viewRoute.path == path);
|
||||||
|
}
|
||||||
|
}
|
10
frontend/views/profile/profile-view.ts
Normal file
10
frontend/views/profile/profile-view.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { html } from 'lit';
|
||||||
|
import { customElement } from 'lit/decorators.js';
|
||||||
|
import { View } from '../../views/view';
|
||||||
|
|
||||||
|
@customElement('profile-view')
|
||||||
|
export class ProfileView extends View {
|
||||||
|
render() {
|
||||||
|
return html`<div>Content placeholder</div>`;
|
||||||
|
}
|
||||||
|
}
|
51
frontend/views/view.ts
Normal file
51
frontend/views/view.ts
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
import { MobxLitElement } from '@adobe/lit-mobx';
|
||||||
|
import { applyTheme } from 'Frontend/generated/theme';
|
||||||
|
import { autorun, IAutorunOptions, IReactionDisposer, IReactionOptions, IReactionPublic, reaction } from 'mobx';
|
||||||
|
|
||||||
|
export class MobxElement extends MobxLitElement {
|
||||||
|
private disposers: IReactionDisposer[] = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a MobX reaction using the given parameters and disposes it when this element is detached.
|
||||||
|
*
|
||||||
|
* This should be called from `connectedCallback` to ensure that the reaction is active also if the element is attached again later.
|
||||||
|
*/
|
||||||
|
protected reaction<T>(
|
||||||
|
expression: (r: IReactionPublic) => T,
|
||||||
|
effect: (arg: T, prev: T, r: IReactionPublic) => void,
|
||||||
|
opts?: IReactionOptions
|
||||||
|
): void {
|
||||||
|
this.disposers.push(reaction(expression, effect, opts));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a MobX autorun using the given parameters and disposes it when this element is detached.
|
||||||
|
*
|
||||||
|
* This should be called from `connectedCallback` to ensure that the reaction is active also if the element is attached again later.
|
||||||
|
*/
|
||||||
|
protected autorun(view: (r: IReactionPublic) => any, opts?: IAutorunOptions): void {
|
||||||
|
this.disposers.push(autorun(view, opts));
|
||||||
|
}
|
||||||
|
|
||||||
|
disconnectedCallback() {
|
||||||
|
super.disconnectedCallback();
|
||||||
|
this.disposers.forEach((disposer) => {
|
||||||
|
disposer();
|
||||||
|
});
|
||||||
|
this.disposers = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class View extends MobxElement {
|
||||||
|
createRenderRoot() {
|
||||||
|
// Do not use a shadow root
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Layout extends MobxElement {
|
||||||
|
connectedCallback() {
|
||||||
|
super.connectedCallback();
|
||||||
|
applyTheme(this.shadowRoot!);
|
||||||
|
}
|
||||||
|
}
|
310
mvnw
vendored
Normal file
310
mvnw
vendored
Normal file
@ -0,0 +1,310 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Maven Start Up Batch script
|
||||||
|
#
|
||||||
|
# Required ENV vars:
|
||||||
|
# ------------------
|
||||||
|
# JAVA_HOME - location of a JDK home dir
|
||||||
|
#
|
||||||
|
# Optional ENV vars
|
||||||
|
# -----------------
|
||||||
|
# M2_HOME - location of maven2's installed home dir
|
||||||
|
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||||
|
# e.g. to debug Maven itself, use
|
||||||
|
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||||
|
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
||||||
|
|
||||||
|
if [ -f /etc/mavenrc ] ; then
|
||||||
|
. /etc/mavenrc
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$HOME/.mavenrc" ] ; then
|
||||||
|
. "$HOME/.mavenrc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# OS specific support. $var _must_ be set to either true or false.
|
||||||
|
cygwin=false;
|
||||||
|
darwin=false;
|
||||||
|
mingw=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN*) cygwin=true ;;
|
||||||
|
MINGW*) mingw=true;;
|
||||||
|
Darwin*) darwin=true
|
||||||
|
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
||||||
|
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
||||||
|
if [ -z "$JAVA_HOME" ]; then
|
||||||
|
if [ -x "/usr/libexec/java_home" ]; then
|
||||||
|
export JAVA_HOME="`/usr/libexec/java_home`"
|
||||||
|
else
|
||||||
|
export JAVA_HOME="/Library/Java/Home"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ] ; then
|
||||||
|
if [ -r /etc/gentoo-release ] ; then
|
||||||
|
JAVA_HOME=`java-config --jre-home`
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$M2_HOME" ] ; then
|
||||||
|
## resolve links - $0 may be a link to maven's home
|
||||||
|
PRG="$0"
|
||||||
|
|
||||||
|
# need this for relative symlinks
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG="`dirname "$PRG"`/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
saveddir=`pwd`
|
||||||
|
|
||||||
|
M2_HOME=`dirname "$PRG"`/..
|
||||||
|
|
||||||
|
# make it fully qualified
|
||||||
|
M2_HOME=`cd "$M2_HOME" && pwd`
|
||||||
|
|
||||||
|
cd "$saveddir"
|
||||||
|
# echo Using m2 at $M2_HOME
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||||
|
if $cygwin ; then
|
||||||
|
[ -n "$M2_HOME" ] &&
|
||||||
|
M2_HOME=`cygpath --unix "$M2_HOME"`
|
||||||
|
[ -n "$JAVA_HOME" ] &&
|
||||||
|
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||||
|
[ -n "$CLASSPATH" ] &&
|
||||||
|
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Mingw, ensure paths are in UNIX format before anything is touched
|
||||||
|
if $mingw ; then
|
||||||
|
[ -n "$M2_HOME" ] &&
|
||||||
|
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
||||||
|
[ -n "$JAVA_HOME" ] &&
|
||||||
|
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ]; then
|
||||||
|
javaExecutable="`which javac`"
|
||||||
|
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
|
||||||
|
# readlink(1) is not available as standard on Solaris 10.
|
||||||
|
readLink=`which readlink`
|
||||||
|
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
|
||||||
|
if $darwin ; then
|
||||||
|
javaHome="`dirname \"$javaExecutable\"`"
|
||||||
|
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
|
||||||
|
else
|
||||||
|
javaExecutable="`readlink -f \"$javaExecutable\"`"
|
||||||
|
fi
|
||||||
|
javaHome="`dirname \"$javaExecutable\"`"
|
||||||
|
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
|
||||||
|
JAVA_HOME="$javaHome"
|
||||||
|
export JAVA_HOME
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVACMD" ] ; then
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="`which java`"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
echo "Error: JAVA_HOME is not defined correctly." >&2
|
||||||
|
echo " We cannot execute $JAVACMD" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ] ; then
|
||||||
|
echo "Warning: JAVA_HOME environment variable is not set."
|
||||||
|
fi
|
||||||
|
|
||||||
|
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
||||||
|
|
||||||
|
# traverses directory structure from process work directory to filesystem root
|
||||||
|
# first directory with .mvn subdirectory is considered project base directory
|
||||||
|
find_maven_basedir() {
|
||||||
|
|
||||||
|
if [ -z "$1" ]
|
||||||
|
then
|
||||||
|
echo "Path not specified to find_maven_basedir"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
basedir="$1"
|
||||||
|
wdir="$1"
|
||||||
|
while [ "$wdir" != '/' ] ; do
|
||||||
|
if [ -d "$wdir"/.mvn ] ; then
|
||||||
|
basedir=$wdir
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
||||||
|
if [ -d "${wdir}" ]; then
|
||||||
|
wdir=`cd "$wdir/.."; pwd`
|
||||||
|
fi
|
||||||
|
# end of workaround
|
||||||
|
done
|
||||||
|
echo "${basedir}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# concatenates all lines of a file
|
||||||
|
concat_lines() {
|
||||||
|
if [ -f "$1" ]; then
|
||||||
|
echo "$(tr -s '\n' ' ' < "$1")"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
BASE_DIR=`find_maven_basedir "$(pwd)"`
|
||||||
|
if [ -z "$BASE_DIR" ]; then
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||||
|
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||||
|
##########################################################################################
|
||||||
|
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Found .mvn/wrapper/maven-wrapper.jar"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
|
||||||
|
fi
|
||||||
|
if [ -n "$MVNW_REPOURL" ]; then
|
||||||
|
jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
||||||
|
else
|
||||||
|
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
||||||
|
fi
|
||||||
|
while IFS="=" read key value; do
|
||||||
|
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
|
||||||
|
esac
|
||||||
|
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Downloading from: $jarUrl"
|
||||||
|
fi
|
||||||
|
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
|
||||||
|
if $cygwin; then
|
||||||
|
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v wget > /dev/null; then
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Found wget ... using wget"
|
||||||
|
fi
|
||||||
|
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||||
|
wget "$jarUrl" -O "$wrapperJarPath"
|
||||||
|
else
|
||||||
|
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
|
||||||
|
fi
|
||||||
|
elif command -v curl > /dev/null; then
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Found curl ... using curl"
|
||||||
|
fi
|
||||||
|
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||||
|
curl -o "$wrapperJarPath" "$jarUrl" -f
|
||||||
|
else
|
||||||
|
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Falling back to using Java to download"
|
||||||
|
fi
|
||||||
|
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
||||||
|
# For Cygwin, switch paths to Windows format before running javac
|
||||||
|
if $cygwin; then
|
||||||
|
javaClass=`cygpath --path --windows "$javaClass"`
|
||||||
|
fi
|
||||||
|
if [ -e "$javaClass" ]; then
|
||||||
|
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo " - Compiling MavenWrapperDownloader.java ..."
|
||||||
|
fi
|
||||||
|
# Compiling the Java class
|
||||||
|
("$JAVA_HOME/bin/javac" "$javaClass")
|
||||||
|
fi
|
||||||
|
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||||
|
# Running the downloader
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo " - Running MavenWrapperDownloader.java ..."
|
||||||
|
fi
|
||||||
|
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
##########################################################################################
|
||||||
|
# End of extension
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo $MAVEN_PROJECTBASEDIR
|
||||||
|
fi
|
||||||
|
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin; then
|
||||||
|
[ -n "$M2_HOME" ] &&
|
||||||
|
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
||||||
|
[ -n "$JAVA_HOME" ] &&
|
||||||
|
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
||||||
|
[ -n "$CLASSPATH" ] &&
|
||||||
|
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
||||||
|
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
||||||
|
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Provide a "standardized" way to retrieve the CLI args that will
|
||||||
|
# work with both Windows and non-Windows executions.
|
||||||
|
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
||||||
|
export MAVEN_CMD_LINE_ARGS
|
||||||
|
|
||||||
|
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||||
|
|
||||||
|
exec "$JAVACMD" \
|
||||||
|
$MAVEN_OPTS \
|
||||||
|
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||||
|
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||||
|
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
182
mvnw.cmd
vendored
Normal file
182
mvnw.cmd
vendored
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
@REM or more contributor license agreements. See the NOTICE file
|
||||||
|
@REM distributed with this work for additional information
|
||||||
|
@REM regarding copyright ownership. The ASF licenses this file
|
||||||
|
@REM to you under the Apache License, Version 2.0 (the
|
||||||
|
@REM "License"); you may not use this file except in compliance
|
||||||
|
@REM with the License. You may obtain a copy of the License at
|
||||||
|
@REM
|
||||||
|
@REM http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@REM
|
||||||
|
@REM Unless required by applicable law or agreed to in writing,
|
||||||
|
@REM software distributed under the License is distributed on an
|
||||||
|
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
@REM KIND, either express or implied. See the License for the
|
||||||
|
@REM specific language governing permissions and limitations
|
||||||
|
@REM under the License.
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
@REM Maven Start Up Batch script
|
||||||
|
@REM
|
||||||
|
@REM Required ENV vars:
|
||||||
|
@REM JAVA_HOME - location of a JDK home dir
|
||||||
|
@REM
|
||||||
|
@REM Optional ENV vars
|
||||||
|
@REM M2_HOME - location of maven2's installed home dir
|
||||||
|
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
||||||
|
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
|
||||||
|
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||||
|
@REM e.g. to debug Maven itself, use
|
||||||
|
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||||
|
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
||||||
|
@echo off
|
||||||
|
@REM set title of command window
|
||||||
|
title %0
|
||||||
|
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
|
||||||
|
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
||||||
|
|
||||||
|
@REM set %HOME% to equivalent of $HOME
|
||||||
|
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
||||||
|
|
||||||
|
@REM Execute a user defined script before this one
|
||||||
|
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
||||||
|
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
||||||
|
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
|
||||||
|
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
|
||||||
|
:skipRcPre
|
||||||
|
|
||||||
|
@setlocal
|
||||||
|
|
||||||
|
set ERROR_CODE=0
|
||||||
|
|
||||||
|
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
||||||
|
@setlocal
|
||||||
|
|
||||||
|
@REM ==== START VALIDATION ====
|
||||||
|
if not "%JAVA_HOME%" == "" goto OkJHome
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Error: JAVA_HOME not found in your environment. >&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||||
|
echo location of your Java installation. >&2
|
||||||
|
echo.
|
||||||
|
goto error
|
||||||
|
|
||||||
|
:OkJHome
|
||||||
|
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
||||||
|
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||||
|
echo location of your Java installation. >&2
|
||||||
|
echo.
|
||||||
|
goto error
|
||||||
|
|
||||||
|
@REM ==== END VALIDATION ====
|
||||||
|
|
||||||
|
:init
|
||||||
|
|
||||||
|
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
||||||
|
@REM Fallback to current working directory if not found.
|
||||||
|
|
||||||
|
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
||||||
|
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
||||||
|
|
||||||
|
set EXEC_DIR=%CD%
|
||||||
|
set WDIR=%EXEC_DIR%
|
||||||
|
:findBaseDir
|
||||||
|
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
||||||
|
cd ..
|
||||||
|
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
||||||
|
set WDIR=%CD%
|
||||||
|
goto findBaseDir
|
||||||
|
|
||||||
|
:baseDirFound
|
||||||
|
set MAVEN_PROJECTBASEDIR=%WDIR%
|
||||||
|
cd "%EXEC_DIR%"
|
||||||
|
goto endDetectBaseDir
|
||||||
|
|
||||||
|
:baseDirNotFound
|
||||||
|
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
||||||
|
cd "%EXEC_DIR%"
|
||||||
|
|
||||||
|
:endDetectBaseDir
|
||||||
|
|
||||||
|
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
||||||
|
|
||||||
|
@setlocal EnableExtensions EnableDelayedExpansion
|
||||||
|
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
||||||
|
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
||||||
|
|
||||||
|
:endReadAdditionalConfig
|
||||||
|
|
||||||
|
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
||||||
|
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
||||||
|
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||||
|
|
||||||
|
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
||||||
|
|
||||||
|
FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||||
|
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
|
||||||
|
)
|
||||||
|
|
||||||
|
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||||
|
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||||
|
if exist %WRAPPER_JAR% (
|
||||||
|
if "%MVNW_VERBOSE%" == "true" (
|
||||||
|
echo Found %WRAPPER_JAR%
|
||||||
|
)
|
||||||
|
) else (
|
||||||
|
if not "%MVNW_REPOURL%" == "" (
|
||||||
|
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
||||||
|
)
|
||||||
|
if "%MVNW_VERBOSE%" == "true" (
|
||||||
|
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
||||||
|
echo Downloading from: %DOWNLOAD_URL%
|
||||||
|
)
|
||||||
|
|
||||||
|
powershell -Command "&{"^
|
||||||
|
"$webclient = new-object System.Net.WebClient;"^
|
||||||
|
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
||||||
|
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
||||||
|
"}"^
|
||||||
|
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
|
||||||
|
"}"
|
||||||
|
if "%MVNW_VERBOSE%" == "true" (
|
||||||
|
echo Finished downloading %WRAPPER_JAR%
|
||||||
|
)
|
||||||
|
)
|
||||||
|
@REM End of extension
|
||||||
|
|
||||||
|
@REM Provide a "standardized" way to retrieve the CLI args that will
|
||||||
|
@REM work with both Windows and non-Windows executions.
|
||||||
|
set MAVEN_CMD_LINE_ARGS=%*
|
||||||
|
|
||||||
|
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
||||||
|
if ERRORLEVEL 1 goto error
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:error
|
||||||
|
set ERROR_CODE=1
|
||||||
|
|
||||||
|
:end
|
||||||
|
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
||||||
|
|
||||||
|
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
|
||||||
|
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
||||||
|
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
|
||||||
|
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
|
||||||
|
:skipRcPost
|
||||||
|
|
||||||
|
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
||||||
|
if "%MAVEN_BATCH_PAUSE%" == "on" pause
|
||||||
|
|
||||||
|
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
|
||||||
|
|
||||||
|
exit /B %ERROR_CODE%
|
171
package.json
Normal file
171
package.json
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
{
|
||||||
|
"name": "no-name",
|
||||||
|
"license": "UNLICENSED",
|
||||||
|
"dependencies": {
|
||||||
|
"@adobe/lit-mobx": "2.0.0-rc.4",
|
||||||
|
"@fontsource/roboto": "4.5.0",
|
||||||
|
"@polymer/iron-icon": "3.0.1",
|
||||||
|
"@polymer/iron-list": "3.1.0",
|
||||||
|
"@polymer/polymer": "3.2.0",
|
||||||
|
"@vaadin/flow-frontend": "./target/flow-frontend",
|
||||||
|
"@vaadin/form": "./target/flow-frontend/form",
|
||||||
|
"@vaadin/router": "1.7.4",
|
||||||
|
"@vaadin/vaadin-accordion": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-app-layout": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-avatar": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-board": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-button": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-charts": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-checkbox": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-combo-box": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-confirm-dialog": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-context-menu": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-cookie-consent": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-core-shrinkwrap": "21.0.0-alpha10",
|
||||||
|
"@vaadin/vaadin-crud": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-custom-field": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-date-picker": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-date-time-picker": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-details": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-dialog": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-form-layout": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-grid": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-grid-pro": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-icon": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-icons": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-item": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-list-box": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-login": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-lumo-styles": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-material-styles": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-menu-bar": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-messages": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-notification": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-ordered-layout": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-progress-bar": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-radio-button": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-rich-text-editor": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-select": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-shrinkwrap": "21.0.0-alpha10",
|
||||||
|
"@vaadin/vaadin-split-layout": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-tabs": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-template-renderer": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-text-field": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-time-picker": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-upload": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-virtual-list": "21.0.0-alpha13",
|
||||||
|
"construct-style-sheets-polyfill": "2.4.16",
|
||||||
|
"line-awesome": "1.3.0",
|
||||||
|
"lit": "2.0.0-rc.1",
|
||||||
|
"mobx": "^6.1.5"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/validator": "13.1.0",
|
||||||
|
"@vaadin/application-theme-plugin": "./target/plugins/application-theme-plugin",
|
||||||
|
"@vaadin/stats-plugin": "./target/plugins/stats-plugin",
|
||||||
|
"@vaadin/theme-live-reload-plugin": "./target/plugins/theme-live-reload-plugin",
|
||||||
|
"@vaadin/theme-loader": "./target/plugins/theme-loader",
|
||||||
|
"chokidar": "^3.5.0",
|
||||||
|
"compression-webpack-plugin": "4.0.1",
|
||||||
|
"css-loader": "4.2.1",
|
||||||
|
"extra-watch-webpack-plugin": "1.0.3",
|
||||||
|
"extract-loader": "5.1.0",
|
||||||
|
"file-loader": "6.2.0",
|
||||||
|
"fork-ts-checker-webpack-plugin": "6.2.1",
|
||||||
|
"glob": "7.1.6",
|
||||||
|
"html-webpack-plugin": "4.5.1",
|
||||||
|
"lit-css-loader": "0.1.0",
|
||||||
|
"loader-utils": "2.0.0",
|
||||||
|
"ts-loader": "8.0.12",
|
||||||
|
"typescript": "4.3.3",
|
||||||
|
"validator": "13.1.17",
|
||||||
|
"webpack": "4.46.0",
|
||||||
|
"webpack-cli": "3.3.11",
|
||||||
|
"webpack-dev-server": "3.11.0",
|
||||||
|
"webpack-manifest-plugin": "3.0.0",
|
||||||
|
"webpack-merge": "4.2.2",
|
||||||
|
"workbox-core": "6.1.0",
|
||||||
|
"workbox-precaching": "6.1.0",
|
||||||
|
"workbox-webpack-plugin": "6.1.0"
|
||||||
|
},
|
||||||
|
"vaadin": {
|
||||||
|
"dependencies": {
|
||||||
|
"@polymer/iron-icon": "3.0.1",
|
||||||
|
"@polymer/iron-list": "3.1.0",
|
||||||
|
"@polymer/polymer": "3.2.0",
|
||||||
|
"@vaadin/router": "1.7.4",
|
||||||
|
"@vaadin/vaadin-accordion": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-app-layout": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-avatar": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-board": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-button": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-charts": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-checkbox": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-combo-box": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-confirm-dialog": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-context-menu": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-cookie-consent": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-core-shrinkwrap": "21.0.0-alpha10",
|
||||||
|
"@vaadin/vaadin-crud": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-custom-field": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-date-picker": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-date-time-picker": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-details": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-dialog": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-form-layout": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-grid": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-grid-pro": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-icon": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-icons": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-item": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-list-box": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-login": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-lumo-styles": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-material-styles": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-menu-bar": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-messages": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-notification": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-ordered-layout": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-progress-bar": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-radio-button": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-rich-text-editor": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-select": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-shrinkwrap": "21.0.0-alpha10",
|
||||||
|
"@vaadin/vaadin-split-layout": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-tabs": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-template-renderer": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-text-field": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-time-picker": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-upload": "21.0.0-alpha13",
|
||||||
|
"@vaadin/vaadin-virtual-list": "21.0.0-alpha13",
|
||||||
|
"construct-style-sheets-polyfill": "2.4.16",
|
||||||
|
"lit": "2.0.0-rc.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/validator": "13.1.0",
|
||||||
|
"chokidar": "^3.5.0",
|
||||||
|
"compression-webpack-plugin": "4.0.1",
|
||||||
|
"css-loader": "4.2.1",
|
||||||
|
"extra-watch-webpack-plugin": "1.0.3",
|
||||||
|
"extract-loader": "5.1.0",
|
||||||
|
"file-loader": "6.2.0",
|
||||||
|
"fork-ts-checker-webpack-plugin": "6.2.1",
|
||||||
|
"glob": "7.1.6",
|
||||||
|
"html-webpack-plugin": "4.5.1",
|
||||||
|
"lit-css-loader": "0.1.0",
|
||||||
|
"loader-utils": "2.0.0",
|
||||||
|
"ts-loader": "8.0.12",
|
||||||
|
"typescript": "4.3.3",
|
||||||
|
"validator": "13.1.17",
|
||||||
|
"webpack": "4.46.0",
|
||||||
|
"webpack-cli": "3.3.11",
|
||||||
|
"webpack-dev-server": "3.11.0",
|
||||||
|
"webpack-manifest-plugin": "3.0.0",
|
||||||
|
"webpack-merge": "4.2.2",
|
||||||
|
"workbox-core": "6.1.0",
|
||||||
|
"workbox-precaching": "6.1.0",
|
||||||
|
"workbox-webpack-plugin": "6.1.0"
|
||||||
|
},
|
||||||
|
"hash": "732bab371dec73c0c97e8b97b815095666d7d1f3c5c61b169d46ba69f09ab1a6"
|
||||||
|
}
|
||||||
|
}
|
8485
pnpm-lock.yaml
Normal file
8485
pnpm-lock.yaml
Normal file
File diff suppressed because it is too large
Load Diff
262
pom.xml
Normal file
262
pom.xml
Normal file
@ -0,0 +1,262 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<!-- Vaadin project from https://start.vaadin.com/project/adc988bd-b0ed-4fc8-ba45-7df6875fb209 -->
|
||||||
|
<groupId>com.cubetiqs.fusion</groupId>
|
||||||
|
<artifactId>fusionmanagement</artifactId>
|
||||||
|
<name>Project base for Spring Boot and Vaadin Flow</name>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<java.version>11</java.version>
|
||||||
|
<vaadin.version>21.0.0.alpha10</vaadin.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>2.4.5</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<!-- The order of definitions matters. Explicitly defining central here to make sure it has the highest priority. -->
|
||||||
|
|
||||||
|
<!-- Main Maven repository -->
|
||||||
|
<repository>
|
||||||
|
<id>central</id>
|
||||||
|
<url>https://repo.maven.apache.org/maven2</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>vaadin-prereleases</id>
|
||||||
|
<url>
|
||||||
|
https://maven.vaadin.com/vaadin-prereleases/
|
||||||
|
</url>
|
||||||
|
</repository>
|
||||||
|
<!-- Repository used by many Vaadin add-ons -->
|
||||||
|
<repository>
|
||||||
|
<id>Vaadin Directory</id>
|
||||||
|
<url>https://maven.vaadin.com/vaadin-addons</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<pluginRepositories>
|
||||||
|
<!-- The order of definitions matters. Explicitly defining central here to make sure it has the highest priority. -->
|
||||||
|
<pluginRepository>
|
||||||
|
<id>central</id>
|
||||||
|
<url>https://repo.maven.apache.org/maven2</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</pluginRepository>
|
||||||
|
<pluginRepository>
|
||||||
|
<id>vaadin-prereleases</id>
|
||||||
|
<url>
|
||||||
|
https://maven.vaadin.com/vaadin-prereleases/
|
||||||
|
</url>
|
||||||
|
</pluginRepository>
|
||||||
|
</pluginRepositories>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.vaadin</groupId>
|
||||||
|
<artifactId>vaadin-bom</artifactId>
|
||||||
|
<version>${vaadin.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.vaadin</groupId>
|
||||||
|
<!-- Replace artifactId with vaadin-core to use only free components -->
|
||||||
|
<artifactId>vaadin</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.vaadin</groupId>
|
||||||
|
<artifactId>vaadin-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.vaadin.artur</groupId>
|
||||||
|
<artifactId>a-vaadin-helper</artifactId>
|
||||||
|
<version>1.7.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.vaadin.artur.exampledata</groupId>
|
||||||
|
<artifactId>exampledata</artifactId>
|
||||||
|
<version>3.4.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.h2database</groupId>
|
||||||
|
<artifactId>h2</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.vaadin</groupId>
|
||||||
|
<artifactId>vaadin-testbench</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- Include JUnit 4 support for TestBench and others -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.vintage</groupId>
|
||||||
|
<artifactId>junit-vintage-engine</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.hamcrest</groupId>
|
||||||
|
<artifactId>hamcrest-core</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.github.bonigarcia</groupId>
|
||||||
|
<artifactId>webdrivermanager</artifactId>
|
||||||
|
<version>4.4.0</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<defaultGoal>spring-boot:run</defaultGoal>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<!-- Clean build and startup time for Vaadin apps sometimes may exceed
|
||||||
|
the default Spring Boot's 30sec timeout. -->
|
||||||
|
<configuration>
|
||||||
|
<wait>500</wait>
|
||||||
|
<maxAttempts>240</maxAttempts>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Take care of synchronizing java dependencies and imports in
|
||||||
|
package.json and main.js files.
|
||||||
|
It also creates webpack.config.js if not exists yet.
|
||||||
|
-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.vaadin</groupId>
|
||||||
|
<artifactId>vaadin-maven-plugin</artifactId>
|
||||||
|
<version>${vaadin.version}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>prepare-frontend</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<!-- Production mode is activated using -Pproduction -->
|
||||||
|
<id>production</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.vaadin</groupId>
|
||||||
|
<artifactId>vaadin-maven-plugin</artifactId>
|
||||||
|
<version>${vaadin.version}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>build-frontend</goal>
|
||||||
|
</goals>
|
||||||
|
<phase>compile</phase>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<productionMode>true</productionMode>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
|
||||||
|
<profile>
|
||||||
|
<id>it</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>start-spring-boot</id>
|
||||||
|
<phase>pre-integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>start</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>stop-spring-boot</id>
|
||||||
|
<phase>post-integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>stop</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!-- Runs the integration tests (*IT) after the server is started -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-failsafe-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>integration-test</goal>
|
||||||
|
<goal>verify</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<trimStackTrace>false</trimStackTrace>
|
||||||
|
<enableAssertions>true</enableAssertions>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
|
||||||
|
</profiles>
|
||||||
|
</project>
|
27
src/main/java/com/cubetiqs/fusion/Application.java
Normal file
27
src/main/java/com/cubetiqs/fusion/Application.java
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package com.cubetiqs.fusion;
|
||||||
|
|
||||||
|
import com.vaadin.flow.component.page.AppShellConfigurator;
|
||||||
|
import com.vaadin.flow.server.PWA;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||||
|
import com.vaadin.flow.theme.Theme;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The entry point of the Spring Boot application.
|
||||||
|
*
|
||||||
|
* Use the @PWA annotation make the application installable on phones, tablets
|
||||||
|
* and some desktop browsers.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@SpringBootApplication
|
||||||
|
@Theme(value = "fusionmanagement")
|
||||||
|
@PWA(name = "Fusion Management", shortName = "Fusion Management", offlineResources = {"images/logo.png"})
|
||||||
|
public class Application extends SpringBootServletInitializer implements AppShellConfigurator {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(Application.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
45
src/main/java/com/cubetiqs/fusion/data/AbstractEntity.java
Normal file
45
src/main/java/com/cubetiqs/fusion/data/AbstractEntity.java
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
package com.cubetiqs.fusion.data;
|
||||||
|
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.MappedSuperclass;
|
||||||
|
|
||||||
|
import com.vaadin.fusion.Nonnull;
|
||||||
|
|
||||||
|
@MappedSuperclass
|
||||||
|
public abstract class AbstractEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
@Nonnull
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
if (id != null) {
|
||||||
|
return id.hashCode();
|
||||||
|
}
|
||||||
|
return super.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (!(obj instanceof AbstractEntity)) {
|
||||||
|
return false; // null or other class
|
||||||
|
}
|
||||||
|
AbstractEntity other = (AbstractEntity) obj;
|
||||||
|
|
||||||
|
if (id != null) {
|
||||||
|
return id.equals(other.id);
|
||||||
|
}
|
||||||
|
return super.equals(other);
|
||||||
|
}
|
||||||
|
}
|
16
src/main/java/com/cubetiqs/fusion/data/Role.java
Normal file
16
src/main/java/com/cubetiqs/fusion/data/Role.java
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package com.cubetiqs.fusion.data;
|
||||||
|
|
||||||
|
public enum Role {
|
||||||
|
USER("user"), ADMIN("admin");
|
||||||
|
|
||||||
|
private String roleName;
|
||||||
|
|
||||||
|
private Role(String roleName) {
|
||||||
|
this.roleName = roleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleName() {
|
||||||
|
return roleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.cubetiqs.fusion.data.endpoint;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import com.cubetiqs.fusion.data.entity.User;
|
||||||
|
import com.cubetiqs.fusion.security.AuthenticatedUser;
|
||||||
|
import com.vaadin.flow.server.auth.AnonymousAllowed;
|
||||||
|
import com.vaadin.fusion.Endpoint;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
@Endpoint
|
||||||
|
@AnonymousAllowed
|
||||||
|
public class UserEndpoint {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AuthenticatedUser authenticatedUser;
|
||||||
|
|
||||||
|
public Optional<User> getAuthenticatedUser() {
|
||||||
|
return authenticatedUser.get();
|
||||||
|
}
|
||||||
|
}
|
61
src/main/java/com/cubetiqs/fusion/data/entity/User.java
Normal file
61
src/main/java/com/cubetiqs/fusion/data/entity/User.java
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
package com.cubetiqs.fusion.data.entity;
|
||||||
|
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
|
||||||
|
import com.cubetiqs.fusion.data.AbstractEntity;
|
||||||
|
import com.vaadin.fusion.Nonnull;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import java.util.Set;
|
||||||
|
import javax.persistence.ElementCollection;
|
||||||
|
import javax.persistence.FetchType;
|
||||||
|
import com.cubetiqs.fusion.data.Role;
|
||||||
|
import javax.persistence.Lob;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
public class User extends AbstractEntity {
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private String username;
|
||||||
|
@Nonnull
|
||||||
|
private String name;
|
||||||
|
@JsonIgnore
|
||||||
|
private String hashedPassword;
|
||||||
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
|
@Nonnull
|
||||||
|
private Set<Role> roles;
|
||||||
|
@Nonnull
|
||||||
|
@Lob
|
||||||
|
private String profilePictureUrl;
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
public String getHashedPassword() {
|
||||||
|
return hashedPassword;
|
||||||
|
}
|
||||||
|
public void setHashedPassword(String hashedPassword) {
|
||||||
|
this.hashedPassword = hashedPassword;
|
||||||
|
}
|
||||||
|
public Set<Role> getRoles() {
|
||||||
|
return roles;
|
||||||
|
}
|
||||||
|
public void setRoles(Set<Role> roles) {
|
||||||
|
this.roles = roles;
|
||||||
|
}
|
||||||
|
public String getProfilePictureUrl() {
|
||||||
|
return profilePictureUrl;
|
||||||
|
}
|
||||||
|
public void setProfilePictureUrl(String profilePictureUrl) {
|
||||||
|
this.profilePictureUrl = profilePictureUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
package com.cubetiqs.fusion.data.generator;
|
||||||
|
|
||||||
|
import com.vaadin.flow.spring.annotation.SpringComponent;
|
||||||
|
|
||||||
|
import com.cubetiqs.fusion.data.service.UserRepository;
|
||||||
|
import com.cubetiqs.fusion.data.entity.User;
|
||||||
|
import java.util.Collections;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
import com.cubetiqs.fusion.data.Role;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.boot.CommandLineRunner;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.vaadin.artur.exampledata.DataType;
|
||||||
|
import org.vaadin.artur.exampledata.ExampleDataGenerator;
|
||||||
|
|
||||||
|
@SpringComponent
|
||||||
|
public class DataGenerator {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public CommandLineRunner loadData(PasswordEncoder passwordEncoder, UserRepository userRepository) {
|
||||||
|
return args -> {
|
||||||
|
Logger logger = LoggerFactory.getLogger(getClass());
|
||||||
|
if (userRepository.count() != 0L) {
|
||||||
|
logger.info("Using existing database");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int seed = 123;
|
||||||
|
|
||||||
|
logger.info("Generating demo data");
|
||||||
|
|
||||||
|
logger.info("... generating 2 User entities...");
|
||||||
|
User user = new User();
|
||||||
|
user.setName("John Normal");
|
||||||
|
user.setUsername("user");
|
||||||
|
user.setHashedPassword(passwordEncoder.encode("user"));
|
||||||
|
user.setProfilePictureUrl(
|
||||||
|
"https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=128&h=128&q=80");
|
||||||
|
user.setRoles(Collections.singleton(Role.USER));
|
||||||
|
userRepository.save(user);
|
||||||
|
User admin = new User();
|
||||||
|
admin.setName("John Normal");
|
||||||
|
admin.setUsername("admin");
|
||||||
|
admin.setHashedPassword(passwordEncoder.encode("admin"));
|
||||||
|
admin.setProfilePictureUrl(
|
||||||
|
"https://images.unsplash.com/photo-1607746882042-944635dfe10e?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=128&h=128&q=80");
|
||||||
|
admin.setRoles(Collections.singleton(Role.ADMIN));
|
||||||
|
userRepository.save(admin);
|
||||||
|
|
||||||
|
logger.info("Generated demo data");
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.cubetiqs.fusion.data.service;
|
||||||
|
|
||||||
|
import com.cubetiqs.fusion.data.entity.User;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import com.vaadin.fusion.Nonnull;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import java.util.Set;
|
||||||
|
import javax.persistence.ElementCollection;
|
||||||
|
import javax.persistence.FetchType;
|
||||||
|
import com.cubetiqs.fusion.data.Role;
|
||||||
|
import javax.persistence.Lob;
|
||||||
|
|
||||||
|
public interface UserRepository extends JpaRepository<User, Integer> {
|
||||||
|
|
||||||
|
User findByUsername(String username);
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.cubetiqs.fusion.data.service;
|
||||||
|
|
||||||
|
import com.cubetiqs.fusion.data.entity.User;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.vaadin.artur.helpers.CrudService;
|
||||||
|
import com.vaadin.fusion.Nonnull;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import java.util.Set;
|
||||||
|
import javax.persistence.ElementCollection;
|
||||||
|
import javax.persistence.FetchType;
|
||||||
|
import com.cubetiqs.fusion.data.Role;
|
||||||
|
import javax.persistence.Lob;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class UserService extends CrudService<User, Integer> {
|
||||||
|
|
||||||
|
private UserRepository repository;
|
||||||
|
|
||||||
|
public UserService(@Autowired UserRepository repository) {
|
||||||
|
this.repository = repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected UserRepository getRepository() {
|
||||||
|
return repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
package com.cubetiqs.fusion.security;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import com.cubetiqs.fusion.data.entity.User;
|
||||||
|
import com.cubetiqs.fusion.data.service.UserRepository;
|
||||||
|
import com.vaadin.flow.component.UI;
|
||||||
|
import com.vaadin.flow.server.VaadinServletRequest;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.core.context.SecurityContext;
|
||||||
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class AuthenticatedUser {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserRepository userRepository;
|
||||||
|
|
||||||
|
private UserDetails getAuthenticatedUser() {
|
||||||
|
SecurityContext context = SecurityContextHolder.getContext();
|
||||||
|
Object principal = context.getAuthentication().getPrincipal();
|
||||||
|
if (principal instanceof UserDetails) {
|
||||||
|
UserDetails userDetails = (UserDetails) context.getAuthentication().getPrincipal();
|
||||||
|
return userDetails;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<User> get() {
|
||||||
|
UserDetails details = getAuthenticatedUser();
|
||||||
|
if (details == null) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
return Optional.of(userRepository.findByUsername(details.getUsername()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void logout() {
|
||||||
|
UI.getCurrent().getPage().setLocation(SecurityConfiguration.LOGOUT_URL);
|
||||||
|
SecurityContextLogoutHandler logoutHandler = new SecurityContextLogoutHandler();
|
||||||
|
logoutHandler.logout(VaadinServletRequest.getCurrent().getHttpServletRequest(), null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.cubetiqs.fusion.security;
|
||||||
|
|
||||||
|
import com.vaadin.flow.spring.security.VaadinWebSecurityConfigurerAdapter;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.builders.WebSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||||
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
|
||||||
|
@EnableWebSecurity
|
||||||
|
@Configuration
|
||||||
|
public class SecurityConfiguration extends VaadinWebSecurityConfigurerAdapter {
|
||||||
|
|
||||||
|
public static final String LOGOUT_URL = "/";
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public PasswordEncoder passwordEncoder() {
|
||||||
|
return new BCryptPasswordEncoder();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
|
// Public access
|
||||||
|
http.authorizeRequests().antMatchers("/").permitAll();
|
||||||
|
|
||||||
|
super.configure(http);
|
||||||
|
setLoginView(http, "/login", LOGOUT_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configure(WebSecurity web) throws Exception {
|
||||||
|
super.configure(web);
|
||||||
|
web.ignoring().antMatchers("/images/logo.png");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
package com.cubetiqs.fusion.security;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.cubetiqs.fusion.data.entity.User;
|
||||||
|
import com.cubetiqs.fusion.data.service.UserRepository;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
|
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||||
|
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class UserDetailsServiceImpl implements UserDetailsService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserRepository userRepository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||||
|
User user = userRepository.findByUsername(username);
|
||||||
|
if (user == null) {
|
||||||
|
throw new UsernameNotFoundException("No user present with username: " + username);
|
||||||
|
} else {
|
||||||
|
return new org.springframework.security.core.userdetails.User(user.getUsername(), user.getHashedPassword(),
|
||||||
|
getAuthorities(user));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<GrantedAuthority> getAuthorities(User user) {
|
||||||
|
return user.getRoles().stream().map(role -> new SimpleGrantedAuthority("ROLE_" + role.getRoleName()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
BIN
src/main/resources/META-INF/resources/icons/icon.png
Normal file
BIN
src/main/resources/META-INF/resources/icons/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
BIN
src/main/resources/META-INF/resources/images/logo.png
Normal file
BIN
src/main/resources/META-INF/resources/images/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
7
src/main/resources/application.properties
Normal file
7
src/main/resources/application.properties
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
server.port=${PORT:8080}
|
||||||
|
logging.level.org.atmosphere = warn
|
||||||
|
spring.mustache.check-template-location = false
|
||||||
|
|
||||||
|
# To improve the performance during development.
|
||||||
|
# For more information https://vaadin.com/docs/flow/spring/tutorial-spring-configuration.html#special-configuration-parameters
|
||||||
|
# vaadin.whitelisted-packages= org/vaadin/example
|
6
src/main/resources/banner.txt
Normal file
6
src/main/resources/banner.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
_____ _ __ __ _
|
||||||
|
| ___| _ _ ___ (_) ___ _ __ | \/ | __ _ _ __ __ _ __ _ ___ _ __ ___ ___ _ __ | |_
|
||||||
|
| |_ | | | |/ __|| | / _ \ | '_ \ | |\/| | / _` || '_ \ / _` | / _` | / _ \| '_ ` _ \ / _ \| '_ \ | __|
|
||||||
|
| _| | |_| |\__ \| || (_) || | | | | | | || (_| || | | || (_| || (_| || __/| | | | | || __/| | | || |_
|
||||||
|
|_| \__,_||___/|_| \___/ |_| |_| |_| |_| \__,_||_| |_| \__,_| \__, | \___||_| |_| |_| \___||_| |_| \__|
|
||||||
|
|___/
|
34
tsconfig.json
Normal file
34
tsconfig.json
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// This TypeScript configuration file is generated by vaadin-maven-plugin.
|
||||||
|
// This is needed for TypeScript compiler to compile your TypeScript code in the project.
|
||||||
|
// It is recommended to commit this file to the VCS.
|
||||||
|
// You might want to change the configurations to fit your preferences
|
||||||
|
// For more information about the configurations, please refer to http://www.typescriptlang.org/docs/handbook/tsconfig-json.html
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"sourceMap": true,
|
||||||
|
"inlineSources": true,
|
||||||
|
"module": "esNext",
|
||||||
|
"target": "es2019",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"strict": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"noImplicitThis": true,
|
||||||
|
"noUnusedLocals": false,
|
||||||
|
"noUnusedParameters": false,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"baseUrl": "frontend",
|
||||||
|
"paths": {
|
||||||
|
"Frontend/*": [
|
||||||
|
"*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"frontend/**/*.ts",
|
||||||
|
"frontend/index.js",
|
||||||
|
"types.d.ts"
|
||||||
|
],
|
||||||
|
"exclude": []
|
||||||
|
}
|
5
types.d.ts
vendored
Normal file
5
types.d.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
declare module '*.css' {
|
||||||
|
import { CSSResultGroup } from 'lit';
|
||||||
|
const content: CSSResultGroup;
|
||||||
|
export default content;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user