diff --git a/.env b/.env index 295e21a..1844f4b 100644 --- a/.env +++ b/.env @@ -31,3 +31,5 @@ VITE_REMOVE_BACKLINK=true VITE_REMOVE_BACKLINK_TEXT=true VITE_DOCS_URL=https://in-cloud.io/docs/tech-docs/introduction/ + +VITE_SEARCH_TABLE_CUSTOMIZATION_PREFIX=stock- diff --git a/.env.options.dist b/.env.options.dist index 5d586f8..a04925e 100644 --- a/.env.options.dist +++ b/.env.options.dist @@ -33,3 +33,5 @@ REMOVE_BACKLINK= REMOVE_BACKLINK_TEXT= DOCS_URL= + +SEARCH_TABLE_CUSTOMIZATION_PREFIX= diff --git a/README.md b/README.md index 48452ce..e9e09cd 100644 --- a/README.md +++ b/README.md @@ -35,3 +35,4 @@ This app can be configured through environment variables. | `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 | +| `SEARCH_TABLE_CUSTOMIZATION_PREFIX` | `string` | Search tables Customization id prefix | diff --git a/server/index.ts b/server/index.ts index d54d03c..f95b1ec 100644 --- a/server/index.ts +++ b/server/index.ts @@ -68,6 +68,11 @@ const REMOVE_BACKLINK_TEXT = const DOCS_URL = process.env.LOCAL === 'true' ? options?.DOCS_URL : process.env.DOCS_URL +const SEARCH_TABLE_CUSTOMIZATION_PREFIX = + process.env.LOCAL === 'true' + ? options?.SEARCH_TABLE_CUSTOMIZATION_PREFIX + : process.env.SEARCH_TABLE_CUSTOMIZATION_PREFIX + const healthcheck = require('express-healthcheck') const promBundle = require('express-prom-bundle') @@ -192,6 +197,7 @@ app.get(`${basePrefix ? basePrefix : ''}/env.js`, (_, res) => { 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"'}, + SEARCH_TABLE_CUSTOMIZATION_PREFIX: ${JSON.stringify(SEARCH_TABLE_CUSTOMIZATION_PREFIX) || '"search-"'}, 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/constants/customizationApiGroupAndVersion.ts b/src/constants/customizationApiGroupAndVersion.ts index 2cf6fc3..b261e26 100644 --- a/src/constants/customizationApiGroupAndVersion.ts +++ b/src/constants/customizationApiGroupAndVersion.ts @@ -66,6 +66,10 @@ export const DOCS_URL = import.meta.env.DEV ? window._env_.DOCS_URL || import.meta.env.VITE_DOCS_URL : window._env_.DOCS_URL +export const SEARCH_TABLE_CUSTOMIZATION_PREFIX = import.meta.env.DEV + ? window._env_.SEARCH_TABLE_CUSTOMIZATION_PREFIX || import.meta.env.VITE_SEARCH_TABLE_CUSTOMIZATION_PREFIX + : window._env_.SEARCH_TABLE_CUSTOMIZATION_PREFIX + 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' diff --git a/src/utils/getTableCustomizationIdPrefix.ts b/src/utils/getTableCustomizationIdPrefix.ts index 4dc6106..336c0d9 100644 --- a/src/utils/getTableCustomizationIdPrefix.ts +++ b/src/utils/getTableCustomizationIdPrefix.ts @@ -1,3 +1,5 @@ +import { SEARCH_TABLE_CUSTOMIZATION_PREFIX } from 'constants/customizationApiGroupAndVersion' + export const getTableCustomizationIdPrefix = ({ project, instance, @@ -16,7 +18,7 @@ export const getTableCustomizationIdPrefix = ({ if (inside) { result = 'inside-' } else if (search) { - result = 'search-' + result = SEARCH_TABLE_CUSTOMIZATION_PREFIX } else { result = 'stock-' }