|
|
@@ -29,7 +29,7 @@ plugin name in the `consolePlugin` declaration of [package.json](package.json).
|
|
|
|
|
|
```json
|
|
|
"consolePlugin": {
|
|
|
- "name": "my-plugin",
|
|
|
+ "name": "console-plugin-template",
|
|
|
"version": "0.0.1",
|
|
|
"displayName": "My Plugin",
|
|
|
"description": "Enjoy this shiny, new console plugin!",
|
|
|
@@ -94,7 +94,7 @@ cached containers will help you start developing in seconds.
|
|
|
1. Create a `dev.env` file inside the `.devcontainer` folder with the correct values for your cluster:
|
|
|
|
|
|
```bash
|
|
|
-OC_PLUGIN_NAME=my-plugin
|
|
|
+OC_PLUGIN_NAME=console-plugin-template
|
|
|
OC_URL=https://api.example.com:6443
|
|
|
OC_USER=kubeadmin
|
|
|
OC_PASS=<password>
|
|
|
@@ -143,14 +143,50 @@ Additional parameters can be specified if desired. Consult the chart [values](ch
|
|
|
|
|
|
### Installing the Helm Chart
|
|
|
|
|
|
-Install the chart using the name of the plugin as the Helm release name into a new namespace or an existing namespace as specified by the `my-plugin-namespace` parameter and providing the location of the image within the `plugin.image` parameter by using the following command:
|
|
|
+Install the chart using the name of the plugin as the Helm release name into a new namespace or an existing namespace as specified by the `plugin_console-plugin-template` parameter and providing the location of the image within the `plugin.image` parameter by using the following command:
|
|
|
|
|
|
```shell
|
|
|
-helm upgrade -i my-plugin charts/openshift-console-plugin -n my-plugin-namespace --create-namespace --set plugin.image=my-plugin-image-location
|
|
|
+helm upgrade -i my-plugin charts/openshift-console-plugin -n plugin__console-plugin-template --create-namespace --set plugin.image=my-plugin-image-location
|
|
|
```
|
|
|
|
|
|
NOTE: When deploying on OpenShift 4.10, it is recommended to add the parameter `--set plugin.securityContext.enabled=false` which will omit configurations related to Pod Security.
|
|
|
|
|
|
+NOTE: Please adhere to the specified namespace format `plugin__<name-of-the-plugin>` when defining namespaces. The name of the plugin should be extracted from the `consolePlugin` declaration within the [package.json](package.json) file.
|
|
|
+
|
|
|
+## i18n
|
|
|
+
|
|
|
+The plugin template demonstrates how you can translate messages in with [react-i18next](https://react.i18next.com/). The i18n namespace must match
|
|
|
+the name of the `ConsolePlugin` resource with the `plugin__` prefix to avoid
|
|
|
+naming conflicts. For example, the plugin template uses the
|
|
|
+`plugin__console-plugin-template` namespace. You can use the `useTranslation` hook
|
|
|
+with this namespace as follows:
|
|
|
+
|
|
|
+```tsx
|
|
|
+conster Header: React.FC = () => {
|
|
|
+ const { t } = useTranslation('plugin__console-plugin-template');
|
|
|
+ return <h1>{t('Hello, World!')}</h1>;
|
|
|
+};
|
|
|
+```
|
|
|
+
|
|
|
+For labels in `console-extensions.json`, you can use the format
|
|
|
+`%plugin__console-plugin-template~My Label%`. Console will replace the value with
|
|
|
+the message for the current language from the `plugin__console-plugin-template`
|
|
|
+namespace. For example:
|
|
|
+
|
|
|
+```json
|
|
|
+ {
|
|
|
+ "type": "console.navigation/section",
|
|
|
+ "properties": {
|
|
|
+ "id": "admin-demo-section",
|
|
|
+ "perspective": "admin",
|
|
|
+ "name": "%plugin__console-plugin-template~Plugin Template%"
|
|
|
+ }
|
|
|
+ }
|
|
|
+```
|
|
|
+
|
|
|
+Running `yarn i18n` updates the JSON files in the `locales` folder of the
|
|
|
+plugin template when adding or changing messages.
|
|
|
+
|
|
|
## Linting
|
|
|
|
|
|
This project adds prettier, eslint, and stylelint. Linting can be run with
|