Skip to content

Commit

Permalink
UI: Disable "RETRY *" buttons until the session is updated to prevent…
Browse files Browse the repository at this point in the history
… multiple executions (#1819)
  • Loading branch information
exoego authored Nov 13, 2023
1 parent a535f90 commit 323fa19
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions digdag-ui/console.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1307,10 +1307,24 @@ class AttemptView extends React.Component<AttemptViewProps> {

interface SessionViewProps {
session: Session
sessionRunning: boolean
}
const SessionViewState = {
sessionRunning: false,
}

class SessionView extends React.Component<SessionViewProps, typeof SessionViewState> {
public readonly state = SessionViewState

componentWillReceiveProps(props: Readonly<SessionViewProps>) {
this.setState({
sessionRunning: props.sessionRunning,
})
}


class SessionView extends React.Component<SessionViewProps> {
retryFailed () {
this.state.sessionRunning = true
const { session } = this.props
const { lastAttempt } = session
if (lastAttempt != null) {
Expand All @@ -1321,6 +1335,7 @@ class SessionView extends React.Component<SessionViewProps> {
}

retryAll () {
this.state.sessionRunning = true
const { session } = this.props
model()
.retrySessionWithLatestRevision(session, uuidv4())
Expand All @@ -1340,13 +1355,15 @@ class SessionView extends React.Component<SessionViewProps> {
{canRetryAll &&
<button
className='btn btn-sm btn-primary float-right'
disabled={this.state.sessionRunning}
onClick={this.retryAll.bind(this)}
>
RETRY ALL
</button>}
{canResume &&
<button
className='btn btn-sm btn-success mr-2 float-right'
disabled={this.state.sessionRunning}
onClick={this.retryFailed.bind(this)}
>
RETRY FAILED
Expand Down Expand Up @@ -2756,7 +2773,7 @@ export class SessionPage extends React.Component<SessionPageProps> {

session () {
return (this.state.session != null)
? <SessionView session={this.state.session} />
? <SessionView session={this.state.session} sessionRunning={false} />
: null
}

Expand Down

0 comments on commit 323fa19

Please sign in to comment.