Title: [184661] trunk/Websites/perf.webkit.org
Revision
184661
Author
[email protected]
Date
2015-05-20 14:52:35 -0700 (Wed, 20 May 2015)

Log Message

UI to associate bugs with an analysis task is crappy
https://bugs.webkit.org/show_bug.cgi?id=145198

Reviewed by Andreas Kling.

Make the UI less crappy by linkifying bug numbers and adding an explicit button to disassociate
a bug and a separate select view with a text field to associate a new bug instead of implicitly
updating or deleting the existing record based on what the user had typed.

* init-database.sql: Removed the constraint that each bug tracker should appear exactly once for
a given analysis task since it's perfectly reasonable for a given task to be associated with
multiple WebKit bugs.

* public/privileged-api/associate-bug.php:
(main): Only remove the bug specified by newly added bugToDelete instead of implicitly deleting
one that matches the analysis task and the bug tracker when the bug number is falsey.

* public/v2/analysis.js:
(App.Bug.url): Added.
(App.BugAdapter.deleteRecord): Added. Uses the privileged API to delete the record.

* public/v2/app.css:

* public/v2/app.js:
(App.AnalysisTaskController.actions.addBug): Added.
(App.AnalysisTaskController.actions.deleteBug): Added.
(App.AnalysisTaskController.associateBug): Deleted.

* public/v2/index.html: Updated the templates.

* public/v2/manifest.js:
(App.BugTracker.urlFromBugNumber): Added.

Modified Paths

Diff

Modified: trunk/Websites/perf.webkit.org/ChangeLog (184660 => 184661)


--- trunk/Websites/perf.webkit.org/ChangeLog	2015-05-20 21:38:01 UTC (rev 184660)
+++ trunk/Websites/perf.webkit.org/ChangeLog	2015-05-20 21:52:35 UTC (rev 184661)
@@ -1,5 +1,40 @@
 2015-05-20  Ryosuke Niwa  <[email protected]>
 
+        UI to associate bugs with an analysis task is crappy
+        https://bugs.webkit.org/show_bug.cgi?id=145198
+
+        Reviewed by Andreas Kling.
+
+        Make the UI less crappy by linkifying bug numbers and adding an explicit button to disassociate
+        a bug and a separate select view with a text field to associate a new bug instead of implicitly
+        updating or deleting the existing record based on what the user had typed.
+
+        * init-database.sql: Removed the constraint that each bug tracker should appear exactly once for
+        a given analysis task since it's perfectly reasonable for a given task to be associated with
+        multiple WebKit bugs.
+
+        * public/privileged-api/associate-bug.php:
+        (main): Only remove the bug specified by newly added bugToDelete instead of implicitly deleting
+        one that matches the analysis task and the bug tracker when the bug number is falsey.
+
+        * public/v2/analysis.js:
+        (App.Bug.url): Added.
+        (App.BugAdapter.deleteRecord): Added. Uses the privileged API to delete the record.
+
+        * public/v2/app.css:
+
+        * public/v2/app.js:
+        (App.AnalysisTaskController.actions.addBug): Added.
+        (App.AnalysisTaskController.actions.deleteBug): Added.
+        (App.AnalysisTaskController.associateBug): Deleted.
+
+        * public/v2/index.html: Updated the templates.
+
+        * public/v2/manifest.js:
+        (App.BugTracker.urlFromBugNumber): Added.
+
+2015-05-20  Ryosuke Niwa  <[email protected]>
+
         A/B testing rootSets should provide commit times as well as revisions
         https://bugs.webkit.org/show_bug.cgi?id=145207
 

Modified: trunk/Websites/perf.webkit.org/init-database.sql (184660 => 184661)


--- trunk/Websites/perf.webkit.org/init-database.sql	2015-05-20 21:38:01 UTC (rev 184660)
+++ trunk/Websites/perf.webkit.org/init-database.sql	2015-05-20 21:52:35 UTC (rev 184661)
@@ -200,8 +200,7 @@
     bug_id serial PRIMARY KEY,
     bug_task integer REFERENCES analysis_tasks NOT NULL,
     bug_tracker integer REFERENCES bug_trackers NOT NULL,
