From c3abcdec6d9b3df7993fa7830c5ac10a44fd6375 Mon Sep 17 00:00:00 2001 From: TeckniX Date: Fri, 24 Apr 2015 13:41:35 -0400 Subject: [PATCH 1/3] Added support for container stop --- images/button-stop.png | Bin 0 -> 3188 bytes images/button-stop@2x.png | Bin 0 -> 3323 bytes .../ContainerDetailsHeader.react.js | 2 +- .../ContainerDetailsSubheader.react.js | 29 ++++++++++++++++++ src/stores/ContainerStore.js | 13 ++++++++ 5 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 images/button-stop.png create mode 100644 images/button-stop@2x.png diff --git a/images/button-stop.png b/images/button-stop.png new file mode 100644 index 0000000000000000000000000000000000000000..14f88011b8f6647683e15bab912d0bb6dc595f0b GIT binary patch literal 3188 zcmaJ^c|4SB8=gX;WLHSW*s_dSFfvTGu^U;YB8p+gK1(wryHm1dJ(MJS)+3~>;SkCe zvNKXCq(T$Q7Wqb}I^Q2(-~0Q$@AEwO@4l}4x}W>{=e=fSY0Sed#ti@fcuY;uHmp@~ z_vPHj`aWsva$qf@bVED3E!mCkhocezdU&!60cc9Zxf5&%IDEjxE`l}yz$W8~wWHf% zERe2bq6%&|N5!8=VW9y4Z5@9K&efYh2f7g4JxM4Kv!NLT^u(h;XVo!K48?%p;b{^` zCD;a9VqF8hT{ZC_os&Rqe3mP?u`QdBgzhA z1vDU22|#rfDA*N>fB_L|Dlj#urkbWQ5DtYwAuu=ussV;Uk?I;qC=B@H0kNu4@oq>P zw9$`RtP=|4L8nuY5Qv|jpNgNV3YqE-foW=LLZEO691dn>fN23FI?f+VqDlW`Koe-L zR8I=slS~5cGU8mwzH}6brSzW`h?HNnB-)Q_VqF--A4h?}RG_;p{Y=DQ{(mZw_$!-6 zw;}wi_kR-8umKbT#D+j4`%+z5gL9MKEk!{ZPzg9XnTjQoeSY4el?Rzlrg@MlKm%KK z6&MhMbM++cM!q937^EqQM#qs{38rWih{d7e>4`@|jntrOFaww&+yD)O8LFKyf*Kj= z8>ks+Xc+42Ayj{2(P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R z>uUNk4sV|0J@W;aL>2-2COy4N z`sg|9(%I(h?&;9mGJwa4lPz<_wknf5w7f4EsMqC|5uR`0H?SI9OU{mTTQ(!lPd`iX z&^{6+1MgbJss~g{MSG1u@*F-&@PLO82KSUDZ`}BJ_Id|SZSJz911K;T0I2v)TkruN pljd^OyW5>P5;3Z&h~;L0D1g~MoEK-ge?<5@g12_CD#Lo8_zzFOt=9km literal 0 HcmV?d00001 diff --git a/src/components/ContainerDetailsHeader.react.js b/src/components/ContainerDetailsHeader.react.js index ded2816d..016bb012 100644 --- a/src/components/ContainerDetailsHeader.react.js +++ b/src/components/ContainerDetailsHeader.react.js @@ -6,7 +6,7 @@ var ContainerDetailsHeader = React.createClass({ if (!this.props.container) { return false; } - if (this.props.container.State.Running && !this.props.container.State.Paused && !this.props.container.State.Restarting) { + if (this.props.container.State.Running && !this.props.container.State.Paused && !this.props.container.State.ExitCode && !this.props.container.State.Restarting) { state = RUNNING; } else if (this.props.container.State.Restarting) { state = RESTARTING; diff --git a/src/components/ContainerDetailsSubheader.react.js b/src/components/ContainerDetailsSubheader.react.js index 36e5fa25..9023208e 100644 --- a/src/components/ContainerDetailsSubheader.react.js +++ b/src/components/ContainerDetailsSubheader.react.js @@ -54,6 +54,12 @@ var ContainerDetailsSubheader = React.createClass({ } return (this.props.container.State.Downloading || this.props.container.State.Restarting); }, + disableStop: function () { + if (!this.props.container) { + return false; + } + return (this.props.container.State.Downloading || this.props.container.State.ExitCode); + }, disableTerminal: function () { if (!this.props.container) { return false; @@ -103,6 +109,13 @@ var ContainerDetailsSubheader = React.createClass({ }); } }, + handleStop: function () { + if (!this.disableStop()) { + metrics.track('Stopped Container'); + ContainerStore.stop(this.props.container.Name, function () { + }); + } + }, handleTerminal: function () { if (!this.disableTerminal()) { metrics.track('Terminaled Into Container'); @@ -134,6 +147,14 @@ var ContainerDetailsSubheader = React.createClass({ var $action = $(this.getDOMNode()).find('.action .restart'); $action.css("visibility", "hidden"); }, + handleItemMouseEnterStop: function () { + var $action = $(this.getDOMNode()).find('.action .stop'); + $action.css("visibility", "visible"); + }, + handleItemMouseLeaveStop: function () { + var $action = $(this.getDOMNode()).find('.action .stop'); + $action.css("visibility", "hidden"); + }, handleItemMouseEnterTerminal: function () { var $action = $(this.getDOMNode()).find('.action .terminal'); $action.css("visibility", "visible"); @@ -151,6 +172,10 @@ var ContainerDetailsSubheader = React.createClass({ action: true, disabled: this.disableRestart() }); + var stopActionClass = classNames({ + action: true, + disabled: this.disableStop() + }); var terminalActionClass = classNames({ action: true, disabled: this.disableTerminal() @@ -181,6 +206,10 @@ var ContainerDetailsSubheader = React.createClass({
Restart +
+
+ Stop +
Terminal diff --git a/src/stores/ContainerStore.js b/src/stores/ContainerStore.js index 81715a5a..080684ce 100644 --- a/src/stores/ContainerStore.js +++ b/src/stores/ContainerStore.js @@ -398,6 +398,19 @@ var ContainerStore = assign(Object.create(EventEmitter.prototype), { } }); }, + stop: function (name, callback) { + var container = docker.client().getContainer(name); + _muted[name] = true; + container.stop(err => { + if (err && err.statusCode !== 304) { + _muted[name] = false; + callback(err); + } else { + _muted[name] = false; + this.fetchContainer(name, callback); + } + }); + }, remove: function (name, callback) { if (_placeholders[name]) { delete _placeholders[name]; From 20ac2b65502d93535034e6008700d045b5aece50 Mon Sep 17 00:00:00 2001 From: TeckniX Date: Fri, 24 Apr 2015 16:19:34 -0400 Subject: [PATCH 2/3] Replaced disableStop by stopDisabled Signed-off-by: TeckniX --- src/components/ContainerDetailsSubheader.react.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/ContainerDetailsSubheader.react.js b/src/components/ContainerDetailsSubheader.react.js index 9023208e..11f92f35 100644 --- a/src/components/ContainerDetailsSubheader.react.js +++ b/src/components/ContainerDetailsSubheader.react.js @@ -54,7 +54,7 @@ var ContainerDetailsSubheader = React.createClass({ } return (this.props.container.State.Downloading || this.props.container.State.Restarting); }, - disableStop: function () { + stopDisabled: function () { if (!this.props.container) { return false; } @@ -110,7 +110,7 @@ var ContainerDetailsSubheader = React.createClass({ } }, handleStop: function () { - if (!this.disableStop()) { + if (!this.stopDisabled()) { metrics.track('Stopped Container'); ContainerStore.stop(this.props.container.Name, function () { }); @@ -174,7 +174,7 @@ var ContainerDetailsSubheader = React.createClass({ }); var stopActionClass = classNames({ action: true, - disabled: this.disableStop() + disabled: this.stopDisabled() }); var terminalActionClass = classNames({ action: true, From 2c76a69fa5bdf8a5725aa3e78aa1292612579ece Mon Sep 17 00:00:00 2001 From: TeckniX Date: Sun, 26 Apr 2015 15:07:05 -0400 Subject: [PATCH 3/3] Centered label --- styles/right-panel.less | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/styles/right-panel.less b/styles/right-panel.less index 384b3e89..e3625104 100644 --- a/styles/right-panel.less +++ b/styles/right-panel.less @@ -46,6 +46,10 @@ left: 2px; //left: -18px; } + &.stop { + left: 7px; + //left: -18px; + } &.terminal { left: -1px; //left: -30px;