diff --git a/client/app/scripts/actions/app-actions.js b/client/app/scripts/actions/app-actions.js index 2094e257b..1b654a934 100644 --- a/client/app/scripts/actions/app-actions.js +++ b/client/app/scripts/actions/app-actions.js @@ -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({ diff --git a/client/app/scripts/constants/action-types.js b/client/app/scripts/constants/action-types.js index b6290f2fb..773143829 100644 --- a/client/app/scripts/constants/action-types.js +++ b/client/app/scripts/constants/action-types.js @@ -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', diff --git a/client/app/scripts/stores/app-store.js b/client/app/scripts/stores/app-store.js index bfd9ab608..78a18aa39 100644 --- a/client/app/scripts/stores/app-store.js +++ b/client/app/scripts/stores/app-store.js @@ -557,6 +557,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, diff --git a/client/app/scripts/utils/web-api-utils.js b/client/app/scripts/utils/web-api-utils.js index ddd0a5f9f..885adb271 100644 --- a/client/app/scripts/utils/web-api-utils.js +++ b/client/app/scripts/utils/web-api-utils.js @@ -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) => { diff --git a/common/xfer/controls.go b/common/xfer/controls.go index d1fd19c23..244d70add 100644 --- a/common/xfer/controls.go +++ b/common/xfer/controls.go @@ -25,7 +25,8 @@ type Response struct { Pipe string `json:"pipe,omitempty"` RawTTY bool `json:"raw_tty,omitempty"` - CloseDetails bool `json:"closeDetails,omitempty"` // True will cause the UI to close the details panel. + // Remove specific fields + RemovedNode string `json:"removedNode,omitempty"` // Set if node was removed } // Message is the unions of Request, Response and arbitrary Value. diff --git a/probe/docker/controls.go b/probe/docker/controls.go index 1748710b4..de2f4fe30 100644 --- a/probe/docker/controls.go +++ b/probe/docker/controls.go @@ -57,7 +57,7 @@ func (r *registry) removeContainer(containerID string, _ xfer.Request) xfer.Resp return xfer.ResponseError(err) } return xfer.Response{ - CloseDetails: true, + RemovedNode: containerID, } }