Merge "Add topic to branch column in dashboard"

This commit is contained in:
Kasper Nilsson 2017-06-12 17:18:25 +00:00 committed by Gerrit Code Review
commit 3fce43cd9d
3 changed files with 23 additions and 8 deletions
polygerrit-ui/app/elements/change-list/gr-change-list-item

@ -140,8 +140,8 @@ limitations under the License.
</td>
<td class="cell branch"
hidden$="[[isColumnHidden('Branch', visibleChangeTableColumns)]]">
<a href$="[[_computeProjectBranchURL(change.project, change.branch)]]">
[[change.branch]]
<a href$="[[_computeProjectBranchURL(change)]]">
[[_computeBranchText(change)]]
</a>
</td>
<td class="cell updated"

@ -106,10 +106,20 @@
this.encodeURL(project, false);
},
_computeProjectBranchURL(project, branch) {
// @see Issue 4255.
return this._computeProjectURL(project) +
'+branch:' + this.encodeURL(branch, false);
_computeProjectBranchURL(change) {
// @see Issue 4255, Issue 6195.
let output = this._computeProjectURL(change.project);
output += '+branch:' + this.encodeURL(change.branch, false);
if (change.topic) {
output += '+topic:' + this.encodeURL(change.topic, false);
}
return output;
},
_computeBranchText(change) {
let output = change.branch;
if (change.topic) { output += ` (${change.topic})`; }
return output;
},
});
})();

@ -130,10 +130,15 @@ limitations under the License.
assert.equal(element._computeProjectURL('combustible/stuff'),
'/q/status:open+project:combustible%252Fstuff');
assert.equal(element._computeProjectBranchURL(
'combustible-stuff', 'le/mons'),
const change = {project: 'combustible-stuff', branch: 'le/mons'};
assert.equal(element._computeProjectBranchURL(change),
'/q/status:open+project:combustible-stuff+branch:le%252Fmons');
change.topic = 'test/test';
assert.equal(element._computeProjectBranchURL(change),
'/q/status:open+project:combustible-stuff+branch:le%252Fmons' +
'+topic:test%252Ftest');
element.change = {_number: 42};
assert.equal(element.changeURL, '/c/42/');
element.change = {_number: 43};