From ec80e69833ae365ee5715404f01e1387e3b2dc65 Mon Sep 17 00:00:00 2001 From: typescreep Date: Wed, 10 Sep 2025 21:24:02 +0300 Subject: [PATCH] docs env + readme --- .env | 2 ++ .env.options.dist | 2 ++ README.md | 36 +++++++++++++++++++ server/index.ts | 3 ++ .../organisms/Documentation/Documentation.tsx | 5 ++- .../customizationApiGroupAndVersion.ts | 4 +++ 6 files changed, 49 insertions(+), 3 deletions(-) diff --git a/.env b/.env index 23389ab..295e21a 100644 --- a/.env +++ b/.env @@ -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/ diff --git a/.env.options.dist b/.env.options.dist index f804b89..5d586f8 100644 --- a/.env.options.dist +++ b/.env.options.dist @@ -31,3 +31,5 @@ LOGIN_USERNAME_FIELD= REMOVE_BACKLINK= REMOVE_BACKLINK_TEXT= + +DOCS_URL= diff --git a/README.md b/README.md index be94b3e..b23d86d 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/server/index.ts b/server/index.ts index 1cbdc63..d54d03c 100644 --- a/server/index.ts +++ b/server/index.ts @@ -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"'} } diff --git a/src/components/organisms/Header/organisms/Documentation/Documentation.tsx b/src/components/organisms/Header/organisms/Documentation/Documentation.tsx index bf50a3f..6eeb0d3 100644 --- a/src/components/organisms/Header/organisms/Documentation/Documentation.tsx +++ b/src/components/organisms/Header/organisms/Documentation/Documentation.tsx @@ -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 ( - ) diff --git a/src/constants/customizationApiGroupAndVersion.ts b/src/constants/customizationApiGroupAndVersion.ts index bd543b9..2cf6fc3 100644 --- a/src/constants/customizationApiGroupAndVersion.ts +++ b/src/constants/customizationApiGroupAndVersion.ts @@ -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'