Skip to content

Commit

Permalink
Download webui logs functionality added!
Browse files Browse the repository at this point in the history
  • Loading branch information
mariyachanniwala committed Jun 14, 2018
1 parent c6d0324 commit f169f9c
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 37 deletions.
22 changes: 5 additions & 17 deletions br-webui/_includes/header.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,6 @@
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 <header>");
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 @@ -55,10 +42,11 @@
<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>
<a href="/webui.log" download>
<button type="button" class="btn btn-primary btn-sm navbar-btn">
Send Error Log
</button>
</a>
</form>
</div><!--/.nav-collapse -->
</div>
Expand Down
8 changes: 1 addition & 7 deletions br-webui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var env = process.env
logger.log('ENVIRONMENT', process.env)
logger.log('COMPANION_DIR', process.env.COMPANION_DIR)
app.use(express.static('public'));
app.use('/webui.log', express.static('/home/pi/.webui.log'));
app.use('/js', express.static(__dirname + '/node_modules/bootstrap/dist/js')); // redirect bootstrap JS
app.use('/js', express.static(__dirname + '/node_modules/jquery/dist')); // redirect JS jQuery
app.use('/font-awesome', express.static(__dirname + '/node_modules/font-awesome')); // redirect JS jQuery
Expand Down Expand Up @@ -1593,13 +1594,6 @@ 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
1 change: 0 additions & 1 deletion br-webui/views/camera.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<script src="js/bootstrap-slider.js"></script>

<script>
//var socket = io();
var _cameras = [];
var _activeFormat = {};
Expand Down
4 changes: 0 additions & 4 deletions br-webui/views/network.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
// WiFi Setup
var networking = io('/networking');
socket.on('getlogs', function(data) {
console.log("In get logs <network>");
console.log(data);
});
networking.on('wifi aps', function(data) {
console.log('got wifi aps')
Expand Down
3 changes: 1 addition & 2 deletions br-webui/views/routing.liquid
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{% include ../_includes/header.liquid %}

<script>
var socket = io();
var config;
socket.on('serial ids', function (data) {
Expand Down Expand Up @@ -312,4 +311,4 @@
</div>


{% include ../_includes/footer.liquid %}
{% include ../_includes/footer.liquid %}
6 changes: 0 additions & 6 deletions br-webui/views/system.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<script src="socket.io-file-client.js"></script>
<script>
var _updating = false;
//var socket = io();
// Listen to internet connectivity status updates from the backend
// Disable features that require backend internet connectivity when
Expand All @@ -21,11 +20,6 @@ socket.on('cpu stats', function(data) {
console.log('got cpu status', data);
});
socket.on('getlogs', function(data) {
console.log("In get logs <system>");
console.log(data);
});
socket.on('terminal output', function(data) {
var terminalEl = document.getElementById("terminal-output");
var html = terminalEl.innerHTML + data;
Expand Down

0 comments on commit f169f9c

Please sign in to comment.