docs env + readme

This commit is contained in:
typescreep
2025-09-10 21:24:02 +03:00
parent 90998ecf3c
commit ec80e69833
6 changed files with 49 additions and 3 deletions

2
.env
View File

@@ -29,3 +29,5 @@ VITE_LOGIN_USERNAME_FIELD=name
VITE_REMOVE_BACKLINK=true
VITE_REMOVE_BACKLINK_TEXT=true
VITE_DOCS_URL=https://in-cloud.io/docs/tech-docs/introduction/

View File

@@ -31,3 +31,5 @@ LOGIN_USERNAME_FIELD=
REMOVE_BACKLINK=
REMOVE_BACKLINK_TEXT=
DOCS_URL=

View File

@@ -1 +1,37 @@
# openapi-ui
## React + TypeScript UI for Kubernetes
A React + TypeScript app that provides tables, forms and factories that renders UI and data directly from Kubernetes Custom Resources (CRDs).
Define interfaces in YAML; the app discovers CRDs, watches their objects, and builds a live UI.
# ⚙️ Configuration
This app can be configured through environment variables.
| Variable | Type | Description |
| ---------------------------------------- | --------- | --------------------------------------------------------------------------------------- |
| `BASEPREFIX` | `string` | Base URL for the app. `/openapi-ui` |
| `KUBE_API_URL` | `string` | URL for the Kubernetes API. `http://api.incloud-web.svc.default.in-cloud.internal:8081` |
| `BFF_URL` | `string` | URL for the BFF |
| `LOGIN_URL` | `string` | Login endpoint. `/oauth/token` |
| `LOGOUT_URL` | `string` | Logout endpoint. `/oauth/logout` |
| `LOGIN_USERNAME_FIELD` | `string` | Field from login endpoint response. `name` |
| `CUSTOMIZATION_API_GROUP` | `string` | API group for customization resources. `front.in-cloud.io` |
| `CUSTOMIZATION_API_VERSION` | `string` | API version for customization resources. `v1alpha1` |
| `CUSTOMIZATION_NAVIGATION_RESOURCE_NAME` | `string` | Resource plural name for navigation settings. `navigations` |
| `CUSTOMIZATION_NAVIGATION_RESOURCE` | `string` | Resource name for navigation settings. `navigation` |
| `USE_NAMESPACE_NAV` | `boolean` | Use namespaces instead of project/instances. `true` |
| `NAVIGATE_FROM_CLUSTERLIST` | `string` | Location to be navigated after selecting cluster. `/openapi-ui/clusters/~recordValue~` |
| `PROJECTS_API_GROUP` | `string` | API group for projects resources. If not using namespace nav. |
| `PROJECTS_VERSION` | `string` | API version for projects resources. If not using namespace nav. |
| `PROJECTS_RESOURCE_NAME` | `string` | Plural name for projects resources. If not using namespace nav. |
| `INSTANCES_API_GROUP` | `string` | API group for instances resources. If not using namespace nav. |
| `INSTANCES_VERSION` | `string` | API version for instances resources. If not using namespace nav. |
| `INSTANCES_RESOURCE_NAME` | `string` | Plural name for instances resources. If not using namespace nav. |
| `MARKETPLACE_RESOURCE_NAME` | `string` | Plural name for marketplace resources for related factory component. |
| `MARKETPLACE_KIND` | `string` | Kind name for marketplace resources for related factory component. |
| `NODE_TERMINAL_DEFAULT_PROFILE` | `string` | Default profile for node terminal component. `baseline` |
| `REMOVE_BACKLINK` | `boolean` | Remove backlink arrow from right-side navigation |
| `REMOVE_BACKLINK_TEXT` | `boolean` | Remove backlink text from right-side navigation |
| `DOCS_URL` | `string` | URL to navigate from question mark |

View File

@@ -66,6 +66,8 @@ const REMOVE_BACKLINK = process.env.LOCAL === 'true' ? options?.REMOVE_BACKLINK
const REMOVE_BACKLINK_TEXT =
process.env.LOCAL === 'true' ? options?.REMOVE_BACKLINK_TEXT : process.env.REMOVE_BACKLINK_TEXT
const DOCS_URL = process.env.LOCAL === 'true' ? options?.DOCS_URL : process.env.DOCS_URL
const healthcheck = require('express-healthcheck')
const promBundle = require('express-prom-bundle')
@@ -189,6 +191,7 @@ app.get(`${basePrefix ? basePrefix : ''}/env.js`, (_, res) => {
LOGIN_URL: ${JSON.stringify(LOGIN_URL) || '"check envs"'},
LOGOUT_URL: ${JSON.stringify(LOGOUT_URL) || '"check envs"'},
LOGIN_USERNAME_FIELD: ${JSON.stringify(LOGIN_USERNAME_FIELD) || '"check envs"'},
DOCS_URL: ${JSON.stringify(DOCS_URL) || '"/docs"'},
REMOVE_BACKLINK: ${!!REMOVE_BACKLINK ? JSON.stringify(REMOVE_BACKLINK).toLowerCase() : '"false"'},
REMOVE_BACKLINK_TEXT: ${!!REMOVE_BACKLINK_TEXT ? JSON.stringify(REMOVE_BACKLINK_TEXT).toLowerCase() : '"false"'}
}

View File

@@ -1,12 +1,11 @@
import React, { FC } from 'react'
import { Button } from 'antd'
import { QuestionCircleOutlined } from '@ant-design/icons'
import { DOCS_URL } from 'constants/customizationApiGroupAndVersion'
export const Documentation: FC = () => {
const platformDocumentationUrl = '/docs'
return (
<Button type="text" onClick={() => window.open(platformDocumentationUrl, '_blank')}>
<Button type="text" onClick={() => window.open(typeof DOCS_URL === 'string' ? DOCS_URL : '/docs', '_blank')}>
<QuestionCircleOutlined />
</Button>
)

View File

@@ -62,6 +62,10 @@ export const LOGIN_USERNAME_FIELD = import.meta.env.DEV
? window._env_.LOGIN_USERNAME_FIELD || import.meta.env.VITE_LOGIN_USERNAME_FIELD
: window._env_.LOGIN_USERNAME_FIELD
export const DOCS_URL = import.meta.env.DEV
? window._env_.DOCS_URL || import.meta.env.VITE_DOCS_URL
: window._env_.DOCS_URL
export const BASE_REMOVE_BACKLINK = import.meta.env.DEV
? window._env_.REMOVE_BACKLINK === 'true' || import.meta.env.VITE_REMOVE_BACKLINK?.toString().toLowerCase() === 'true'
: window._env_.REMOVE_BACKLINK === 'true'