-    bug_number integer NOT NULL,
-    CONSTRAINT bug_task_and_tracker_must_be_unique UNIQUE(bug_task, bug_tracker));
+    bug_number integer NOT NULL);
 
 CREATE TABLE build_triggerables (
     triggerable_id serial PRIMARY KEY,

Modified: trunk/Websites/perf.webkit.org/public/privileged-api/associate-bug.php (184660 => 184661)


--- trunk/Websites/perf.webkit.org/public/privileged-api/associate-bug.php	2015-05-20 21:38:01 UTC (rev 184660)
+++ trunk/Websites/perf.webkit.org/public/privileged-api/associate-bug.php	2015-05-20 21:52:35 UTC (rev 184661)
@@ -8,25 +8,23 @@
     $analysis_task_id = array_get($data, 'task');
     $bug_tracker_id = array_get($data, 'bugTracker');
     $bug_number = array_get($data, 'number');
+    $bug_id = array_get($data, 'bugToDelete');
 
-    require_format('AnalysisTask', $analysis_task_id, '/^\d+$/');
-    require_format('BugTracker', $bug_tracker_id, '/^\d+$/');
-    require_format('BugNumber', $bug_number, '/^\d*$/');
-
     $db = connect();
     $db->begin_transaction();
 
-    $bug_id = NULL;
-    if (!$bug_number) {
-        $count = $db->query_and_get_affected_rows("DELETE FROM bugs WHERE bug_task = $1 AND bug_tracker = $2",
-            array($analysis_task_id, $bug_tracker_id));
-        if ($count > 1) {
+    if ($bug_id) {
+        require_format('BugToDelete', $bug_id, '/^\d+$/');
+        $count = $db->query_and_get_affected_rows("DELETE FROM bugs WHERE bug_id = $1", array($bug_id));
+        if ($count != 1) {
             $db->rollback_transaction();
             exit_with_error('UnexpectedNumberOfAffectedRows', array('affectedRows' => $count));
         }
     } else {
-        $bug_id = $db->update_or_insert_row('bugs', 'bug', array('task' => $analysis_task_id, 'tracker' => $bug_tracker_id),
-            array('task' => $analysis_task_id, 'tracker' => $bug_tracker_id, 'number' => $bug_number));
+        require_format('AnalysisTask', $analysis_task_id, '/^\d+$/');
+        require_format('BugTracker', $bug_tracker_id, '/^\d+$/');
+        require_format('BugNumber', $bug_number, '/^\d+$/');
+        $bug_id = $db->insert_row('bugs', 'bug', array('task' => $analysis_task_id, 'tracker' => $bug_tracker_id, 'number' => $bug_number));
     }
     $db->commit_transaction();
 

Modified: trunk/Websites/perf.webkit.org/public/v2/analysis.js (184660 => 184661)


--- trunk/Websites/perf.webkit.org/public/v2/analysis.js	2015-05-20 21:38:01 UTC (rev 184660)
+++ trunk/Websites/perf.webkit.org/public/v2/analysis.js	2015-05-20 21:52:35 UTC (rev 184661)
@@ -61,6 +61,9 @@
     bugTracker: DS.belongsTo('BugTracker'),
     createdAt: DS.attr('date'),
     number: DS.attr('number'),
+    url: function () {
+        return this.get('bugTracker').urlFromBugNumber(this.get('number'));
+    }.property('bugTracker.bugUrl', 'number'),
     label: function () {
         return this.get('bugTracker').get('label') + ': ' + this.get('number');
     }.property('name', 'bugTracker'),
@@ -95,6 +98,12 @@
             param['id'] = data['bugId'];
             return {'bug': param};
         });
+    },
+    deleteRecord: function (store, type, record)
+    {
+        return PrivilegedAPI.sendRequest('associate-bug', {bugToDelete: record.get('id')}).then(function () {
+            return {};
+        });
     }
 });
 

Modified: trunk/Websites/perf.webkit.org/public/v2/app.css (184660 => 184661)


--- trunk/Websites/perf.webkit.org/public/v2/app.css	2015-05-20 21:38:01 UTC (rev 184660)
+++ trunk/Websites/perf.webkit.org/public/v2/app.css	2015-05-20 21:52:35 UTC (rev 184661)
@@ -587,6 +587,12 @@
     font-size: 0.9rem;
 }
 
+.analysis-bugs .icon-button {
+    margin-left: 0.2rem;
+    width: 0.8rem;
+    height: 0.8rem;
+}
+
 .analysis-bugs .hidden {
     display: none;
 }

Modified: trunk/Websites/perf.webkit.org/public/v2/app.js (184660 => 184661)


--- trunk/Websites/perf.webkit.org/public/v2/app.js	2015-05-20 21:38:01 UTC (rev 184660)
+++ trunk/Websites/perf.webkit.org/public/v2/app.js	2015-05-20 21:52:35 UTC (rev 184661)
@@ -1196,6 +1196,7 @@
                 elementId: 'bug-' + bugTracker.get('id'),
                 content: bugTracker,
                 bugNumber: bugNumber,
+                bugUrl: bugTracker.urlFromBugNumber(bugNumber),
                 editedBugNumber: bugNumber,
             });
         }));
