← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wallyworld/launchpad/display-artifact-info-type-979589 into lp:launchpad

 

Ian Booth has proposed merging lp:~wallyworld/launchpad/display-artifact-info-type-979589 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #979589 in Launchpad itself: "Display information type  of each artifact on sharing details page"
  https://bugs.launchpad.net/launchpad/+bug/979589

For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/display-artifact-info-type-979589/+merge/101698

== Implementation ==

Add display of the artifact's information type to the sharing details page.
A bit of lint fixing in the css file also.


== Tests ==

Update PillarSharingDetailsMixin.test_view_data_model()
Update test_sharingdetails yui tests

== Lint ==

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/canonical/launchpad/icing/css/components/sharing.css
  lib/lp/registry/browser/pillar.py
  lib/lp/registry/browser/tests/test_pillar_sharing.py
  lib/lp/registry/javascript/sharing/sharingdetails.js
  lib/lp/registry/javascript/sharing/tests/test_sharingdetails.js
  lib/lp/registry/templates/pillar-sharing-details.pt
-- 
https://code.launchpad.net/~wallyworld/launchpad/display-artifact-info-type-979589/+merge/101698
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wallyworld/launchpad/display-artifact-info-type-979589 into lp:launchpad.
=== modified file 'lib/canonical/launchpad/icing/css/components/sharing.css'
--- lib/canonical/launchpad/icing/css/components/sharing.css	2012-03-10 15:33:33 +0000
+++ lib/canonical/launchpad/icing/css/components/sharing.css	2012-04-12 09:28:17 +0000
@@ -2,15 +2,19 @@
     padding: 2px 0 2px 0;
     margin: 0;
     }
+
 table.sharing ul {
     margin-top: 3px;
     }
+
 table.sharing ul.horizontal li {
     display: inline;
     list-style-type: none;
     padding-right: 10px;
     }
-table.sharing ul.horizontal li div {
+
+table.sharing ul.horizontal li div,
+.information_type {
     display: inline;
     border-radius: 5px;
     background-color: #dcdcdc;
@@ -18,6 +22,7 @@
     width: auto;
     overflow: hidden;
     }
+
 table.sharing tr.spacebefore > td {
     padding-top: 1em;
     }

=== modified file 'lib/lp/registry/browser/pillar.py'
--- lib/lp/registry/browser/pillar.py	2012-04-11 02:15:10 +0000
+++ lib/lp/registry/browser/pillar.py	2012-04-12 09:28:17 +0000
@@ -48,6 +48,7 @@
     IBugTaskSet,
     )
 from lp.code.interfaces.branch import IBranch
+from lp.registry.enums import InformationType
 from lp.registry.interfaces.distribution import IDistribution
 from lp.registry.interfaces.distributionsourcepackage import (
     IDistributionSourcePackage,
@@ -449,11 +450,15 @@
     def _build_branch_template_data(self, branches, request):
         branch_data = []
         for branch in branches:
+            # At the moment, all branches displayed on the sharing details
+            # page are private.
+            information_type = InformationType.USERDATA.title
             branch_data.append(dict(
                 self_link=absoluteURL(branch, request),
                 web_link=canonical_url(branch, path_only_if_possible=True),
                 branch_name=branch.unique_name,
-                branch_id=branch.id))
+                branch_id=branch.id,
+                information_type=information_type))
         return branch_data
 
     def _build_bug_template_data(self, bugtasks, request):
@@ -462,11 +467,12 @@
             web_link = canonical_url(bugtask, path_only_if_possible=True)
             self_link = absoluteURL(bugtask.bug, request)
             importance = bugtask.importance.title.lower()
-
+            information_type = bugtask.bug.information_type.title
             bug_data.append(dict(
                 self_link=self_link,
                 web_link=web_link,
                 bug_summary=bugtask.bug.title,
                 bug_id=bugtask.bug.id,
-                bug_importance=importance))
+                bug_importance=importance,
+                information_type=information_type))
         return bug_data

=== modified file 'lib/lp/registry/browser/tests/test_pillar_sharing.py'
--- lib/lp/registry/browser/tests/test_pillar_sharing.py	2012-04-11 02:15:10 +0000
+++ lib/lp/registry/browser/tests/test_pillar_sharing.py	2012-04-12 09:28:17 +0000
@@ -173,6 +173,7 @@
                 'bug_id': self.bug.id,
                 'bug_summary': self.bug.title,
                 'bug_importance': bugtask.importance.title.lower(),
+                'information_type': self.bug.information_type.title,
                 'web_link': canonical_url(
                     bugtask, path_only_if_possible=True),
                 'self_link': absoluteURL(self.bug, request),
