1
0
mirror of https://github.com/docker/docs.git synced 2026-11-06 12:54:24 +03:00
Files
docs/src/ContainerHome.react.js
Dominik Deren 046e640eeb - Working on changes required to setup client on windows.
- For now changes in SetupStore are made, to skip steps that do MacOS setup.
- Adding deps.ps1 script for installing all required dependencies on windows.
- Adding reset.ps1 script for removing all dependencies on windows.
- Modifying files to work with windows dependencies
- Fix for duplicate react instances in the code.
- A fix required to load only one instance of React in the application. Without such fix, on windows application loads two instances of React at start time, and crashes.
- Modifying files to support windows paths
- Modifying deps and reset powershell scripts to loose chocolatey dependency. Adding windows VirtualBox installation steps.
- Improved a workaround for adding Users directory to the shared folder in the VM on windows. Added few more fixes for Windows/Mac compatibility.
- Removing unnecessary log from deps.ps1 script,
- Updating Gulpfile to download and copy all the dependencies on application start,
- Cleaning pre and post install scripts from package.json, as they are not realy friendly for different platforms.
- Removing changes from browser.js as they were not necessary or even breaking.
- Cleaning pre and post install scripts from package.json, as they are not really friendly for different platforms.
- Fixing changes in package.json.
- Fixed reset.ps1 file to delete all folders created by the app,
- Fixed metrics.js file to properly use userAgent depending on the OS.
- Uncommented updateBinaries line in SetupStore.
- Adding open as a dependency.
- Fixing the setupStore tests.
- Adding proper directory to PATH for docker and docker-machine binaries.
- Adding support for the docker terminal command. It opens a CMD on windows and sets required env variables for the docker to work. Docker and Docker-Machine should be on the path, as they are set up there on Kitematic startup.
- Added Resources module which provides paths to all files stored in the resources directory,
- Added docker and docker-machine binary paths to Util module, to have a single place for calling those paths,
- Added binaries directory path, to Util module, to have a single place for calling this path,
- Added another exec command, which utilizes "child_process" module, and it's "exec" command, as the "exec" used right now is deprecated,
- Refactored the Installation step in the SetupStore, and connected with that SetupUtil commands to perform copying binaries from node instead of bash commands. That way application is more cross-platform friendly,
- Added new dependencies in form of fs-extra, fs-promise and any-promise, to allow yielding of fs commands in SetupUtil.
- The setup process now works correctly on windows from the beginning to end.
- Fixing broken tests.
- Improving tests.
- Adding elevated permissions to the reset script, as it is required to kill processes and remove VirtualBox.
- Added ability to run reset scripts through gulp,
- Added new npm script for resetting the environment "npm run reset".
- Refactored docker-machine module, to use Resources module for finding the machine command and general code cleaning,
- Added windows keyboard shortcut support.
- Adding the use of Resources module, instead of direct access of files in the resources dir.
- Testing appveyor.
- Testing appveyor + io.js.
- Back to node 0.10.
- Fixing permission issues with appveyor.
- Testing travis.

Signed-off-by: Dominik Deren <dominik.deren@live.com>

- Working on changes required to setup client on windows.
- For now changes in SetupStore are made, to skip steps that do MacOS setup.

- Adding deps.ps1 script for installing all required dependencies on windows.
- Adding reset.ps1 script for removing all dependencies on windows.

Fix for duplicate react instances in the code.

Modifying files to support windows paths

- Removing unnecessary log from deps.ps1 script,
- Updating Gulpfile to download and copy all the dependencies on application start,
- Cleaning pre and post install scripts from package.json, as they are not realy friendly for different platforms.
- Removing changes from browser.js as they were not necessary or even breaking.

- Fixing changes in package.json.

- Uncommented updateBinaries line in SetupStore.

- Adding open as a dependency.

- Adding proper directory to PATH for docker and docker-machine binaries.

- Fixing broken tests.

- Improving tests.

- Adding elevated permissions to the reset script, as it is required to kill processes and remove VirtualBox.

- Added ability to run reset scripts through gulp,
- Added new npm script for resetting the environment "npm run reset".

- Refactored docker-machine module, to use Resources module for finding the machine command and general code cleaning,
- Added windows keyboard shortcut support.

- Adding the use of Resources module, instead of direct access of files in the resources dir.

- Testing appveyor + io.js.

