1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-15 07:40:07 +02:00

fix(cp-frontend): handle manifests without env varibales

This commit is contained in:
Sérgio Ramos 2017-08-22 14:37:28 +01:00
parent ccf1fd6f9a
commit b5ea1580e5

View File

@ -11,6 +11,7 @@ import uniq from 'lodash.uniq';
import find from 'lodash.find'; import find from 'lodash.find';
import { safeLoad } from 'js-yaml'; import { safeLoad } from 'js-yaml';
import uuid from 'uuid/v4'; import uuid from 'uuid/v4';
import forceArray from 'force-array';
import DeploymentGroupBySlugQuery from '@graphql/DeploymentGroupBySlug.gql'; import DeploymentGroupBySlugQuery from '@graphql/DeploymentGroupBySlug.gql';
import DeploymentGroupCreateMutation from '@graphql/DeploymentGroupCreate.gql'; import DeploymentGroupCreateMutation from '@graphql/DeploymentGroupCreate.gql';
@ -138,6 +139,7 @@ class DeploymentGroupEditOrCreate extends Component {
); );
return filenames return filenames
.filter(Boolean)
.filter(filename => !find(currentFiles, ['name', filename])) .filter(filename => !find(currentFiles, ['name', filename]))
.map(this.getDefaultFile) .map(this.getDefaultFile)
.concat(currentFiles); .concat(currentFiles);
@ -169,9 +171,9 @@ class DeploymentGroupEditOrCreate extends Component {
return environment; return environment;
} }
const names = manifest const names = forceArray(manifest.match(INTERPOLATE_REGEX)).map(name =>
.match(INTERPOLATE_REGEX) name.replace(/^\$/, '')
.map(name => name.replace(/^\$/, '')); );
const vars = uniq(names).map(name => `\n${name}=`).join(''); const vars = uniq(names).map(name => `\n${name}=`).join('');