Skip to content

Commit

Permalink
fix: missing anchors required for the application dashboard (#2323)
Browse files Browse the repository at this point in the history
  • Loading branch information
themr0c committed May 17, 2022
1 parent f64a10b commit 6e1344c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
:keywords: user-guide, customizing-developer-environments
:page-aliases: configuring-a-workspace-using-a-devfile, making-a-workspace-portable-using-a-devfile, authoring-devfiles-version-1, authoring-devfiles-version-2, authoring-devfiles, defining-custom-commands-for-che-theia, adding-a-vs-code-extension-to-a-workspace, adding-a-vs-code-extension-to-the-che-plugin-registry, adding-tools-to-che-after-creating-a-workspace, using-private-container-registries, using-artifact-repositories-in-a-restricted-environment, using-maven-artifact-repositories, using-gradle-artifact-repositories, using-python-artifact-repositories, using-go-artifact-repositories, using-nuget-artifact-repositories, using-npm-artifact-repositories, customizing-developer-environments, what-is-a-che-theia-plug-in, testing-a-visual-studio-code-extension-in-che, publishing-metadata-for-a-vs-code-extension, contributor-guide:developing-che-theia-plug-ins, contributor-guide:testing-che-theia-plug-ins, contributor-guide:publishing-che-theia-plug-ins, contributor-guide:adding-support-for-a-new-language, contributor-guide:adding-support-for-a-new-debugger, contributor-guide:che-extensibility-reference, contributor-guide:che-extension-points, contributor-guide:che-theia-plug-in-api, contributor-guide:debug-adapter-protocol, contributor-guide:language-server-protocol, customizing-workspaces-components

[id="customizing-workspace-components_{context}"]
// The application dashboard requires the presence of the `customizing-workspaces` id.
[id="customizing-workspaces_{context}"]
= Customizing workspace components

To customize workspace components:
Expand Down
32 changes: 28 additions & 4 deletions tools/detect-unused-content.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,28 @@ DOCS_PROJECT_PATH=$SCRIPT_DIR/..
pushd "$DOCS_PROJECT_PATH/modules" > /dev/null
readarray -d '' modules < <(find . -mindepth 1 -maxdepth 1 -type d -print0)

missing_anchors=""
# Getting anchor list
id_list="$(curl -fsSL https://raw.githubusercontent.com/redhat-developer/devspaces-images/devspaces-3-rhel-8/devspaces-dashboard/packages/dashboard-frontend/assets/branding/product.json \
| jq -r '.docs[]' | grep '#' | cut -d'#' -f2)"
# Checking the anchors
for id in $id_list
do
if grep --quiet --recursive -e "id=\"${id}_" "${SCRIPT_DIR}/../modules/"
then
true
else
missing_anchors="${missing_anchors} - ${id}"
fi
done

unused_images=""
for module in "${modules[@]}"
do
pushd "$module" > /dev/null
relative_dir="modules${module#.}"

if [ ! -d "./images" ]; then
if [ ! -d "./images" ]; then
# This module does not have images"
popd > /dev/null
continue
Expand All @@ -54,15 +69,15 @@ do
pushd "$module" > /dev/null
relative_dir="modules${module#.}"

if [ ! -d "./pages" ]; then
if [ ! -d "./pages" ]; then
# This module does not have pages"
popd > /dev/null
continue
fi

readarray -d '' pages < <(find "pages" -name '*.adoc' -print0)
for page in "${pages[@]}"
do
do
page=${page#pages/}
if ! grep -q "$page" nav.adoc ; then
unused_pages="$unused_pages - $relative_dir/$page\n"
Expand All @@ -78,7 +93,7 @@ do
pushd "$module" > /dev/null
relative_dir="modules${module#.}"

if [ ! -d "./partials" ]; then
if [ ! -d "./partials" ]; then
# This module does not have partials"
popd > /dev/null
continue
Expand Down Expand Up @@ -125,4 +140,13 @@ else
echo "INFO: All partials have reference in the modules."
fi

if [[ "$missing_anchors" ]]; then
echo "ERROR: The following anchors required for the application dashboard are missing:"
echo -e "${missing_anchors}"
exit_status=1
else
echo "INFO: All dashboard anchors are present."
fi


exit $exit_status

0 comments on commit 6e1344c

Please sign in to comment.