Dashboard

We have built a simple dashboard displaying some key data from reports created in the Koha staff client, built using Freeboard. You can access it here.
= Koha Dashboard =
=== Building the dashboard locally ===
# After logging into vagrant within your kohadevbox, git clone the Freeboard file from github
# In the terminal, cd into koha-tmpl and create a shortcut 
 ln -s /home/vagrant/freeboard/ .
# Open Freeboard in your browser at localhost:8080/freeboard/
# Open the Koha staff client in your browser at localhost:8081/ and either create some reports or used saved reports
# Back on Freeboard, at the top right where it says 'Data Sources', click ADD to get the reports into your dashboard
# Select Type = 'JSON', then fill in the details and click Save. The URL of the data source (report) from Koha should be something like http://localhost:8080/cgi-bin/koha/svc/report?id=IDNUMBER
# To get your data showing in a widget on the dashboard, click where it says ADD PANE on the left. A dark box will show up on the black bottom section of the page.
# Click the plus, select the appropriate Type (the way you want your data to be displayed), then fill in the details and click Save. For Value, click DATA SOURCE and choose your linked report from the drop down menu. The SPARKLINE option is a realtime line graph that shows changes in your data, which updates every time the data source refreshes. You can drag the panes around the page, as well as have multiple widgets within one pane.
# To save your Freeboard, click SAVE FREEBOARD on the top left and it will be exported as a JSON file to your Downloads folder, which you can then reload into Freeboard (by clicking LOAD FREEBOARD) to work on again. Important: Remember to save your work regularly, as it will be gone when the page is closed or reloaded (F5).
=== Sharing the dashboard ===
# In the terminal, cd into your kohadevbox and ssh demo.mykoha.co.nz . Once you're in, git clone the Freeboard file from github
# Open another terminal tab so that you're back to your home directory and host server and cd into your Downloads folder. Copy your dashboard file from your home server into the demo-mykoha server 
 scp YOURSAVEDDASHBOARD.json USERNAME@demo-mykoha:Freeboard 
# You should then be able to load and edit your saved dashboard at http://demo.mykoha.co.nz/freeboard/ , as well as access it via URL at http://demo.mykoha.co.nz/freeboard/?load=http://demo.mykoha.co.nz/freeboard/YOURSAVEDDASHBOARD.json . This is the URL that you can share and where others can view your dashboard.
# You'll want the dashboard to be read-only from this URL (not editable), so go back into your terminal, cd into the Freeboard folder and open index.html. Within the <head>, look for the part that says this:
 function(){
 $(function()
 { //DOM Ready
 freeboard.initialize(true);
 });
and just under the freeboard.initialize(true); line, add 
 freeboard.setEditing(false); 
* The dashboard will still show the editing interface, but you can easily turn that off by editing the YOURSAVEDDASHBOARD.json file from
 {"version":1,"allow_edit":true,
to
 {"version":1,"allow_edit":false,
and saving it.
* You now have a public dashboard, shareable via http://demo.mykoha.co.nz/freeboard/?load=http://demo.mykoha.co.nz/freeboard/YOURSAVEDDASHBOARD.json where it is read-only, and editable by you via http://demo.mykoha.co.nz/freeboard/ . Remember that everytime you update your dashboard and save it, you must copy it across to the demo-mykoha server from the Downloads folder on your host server (scp command) so that the URL accesses the correct file.
= Reports =
Koha SQL Reports Library
The reports we are using (and what you could use) are:
===== Total issues =====
:SELECT count(*) FROM statistics WHERE type = "issue"
===== Total biblios =====
:SELECT count(*) FROM biblio
===== Total items available for loan =====
:SELECT count(*) FROM itemtypes WHERE notforloan = 0
===== Total reserves =====
:SELECT count(*) FROM reserves
===== Total fines due =====
:SELECT FORMAT(Sum(accountlines.amountoutstanding),2) FROM accountlines
===== Total missing items =====
:SELECT count(items.itemnumber) FROM items LEFT JOIN biblio ON (items.biblionumber = biblio.biblionumber) LEFT JOIN authorised_values ON (items.itemlost = authorised_values.authorised_value) WHERE items.itemlost = 4 AND authorised_values.category = 'LOST'
Category:Development