mirror of
https://github.com/nuintun/command-manager.git
synced 2025-10-20 01:27:47 +08:00
update files
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var ipc = require('ipc-renderer');
|
||||
var Vue = require('../../vue/vue');
|
||||
|
||||
require('../project-base');
|
||||
@@ -16,11 +15,27 @@ module.exports = Vue.component('project-configure', {
|
||||
template: fs.readFileSync(path.join(__dirname, 'project-configure.html')).toString(),
|
||||
props: {
|
||||
project: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
uniqueProjects: {
|
||||
type: Object,
|
||||
twoWay: true,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data: function (){
|
||||
return {
|
||||
nameError: '',
|
||||
pathError: '',
|
||||
submitError: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
projectClone: function (){
|
||||
return JSON.parse(JSON.stringify(this.project));
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
focus: function (event){
|
||||
if (event.target.type === 'text') {
|
||||
@@ -28,9 +43,26 @@ module.exports = Vue.component('project-configure', {
|
||||
}
|
||||
},
|
||||
edit: function (){
|
||||
this.$broadcast('submit');
|
||||
var name = this.projectClone.name;
|
||||
var originName = this.project.name;
|
||||
|
||||
console.log(this.project);
|
||||
if (this.projectClone.name && this.projectClone.path) {
|
||||
if (name !== originName && this.uniqueProjects[name]) {
|
||||
this.submitError = '项目已存在';
|
||||
} else {
|
||||
// clean error
|
||||
this.submitError = '';
|
||||
|
||||
// send message
|
||||
this.$dispatch('edit', this.projectClone);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
events: {
|
||||
'configure-refresh': function (){
|
||||
this.submitError = '';
|
||||
this.$broadcast('clean-error');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@@ -7,15 +7,16 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui-project-configure">
|
||||
<div v-show="submitError" class="ui-submit-tips">{{ submitError }}</div>
|
||||
<ul>
|
||||
<li is="project-base" :name.sync="project.name" :path.sync="project.path"></li>
|
||||
<li is="project-base" :name.sync="projectClone.name" :path.sync="projectClone.path"></li>
|
||||
<li class="ui-sub-item">
|
||||
<label>环境变量:</label>
|
||||
<dynamic-item name-label="变量名" value-label="变量值" :items.sync="project.env"></dynamic-item>
|
||||
<dynamic-item name-label="变量名" value-label="变量值" :items.sync="projectClone.env"></dynamic-item>
|
||||
</li>
|
||||
<li id="add-cmd" class="ui-sub-item">
|
||||
<label>项目命令:</label>
|
||||
<dynamic-item name-label="名称" value-label="命令" :items.sync="project.command"></dynamic-item>
|
||||
<dynamic-item name-label="名称" value-label="命令" :items.sync="projectClone.command"></dynamic-item>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user