This commit is contained in:
Ruben Fiszel
2024-09-03 00:49:44 +02:00
parent 8edf24ff96
commit 95202211f5
9 changed files with 44 additions and 13 deletions
@@ -98,6 +98,7 @@
| undefined = undefined
export let diffDrawer: DiffDrawer | undefined = undefined
export let customUi: FlowBuilderWhitelabelCustomUi = {}
export let disableAi: boolean = false
$: setContext('customUi', customUi)
@@ -219,6 +220,7 @@
sendUserToast('Saved as draft')
} catch (error) {
sendUserToast(`Error while saving the flow as a draft: ${error.body || error.message}`, true)
dispatch('saveDraftError', error)
}
loadingDraft = false
}
@@ -333,6 +335,7 @@
loadingSave = false
dispatch('deploy', $pathStore)
} catch (err) {
dispatch('deployError', err)
sendUserToast(`The flow could not be saved: ${err.body}`, true)
loadingSave = false
}
@@ -1101,7 +1104,10 @@
<div transition:fade class="absolute inset-0 bg-gray-500 bg-opacity-75 z-[900] !m-0" />
{/if}
<div class="flex w-full max-w-md gap-4 items-center">
<Summary bind:value={$flowStore.summary} />
<Summary
disabled={customUi?.topBar?.editableSummary == false}
bind:value={$flowStore.summary}
/>
<UndoRedo
undoProps={{ disabled: $history.index === 0 }}
@@ -1246,7 +1252,7 @@
</div>
</Button>
{/if}
{#if customUi?.topBar?.aiBuilder != false}
{#if !disableAi && customUi?.topBar?.aiBuilder != false}
<FlowCopilotStatus
{copilotLoading}
bind:copilotStatus
@@ -1310,7 +1316,7 @@
<!-- metadata -->
{#if $flowStateStore}
<FlowEditor
enableAi={customUi?.stepInputs?.ai != false}
disableAi={disableAi || customUi?.stepInputs?.ai == false}
disableSettings={customUi?.settingsPanel === false}
{loading}
on:reload={() => {
@@ -15,6 +15,7 @@
export let hideTimeline = false
export let hideDownloadInGraph = false
export let hideNodeDefinition = false
export let hideJobId = false
export let isOwner = false
export let wideResults = false
@@ -29,7 +30,8 @@
retryStatus,
hideDownloadInGraph,
hideNodeDefinition,
hideTimeline
hideTimeline,
hideJobId
})
function loadOwner(path: string) {
@@ -316,6 +316,7 @@
dispatch('deploy', newHash)
}
} catch (error) {
dispatch('deployError', error)
sendUserToast(`Error while saving the script: ${error.body || error.message}`, true)
}
loadingSave = false
@@ -411,16 +412,21 @@
draft: structuredClone(script)
} as NewScriptWithDraft
let savedAtNewPath = false
if (initialPath == '' || (savedScript?.draft_only && script.path !== initialPath)) {
savedAtNewPath = true
initialPath = script.path
dispatch('saveInitial', script.path)
}
dispatch('saveDraft', { path: script.path, savedAtNewPath, script })
sendUserToast('Saved as draft')
} catch (error) {
sendUserToast(
`Error while saving the script as a draft: ${error.body || error.message}`,
true
)
dispatch('saveDraftError', error)
}
loadingDraft = false
}
@@ -1035,7 +1041,10 @@
<LanguageIcon lang={script.language} height={20} />
</button>
</div>
<Summary bind:value={script.summary} />
<Summary
disabled={customUi?.topBar?.editableSummary == false}
bind:value={script.summary}
/>
</div>
<div class="gap-4 flex">
+5 -1
View File
@@ -2,6 +2,7 @@
import { Pen } from 'lucide-svelte'
export let value: string
export let disabled = false
function blur(e: KeyboardEvent) {
e.key === 'Enter' && (e?.target as any)?.blur()
@@ -16,9 +17,12 @@
placeholder="Untitled"
class="windmillapp app-title text-sm w-full font-semibold"
bind:value
{disabled}
on:keydown={blur}
/>
<Pen class="absolute top-2 right-2 pen-icon -z-10 opacity-60" size={14} />
{#if !disabled}
<Pen class="absolute top-2 right-2 pen-icon -z-10 opacity-60" size={14} />
{/if}
</div>
</div>
@@ -46,8 +46,8 @@
if (ping.vcpus) {
vcpus += ping.vcpus
}
if (ping.memory_usage) {
memory += ping.memory_usage
if (ping.memory) {
memory += ping.memory
}
}
}
@@ -870,7 +870,8 @@
<div class="text-xs"
>{pluralize(activeWorkers, 'worker')}
{#if vcpus_memory?.vcpus}
- {(vcpus_memory?.vcpus / 100000).toFixed(2)} vCPUs{/if}{#if vcpus_memory?.memory}
- {(vcpus_memory?.vcpus / 100000).toFixed(2)} vCPUs{/if}
{#if vcpus_memory?.memory}
- {((vcpus_memory?.memory * 1.0) / 1024 / 1024 / 1024).toFixed(2)} GB{/if}</div
>
<div class="flex gap-2 items-center justify-end flex-row my-2">
+2
View File
@@ -9,6 +9,7 @@ export type FlowBuilderWhitelabelCustomUi = {
tutorials?: boolean
diff?: boolean
extraDeployOptions?: boolean
editableSummary?: boolean
}
settingsPanel?: boolean
settingsTabs?: {
@@ -54,6 +55,7 @@ export type ScriptBuilderWhitelabelCustomUi = {
path?: boolean
settings?: boolean
extraDeployOptions?: boolean
editableSummary?: boolean
}
editorBar?: EditorBarUi
}
@@ -17,7 +17,6 @@
export let disableAi = false
export let disableSettings = false
export let smallErrorHandler = false
export let enableAi = true
let size = 40
@@ -61,7 +60,7 @@
</div>
</div>
{:else}
<FlowEditorPanel {enableAi} />
<FlowEditorPanel enableAi={!disableAi} />
{/if}
</Pane>
</Splitpanes>
@@ -36,7 +36,9 @@ export type FlowStatusViewerContext = {
hideDownloadInGraph?: boolean
hideTimeline?: boolean
hideNodeDefinition?: boolean
hideJobId?: boolean
}
export type GraphModuleState = {
type: FlowStatusModule['type']
args: any
@@ -3,21 +3,27 @@
import { base } from '$lib/base'
import JobStatus from '../JobStatus.svelte'
import { ExternalLinkIcon } from 'lucide-svelte'
import type { FlowStatusViewerContext } from '../graph'
import { getContext } from 'svelte'
export let job: QueuedJob | CompletedJob
let { hideJobId } = getContext<FlowStatusViewerContext>('FlowStatusViewer')
</script>
<div class="grid grid-cols-2 gap-4 mb-1 text-tertiary dark:text-gray-400">
<JobStatus {job} />
{#if job}
{#if job && !hideJobId}
<div>
<div class="text-primary whitespace-nowrap truncate text-sm">
<span class="font-semibold mr-1">Flow's job Id:</span>
<span class="font-semibold mr-1">Flow:</span>
<a
rel="noreferrer"
target="_blank"
href="{base}/run/{job?.id}?workspace={job?.workspace_id}"
>
{job?.id}
<ExternalLinkIcon size={14} class="inline mb-1 ml-1" />
</a>
</div>
</div>