Render hostname in UI

This commit is contained in:
David Kaltschmidt
2015-12-04 15:45:16 +01:00
parent 4444a405e0
commit 0c5331d33c
3 changed files with 11 additions and 3 deletions

View File

@@ -167,6 +167,7 @@ export function receiveTopologies(topologies) {
export function receiveApiDetails(apiDetails) {
AppDispatcher.dispatch({
type: ActionTypes.RECEIVE_API_DETAILS,
hostname: apiDetails.hostname,
version: apiDetails.version
});
}

View File

@@ -25,6 +25,7 @@ function getStateFromStores() {
errorUrl: AppStore.getErrorUrl(),
highlightedEdgeIds: AppStore.getHighlightedEdgeIds(),
highlightedNodeIds: AppStore.getHighlightedNodeIds(),
hostname: AppStore.getHostname(),
selectedNodeId: AppStore.getSelectedNodeId(),
nodeDetails: AppStore.getNodeDetails(),
nodes: AppStore.getNodes(),
@@ -68,7 +69,7 @@ export default class App extends React.Component {
render() {
const showingDetails = this.state.selectedNodeId;
const versionString = this.state.version ? 'Version ' + this.state.version : '';
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;
@@ -101,7 +102,7 @@ export default class App extends React.Component {
</Sidebar>
<div className="footer">
{versionString}&nbsp;&nbsp;
{footer}&nbsp;&nbsp;
<a href="https://gitreports.com/issue/weaveworks/scope" target="_blank">Report an issue</a>
</div>
</div>

View File

@@ -51,7 +51,8 @@ let controlPending = false;
let currentTopology = null;
let currentTopologyId = 'containers';
let errorUrl = null;
let version = '';
let hostname = '...';
let version = '...';
let mouseOverEdgeId = null;
let mouseOverNodeId = null;
let nodes = makeOrderedMap();
@@ -198,6 +199,10 @@ export class AppStore extends Store {
return null;
}
getHostname() {
return hostname;
}
getNodeDetails() {
return nodeDetails;
}
@@ -403,6 +408,7 @@ export class AppStore extends Store {
case ActionTypes.RECEIVE_API_DETAILS:
errorUrl = null;
hostname = payload.hostname;
version = payload.version;
this.__emitChange();
break;