Skip to content

Commit

Permalink
Render hostname in UI
Browse files Browse the repository at this point in the history
  • Loading branch information
davkal committed Dec 4, 2015
1 parent 4444a40 commit 0c5331d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions client/app/scripts/actions/app-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
}
Expand Down
5 changes: 3 additions & 2 deletions client/app/scripts/components/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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>
Expand Down
8 changes: 7 additions & 1 deletion client/app/scripts/stores/app-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -198,6 +199,10 @@ export class AppStore extends Store {
return null;
}

getHostname() {
return hostname;
}

getNodeDetails() {
return nodeDetails;
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0c5331d

Please sign in to comment.