Skip to content

Commit

Permalink
Merge pull request #363 from django/dashboard
Browse files Browse the repository at this point in the history
Add dev-dashboard
  • Loading branch information
jezdez committed Jan 31, 2015
2 parents a89887e + 80b5ba5 commit 07d61fb
Show file tree
Hide file tree
Showing 69 changed files with 28,626 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ secrets.json
.sass-cache/
.coverage
.tox
djangoproject/static/js/lib/jquery-flot/examples
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
STATIC = djangoproject/static
JQUERY_FLOT=djangoproject/static/js/lib/jquery-flot

.PHONY: collectstatics compile-scss compile-scss-debug watch-scss run install test ci

Expand All @@ -21,7 +22,14 @@ install:
pip install -r requirements/dev.txt

test:
@coverage run manage.py test -v2 aggregator contact docs fundraising legacy releases svntogit
@coverage run manage.py test -v2 aggregator contact docs fundraising legacy releases svntogit dashboard

ci: test
@coverage report

$(JQUERY_FLOT)/jquery.flot.min.js: $(JQUERY_FLOT)
cat $(JQUERY_FLOT)/jquery.flot.js $(JQUERY_FLOT)/jquery.flot.time.js > $(JQUERY_FLOT)/jquery.flot.concat.js
yuicompressor $(JQUERY_FLOT)/jquery.flot.concat.js -o $(JQUERY_FLOT)/jquery.flot.min.js

$(JQUERY_FLOT)/:
bower install
14 changes: 10 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,16 @@ To run locally, do the usual:
./manage.py loaddata doc_releases
./manage.py update_docs

#. Point the ``www.djangoproject.dev`` and ``docs.djangoproject.dev``
#. For dashboard::

./manage.py loaddata dashboard_example_data
./manage.py update_metrics

#. Point the ``www.djangoproject.dev``, ``docs.djangoproject.dev`` and ``dashboard.djangoproject.dev``
hostnames with your ``/etc/hosts`` file to ``localhost``/``127.0.0.1``.
Here's how it could look like::

127.0.0.1 docs.djangoproject.dev, www.djangoproject.dev
127.0.0.1 docs.djangoproject.dev, www.djangoproject.dev, dashboard.djangoproject.dev

If you're on Mac OS and don't feel like editing the ``/etc/hosts`` file
manually, there is a great preference pane called `Hosts.prefpane`_. On
Expand All @@ -71,8 +76,9 @@ To run locally, do the usual:
make run

This runs both the main site ("www") as well as the
docs site in the same process. Open http://www.djangoproject.dev:8000/
or http://docs.djangoproject.dev:8000/.
docs and dashboard site in the same process.
Open http://www.djangoproject.dev:8000/, http://docs.djangoproject.dev:8000/
or http://dashboard.djangoproject.dev:8000/.

Running the tests
-----------------
Expand Down
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"jquery.inview": "1.0.0",
"webfontloader": "~1.5.10",
"jquery.payment": "~1.1.4",
"modernizr-retina-test": "~1.0.0"
"modernizr-retina-test": "~1.0.0",
"jquery-flot": "~0.8.3"
}
}
Empty file added dashboard/__init__.py
Empty file.
27 changes: 27 additions & 0 deletions dashboard/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from __future__ import absolute_import

from django.contrib import admin
from .models import Category, Metric, Datum


@admin.register(Category)
class CategoryAdmin(admin.ModelAdmin):
list_display = ('name', 'position')
list_editable = ('position',)
ordering = ('position',)


class MetricAdmin(admin.ModelAdmin):
list_display = ('name', 'category', 'position', 'show_on_dashboard', 'show_sparkline', 'period')
list_editable = ('show_on_dashboard', 'category', 'position', 'show_sparkline', 'period')
ordering = ('category__position', 'position')
prepopulated_fields = {'slug': ['name']}


for MC in Metric.__subclasses__():
admin.site.register(MC, MetricAdmin)


