diff --git a/index.html b/index.html index 01c9594..5107096 100644 --- a/index.html +++ b/index.html @@ -16,31 +16,7 @@
-
-
-
- - -
-
- -
-
-
-
- +
diff --git a/static/js/app/index.js b/static/js/app/index.js index 5fba6b2..e517b73 100644 --- a/static/js/app/index.js +++ b/static/js/app/index.js @@ -10,10 +10,7 @@ var Vue = require('../vue/vue'); require('../components/app-configure'); require('../components/window-control'); require('../components/app-nav'); -require('../components/directory'); -require('../components/project-base'); -require('../components/dynamic-item'); -require('../components/project-configure'); +require('../components/app-main'); window.addEventListener('DOMContentLoaded', function (){ function normalize(configure){ diff --git a/static/js/components/app-configure/index.js b/static/js/components/app-configure/index.js index f24728f..c9d51f4 100644 --- a/static/js/components/app-configure/index.js +++ b/static/js/components/app-configure/index.js @@ -9,6 +9,8 @@ var path = require('path'); var ipc = require('ipc-renderer'); var Vue = require('../../vue/vue'); +require('../project-base'); + module.exports = Vue.component('app-configure', { template: fs.readFileSync(path.join(__dirname, 'app-configure.html')).toString(), props: { diff --git a/static/js/components/app-main/app-main.html b/static/js/components/app-main/app-main.html index 11b399e..c3d1479 100644 --- a/static/js/components/app-main/app-main.html +++ b/static/js/components/app-main/app-main.html @@ -1,4 +1,4 @@ - +
diff --git a/static/js/components/app-main/index.js b/static/js/components/app-main/index.js index 16550f9..6394e53 100644 --- a/static/js/components/app-main/index.js +++ b/static/js/components/app-main/index.js @@ -1,3 +1,51 @@ /** * Created by nuintun on 2015/11/20. */ + + +var fs = require('fs'); +var path = require('path'); +var ipc = require('ipc-renderer'); +var Vue = require('../../vue/vue'); + +require('../project-configure'); + +module.exports = Vue.component('app-main', { + template: fs.readFileSync(path.join(__dirname, 'app-main.html')).toString(), + props: { + activeIndex: { + type: Number, + required: true + }, + projects: { + type: Array, + twoWay: true, + required: true + }, + uniqueProjects: { + type: Object, + twoWay: true, + required: true + } + }, + computed: { + project: function (){ + var project = this.projects[this.activeIndex] || { + name: '', + path: '', + env: [], + command: [] + }; + + if (!project.env) { + project.env = []; + } + + if (!project.command) { + project.command = []; + } + + return project; + } + } +}); diff --git a/static/js/components/project-base/index.js b/static/js/components/project-base/index.js index 63df44d..05f9bf3 100644 --- a/static/js/components/project-base/index.js +++ b/static/js/components/project-base/index.js @@ -8,6 +8,8 @@ var fs = require('fs'); var path = require('path'); var Vue = require('../../vue/vue'); +require('../directory'); + module.exports = Vue.component('project-base', { template: fs.readFileSync(path.join(__dirname, 'project-base.html')).toString(), props: { diff --git a/static/js/components/project-configure/index.js b/static/js/components/project-configure/index.js index 2f786b3..7a77c89 100644 --- a/static/js/components/project-configure/index.js +++ b/static/js/components/project-configure/index.js @@ -9,27 +9,16 @@ var path = require('path'); var ipc = require('ipc-renderer'); var Vue = require('../../vue/vue'); +require('../project-base'); +require('../dynamic-item'); + module.exports = Vue.component('project-configure', { template: fs.readFileSync(path.join(__dirname, 'project-configure.html')).toString(), props: { - activeIndex: { - type: Number, - required: true - }, - projects: { + project: { type: Object, twoWay: true, required: true - }, - uniqueProjects: { - type: Object, - twoWay: true, - required: true - } - }, - computed: { - project: function (){ - return this.projects[this.activeIndex] || { name: '', path: '', env: [], command: [] }; } }, methods: { diff --git a/static/js/components/project-configure/project-configure.html b/static/js/components/project-configure/project-configure.html index c9f7629..86ada45 100644 --- a/static/js/components/project-configure/project-configure.html +++ b/static/js/components/project-configure/project-configure.html @@ -1,5 +1,5 @@
-
+