-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add stop all running backfills button
Adding clientside button for #368
- Loading branch information
Showing
3 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
74 changes: 74 additions & 0 deletions
74
service/web/tabs/app/src/components/StopAllBackfillsButton.tsx
This file contains 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 |
---|---|---|
@@ -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 |
This file contains 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