diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6bdd3992a..b5ddee309 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,6 +40,7 @@ jobs: rm -rf stylesheets - name: Build run: | + bash prebuild.sh hugo - name: Publish working-directory: ${{ env.PUBLISH_DIRECTORY }} diff --git a/.gitignore b/.gitignore index 494176aec..e12f7329b 100644 --- a/.gitignore +++ b/.gitignore @@ -24,8 +24,11 @@ node_modules/ .sass-cache .ruby-version package-lock.json +nifi-runtime-manifest.json # hugo /public /resources /.hugo_build.lock +/prebuild/public +/prebuild/.hugo_build.lock diff --git a/README.md b/README.md index 39624a3c5..055affb2e 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,9 @@ The Apache NiFi website uses [Hugo](https://gohugo.io) to build static HTML and ## Build +- Run prebuild.sh for generated documentation + - `bash prebuild.sh` + - Run Hugo Build - `hugo` diff --git a/config.toml b/config.toml index aae042267..17ffaeed8 100644 --- a/config.toml +++ b/config.toml @@ -8,6 +8,7 @@ disableKinds = ["RSS"] enableGitInfo = true theme = "nifi" enableInlineShortcodes = true +disablePathToLower = true [markup.goldmark.renderer] unsafe = true @@ -28,6 +29,8 @@ assets = "assets" matomoSiteId = 28 productionHost = "nifi.apache.org" +staticDocsPath = "/nifi-docs" + apacheFoundationGroupsUrl = "https://projects.apache.org/json/foundation/groups.json" apacheFoundationPeopleNameUrl = "https://projects.apache.org/json/foundation/people_name.json" @@ -47,7 +50,29 @@ minifiCppCurrentProjectVersionReleased = "2024-05-17" minifiCppPreviousProjectVersion = "0.15.0" minifiCppPreviousProjectVersionReleased = "2023-09-01" +[module] + [[module.mounts]] + source = "content" + target = "content" + [[module.mounts]] + source = "static" + target = "static" + [[module.mounts]] + source = "layouts" + target = "layouts" + [[module.mounts]] + source = "prebuild/public/components" + target = "content/components" + [[module.mounts]] + source = "prebuild/public/html" + target = "content/nifi-docs" + [menu] + [[menu.main]] + name = 'NiFi Version 2 Documentation' + url = '/components/' + weight = 1 + parent = 'Documentation' [[menu.main]] name = 'Wiki' url = 'https://cwiki.apache.org/confluence/display/NIFI' diff --git a/content/documentation/_index.md b/content/documentation/_index.md index 2156f91c5..273a86910 100644 --- a/content/documentation/_index.md +++ b/content/documentation/_index.md @@ -11,7 +11,7 @@ menu: ## Configuration and Component Properties -- [NiFi Documentation {{< param currentProjectVersion >}}]({{< relref "/documentation/v2" >}}) +- [NiFi Documentation {{< param currentProjectVersion >}}]({{< relref "/components/" >}}) - [NiFi Documentation {{< param previousProjectVersion >}}]({{< relref "/documentation/v1" >}}) ## Reference Information diff --git a/content/documentation/v2/_index.md b/content/documentation/v2/_index.md deleted file mode 100644 index 518e92880..000000000 --- a/content/documentation/v2/_index.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: "Documentation for Version 2" -layout: "documentation" -iframe: true -menu: - main: - name: NiFi Version 2 Documentation - parent: "Documentation" - weight: 1 ---- - - diff --git a/prebuild.sh b/prebuild.sh new file mode 100644 index 000000000..6fcc25492 --- /dev/null +++ b/prebuild.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +CURRENT_VERSION=2.0.0 + +RESOURCES_DIR=resources +PREBUILD_DIR=prebuild + +MAVEN_BASE_URL=https://repo1.maven.org/maven2 + +MANIFEST_JAR_URL="$MAVEN_BASE_URL/org/apache/nifi/nifi-runtime-manifest/$CURRENT_VERSION/nifi-runtime-manifest-$CURRENT_VERSION.jar" +MANIFEST_JAR_PATH=$RESOURCES_DIR/nifi-runtime-manifest.jar +MANIFEST_JSON=nifi-runtime-manifest.json + +NIFI_DOCS_ZIP_URL="$MAVEN_BASE_URL/org/apache/nifi/nifi-docs/$CURRENT_VERSION/nifi-docs-$CURRENT_VERSION-resources.zip" +NIFI_DOCS_ZIP_PATH=$RESOURCES_DIR/nifi-docs-resources.zip + +# Create Hugo directories +if [ ! -d $RESOURCES_DIR ];then + mkdir $RESOURCES_DIR +fi + +# Download Runtime Manifest JAR and extract JSON to prebuild +echo "Downloading $MANIFEST_JAR_URL" +curl -o $MANIFEST_JAR_PATH $MANIFEST_JAR_URL +unzip -q -o -d $PREBUILD_DIR/assets $MANIFEST_JAR_PATH $MANIFEST_JSON + +# Download Documentation Resources and extract to prebuild +echo "Downloading $NIFI_DOCS_ZIP_URL" +curl -o $NIFI_DOCS_ZIP_PATH $NIFI_DOCS_ZIP_URL +unzip -q -o -d $PREBUILD_DIR/public $NIFI_DOCS_ZIP_PATH + +# Build components using prebuild directory with Hugo +hugo -s $PREBUILD_DIR diff --git a/prebuild/config.toml b/prebuild/config.toml new file mode 100644 index 000000000..04ee003d4 --- /dev/null +++ b/prebuild/config.toml @@ -0,0 +1,6 @@ +title = "Apache NiFi" +copyright = "The Apache Software Foundation" +disableKinds = ["RSS", "sitemap", "taxonomy", "term"] + +[outputs] +home = ["html"] diff --git a/prebuild/layouts/index.html b/prebuild/layouts/index.html new file mode 100644 index 000000000..0059840db --- /dev/null +++ b/prebuild/layouts/index.html @@ -0,0 +1,51 @@ +{{ $manifest := dict }} +{{ with resources.Get "nifi-runtime-manifest.json" }} + {{ with . | transform.Unmarshal }} + {{ $manifest = . }} + {{ end }} +{{ else }} + not found +{{ end }} + +{{ range $manifest.bundles }} + {{ range .componentManifest.controllerServices }} + {{ $simpleClassName := replaceRE `.+?\.?([^\.]+)$` "$1" .type }} + {{ $metadata := merge . (dict "title" $simpleClassName "componentType" "controller-services") }} + {{ $string := jsonify $metadata }} + {{ $filename := printf "components/%s/_index.md" .type }} + {{ $resource := resources.FromString $filename $string }} + {{ $file := $resource.RelPermalink }} + {{ end }} + {{ range .componentManifest.processors }} + {{ $simpleClassName := replaceRE `.+?\.?([^\.]+)$` "$1" .type }} + {{ $metadata := merge . (dict "title" $simpleClassName "componentType" "processors") }} + {{ $string := jsonify $metadata }} + {{ $filename := printf "components/%s/_index.md" .type }} + {{ $resource := resources.FromString $filename $string }} + {{ $file := $resource.RelPermalink }} + {{ end }} + {{ range .componentManifest.reportingTasks }} + {{ $simpleClassName := replaceRE `.+?\.?([^\.]+)$` "$1" .type }} + {{ $metadata := merge . (dict "title" $simpleClassName "componentType" "reporting-tasks") }} + {{ $string := jsonify $metadata }} + {{ $filename := printf "components/%s/_index.md" .type }} + {{ $resource := resources.FromString $filename $string }} + {{ $file := $resource.RelPermalink }} + {{ end }} + {{ range .componentManifest.parameterProviders }} + {{ $simpleClassName := replaceRE `.+?\.?([^\.]+)$` "$1" .type }} + {{ $metadata := merge . (dict "title" $simpleClassName "componentType" "parameter-providers") }} + {{ $string := jsonify $metadata }} + {{ $filename := printf "components/%s/_index.md" .type }} + {{ $resource := resources.FromString $filename $string }} + {{ $file := $resource.RelPermalink }} + {{ end }} + {{ range .componentManifest.flowAnalysisRules }} + {{ $simpleClassName := replaceRE `.+?\.?([^\.]+)$` "$1" .type }} + {{ $metadata := merge . (dict "title" $simpleClassName "componentType" "flow-analysis-rules") }} + {{ $string := jsonify $metadata }} + {{ $filename := printf "components/%s/_index.md" .type }} + {{ $resource := resources.FromString $filename $string }} + {{ $file := $resource.RelPermalink }} + {{ end }} +{{ end }} diff --git a/static/.htaccess b/static/.htaccess index 1947d7dc4..6087b77e4 100644 --- a/static/.htaccess +++ b/static/.htaccess @@ -10,6 +10,9 @@ RewriteRule ^documentation/nifi-latest/html/(.+?)$ /documentation/nifi-2.0.0-M4/ # Redirect component documentation to specified version RewriteRule ^docs/nifi-docs/components/org\.apache\.nifi/([^\/]+?)/[^\/]+?/(.*)$ docs/nifi-docs/components/org.apache.nifi/$1/1.28.0/$2 [L] +# Rewrite documentation overview pages +RewriteRule ^documentation/v2/$ /components/ [L,R] + # Rewrite historical links RewriteRule ^minifi/.*$ /projects/minifi/ [L,R] RewriteRule ^quickstart\.html$ /documentation/v2/ [L,R] diff --git a/themes/nifi/layouts/partials/component.html b/themes/nifi/layouts/partials/component.html new file mode 100644 index 000000000..b057a43b8 --- /dev/null +++ b/themes/nifi/layouts/partials/component.html @@ -0,0 +1,422 @@ +{{ $processors := where .Site.Pages "Params.componentType" "processors" }} +{{ $controllerServices := where .Site.Pages "Params.componentType" "controller-services" }} + +

