|
105 | 105 | });
|
106 | 106 |
|
107 | 107 | // Customize change view
|
108 |
| - plugin.on('show-revision-actions', function(actions, changeInfo) { |
109 |
| - plugin.ca = plugin.changeActions(); |
| 108 | + plugin.on('show-revision-actions', function(revisionActions, changeInfo) { |
| 109 | + var actions = Object.assign({}, revisionActions, changeInfo.actions); |
| 110 | + var cActions = plugin.changeActions(); |
110 | 111 |
|
111 | 112 | // always hide the rebase button
|
112 |
| - plugin.ca.setActionHidden('revision', 'rebase', true); |
| 113 | + cActions.setActionHidden('revision', 'rebase', true); |
113 | 114 |
|
114 | 115 | // Hide 'Sanity-Review+1' button in header
|
115 |
| - var secondaryActionsElem = plugin.ca._el.root.querySelector("#secondaryActions"); |
| 116 | + var secondaryActionsElem = cActions._el.root.querySelector("#secondaryActions"); |
116 | 117 | if (secondaryActionsElem &&
|
117 | 118 | secondaryActionsElem.innerHTML &&
|
118 | 119 | secondaryActionsElem.innerHTML.indexOf('Sanity-Review+1') != -1) {
|
119 |
| - plugin.ca.hideQuickApproveAction(); |
| 120 | + cActions.hideQuickApproveAction(); |
120 | 121 | }
|
121 | 122 |
|
122 | 123 | // Remove any existing buttons
|
123 | 124 | if (plugin.buttons) {
|
124 | 125 | BUTTONS.forEach((key) => {
|
125 | 126 | if(typeof plugin.buttons[key] !== 'undefined' && plugin.buttons[key] !== null) {
|
126 |
| - plugin.ca.removeTapListener(plugin.buttons[key], (param) => {} ); |
127 |
| - plugin.ca.remove(plugin.buttons[key]); |
| 127 | + cActions.removeTapListener(plugin.buttons[key], (param) => {} ); |
| 128 | + cActions.remove(plugin.buttons[key]); |
128 | 129 | plugin.buttons[key] = null;
|
129 | 130 | }
|
130 | 131 | });
|
|
135 | 136 | var action = actions[key];
|
136 | 137 | if (action) {
|
137 | 138 | // hide dropdown action
|
138 |
| - plugin.ca.setActionHidden(action.__type, action.__key, true); |
| 139 | + cActions.setActionHidden(action.__type, action.__key, true); |
139 | 140 |
|
140 | 141 | // add button
|
141 |
| - plugin.buttons[key] = plugin.ca.add(action.__type, action.label); |
142 |
| - plugin.ca.setTitle(plugin.buttons[key], action.title); |
143 |
| - plugin.ca.addTapListener(plugin.buttons[key], buttonEventCallback); |
| 142 | + plugin.buttons[key] = cActions.add(action.__type, action.label); |
| 143 | + cActions.setTitle(plugin.buttons[key], action.title); |
| 144 | + cActions.addTapListener(plugin.buttons[key], buttonEventCallback); |
144 | 145 |
|
145 | 146 | if (key === 'gerrit-plugin-qt-workflow~stage') {
|
146 | 147 | // use the submit icon for our stage button
|
147 |
| - plugin.ca.setIcon(plugin.buttons[key], 'submit'); |
| 148 | + cActions.setIcon(plugin.buttons[key], 'submit'); |
148 | 149 | // hide submit button when it would be disabled next to the stage button
|
149 | 150 | let submit = actions['submit'];
|
150 | 151 | if (!submit.enabled) {
|
151 |
| - plugin.ca.setActionHidden('revision', 'submit', true); |
| 152 | + cActions.setActionHidden('revision', 'submit', true); |
152 | 153 | }
|
153 | 154 | }
|
154 | 155 |
|
|
0 commit comments