diff --git a/README.md b/README.md index 59081c1..df261e2 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ```frontail``` is node.js application for serving `tail -F` output to browser. -[![Build Status](https://travis-ci.org/mthenw/frontail.png?branch=master)](https://travis-ci.org/mthenw/frontail) +[![Build Status](https://travis-ci.org/mthenw/frontail.svg?branch=master)](https://travis-ci.org/mthenw/frontail) [![NPM version](https://badge.fury.io/js/frontail.png)](http://badge.fury.io/js/frontail) ## Features @@ -39,6 +39,8 @@ -c, --certificate Certificate for HTTPS, option works only along with -k option --pid-path if run as daemon file that will store the process id, default /var/run/frontail.pid --log-path if run as daemon file that will be used as a log, default /dev/null + --ui-hide-topbar hide topbar (log file name and search box) + --ui-no-indent don't indent log lines (every line after first one) Web interface is on http://localhost:[port] diff --git a/index.js b/index.js index 0308a9f..6fb5113 100644 --- a/index.js +++ b/index.js @@ -36,6 +36,8 @@ program String, '/var/run/frontail.pid') .option('--log-path ', 'if run as daemon file that will be used as a log, default /dev/null', String, '/dev/null') + .option('--ui-hide-topbar', 'hide topbar (log file name and search box)') + .option('--ui-no-indent', 'don\'t indent log lines (every line after first one)') .parse(process.argv); if (program.args.length === 0) { @@ -125,6 +127,9 @@ if (program.daemonize) { var filesSocket = io.of('/' + filesNamespace).on('connection', function (socket) { socket.emit('options:lines', program.lines); + program.uiHideTopbar && socket.emit('options:hide-topbar'); + !program.uiIndent && socket.emit('options:no-indent'); + tailer.getBuffer().forEach(function (line) { socket.emit('line', line); }); diff --git a/lib/web/assets/app.js b/lib/web/assets/app.js index 9c87647..9f477ab 100644 --- a/lib/web/assets/app.js +++ b/lib/web/assets/app.js @@ -26,6 +26,18 @@ window.App = (function (window, document) { */ var _filterValue = ''; + /** + * @type {HTMLElement} + * @private + */ + var _topbar; + + /** + * @type {HTMLElement} + * @private + */ + var _body; + /** * @type {number} * @private @@ -127,20 +139,12 @@ window.App = (function (window, document) { init: function (opts) { var self = this; - // socket.io init - _socket = opts.socket; - _socket - .on('options:lines', function (limit) { - _linesLimit = limit; - }) - .on('line', function (line) { - self.log(line); - }); - // Elements _logContainer = opts.container; _filterInput = opts.filterInput; _filterInput.focus(); + _topbar = opts.topbar; + _body = opts.body; // Filter input bind _filterInput.addEventListener('keyup', function (e) { @@ -161,6 +165,23 @@ window.App = (function (window, document) { _isWindowFocused = true; _faviconReset(); }, true); + + // socket.io init + _socket = opts.socket; + _socket + .on('options:lines', function (limit) { + _linesLimit = limit; + }) + .on('options:hide-topbar', function () { + _topbar.className += ' hide'; + _body.className = 'no-topbar'; + }) + .on('options:no-indent', function () { + _logContainer.className += ' no-indent'; + }) + .on('line', function (line) { + self.log(line); + }); }, /** diff --git a/lib/web/assets/styles/dark.css b/lib/web/assets/styles/dark.css index f26397b..31bc373 100644 --- a/lib/web/assets/styles/dark.css +++ b/lib/web/assets/styles/dark.css @@ -5,6 +5,10 @@ body { background-color: #2F3238; } +.no-topbar { + padding-top: 10px; +} + .navbar { background-color: #26292E; border: 0; @@ -32,6 +36,11 @@ body { margin-bottom: 0; } +.log.no-indent .inner-line { + margin-left: 0; + text-indent: 0; +} + .log .line-selected { background-color: #302436; } diff --git a/lib/web/assets/styles/default.css b/lib/web/assets/styles/default.css index 8e5e6d0..d689c1d 100644 --- a/lib/web/assets/styles/default.css +++ b/lib/web/assets/styles/default.css @@ -4,6 +4,10 @@ body { padding-top: 4em; } +.no-topbar { + padding-top: 10px; +} + .navbar-inverse .navbar-brand { color: white; } @@ -24,6 +28,11 @@ body { margin-bottom: 0; } +.log.no-indent .inner-line { + margin-left: 0; + text-indent: 0; +} + .log .line-selected { background-color: #ffb2b0; -} \ No newline at end of file +} diff --git a/lib/web/index.html b/lib/web/index.html index 15b54fc..509d195 100644 --- a/lib/web/index.html +++ b/lib/web/index.html @@ -7,7 +7,7 @@ -