Move 'Start Review' to primary actions
Also rename the "Reply" button to "Start Review", if the change is in
WIP state. That restores the behavior prior to change 256995.
Also rename the moved 'Start Review' button, see other change in this
topic.
Before: https://imgur.com/a/WOVegGG
After: https://imgur.com/a/A3bIp8D
Bug: Issue 12789
Change-Id: I68c986f5896ac96d428979ec56943f0612c3f297
diff --git a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js
index d65757a..ca9016f 100644
--- a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js
+++ b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js
@@ -89,6 +89,7 @@
PRIVATE: 'private',
PRIVATE_DELETE: 'private.delete',
PUBLISH_EDIT: 'publishEdit',
+ READY: 'ready',
REBASE_EDIT: 'rebaseEdit',
RESTORE: 'restore',
REVERT: 'revert',
@@ -207,6 +208,7 @@
ChangeActions.DELETE_EDIT,
ChangeActions.EDIT,
ChangeActions.PUBLISH_EDIT,
+ ChangeActions.READY,
ChangeActions.REBASE_EDIT,
ChangeActions.RESTORE,
ChangeActions.REVERT,
@@ -294,6 +296,7 @@
type: Array,
value() {
return [
+ ChangeActions.READY,
RevisionActions.SUBMIT,
];
},
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js
index 968f56f..b48c474 100644
--- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js
+++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js
@@ -310,7 +310,7 @@
_replyButtonLabel: {
type: String,
value: 'Reply',
- computed: '_computeReplyButtonLabel(_diffDrafts.*)',
+ computed: '_computeReplyButtonLabel(_diffDrafts.*, _canStartReview)',
},
_selectedPatchSet: String,
_shownFileCount: Number,
@@ -922,23 +922,6 @@
this._openReplyDialog(this.$.replyDialog.FocusTarget.ANY);
}
- _handleReadyTap(e) {
- e.preventDefault();
- const button = e && e.target;
- if (button) {
- button.loading = true;
- }
- return this.$.restAPI.startReview(this._changeNum)
- .then(result => {
- this._reload(result);
- })
- .finally(() => {
- if (button) {
- button.loading = false;
- }
- });
- }
-
_handleOpenDiffPrefs() {
this.$.fileList.openDiffPrefs();
}
@@ -1378,11 +1361,14 @@
return result;
}
- _computeReplyButtonLabel(changeRecord) {
+ _computeReplyButtonLabel(changeRecord, canStartReview) {
// Polymer 2: check for undefined
- if ([changeRecord].some(arg => arg === undefined)) {
+ if ([changeRecord, canStartReview].some(arg => arg === undefined)) {
return 'Reply';
}
+ if (canStartReview) {
+ return 'Start Review';
+ }
const drafts = (changeRecord && changeRecord.base) || {};
const draftCount = Object.keys(drafts)
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_html.js b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_html.js
index e8f8a68..a1d4c52 100644
--- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_html.js
+++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_html.js
@@ -172,9 +172,6 @@
margin: var(--spacing-l) 0;
padding: 0 var(--spacing-l);
}
- #startReviewBtn {
- margin-left: var(--spacing-s);
- }
.collapseToggleContainer {
display: flex;
margin-bottom: 8px;
@@ -446,20 +443,11 @@
title="[[createTitle(Shortcut.OPEN_REPLY_DIALOG,
ShortcutSection.ACTIONS)]]"
hidden$="[[!_loggedIn]]"
- primary$="[[!_canStartReview]]"
+ primary=""
disabled="[[_replyDisabled]]"
on-click="_handleReplyTap"
>[[_replyButtonLabel]]</gr-button
>
- <gr-button
- id="startReviewBtn"
- class="startReview"
- title="Switches change state from 'Work in Progress' to 'Active'."
- hidden="[[!_canStartReview]]"
- primary$="[[_canStartReview]]"
- on-click="_handleReadyTap"
- >Start review</gr-button
- >
</div>
<div id="commitMessage" class="commitMessage">
<gr-editable-content
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.html b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.html
index 62336e0..c935a84 100644
--- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.html
+++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.html
@@ -1062,7 +1062,7 @@
const getLabel = element._computeReplyButtonLabel;
assert.equal(getLabel(null, false), 'Reply');
- assert.equal(getLabel(null, true), 'Reply');
+ assert.equal(getLabel(null, true), 'Start Review');
const changeRecord = {base: null};
assert.equal(getLabel(changeRecord, false), 'Reply');
@@ -1077,10 +1077,6 @@
assert.equal(getLabel(changeRecord, false), 'Reply (3)');
});
- test('start review button when owner of WIP change', () => {
- assert.equal(element.$.startReviewBtn.innerHTML, 'Start review');
- });
-
test('comment events properly update diff drafts', () => {
element._patchRange = {
basePatchNum: 'PARENT',
diff --git a/polygerrit-ui/app/elements/shared/gr-icons/gr-icons.js b/polygerrit-ui/app/elements/shared/gr-icons/gr-icons.js
index f7b8b63..84d0d2a 100644
--- a/polygerrit-ui/app/elements/shared/gr-icons/gr-icons.js
+++ b/polygerrit-ui/app/elements/shared/gr-icons/gr-icons.js
@@ -98,6 +98,8 @@
<g id="zeroState"><path d="M22 9V7h-2V5c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-2h2v-2h-2v-2h2v-2h-2V9h2zm-4 10H4V5h14v14zM6 13h5v4H6zm6-6h4v3h-4zM6 7h5v5H6zm6 4h4v6h-4z"></path></g>
<!-- This SVG is an adaptation of material.io https://material.io/icons/#label_important-->
<g id="attention"><path d="M5.5 19 l9 0 c.67 0 1.27 -.33 1.63 -.84 L20.5 12 l-4.37 -6.16 c-.36 -.51 -.96 -.84 -1.63 -.84 l-9 0 L9 12 z"></path></g>
+ <!-- This SVG is a copy from material.io https://material.io/icons/#visibility-->
+ <g id="ready"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/></g>
</defs>
</svg>
</iron-iconset-svg>`;