Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate docusaurus to v3 and add search for documentation #12681

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docusaurus/docs/extensions/advanced/localization.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Localisation files can be found in `./assets/translations/en-us.yaml`.

Please follow precedents in file to determine where new translations should be place.

Form fields are conventionally defined in translations as `<some prefix>`.`<field name>`.{label,description,enum options if applicable} e.g.
Form fields are conventionally defined in translations as `<some prefix>`.`<field name>`.\{label,description,enum options if applicable\} e.g.

```yml
account:
Expand Down
2 changes: 1 addition & 1 deletion docusaurus/docs/extensions/api/common.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ The admissible parameters for the `LocationConfig` object are:
|`product`| `v2.7.2` | Array | Array of the product identifier. Ex: `fleet`, `manager` (Cluster Management), `harvesterManager` (Virtualization Management), `explorer` (Cluster Explorer) or `home` (Homepage) |
|`resource`| `v2.7.2` + `v2.8.0` | Array | Array of the identifier of the kubernetes resource to be bound to. Ex: `apps.deployment`, `storage.k8s.io.storageclass` or `secret` (v2.7.2). You can also define a wildcard, ex: `['*']`, which will match any resource page (v2.8.0) |
|`namespace`| `v2.7.2` | Array | Array of the namespace identifier. Ex: `kube-system`, `cattle-global-data` or `cattle-system` |
|`path`| `v2.7.7` | Array | Array of objects that does matching for the `path` part of the url. Admissable properties for the object are: `urlPath` (string), `exact` (boolean, default or omission: `true`, which defines the type of match it does) and `endsWith` (boolean, defaults to false) .Ex: { `urlPath`: '/c/local/explorer/projectsnamespaces', `exact`: true } or { `urlPath`: 'explorer/projectsnamespaces', `endsWith`: true } |
|`path`| `v2.7.7` | Array | Array of objects that does matching for the `path` part of the url. Admissable properties for the object are: `urlPath` (string), `exact` (boolean, default or omission: `true`, which defines the type of match it does) and `endsWith` (boolean, defaults to false) .Ex: \{ `urlPath`: '/c/local/explorer/projectsnamespaces', `exact`: true \} or \{ `urlPath`: 'explorer/projectsnamespaces', `endsWith`: true \} |
|`cluster`| `v2.7.2` | Array | Array of the cluster identifier. Ex: `local` |
|`id`| `v2.7.2` | Array | Array of the identifier for a given resource. Ex: `deployment-unt6xmz` |
|`mode`| `v2.7.2` + `v2.7.7` | Array | Array of modes which relates to the type of view on which the given enhancement should be applied. Admissible values are: `edit` (v2.7.2), `config` (v2.7.2), `detail` (v2.7.2), `list` (v2.7.2) and `create` (v2.7.7) |
Expand Down
2 changes: 1 addition & 1 deletion docusaurus/docs/extensions/extensions-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ This command will create a new folder `my-app` and populate it with the minimum

### Installing Rancher

See <https://ranchermanager.docs.rancher.com/getting-started/installation-and-upgrade>. Note: Not all Linux distros and versions are supported. To make sure your OS is compatible with Rancher, see the support maintenance terms for the specific Rancher version that you are using: https://www.suse.com/suse-rancher/support-matrix/all-supported-versions
See https://ranchermanager.docs.rancher.com/getting-started/installation-and-upgrade. Note: Not all Linux distros and versions are supported. To make sure your OS is compatible with Rancher, see the support maintenance terms for the specific Rancher version that you are using: https://www.suse.com/suse-rancher/support-matrix/all-supported-versions

The above linked installation docs cover two methods confirmed to work with the Dashboard:

Expand Down
12 changes: 6 additions & 6 deletions docusaurus/docs/internal/code-base-works/forms-and-validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,17 +197,17 @@ customValidationRules() {

> #### A validation rule can contain the following keys:
>
> `path` {string}: the model property to validate
> `path` \{string\}: the model property to validate
>
> `nullable` {boolean}: asserts if property accepts `null` value
> `nullable` \{boolean\}: asserts if property accepts `null` value
>
> `required` {boolean}: asserts if property requires a value
> `required` \{boolean\}: asserts if property requires a value
>
> `translationKey` {string}: path to validation key in `assets/translations`
> `translationKey` \{string\}: path to validation key in `assets/translations`
>
> `type` {string}: name of built-in validation rule to assert
> `type` \{string\}: name of built-in validation rule to assert
>
> `validators` {string}: name of custom validation rule to assert
> `validators` \{string\}: name of custom validation rule to assert

Add `:${arg}` to pass custom arguments to a validation function:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ import ResourceManager from '@shell/mixins/resource-manager';

Allowed params for the configuration object:

* @param {**String**} `namespace` - Namespace identifier
* @param {**Object**} `data` - Object containing info about the data needed to be fetched and how it should be parsed.
* @param \{**String**\} `namespace` - Namespace identifier
* @param \{**Object**\} `data` - Object containing info about the data needed to be fetched and how it should be parsed.

**NOTE: The object KEY NEEDS to be the resource TYPE!**
* @param {**Array**} `data[TYPE].applyTo` - The array of operations needed to be performed for the specific data TYPE
* @param {**String**} `data[TYPE].applyTo[x].var` - The 'this' property name that should be populated with the data fetched
* @param {**Boolean**} `data[TYPE].applyTo[x].classify` - Whether the data fetched should have a model applied to it
* @param {**Function**} `data[TYPE].applyTo[x].parsingFunc` - Optional parsing function if the fetched data needs to be parsed
* @param \{**Array**\} `data[TYPE].applyTo` - The array of operations needed to be performed for the specific data TYPE
* @param \{**String**\} `data[TYPE].applyTo[x].var` - The 'this' property name that should be populated with the data fetched
* @param \{**Boolean**\} `data[TYPE].applyTo[x].classify` - Whether the data fetched should have a model applied to it
* @param \{**Function**\} `data[TYPE].applyTo[x].parsingFunc` - Optional parsing function if the fetched data needs to be parsed

Example of a configuration object to be used with the `resource-manager`:

Expand Down Expand Up @@ -83,8 +83,8 @@ async fetch() {
#### **resourceManagerFetchSecondaryResources**
Function used to initialize the data loading procedure

* @param {**Object**} `dataConfig` - Configuration object
* @param {**Boolean**} `onlyNamespaced` - Flag to enable the fetch from API *ONLY* for namespaced resources (will ignore requests for non-namespaced resources you have defined on the configuration object). Defaults to `false`
* @param \{**Object**\} `dataConfig` - Configuration object
* @param \{**Boolean**\} `onlyNamespaced` - Flag to enable the fetch from API *ONLY* for namespaced resources (will ignore requests for non-namespaced resources you have defined on the configuration object). Defaults to `false`

Example:
```
Expand All @@ -96,8 +96,8 @@ async fetch() {
#### **resourceManagerClearSecondaryResources**
Function used to clear the results for the secondary resource data fetch. It's a very useful method in a CREATE screen scenario where a user can "create" a namespace on the UI, operation which will make all our previous namespaced results invalid and in need to be cleared.

* @param {**Object**} `dataConfig` - Configuration object
* @param {**Boolean**} `onlyNamespaced` - Flag to enable the fetch from API *ONLY* for namespaced resources (will ignore requests for non-namespaced resources you have defined on the configuration object). Defaults to `false`
* @param \{**Object**\} `dataConfig` - Configuration object
* @param \{**Boolean**\} `onlyNamespaced` - Flag to enable the fetch from API *ONLY* for namespaced resources (will ignore requests for non-namespaced resources you have defined on the configuration object). Defaults to `false`

Example:
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Localisation files can be found in `./assets/translations/en-us.yaml`.

Please follow precedents in file to determine where new translations should be place.

Form fields are conventionally defined in translations as `<some prefix>`.`<field name>`.{label,description,enum options if applicable} e.g.
Form fields are conventionally defined in translations as `<some prefix>`.`<field name>`.\{label,description,enum options if applicable\} e.g.

```yml
account:
Expand Down
20 changes: 10 additions & 10 deletions docusaurus/docs/internal/getting-started/development_environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ A good base knowledge of Vue, Vuex and Nuxt should be reached before going throu

| Description | Link |
| --------------------------------- | ------------------------------------------------------------------------------------------------------ |
| Core Vue Docs | <https://vuejs.org/v2/guide> |
| Typescript in Vue | <https://vuejs.org/v2/guide/typescript.html> |
| Vue Template/Directive Shorthands | <https://vuejs.org/v2/guide/syntax.html> |
| Vue Conditional rendering | <https://vuejs.org/v2/guide/conditional.html> |
| Vuex Core Docs | <https://vuex.vuejs.org/> |
| Nuxt Get Started | <https://nuxtjs.org/docs/2.x/get-started/installation> |
| Nuxt Structure | <https://nuxtjs.org/docs/2.x/directory-structure> |
| Axios (HTTP Requests) | <https://axios.nuxtjs.org/options> |
| HTTP Proxy middleware | <https://github.com/nuxt-community/proxy-module> (<https://github.com/chimurai/http-proxy-middleware>) |
| Core Vue Docs | https://vuejs.org/v2/guide |
| Typescript in Vue | https://vuejs.org/v2/guide/typescript.html |
| Vue Template/Directive Shorthands | https://vuejs.org/v2/guide/syntax.html |
| Vue Conditional rendering | https://vuejs.org/v2/guide/conditional.html |
| Vuex Core Docs | https://vuex.vuejs.org/ |
| Nuxt Get Started | https://nuxtjs.org/docs/2.x/get-started/installation |
| Nuxt Structure | https://nuxtjs.org/docs/2.x/directory-structure |
| Axios (HTTP Requests) | https://axios.nuxtjs.org/options |
| HTTP Proxy middleware | https://github.com/nuxt-community/proxy-module (https://github.com/chimurai/http-proxy-middleware) |

## Platform

The Dashboard is shipped with the Rancher package which contains the Rancher API. When developing locally the Dashboard must point to an instance of the Rancher API.

### Installing Rancher

See <https://ranchermanager.docs.rancher.com/getting-started/installation-and-upgrade>. Note: Not all Linux distros and versions are supported. To make sure your OS is compatible with Rancher, see the support maintenance terms for the specific Rancher version that you are using: https://www.suse.com/suse-rancher/support-matrix/all-supported-versions
See https://ranchermanager.docs.rancher.com/getting-started/installation-and-upgrade. Note: Not all Linux distros and versions are supported. To make sure your OS is compatible with Rancher, see the support maintenance terms for the specific Rancher version that you are using: https://www.suse.com/suse-rancher/support-matrix/all-supported-versions

The above linked installation docs cover two methods confirmed to work with the Dashboard:

Expand Down
7 changes: 5 additions & 2 deletions docusaurus/docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @ts-check
const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
const { themes } = require('prism-react-renderer');
const lightCodeTheme = themes.github;
const darkCodeTheme = themes.dracula;

/** @type {import('@docusaurus/types').Config} */
const config = {
Expand Down Expand Up @@ -42,6 +43,8 @@ const config = {
],

plugins: [
[require.resolve('docusaurus-lunr-search'), { excludeRoutes: ['internal/*', 'internal/**/*', '/internal/*', '/internal/**/*', 'blog/*', 'blog/**/*', '/blog/*', '/blog/**/*'] }
],
[
'@docusaurus/plugin-content-docs',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Localisation files can be found in `./assets/translations/en-us.yaml`.

Please follow precedents in file to determine where new translations should be place.

Form fields are conventionally defined in translations as `<some prefix>`.`<field name>`.{label,description,enum options if applicable} e.g.
Form fields are conventionally defined in translations as `<some prefix>`.`<field name>`.\{label,description,enum options if applicable\} e.g.

```yml
account:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ The admissible parameters for the `LocationConfig` object are:
|`product`| `v2.7.2` | Array | Array of the product identifier. Ex: `fleet`, `manager` (Cluster Management), `harvesterManager` (Virtualization Management), `explorer` (Cluster Explorer) or `home` (Homepage) |
|`resource`| `v2.7.2` + `v2.8.0` | Array | Array of the identifier of the kubernetes resource to be bound to. Ex: `apps.deployment`, `storage.k8s.io.storageclass` or `secret` (v2.7.2). You can also define a wildcard, ex: `['*']`, which will match any resource page (v2.8.0) |
|`namespace`| `v2.7.2` | Array | Array of the namespace identifier. Ex: `kube-system`, `cattle-global-data` or `cattle-system` |
|`path`| `v2.7.7` | Array | Array of objects that does matching for the `path` part of the url. Admissable properties for the object are: `urlPath` (string), `exact` (boolean, default or omission: `true`, which defines the type of match it does) and `endsWith` (boolean, defaults to false) .Ex: { `urlPath`: '/c/local/explorer/projectsnamespaces', `exact`: true } or { `urlPath`: 'explorer/projectsnamespaces', `endsWith`: true } |
|`path`| `v2.7.7` | Array | Array of objects that does matching for the `path` part of the url. Admissable properties for the object are: `urlPath` (string), `exact` (boolean, default or omission: `true`, which defines the type of match it does) and `endsWith` (boolean, defaults to false) .Ex: \{ `urlPath`: '/c/local/explorer/projectsnamespaces', `exact`: true \} or \{ `urlPath`: 'explorer/projectsnamespaces', `endsWith`: true \} |
|`cluster`| `v2.7.2` | Array | Array of the cluster identifier. Ex: `local` |
|`id`| `v2.7.2` | Array | Array of the identifier for a given resource. Ex: `deployment-unt6xmz` |
|`mode`| `v2.7.2` + `v2.7.7` | Array | Array of modes which relates to the type of view on which the given enhancement should be applied. Admissible values are: `edit` (v2.7.2), `config` (v2.7.2), `detail` (v2.7.2), `list` (v2.7.2) and `create` (v2.7.7) |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ This command will create a new folder `my-app` and populate it with the minimum

### Installing Rancher

See <https://ranchermanager.docs.rancher.com/getting-started/installation-and-upgrade>. Note: Not all Linux distros and versions are supported. To make sure your OS is compatible with Rancher, see the support maintenance terms for the specific Rancher version that you are using: https://www.suse.com/suse-rancher/support-matrix/all-supported-versions
See https://ranchermanager.docs.rancher.com/getting-started/installation-and-upgrade. Note: Not all Linux distros and versions are supported. To make sure your OS is compatible with Rancher, see the support maintenance terms for the specific Rancher version that you are using: https://www.suse.com/suse-rancher/support-matrix/all-supported-versions

The above linked installation docs cover two methods confirmed to work with the Dashboard:

Expand Down
20 changes: 11 additions & 9 deletions docusaurus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@
"install:ci": "yarn install --frozen-lockfile"
},
"dependencies": {
"@docusaurus/core": "2.0.0-beta.22",
"@docusaurus/plugin-client-redirects": "2.0.0-beta.22",
"@docusaurus/preset-classic": "2.0.0-beta.22",
"@mdx-js/react": "^1.6.22",
"@docusaurus/core": "^3.6.3",
"@docusaurus/plugin-client-redirects": "^3.6.3",
"@docusaurus/preset-classic": "^3.6.3",
"@mdx-js/react": "^3.0.0",
"clsx": "^1.2.0",
"prism-react-renderer": "^1.3.5",
"react": "^17.0.2",
"react-dom": "^17.0.2"
"docusaurus-lunr-search": "^3.5.0",
"prism-react-renderer": "^2.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.0.0-beta.22"
"@docusaurus/module-type-aliases": "^3.6.3",
"@docusaurus/types": "3.0.0"
},
"browserslist": {
"production": [
Expand All @@ -43,6 +45,6 @@
"cheerio": "1.0.0-rc.12"
},
"engines": {
"node": ">=16.14"
"node": ">=18.0"
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"docs:install": "cd docusaurus/ && yarn install",
"docs:build": "cd docusaurus/ && yarn build",
"docs:start": "cd docusaurus/ && yarn start",
"docs:serve": "cd docusaurus/ && yarn serve",
"migrate": "node ./shell/scripts/vue-migrate.js",
"publish:lib": "cd pkg/rancher-components && npm publish"
},
Expand Down