update files

This commit is contained in:
nuintun 2015-11-23 22:53:56 +08:00
parent 463b8998e5
commit 26eec2faf6
3 changed files with 22 additions and 24 deletions

View File

@ -62,26 +62,34 @@ function verifyConfigure(configure){
return false;
}
if (!project.path || typeof project.path !== 'string') {
return false;
}
if (Array.isArray(project.env)) {
if (
!project.env.every(function (env){
return env.name && typeof env.name === 'string'
&& env.value && typeof env.value === 'string';
})
) {
var envValid = project.env.every(function (env){
return env.name && typeof env.name === 'string'
&& env.value && typeof env.value === 'string';
});
if (!envValid) {
return false;
}
} else {
return false
}
if (Array.isArray(project.command)) {
if (
!project.command.every(function (command){
return command.name && typeof command.name === 'string'
&& command.value && typeof command.value === 'string';
})
) {
var commandValid = project.command.every(function (command){
return command.name && typeof command.name === 'string'
&& command.value && typeof command.value === 'string';
});
if (commandValid) {
return false;
}
} else {
return false;
}
return true;

View File

@ -60,7 +60,7 @@ module.exports = Vue.component('app-configure', {
this.submitError = '项目已存在';
} else {
this.showPopup = false;
this.configure.projects.push({ name: this.name, path: this.path });
this.configure.projects.push({ name: this.name, path: this.path, env: [], command: [] });
this.submitError = '';

View File

@ -37,17 +37,7 @@ module.exports = Vue.component('app-main', {
},
computed: {
project: function (){
var project = util.clone(this.projects[this.activeIndex]);
if (!project.env) {
project.env = [];
}
if (!project.command) {
project.command = [];
}
return project;
return util.clone(this.projects[this.activeIndex]);
},
command: function (){
return this.project.command.slice(0, 3);