diff --git a/static/js/app/index.js b/static/js/app/index.js
index e517b73..1afa2d7 100644
--- a/static/js/app/index.js
+++ b/static/js/app/index.js
@@ -13,43 +13,53 @@ require('../components/app-nav');
require('../components/app-main');
window.addEventListener('DOMContentLoaded', function (){
+ var app;
+
function normalize(configure){
return JSON.parse(JSON.stringify(configure));
}
- var app = new Vue({
- el: '#app',
- data: {
- activeIndex: 0,
- configure: { projects: [] }
- },
- computed: {
- uniqueProjects: function (){
- var cache = {};
-
- this.configure.projects.forEach(function (project){
- cache[project.name] = true;
- });
-
- return cache;
- }
- },
- events: {
- 'change-active': function (index){
- this.activeIndex = index;
+ function init(configure){
+ app = new Vue({
+ el: '#app',
+ data: {
+ activeIndex: 0,
+ configure: configure
},
- 'save-configure': function (){
- ipc.send('app-configure', 'save', normalize(this.configure));
+ computed: {
+ uniqueProjects: function (){
+ var cache = {};
+
+ this.configure.projects.forEach(function (project){
+ cache[project.name] = true;
+ });
+
+ return cache;
+ }
+ },
+ events: {
+ 'change-active': function (index){
+ this.activeIndex = index;
+ },
+ 'save-configure': function (){
+ ipc.send('app-configure', 'save', normalize(this.configure));
+ }
}
- }
- });
+ });
+ }
ipc.on('app-configure', function (event, command, configure){
switch (command) {
case 'refresh':
- app.activeIndex = 0;
- configure.projects = configure.projects || [];
- app.configure = configure;
+ if (app) {
+ app.activeIndex = 0;
+ configure.projects = configure.projects || [];
+ app.configure = configure;
+
+ app.$broadcast('configure-refresh');
+ } else {
+ init(configure);
+ }
break;
}
});
diff --git a/static/js/components/app-main/app-main.html b/static/js/components/app-main/app-main.html
index c3d1479..9b801cb 100644
--- a/static/js/components/app-main/app-main.html
+++ b/static/js/components/app-main/app-main.html
@@ -1,4 +1,4 @@
-