fixing minor UI bugs

This commit is contained in:
Jeff Morgan 2014-12-01 22:12:04 -05:00
parent 668ffa4bc8
commit 56b3ada8a8
13 changed files with 50 additions and 37 deletions

View File

@ -135,6 +135,7 @@ app.on('ready', function() {
process.on('uncaughtException', app.quit); process.on('uncaughtException', app.quit);
var saveVMOnQuit = true;
app.on('will-quit', function (e) { app.on('will-quit', function (e) {
console.log('Cleaning up children.'); console.log('Cleaning up children.');
if (nodeChild) { if (nodeChild) {
@ -143,7 +144,9 @@ app.on('ready', function() {
if (mongoChild) { if (mongoChild) {
mongoChild.kill(); mongoChild.kill();
} }
if (saveVMOnQuit) {
exec('VBoxManage controlvm boot2docker-vm savestate', function (stderr, stdout, code) {}); exec('VBoxManage controlvm boot2docker-vm savestate', function (stderr, stdout, code) {});
}
}); });
mainWindow.webContents.on('new-window', function (e) { mainWindow.webContents.on('new-window', function (e) {
@ -178,6 +181,7 @@ app.on('ready', function() {
ipc.on('command', function (event, arg) { ipc.on('command', function (event, arg) {
console.log('Command: ' + arg); console.log('Command: ' + arg);
if (arg === 'application:quit-install') { if (arg === 'application:quit-install') {
saveVMOnQuit = false;
autoUpdater.quitAndInstall(); autoUpdater.quitAndInstall();
} }
}); });

View File

@ -118,6 +118,9 @@ Docker.runContainer = function (app, image, callback) {
var binds = []; var binds = [];
if (app.volumesEnabled && image.docker.Config.Volumes && image.docker.Config.Volumes.length > 0) { if (app.volumesEnabled && image.docker.Config.Volumes && image.docker.Config.Volumes.length > 0) {
_.each(image.docker.Config.Volumes, function (vol) { _.each(image.docker.Config.Volumes, function (vol) {
if (vol.Path && vol.Path.length && vol.Path[0] === '/') {
vol.Path = vol.Path.substr(1);
}
binds.push([Util.getHomePath(), 'Kitematic', app.name, vol.Path].join('/') + ':' + vol.Path); binds.push([Util.getHomePath(), 'Kitematic', app.name, vol.Path].join('/') + ':' + vol.Path);
}); });
} }

View File

@ -51,7 +51,11 @@ Router.map(function () {
} }
startUpdatingBoot2DockerUtilization(); startUpdatingBoot2DockerUtilization();
startSyncingAppState(); startSyncingAppState();
if (Apps.findOne()) {
Router.go('dashboard_apps'); Router.go('dashboard_apps');
} else {
Router.go('dashboard_images');
}
} }
}); });
} }

View File

@ -60,9 +60,9 @@
{{#if $eq status 'STOPPED'}} {{#if $eq status 'STOPPED'}}
<a href="#" onclick="trackLink('start container')" class="btn-icon btn-start" data-toggle="tooltip" data-placement="bottom" title="Start"><span class="typcn typcn-media-play-outline"></span></a> <a href="#" onclick="trackLink('start container')" class="btn-icon btn-start" data-toggle="tooltip" data-placement="bottom" title="Start"><span class="typcn typcn-media-play-outline"></span></a>
{{/if}} {{/if}}
{{#if $eq status 'READY'}} {{#unless changingState}}
<a href="#" onclick="trackLink('restart container')" class="btn-icon btn-restart" data-toggle="tooltip" data-placement="bottom" title="Restart"><span class="typcn typcn-refresh-outline"></span></a> <a href="#" onclick="trackLink('restart container')" class="btn-icon btn-restart" data-toggle="tooltip" data-placement="bottom" title="Restart"><span class="typcn typcn-refresh-outline"></span></a>
{{/if}} {{/unless}}
<a href="/apps/{{name}}/logs" onclick="trackLink('container logs')" class="btn-icon btn-logs" data-toggle="tooltip" data-placement="bottom" title="Logs"><span class="typcn typcn-document-text"></span></a> <a href="/apps/{{name}}/logs" onclick="trackLink('container logs')" class="btn-icon btn-logs" data-toggle="tooltip" data-placement="bottom" title="Logs"><span class="typcn typcn-document-text"></span></a>
<a href="/apps/{{name}}/settings" onclick="trackLink('container settings')" class="btn-icon" data-toggle="tooltip" data-placement="bottom" title="Settings"><span class="typcn typcn-cog-outline"></span></a> <a href="/apps/{{name}}/settings" onclick="trackLink('container settings')" class="btn-icon" data-toggle="tooltip" data-placement="bottom" title="Settings"><span class="typcn typcn-cog-outline"></span></a>
</div> </div>

View File

@ -16,6 +16,9 @@ Template.dashboardSingleApp.helpers({
return ports[0]; return ports[0];
} }
return null; return null;
},
changingState: function () {
return this.status === 'STARTING' || this.status === 'STOPPING';
} }
}); });
@ -49,10 +52,12 @@ Template.dashboardSingleApp.events({
}, },
'click .btn-restart': function (e) { 'click .btn-restart': function (e) {
e.preventDefault(); e.preventDefault();
$('.btn-icon').tooltip('hide');
AppUtil.run(this, function (err) {}); AppUtil.run(this, function (err) {});
}, },
'click .btn-folder': function (e) { 'click .btn-folder': function (e) {
e.preventDefault(); e.preventDefault();
$('.btn-icon').tooltip('hide');
var app = this; var app = this;
if (!app) { if (!app) {
throw new Error('Cannot find app with id: ' + app._id); throw new Error('Cannot find app with id: ' + app._id);
@ -61,13 +66,14 @@ Template.dashboardSingleApp.events({
var openDirectory = function () { var openDirectory = function () {
var appPath = path.join(Util.KITE_PATH, app.name); var appPath = path.join(Util.KITE_PATH, app.name);
if (app.docker.Volumes.length) { if (app.docker.Volumes.length) {
if (app.docker.Volumes[0].Value.indexOf(path.join(Util.getHomePath(), 'Kitematic')) !== -1) { if (_.find(app.docker.Volumes, function (volume) { return volume.Value.indexOf(path.join(Util.getHomePath(), 'Kitematic')) !== -1; })) {
exec(['open', appPath], function (stderr, stdout, code) { exec(['open', appPath], function (stderr, stdout, code) {
if (code) { throw stderr; } if (code) { throw stderr; }
}); });
return; return;
} else { } else {
exec(['open', app.docker.Volumes[0].Value], function (stderr, stdout, code) { var volume = _.find(app.docker.Volumes, function (volume) { return volume.Value.indexOf(Util.getHomePath()) !== -1; })
exec(['open', volume.Value], function (stderr, stdout, code) {
if (code) { throw stderr; } if (code) { throw stderr; }
}); });
return; return;
@ -101,5 +107,6 @@ Template.dashboardSingleApp.events({
}, },
'click .btn-logs': function (e) { 'click .btn-logs': function (e) {
AppUtil.logs(this._id); AppUtil.logs(this._id);
$('.btn-icon').tooltip('hide');
} }
}); });

View File

@ -59,7 +59,7 @@
<p class="help-block">You can change the folder of which your image will be built from.</p> <p class="help-block">You can change the folder of which your image will be built from.</p>
</div> </div>
<div class="right-section"> <div class="right-section">
<h5><strong>{{this.originPath}}</strong></h5> <h5><strong>{{this.path}}</strong></h5>
<h6 id="picked-directory-error" class="error"></h6> <h6 id="picked-directory-error" class="error"></h6>
<a onclick="trackLink('change build directory')" href="#" id="btn-pick-directory" class="btn btn-positive btn-sm"><span class="typcn typcn-folder-open"></span> Change Directory</a> <a onclick="trackLink('change build directory')" href="#" id="btn-pick-directory" class="btn btn-positive btn-sm"><span class="typcn typcn-folder-open"></span> Change Directory</a>
</div> </div>

View File

@ -35,7 +35,7 @@ Template.dashboardImagesSettings.events({
} else { } else {
Images.update(imageId, { Images.update(imageId, {
$set: { $set: {
originPath: directory path: directory
} }
}); });
} }

View File

@ -31,11 +31,11 @@
<a onclick="trackLink('create container from image')" href="#" class="btn-icon btn-create-app" data-toggle="tooltip" data-placement="bottom" title="Create Container"><span class="typcn typcn-plus-outline"></span></a> <a onclick="trackLink('create container from image')" href="#" class="btn-icon btn-create-app" data-toggle="tooltip" data-placement="bottom" title="Create Container"><span class="typcn typcn-plus-outline"></span></a>
{{/if}} {{/if}}
{{/if}} {{/if}}
{{#if originPath}} {{#if path}}
<a onclick="trackLink('open image folder')" href="#" class="btn-icon btn-folder" target="_blank" data-toggle="tooltip" data-placement="bottom" title="Folder"><span class="typcn typcn-folder-open"></span></a> <a onclick="trackLink('open image folder')" href="#" class="btn-icon btn-folder" target="_blank" data-toggle="tooltip" data-placement="bottom" title="Folder"><span class="typcn typcn-folder-open"></span></a>
{{/if}} {{/if}}
{{#if $neq status 'BUILDING'}} {{#if $neq status 'BUILDING'}}
{{#if $or path originPath}} {{#if path}}
<a onclick="trackLink('rebuild image')" href="#" class="btn-icon btn-rebuild" target="_blank" data-toggle="tooltip" data-placement="bottom" title="Rebuild"><span class="typcn typcn-refresh-outline"></span></a> <a onclick="trackLink('rebuild image')" href="#" class="btn-icon btn-rebuild" target="_blank" data-toggle="tooltip" data-placement="bottom" title="Rebuild"><span class="typcn typcn-refresh-outline"></span></a>
{{/if}} {{/if}}
{{/if}} {{/if}}

View File

@ -13,7 +13,7 @@ Template.dashboardSingleImage.events({
$('#image-picker').hide(); $('#image-picker').hide();
}, },
'click .btn-folder': function () { 'click .btn-folder': function () {
exec(['open', this.originPath], function (err) { exec(['open', this.path], function (err) {
if (err) { throw err; } if (err) { throw err; }
}); });
}, },

View File

@ -16,11 +16,11 @@
<a onclick="trackLink('create container from image')" href="#" class="btn-create-app" data-toggle="tooltip" data-placement="bottom" title="Create Container" data-container="body"><span class="typcn typcn-plus-outline"></span></a> <a onclick="trackLink('create container from image')" href="#" class="btn-create-app" data-toggle="tooltip" data-placement="bottom" title="Create Container" data-container="body"><span class="typcn typcn-plus-outline"></span></a>
{{/if}} {{/if}}
{{/if}} {{/if}}
{{#if originPath}} {{#if path}}
<a onclick="trackLink('open image folder')" href="#" class="btn-folder" data-toggle="tooltip" data-placement="bottom" title="Folder" data-container="body"><span class="typcn typcn-folder-open"></span></a> <a onclick="trackLink('open image folder')" href="#" class="btn-folder" data-toggle="tooltip" data-placement="bottom" title="Folder" data-container="body"><span class="typcn typcn-folder-open"></span></a>
{{/if}} {{/if}}
{{#if $neq status 'BUILDING'}} {{#if $neq status 'BUILDING'}}
{{#if originPath}} {{#if path}}
<a onclick="trackLink('rebuild image')" href="#" class="btn-rebuild" data-toggle="tooltip" data-placement="bottom" title="Rebuild" data-container="body"><span class="typcn typcn-refresh-outline"></span></a> <a onclick="trackLink('rebuild image')" href="#" class="btn-rebuild" data-toggle="tooltip" data-placement="bottom" title="Rebuild" data-container="body"><span class="typcn typcn-refresh-outline"></span></a>
{{/if}} {{/if}}
{{/if}} {{/if}}

View File

@ -12,7 +12,7 @@ Template.dashboardImagesLayout.events({
}, },
'click .btn-folder': function () { 'click .btn-folder': function () {
var exec = require('exec'); var exec = require('exec');
exec(['open', this.originPath], function (err) { exec(['open', this.path], function (err) {
if (err) { throw err; } if (err) { throw err; }
}); });
}, },

View File

@ -13,10 +13,6 @@
{{/if}} {{/if}}
</div> </div>
<div class="right-section"> <div class="right-section">
{{#if $.Session.equals 'boot2dockerState' 'poweroff'}}
<a onclick="trackLink('start boot2docker')" class="btn btn-default btn-start-boot2docker">Start Boot2Docker VM</a>
{{else}}
<a onclick="trackLink('stop boot2docker')" class="btn btn-negative btn-stop-boot2docker">Stop Boot2Docker VM</a>
{{#if disk}} {{#if disk}}
<div class="utilization disk-utilization"> <div class="utilization disk-utilization">
<div><strong>Disk Utilization</strong><span class="pull-right">{{disk.used_gb}}GB used of {{disk.total_gb}}GB</span></div> <div><strong>Disk Utilization</strong><span class="pull-right">{{disk.used_gb}}GB used of {{disk.total_gb}}GB</span></div>
@ -37,7 +33,6 @@
</div> </div>
</div> </div>
{{/if}} {{/if}}
{{/if}}
</div> </div>
</div> </div>
<div class="section dashboard-settings"> <div class="section dashboard-settings">

View File

@ -1,5 +1,5 @@
<template name="updateNotification"> <template name="updateNotification">
{{#if updateAvailable}} {{#if updateAvailable}}
<div class="update-alert" role="alert"><span class="update-text">A new version of Kitematic is available.</span> <a href="#" class="btn btn-action-inverse btn-inverse btn-xs btn-update">Restart to Update</a></div> <div class="update-alert" role="alert"><span class="update-text">A new version of Kitematic is available.</span> <a href="#" class="btn btn-action-inverse btn-inverse btn-xs btn-update">Update Now</a></div>
{{/if}} {{/if}}
</template> </template>