From d5cf3d2c59e39d48b968273cbd11be54beb2b358 Mon Sep 17 00:00:00 2001 From: Simon Howe Date: Thu, 21 Jan 2016 16:57:22 +0100 Subject: [PATCH] Fixes exec/attach from the 2nd+ card. - Also fixes strange issue where hitting ESC while a terminal was active, would update the route, reload the top card, and break the terminal connection status. --- client/app/scripts/actions/app-actions.js | 7 ++++--- client/app/scripts/components/app.js | 2 +- client/app/scripts/components/embedded-terminal.js | 13 +++++++------ client/app/scripts/stores/app-store.js | 4 ++++ 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/client/app/scripts/actions/app-actions.js b/client/app/scripts/actions/app-actions.js index 6a28ac297..7fba88d65 100644 --- a/client/app/scripts/actions/app-actions.js +++ b/client/app/scripts/actions/app-actions.js @@ -159,11 +159,12 @@ export function hitEsc() { type: ActionTypes.CLICK_CLOSE_TERMINAL, pipeId: controlPipe.id }); + updateRoute(); // Dont deselect node on ESC if there is a controlPipe (keep terminal open) - } else if (AppStore.getSelectedNodeId() && !controlPipe) { + } else if (AppStore.getTopCardNodeId() && !controlPipe) { AppDispatcher.dispatch({type: ActionTypes.DESELECT_NODE}); + updateRoute(); } - updateRoute(); } export function leaveEdge(edgeId) { @@ -242,7 +243,7 @@ export function receiveControlPipeFromParams(pipeId, rawTty) { } export function receiveControlPipe(pipeId, nodeId, rawTty) { - if (nodeId !== AppStore.getSelectedNodeId()) { + if (nodeId !== AppStore.getTopCardNodeId()) { log('Node was deselected before we could set up control!'); deletePipe(pipeId); return; diff --git a/client/app/scripts/components/app.js b/client/app/scripts/components/app.js index fbad26b07..01cb5de6d 100644 --- a/client/app/scripts/components/app.js +++ b/client/app/scripts/components/app.js @@ -87,7 +87,7 @@ export default class App extends React.Component { {showingTerminal && } + details={this.state.nodeDetails} />}
diff --git a/client/app/scripts/components/embedded-terminal.js b/client/app/scripts/components/embedded-terminal.js index 7c3af84d1..bd7436bf1 100644 --- a/client/app/scripts/components/embedded-terminal.js +++ b/client/app/scripts/components/embedded-terminal.js @@ -3,18 +3,19 @@ import React from 'react'; import { getNodeColor, getNodeColorDark } from '../utils/color-utils'; import Terminal from './terminal'; -export default function EmeddedTerminal({pipe, nodeId, nodes}) { - const node = nodes.get(nodeId); - const titleBarColor = node && getNodeColorDark(node.get('rank'), node.get('label_major')); - const statusBarColor = node && getNodeColor(node.get('rank'), node.get('label_major')); - const title = node && node.get('label_major'); +export default function EmeddedTerminal({pipe, nodeId, details}) { + const node = details.get(nodeId); + const d = node && node.details; + const titleBarColor = d && getNodeColorDark(d.rank, d.label_major); + const statusBarColor = d && getNodeColor(d.rank, d.label_major); + const title = d && d.label_major; // React unmount/remounts when key changes, this is important for cleaning up // the term.js and creating a new one for the new pipe. return (
+ statusBarColor={statusBarColor} title={title} />
); } diff --git a/client/app/scripts/stores/app-store.js b/client/app/scripts/stores/app-store.js index 549c3da00..48af9fd29 100644 --- a/client/app/scripts/stores/app-store.js +++ b/client/app/scripts/stores/app-store.js @@ -239,6 +239,10 @@ export class AppStore extends Store { }).toJS(); } + getTopCardNodeId() { + return nodeDetails.last().id; + } + getNodes() { return nodes; }