diff mbox

[Branch,~linaro-validation/lava-dashboard/trunk] Rev 310: remove the image status view

Message ID 20120326212111.26242.68407.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Michael-Doyle Hudson March 26, 2012, 9:21 p.m. UTC
Merge authors:
  Michael Hudson-Doyle (mwhudson)
Related merge proposals:
  https://code.launchpad.net/~mwhudson/lava-dashboard/no-more-image-status-view/+merge/99251
  proposed by: Michael Hudson-Doyle (mwhudson)
  review: Approve - Zygmunt Krynicki (zkrynicki)
------------------------------------------------------------
revno: 310 [merge]
committer: Michael Hudson-Doyle <michael.hudson@linaro.org>
branch nick: trunk
timestamp: Tue 2012-03-27 10:19:11 +1300
message:
  remove the image status view
modified:
  dashboard_app/extension.py
  dashboard_app/models.py
  dashboard_app/urls.py
  dashboard_app/views.py
  doc/changes.rst


--
lp:lava-dashboard
https://code.launchpad.net/~linaro-validation/lava-dashboard/trunk

You are subscribed to branch lp:lava-dashboard.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dashboard/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'dashboard_app/extension.py'
--- dashboard_app/extension.py	2012-01-16 18:07:05 +0000
+++ dashboard_app/extension.py	2012-03-26 04:05:20 +0000
@@ -40,7 +40,6 @@ 
         menu = super(DashboardExtension, self).get_menu()
         menu.sub_menu = [
             Menu("About", reverse(self.main_view_name)),
-            Menu("Image Status", reverse("dashboard_app.views.image_status_list")),
             Menu("Testing Efforts", reverse("dashboard_app.views.testing_effort_list")),
             Menu("Bundle Streams", reverse("dashboard_app.views.bundle_stream_list")),
             Menu("Tests", reverse("dashboard_app.views.test_list")),
@@ -53,25 +52,9 @@ 
         return "dashboard_app/front_page_snippet.html"
 
     def get_front_page_context(self):
-        from dashboard_app.models import (DataReport, ImageHealth)
+        from dashboard_app.models import DataReport
         return {
             'report_list': DataReport.repository.filter(front_page=True),
-            'interesting_images': [
-                ImageHealth('nano', 'panda'),
-                ImageHealth('nano', 'omap3'),
-                ImageHealth('nano', 'lt-panda'),
-                ImageHealth('developer', 'panda'),
-                ImageHealth('developer', 'omap3'),
-                ImageHealth('developer', 'lt-panda'),
-                ImageHealth('alip', 'panda'),
-                ImageHealth('alip', 'omap3'),
-                ImageHealth('alip', 'lt-panda'),
-                ImageHealth('alip', 'lt-panda-x11-base-natty'),
-                ImageHealth('ubuntu-desktop', 'panda'),
-                ImageHealth('ubuntu-desktop', 'omap3'),
-                ImageHealth('ubuntu-desktop', 'lt-panda'),
-                ImageHealth('ubuntu-desktop', 'lt-panda-x11-base-natty'),
-            ]
         }
 
     @property

=== modified file 'dashboard_app/models.py'
--- dashboard_app/models.py	2012-03-15 03:08:00 +0000
+++ dashboard_app/models.py	2012-03-26 04:00:57 +0000
@@ -1364,124 +1364,6 @@ 
         return self._data['front_page']
 
 
-class ImageHealth(object):
-
-    def __init__(self, rootfs_type, hwpack_type):
-        self.rootfs_type = rootfs_type
-        self.hwpack_type = hwpack_type
-
-    @models.permalink
-    def get_absolute_url(self):
-        return ("dashboard_app.views.image_status_detail", [
-            self.rootfs_type, self.hwpack_type])
-
-    def get_tests(self):
-        return Test.objects.filter(test_runs__in=self.get_test_runs()).distinct()
-
-    def current_health_for_test(self, test):
-        test_run = self.get_current_test_run(test)
-        test_results = test_run.test_results
-        fail_count = test_results.filter(
-            result=TestResult.RESULT_FAIL).count()
-        pass_count = test_results.filter(
-            result=TestResult.RESULT_PASS).count()
-        total_count = test_results.count()
-        return {
-            "test_run": test_run,
-            "total_count": total_count,
-            "fail_count": fail_count,
-            "pass_count": pass_count,
-            "other_count": total_count - (fail_count + pass_count),
-            "fail_percent": fail_count * 100.0 / total_count if total_count > 0 else None,
-        }
-    
-    def overall_health_for_test(self, test):
-        test_run_list = self.get_all_test_runs_for_test(test)
-        test_result_list = TestResult.objects.filter(test_run__in=test_run_list)
-        fail_result_list = test_result_list.filter(result=TestResult.RESULT_FAIL)
-        pass_result_list = test_result_list.filter(result=TestResult.RESULT_PASS)
-
-        total_count = test_result_list.count()
-        fail_count = fail_result_list.count()
-        pass_count = pass_result_list.count()
-        fail_percent = fail_count * 100.0 / total_count if total_count > 0 else None
-        return {
-            "total_count": total_count,
-            "total_run_count": test_run_list.count(),
-            "fail_count": fail_count,
-            "pass_count": pass_count,
-            "other_count": total_count - fail_count - pass_count,
-            "fail_percent": fail_percent,
-        }
-
-    def get_recent_test_runs(self, last_n_days=7 * 2):
-        until = datetime.datetime.now()
-        since = until - datetime.timedelta(days=last_n_days)
-        return self.get_test_runs(
-        ).select_related(
-            'denormalization',
-            'bundle',
-            'bundle__bundle_stream',
-            'test',
-        ).filter(
-            analyzer_assigned_date__range=(since, until)
-        ).order_by('-analyzer_assigned_date')
-
-    def get_chart_data(self):
-        return TestResult.objects.select_related(
-        ).filter(
-            test_run__in=[run.pk for run in self.get_recent_test_runs().only('id').order_by()]
-        ).values(
-            'test_run__analyzer_assigned_date'
-        ).extra(
-            select={'bucket': 'date(analyzer_assigned_date)'},
-        ).values(
-            'bucket', 'result'
-        ).annotate(
-            count=models.Count('result')
-        ).order_by('result')
-
-    def get_test_runs(self):
-        return TestRun.objects.select_related(
-        ).filter(
-            bundle__bundle_stream__pathname="/anonymous/lava-daily/"
-        ).filter(
-            attributes__name='rootfs.type'
-        ).filter(
-            attributes__value=self.rootfs_type
-        ).filter(
-            attributes__name='hwpack.type'
-        ).filter(
-            attributes__value=self.hwpack_type
-        )
-
-    def get_current_test_run(self, test):
-        return self.get_all_test_runs_for_test(test).order_by('-analyzer_assigned_date')[0]
-
-    def get_all_test_runs_for_test(self, test):
-        return self.get_test_runs().filter(test=test)
-
-    @classmethod
-    def get_rootfs_list(self):
-        rootfs_list = [
-            attr['value'] 
-            for attr in NamedAttribute.objects.filter(
-                name='rootfs.type').values('value').distinct()]
-        try:
-            rootfs_list.remove('android')
-        except ValueError:
-            pass
-        return rootfs_list
-
-    @classmethod
-    def get_hwpack_list(self):
-        hwpack_list = [
-            attr['value'] 
-            for attr in NamedAttribute.objects.filter(
-                name='hwpack.type').values('value').distinct()]
-        return hwpack_list
-
-
 class Tag(models.Model):
     """
     Tag used for marking test runs.

=== modified file 'dashboard_app/urls.py'
--- dashboard_app/urls.py	2012-03-16 03:31:30 +0000
+++ dashboard_app/urls.py	2012-03-26 04:00:57 +0000
@@ -66,9 +66,6 @@ 
     url(r'^permalink/test-result/(?P<analyzer_assigned_uuid>[a-zA-Z0-9-]+)/(?P<relative_index>[0-9]+)/(?P<trailing>.*)$', 'redirect_to_test_result'),
     url(r'^permalink/bundle/(?P<content_sha1>[0-9a-z]+)/$', 'redirect_to_bundle'),
     url(r'^permalink/bundle/(?P<content_sha1>[0-9a-z]+)/(?P<trailing>.*)$', 'redirect_to_bundle'),
-    url(r'^image_status/$', 'image_status_list'),
-    url(r'^image_status/(?P<rootfs_type>[a-zA-Z0-9_-]+)\+(?P<hwpack_type>[a-zA-Z0-9_-]+)/$', 'image_status_detail'),
-    url(r'^image_status/(?P<rootfs_type>[a-zA-Z0-9_-]+)\+(?P<hwpack_type>[a-zA-Z0-9_-]+)/test-history/(?P<test_id>[^/]+)/$', 'image_test_history'),
     url(r'^efforts/$', 'testing_effort_list'),
     url(r'^efforts/(?P<pk>[0-9]+)/$', 'testing_effort_detail'),
     url(r'^efforts/(?P<pk>[0-9]+)/update/$', 'testing_effort_update'),

=== modified file 'dashboard_app/views.py'
--- dashboard_app/views.py	2012-03-20 21:19:58 +0000
+++ dashboard_app/views.py	2012-03-26 04:05:55 +0000
@@ -49,7 +49,6 @@ 
     BundleStream,
     DataReport,
     DataView,
-    ImageHealth,
     Tag,
     Test,
     TestResult,
@@ -721,55 +720,6 @@ 
     return redirect_to(request, bundle, trailing)
 
 
-@BreadCrumb("Image Status Matrix", parent=index)
-def image_status_list(request):
-    return render_to_response(
-        "dashboard_app/image_status_list.html", {
-            'hwpack_list': ImageHealth.get_hwpack_list(),
-            'rootfs_list': ImageHealth.get_rootfs_list(),
-            'ImageHealth': ImageHealth,
-            'bread_crumb_trail': BreadCrumbTrail.leading_to(image_status_list)
-        }, RequestContext(request))
-
-
-@BreadCrumb(
-    "Image Status for {rootfs_type} + {hwpack_type}",
-    parent=image_status_list,
-    needs=["rootfs_type", "hwpack_type"])
-def image_status_detail(request, rootfs_type, hwpack_type):
-    image_health = ImageHealth(rootfs_type, hwpack_type)
-    return render_to_response(
-        "dashboard_app/image_status_detail.html", {
-            'image_health': image_health,
-            'bread_crumb_trail': BreadCrumbTrail.leading_to(
-                image_status_detail,
-                rootfs_type=rootfs_type,
-                hwpack_type=hwpack_type),
-        }, RequestContext(request))
-
-
-@BreadCrumb(
-    "Test history for {test_id}",
-    parent=image_status_detail,
-    needs=["rootfs_type", "hwpack_type", "test_id"])
-def image_test_history(request, rootfs_type, hwpack_type, test_id):
-    image_health = ImageHealth(rootfs_type, hwpack_type)
-    test = get_object_or_404(Test, test_id=test_id)
-    test_run_list = image_health.get_test_runs().filter(test=test)
-    return render_to_response(
-        "dashboard_app/image_test_history.html", {
-            'test_run_list': test_run_list,
-            'test': test,
-            'image_health': image_health,
-            'bread_crumb_trail': BreadCrumbTrail.leading_to(
-                image_test_history,
-                rootfs_type=rootfs_type,
-                hwpack_type=hwpack_type,
-                test=test,
-                test_id=test_id),
-        }, RequestContext(request))
-
-
 @BreadCrumb("Testing efforts", parent=index)
 def testing_effort_list(request):
     return render_to_response(

=== modified file 'doc/changes.rst'
--- doc/changes.rst	2012-03-26 20:44:00 +0000
+++ doc/changes.rst	2012-03-26 21:19:01 +0000
@@ -6,6 +6,8 @@ 
 Version 0.15
 ============
 
+* Remove the image status view.
+
 .. _version_0_14:
 
 Version 0.14