mirror of https://github.com/docker/docs.git
Cleanup and linting.
This commit is contained in:
parent
ecb45f0102
commit
c78549a45f
|
@ -1,84 +0,0 @@
|
|||
var async = require('async');
|
||||
var _ = require('underscore');
|
||||
var $ = require('jquery');
|
||||
var React = require('react/addons');
|
||||
var Router = require('react-router');
|
||||
var Modal = require('react-bootstrap/Modal');
|
||||
var RetinaImage = require('react-retina-image');
|
||||
var ModalTrigger = require('react-bootstrap/ModalTrigger');
|
||||
var ContainerModal = require('./ContainerModal.react');
|
||||
var Header = require('./Header.react');
|
||||
var docker = require('./docker');
|
||||
|
||||
var ContainerListItem = React.createClass({
|
||||
componentWillMount: function () {
|
||||
this._start = Date.now();
|
||||
},
|
||||
handleItemMouseEnter: function () {
|
||||
var $action = $(this.getDOMNode()).find('.action');
|
||||
$action.show();
|
||||
},
|
||||
handleItemMouseLeave: function () {
|
||||
var $action = $(this.getDOMNode()).find('.action');
|
||||
$action.hide();
|
||||
},
|
||||
render: function () {
|
||||
var self = this;
|
||||
var container = this.props.container;
|
||||
var downloadingImage = null, downloading = false;
|
||||
var env = container.Config.Env;
|
||||
if (env.length) {
|
||||
var obj = _.object(env.map(function (e) {
|
||||
return e.split('=');
|
||||
}));
|
||||
if (obj.KITEMATIC_DOWNLOADING) {
|
||||
downloading = true;
|
||||
}
|
||||
downloadingImage = obj.KITEMATIC_DOWNLOADING_IMAGE || null;
|
||||
}
|
||||
|
||||
var imageName = downloadingImage || container.Config.Image;
|
||||
|
||||
// Synchronize all animations
|
||||
var style = {
|
||||
WebkitAnimationDelay: (self._start - Date.now()) + 'ms'
|
||||
};
|
||||
|
||||
var state;
|
||||
if (downloading) {
|
||||
state = <div className="state state-downloading"><div style={style} className="downloading-arrow"></div></div>;
|
||||
} else if (container.State.Running && !container.State.Paused) {
|
||||
state = <div className="state state-running"><div style={style} className="runningwave"></div></div>;
|
||||
} else if (container.State.Restarting) {
|
||||
state = <div className="state state-restarting" style={style}></div>;
|
||||
} else if (container.State.Paused) {
|
||||
state = <div className="state state-paused"></div>;
|
||||
} else if (container.State.ExitCode) {
|
||||
// state = <div className="state state-error"></div>;
|
||||
state = <div className="state state-stopped"></div>;
|
||||
} else {
|
||||
state = <div className="state state-stopped"></div>;
|
||||
}
|
||||
|
||||
return (
|
||||
<Router.Link key={container.Name} data-container={name} to="container" params={{name: container.Name}}>
|
||||
<li onMouseEnter={self.handleItemMouseEnter} onMouseLeave={self.handleItemMouseLeave}>
|
||||
{state}
|
||||
<div className="info">
|
||||
<div className="name">
|
||||
{container.Name}
|
||||
</div>
|
||||
<div className="image">
|
||||
{imageName}
|
||||
</div>
|
||||
</div>
|
||||
<div className="action">
|
||||
<span className="icon icon-delete-3 btn-delete"></span>
|
||||
</div>
|
||||
</li>
|
||||
</Router.Link>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = ContainerListItem;
|
|
@ -1,7 +1,3 @@
|
|||
var child_process = require('child_process');
|
||||
var net = require('net');
|
||||
var os = require('os');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var exec = require('exec');
|
||||
|
||||
|
@ -23,6 +19,16 @@ if (argv.integration) {
|
|||
process.env.TEST_TYPE = 'test';
|
||||
}
|
||||
|
||||
var mainWindow = new BrowserWindow({
|
||||
width: 1000,
|
||||
height: 700,
|
||||
'min-width': 1000,
|
||||
'min-height': 700,
|
||||
resizable: true,
|
||||
frame: false,
|
||||
show: false
|
||||
});
|
||||
|
||||
app.on('activate-with-no-open-windows', function () {
|
||||
if (mainWindow) {
|
||||
mainWindow.show();
|
||||
|
@ -31,23 +37,14 @@ app.on('activate-with-no-open-windows', function () {
|
|||
});
|
||||
|
||||
app.on('ready', function() {
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 1000,
|
||||
height: 700,
|
||||
'min-width': 1000,
|
||||
'min-height': 700,
|
||||
resizable: true,
|
||||
frame: false,
|
||||
show: false
|
||||
});
|
||||
|
||||
if (argv.test) {
|
||||
mainWindow.loadUrl('file://' + __dirname + '/../tests/tests.html');
|
||||
} else {
|
||||
mainWindow.loadUrl('file://' + __dirname + '/../build/index.html');
|
||||
app.on('will-quit', function (e) {
|
||||
app.on('will-quit', function () {
|
||||
if (saveVMOnQuit) {
|
||||
exec('VBoxManage controlvm boot2docker-vm savestate', function (stderr, stdout, code) {});
|
||||
exec('VBoxManage controlvm boot2docker-vm savestate', function () {});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -67,7 +64,7 @@ app.on('ready', function() {
|
|||
if (process.env.NODE_ENV !== 'development' && !argv.test) {
|
||||
autoUpdater.setFeedUrl('https://updates.kitematic.com/releases/latest?version=' + app.getVersion());
|
||||
|
||||
autoUpdater.on('checking-for-update', function (e) {
|
||||
autoUpdater.on('checking-for-update', function () {
|
||||
console.log('Checking for update...');
|
||||
});
|
||||
|
||||
|
@ -76,12 +73,13 @@ app.on('ready', function() {
|
|||
console.log(e);
|
||||
});
|
||||
|
||||
autoUpdater.on('update-not-available', function (e) {
|
||||
autoUpdater.on('update-not-available', function () {
|
||||
console.log('Update not available.');
|
||||
});
|
||||
|
||||
autoUpdater.on('update-downloaded', function (e, releaseNotes, releaseName, releaseDate, updateURL) {
|
||||
console.log('Update downloaded.');
|
||||
console.log(releaseNotes, releaseName, releaseDate, updateURL);
|
||||
mainWindow.webContents.send('notify', 'window:update-available');
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue