React Front-End UI
This commit is to move the React front end files from the Clamp Policy Repo to the Onap Gui Policy Repo.
Also created the added Maven featue to compile the React project via Node and NPM, and copy the production files to the target directory.
Fixed in gitignore that was ignoring the contents inside the logs/ directory.
Reformated JS spacing files from 4 spaces to 2 spaces.
Fixed Broken JEST test
Applied Jim's Code Review as well updated Node Version from 12.18 to 14.17 accross the modules. Unfortunately cannot apply NPM version since it broke npm install.
Fixed ONAP Job Builder Linting Error
Applied Jim's Second Code Review
Issue-ID: POLICY-3218
Signed-off-by: brunomilitzer <bruno.militzer@est.tech>
Change-Id: I01f95c350d27d72f941c835592fd596472601d6e
diff --git a/gui-clamp/pom.xml b/gui-clamp/pom.xml
index 44d2028..a1219e1 100644
--- a/gui-clamp/pom.xml
+++ b/gui-clamp/pom.xml
@@ -16,18 +16,217 @@
SPDX-License-Identifier: Apache-2.0
============LICENSE_END=========================================================
--->
+ -->
<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">
+ 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>
<parent>
<groupId>org.onap.policy.gui</groupId>
<artifactId>policy-gui</artifactId>
<version>2.1.0-SNAPSHOT</version>
</parent>
-
<artifactId>gui-clamp</artifactId>
<packaging>pom</packaging>
<name>${project.artifactId}</name>
<description>This module contains the implementation code for the CLAMP GUIs in the Policy Framework</description>
+ <properties>
+ <ui.react.src>ui-react</ui.react.src>
+ <ui.react.lib.src>ui-react-lib</ui.react.lib.src>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>3.2.0</version>
+ <executions>
+ <execution>
+ <id>copy-resources-1</id>
+ <!-- here the phase you need -->
+ <phase>compile</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/${ui.react.src}</outputDirectory>
+ <resources>
+ <resource>
+ <directory>${ui.react.src}</directory>
+ <excludes>
+ <exclude>node_modules</exclude>
+ </excludes>
+ <includes>
+ <include>src/**</include>
+ <include>public/**</include>
+ <include>package.json</include>
+ <include>package-lock.json</include>
+ </includes>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-resources-2</id>
+ <!-- here the phase you need -->
+ <phase>compile</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/${ui.react.src}</outputDirectory>
+ <resources>
+ <resource>
+ <directory>${ui.react.src}</directory>
+ <includes>
+ <include>src/**</include>
+ </includes>
+ <excludes>
+ <exclude>**/__snapshots__/**</exclude>
+ <exclude>**/**.test.js</exclude>
+ </excludes>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-resources-3</id>
+ <!-- here the phase you need -->
+ <phase>compile</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/${ui.react.lib.src}</outputDirectory>
+ <resources>
+ <resource>
+ <directory>${ui.react.lib.src}</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ <excludes>
+ <exclude>node_modules/**</exclude>
+ <exclude>package-lock.json</exclude>
+ </excludes>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>com.github.eirslett</groupId>
+ <artifactId>frontend-maven-plugin</artifactId>
+ <version>1.11.3</version>
+ <configuration>
+ <installDirectory>${project.build.directory}/${ui.react.src}</installDirectory>
+ <npmDownloadRoot>${repo.npm}</npmDownloadRoot>
+ </configuration>
+ <executions>
+ <execution>
+ <id>install node and npm</id>
+ <goals>
+ <goal>install-node-and-npm</goal>
+ </goals>
+ <phase>generate-sources</phase>
+ <configuration>
+ <nodeVersion>v14.17.0</nodeVersion>
+ </configuration>
+ </execution>
+ <execution>
+ <id>npm_install</id>
+ <goals>
+ <goal>npm</goal>
+ </goals>
+ <phase>compile</phase>
+ <configuration>
+ <workingDirectory>${project.build.directory}/${ui.react.src}</workingDirectory>
+ <arguments>install</arguments>
+ </configuration>
+ </execution>
+ <execution>
+ <id>npm_test</id>
+ <goals>
+ <goal>npm</goal>
+ </goals>
+ <phase>test</phase>
+ <configuration>
+ <skip>${maven.test.skip}</skip>
+ <arguments>run-script test:coverage</arguments>
+ <workingDirectory>${project.build.directory}/${ui.react.src}</workingDirectory>
+ </configuration>
+ </execution>
+ <execution>
+ <id>npm_install_lib</id>
+ <goals>
+ <goal>npm</goal>
+ </goals>
+ <phase>deploy</phase>
+ <configuration>
+ <workingDirectory>${project.build.directory}/${ui.react.lib.src}</workingDirectory>
+ <arguments>install</arguments>
+ </configuration>
+ </execution>
+ <execution>
+ <id>npm_build_lib</id>
+ <goals>
+ <goal>npm</goal>
+ </goals>
+ <phase>deploy</phase>
+ <configuration>
+ <workingDirectory>${project.build.directory}/${ui.react.lib.src}</workingDirectory>
+ <arguments>run build</arguments>
+ </configuration>
+ </execution>
+ <execution>
+ <id>npm_publish</id>
+ <goals>
+ <goal>npm</goal>
+ </goals>
+ <phase>deploy</phase>
+ <configuration>
+ <workingDirectory>${project.build.directory}/${ui.react.lib.src}</workingDirectory>
+ <arguments>publish</arguments>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>3.0.0</version>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>${ui.react.lib.src}/node</directory>
+ </fileset>
+ <fileset>
+ <directory>${ui.react.src}/node</directory>
+ </fileset>
+ <fileset>
+ <directory>${ui.react.src}/node_modules</directory>
+ </fileset>
+ <fileset>
+ <directory>${ui.react.lib.src}/node_modules</directory>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.1</version>
+ <configuration>
+ <source>11</source>
+ <target>11</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>versions-maven-plugin</artifactId>
+ <version>1.3.1</version>
+ </plugin>
+ </plugins>
+ </build>
</project>