{{ .Params.title }} {{ .Params.version }}

+ +
+
Bundle
+
{{ .Params.group }} | {{ .Params.artifact }}
+
Description
+
{{ .Params.typeDescription }}
+
Tags
+
+ {{- range $index, $tag := .Params.tags -}} + {{- if $index }}, {{ end }}{{ $tag }} + {{- end -}} +
+
Input Requirement
+
+ {{ replace .Params.inputRequirement "INPUT_" "" }} +
+
Supports Sensitive Dynamic Properties
+
{{ .Params.supportsSensitiveDynamicProperties }}
+
+ +
+
Properties
+
+ + +
+ +
+
+ +
+ +{{ if .Params.dynamicProperties }} +
+
Dynamic Properties
+
+ + +
+ +
+
+ +
+{{ end }} + +{{ if .Params.stateful }} +
State Management
+
+ + + + + + + + + + + + + +
ScopesDescription
+ {{- range $index, $scope := .Params.stateful.scopes -}} + {{- if $index }}, {{ end }}{{ $scope }} + {{- end -}} + {{ .Params.stateful.description }}
+
+{{ end }} + +{{ if .Params.systemResourceConsiderations }} +
System Resource Considerations
+
+ + + + + + + + + {{ range .Params.systemResourceConsiderations }} + + + + + {{ end }} + +
ResourceDescription
{{ .resource }}{{ .description }}
+
+{{ end }} + +{{ if .Params.explicitRestrictions }} +
Restrictions
+
+ + + + + + + + + {{ range .Params.explicitRestrictions }} + + + + + {{ end }} + +
Required PermissionExplanation
{{ .requiredPermission }}{{ .explanation }}
+
+{{ end }} + +{{ if .Params.supportedRelationships }} +
Relationships
+
+ + + + + + + + + {{ range .Params.supportedRelationships }} + + + + + {{ end }} + +
NameDescription
{{ .name }}{{ .description }}
+
+{{ end }} + +{{ if .Params.readsAttributes }} +
Reads Attributes
+
+ + + + + + + + + {{ range .Params.readsAttributes }} + + + + + {{ end }} + +
NameDescription
{{ .name }}{{ .description }}
+
+{{ end }} + +{{ if .Params.writesAttributes }} +
Writes Attributes
+
+ + + + + + + + + {{ range .Params.writesAttributes }} + + + + + {{ end }} + +
NameDescription
{{ .name }}{{ .description }}
+
+{{ end }} + +{{ if .Params.useCases }} +
+
Use Cases
+
+
+ +
+{{ end }} + +{{ if .Params.multiProcessorUseCases }} +
+
Use Cases Involving Other Components
+
+
+ +
+ +{{ end }} + +{{ if .Params.seeAlso }} +
See Also
+ +{{ end }} \ No newline at end of file diff --git a/themes/nifi/layouts/section/components.html b/themes/nifi/layouts/section/components.html new file mode 100644 index 000000000..4e355ce49 --- /dev/null +++ b/themes/nifi/layouts/section/components.html @@ -0,0 +1,141 @@ +{{ define "main" }} + {{ $pageTitle := .Title }} +
+ +
+
+ + + + +
    +
  • + Processors +
    + {{ $processors := where .Site.Pages "Params.componentType" "processors" }} +
      + {{ range $processors }} +
    • + {{ .Title }} +
    • + {{ end }} +
    +
    +
  • +
