mirror of https://github.com/docker/docs.git
Refactored widget display logic.
This commit is contained in:
parent
29c277babe
commit
9e74d6200f
|
@ -35,6 +35,18 @@ var ContainerHome = React.createClass({
|
||||||
shell.openExternal('https://github.com/kitematic/kitematic/issues/new');
|
shell.openExternal('https://github.com/kitematic/kitematic/issues/new');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
showWeb: function () {
|
||||||
|
console.log(_.keys(this.props.ports));
|
||||||
|
return _.keys(this.props.ports).length > 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
showFolders: function () {
|
||||||
|
console.log('SUPETEST');
|
||||||
|
console.log(this.props.container.Volumes);
|
||||||
|
console.log(_.keys(this.props.container.Volumes).length);
|
||||||
|
return this.props.container.Volumes && _.keys(this.props.container.Volumes).length > 0 && this.props.container.State.Running;
|
||||||
|
},
|
||||||
|
|
||||||
render: function () {
|
render: function () {
|
||||||
if (!this.props.container) {
|
if (!this.props.container) {
|
||||||
return;
|
return;
|
||||||
|
@ -88,43 +100,40 @@ var ContainerHome = React.createClass({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.props.defaultPort) {
|
var logWidget = (
|
||||||
body = (
|
|
||||||
<div className="details-panel home">
|
|
||||||
<div className="content">
|
|
||||||
<div className="left">
|
|
||||||
<ContainerHomeLogs container={this.props.container}/>
|
<ContainerHomeLogs container={this.props.container}/>
|
||||||
</div>
|
|
||||||
<div className="right">
|
|
||||||
<ContainerHomePreview ports={this.props.ports} defaultPort={this.props.defaultPort} />
|
|
||||||
<ContainerHomeFolders container={this.props.container} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
} else {
|
var webWidget;
|
||||||
var right;
|
if (this.showWeb()) {
|
||||||
if (_.keys(this.props.ports) > 0) {
|
webWidget = (
|
||||||
right = (
|
|
||||||
<div className="right">
|
|
||||||
<ContainerHomePreview ports={this.props.ports} defaultPort={this.props.defaultPort} />
|
<ContainerHomePreview ports={this.props.ports} defaultPort={this.props.defaultPort} />
|
||||||
<ContainerHomeFolders container={this.props.container} />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
right = (
|
|
||||||
<div className="right">
|
|
||||||
<ContainerHomeFolders container={this.props.container} />
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
var folderWidget;
|
||||||
|
if (this.showFolders()) {
|
||||||
|
folderWidget = (
|
||||||
|
<ContainerHomeFolders container={this.props.container} />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (logWidget && !webWidget && !folderWidget) {
|
||||||
|
body = (
|
||||||
|
<div className="details-panel home">
|
||||||
|
<div className="content">
|
||||||
|
{logWidget}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
body = (
|
body = (
|
||||||
<div className="details-panel home">
|
<div className="details-panel home">
|
||||||
<div className="content">
|
<div className="content">
|
||||||
<div className="left">
|
<div className="left">
|
||||||
<ContainerHomeLogs container={this.props.container}/>
|
{logWidget}
|
||||||
|
</div>
|
||||||
|
<div className="right">
|
||||||
|
{webWidget}
|
||||||
|
{folderWidget}
|
||||||
</div>
|
</div>
|
||||||
{right}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -73,23 +73,21 @@ var ContainerHomeFolder = React.createClass({
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.props.container.Volumes && _.keys(this.props.container.Volumes).length > 0 && this.props.container.State.Running) {
|
|
||||||
return (
|
return (
|
||||||
<div className="folders wrapper">
|
<div className="folders wrapper">
|
||||||
<div className="widget">
|
<div className="widget">
|
||||||
<div className="top-bar">
|
<div className="top-bar">
|
||||||
<div className="text">Edit Files</div>
|
<div className="text">Edit Files</div>
|
||||||
|
<div className="settings" onClick={this.handleClickChangeFolders}>
|
||||||
|
<span className="icon icon-preferences"></span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="folders-list">
|
<div className="folders-list">
|
||||||
{folders}
|
{folders}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="subtext" onClick={this.handleClickChangeFolders}>Change Folders</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -47,18 +47,22 @@ var ContainerHomePreview = React.createClass({
|
||||||
|
|
||||||
render: function () {
|
render: function () {
|
||||||
var preview;
|
var preview;
|
||||||
|
var tempDisp = (
|
||||||
|
<div className="frame-overlay" onClick={this.handleClickPreview}><span className="icon icon-upload-2"></span><div className="text">Open in Browser</div></div>
|
||||||
|
);
|
||||||
if (this.props.defaultPort) {
|
if (this.props.defaultPort) {
|
||||||
var frame = React.createElement('webview', {className: 'frame', id: 'webview', src: this.props.ports[this.props.defaultPort].url, autosize: 'on'});
|
var frame = React.createElement('webview', {className: 'frame', id: 'webview', src: this.props.ports[this.props.defaultPort].url, autosize: 'on'});
|
||||||
preview = (
|
preview = (
|
||||||
<div className="web-preview wrapper">
|
<div className="web-preview wrapper">
|
||||||
<div className="widget">
|
<div className="widget">
|
||||||
<div className="top-bar">
|
<div className="top-bar">
|
||||||
<div className="text">WEB PREVIEW</div>
|
<div className="text">Web Preview</div>
|
||||||
|
<div className="settings" onClick={this.handleClickNotShowingCorrectly}>
|
||||||
|
<span className="icon icon-preferences"></span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{frame}
|
{frame}
|
||||||
<div className="frame-overlay" onClick={this.handleClickPreview}><span className="icon icon-upload-2"></span><div className="text">Open in Browser</div></div>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="subtext" onClick={this.handleClickNotShowingCorrectly}>Not showing correctly?</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -78,6 +82,9 @@ var ContainerHomePreview = React.createClass({
|
||||||
<div className="widget">
|
<div className="widget">
|
||||||
<div className="top-bar">
|
<div className="top-bar">
|
||||||
<div className="text">IP & PORTS</div>
|
<div className="text">IP & PORTS</div>
|
||||||
|
<div className="settings" onClick={this.handleClickNotShowingCorrectly}>
|
||||||
|
<span className="icon icon-preferences"></span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p>You can access this container using the following IP address and port:</p>
|
<p>You can access this container using the following IP address and port:</p>
|
||||||
<div className="table ports">
|
<div className="table ports">
|
||||||
|
|
|
@ -15,21 +15,14 @@
|
||||||
width: 40%;
|
width: 40%;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
.subtext {
|
|
||||||
text-align: right;
|
|
||||||
color: @gray-lighter;
|
|
||||||
margin-top: 2px;
|
|
||||||
transition: all 0.25s;
|
|
||||||
&:hover {
|
|
||||||
color: darken(@gray-lightest, 10%);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.web-preview {
|
.web-preview {
|
||||||
margin-bottom: 50px;
|
margin-bottom: 1rem;
|
||||||
.widget {
|
.widget {
|
||||||
.widget-style();
|
.widget-style();
|
||||||
|
.top-bar {
|
||||||
|
.widget-bar-style();
|
||||||
|
}
|
||||||
background-color: white;
|
background-color: white;
|
||||||
padding: 0.5rem;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
p {
|
p {
|
||||||
|
@ -90,6 +83,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.frame {
|
.frame {
|
||||||
|
padding-top: 8rem;
|
||||||
border: 0;
|
border: 0;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: -100%;
|
left: -100%;
|
||||||
|
@ -132,14 +126,16 @@
|
||||||
.widget-bar-style();
|
.widget-bar-style();
|
||||||
background-color: darken(@gray-darkest, 3%);
|
background-color: darken(@gray-darkest, 3%);
|
||||||
border-bottom: 1px solid rgba(255,255,255,0.1);
|
border-bottom: 1px solid rgba(255,255,255,0.1);
|
||||||
|
.text {
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
height: 100%;
|
height: 100%;
|
||||||
.logs {
|
.logs {
|
||||||
background-color: @gray-darkest;
|
background-color: @gray-darkest;
|
||||||
color: @gray-lightest;
|
color: @gray-lightest;
|
||||||
font-family: @font-code;
|
font-family: @font-code;
|
||||||
font-size: 9px;
|
font-size: 10px;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
-webkit-user-select: text;
|
-webkit-user-select: text;
|
||||||
padding: 1.2rem;
|
padding: 1.2rem;
|
||||||
|
@ -189,6 +185,9 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
border-bottom: 1px solid @color-divider;
|
border-bottom: 1px solid @color-divider;
|
||||||
|
&:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: @color-box-button;
|
background-color: @color-box-button;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,13 +31,30 @@
|
||||||
|
|
||||||
.widget-bar-style() {
|
.widget-bar-style() {
|
||||||
height: 40px;
|
height: 40px;
|
||||||
|
background-color: white;
|
||||||
|
border-bottom: 1px solid @color-divider;
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
position: relative;
|
||||||
|
z-index: 99999;
|
||||||
|
.text {
|
||||||
|
flex: 1 auto;
|
||||||
|
padding: 1.1rem;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
padding: 1.1rem;
|
|
||||||
background-color: white;
|
|
||||||
color: @gray-light;
|
color: @gray-light;
|
||||||
border-bottom: 1px solid @color-divider;
|
}
|
||||||
|
.settings {
|
||||||
|
flex: 0 auto;
|
||||||
|
height: 40px;
|
||||||
|
width: 40px;
|
||||||
|
align-self: flex-end;
|
||||||
|
border-left: 1px solid @color-divider;
|
||||||
|
padding-top: 0.3rem;
|
||||||
|
padding-left: 0.9rem;
|
||||||
|
.box-button();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.fade-in() {
|
.fade-in() {
|
||||||
|
@ -48,7 +65,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.box-button {
|
.box-button {
|
||||||
transition: all 140ms;
|
transition: all 100ms;
|
||||||
color: @gray-light;
|
color: @gray-light;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
|
Loading…
Reference in New Issue