Skip to content

Commit 9175aa9

Browse files
authored
RHIDP-5422: TechDocs add-ons doc (#975)
* RHIDP-5422: TechDocs add-ons doc * RHIDP-5422: Draft 'create' proc * RHIDP-5422: Apply SME comments * RHIDP-5422: Apply add'l SME comments * RHIDP-5422: Add Create proc + additional changes * RHIDP-5422: add link to installation doc + add'l uodates * RHIDP-5422: Add conceptual info about how add-ons are imported, enabled, and added via the techdocs plugin package * RHIDP-5422: Add more conceptual info about preinstalled and external add-ons and how they are imported by using dynamic plugins * RHIDP-5422: add peer review comments / remove TechDocs content from Customizing guide
1 parent 74f4dbb commit 9175aa9

17 files changed

+672
-7
lines changed

assemblies/assembly-configuring-techdocs.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
:_mod-docs-content-type: ASSEMBLY
22
:context: configuring-techdocs
33
[id="{context}"]
4-
= Configuring TechDocs
4+
= TechDocs configuration
55

66
The TechDocs plugin is preinstalled and enabled on a {product-short} instance by default. You can disable or enable the TechDocs plugin, and change other parameters, by configuring the {product} Helm chart or the {product} Operator ConfigMap.
77

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
:_mod-docs-content-type: ASSEMBLY
2+
:context: techdocs-addon-installing
3+
[id="techdocs-addon-installing"]
4+
= Installing and configuring a TechDocs add-on
5+
6+
TechDocs add-ons are supported by {company-name} are imported by the `backstage-plugin-techdocs-module-addons-contrib` plugin package. The `<ReportIssue />` add-on is preinstalled in the TechDocs plugin and enabled by default. You can install external TechDocs add-ons by adding them to `backstage-plugin-techdocs-module-addons-contrib` package with either the {product} Operator or Helm chart. Additionally, you can import compatible third-party add-ons, including add-ons that you create yourself, with a third-party dynamic plugin.
7+
8+
include::modules/techdocs/proc-techdocs-addon-install-operator.adoc[]
9+
10+
include::modules/techdocs/proc-techdocs-addon-install-helm.adoc[]
11+
12+
include::modules/techdocs/proc-techdocs-addon-install-third-party.adoc[]
13+
14+
.Additional resources
15+
* link:https://docs.redhat.com/en/documentation/red_hat_developer_hub/1.4/html/installing_and_viewing_plugins_in_red_hat_developer_hub/rhdh-installing-rhdh-plugins_title-plugins-rhdh-about[Installing dynamic plugins in Red Hat Developer Hub]
16+
* link:https://docs.redhat.com/en/documentation/red_hat_developer_hub/1.4/html/installing_and_viewing_plugins_in_red_hat_developer_hub/assembly-third-party-plugins[Third-party plugins in Red Hat Developer Hub]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
:_mod-docs-content-type: ASSEMBLY
2+
:context: techdocs-addon-removing
3+
[id="techdocs-addon-removing"]
4+
= Removing a TechDocs add-on
5+
6+
Administrators can remove installed TechDocs add-ons from your {product} instance by using either the Operator or Helm chart, depending on the method used to install the add-on. If you used the Operator to install the add-on, remove it from the ConfigMap. If you used the Helm chart to install the add-on, remove it from the Helm chart.
7+
8+
If you want to disable a plugin instead of removing it from your {product} instance, you can disable the plugin that you are using to import the TechDocs add-on. Since the `disabled` status is controlled at the plugin level, disabling the plugin disables all of the TechDocs add-ons in the specified plugin package.
9+
10+
include::modules/techdocs/proc-techdocs-addon-remove-operator.adoc[]
11+
12+
include::modules/techdocs/proc-techdocs-addon-remove-helm.adoc[]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
:_mod-docs-content-type: ASSEMBLY
2+
:context: techdocs-addon-using
3+
[id="techdocs-addon-using"]
4+
= Using TechDocs add-ons
5+
6+
After an administrator installs a TechDocs add-on in your {product} instance, you can use it to extend the functionality of the TechDocs plugin and enhance your documentation experience.
7+
8+
include::modules/techdocs/proc-techdocs-addon-use-report-issue.adoc[]
9+
10+
include::modules/techdocs/proc-techdocs-addon-use-text-size.adoc[]
11+
12+
include::modules/techdocs/proc-techdocs-addon-use-light-box.adoc[]
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
:_mod-docs-content-type: ASSEMBLY
2+
:context: techdocs-addon
3+
[id="techdocs-addon"]
4+
= TechDocs add-ons
5+
6+
TechDocs add-ons are dynamic plugins that extend the functionality of the built-in TechDocs plugin. For example, you can use add-ons to report documentation issues, change text size, or view images in overlay in either the TechDocs Reader page or an Entity page.
7+
8+
The following table describes the TechDocs add-ons that are available for {product} {product-version}:
9+
10+
.TechDocs Add-ons available in {product}
11+
|===
12+
| TechDocs Add-on | Package/Plugin | Description | Type
13+
14+
| `<ReportIssue />`
15+
| `backstage-plugin-techdocs-module-addons-contrib`
16+
| Select a portion of text on a TechDocs page and open an issue against the repository that contains the documentation. The issue template is automatically populated with the selected text.
17+
| Preinstalled
18+
19+
| `<TextSize />`
20+
| `backstage-plugin-techdocs-module-addons-contrib`
21+
| Customize text size on documentation pages by increasing or decreasing the font size with a slider or buttons. The default value for font size is 100% and this setting is kept in the browser's local storage whenever it is changed.
22+
| External
23+
24+
| `<LightBox />`
25+
| `backstage-plugin-techdocs-module-addons-contrib`
26+
| Open images in a light-box on documentation pages, to navigate to multiple images on a single page. The image size of the light-box image is the same as the image size on the document page. Clicking the zoom icon increases the image size to fit the screen.
27+
| External
28+
29+
//future release | `<ExpandableNavigation />`
30+
//future release | `backstage-plugin-techdocs-module-addons-contrib`
31+
//future release | Expand or collapse the subtitles in the TechDocs navigation menu and keep your preferred state between documentation sites.
32+
|===
33+
34+
You can use a dynamic plugin to import a TechDocs add-on. TechDocs add-ons are enabled at the plugin level, therefore, enabling a plugin enables all of the TechDocs add-ons in the specified plugin package. The preinstalled and external add-ons supported by {company} are imported by the `backstage-plugin-techdocs-module-addons-contrib` plugin package. Since the `disabled` status is set at the plugin level, the `disabled` status of the plugin package applies to all of the TechDocs add-ons imported by that package.

modules/techdocs/con-techdocs-about.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ Built-in navigation and search::
1818
Locate the information that you need within a document quickly and easily.
1919

2020
Add-ons::
21-
Customize your TechDocs experience with add-ons to address higher-order documentation needs.
21+
Make your documentation more functional and interactive with supported TechDocs add-ons. Some add-ons are preinstalled and enabled by default. To extend the default functionality, you can dynamically load external and third-party add-ons into your {product} instance. If you want to further customize your TechDocs experience, you can create add-ons that meet specific documentation needs for your organization.
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
// Module included in the following assemblies:
2+
//
3+
// [WIP] file created but not currently part of any assembly or title
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="proc-techdocs-addon-create_{context}"]
7+
== Creating a TechDocs add-on
8+
9+
If your organization has documentation needs that are not met by the functions of existing TechDocs add-ons, developers can create a new add-on for your TechDocs plugin.
10+
11+
A TechDocs add-on is a React component that is imported from a front-end plugin. If you do not have an existing plugin that you can use to export your TechDocs add-on, you can create a new plugin by using `backstage-cli` to generate a default front-end plugin structure that you can customize.
12+
13+
The folder structure of a new plugin that can be used to import TechDocs add-ons into the TechDocs plugin looks similar to the following example:
14+
[source,json,subs="+attributes,+quotes"]
15+
----
16+
_<new_plugin_for_techdocs_add-on>_/
17+
dev/
18+
index.ts
19+
src/
20+
components/
21+
_<new_techdocs_add-on_component>_/
22+
_<new_techdocs_add-on_component>_.test.tsx
23+
_<new_techdocs_add-on_component>_.tsx
24+
index.ts
25+
_<new_techdocs_add-on_fetch-component>_/
26+
_<new_techdocs_add-on_fetch-component>_.test.tsx
27+
_<new_techdocs_add-on_fetch-component>_.tsx
28+
index.ts
29+
index.ts
30+
plugin.test.ts
31+
plugin.ts
32+
routes.ts
33+
setupTests.ts
34+
.eslintrc.js
35+
package.json
36+
README.md
37+
----
38+
39+
.Prerequisites
40+
* The `yarn` package manager is installed.
41+
* Docker v3.2.0 or later or Podman v3.2.0 or later is installed and running.
42+
43+
.Procedure
44+
. In the terminal, navigate to the root folder of the repository where you want to create your new plugin.
45+
. To create a new front-end plugin, run the following command:
46+
+
47+
[source,terminal,subs="+attributes,+quotes"]
48+
----
49+
yarn new
50+
----
51+
.Example output
52+
+
53+
[source,terminal,subs="+quotes"]
54+
----
55+
? What do you want to create? plugin - A new frontend plugin
56+
? Enter the ID of the plugin [required]
57+
----
58+
+
59+
. In the terminal prompt, type a name for the new plugin. For example:
60+
+
61+
[source,terminal,subs="+attributes,+quotes"]
62+
----
63+
? Enter the ID of the plugin [required] _<new_plugin_for_techdocs_add-on>_
64+
----
65+
+
66+
.Example output
67+
+
68+
[source,terminal,subs="+attributes,+quotes"]
69+
----
70+
Successfully created plugin
71+
----
72+
+
73+
.Result
74+
In the `plugins` directory, a sub-directory with the same name that you gave to your plugin is automatically generated. The directory contains all of the files that you need to configure to create your new plugin.
75+
+
76+
. In the terminal, navigate to your new plugin directory. For example:
77+
+
78+
[source,terminal,subs="+attributes,+quotes"]
79+
----
80+
cd plugins/_<new_techdocs_add-on_directory>_
81+
----
82+
. Add the`@backstage/plugin-techdocs-react` package to get frontend utilities for TechDocs add-ons. For example:
83+
+
84+
[source,terminal,subs="+attributes,+quotes"]
85+
----
86+
yarn add @backstage/plugin-techdocs-react
87+
----
88+
. In the directory containing the components of your custom TechDocs add-on, delete any default files or file components that are not required for your add-on, such as the `routes.ts` file or components of the `index.tsx` and `plugins.ts` files.
89+
. In the `plugins.ts` file, add the following code:
90+
+
91+
[source,java,subs="+attributes,+quotes"]
92+
----
93+
import { createPlugin } from '@backstage/core-plugin-api';
94+
import { createTechDocsAddonExtension } from '@backstage/plugin-techdocs-react';
95+
96+
export const _<new_plugin_for_techdocs_add-on>_ = createPlugin({
97+
id: '_<new_techdocs_add-on>_',
98+
});
99+
100+
/*
101+
*
102+
* @public
103+
*/
104+
export const _<new_techdocs_add-on>_ = _<new_plugin_for_techdocs_add-on>_.provide(
105+
createTechDocsAddonExtension<_<new_techdocs_addon_props>_>({
106+
name: '_<new_techdocs_add-on>_',
107+
location: TechDocsAddonLocations.Content,
108+
component: _<new_techdocs_add-on_component>_,
109+
}),
110+
);
111+
----
112+
+
113+
where
114+
115+
_<new_plugin_for_techdocs_add-on>_ :: Specifies the new plugin that you use to import the TechDocs add-on to your {product} instance.
116+
_<new_techdocs_add-on>_ :: Specifies the custom TechDocs add-on that you want to create.
117+
_<new_techdocs_addon_props>_ (Optional) :: Specifies the `props` for your new TechDocs add-on, as specified in your `_<new_techdocs_add-on>_.tsx` file, if applicable.
118+
_<new_techdocs_add-on_component>_ :: Specifies the React component for the custom TechDocs add-on that you want to create. You will create this component in a `.tsx` file in a later step.
119+
. In the `index.ts` file, export the custom TechDocs add-on that you want to create by adding the following code:
120+
+
121+
[source,java,subs="+attributes,+quotes"]
122+
----
123+
export { _<new_plugin_for_techdocs_add-on>_, _<new_techdocs_add-on>_ } from './plugin';
124+
----
125+
. Create a new `_<new_techdocs_add-on>_.tsx` file and add the code for your new TechDocs add-on component.
126+
+
127+
////
128+
[source,java,subs="+attributes,+quotes"]
129+
----
130+
can add example code for this file, if helpful
131+
can also mention a template that the user can configure, if there is one
132+
----
133+
////
134+
. Create a new `index.tsx` file and use it to export your new TechDocs add-on component by adding the following code:
135+
+
136+
[source,java,subs="+attributes,+quotes"]
137+
----
138+
export { _<new_techdocs_add-on>_, type _<new_techdocs_addon_props>_} from './_<new_techdocs_add-on_directory>_'
139+
----
140+
+
141+
where
142+
143+
_<new_techdocs_addon_props>_ (Optional) :: Specifies the `props` for your new TechDocs add-on, as specified in your `_<new_techdocs_add-on>_.tsx` file, if applicable.
144+
. In the `plugins.ts` file, import your new TechDocs add-on component.
145+
. Install and configure your new TechDocs add-on by following the steps in link:{techdocs-book-url}#techdocs-addon-installing[Installing and configuring a TechDocs add-on]
146+
147+
.Verification
148+
. Restart the RHDH application and verify that the plugin is successfully activated and configured.
149+
. Verify the application logs for confirmation and ensure the plugin is functioning as expected.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * assemblies/assembly-techdocs-addons-installing.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="proc-techdocs-addon-install-helm_{context}"]
7+
== Installing and configuring an external TechDocs add-on using the Helm chart
8+
9+
You can use a dynamic plugin to import TechDocs add-ons into your TechDocs plugin. If you use the {product} Helm chart to install the dynamic plugin, you can add TechDocs add-ons to the plugin package in your Helm chart.
10+
11+
Preinstalled add-ons, such as `ReportIssue`, are included in the default `backstage-plugin-techdocs-module-addons-contrib` package configuration. External add-ons that are supported by {company-name} are installed by manually adding them to the `techdocsAddons` section of the configuration file.
12+
13+
.Prerequisites
14+
* The TechDocs plugin is installed and enabled.
15+
16+
.Procedure
17+
. In your Helm chart, add the `global.dynamic` parameters required to install a dynamic plugin, as shown in link:https://docs.redhat.com/en/documentation/red_hat_developer_hub/1.4/html/installing_and_viewing_plugins_in_red_hat_developer_hub/rhdh-installing-rhdh-plugins_title-plugins-rhdh-about#con-install-dynamic-plugin-helm_rhdh-installing-rhdh-plugins[Installing dynamic plugins using the Helm chart ]
18+
+
19+
[NOTE]
20+
====
21+
The default configuration includes the `dynamic-plugins.default.yaml` file, which contains all of the dynamic plugins, including TechDocs add-ons, that are preinstalled in {product}, whether they are enabled or disabled by default.
22+
====
23+
. In your Helm chart, add the default `backstage-plugin-techdocs-module-addons-contrib` package configuration. For example:
24+
+
25+
[source,yaml,subs="+quotes,+attributes"]
26+
----
27+
global:
28+
dynamic:
29+
plugins:
30+
- package: ./dynamic-plugins/dist/backstage-plugin-techdocs-module-addons-contrib
31+
disabled: false
32+
pluginConfig:
33+
dynamicPlugins:
34+
frontend:
35+
backstage.plugin-techdocs-module-addons-contrib:
36+
techdocsAddons:
37+
- importName: ReportIssue
38+
----
39+
. In the `techdocsAddons` section of the Helm chart, add `importName: _<external_techdocs_add-on>_` for each external TechDocs add-on that you want to add from the specified plugin package. For example:
40+
+
41+
[source,yaml,subs="+quotes,+attributes"]
42+
----
43+
global:
44+
dynamic:
45+
plugins:
46+
- package: ./dynamic-plugins/dist/backstage-plugin-techdocs-module-addons-contrib
47+
disabled: false
48+
pluginConfig:
49+
dynamicPlugins:
50+
frontend:
51+
backstage.plugin-techdocs-module-addons-contrib:
52+
techdocsAddons:
53+
- importName: ReportIssue
54+
- importName: _<external_techdocs_add-on>_
55+
----
56+
+
57+
where:
58+
59+
_<external_techdocs_add-on>_:: Specifies the external TechDocs add-on that you want to install, for example, `TextSize` or `LightBox`.
60+
61+
//.Next steps
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * assemblies/assembly-techdocs-addons-installing.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="proc-techdocs-addon-install-operator_{context}"]
7+
== Installing and configuring an external TechDocs add-on using the Operator
8+
9+
You can use a dynamic plugin to import TechDocs add-ons into your TechDocs plugin. If you use the {product} Operator to install the dynamic plugin, you can add TechDocs add-ons to the plugin package in your ConfigMap.
10+
11+
Preinstalled add-ons, such as `ReportIssue`, are included in the default `backstage-plugin-techdocs-module-addons-contrib` package configuration. External add-ons that are supported by {company-name} are installed by manually adding them to the `techdocsAddons` section of the configuration file.
12+
13+
.Procedure
14+
15+
. From the Developer perspective in the {ocp-short} web console, click *ConfigMaps* > *Create ConfigMap*.
16+
. From the *Create ConfigMap* page, select the *YAML view* option in the *Configure via* field.
17+
. In the newly created ConfigMap, add the default `backstage-plugin-techdocs-module-addons-contrib` package configuration. For example:
18+
+
19+
[source,yaml,subs="+quotes,+attributes"]
20+
----
21+
kind: ConfigMap
22+
apiVersion: v1
23+
metadata:
24+
name: dynamic-plugins-rhdh
25+
data:
26+
dynamic-plugins.yaml: |
27+
includes:
28+
- dynamic-plugins.default.yaml
29+
plugins:
30+
- package: ./dynamic-plugins/dist/backstage-plugin-techdocs-module-addons-contrib
31+
disabled: false
32+
pluginConfig:
33+
dynamicPlugins:
34+
frontend:
35+
backstage.plugin-techdocs-module-addons-contrib:
36+
techdocsAddons:
37+
- importName: ReportIssue
38+
----
39+
. In the `techdocsAddons` section of the ConfigMap, add `importName: _<external_techdocs_add-on>_` for each external TechDocs add-on that you want to add from the specified plugin package. For example:
40+
+
41+
[source,yaml,subs="+quotes,+attributes"]
42+
----
43+
kind: ConfigMap
44+
apiVersion: v1
45+
metadata:
46+
name: dynamic-plugins-rhdh
47+
data:
48+
dynamic-plugins.yaml: |
49+
includes:
50+
- dynamic-plugins.default.yaml
51+
plugins:
52+
- package: ./dynamic-plugins/dist/backstage-plugin-techdocs-module-addons-contrib
53+
disabled: false
54+
pluginConfig:
55+
dynamicPlugins:
56+
frontend:
57+
backstage.plugin-techdocs-module-addons-contrib:
58+
techdocsAddons:
59+
- importName: ReportIssue
60+
- importName: _<external_techdocs_add-on>_
61+
----
62+
+
63+
where:
64+
65+
_<external_techdocs_add-on>_:: Specifies the external TechDocs add-on that you want to install, for example, `TextSize` or `LightBox`.
66+
. Click *Create*.
67+
. In the web console navigation menu, click *Topology*.
68+
. Click on the overflow menu for the {product} instance that you want to use and select *Edit Backstage* to load the YAML view of the {product} instance.
69+
. In your `{product-custom-resource-type}` CR, add the `dynamicPluginsConfigMapName: _<dynamic_plugins_configmap>_` key-value pair. For example:
70+
+
71+
[source,yaml]
72+
----
73+
apiVersion: rhdh.redhat.com/v1alpha3
74+
kind: Backstage
75+
metadata:
76+
name: my-rhdh
77+
spec:
78+
application:
79+
# ...
80+
dynamicPluginsConfigMapName: _<dynamic_plugins_configmap>_
81+
# ...
82+
----
83+
+
84+
where:
85+
86+
_<dynamic_plugins_configmap>_:: Specifies the name of your dynamic plugins ConfigMap for your {product} instance, for example, `dynamic-plugins-rhdh`.
87+
. Click *Save*.
88+
. In the web console navigation menu, click *Topology* and wait for the {product} pod to start.
89+
. Click the *Open URL* icon to start using the {product} platform with the new configuration changes.
90+
91+
//.Next steps

0 commit comments

Comments
 (0)