Switch button key for revert submission for adding loading text

* After removing revert submission button, when key is revert_submission
the text for the Revert button should update to loading

Change-Id: Id28968faf03cb015abd6417915ea4a895f37ed0c
This commit is contained in:
Dhruv Srivastava
2020-02-17 16:31:08 +01:00
parent 29a516f043
commit b9392f2a3e

View File

@@ -1224,10 +1224,18 @@
_setLoadingOnButtonWithKey(type, key) {
this._actionLoadingMessage = this._computeLoadingLabel(key);
let buttonKey = key;
// TODO(dhruvsri): clean this up later
// If key is revert-submission, then button key should be 'revert'
if (buttonKey === ChangeActions.REVERT_SUBMISSION) {
// Revert submission button no longer exists
buttonKey = ChangeActions.REVERT;
}
// If the action appears in the overflow menu.
if (this._getActionOverflowIndex(type, key) !== -1) {
this.push('_disabledMenuActions', key === '/' ? 'delete' : key);
if (this._getActionOverflowIndex(type, buttonKey) !== -1) {
this.push('_disabledMenuActions', buttonKey === '/' ? 'delete' :
buttonKey);
return function() {
this._actionLoadingMessage = '';
this._disabledMenuActions = [];
@@ -1235,7 +1243,7 @@
}
// Otherwise it's a top-level action.
const buttonEl = this.$$(`[data-action-key="${key}"]`);
const buttonEl = this.$$(`[data-action-key="${buttonKey}"]`);
buttonEl.setAttribute('loading', true);
buttonEl.disabled = true;
return function() {