mirror of
https://github.com/nuintun/command-manager.git
synced 2025-07-08 17:37:47 +08:00
update files
This commit is contained in:
parent
e1c9c15fc4
commit
84768cea6b
@ -35,8 +35,10 @@ window.addEventListener('DOMContentLoaded', function (){
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
'change-active': function (index){
|
'change-active': function (index, setting){
|
||||||
this.activeIndex = index;
|
this.activeIndex = index;
|
||||||
|
|
||||||
|
this.$broadcast('setting-toggle', setting);
|
||||||
},
|
},
|
||||||
'save-configure': function (){
|
'save-configure': function (){
|
||||||
ipc.send('app-configure', 'save', util.normalize(this.configure));
|
ipc.send('app-configure', 'save', util.normalize(this.configure));
|
||||||
|
@ -46,10 +46,10 @@ module.exports = Vue.component('app-configure', {
|
|||||||
this.showPopup = !this.showPopup;
|
this.showPopup = !this.showPopup;
|
||||||
|
|
||||||
if (!this.showPopup) {
|
if (!this.showPopup) {
|
||||||
this.name = '';
|
|
||||||
this.path = '';
|
|
||||||
this.submitError = '';
|
this.submitError = '';
|
||||||
this.$broadcast('clean-error');
|
|
||||||
|
// clean imput
|
||||||
|
this.$broadcast('reset-form');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
add: function (){
|
add: function (){
|
||||||
@ -62,13 +62,13 @@ module.exports = Vue.component('app-configure', {
|
|||||||
this.showPopup = false;
|
this.showPopup = false;
|
||||||
this.configure.projects.push({ name: this.name, path: this.path });
|
this.configure.projects.push({ name: this.name, path: this.path });
|
||||||
|
|
||||||
// clean imput
|
|
||||||
this.name = '';
|
|
||||||
this.path = '';
|
|
||||||
this.submitError = '';
|
this.submitError = '';
|
||||||
|
|
||||||
|
// clean imput
|
||||||
|
this.$broadcast('reset-form');
|
||||||
|
|
||||||
// send message
|
// send message
|
||||||
this.$dispatch('change-active', this.configure.projects.length - 1);
|
this.$dispatch('change-active', this.configure.projects.length - 1, true);
|
||||||
this.$dispatch('save-configure');
|
this.$dispatch('save-configure');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
var util = require('../../util');
|
||||||
var Vue = require('../../vue/vue');
|
var Vue = require('../../vue/vue');
|
||||||
|
|
||||||
require('../project-configure');
|
require('../project-configure');
|
||||||
@ -36,7 +37,7 @@ module.exports = Vue.component('app-main', {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
project: function (){
|
project: function (){
|
||||||
var project = JSON.parse(JSON.stringify(this.projects[this.activeIndex]));
|
var project = util.clone(this.projects[this.activeIndex]);
|
||||||
|
|
||||||
if (!project.env) {
|
if (!project.env) {
|
||||||
project.env = [];
|
project.env = [];
|
||||||
@ -65,10 +66,14 @@ module.exports = Vue.component('app-main', {
|
|||||||
remove: function (){
|
remove: function (){
|
||||||
this.projects.splice(this.activeIndex, 1);
|
this.projects.splice(this.activeIndex, 1);
|
||||||
this.activeIndex = 0;
|
this.activeIndex = 0;
|
||||||
|
|
||||||
this.$dispatch('save-configure');
|
this.$dispatch('save-configure');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
|
'setting-toggle': function (flag){
|
||||||
|
this.showSetting = flag;
|
||||||
|
},
|
||||||
edit: function (project){
|
edit: function (project){
|
||||||
this.projects.$set(this.activeIndex, project);
|
this.projects.$set(this.activeIndex, project);
|
||||||
this.$dispatch('save-configure');
|
this.$dispatch('save-configure');
|
||||||
|
@ -91,7 +91,9 @@ module.exports = Vue.component('dynamic-item', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
'clean-error': function (){
|
'reset-form': function (){
|
||||||
|
this.name = '';
|
||||||
|
this.value = '';
|
||||||
this.nameError = '';
|
this.nameError = '';
|
||||||
this.valueError = '';
|
this.valueError = '';
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,9 @@ module.exports = Vue.component('project-base', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
'clean-error': function (){
|
'reset-form': function (){
|
||||||
|
this.name = '';
|
||||||
|
this.path = '';
|
||||||
this.nameError = '';
|
this.nameError = '';
|
||||||
this.pathError = '';
|
this.pathError = '';
|
||||||
},
|
},
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
var util = require('../../util');
|
||||||
var Vue = require('../../vue/vue');
|
var Vue = require('../../vue/vue');
|
||||||
|
|
||||||
require('../project-base');
|
require('../project-base');
|
||||||
@ -33,12 +34,13 @@ module.exports = Vue.component('project-configure', {
|
|||||||
return {
|
return {
|
||||||
nameError: '',
|
nameError: '',
|
||||||
pathError: '',
|
pathError: '',
|
||||||
submitError: ''
|
submitError: '',
|
||||||
|
projectClone: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
watch: {
|
||||||
projectClone: function (){
|
project: function (project){
|
||||||
return JSON.parse(JSON.stringify(this.project));
|
this.projectClone = util.clone(project);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -55,33 +57,32 @@ module.exports = Vue.component('project-configure', {
|
|||||||
if (name !== originName && this.uniqueProjects[name]) {
|
if (name !== originName && this.uniqueProjects[name]) {
|
||||||
this.submitError = '项目已存在';
|
this.submitError = '项目已存在';
|
||||||
} else {
|
} else {
|
||||||
|
this.show = false;
|
||||||
|
|
||||||
// clean error
|
// clean error
|
||||||
this.submitError = '';
|
this.submitError = '';
|
||||||
|
|
||||||
this.show = false;
|
|
||||||
// send message
|
// send message
|
||||||
this.$dispatch('edit', this.projectClone);
|
this.$dispatch('edit', util.clone(this.projectClone));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cancel: function (){
|
cancel: function (){
|
||||||
var origin = JSON.parse(JSON.stringify(this.project));
|
|
||||||
|
|
||||||
this.show = false;
|
this.show = false;
|
||||||
this.project = JSON.parse(JSON.stringify(this.projectClone));
|
this.submitError = '';
|
||||||
|
|
||||||
this.$nextTick(function (){
|
this.$broadcast('reset-form');
|
||||||
this.project = origin;
|
|
||||||
});
|
this.projectClone = util.clone(this.project);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
'configure-refresh': function (){
|
'configure-refresh': function (){
|
||||||
this.submitError = '';
|
this.submitError = '';
|
||||||
this.$broadcast('clean-error');
|
this.$broadcast('reset-form');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created: function (){
|
created: function (){
|
||||||
window.app = this;
|
this.projectClone = util.clone(this.project);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user