Skip to content

Commit 4363e58

Browse files
author
Aaron Imming
committed
Refactor disableRunButton function
1 parent e3b33a5 commit 4363e58

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/botPage/view/blockly/blocks/shared.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,21 @@ export const getPredictionForContracts = (contracts, selectedContractType) => {
410410
return predictionRange;
411411
};
412412

413-
export const disableRunButton = isDisabled => {
414-
$('#runButton, #summaryRunButton').attr('disabled', isDisabled);
413+
export const disableRunButton = should_disable => {
414+
const el_run_buttons = document.querySelectorAll('#runButton, #summaryRunButton');
415+
const is_running = globalObserver.getState('is_running');
416+
417+
el_run_buttons.forEach(el_run_button => {
418+
if (is_running) {
419+
if (should_disable) {
420+
el_run_button.setAttributeNode(document.createAttribute('disabled'));
421+
} else {
422+
// Do not enable. The bot is running.
423+
}
424+
} else if (should_disable) {
425+
el_run_button.setAttributeNode(document.createAttribute('disabled'));
426+
} else {
427+
el_run_button.removeAttribute('disabled');
428+
}
429+
});
415430
};

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy