Merge "Add ability to hide quick approve button to GrChangeActionsInterface"
This commit is contained in:
@@ -211,6 +211,10 @@
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
value: false,
|
value: false,
|
||||||
},
|
},
|
||||||
|
_hideQuickApproveAction: {
|
||||||
|
type: Boolean,
|
||||||
|
value: false,
|
||||||
|
},
|
||||||
changeNum: String,
|
changeNum: String,
|
||||||
changeStatus: String,
|
changeStatus: String,
|
||||||
commitNum: String,
|
commitNum: String,
|
||||||
@@ -653,7 +657,18 @@
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
hideQuickApproveAction() {
|
||||||
|
this._topLevelSecondaryActions =
|
||||||
|
this._topLevelSecondaryActions.filter(sa => {
|
||||||
|
return sa.key !== QUICK_APPROVE_ACTION.key;
|
||||||
|
});
|
||||||
|
this._hideQuickApproveAction = true;
|
||||||
|
},
|
||||||
|
|
||||||
_getQuickApproveAction() {
|
_getQuickApproveAction() {
|
||||||
|
if (this._hideQuickApproveAction) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
const approval = this._getTopMissingApproval();
|
const approval = this._getTopMissingApproval();
|
||||||
if (!approval) {
|
if (!approval) {
|
||||||
return null;
|
return null;
|
||||||
|
@@ -1091,6 +1091,21 @@ limitations under the License.
|
|||||||
assert.isNotNull(approveButton);
|
assert.isNotNull(approveButton);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('hide quick approve', () => {
|
||||||
|
const approveButton =
|
||||||
|
element.$$('gr-button[data-action-key=\'review\']');
|
||||||
|
assert.isNotNull(approveButton);
|
||||||
|
assert.isFalse(element._hideQuickApproveAction);
|
||||||
|
|
||||||
|
// Assert approve button gets removed from list of buttons.
|
||||||
|
element.hideQuickApproveAction();
|
||||||
|
flushAsynchronousOperations();
|
||||||
|
const approveButtonUpdated =
|
||||||
|
element.$$('gr-button[data-action-key=\'review\']');
|
||||||
|
assert.isNull(approveButtonUpdated);
|
||||||
|
assert.isTrue(element._hideQuickApproveAction);
|
||||||
|
});
|
||||||
|
|
||||||
test('is first in list of secondary actions', () => {
|
test('is first in list of secondary actions', () => {
|
||||||
const approveButton = element.$.secondaryActions
|
const approveButton = element.$.secondaryActions
|
||||||
.querySelector('gr-button');
|
.querySelector('gr-button');
|
||||||
|
@@ -62,6 +62,11 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GrChangeActionsInterface.prototype.hideQuickApproveAction = function() {
|
||||||
|
ensureEl(this);
|
||||||
|
this._el.hideQuickApproveAction();
|
||||||
|
};
|
||||||
|
|
||||||
GrChangeActionsInterface.prototype.setActionOverflow = function(type, key,
|
GrChangeActionsInterface.prototype.setActionOverflow = function(type, key,
|
||||||
overflow) {
|
overflow) {
|
||||||
ensureEl(this);
|
ensureEl(this);
|
||||||
|
Reference in New Issue
Block a user