From f081d7236f5ae4c04f9fb078b77353b331f94f46 Mon Sep 17 00:00:00 2001 From: Kasper Nilsson Date: Fri, 18 Nov 2016 10:54:24 -0800 Subject: [PATCH] UI side of patchset descriptions Adds an editable label allowing the change owner to edit patchset descriptions within the UI. Also re-styles the dropdowns pertaining to patchsets for better UX. Feature: Issue 4544 Change-Id: I15c0f8ab6a60c3a06482fe152539615d31eeae0f --- .../gr-patch-set-behavior.html | 8 +- .../gr-patch-set-behavior_test.html | 4 +- .../gr-change-actions/gr-change-actions.js | 2 +- .../change/gr-change-view/gr-change-view.html | 24 ++++-- .../change/gr-change-view/gr-change-view.js | 73 ++++++++++++++++--- .../gr-change-view/gr-change-view_test.html | 60 ++++++++++++++- .../change/gr-file-list/gr-file-list.html | 12 +-- .../change/gr-file-list/gr-file-list.js | 14 +++- .../gr-file-list/gr-file-list_test.html | 21 ++++-- .../gr-patch-range-select.html | 2 +- .../gr-patch-range-select.js | 2 +- .../gr-editable-label/gr-editable-label.html | 26 ++++--- .../gr-rest-api-interface.js | 6 ++ 13 files changed, 199 insertions(+), 55 deletions(-) diff --git a/polygerrit-ui/app/behaviors/gr-patch-set-behavior/gr-patch-set-behavior.html b/polygerrit-ui/app/behaviors/gr-patch-set-behavior/gr-patch-set-behavior.html index c52c12eb31..acf3a62955 100644 --- a/polygerrit-ui/app/behaviors/gr-patch-set-behavior/gr-patch-set-behavior.html +++ b/polygerrit-ui/app/behaviors/gr-patch-set-behavior/gr-patch-set-behavior.html @@ -23,11 +23,11 @@ limitations under the License. * Given an object of revisions, get a particular revision based on patch * num. * - * @param {Object} revisions - * @param {number|string} patchNum - * @return {Object} + * @param {Object} revisions The object of revisions given by the API + * @param {number|string} patchNum The number index of the revision + * @return {Object} The correspondent revision obj from {revisions} */ - getRevisionNumber: function(revisions, patchNum) { + getRevisionByPatchNum: function(revisions, patchNum) { patchNum = parseInt(patchNum, 10); for (var rev in revisions) { if (revisions.hasOwnProperty(rev) && diff --git a/polygerrit-ui/app/behaviors/gr-patch-set-behavior/gr-patch-set-behavior_test.html b/polygerrit-ui/app/behaviors/gr-patch-set-behavior/gr-patch-set-behavior_test.html index d9e98f4c58..7ff93719df 100644 --- a/polygerrit-ui/app/behaviors/gr-patch-set-behavior/gr-patch-set-behavior_test.html +++ b/polygerrit-ui/app/behaviors/gr-patch-set-behavior/gr-patch-set-behavior_test.html @@ -23,8 +23,8 @@ limitations under the License. diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js index 8a66533580..48682e93f2 100644 --- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js +++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js @@ -905,5 +905,11 @@ return this.send('DELETE', '/changes/' + changeID + '/reviewers/' + account + '/votes/' + encodeURIComponent(label)); }, + + setDescription: function(changeNum, patchNum, desc) { + return this.send('PUT', + this.getChangeActionURL(changeNum, patchNum, '/description'), + {description: desc}); + }, }); })();