diff --git a/app.js b/app.js index 1e5d1fa..050a588 100644 --- a/app.js +++ b/app.js @@ -32,7 +32,7 @@ var server = http.createServer(function(req, res) { } if (req.url.indexOf('/data.io.js') === -1) { - if (/(js|css|fonts)/.test(req.url)) { + if (/(js|css|fonts|images)/.test(req.url)) { staticServer.serve(req, res); } else { // serve index for all app pages diff --git a/static/images/preloader.gif b/static/images/preloader.gif new file mode 100644 index 0000000..a531cf9 Binary files /dev/null and b/static/images/preloader.gif differ diff --git a/static/js/app/components/terminal/terminal.jade b/static/js/app/components/terminal/terminal.jade index 304ffa3..35cbd36 100644 --- a/static/js/app/components/terminal/terminal.jade +++ b/static/js/app/components/terminal/terminal.jade @@ -1,3 +1,3 @@ .terminal pre.terminal_code - .terminal_footer(style={height: '30px'}) + .terminal_footer diff --git a/static/js/app/components/terminal/terminal.js b/static/js/app/components/terminal/terminal.js index b68a185..83ca011 100644 --- a/static/js/app/components/terminal/terminal.js +++ b/static/js/app/components/terminal/terminal.js @@ -5,9 +5,18 @@ define([ 'react', 'reflux', 'app/stores/terminal', + 'app/stores/build', 'ansi_up', - 'templates/app/components/terminal/terminal', -], function(_, React, Reflux, terminalStore, ansiUp, template) { + 'templates/app/components/terminal/terminal' +], function( + _, + React, + Reflux, + terminalStore, + buildStore, + ansiUp, + template +) { var Component = React.createClass({ mixins: [Reflux.ListenerMixin], @@ -19,9 +28,26 @@ define([ this.listenTo(terminalStore, this.updateItems); var node = document.getElementsByClassName('terminal')[0]; this.initialScrollPosition = node.getBoundingClientRect().top; + if (this.props.showPreloader) { + this.getTerminal().insertAdjacentHTML('afterend', + '' + ); + + this.listenTo(buildStore, function(build) { + if (build.completed) { + this.removePreloader(); + } + }); + } window.onscroll = this.onScroll; }, + removePreloader: function() { + var preloader = document.getElementsByClassName( + 'terminal_preloader' + )[0]; + preloader.parentNode.removeChild(preloader); + }, componentWillUnmount: function() { window.onscroll = null; }, @@ -91,6 +117,9 @@ define([ this.data = build.data; this.renderBuffer(); } + if (this.props.showPreloader && build.buildCompleted) { + this.removePreloader(); + } }, shouldComponentUpdate: function() { return false; diff --git a/static/js/app/stores/terminal.js b/static/js/app/stores/terminal.js index d743ff5..7082b0a 100644 --- a/static/js/app/stores/terminal.js +++ b/static/js/app/stores/terminal.js @@ -36,6 +36,7 @@ define([ self.lines = self.lines.concat(data.lines); self.trigger({ buildId: build.id, + buildCompleted: build.completed, name: 'Console for build #' + build.id, data: _(self.lines).pluck('text') });