This repository was archived by the owner on Feb 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 541
Running indicator #1693
Merged
Merged
Running indicator #1693
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6dd49cd
Create global state in observer
db5793f
Keep track of bot is_running status globally
e3b33a5
Ensure correct button status
4363e58
Refactor disableRunButton function
3e5141f
Restore display on stopBeforeStart
7e02356
Convert everything to camelCase
9ee2b50
Don't manipulate passed argument directly
db544b8
Set #summaryStopButton to display: none by default
497e92b
Be consistent in display values
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -440,7 +440,17 @@ while(true) { | |
} | ||
stop(stopBeforeStart) { | ||
if (!stopBeforeStart) { | ||
$('#stopButton, #summaryStopButton').prop('disabled', true); | ||
const elRunButtons = document.querySelectorAll('#runButton, #summaryRunButton'); | ||
const elStopButtons = document.querySelectorAll('#stopButton, #summaryStopButton'); | ||
|
||
elRunButtons.forEach(el => { | ||
const elRunButton = el; | ||
elRunButton.style.display = 'initial'; | ||
}); | ||
elStopButtons.forEach(el => { | ||
const elStopButton = el; | ||
elStopButton.style.display = null; | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @aaron-binary you copy this code almost 4 times. can it all goes in some "setBotButtonsVisibility` or st like that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Each of the blocks does different things, e.g. in one case the block will just be hidden, in another, the block will be hidden and disabled, and in the other, the block is just disabled. |
||
} | ||
if (this.interpreter) { | ||
this.interpreter.stop(); | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,7 +169,7 @@ body { | |
background: black; | ||
} | ||
|
||
#stopButton { | ||
#stopButton, #summaryStopButton { | ||
display: none; | ||
} | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aaron-binary does this
globalObserver
have something likereaction
so it listen to state changes and when ever bot state change to running or not running , disable and enable thebuttons
once only.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Through the observer you can
observer.register('name')
to a named event, once that event is emitted (throughobserver.emit('name')
) the callback will be executed. In some cases, the buttons should not be enabled when the bot is not running, e.g. when the user is fetchingcontracts_for
from the API.