Show remote server hostname
This commit is contained in:
parent
4ab936986f
commit
e2bebc33d5
32
components/server-info/index.js
Normal file
32
components/server-info/index.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
|
||||||
|
const os = require('os');
|
||||||
|
|
||||||
|
const React = require('react');
|
||||||
|
|
||||||
|
const r = require('r-dom');
|
||||||
|
|
||||||
|
const { connect } = require('react-redux');
|
||||||
|
|
||||||
|
const localHostname = os.hostname();
|
||||||
|
const { username: localUsername } = os.userInfo();
|
||||||
|
|
||||||
|
class ServerInfo extends React.Component {
|
||||||
|
render() {
|
||||||
|
const { username, hostname } = this.props.serverInfo;
|
||||||
|
|
||||||
|
const server = `${username}@${hostname}`;
|
||||||
|
const local = `${localUsername}@${localHostname}`;
|
||||||
|
|
||||||
|
return r.div({
|
||||||
|
className: 'server-info',
|
||||||
|
}, [
|
||||||
|
hostname && (server !== local) && r.span(server),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = connect(
|
||||||
|
state => ({
|
||||||
|
serverInfo: state.pulse.serverInfo,
|
||||||
|
}),
|
||||||
|
)(ServerInfo);
|
11
index.css
11
index.css
|
@ -177,12 +177,21 @@ div[tabindex="-1"]:focus {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.server-info {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
padding: 1rem;
|
||||||
|
pointer-events: none;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
.log {
|
.log {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
overflow: auto;
|
overflow: hidden;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ const Graph = require('./components/graph');
|
||||||
const Cards = require('./components/cards');
|
const Cards = require('./components/cards');
|
||||||
const Preferences = require('./components/preferences');
|
const Preferences = require('./components/preferences');
|
||||||
const Log = require('./components/log');
|
const Log = require('./components/log');
|
||||||
|
const ServerInfo = require('./components/server-info');
|
||||||
const { HotKeys } = require('./components/hot-keys');
|
const { HotKeys } = require('./components/hot-keys');
|
||||||
const { MenuProvider } = require('./components/menu');
|
const { MenuProvider } = require('./components/menu');
|
||||||
const Modals = require('./components/modals');
|
const Modals = require('./components/modals');
|
||||||
|
@ -28,6 +29,7 @@ const Root = () => r(ReduxProvider, {
|
||||||
r(Graph, { ref: graphRef, ...actions }),
|
r(Graph, { ref: graphRef, ...actions }),
|
||||||
r(Cards, { ref: cardsRef }),
|
r(Cards, { ref: cardsRef }),
|
||||||
r(Preferences, { ref: preferencesRef }),
|
r(Preferences, { ref: preferencesRef }),
|
||||||
|
r(ServerInfo),
|
||||||
r(Log),
|
r(Log),
|
||||||
]))));
|
]))));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user