+ +
    +
  • + Controller Services +
    + {{ $controllerServices := where .Site.Pages "Params.componentType" "controller-services" }} +
      + {{ range $controllerServices }} +
    • + {{ .Title }} +
    • + {{ end }} +
    +
    +
  • +
+ +
    +
  • + Reporting Tasks +
    + {{ $reportingTasks := where .Site.Pages "Params.componentType" "reporting-tasks" }} +
      + {{ range $reportingTasks }} +
    • + {{ .Title }} +
    • + {{ end }} +
    +
    +
  • +
+ +
    +
  • + Parameter Providers +
    + {{ $parameterProviders := where .Site.Pages "Params.componentType" "parameter-providers" }} +
      + {{ range $parameterProviders }} +
    • + {{ .Title }} +
    • + {{ end }} +
    +
    +
  • +
+ +
    +
  • + Flow Analysis Rules +
    + {{ $flowAnalysisRules := where .Site.Pages "Params.componentType" "flow-analysis-rules" }} +
      + {{ range $flowAnalysisRules }} +
    • + {{ .Title }} +
    • + {{ end }} +
    +
    +
  • +
+
+ + +
+ +
+
+ {{ if .Params.artifact }} + {{ partial "component.html" . }} + {{ else }} +

Overview

+

+ Apache NiFi is a dataflow system based on the concepts of flow-based programming. It supports powerful and scalable directed graphs of data routing, transformation, and system mediation + logic. NiFi has a web-based user interface for design, control, feedback, and monitoring of dataflows. It is highly configurable along several dimensions of quality of service, such as + loss-tolerant versus guaranteed delivery, low latency versus high throughput, and priority-based queuing. NiFi provides fine-grained data provenance for all data received, forked, joined + cloned, modified, sent, and ultimately dropped upon reaching its configured end-state. +

