Skip to content

Commit

Permalink
NIFI-13017: Replace JoltTransformJSON custom UI (#9117)
Browse files Browse the repository at this point in the history
* NIFI-13017:
- Remove old JoltTransformJSON custom UI.
- Update build to use new JoltTransformJSON custom UI.
- Fix revision query parameter.

* NIFI-13017:
- Excluding jolt transform json ui in workflow ci.

* NIFI-13017:
- Excluding jolt nar in workflow ci.

* NIFI-13017:
- Excluding jolt ui war from code coverage.

* NIFI-13017:
- Incorporating nifi-web-servlet-shared.
- Moving QueryStringToFragmentFilter to nifi-web-servlet-shared.

This closes #9117
  • Loading branch information
mcgilman authored Aug 6, 2024
1 parent 05c92e4 commit da6c9c4
Show file tree
Hide file tree
Showing 64 changed files with 133 additions and 6,477 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ env:
-pl -:nifi-py4j-integration-tests
-pl -:nifi-server-nar
-pl -:nifi-ui
-pl -:nifi-jolt-nar
-pl -:nifi-jolt-transform-json-ui
MAVEN_VERIFY_COMMAND: >-
verify
--show-version
Expand Down
3 changes: 3 additions & 0 deletions nifi-assembly/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2866,4 +2866,7 @@ The binary distribution of this product bundles 'Py4J' under a BSD license.
OTHER DEALINGS IN THE SOFTWARE.

For the binary distribution of nifi-ui see its 3rdpartylicenses.txt
for additional license and notice information.

For the binary distribution of nifi-jolt-transform-json-ui see its 3rdpartylicenses.txt
for additional license and notice information.
3 changes: 3 additions & 0 deletions nifi-assembly/NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -2574,4 +2574,7 @@ The following binary components are provided under the SIL Open Font License 1.1
(SIL OFL 1.1) FontAwesome (4.7.0 - https://fontawesome.com/license/free)

For the binary distribution of nifi-ui see its 3rdpartylicenses.txt
for additional license and notice information.

For the binary distribution of nifi-jolt-transform-json-ui see its 3rdpartylicenses.txt
for additional license and notice information.
6 changes: 0 additions & 6 deletions nifi-code-coverage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1288,12 +1288,6 @@
<artifactId>nifi-sql-reporting-tasks</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-jolt-transform-json-ui</artifactId>
<version>2.0.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-standard-content-viewer</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* 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.
*/

package org.apache.nifi.web.servlet.filter;

import jakarta.servlet.Filter;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.nifi.web.servlet.shared.RequestUriBuilder;

import java.io.IOException;
import java.net.URI;

public class QueryStringToFragmentFilter implements Filter {

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
final HttpServletRequest httpServletRequest = (HttpServletRequest) request;
final String queryString = httpServletRequest.getQueryString();

if (queryString != null) {
// Some NiFi front ends use hash based routing, so they don't need to know the baseHref. With hash based
// routing query parameters are implemented within the URL fragment. Because of this any query parameters on the
// original URL are not considered. This filter captures those and adds them to the fragment.
final RequestUriBuilder requestUriBuilder = RequestUriBuilder.fromHttpServletRequest(httpServletRequest).path(httpServletRequest.getContextPath()).fragment("/?" + queryString);
final URI redirectUri = requestUriBuilder.build();

final HttpServletResponse httpServletResponse = (HttpServletResponse) response;
httpServletResponse.sendRedirect(redirectUri.toString());
} else {
filterChain.doFilter(request, response);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,10 @@ language governing permissions and limitations under the License. -->

<packaging>war</packaging>
<properties>
<frontend.dependency.configs>${basedir}/src/main/frontend</frontend.dependency.configs>
<frontend.working.dir>${project.build.directory}/frontend-working-directory</frontend.working.dir>
<frontend.assets>${project.build.directory}/${project.build.finalName}/assets</frontend.assets>
<nifi.jolt.ui.working.dir>${project.build.directory}/nifi-jolt-transform-json-ui-working-directory</nifi.jolt.ui.working.dir>
</properties>

<dependencies>

<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-framework-api</artifactId>
Expand All @@ -51,10 +48,6 @@ language governing permissions and limitations under the License. -->
<artifactId>nifi-jolt-utils</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
Expand All @@ -71,18 +64,6 @@ language governing permissions and limitations under the License. -->
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
<artifactId>jersey-test-framework-provider-inmemory</artifactId>
Expand All @@ -94,93 +75,54 @@ language governing permissions and limitations under the License. -->
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-web-servlet-shared</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-frontend</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<!--
Unpack the built nifi front end application
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-client-side-deps</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${frontend.assets}</outputDirectory>
<resources>
<resource>
<directory>${frontend.working.dir}/node_modules</directory>
<filtering>false</filtering>
<includes>
<include>**/*.js</include>
<include>**/*.css</include>
<!-- font awesome -->
<include>font-awesome/fonts/**/*</include>
<include>font-awesome/README.md</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-package-json</id>
<phase>generate-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${frontend.working.dir}</outputDirectory>
<resources>
<resource>
<directory>${frontend.dependency.configs}</directory>
<filtering>false</filtering>
<includes>
<include>package.json</include>
<include>package-lock.json</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>${frontend.mvn.plugin.version}</version>
<configuration>
<installDirectory>${frontend.working.dir}</installDirectory>
</configuration>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>install-node-and-npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<id>unpack-nifi-jolt-transform-json-ui</id>
<phase>generate-resources</phase>
<configuration>
<nodeVersion>${node.version}</nodeVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<arguments>--cache-min Infinity install</arguments>
<workingDirectory>${frontend.working.dir}</workingDirectory>
<includeGroupIds>org.apache.nifi</includeGroupIds>
<includeArtifactIds>nifi-frontend</includeArtifactIds>
<excludeTransitive>true</excludeTransitive>
<silent>false</silent>
<outputDirectory>${nifi.jolt.ui.working.dir}</outputDirectory>
<includes>nifi-jolt-transform-ui/**/*</includes>
</configuration>
</execution>
</executions>
</plugin>
<!--
Include the NiFi UI and exclude the JAR dependency
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<directory>${nifi.jolt.ui.working.dir}/nifi-jolt-transform-ui</directory>
<includes>**/*</includes>
</resource>
<resource>
<directory>src/main/webapp/META-INF</directory>
<targetPath>META-INF</targetPath>
Expand All @@ -190,21 +132,7 @@ language governing permissions and limitations under the License. -->
<filtering>true</filtering>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<configuration>
<excludes combine.children="append">
<exclude>nbactions.xml</exclude>
<exclude>src/main/frontend/package.json</exclude>
<exclude>src/main/frontend/package-lock.json</exclude>
<exclude>src/main/webapp/js/codemirror/</exclude>
<exclude>src/main/webapp/css/main.css</exclude>
<exclude>src/main/webapp/js/js-beautify/*</exclude>
<exclude>src/main/webapp/fonts/**/*</exclude>
</excludes>
<packagingExcludes>WEB-INF/lib/nifi-frontend*.jar</packagingExcludes>
</configuration>
</plugin>
</plugins>
Expand Down
Loading

0 comments on commit da6c9c4

Please sign in to comment.