static: refactor dashboard.js

Signed-off-by: Pierre-Alexandre Meyer <pierre@ning.com>