make missing script key value 'default' (#3278)

This commit is contained in:
Jonathan Dobson
2025-08-22 17:34:53 -04:00
committed by GitHub
parent 5055daad00
commit 164bcf57c9
5 changed files with 25 additions and 16 deletions

View File

@@ -181,7 +181,7 @@ function WorkflowHeader({
} }
onCacheKeyValuesKeydown(e); onCacheKeyValuesKeydown(e);
}} }}
placeholder="Script Key" placeholder="Script Key Value"
value={chosenCacheKeyValue ?? undefined} value={chosenCacheKeyValue ?? undefined}
onBlur={(e) => { onBlur={(e) => {
onCacheKeyValuesBlurred(e.target.value); onCacheKeyValuesBlurred(e.target.value);

View File

@@ -681,7 +681,7 @@ function Workspace({
<WorkflowCacheKeyValuesPanel <WorkflowCacheKeyValuesPanel
cacheKeyValues={cacheKeyValues} cacheKeyValues={cacheKeyValues}
pending={cacheKeyValuesLoading} pending={cacheKeyValuesLoading}
scriptKey={workflow.cache_key ?? "<none>"} scriptKey={workflow.cache_key ?? "default"}
onDelete={(cacheKeyValue) => { onDelete={(cacheKeyValue) => {
setToDeleteCacheKeyValue(cacheKeyValue); setToDeleteCacheKeyValue(cacheKeyValue);
setOpenConfirmCacheKeyValueDeleteDialogue(true); setOpenConfirmCacheKeyValueDeleteDialogue(true);

View File

@@ -151,16 +151,21 @@ function StartNode({ id, data }: NodeProps<StartNode>) {
</div> </div>
</div> </div>
{inputs.useScriptCache && ( {inputs.useScriptCache && (
<WorkflowBlockInputTextarea <div className="space-y-2">
nodeId={id} <div className="flex gap-2">
onChange={(value) => { <Label>Script Key (optional)</Label>
const v = value.length ? value : null; </div>
handleChange("scriptCacheKey", v); <WorkflowBlockInputTextarea
}} nodeId={id}
value={inputs.scriptCacheKey ?? ""} onChange={(value) => {
placeholder={placeholders["scripts"]["scriptKey"]} const v = value.length ? value : null;
className="nopan text-xs" handleChange("scriptCacheKey", v);
/> }}
value={inputs.scriptCacheKey ?? ""}
placeholder={placeholders["scripts"]["scriptKey"]}
className="nopan text-xs"
/>
</div>
)} )}
</OrgWalled> </OrgWalled>
<div className="space-y-2"> <div className="space-y-2">

View File

@@ -50,10 +50,10 @@ function WorkflowCacheKeyValuesPanel({
<code className="font-mono text-xs text-slate-200"> <code className="font-mono text-xs text-slate-200">
{scriptKey} {scriptKey}
</code> </code>
, search for a cached value to see scripts for. For this script key , search for scripts using a script key value. For this script key
there {totalCount === 1 ? "is" : "are"}{" "} there {totalCount === 1 ? "is" : "are"}{" "}
<span className="font-bold text-slate-200">{totalCount}</span>{" "} <span className="font-bold text-slate-200">{totalCount}</span>{" "}
cached {totalCount === 1 ? "value" : "values"} script key {totalCount === 1 ? "value" : "values"}
{filteredCount !== totalCount && ( {filteredCount !== totalCount && (
<> <>
{" "} {" "}
@@ -140,7 +140,7 @@ function WorkflowCacheKeyValuesPanel({
</PaginationItem> </PaginationItem>
<PaginationItem> <PaginationItem>
<div className="text-sm font-bold"> <div className="text-sm font-bold">
{displayPage} of {totalPages} {displayPage} of {isNaN(totalPages) ? 0 : totalPages}
</div> </div>
</PaginationItem> </PaginationItem>
<PaginationItem> <PaginationItem>

View File

@@ -100,6 +100,10 @@ const useWorkflowSave = () => {
} }
} }
const scriptCacheKey = saveData.settings.scriptCacheKey ?? "";
const normalizedKey =
scriptCacheKey === "" ? "default" : saveData.settings.scriptCacheKey;
const requestBody: WorkflowCreateYAMLRequest = { const requestBody: WorkflowCreateYAMLRequest = {
title: saveData.title, title: saveData.title,
description: saveData.workflow.description, description: saveData.workflow.description,
@@ -111,7 +115,7 @@ const useWorkflowSave = () => {
totp_verification_url: saveData.workflow.totp_verification_url, totp_verification_url: saveData.workflow.totp_verification_url,
extra_http_headers: extraHttpHeaders, extra_http_headers: extraHttpHeaders,
generate_script: saveData.settings.useScriptCache, generate_script: saveData.settings.useScriptCache,
cache_key: saveData.settings.scriptCacheKey, cache_key: normalizedKey,
workflow_definition: { workflow_definition: {
parameters: saveData.parameters, parameters: saveData.parameters,
blocks: saveData.blocks, blocks: saveData.blocks,