aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxliiv <tymoteusz.jankowski@gmail.com>2014-09-05 13:16:50 +0200
committerxliiv <tymoteusz.jankowski@gmail.com>2014-09-05 13:16:50 +0200
commit378b570ecce1fc9b16af79dcb8274f736654ed28 (patch)
tree5684bc9221393eabd7c46be870afb738dfb1e5d6
parent60c073a6ed451cf91d9877a3305407756b9ffdce (diff)
parentf095351d856d4c4e4fd686adcb6dd3a34803e521 (diff)
downloadtipboard-378b570ecce1fc9b16af79dcb8274f736654ed28.tar.gz
tipboard-378b570ecce1fc9b16af79dcb8274f736654ed28.tar.bz2
tipboard-378b570ecce1fc9b16af79dcb8274f736654ed28.zip
Merge pull request #3 from xor-xor/minor_fixes
Minor fixes/improvements here and there (see descriptions of individual commits).
-rw-r--r--README.rst7
-rw-r--r--doc/api.rst6
-rw-r--r--doc/configuration.rst21
-rw-r--r--tipboard/app.py7
-rw-r--r--tipboard/static/js/tipboard.js8
-rw-r--r--tipboard/templates/base.html2
-rw-r--r--tipboard/tests/frontend/SpecRunner.html2
-rw-r--r--tipboard/tiles/advanced_plot.html2
-rw-r--r--tipboard/tiles/advanced_plot.js2
9 files changed, 39 insertions, 18 deletions
diff --git a/README.rst b/README.rst
index be6ef7e..d5b20b0 100644
--- a/README.rst
+++ b/README.rst
@@ -2,6 +2,8 @@
Tipboard
========
+|docs|
+
Introduction
------------
@@ -82,3 +84,8 @@ License
Tipboard is licensed under the `Apache License, v2.0 <http://tipboard.readthedocs.org/en/latest/license.html>`_.
Copyright (c) 2013-2014 `Allegro Group <http://allegrogroup.com>`_.
+
+.. |docs| image:: https://readthedocs.org/projects/tipboard/badge/?version=latest
+ :alt: Documentation Status
+ :scale: 100%
+ :target: https://readthedocs.org/projects/tipboard/
diff --git a/doc/api.rst b/doc/api.rst
index 50ae7e4..0979c70 100644
--- a/doc/api.rst
+++ b/doc/api.rst
@@ -43,7 +43,7 @@ Current API version: **v0.1**
.. note::
In 99% of cases, probably only ``push`` and ``tileconfig`` will be of
- interest to you.
+ interest to you (and maybe ``tiledata`` too).
.. http:post:: /api/(api_version)/(api_key)/push
@@ -126,7 +126,9 @@ Current API version: **v0.1**
.. http:get:: /api/(api_version)/(api_key)/tiledata/(tile_id)
- Retrieves data belonging to the tile specified by `tile_id`. May be useful for diagnostics.
+ Retrieves data belonging to the tile specified by `tile_id`. May be useful
+ in cases when you need to re-fetch some parts of your data (e.g. when
+ updating your team's stats) or just for diagnostics.
:param api_version: version of API to be used
:param api_key: your API key
diff --git a/doc/configuration.rst b/doc/configuration.rst
index a4d8f0b..c31bcd4 100644
--- a/doc/configuration.rst
+++ b/doc/configuration.rst
@@ -9,13 +9,13 @@ below (see section :ref:`installation`).
Default configuration
---------------------
-Tipboard launched after installation present a basic, empty layout – empty
-tiles in 2 lines with 4 columns each. If you want to modify them, create a
-"clean" config, where your changes will be introduced. Use the command::
+First thing that you need to do after successfull installation is to create an
+empty config that will provide a base for your customizations. Type in this
+command::
(tb-env)$ tipboard create_project <name_of_project>
-It will create the ``~/.tipboard`` dir with the following content:
+It will create ``~/.tipboard`` directory with the following content:
* ``settings-local.yaml`` file that defines the layout of tiles on the
dashboard you are creating;
@@ -35,8 +35,7 @@ It will create the ``~/.tipboard`` dir with the following content:
Launching Tipboard app
----------------------
-After you have logged in to your machine, you may launch Tipboard with the
-command::
+Having default config in place, you may launch Tipboard with the command::
(tb-env)$ tipboard runserver [<host>] [<port>]
@@ -44,6 +43,9 @@ command::
``localhost`` and ``7272``; if you want the application to listen on all the
network interfaces, set ``host`` to ``0.0.0.0``).
+You can now point your web browser to ``http://localhost:7272`` - you should
+see a basic, empty layout with tiles in 2 lines of 4 columns each.
+
Customising tile layout
-----------------------
@@ -137,7 +139,7 @@ One of the most useful functions is defining tiles to rotate. In a single
container (i.e. in one of the fields indicated by ``col_X_of_Y`` and
``row_X_of_Y``), you may define a few tiles to be displayed in this location as
items rotating at intervals defined in the configuration (similar to ads
-rotating on bus/tram stops, so-called *citylights*). To achieve that:
+rotating on bus/tram stops, so-called citylights). To achieve that:
* add the ``flip-time-xx`` class to a container, where ``xx`` is rotation
interval in seconds;
@@ -239,3 +241,8 @@ this behavior and rotate only certain dashboards, just add another parameter
taken into account, e.g.::
FLIPBOARD_SEQUENCE = ['my_first_dashboard', 'my_third_dashboard']
+
+.. note::
+
+ Every change in ``settings-local.py`` file requires restart of the
+ application.
diff --git a/tipboard/app.py b/tipboard/app.py
index 59f93b4..a31ff1b 100644
--- a/tipboard/app.py
+++ b/tipboard/app.py
@@ -118,21 +118,26 @@ class DashboardSocketHandler(tornado.websocket.WebSocketHandler, RedisMixin,
self.pubsub.disconnect()
self.getter.disconnect()
+
@tornado.gen.engine
def on_message(self, message):
log.info('Message received: %s.', message)
if message != 'update':
return
+ stale_keys = set()
for tile_id in self.cache:
log.debug('Putting data for tile: {}'.format(tile_id))
raw = yield tornado.gen.Task(self.getter.get, tile_id)
if not raw:
log.warn('No data in key %s on Redis.', tile_id)
- del self.cache[tile_id]
+ stale_keys.add(tile_id)
continue
data = json.loads(raw)
data['tipboard'] = self.tipboard_helpers
self.write_message(data)
+ if stale_keys:
+ self.cache.difference_update(stale_keys)
+
@tornado.gen.engine
def on_publish(self, msg):
diff --git a/tipboard/static/js/tipboard.js b/tipboard/static/js/tipboard.js
index 3727608..ce0dce6 100644
--- a/tipboard/static/js/tipboard.js
+++ b/tipboard/static/js/tipboard.js
@@ -40,7 +40,7 @@ RendererFactory.prototype.rendererName2renderObj = {
RendererFactory.prototype.createRenderer = function (rendererName) {
var lower = rendererName.toLowerCase();
var rendererClass = RendererFactory.prototype.rendererName2renderObj[lower];
- if (rendererClass === undefined) {
+ if (rendererClass === void 0) {
throw new RendererFactory.prototype.UnknownRenderer(rendererName);
}
return rendererClass;
@@ -183,11 +183,11 @@ var renderersSwapper = new RenderersSwapper();
getPalette: function(colors) {
// DEPRECATED, use paletteAsList instead
var palette = [];
- for (var name in colors) {
+ $.each(colors, function(name) {
if (['black', 'white', 'tile_background'].indexOf(name) < 0) {
palette.push(colors[name]);
}
- }
+ });
return palette;
},
@@ -413,7 +413,7 @@ var renderersSwapper = new RenderersSwapper();
return false; // break
}
});
- if (typeof nextFlipIdx !== undefined) {
+ if (typeof nextFlipIdx !== void 0) {
var tileToFlip = containerFlips[nextFlipIdx];
$(tileToFlip).addClass("flippedforward");
}
diff --git a/tipboard/templates/base.html b/tipboard/templates/base.html
index 950a3ff..afb9136 100644
--- a/tipboard/templates/base.html
+++ b/tipboard/templates/base.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html lang="en" ng-app="dashboard">
+<html lang="en">
<head>
<meta charset="utf-8">
<title>{% block page_title %}Dashboard{% end %}</title>
diff --git a/tipboard/tests/frontend/SpecRunner.html b/tipboard/tests/frontend/SpecRunner.html
index b62052d..51b54a7 100644
--- a/tipboard/tests/frontend/SpecRunner.html
+++ b/tipboard/tests/frontend/SpecRunner.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html lang="en" ng-app="dashboard">
+<html lang="en">
<head>
<meta charset="utf-8">
<title>Sample Dashboard</title>
diff --git a/tipboard/tiles/advanced_plot.html b/tipboard/tiles/advanced_plot.html
index ef31356..3076209 100644
--- a/tipboard/tiles/advanced_plot.html
+++ b/tipboard/tiles/advanced_plot.html
@@ -9,6 +9,6 @@
class="result label description"
></div>
- <div id="{{ tile_id + '-chart' }}" class="chart"> </div>
+ <div id="{{ tile_id + '-chart' }}" class="chart advanced-plot"> </div>
</div>
</div>
diff --git a/tipboard/tiles/advanced_plot.js b/tipboard/tiles/advanced_plot.js
index 04aae13..81df173 100644
--- a/tipboard/tiles/advanced_plot.js
+++ b/tipboard/tiles/advanced_plot.js
@@ -28,7 +28,7 @@
var renderersSwapper = new RenderersSwapper();
renderersSwapper.swap(newMeta);
AdvancedPlotTile.rescaleContainers(tile);
- AdvancedPlotTile.buildChart(tileId, data.plotData, newMeta);
+ AdvancedPlotTile.buildChart(tileId, data.plot_data, newMeta);
}
Tipboard.Dashboard.registerUpdateFunction('advanced_plot', updateTileAdvancedPlot);