Skip to content

Commit

Permalink
Fix environment selection
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoasr committed Jul 16, 2024
1 parent 5956092 commit 84a1b94
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class Ami {
*
* @param amiId - for AWS, the string "ami-" and a sequence of 17 characters
* @param applicationEnvironment - comma-separated list of environments (dev, test,
* staging, prod) supported by this ami
* stage, prod, m10n) supported by this ami
* @param creationDate - ami creation date, UTC
* @return the new Ami instance
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,25 @@ function Ami({ amiList, requestAmiList, envTypes, requestEnvTypes, updateAmiTag
setArch(event.target.value);
};
const [selected, setSelected] = React.useState([]);
const [env, setEnv] = React.useState({});
if (envTypes !== undefined && Object.keys(env).length == 0) {
const targetEnv = {};
envTypes.forEach(value => { targetEnv[value] = false; });
setEnv(targetEnv);
}
const handleTableRowSelect = (id, row) => {
setSelected(id);
setAppEnv(row.applicationEnvironment);
const envs_str = row.applicationEnvironment;
const envs = envs_str.split(',');
env.dev = env.test = env.staging = env.prod = false;
envTypes.forEach(envType => { env[envType] = false; });
for (const env_str of envs)
env[env_str] = true;
};
const [appEnv, setAppEnv] = React.useState();
const handleAppEnvChange = event => {
setAppEnv(event.target.value);
};
const envMap = {};
if (envTypes !== undefined)
envTypes.forEach(value => { envMap[value] = false; });
const [env] = React.useState(envMap);
const handleCheckboxChange = (event) => {
env[event.target.name] = event.target.checked;
const newAppEnv = [];
Expand All @@ -86,6 +88,8 @@ function Ami({ amiList, requestAmiList, envTypes, requestEnvTypes, updateAmiTag
requestAmiList(parms.join('&'));
requestEnvTypes();
}
console.log("env = " + JSON.stringify(env))
// console.log("envMap = " + JSON.stringify(envMap))

if (!amiList)
amiList = [];
Expand Down

0 comments on commit 84a1b94

Please sign in to comment.