-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add option to re-run a playbook run with the same parameters
Fixes #1738 chore: direct to playbook run on success submission fix: use modal to show playbook re-run
- Loading branch information
1 parent
c0e77fe
commit bd4f7a0
Showing
8 changed files
with
102 additions
and
42 deletions.
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
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
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
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
45 changes: 45 additions & 0 deletions
45
src/components/Playbooks/Runs/Submit/ReRunPlaybookWithParamsButton.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,45 @@ | ||
import { PlaybookSpec } from "@flanksource-ui/api/types/playbooks"; | ||
import { Button } from "@flanksource-ui/ui/Buttons/Button"; | ||
import { useState } from "react"; | ||
import SubmitPlaybookRunForm from "./SubmitPlaybookRunForm"; | ||
|
||
type ReRunPlaybookWithParamsProps = { | ||
params?: Record<string, unknown>; | ||
playbook: Pick<PlaybookSpec, "id" | "spec" | "name">; | ||
componentId?: string; | ||
configId?: string; | ||
checkId?: string; | ||
}; | ||
|
||
export default function ReRunPlaybookWithParamsButton({ | ||
params, | ||
playbook, | ||
componentId, | ||
configId, | ||
checkId | ||
}: ReRunPlaybookWithParamsProps) { | ||
const [isOpened, setIsOpened] = useState(false); | ||
|
||
return ( | ||
<> | ||
<Button | ||
onClick={() => setIsOpened(true)} | ||
className="btn-white min-w-max space-x-2" | ||
title="Run playbook again with the same parameters" | ||
disabled={isOpened} | ||
> | ||
Re-run playbook | ||
</Button> | ||
|
||
<SubmitPlaybookRunForm | ||
isOpen={isOpened} | ||
onClose={() => setIsOpened(false)} | ||
playbook={playbook} | ||
componentId={componentId} | ||
checkId={checkId} | ||
configId={configId} | ||
params={params} | ||
/> | ||
</> | ||
); | ||
} |
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
2 changes: 1 addition & 1 deletion
2
src/components/Playbooks/Runs/Submit/__tests__/SelectPlaybookToRun.unit.test.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
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