Auto-update UI and fixed menu.

This commit is contained in:
Sean Li 2015-02-16 15:40:48 -08:00
Родитель a4669e2240
Коммит 7390b83cc3
4 изменённых файлов: 44 добавлений и 6 удалений

Просмотреть файл

@ -78,6 +78,7 @@ var Containers = React.createClass({
this.transitionTo('new');
},
handleAutoUpdateClick: function () {
console.log('CLICKED UPDATE');
ipc.send('command', 'application:quit-install');
},
render: function () {
@ -85,7 +86,16 @@ var Containers = React.createClass({
if (this.state.sidebarOffset) {
sidebarHeaderClass += ' sep';
}
var updateNotification;
var updatePadding;
if (this.state.updateAvailable) {
updateNotification = (
<div className="update-notification"><span className="text">Update Available</span><a className="btn btn-action small" onClick={this.handleAutoUpdateClick}>Update Now</a></div>
);
updatePadding = (
<div className="update-padding"></div>
);
}
var container = this.getParams().name ? this.state.containers[this.getParams().name] : {};
return (
<div className="containers">
@ -100,6 +110,8 @@ var Containers = React.createClass({
</section>
<section className="sidebar-containers" onScroll={this.handleScroll}>
<ContainerList containers={this.state.sorted} newContainer={this.state.newContainer} />
{updatePadding}
{updateNotification}
</section>
</div>
<Router.RouteHandler container={container}/>

Просмотреть файл

@ -9,6 +9,8 @@ var router = require('./router');
var boot2docker = require('./boot2docker');
var ContainerStore = require('./ContainerStore');
var SetupStore = require('./SetupStore');
var MenuTemplate = require('./MenuTemplate');
var Menu = remote.require('menu');
var settingsjson;
try {
@ -32,6 +34,9 @@ bugsnag.releaseStage = process.env.NODE_ENV === 'development' ? 'development' :
bugsnag.notifyReleaseStages = ['production'];
bugsnag.appVersion = app.getVersion();
var menu = Menu.buildFromTemplate(MenuTemplate);
Menu.setApplicationMenu(menu);
router.run(Handler => React.render(<Handler/>, document.body));
SetupStore.run().then(boot2docker.ip).then(ip => {
console.log(ip);

Просмотреть файл

@ -2,13 +2,12 @@ var remote = require('remote');
var app = remote.require('app');
var path = require('path');
var docker = require('./Docker');
var Menu = remote.require('menu');
var BrowserWindow = remote.require('browser-window');
var router = require('./Router');
var util = require('./Util');
// main.js
var template = [
var MenuTemplate = [
{
label: 'Kitematic',
submenu: [
@ -160,7 +159,5 @@ var template = [
},
];
var menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);
module.exports = menu;
module.exports = MenuTemplate;

Просмотреть файл

@ -61,6 +61,30 @@ html, body {
border: 1px solid #ddd;
}
.update-notification {
background-color: white;
opacity: 0.9;
position: fixed;
bottom: 0;
width: 259px;
padding: 10px;
//border-top: 1px solid darken(#FCF8E3, 5%);
color: @gray-normal;
font-size: 12px;
.text {
position: relative;
top: 3px;
}
.btn {
position: relative;
float: right;
}
}
.update-padding {
position: relative;
height: 40px;
}
@-webkit-keyframes spin {
from {