Allow user to create new fields for environment names

Currently only one of them is being created.
This commit is contained in:
richard-dds
2018-08-21 15:12:58 -04:00
parent 67700e13ba
commit 020e1b9cb0
4 changed files with 55 additions and 4 deletions

View File

@@ -0,0 +1,46 @@
import textinput from '../text_input'
export default {
name: 'new-project',
components: {
textinput
},
props: {
initialData: {
type: Object,
default: () => ({})
}
},
data: function () {
const {
name,
description,
environments = ['']
} = this.initialData
return {
name,
description,
environments,
}
},
mounted: function () {
this.$root.$on('onEnvironmentAdded', this.addEnvironment)
},
methods: {
addEnvironment: function (event) {
this.environments.push('')
},
removeEnvironment: function (index) {
if (this.environments.length > 1) {
this.environments.splice(index, 1)
}
}
}
}