Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
19,678 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!doctype html> | ||
<html lang="ja"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Tailor log watcher</title> | ||
<meta name="viewport" content="width=device-width"> | ||
<link rel="stylesheet" type="text/css" href="/tailor.css"> | ||
<meta name="robots" content="noindex,nofollow"> | ||
</head> | ||
<body> | ||
<div class="T-Wrap"></div> | ||
<script src="/tailor.js"></script> | ||
</body> | ||
</html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from "react"; | ||
|
||
export default class Indicator extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
} | ||
|
||
render() { | ||
if ( this.props.connected === true ) { | ||
return ( | ||
<span className="T-Indicator c">Connected</span> | ||
); | ||
} else { | ||
return ( | ||
<span className="T-Indicator n">Not Connected</span> | ||
); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from "react"; | ||
|
||
export default class LogFileList extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
} | ||
|
||
selectHost(evt) { | ||
const em = evt.currentTarget.querySelector("em"); | ||
em.normalize(); | ||
this.props.onSelectHost(em.textContent); | ||
} | ||
|
||
render() { | ||
return ( | ||
<div className="T-Sidebar"> | ||
<ul className="T-LogList"> | ||
{ this.props.hosts.map((h) => { | ||
if ( h === this.props.selectedHost ) { | ||
return ( | ||
<li onClick={this.selectHost.bind(this)}> | ||
<a href="#" className="active"> | ||
<em>{h}</em> | ||
</a> | ||
</li> | ||
); | ||
} else { | ||
return ( | ||
<li onClick={this.selectHost.bind(this)}> | ||
<a href="#"> | ||
<em>{h}</em> | ||
</a> | ||
</li> | ||
); | ||
} | ||
}) } | ||
</ul> | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,46 @@ | ||
const ReactDOM = require("react-dom"); | ||
const Main = require("./modules/main"); | ||
import ReactDOM from "react-dom"; | ||
import React from "react"; | ||
import Main from "./modules/main"; | ||
|
||
class Controller { | ||
constructor(element) { | ||
this.element = element; | ||
this.elemment.style.height = (window.innerHeight - 40) + "px"; | ||
this.element.style.height = (window.innerHeight - 40) + "px"; | ||
|
||
this.logs = {}; | ||
} | ||
|
||
init() { | ||
this.main = ReactDOM.render(main, <Main />); | ||
this.ws = new WebSocket(WEBSOCKET_URL); | ||
this.ws.onmessage = (message) => { | ||
this.main.setState({log: message}); | ||
this.main = ReactDOM.render(<Main logs={this.logs} hostList={this.hosts}/>, this.element); | ||
//this.ws = new WebSocket(WEBSOCKET_URL); | ||
this.ws = new WebSocket("ws://localhost:9999/reader"); | ||
this.ws.onopen = () => { | ||
this.main.setState({connected: true}); | ||
this.ws.onmessage = (evt) => this.handleSocket(evt); | ||
}; | ||
this.ws.onclose = () => { | ||
this.main.setState({connected: false}); | ||
this.ws.onmessage = null; | ||
}; | ||
} | ||
|
||
handleSocket(evt) { | ||
const message = JSON.parse(evt.data); | ||
console.log(message); | ||
|
||
if ( message.host in this.logs ) { | ||
this.logs[message.host].push(message.message); | ||
} else { | ||
this.logs[message.host] = [message.message]; | ||
} | ||
this.main.setState({ | ||
logs: this.logs | ||
}); | ||
} | ||
} | ||
|
||
const controller = new Controller( | ||
document.querySelector(".T-Main") | ||
const c = new Controller( | ||
document.querySelector(".T-Wrap") | ||
); | ||
c.init(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.