NIFI-182: - Embedding REST docs in the Help section. Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/5e6de841 Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/5e6de841 Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/5e6de841
Branch: refs/heads/develop Commit: 5e6de841d06773ff617f70cbae6a655bcab061f1 Parents: 4146a23 Author: Matt Gilman <[email protected]> Authored: Fri Dec 19 10:47:23 2014 -0500 Committer: Matt Gilman <[email protected]> Committed: Fri Dec 19 10:47:23 2014 -0500 ---------------------------------------------------------------------- .../org/apache/nifi/web/server/JettyServer.java | 14 +++++++++++-- .../framework/web/nifi-web-api/pom.xml | 4 ++-- .../src/main/enunciate/override.css | 22 +++++--------------- .../src/main/webapp/WEB-INF/web.xml | 14 +++++++++---- .../main/webapp/WEB-INF/jsp/documentation.jsp | 11 ++++++++++ .../src/main/webapp/js/application.js | 9 ++++++-- .../nifi-web-error/src/main/webapp/index.jsp | 1 + 7 files changed, 48 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/5e6de841/nar-bundles/framework-bundle/framework/web/nifi-jetty/src/main/java/org/apache/nifi/web/server/JettyServer.java ---------------------------------------------------------------------- diff --git a/nar-bundles/framework-bundle/framework/web/nifi-jetty/src/main/java/org/apache/nifi/web/server/JettyServer.java b/nar-bundles/framework-bundle/framework/web/nifi-jetty/src/main/java/org/apache/nifi/web/server/JettyServer.java index 3900cfc..62d83a4 100644 --- a/nar-bundles/framework-bundle/framework/web/nifi-jetty/src/main/java/org/apache/nifi/web/server/JettyServer.java +++ b/nar-bundles/framework-bundle/framework/web/nifi-jetty/src/main/java/org/apache/nifi/web/server/JettyServer.java @@ -384,14 +384,24 @@ public class JettyServer implements NiFiServer { // load the docs directory final File docsDir = Paths.get("docs").toRealPath().toFile(); final Resource docsResource = Resource.newResource(docsDir); - // load the component documentation working directory + // load the component documentation working directory final String componentDocsDirPath = props.getProperty(NiFiProperties.COMPONENT_DOCS_DIRECTORY, "work/docs/components"); final File workingDocsDirectory = Paths.get(componentDocsDirPath).toRealPath().getParent().toFile(); final Resource workingDocsResource = Resource.newResource(workingDocsDirectory); + // load the rest documentation + final File webApiDocsDir = new File(webApiContext.getTempDirectory(), "webapp/docs"); + if (!webApiDocsDir.exists()) { + final boolean made = webApiDocsDir.mkdirs(); + if (!made) { + throw new RuntimeException(webApiDocsDir.getAbsolutePath() + " could not be created"); + } + } + final Resource webApiDocsResource = Resource.newResource(webApiDocsDir); + // create resources for both docs locations - final ResourceCollection resources = new ResourceCollection(docsResource, workingDocsResource); + final ResourceCollection resources = new ResourceCollection(docsResource, workingDocsResource, webApiDocsResource); resourceHandler.setBaseResource(resources); // create the context handler http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/5e6de841/nar-bundles/framework-bundle/framework/web/nifi-web-api/pom.xml ---------------------------------------------------------------------- diff --git a/nar-bundles/framework-bundle/framework/web/nifi-web-api/pom.xml b/nar-bundles/framework-bundle/framework/web/nifi-web-api/pom.xml index f0cb80b..8a9b2d1 100644 --- a/nar-bundles/framework-bundle/framework/web/nifi-web-api/pom.xml +++ b/nar-bundles/framework-bundle/framework/web/nifi-web-api/pom.xml @@ -34,7 +34,7 @@ <resources> <resource> <directory>src/main/enunciate/images</directory> - <targetPath>${project.build.directory}/${project.artifactId}-${project.version}/docs/img</targetPath> + <targetPath>${project.build.directory}/${project.artifactId}-${project.version}/docs/rest-api/img</targetPath> </resource> </resources> <plugins> @@ -51,7 +51,7 @@ <goal>docs</goal> </goals> <configuration> - <docsDir>${project.build.directory}/${project.artifactId}-${project.version}/docs</docsDir> + <docsDir>${project.build.directory}/${project.artifactId}-${project.version}/docs/rest-api</docsDir> </configuration> </execution> </executions> http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/5e6de841/nar-bundles/framework-bundle/framework/web/nifi-web-api/src/main/enunciate/override.css ---------------------------------------------------------------------- diff --git a/nar-bundles/framework-bundle/framework/web/nifi-web-api/src/main/enunciate/override.css b/nar-bundles/framework-bundle/framework/web/nifi-web-api/src/main/enunciate/override.css index 5e839c5..a96d0a3 100644 --- a/nar-bundles/framework-bundle/framework/web/nifi-web-api/src/main/enunciate/override.css +++ b/nar-bundles/framework-bundle/framework/web/nifi-web-api/src/main/enunciate/override.css @@ -18,7 +18,7 @@ } #site-name a { - /*font-variant: normal !important;*/ + font-variant: normal !important; letter-spacing: 1px; } @@ -35,10 +35,6 @@ color: #fff !important; } -.xbreadcrumbs li { - /*padding: 10px 15px 10px 10px !important;*/ -} - .xbreadcrumbs li a, .xbreadcrumbs li.current a { font-size: 13px !important; color: #fff !important; @@ -46,6 +42,7 @@ .xbreadcrumbs li a.home { background: url(img/home.png) no-repeat left center; + line-height: 16px; } .xbreadcrumbs li ul { @@ -58,8 +55,8 @@ } .home { - background-color: #dfe8ec; color: #444; + font-family: Verdana, Arial, Helvetica, sans-serif !important; } a { @@ -71,9 +68,6 @@ a:hover { } .container { - width: 940px !important; - border-left: 2px solid #efefef; - border-right: 2px solid #efefef; padding: 0 10px; background-color: #fff; } @@ -139,12 +133,6 @@ code { border-top: 3px solid #eee; } -/* width */ - .span-18 { - width: 916px !important; -} - -.span-20 { - width: 935px !important; -} + width: 776px !important; +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/5e6de841/nar-bundles/framework-bundle/framework/web/nifi-web-api/src/main/webapp/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/nar-bundles/framework-bundle/framework/web/nifi-web-api/src/main/webapp/WEB-INF/web.xml b/nar-bundles/framework-bundle/framework/web/nifi-web-api/src/main/webapp/WEB-INF/web.xml index 8986a45..2ee9670 100644 --- a/nar-bundles/framework-bundle/framework/web/nifi-web-api/src/main/webapp/WEB-INF/web.xml +++ b/nar-bundles/framework-bundle/framework/web/nifi-web-api/src/main/webapp/WEB-INF/web.xml @@ -15,6 +15,7 @@ --> <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> <display-name>nifi-api</display-name> + <context-param> <param-name>contextConfigLocation</param-name> <param-value> @@ -26,12 +27,15 @@ classpath:nifi-cluster-protocol-context.xml </param-value> </context-param> + <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> + <listener> <listener-class>org.apache.nifi.web.contextlistener.ApplicationStartupContextListener</listener-class> </listener> + <servlet> <servlet-name>jerseySpring</servlet-name> <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class> @@ -44,10 +48,7 @@ <servlet-name>jerseySpring</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> - <servlet-mapping> - <servlet-name>default</servlet-name> - <url-pattern>/docs/*</url-pattern> - </servlet-mapping> + <filter> <filter-name>timer</filter-name> <filter-class>org.apache.nifi.web.filter.TimerFilter</filter-class> @@ -56,6 +57,7 @@ <filter-name>timer</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> + <filter> <filter-name>threadLocal</filter-name> <filter-class>org.apache.nifi.web.filter.ThreadLocalFilter</filter-class> @@ -64,6 +66,7 @@ <filter-name>threadLocal</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> + <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> @@ -72,6 +75,7 @@ <filter-name>springSecurityFilterChain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> + <filter> <filter-name>requestLogger</filter-name> <filter-class>org.apache.nifi.web.filter.RequestLogger</filter-class> @@ -80,6 +84,7 @@ <filter-name>requestLogger</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> + <filter> <filter-name>gzipCompressionFilter</filter-name> <filter-class>org.eclipse.jetty.servlets.GzipFilter</filter-class> @@ -88,6 +93,7 @@ <filter-name>gzipCompressionFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> + <filter> <filter-name>nodeRequestFilter</filter-name> <filter-class>org.apache.nifi.web.filter.NodeRequestFilter</filter-class> http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/5e6de841/nar-bundles/framework-bundle/framework/web/nifi-web-docs/src/main/webapp/WEB-INF/jsp/documentation.jsp ---------------------------------------------------------------------- diff --git a/nar-bundles/framework-bundle/framework/web/nifi-web-docs/src/main/webapp/WEB-INF/jsp/documentation.jsp b/nar-bundles/framework-bundle/framework/web/nifi-web-docs/src/main/webapp/WEB-INF/jsp/documentation.jsp index 299cf4e..b350e6b 100644 --- a/nar-bundles/framework-bundle/framework/web/nifi-web-docs/src/main/webapp/WEB-INF/jsp/documentation.jsp +++ b/nar-bundles/framework-bundle/framework/web/nifi-web-docs/src/main/webapp/WEB-INF/jsp/documentation.jsp @@ -20,6 +20,7 @@ <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <link rel="shortcut icon" href="../nifi/images/nifi16.ico"/> <title>NiFi Documentation</title> <script type="text/javascript" src="../nifi/js/jquery/jquery-2.1.1.min.js"></script> <script type="text/javascript" src="js/application.js"></script> @@ -41,6 +42,7 @@ <div class="header">Documents</div> <div class="component-links"> <ul> + <li class="component-item"><a class="component-link user-guide" href="user-guide/nifi-user-guide.html" target="component-usage">User Guide</a></li> </ul> </div> </div> @@ -98,6 +100,15 @@ </c:choose> </div> </div> + <div class="section"> + <div class="header">Developer</div> + <div class="component-links"> + <ul> + <li class="component-item"><a class="component-link rest-api" href="rest-api/index.html" target="component-usage">Rest Api</a></li> + <li class="component-item"><a class="component-link" href="javascript:void(0);" target="component-usage">Developer Guide</a></li> + </ul> + </div> + </div> </div> <div id="component-filter-controls"> <div id="component-filter-container"> http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/5e6de841/nar-bundles/framework-bundle/framework/web/nifi-web-docs/src/main/webapp/js/application.js ---------------------------------------------------------------------- diff --git a/nar-bundles/framework-bundle/framework/web/nifi-web-docs/src/main/webapp/js/application.js b/nar-bundles/framework-bundle/framework/web/nifi-web-docs/src/main/webapp/js/application.js index 1a60de6..5e5ee1c 100644 --- a/nar-bundles/framework-bundle/framework/web/nifi-web-docs/src/main/webapp/js/application.js +++ b/nar-bundles/framework-bundle/framework/web/nifi-web-docs/src/main/webapp/js/application.js @@ -199,9 +199,9 @@ $(document).ready(function () { } }).blur(function () { if ($(this).val() === '') { - $(this).addClass('component-filter-list').val('Filter components'); + $(this).addClass('component-filter-list').val('Filter'); } - }).addClass('component-filter-list').val('Filter components'); + }).addClass('component-filter-list').val('Filter'); // get the component usage container to install the window listener var componentUsageContainer = $('#component-usage-container'); @@ -255,6 +255,11 @@ $(document).ready(function () { selectComponent(componentName); } }); + + // listen for on the rest api and user guide + $('a.rest-api a.user-guide').on('click', function() { + selectComponent($(this).text()); + }); // get the initial selection var initialComponentLink = $('a.component-link:first'); http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/5e6de841/nar-bundles/framework-bundle/framework/web/nifi-web-error/src/main/webapp/index.jsp ---------------------------------------------------------------------- diff --git a/nar-bundles/framework-bundle/framework/web/nifi-web-error/src/main/webapp/index.jsp b/nar-bundles/framework-bundle/framework/web/nifi-web-error/src/main/webapp/index.jsp index f7dc687..3a342fb 100644 --- a/nar-bundles/framework-bundle/framework/web/nifi-web-error/src/main/webapp/index.jsp +++ b/nar-bundles/framework-bundle/framework/web/nifi-web-error/src/main/webapp/index.jsp @@ -20,6 +20,7 @@ <% String contextPath = "/".equals(request.getContextPath()) ? "" : request.getContextPath(); %> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <link rel="shortcut icon" href="../nifi/images/nifi16.ico"/> <title>NiFi</title> <link href="<%= contextPath %>/nifi/css/message-pane.css" rel="stylesheet" type="text/css" /> <link href="<%= contextPath %>/nifi/css/message-page.css" rel="stylesheet" type="text/css" />
