From 8061a65720b4cf3b5ffc9a80b26a4efe94690f3e Mon Sep 17 00:00:00 2001 From: Andrew Bonventre Date: Wed, 16 Dec 2015 18:34:58 -0500 Subject: [PATCH] Implement selection of patch set in diff view Feature: Issue 3645 Change-Id: Ic7f408069abce6005392a4a222cc2a1fd4f7573b --- polygerrit-ui/app/elements/gr-diff-view.html | 9 ++ polygerrit-ui/app/elements/gr-diff.html | 33 +++++-- .../app/elements/gr-patch-range-select.html | 95 +++++++++++++++++++ .../app/test/gr-patch-range-select-test.html | 93 ++++++++++++++++++ polygerrit-ui/app/test/index.html | 1 + 5 files changed, 221 insertions(+), 10 deletions(-) create mode 100644 polygerrit-ui/app/elements/gr-patch-range-select.html create mode 100644 polygerrit-ui/app/test/gr-patch-range-select-test.html diff --git a/polygerrit-ui/app/elements/gr-diff-view.html b/polygerrit-ui/app/elements/gr-diff-view.html index 4945a67956..9829aeba7e 100644 --- a/polygerrit-ui/app/elements/gr-diff-view.html +++ b/polygerrit-ui/app/elements/gr-diff-view.html @@ -55,6 +55,7 @@ limitations under the License. change-num="[[_changeNum]]" patch-range="[[_patchRange]]" path="[[_path]]" + available-patches="[[_computeAvailablePatches(_change.revisions)]]" on-render="_handleDiffRender"> @@ -156,6 +157,14 @@ limitations under the License. } }, + _computeAvailablePatches: function(revisions) { + var patchNums = []; + for (var rev in revisions) { + patchNums.push(revisions[rev]._number); + } + return patchNums.sort(function(a, b) { return a - b; }); + }, + _computeChangePath: function(changeNum) { return '/c/' + changeNum; }, diff --git a/polygerrit-ui/app/elements/gr-diff.html b/polygerrit-ui/app/elements/gr-diff.html index 23d14b5a81..ebc67b991f 100644 --- a/polygerrit-ui/app/elements/gr-diff.html +++ b/polygerrit-ui/app/elements/gr-diff.html @@ -17,12 +17,16 @@ limitations under the License. + + + diff --git a/polygerrit-ui/app/test/gr-patch-range-select-test.html b/polygerrit-ui/app/test/gr-patch-range-select-test.html new file mode 100644 index 0000000000..c2b19e7542 --- /dev/null +++ b/polygerrit-ui/app/test/gr-patch-range-select-test.html @@ -0,0 +1,93 @@ + + + + +gr-patch-range-select + + + + + + + + + + + + + diff --git a/polygerrit-ui/app/test/index.html b/polygerrit-ui/app/test/index.html index 231f960006..1ba06b00d9 100644 --- a/polygerrit-ui/app/test/index.html +++ b/polygerrit-ui/app/test/index.html @@ -34,6 +34,7 @@ limitations under the License. 'gr-diff-test.html', 'gr-diff-view-test.html', 'gr-file-list-test.html', + 'gr-patch-range-select-test.html', 'gr-reply-dropdown-test.html', 'gr-search-bar-test.html', ].forEach(function(file) {