swarm-ui: preview a draft flow's hit counts in the editor with the dry-run route
The editor's preview button posts the draft to POST /api/notify/dry-run and puts each box's hit count on the canvas; any edit hides the numbers. Boxes of kind request_reviewer label themselves "reviewer", so the long kind name no longer runs into the hit count shown beside it.
This commit is contained in:
parent
e8538d8690
commit
404d8334aa
1 changed files with 97 additions and 6 deletions
|
|
@ -429,6 +429,19 @@ export function saveRequest(
|
|||
};
|
||||
}
|
||||
|
||||
// The `POST /api/notify/dry-run` request for the draft: the same document a
|
||||
// save sends, without a revision since nothing is stored.
|
||||
export function previewRequest(
|
||||
flows: Flow[],
|
||||
disabledBuiltins: string[],
|
||||
): { method: "POST"; headers: Record<string, string>; body: string } {
|
||||
return {
|
||||
method: "POST",
|
||||
headers: { "content-type": "application/json" },
|
||||
body: JSON.stringify({ disabled_builtins: disabledBuiltins, flows }),
|
||||
};
|
||||
}
|
||||
|
||||
export type SaveOutcome = "saved" | "conflict" | "invalid" | "error";
|
||||
|
||||
// What a save's HTTP status means to the editor: 409 is a stale revision (read
|
||||
|
|
|
|||
Loading…
Reference in a new issue