+ {{ end }} +
+
+
+{{ end }} diff --git a/themes/nifi/static/css/main.css b/themes/nifi/static/css/main.css index 386f5a119..e2262c19e 100644 --- a/themes/nifi/static/css/main.css +++ b/themes/nifi/static/css/main.css @@ -10,19 +10,6 @@ footer { padding: 60px 0px 40px 0px; } -table tr td, -table tr th { - text-align: left; - padding: 12px 24px; -} - -table tr td:first-child, -table tr th:first-child { - padding-left: 0; -} - - - a { color: #004849; } @@ -355,4 +342,47 @@ footer h3 { .uk-card img { width: 40%; -} \ No newline at end of file +} + +.component-items li { + margin-left: 10px; +} + +@media (width > 960px) { + #component-panel { + padding-left: 0px; + } +} + +.component-section-header { + color: #333; + font-size: .875rem; + font-weight: 400; + text-transform: uppercase; +} + +.uk-accordion-title { + font-size: 16px; +} + +.uk-accordion > .property-descriptor { + margin: 0px; + padding: 10px; + border: 1px solid #eee; +} + +.property-required { + font-weight: bold; +} + +.uk-accordion > .description { + margin: 0px; + padding: 10px; + border: 1px solid #eee; +} + +.use-case-configuration { + border: none; + white-space: pre-wrap; + margin: 0px; +}