learningequality/ka-lite — pull request #322 by bcipolli (2013-07-29 02:46:34+00:00)
Title: Abstracted "updates" app, with implementation in videodownload

Dependencies:
* @ruimalheiro's branch on server & client online status via AJAX

Background:
We have a number of updates that need a progressbar, but no abstracted way to communicate progress from the server to the client.

Design (done with @dylanjbarth):
* On the distributed server side,
* we have a new app / model "updates", which contains progress on a "process" (e.g. videodownload), and sub-progress on a "stage" (e.g. a particular video).
* This app contains a model UpdateProgressLog, which exposes both properties usable for updating progress, as well as as an interface for properly updating progress (i.e. the actual properties should not really be set directly).
* The app also contains two extensions to the Django Command object: UpdatesDynamicCommand and UpdatesStaticCommand
* UpdatesStaticCommand exposes utility functions for updating progress within a process/command that has a static set of stages it walks through.
* UpdatesDynamicCommand exposes utility functions for updating progress within a process/command that has no static set of stages, but instead a number of stages that can change over time (e.g. the # of videos to download)
* On the client side,
* Code from video_download.html has been abstracted into updates.js, updates.css, and updates/progress-bar.html
* Javascript code controls updating of the two-level progress bar, as well as progress callbacks such that clients can listen on particular update events (e.g. start, update, stop)

Implementation:
* Besides these framework changes, I've migrated video_download.html to use the updates app, and videodownload.py to use the UpdatesDynamicCommand object.

Notes:
* I have another branch that has migrated the 'update' command to use UpdatesStaticCommand
* On this other branch, updates now has a landing page (with 3 options: videos, languages (subtitles), and software)
* This branch will be used by @dylanjbarth to implement the subtitles front-end. That will also require migration to use the UpdatesStaticCommand
* As I am traveling, I am opening this pull request for a code review, as well as collaboration with anybody that can move forward on it. I will close, but please work on this if you're interested!