Skip to content

Commit afecada

Browse files
committed
Dynamic plug-in doc updates
1 parent 285a7d1 commit afecada

9 files changed

+2027
-33
lines changed

modules/about-dynamic-plug-ins.adoc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,14 @@ When creating your plug-in, follow these general guidelines:
3030

3131
* Prefix your CSS class names with your plug-in name to avoid collisions. For example, `my-plugin_\_heading` and `my-plugin_\_icon`.
3232
* Maintain a consistent look, feel, and behavior with other console pages.
33-
* Use link:https://github.com/openshift/enhancements/blob/master/enhancements/console/dynamic-plugins.md#localization[react-i18next] for localization.
33+
* Follow link:https://www.i18next.com/[react-i18next] localization guidelines when creating your plug-in. You can use the `useTranslation` hook like the one in the following example:
34+
+
35+
[source,ymal]
36+
----
37+
conster Header: React.FC = () => {
38+
const { t } = useTranslation('plugin__console-demo-plugin');
39+
return <h1>{t('Hello, World!')}</h1>;
40+
};
41+
----
42+
3443
* _Do not_ use console CSS classes in your markup or override console CSS classes. These are not APIs and are subject to change. Using them might break your plug-in. Avoid selectors like element selectors that could affect markup outside of your plug-in’s components.

modules/adding-new-extension-dynamic-plug-in.adoc

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,34 @@
22
//
33
// * web_console/dynamic-plug-ins.adoc
44

5-
:_content-type: CONCEPT
5+
:_content-type: PROCEDURE
66
[id="adding-new-extension-dynamic-plugin_{context}"]
77
= Adding a new extension to your plug-in
8-
You can add extensions to your plug-in that are loaded at runtime.
8+
You can add extensions that allow you to customize your plug-in. Those extensions are then loaded to the console at run-time.
9+
10+
. Edit the `console-extensions.json` file:
11+
+
12+
[source,json]
13+
----
14+
[
15+
{
16+
"type": "console.flag", <1>
17+
"properties": {
18+
"handler": { "$codeRef": "barUtils.testHandler" } <2>
19+
}
20+
},
21+
{
22+
"type": "console.flag/model",
23+
"properties": {
24+
"flag": "EXAMPLE",
25+
"model": {
26+
"group": "kubevirt.io",
27+
"version": "v1alpha3",
28+
"kind": "ExampleModel"
29+
}
30+
}
31+
}
32+
]
33+
----
34+
<1> Add the extension type(s) you want to include with this plug-in. You can include multiple extensions separated with a comma.
35+
<2> The `$codeRef` value should be formatted as either `moduleName.exportName` for a named export or `moduleName` for the default export. Only the plug-in’s exported modules can be used in code references.

modules/deployment-plug-in-cluster.adoc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ After pushing an image with your changes to a registry, you can deploy the plug-
1010

1111
.Procedure
1212

13-
. To deploy your plug-in to a cluster, instantiate the link:https://github.com/spadgett/console-plugin-template/blob/main/template.yaml[template] by running the following command:
13+
. To deploy your plug-in to a cluster, instantiate your plug-in by running the following command:
1414
+
1515
[source,terminal]
1616
----
@@ -26,7 +26,10 @@ $ oc process -f template.yaml \
2626
+
2727
This command runs a light-weight NGINX HTTP server to serve the assets for your plug-in.
2828

29-
IMPORTANT: `PLUGIN_NAME` must match the plug-in name you used in the `consolePlugin` declaration of `package.json`.
29+
[IMPORTANT]
30+
====
31+
`PLUGIN_NAME` must match the plug-in name you used in the `consolePlugin` declaration of `package.json`.
32+
====
3033

3134
[start=2]
3235
. Patch the *Console Operator* configuration to enable the plug-in by running the following command:
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * web_console/dynamic-plug-ins.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="disabling-your-plug-in-browser_{context}"]
7+
= Disabling your plug-in in the browser
8+
9+
Console users can use the `disable-plugins` query parameter to disable specific or all dynamic plug-ins that would normally get loaded at run-time.
10+
11+
.Procedure
12+
13+
* To disable a specific plug-in(s), remove the plug-in you want to disable from the comma-separated list of plug-in names.
14+
15+
* To disable all plug-ins, leave an an empty string in the `disable-plugins` query parameter.
16+
17+
[NOTE]
18+
====
19+
Cluster administrators can disable plug-ins in the *Cluster Settings* page of the web console
20+
====

0 commit comments

Comments
 (0)