feat(taskactions): retry a parked task on the current workflow definition
This commit is contained in:
1 parent
c80d4750a8
commit
9d7287c647
18 files changed
+134
-58
No files matched your search
@@ -255,6 +255,7 @@ export const api = {
|
||||
findings?: string[];
|
||||
retry_mode?: string;
|
||||
resume_from?: string;
|
||||
current_definition?: boolean;
|
||||
},
|
||||
) =>
|
||||
request<T>(`/api/tasks/${encodeURIComponent(id)}/action`, {
|
||||
|
||||
@@ -213,7 +213,12 @@ function request(id: string) {
|
||||
|
||||
async function run(
|
||||
id: string,
|
||||
payload?: { instructions?: string; retry_mode?: string; findings?: string[] },
|
||||
payload?: {
|
||||
instructions?: string;
|
||||
retry_mode?: string;
|
||||
findings?: string[];
|
||||
current_definition?: boolean;
|
||||
},
|
||||
) {
|
||||
if (id === "approve" && gate.value) {
|
||||
if (!props.findings?.length) return;
|
||||
@@ -251,11 +256,14 @@ function onRetryOpen(open: boolean) {
|
||||
retryOpen.value = open;
|
||||
}
|
||||
|
||||
function submitRetry() {
|
||||
// currentDefinition moves the run off its pinned definition onto the
|
||||
// workflow's current stored version, so a definition edit reaches it.
|
||||
function submitRetry(currentDefinition = false) {
|
||||
const id = retryId.value;
|
||||
if (!id || !retryMode.value) return;
|
||||
retryOpen.value = false;
|
||||
void run(id, retryPayload(retryMode.value));
|
||||
const payload = retryPayload(retryMode.value);
|
||||
void run(id, currentDefinition ? { ...payload, current_definition: true } : payload);
|
||||
}
|
||||
|
||||
function onConfirmationOpen(open: boolean) {
|
||||
@@ -420,7 +428,12 @@ function requestFromMenu(id: string) {
|
||||
</RadioGroupRoot>
|
||||
<DialogFooter>
|
||||
<Button variant="ghost" :disabled="inFlight" @click="onRetryOpen(false)">Keep it parked</Button>
|
||||
<Button :disabled="inFlight || !retryMode" @click="submitRetry">Retry</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
:disabled="inFlight || !retryMode"
|
||||
@click="submitRetry(true)"
|
||||
>Retry on current definition</Button>
|
||||
<Button :disabled="inFlight || !retryMode" @click="submitRetry()">Retry</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
Reference in new issue
Block a user