From Koha Wiki

Jump to: navigation, search
Koha > Technical > Development

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

  1. After logging into vagrant within your kohadevbox, git clone the Freeboard file from github
  2. In the terminal, cd into koha-tmpl and create a shortcut
 ln -s /home/vagrant/freeboard/ .
  1. Open Freeboard in your browser at localhost:8080/freeboard/
  2. Open the Koha staff client in your browser at localhost:8081/ and either create some reports or used saved reports
  3. Back on Freeboard, at the top right where it says 'Data Sources', click ADD to get the reports into your dashboard
  4. 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
  5. 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.
  6. 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.
  7. 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

  1. In the terminal, cd into your kohadevbox and ssh demo.mykoha.co.nz . Once you're in, git clone the Freeboard file from github
  2. 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 
  1. 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.
  2. 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:
                   { //DOM Ready

and just under the freeboard.initialize(true); line, add

  • The dashboard will still show the editing interface, but you can easily turn that off by editing the YOURSAVEDDASHBOARD.json file from



and saving it.


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'
Personal tools