@@ -181,6 +182,7 @@
                 self.assertEqual({
                     'branch_id': self.branch.id,
                     'branch_name': self.branch.unique_name,
+                    'information_type': InformationType.USERDATA.title,
                     'web_link': canonical_url(
                         self.branch, path_only_if_possible=True),
                     'self_link': absoluteURL(self.branch, request),

=== modified file 'lib/lp/registry/javascript/sharing/sharingdetails.js'
--- lib/lp/registry/javascript/sharing/sharingdetails.js	2012-04-06 17:28:25 +0000
+++ lib/lp/registry/javascript/sharing/sharingdetails.js	2012-04-12 09:28:17 +0000
@@ -276,6 +276,11 @@
         '    &nbsp;</a>',
         '    </span>',
         '    </td>',
+        '   <td>',
+        '   <span class="information_type">',
+        '  {{information_type}}',
+        '   </span>',
+        '   </td>',
         '</tr>'
         ].join(' ');
     },
@@ -297,6 +302,11 @@
         '    &nbsp;</a>',
         '    </span>',
         '    </td>',
+        '   <td>',
+        '   <span class="information_type">',
+        '  {{information_type}}',
+        '   </span>',
+        '   </td>',
         '</tr>'
         ].join(' ');
     }

=== modified file 'lib/lp/registry/javascript/sharing/tests/test_sharingdetails.js'
--- lib/lp/registry/javascript/sharing/tests/test_sharingdetails.js	2012-04-06 17:28:25 +0000
+++ lib/lp/registry/javascript/sharing/tests/test_sharingdetails.js	2012-04-12 09:28:17 +0000
@@ -22,7 +22,8 @@
                             web_link:'/bugs/2',
                             bug_id: '2',
                             bug_importance: 'critical',
-                            bug_summary:'Everything is broken.'
+                            bug_summary:'Everything is broken.',
+                            information_type: 'Embargoed Security'
                         }
                     ],
                     branches: [
@@ -30,7 +31,8 @@
                             self_link: 'api/devel/~someone/+junk/somebranch',
                             web_link:'/~someone/+junk/somebranch',
                             branch_id: '2',
-                            branch_name:'lp:~someone/+junk/somebranch'
+                            branch_name:'lp:~someone/+junk/somebranch',
+                            information_type: 'User Data'
                         }
                     ]
                 }
@@ -95,22 +97,30 @@
         test_render_branches: function () {
             this.details_widget = this._create_Widget();
             this.details_widget.render();
+            var row = Y.one(
+                '#sharing-table-body tr#shared-branch-2');
+            var web_link = row.one('a');
             var expected = "lp:~someone/+junk/somebranch";
-            var web_link = Y.one(
-                '#sharing-table-body tr#shared-branch-2').one('a');
             var actual_text = web_link.get('text').replace(/\s+/g, '');
             Assert.areEqual(expected, actual_text);
+            var info_type = row.one('.information_type');
+            var info_text = info_type.get('text').replace(/\s+/g, '');
+            Assert.areEqual('UserData', info_text);
         },
 
         // Test that bugs are correctly rendered.
         test_render_bugs: function () {
             this.details_widget = this._create_Widget();
             this.details_widget.render();
+            var row = Y.one(
+                '#sharing-table-body tr#shared-bug-2');
+            var web_link = row.one('a');
             var expected = "Everythingisbroken.";
-            var web_link = Y.one(
-                '#sharing-table-body tr#shared-bug-2').one('a');
             var actual_text = web_link.get('text').replace(/\s+/g, '');
             Assert.areEqual(expected, actual_text);
+            var info_type = row.one('.information_type');
+            var info_text = info_type.get('text').replace(/\s+/g, '');
+            Assert.areEqual('EmbargoedSecurity', info_text);
         },
 
         // When the bug revoke link is clicked, the correct event is published.

=== modified file 'lib/lp/registry/templates/pillar-sharing-details.pt'
--- lib/lp/registry/templates/pillar-sharing-details.pt	2012-04-11 02:53:26 +0000
+++ lib/lp/registry/templates/pillar-sharing-details.pt	2012-04-12 09:28:17 +0000
@@ -43,16 +43,20 @@
       <col width="auto"/>
       <col width="auto"/>
       <col width="auto"/>
+      <col width="auto"/>
       <thead>
         <tr>
           <th colspan="4" width="">
             <a href="#" class="sortheader">Subscribed Bug Report or Branch</a>
           </th>
+          <th>
+            Information Type
+          </th>
         </tr>
       </thead>
       <tbody id="sharing-table-body">
           <tr>
-              <td colspan="4">
+              <td colspan="5">
                   There are no shared bugs or branches.
               </td>
           </tr>