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:
@@ -16,10 +16,9 @@
|
||||
<span></span>
|
||||
</div>
|
||||
<div class="ui-popup-content">
|
||||
<div v-show="submitError" class="ui-submit-tips">{{ submitError }}</div>
|
||||
<form @submit.prevent="add" @focusin="focus">
|
||||
<form @submit.prevent="add">
|
||||
<ul>
|
||||
<li v-ref:base is="project-base" :name.sync="name" :path.sync="path"></li>
|
||||
<li v-ref:base is="project-base" :name.sync="name" :path.sync="path" :unique="unique"></li>
|
||||
<li class="ui-popup-control">
|
||||
<input type="submit" class="ui-button" value="确定"/>
|
||||
<input @click.stop="hidePopup" type="button" class="ui-button ui-button-orange" value="取消"/>
|
||||
|
@@ -19,7 +19,7 @@ module.exports = Vue.component('app-configure', {
|
||||
twoWay: true,
|
||||
required: true
|
||||
},
|
||||
uniqueProjects: {
|
||||
unique: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
@@ -28,49 +28,39 @@ module.exports = Vue.component('app-configure', {
|
||||
return {
|
||||
name: '',
|
||||
path: '',
|
||||
submitError: '',
|
||||
showPopup: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
focus: function (event){
|
||||
if (event.target.type === 'text') {
|
||||
this.submitError = '';
|
||||
}
|
||||
},
|
||||
appConfigure: function (command, configure){
|
||||
ipc.send('app-configure', command, configure);
|
||||
},
|
||||
hidePopup: function (){
|
||||
this.showPopup = false;
|
||||
this.name = '';
|
||||
this.path = '';
|
||||
this.submitError = '';
|
||||
// clean input
|
||||
var base = this.$refs.base;
|
||||
|
||||
// clean error
|
||||
this.$broadcast('reset-error');
|
||||
base.$emit('reset-input');
|
||||
base.$emit('reset-error');
|
||||
},
|
||||
add: function (){
|
||||
this.$broadcast('submit');
|
||||
var base = this.$refs.base;
|
||||
|
||||
if (this.name && this.path) {
|
||||
if (this.uniqueProjects[this.name]) {
|
||||
this.submitError = '项目已存在';
|
||||
} else {
|
||||
this.showPopup = false;
|
||||
this.configure.projects.push({ name: this.name, path: this.path, env: [], command: [] });
|
||||
if (base.isValid()) {
|
||||
this.showPopup = false;
|
||||
|
||||
this.name = '';
|
||||
this.path = '';
|
||||
this.submitError = '';
|
||||
this.configure.projects.push({
|
||||
name: this.name,
|
||||
path: this.path,
|
||||
env: [],
|
||||
command: []
|
||||
});
|
||||
|
||||
// clean error
|
||||
this.$broadcast('reset-error');
|
||||
|
||||
// send message
|
||||
this.$dispatch('change-active', this.configure.projects.length - 1, true);
|
||||
this.$dispatch('save-configure');
|
||||
}
|
||||
// clean input
|
||||
base.$emit('reset-input');
|
||||
// send message
|
||||
this.$dispatch('change-active', this.configure.projects.length - 1, true);
|
||||
this.$dispatch('save-configure');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user