- Back to node 0.10.

- Fixing permission issues with appveyor.

Signed-off-by: Dominik Deren <dominik.deren@live.com>
2015-03-31 16:20:35 +01:00

152 lines
4.8 KiB
JavaScript

var _ = require('underscore');
var $ = require('jquery');
var React = require('react/addons');
var ContainerStore = require('./ContainerStore');
var Router = require('react-router');
var Radial = require('./Radial.react');
var ContainerHomePreview = require('./ContainerHomePreview.react');
var ContainerHomeLogs = require('./ContainerHomeLogs.react');
var ContainerHomeFolders = require('./ContainerHomeFolders.react');
var ContainerUtil = require('./ContainerUtil');
var util = require('./Util');
var resizeWindow = function () {
$('.left .wrapper').height(window.innerHeight - 240);
$('.right .wrapper').height(window.innerHeight / 2 - 100);
};
var ContainerHome = React.createClass({
mixins: [Router.State, Router.Navigation],
getInitialState: function () {
return {
ports: {},
defaultPort: null,
progress: 0
};
},
handleResize: function () {
resizeWindow();
},
handleErrorClick: function () {
util.openPathOrUrl('https://github.com/kitematic/kitematic/issues/new');
},
componentWillReceiveProps: function () {
this.init();
},
componentDidMount: function() {
this.init();
ContainerStore.on(ContainerStore.SERVER_PROGRESS_EVENT, this.updateProgress);
resizeWindow();
window.addEventListener('resize', this.handleResize);
},
componentWillUnmount: function() {
ContainerStore.removeListener(ContainerStore.SERVER_PROGRESS_EVENT, this.updateProgress);
window.removeEventListener('resize', this.handleResize);
},
componentDidUpdate: function () {
resizeWindow();
},
init: function () {
var container = ContainerStore.container(this.getParams().name);
if (!container) {
return;
}
var ports = ContainerUtil.ports(container);
this.setState({
ports: ports,
defaultPort: _.find(_.keys(ports), function (port) {
return util.webPorts.indexOf(port) !== -1;
}),
progress: ContainerStore.progress(this.getParams().name),
blocked: ContainerStore.blocked(this.getParams().name)
});
},
updateProgress: function (name) {
if (name === this.getParams().name) {
this.setState({
blocked: ContainerStore.blocked(name),
progress: ContainerStore.progress(name)
});
}
},
render: function () {
var body;
if (this.props.error) {
body = (
<div className="details-progress">
<h3>There was a problem connecting to the Docker Engine in the VirtualBox VM.<br/>This could be caused because this Mac is currently connected to a VPN, blocking access to the VM. If the issue persists, please <a onClick={this.handleErrorClick}>file a ticket on our GitHub repo.</a></h3>
<Radial progress={100} error={true} thick={true} transparent={true}/>
</div>
);
} else if (this.props.container && this.props.container.State.Downloading) {
if (this.state.progress) {
body = (
<div className="details-progress">
<h2>Downloading Image</h2>
<Radial progress={Math.min(Math.round(this.state.progress * 100), 99)} thick={true} gray={true}/>
</div>
);
} else if (this.state.blocked) {
body = (
<div className="details-progress">
<h2>Waiting For Another Download</h2>
<Radial spin="true" progress="90" thick={true} transparent={true}/>
</div>
);
} else {
body = (
<div className="details-progress">
<h2>Connecting to Docker Hub</h2>
<Radial spin="true" progress="90" thick={true} transparent={true}/>
</div>
);
}
} else {
if (this.state.defaultPort) {
body = (
<div className="details-panel home">
<div className="content">
<div className="left">
<ContainerHomePreview />
</div>
<div className="right">
<ContainerHomeLogs/>
<ContainerHomeFolders container={this.props.container} />
</div>
</div>
</div>
);
} else {
var right;
if (_.keys(this.state.ports) > 0) {
right = (
<div className="right">
<ContainerHomePreview />
<ContainerHomeFolders container={this.props.container} />
</div>
);
} else {
right = (
<div className="right">
<ContainerHomeFolders container={this.props.container} />
</div>
);
}
body = (
<div className="details-panel home">
<div className="content">
<div className="left">
<ContainerHomeLogs/>
</div>
{right}
</div>
</div>
);
}
}
return body;
}
});
module.exports = ContainerHome;