Merge pull request #1290 from weaveworks/remove-container-control

Add control for removing stopped docker containers.
This commit is contained in:
Paul Bellamy
2016-04-22 14:13:40 +01:00
14 changed files with 98 additions and 35 deletions
@@ -322,6 +322,14 @@ export function receiveApiDetails(apiDetails) {
});
}
export function receiveControlNodeRemoved(nodeId) {
AppDispatcher.dispatch({
type: ActionTypes.RECEIVE_CONTROL_NODE_REMOVED,
nodeId
});
updateRoute();
}
export function receiveControlPipeFromParams(pipeId, rawTty) {
// TODO add nodeId
AppDispatcher.dispatch({
@@ -1,4 +1,5 @@
import React from 'react';
import _ from 'lodash';
import NodeDetailsControlButton from './node-details-control-button';
@@ -17,7 +18,7 @@ export default function NodeDetailsControls({controls, error, nodeId, pending})
<span className="node-details-controls-error-messages">{error}</span>
</div>}
<span className="node-details-controls-buttons">
{controls && controls.map(control => <NodeDetailsControlButton
{_.sortBy(controls, 'rank').map(control => <NodeDetailsControlButton
nodeId={nodeId} control={control} pending={pending} key={control.id} />)}
</span>
{controls && <span title="Applying..." className={spinnerClassName}></span>}
@@ -27,6 +27,7 @@ const ACTION_TYPES = [
'PIN_METRIC',
'UNPIN_METRIC',
'OPEN_WEBSOCKET',
'RECEIVE_CONTROL_NODE_REMOVED',
'RECEIVE_CONTROL_PIPE',
'RECEIVE_CONTROL_PIPE_STATUS',
'RECEIVE_NODE_DETAILS',
+5
View File
@@ -561,6 +561,11 @@ export class AppStore extends Store {
this.__emitChange();
break;
}
case ActionTypes.RECEIVE_CONTROL_NODE_REMOVED: {
closeNodeDetails(payload.nodeId);
this.__emitChange();
break;
}
case ActionTypes.RECEIVE_CONTROL_PIPE: {
controlPipes = controlPipes.set(payload.pipeId, makeOrderedMap({
id: payload.pipeId,
+9 -4
View File
@@ -3,8 +3,8 @@ import reqwest from 'reqwest';
import { clearControlError, closeWebsocket, openWebsocket, receiveError,
receiveApiDetails, receiveNodesDelta, receiveNodeDetails, receiveControlError,
receiveControlPipe, receiveControlPipeStatus, receiveControlSuccess,
receiveTopologies, receiveNotFound } from '../actions/app-actions';
receiveControlNodeRemoved, receiveControlPipe, receiveControlPipeStatus,
receiveControlSuccess, receiveTopologies, receiveNotFound } from '../actions/app-actions';
import { API_INTERVAL, TOPOLOGY_INTERVAL } from '../constants/timer';
@@ -184,8 +184,13 @@ export function doControlRequest(nodeId, control) {
url,
success: (res) => {
receiveControlSuccess(nodeId);
if (res && res.pipe) {
receiveControlPipe(res.pipe, nodeId, res.raw_tty, true);
if (res) {
if (res.pipe) {
receiveControlPipe(res.pipe, nodeId, res.raw_tty, true);
}
if (res.removedNode) {
receiveControlNodeRemoved(nodeId);
}
}
},
error: (err) => {