@admin.register(Datum)
class DatumAdmin(admin.ModelAdmin):
list_display = ('timestamp', 'metric', 'measurement')
Binary file added dashboard/fixtures/dashboard_example_data.json.gz
Binary file not shown.
246 changes: 246 additions & 0 deletions dashboard/fixtures/dashboard_test_data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
[
{
"fields": {
"position": 1,
"name": "Activity"
},
"model": "dashboard.category",
"pk": 1
},
{
"fields": {
"position": 2,
"name": "Patches"
},
"model": "dashboard.category",
"pk": 2
},
{
"fields": {
"position": 3,
"name": "Tickets by triage stage"
},
"model": "dashboard.category",
"pk": 3
},
{
"fields": {
"position": 4,
"name": "Accepted tickets by type"
},
"model": "dashboard.category",
"pk": 4
},
{
"fields": {
"category": 3,
"show_on_dashboard": true,
"name": "Unreviewed tickets",
"period": "instant",
"show_sparkline": true,
"query": "status=!closed&stage=Unreviewed",
"unit_plural": "tickets",
"position": 1,
"slug": "unreviewed",
"unit": "ticket"
},
"model": "dashboard.tracticketmetric",
"pk": 1
},
{
"fields": {
"category": 2,
"show_on_dashboard": true,
"name": "Patches needing review",
"period": "instant",
"show_sparkline": true,
"query": "status=!closed&needs_better_patch=0&needs_tests=0&needs_docs=0&has_patch=1&stage=Accepted",
"unit_plural": "tickets",
"position": 1,
"slug": "patches",
"unit": "ticket"
},
"model": "dashboard.tracticketmetric",
"pk": 2
},
{
"fields": {
"category": 2,
"show_on_dashboard": true,
"name": "Doc. patches needing review",
"period": "instant",
"show_sparkline": true,
"query": "status=!closed&needs_better_patch=0&component=Documentation&needs_tests=0&needs_docs=0&has_patch=1&stage=Accepted",
"unit_plural": "tickets",
"position": 1,
"slug": "doc-patches",
"unit": "ticket"
},
"model": "dashboard.tracticketmetric",
"pk": 3
},
{
"fields": {
"category": 3,
"show_on_dashboard": true,
"name": "Tickets needing design decision",
"period": "instant",
"show_sparkline": true,
"query": "status=!closed&stage=Design decision needed",
"unit_plural": "tickets",
"position": 1,
"slug": "ddn",
"unit": "ticket"
},
"model": "dashboard.tracticketmetric",
"pk": 4
},
{
"fields": {
"category": 3,
"show_on_dashboard": true,
"name": "Tickets ready for commit",
"period": "instant",
"show_sparkline": true,
"query": "status=!closed&stage=Ready for checkin",
"unit_plural": "tickets",
"position": 1,
"slug": "rfc",
"unit": "ticket"
},
"model": "dashboard.tracticketmetric",
"pk": 5
},
{
"fields": {
"category": 1,
"show_on_dashboard": true,
"name": "Release blockers",
"period": "instant",
"show_sparkline": true,
"query": "status=!closed&severity=Release blocker",
"unit_plural": "tickets",
"position": 1,
"slug": "blockers",
"unit": "ticket"
},
"model": "dashboard.tracticketmetric",
"pk": 6
},
{
"fields": {
"category": 1,
"show_on_dashboard": true,
"name": "New tickets this week",
"period": "weekly",
"show_sparkline": true,
"query": "time=thisweek..",
"unit_plural": "tickets",
"position": 1,
"slug": "new-tickets-week",
"unit": "ticket"
},
"model": "dashboard.tracticketmetric",
"pk": 7
},
{
"fields": {
"category": 1,
"show_on_dashboard": true,
"name": "New tickets today",
"period": "daily",
"show_sparkline": true,
"query": "time=today..",
"unit_plural": "tickets",
"position": 1,
"slug": "new-tickets-today",
"unit": "ticket"
},
"model": "dashboard.tracticketmetric",
"pk": 8
},
{
"fields": {
"category": 2,
"show_on_dashboard": true,
"name": "\"Easy\" tickets",
"period": "instant",
"show_sparkline": true,
"query": "status=!closed&easy=1&stage=Accepted",
"unit_plural": "tickets",
"position": 1,
"slug": "easy-tickets",
"unit": "ticket"
},
"model": "dashboard.tracticketmetric",
"pk": 9
},
{
"fields": {
"category": 1,
"show_on_dashboard": true,
"name": "Commits today",
"feed_url": "http://code.djangoproject.com/timeline?changeset=on&max=0&daysback=0&format=rss",
"link_url": "http://code.djangoproject.com/timeline?changeset=on&max=0&daysback=0",
"period": "daily",
"show_sparkline": true,
"unit_plural": "commits",
"position": 1,
"slug": "commits-today",
"unit": "commit"
},
"model": "dashboard.rssfeedmetric",
"pk": 1
},
{
"fields": {
"category": 1,
"show_on_dashboard": true,
"name": "Commits in the last week",
"feed_url": "http://code.djangoproject.com/timeline?changeset=on&max=0&daysback=7&format=rss",
"link_url": "http://code.djangoproject.com/timeline?changeset=on&max=0&daysback=7",
"period": "weekly",
"show_sparkline": true,
"unit_plural": "commits",
"position": 1,
"slug": "commits-week",
"unit": "commit"
},
"model": "dashboard.rssfeedmetric",
"pk": 2
},
{
"fields": {
"category": 2,
"show_on_dashboard": true,
"name": "Pull Requests (Open)",
"link_url": "https://github.com/django/django/pulls",
"period": "instant",
"show_sparkline": true,
"unit_plural": "pull requests",
"position": 1,
"slug": "pull-requests-open",
"unit": "pull request",
"api_url": "https://api.github.com/repos/django/django/pulls?state=open"
},
"model": "dashboard.githubitemcountmetric",
"pk": 1
},
{
"fields": {
"category": 2,
"show_on_dashboard": true,
"name": "Pull Requests (Closed)",
"link_url": "https://github.com/django/django/pulls",
"period": "instant",
"show_sparkline": true,
"unit_plural": "pull requests",
"position": 1,
"slug": "pull-requests-closed",
"unit": "pull request",
"api_url": "https://api.github.com/repos/django/django/pulls?state=closed"
},
"model": "dashboard.githubitemcountmetric",
"pk": 2
}
]
Loading

0 comments on commit 07d61fb

Please sign in to comment.