@@ -1295,16 +1296,26 @@
         });
     }.observes('analysisPoints'),
     actions: {
-        associateBug: function (bugTracker, bugNumber)
+        addBug: function (bugTracker, bugNumber)
         {
             var model = this.get('model');
-            this.store.createRecord('bug',
-                {task: this.get('model'), bugTracker: bugTracker.get('content'), number: bugNumber}).save().then(function () {
-                    // FIXME: Should we notify the user?
-                }, function (error) {
-                    alert('Failed to associate the bug: ' + error);
-                });
+            if (!bugTracker)
+                bugTracker = this.get('bugTrackers').objectAt(0);
+            var bug = {task: this.get('model'), bugTracker: bugTracker.get('content'), number: bugNumber};
+            this.store.createRecord('bug', bug).save().then(function () {
+                alert('Associated the ' + bugTracker.get('name') + ' ' + bugNumber + ' with this analysis.');
+            }, function (error) {
+                alert('Failed to associate the bug: ' + error);
+            });
         },
+        deleteBug: function (bug)
+        {
+            bug.destroyRecord().then(function () {
+                alert('Successfully deassociated the bug.');
+            }, function (error) {
+                alert('Failed to disassociate the bug: ' + error);
+            });
+        },
         saveStatus: function ()
         {
             var chosenResult = this.get('chosenAnalysisResult');

Modified: trunk/Websites/perf.webkit.org/public/v2/index.html (184660 => 184661)


--- trunk/Websites/perf.webkit.org/public/v2/index.html	2015-05-20 21:38:01 UTC (rev 184660)
+++ trunk/Websites/perf.webkit.org/public/v2/index.html	2015-05-20 21:52:35 UTC (rev 184661)
@@ -86,7 +86,7 @@
                                 {{#if chartData}}
                                     <div class="dashboard-status">
                                         {{#if latestStatus}}
-                                            {{latestStatus.currentValue}} {{chartData.unit}}
+                                            {{latestStatus.currentValue}}{{chartData.unit}}
                                             {{#if latestStatus.label}}
                                                 <span {{bind-attr class=":status-label latestStatus.className"}}>{{latestStatus.label}}</span>
                                             {{/if}}
@@ -264,9 +264,8 @@
                     <tr>
                         <th>{{label}}</th>
                         <td>
-                            {{#each bugs}}
-                                <a {{bind-attr href="" target="_blank">{{bugNumber}}</a>
-                            {{/each}}
+                        [{{bugUrl}}]
+                        <a {{bind-attr href="" target="_blank">{{bugNumber}}</a>
                         </td>
                     </tr>
                 {{/if}}
@@ -736,16 +735,26 @@
     <script type="text/x-handlebars" data-template-name="analysisStatusForm">
         <table class="analysis-bugs">
             <tbody>
-                {{#each bugTrackers}}
+                {{#each model.bugs}}
                     <tr>
-                        <th><label {{bind-attr for=""
+                        <th>{{bugTracker.name}}</th>
                         <td>
-                            <form {{action "associateBug" this editedBugNumber on="submit"}}>
-                                {{input id=elementId type=text value=editedBugNumber}}
-                            </form>
+                            <a {{bind-attr href="" target="_blank">{{number}}</a>
+                            <a href="" {{action "deleteBug" this}}>{{partial "close-button"}}</a>
                         </td>
                     </tr>
                 {{/each}}
+                {{#if bugTrackers}}
+                    <tr>
+                        <td>
+                            {{view Ember.Select content=bugTrackers optionValuePath="content" optionLabelPath="content.name" value=chosenBugTracker}}
+                        </td>
+                        <td>
+                            {{input id=elementId type=text value=editedBugNumber}}
+                            <button {{action "addBug" chosenBugTracker editedBugNumber}}>Add</button>
+                        </td>
+                    </tr>
+                {{/if}}
             </tbody>
             <tbody>
                 <tr>

Modified: trunk/Websites/perf.webkit.org/public/v2/manifest.js (184660 => 184661)


--- trunk/Websites/perf.webkit.org/public/v2/manifest.js	2015-05-20 21:38:01 UTC (rev 184660)
+++ trunk/Websites/perf.webkit.org/public/v2/manifest.js	2015-05-20 21:52:35 UTC (rev 184661)
@@ -52,6 +52,10 @@
     bugUrl: DS.attr('string'),
     newBugUrl: DS.attr('string'),
     repositories: DS.hasMany('repository'),
+    urlFromBugNumber: function (bugNumber) {
+        var template = this.get('bugUrl');
+        return template && bugNumber ? template.replace(/\$number/g, bugNumber) : null;
+    }
 });
 
 App.DateArrayTransform = DS.Transform.extend({
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to