CEC-4044 update manifest form (#312)

* CEC-4044 update manifest form

* Show env input if there are options
This commit is contained in:
John Wu
2023-04-10 10:59:01 -07:00
committed by GitHub
parent c83f4dde01
commit cfb1b7d74e
10 changed files with 182 additions and 4 deletions

35
src/utils/key-envs.js Normal file
View File

@@ -0,0 +1,35 @@
const KEY_ENVS = process.env.REACT_APP_ECCKEY_ENV;
const ENV = process.env.REACT_APP_ENV;
export const CURRENT_ENV = "current";
const GetEnvName = (value) => {
if (value === "cec-prd" || value === "cec-euprd") return "prd";
return value;
}
const MakeList = () => {
const result = [];
const list = KEY_ENVS.split(",");
list.forEach((env) => {
if (env.length > 0) result.push({
value: env,
label: env,
})
})
result.unshift({
value: CURRENT_ENV,
label: GetEnvName(ENV),
});
return result;
}
export const GetEnvValue = (value) => {
if (value === ENV) return CURRENT_ENV;
return value;
}
export const ENVS = MakeList();