Commit a03f2627 authored by Jaden DIEFENBAUGH's avatar Jaden DIEFENBAUGH
Browse files

[experiments] update test & code for new environment data format

parent e3be081a
......@@ -53,7 +53,7 @@ type Props = {
analyzerBlocks: BeatObject[],
datasets: any[],
toolchain: BeatObject,
environments: BeatEnvironment[],
environments: { [string]: BeatEnvironment },
saveFunc: (BeatObject) => any,
};
......@@ -241,7 +241,7 @@ type EnvironmentConfigProps = {
version: string,
},
queue: string,
availableEnvs: BeatEnvironment[],
availableEnvs: { [string]: BeatEnvironment },
updateEnvInfo: (name: string, version: string) => any,
updateQueue: (queue: string) => any,
disabled?: boolean,
......@@ -249,7 +249,7 @@ type EnvironmentConfigProps = {
const formatEnv = (name, version) => `${ name } (${ version })`;
const EnvironmentConfig = ({ envInfo, queue, availableEnvs, updateEnvInfo, updateQueue, disabled = false }: EnvironmentConfigProps) => {
const eObjs = availableEnvs.map(e => ({[formatEnv(e.name, e.version)]: Object.keys(e.queues)}));
const eObjs = Object.values(availableEnvs).map(e => ({[formatEnv(e.name, e.version)]: Object.keys(e.queues)}));
const envQueues = Object.assign({}, ...eObjs);
const currEnv = formatEnv(envInfo.name, envInfo.version);
const queues = envQueues[currEnv];
......@@ -829,7 +829,7 @@ export class ExperimentEditor extends React.Component<Props, State> {
availableEnvs={this.props.environments}
disabled={envDisabled}
updateEnvInfo={(name, version) => {
const env = this.props.environments.find(e => e.name === name && e.version === version);
const env = Object.values(this.props.environments).find(e => e.name === name && e.version === version);
if(!env)
return;
const queue = Object.keys(env.queues)[0];
......
......@@ -13,15 +13,16 @@ import testDbs from '@test/test_dbs.json';
import testExps from '@test/test_exps.json';
import testTcs from '@test/test_tcs.json';
const envs = [
{
const envs = {
'Scientific Python 2.7': {
name: 'Scientific Python 2.7',
version: '1.0.0',
queues: {
Default: {}
}
},
packages: {}
}
];
};
describe('<ExperimentEditor />', () => {
let wrapper;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment