Skip to content

Commit

Permalink
Add stop all running backfills button
Browse files Browse the repository at this point in the history
Adding clientside button for #368
  • Loading branch information
mhickman committed Jan 27, 2024
1 parent 87debc3 commit 78fcc40
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ $ java -jar service/build/libs/service.jar
```

### From IntelliJ
Right-click on `BackfilaService.kt` and select `Run`
Right-click on `BackfilaDevelopmentService.kt` and select `Run`

### From Docker

Expand Down
74 changes: 74 additions & 0 deletions service/web/tabs/app/src/components/StopAllBackfillsButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import * as React from "react"
import Axios from "axios"
import { Button, Intent, Toaster, Classes, Popover } from "@blueprintjs/core"

interface IStopAllBackillsProps {
onUpdate?: () => void
}

interface IStopAllBackfillsState {
loading: boolean
}

class StopAllRealButton extends React.Component<IStopAllBackillsProps, IStopAllBackfillsState> {
public state: IStopAllBackfillsState = {
loading: false
}

stopall() {
const url = `/backfills/stop_all`
this.setState({loading: true})
Axios.post(url, {})
.then(response => {
if (this.props.onUpdate) {
this.props.onUpdate()
}
})
.catch(error => {
Toaster.create().show({
intent: Intent.DANGER,
message: `Error: ${error.response.data}`
})
})
.finally(() => this.setState({loading: false}))
}

render() {
return(
<Button
onClick={() => this.stopall()}
intent={Intent.DANGER}
loading={this.state.loading}
small={true}
text={"Yes Stop All Running Backfills"}
/>
)
}
}

class StopAllButton extends React.Component {
render() {
return (
<Popover
interactionKind="click"
popoverClassName={Classes.POPOVER_CONTENT_SIZING}
position="right"
content={
<div>
<p>Are you sure? This should only been done during large incidents.</p>
<StopAllRealButton />
</div>
}
children={
<Button
intent={Intent.DANGER}
small={true}
text={"Stop All Running Backfills"}
/>
}
/>
);
}
}

export default StopAllButton
2 changes: 2 additions & 0 deletions service/web/tabs/app/src/containers/HomeContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import { Checkbox, FormGroup } from "@blueprintjs/core"
import { LayoutContainer } from "."
import { RouteComponentProps } from "react-router-dom"
import StopAllBackfillsButton from "../components/StopAllBackfillsButton";

interface TabContainerState extends RouteComponentProps {
only_show_running_backfills: boolean
Expand Down Expand Up @@ -57,6 +58,7 @@ class TabContainer extends React.Component<
tag={this.tableTag}
onlyShowRunningBackfills={this.state.only_show_running_backfills}
/>
<StopAllBackfillsButton />
</LayoutContainer>
)
}
Expand Down

0 comments on commit 78fcc40

Please sign in to comment.