Skip to content

Commit

Permalink
NIFI-14040 Added Additional Details for Component Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
exceptionfactory committed Nov 22, 2024
1 parent ebf8c6f commit 89bc133
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ nifi-runtime-manifest.json
/.hugo_build.lock
/prebuild/public
/prebuild/.hugo_build.lock
/prebuild/assets/docs
3 changes: 2 additions & 1 deletion prebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ 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
MANIFEST_DOCS_DIR=docs

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
Expand All @@ -22,7 +23,7 @@ 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
unzip -q -o -d $PREBUILD_DIR/assets $MANIFEST_JAR_PATH $MANIFEST_JSON $MANIFEST_DOCS_DIR

# Download Documentation Resources and extract to prebuild
echo "Downloading $NIFI_DOCS_ZIP_URL"
Expand Down
6 changes: 6 additions & 0 deletions prebuild/assets/additional-details-header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
build:
list: never
publishResources: false
render: never
---
42 changes: 42 additions & 0 deletions prebuild/layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
not found
{{ end }}

{{ $detailsHeader := resources.Get "additional-details-header.md" }}

{{ range $manifest.bundles }}
{{ range .componentManifest.controllerServices }}
{{ $simpleClassName := replaceRE `.+?\.?([^\.]+)$` "$1" .type }}
Expand All @@ -15,6 +17,14 @@
{{ $filename := printf "components/%s/_index.md" .type }}
{{ $resource := resources.FromString $filename $string }}
{{ $file := $resource.RelPermalink }}

{{ if .additionalDetails }}
{{ $detailsMarkdownPath := printf "docs/%s/%s/%s/%s/additionalDetails.md" .group .artifact .version .type }}
{{ $detailsResource := resources.Get $detailsMarkdownPath }}
{{ $componentDetailsPath := printf "components/%s/additional-details.md" .type }}
{{ $componentDetailsResource := slice $detailsHeader $detailsResource | resources.Concat $componentDetailsPath }}
{{ $componentDetailsResource.Publish }}
{{ end }}
{{ end }}
{{ range .componentManifest.processors }}
{{ $simpleClassName := replaceRE `.+?\.?([^\.]+)$` "$1" .type }}
Expand All @@ -23,6 +33,14 @@
{{ $filename := printf "components/%s/_index.md" .type }}
{{ $resource := resources.FromString $filename $string }}
{{ $file := $resource.RelPermalink }}

{{ if .additionalDetails }}
{{ $detailsMarkdownPath := printf "docs/%s/%s/%s/%s/additionalDetails.md" .group .artifact .version .type }}
{{ $detailsResource := resources.Get $detailsMarkdownPath }}
{{ $componentDetailsPath := printf "components/%s/additional-details.md" .type }}
{{ $componentDetailsResource := slice $detailsHeader $detailsResource | resources.Concat $componentDetailsPath }}
{{ $componentDetailsResource.Publish }}
{{ end }}
{{ end }}
{{ range .componentManifest.reportingTasks }}
{{ $simpleClassName := replaceRE `.+?\.?([^\.]+)$` "$1" .type }}
Expand All @@ -31,6 +49,14 @@
{{ $filename := printf "components/%s/_index.md" .type }}
{{ $resource := resources.FromString $filename $string }}
{{ $file := $resource.RelPermalink }}

{{ if .additionalDetails }}
{{ $detailsMarkdownPath := printf "docs/%s/%s/%s/%s/additionalDetails.md" .group .artifact .version .type }}
{{ $detailsResource := resources.Get $detailsMarkdownPath }}
{{ $componentDetailsPath := printf "components/%s/additional-details.md" .type }}
{{ $componentDetailsResource := slice $detailsHeader $detailsResource | resources.Concat $componentDetailsPath }}
{{ $componentDetailsResource.Publish }}
{{ end }}
{{ end }}
{{ range .componentManifest.parameterProviders }}
{{ $simpleClassName := replaceRE `.+?\.?([^\.]+)$` "$1" .type }}
Expand All @@ -39,6 +65,14 @@
{{ $filename := printf "components/%s/_index.md" .type }}
{{ $resource := resources.FromString $filename $string }}
{{ $file := $resource.RelPermalink }}

{{ if .additionalDetails }}
{{ $detailsMarkdownPath := printf "docs/%s/%s/%s/%s/additionalDetails.md" .group .artifact .version .type }}
{{ $detailsResource := resources.Get $detailsMarkdownPath }}
{{ $componentDetailsPath := printf "components/%s/additional-details.md" .type }}
{{ $componentDetailsResource := slice $detailsHeader $detailsResource | resources.Concat $componentDetailsPath }}
{{ $componentDetailsResource.Publish }}
{{ end }}
{{ end }}
{{ range .componentManifest.flowAnalysisRules }}
{{ $simpleClassName := replaceRE `.+?\.?([^\.]+)$` "$1" .type }}
Expand All @@ -47,5 +81,13 @@
{{ $filename := printf "components/%s/_index.md" .type }}
{{ $resource := resources.FromString $filename $string }}
{{ $file := $resource.RelPermalink }}

{{ if .additionalDetails }}
{{ $detailsMarkdownPath := printf "docs/%s/%s/%s/%s/additionalDetails.md" .group .artifact .version .type }}
{{ $detailsResource := resources.Get $detailsMarkdownPath }}
{{ $componentDetailsPath := printf "components/%s/additional-details.md" .type }}
{{ $componentDetailsResource := slice $detailsHeader $detailsResource | resources.Concat $componentDetailsPath }}
{{ $componentDetailsResource.Publish }}
{{ end }}
{{ end }}
{{ end }}
14 changes: 14 additions & 0 deletions themes/nifi/layouts/partials/component.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@ <h3>{{ .Params.title }} {{ .Params.version }}</h3>
<dd>{{ .Params.supportsSensitiveDynamicProperties }}</dd>
</dl>

{{ if .Params.additionalDetails }}

{{ $detailsPage := .GetPage "additional-details" }}
<ul uk-accordion>
<li class="additional-details">
<a class="uk-accordion-title" href>Additional Details for {{ .Params.title }} {{ .Params.version }}</a>
<div class="uk-accordion-content">
{{ $detailsPage.Content }}
</div>
</li>
</ul>

{{ end }}

<div class="uk-margin uk-flex">
<div class="component-section-header uk-width-3-4">Properties</div>
<div class="uk-width-1-4 uk-text-right">
Expand Down
6 changes: 6 additions & 0 deletions themes/nifi/static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,12 @@ footer h3 {
font-size: 16px;
}

.uk-accordion > .additional-details {
margin: 0px;
padding: 10px;
border: 1px solid #eee;
}

.uk-accordion > .property-descriptor {
margin: 0px;
padding: 10px;
Expand Down

0 comments on commit 89bc133

Please sign in to comment.