Skip to content

Commit

Permalink
Created a send log button and added some backend functionality to it.
Browse files Browse the repository at this point in the history
  • Loading branch information
mariyachanniwala committed Jun 4, 2018
1 parent 469d29d commit c6b54ff
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
17 changes: 17 additions & 0 deletions br-webui/_includes/header.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@
function shutdown() {
socket.emit('shutdown');
}
function send() {
console.log('got into the function send');
socket.emit('sendlog');
}
socket.on('getlogs', function(data) {
console.log("In get logs");
console.log(data);
});
</script>
<link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/font-awesome/css/font-awesome.min.css">
Expand Down Expand Up @@ -42,6 +55,10 @@
<form class="navbar-form navbar-right">
<button onclick="reboot()" class="btn btn-primary btn-sm navbar-btn">Reboot</button>
<button onclick="shutdown()" class="btn btn-error btn-sm navbar-btn">Shutdown</button>
<button type="button" onclick="send()" class="btn btn-primary btn-sm navbar-btn">
Send Error Log

</button>
</form>
</div><!--/.nav-collapse -->
</div>
Expand Down
7 changes: 7 additions & 0 deletions br-webui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1593,6 +1593,13 @@ io.on('connection', function(socket) {
});
});

socket.on('sendlog', function(data) {
logger.log('sendlog');
var cmd = child_process.exec('ls', function (error, stdout, stderr) {
socket.emit('getlogs',"hi");
logger.log('entered function sendlog');
});
});
var uploader = new SocketIOFile(socket, {
// uploadDir: { // multiple directories
// music: 'data/music',
Expand Down

0 comments on commit c6b54ff

Please sign in to comment.