mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 18:20:27 +00:00
- term.js - Add eslintignore - Fix color and es2015 after rebase - Fix JS test, probably deleted during conflict resolution - Moves terminal close button to top-right of window - Consitent w/ details window. - Changes padding of details window close button so both close buttons are horizonally aligned. - Terminal resizes w/ browser window. - No longer can drag window around. - Add tiny big of padding between term and node-details. - Playing w/ terminal placement. This one's more drawer-like. - Send DELETE when we close a terminal window. - Dont lint or bable JS vendor files - Ignore ctags 'tags' files. - Adds popping out terminal out into a new browser window. - Simplify code as now we've just a single terminal window. - ESC is back to close the terminal, then the details panel. - Fixes bug w/ slow response to closing the details panel. - Moving away from "drawer-style" for terminal size and position to a simple window. - Just gotta handle the case for refreshing a popped out terminal. - Stop terminal text being auto-deselected. - window resizes will still deselect. - Adds state.connected to react.scu check. - Don't delete pipe when browser closes - To allow for nicer refresh flows - scope-app will time out pipe after a while. - Keep terminal-open/closed state in the url. - shouldComponentUpdate fix to prevent deselection of text has been rolled back so gotta come up w/ another way to handle that... - Fixes terminal text-selection again. - Make pipes work for non-raw terminals too. - Move document.title updating somewhere more sensible. - Pass rawTty prop along to all terminals. - Don't render react root into doc.body - Reconnect the websocket if we lose it. - First, slightly rough, attempt at displaying if pipe has been deleted - Refactor controlPipe structure in the AppStore/hash. - Merge controlPipeId, controlPipeRaw, controlPipeStatus into a single object. - Adds a status bar to the terminal window. - Error handling in popout working again. - Don't show terminal cursor when not connected. - Simplify controlPipe status and error handling. - Don't keep the status in the hash. - Use special new action receiveControlPipeFromParams rather than adding lots of branching to receiveControlPipe. - You can reload a terminal but it doesn't exist in history stack. - Pull out terminal into its own entry point! - Fixes prod webpack build - Fixes terminal-app websocket path when running on prod. - Fixes old terminals appearing when closing a terminal. - History hacking wasn't working, this is a little simpler.
121 lines
4.1 KiB
JavaScript
121 lines
4.1 KiB
JavaScript
import React from 'react';
|
|
|
|
import Logo from './logo';
|
|
import AppStore from '../stores/app-store';
|
|
import Sidebar from './sidebar.js';
|
|
import Status from './status.js';
|
|
import Topologies from './topologies.js';
|
|
import TopologyOptions from './topology-options.js';
|
|
import { getApiDetails, getTopologies } from '../utils/web-api-utils';
|
|
import { hitEsc } from '../actions/app-actions';
|
|
import Details from './details';
|
|
import Nodes from './nodes';
|
|
import EmbeddedTerminal from './embedded-terminal';
|
|
import { getRouter } from '../utils/router-utils';
|
|
|
|
const ESC_KEY_CODE = 27;
|
|
|
|
function getStateFromStores() {
|
|
return {
|
|
activeTopologyOptions: AppStore.getActiveTopologyOptions(),
|
|
controlError: AppStore.getControlError(),
|
|
controlPending: AppStore.isControlPending(),
|
|
controlPipe: AppStore.getControlPipe(),
|
|
currentTopology: AppStore.getCurrentTopology(),
|
|
currentTopologyId: AppStore.getCurrentTopologyId(),
|
|
currentTopologyOptions: AppStore.getCurrentTopologyOptions(),
|
|
errorUrl: AppStore.getErrorUrl(),
|
|
highlightedEdgeIds: AppStore.getHighlightedEdgeIds(),
|
|
highlightedNodeIds: AppStore.getHighlightedNodeIds(),
|
|
hostname: AppStore.getHostname(),
|
|
selectedNodeId: AppStore.getSelectedNodeId(),
|
|
nodeDetails: AppStore.getNodeDetails(),
|
|
nodes: AppStore.getNodes(),
|
|
topologies: AppStore.getTopologies(),
|
|
topologiesLoaded: AppStore.isTopologiesLoaded(),
|
|
version: AppStore.getVersion(),
|
|
websocketClosed: AppStore.isWebsocketClosed()
|
|
|
|
};
|
|
}
|
|
|
|
export default class App extends React.Component {
|
|
|
|
constructor(props, context) {
|
|
super(props, context);
|
|
this.onChange = this.onChange.bind(this);
|
|
this.onKeyPress = this.onKeyPress.bind(this);
|
|
this.state = getStateFromStores();
|
|
}
|
|
|
|
componentDidMount() {
|
|
AppStore.addListener(this.onChange);
|
|
window.addEventListener('keyup', this.onKeyPress);
|
|
|
|
getRouter().start({hashbang: true});
|
|
if (!AppStore.isRouteSet()) {
|
|
// dont request topologies when already done via router
|
|
getTopologies(AppStore.getActiveTopologyOptions());
|
|
}
|
|
getApiDetails();
|
|
}
|
|
|
|
onChange() {
|
|
this.setState(getStateFromStores());
|
|
}
|
|
|
|
onKeyPress(ev) {
|
|
if (ev.keyCode === ESC_KEY_CODE) {
|
|
hitEsc();
|
|
}
|
|
}
|
|
|
|
render() {
|
|
const showingDetails = this.state.selectedNodeId;
|
|
const showingTerminal = this.state.controlPipe;
|
|
const footer = `Version ${this.state.version} on ${this.state.hostname}`;
|
|
// width of details panel blocking a view
|
|
const detailsWidth = showingDetails ? 450 : 0;
|
|
const topMargin = 100;
|
|
|
|
return (
|
|
<div className="app">
|
|
{showingDetails && <Details nodes={this.state.nodes}
|
|
controlError={this.state.controlError}
|
|
controlPending={this.state.controlPending}
|
|
nodeId={this.state.selectedNodeId}
|
|
details={this.state.nodeDetails} />}
|
|
|
|
{showingTerminal && <EmbeddedTerminal
|
|
pipe={this.state.controlPipe}
|
|
nodeId={this.state.selectedNodeId}
|
|
nodes={this.state.nodes} />}
|
|
|
|
<div className="header">
|
|
<Logo />
|
|
<Topologies topologies={this.state.topologies} currentTopology={this.state.currentTopology} />
|
|
</div>
|
|
|
|
<Nodes nodes={this.state.nodes} highlightedNodeIds={this.state.highlightedNodeIds}
|
|
highlightedEdgeIds={this.state.highlightedEdgeIds} detailsWidth={detailsWidth}
|
|
selectedNodeId={this.state.selectedNodeId} topMargin={topMargin}
|
|
topologyId={this.state.currentTopologyId} />
|
|
|
|
<Sidebar>
|
|
<TopologyOptions options={this.state.currentTopologyOptions}
|
|
topologyId={this.state.currentTopologyId}
|
|
activeOptions={this.state.activeTopologyOptions} />
|
|
<Status errorUrl={this.state.errorUrl} topology={this.state.currentTopology}
|
|
topologiesLoaded={this.state.topologiesLoaded}
|
|
websocketClosed={this.state.websocketClosed} />
|
|
</Sidebar>
|
|
|
|
<div className="footer">
|
|
{footer}
|
|
<a href="https://gitreports.com/issue/weaveworks/scope" target="_blank">Report an issue</a>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
}
|