whitelabel custom settings

This commit is contained in:
Ruben Fiszel
2024-08-02 13:47:28 +02:00
parent 91e364bde5
commit c55d15c0a9
12 changed files with 228 additions and 137 deletions
@@ -12,6 +12,12 @@
const { flowStore } = getContext<FlowEditorContext>('FlowEditorContext')
export let loading: boolean
export let disableStaticInputs = false
export let disableTutorials = false
export let disableAi = false
export let disableSettings = false
export let smallErrorHandler = false
export let enableAi = true
let size = 40
@@ -35,7 +41,15 @@
{/each}
</div>
{:else if $flowStore.value.modules}
<FlowModuleSchemaMap bind:modules={$flowStore.value.modules} on:reload />
<FlowModuleSchemaMap
{disableStaticInputs}
{disableTutorials}
{disableAi}
{disableSettings}
{smallErrorHandler}
bind:modules={$flowStore.value.modules}
on:reload
/>
{/if}
</div>
</Pane>
@@ -47,7 +61,7 @@
</div>
</div>
{:else}
<FlowEditorPanel enableAi />
<FlowEditorPanel {enableAi} />
{/if}
</Pane>
</Splitpanes>
@@ -3,7 +3,7 @@
import ToggleHubWorkspace from '$lib/components/ToggleHubWorkspace.svelte'
import Tooltip from '$lib/components/Tooltip.svelte'
import { createEventDispatcher } from 'svelte'
import { createEventDispatcher, getContext } from 'svelte'
import FlowScriptPicker from '../pickers/FlowScriptPicker.svelte'
import PickHubScript from '../pickers/PickHubScript.svelte'
import WorkspaceScriptPicker from '../pickers/WorkspaceScriptPicker.svelte'
@@ -17,6 +17,7 @@
import { defaultScriptLanguages, processLangs } from '$lib/scripts'
import type { SupportedLanguage } from '$lib/common'
import DefaultScripts from '$lib/components/DefaultScripts.svelte'
import type { WhitelabelCustomUi } from '$lib/components/custom_ui'
export let failureModule: boolean
export let shouldDisableTriggerScripts: boolean = false
@@ -53,6 +54,8 @@
}
return kind == 'script' && !failureModule
}
let customUi: undefined | WhitelabelCustomUi = getContext('customUi')
</script>
<div class="p-4 h-full flex flex-col" id="flow-editor-flow-inputs">
@@ -193,7 +196,7 @@
<div class="pb-2" />
{/if}
<div class="flex flex-row flex-wrap gap-2" id="flow-editor-action-script">
{#each langs as [label, lang] (lang)}
{#each langs.filter((lang) => customUi?.languages == undefined || customUi?.languages?.includes(lang?.[1])) as [label, lang] (lang)}
{#if displayLang(lang, kind)}
<FlowScriptPicker
id={`flow-editor-action-script-${lang}`}
@@ -19,12 +19,14 @@
import { sendUserToast } from '$lib/utils'
import { workerTags } from '$lib/stores'
import { getLatestHashForScript } from '$lib/scripts'
import type { WhitelabelCustomUi } from '$lib/components/custom_ui'
export let module: FlowModule
const { scriptEditorDrawer, flowStore, selectedId } =
getContext<FlowEditorContext>('FlowEditorContext')
const dispatch = createEventDispatcher()
let customUi: undefined | WhitelabelCustomUi = getContext('customUi')
loadWorkerGroups()
@@ -132,15 +134,17 @@
Edit {#if module.value.hash != undefined} (locked hash){/if}
</Button>
{/if}
<Button
size="xs"
color="light"
on:click={() => dispatch('fork')}
startIcon={{ icon: GitFork }}
iconOnly={false}
>
Fork
</Button>
{#if customUi?.scriptFork != false}
<Button
size="xs"
color="light"
on:click={() => dispatch('fork')}
startIcon={{ icon: GitFork }}
iconOnly={false}
>
Fork
</Button>
{/if}
{/if}
<div class="px-0.5" />
{#if module.value.type === 'rawscript'}
@@ -35,6 +35,8 @@
export let disableStaticInputs = false
export let disableTutorials = false
export let disableAi = false
export let disableSettings = false
export let smallErrorHandler = false
let flowTutorials: FlowTutorials | undefined = undefined
@@ -240,7 +242,9 @@
{#if $copilotCurrentStepStore !== undefined}
<div transition:fade class="absolute inset-0 bg-gray-500 bg-opacity-75 z-[900] !m-0" />
{/if}
<FlowSettingsItem />
{#if !disableSettings}
<FlowSettingsItem />
{/if}
{#if !disableStaticInputs}
<FlowConstantsItem />
{/if}
@@ -1,10 +1,11 @@
<script lang="ts">
import { Menu } from '$lib/components/common'
import { createEventDispatcher } from 'svelte'
import { createEventDispatcher, getContext } from 'svelte'
import { CheckCircle2, Code, Cross, GitBranch, Repeat, Square, Zap } from 'lucide-svelte'
import StepGen from '$lib/components/copilot/StepGen.svelte'
import type { FlowModule } from '$lib/gen'
import BarsStaggered from '$lib/components/icons/BarsStaggered.svelte'
import type { WhitelabelCustomUi } from '$lib/components/custom_ui'
const dispatch = createEventDispatcher()
export let trigger = false
@@ -16,6 +17,7 @@
export let disableAi = false
$: !open && (funcDesc = '')
let customUi: undefined | WhitelabelCustomUi = getContext('customUi')
</script>
<Menu
@@ -52,7 +54,7 @@
<Code size={14} />
Action
</button>
{#if trigger}
{#if customUi?.triggers != false && trigger}
<button
class="w-full text-left py-2 px-3 hover:bg-surface-hover whitespace-nowrap flex flex-row gap-2 items-center"
on:pointerdown={() => {
@@ -128,17 +130,19 @@
Branch to all
</button>
<button
class="w-full text-left py-2 px-3 hover:bg-surface-hover rounded-none whitespace-nowrap flex flex-row gap-2 items-center"
on:pointerdown={() => {
close()
dispatch('new', 'flow')
}}
role="menuitem"
>
<BarsStaggered size={14} />
Flow
</button>
{#if customUi?.flowNode != false}
<button
class="w-full text-left py-2 px-3 hover:bg-surface-hover rounded-none whitespace-nowrap flex flex-row gap-2 items-center"
on:pointerdown={() => {
close()
dispatch('new', 'flow')
}}
role="menuitem"
>
<BarsStaggered size={14} />
Flow
</button>
{/if}
{#if stop}
<button
class="w-full text-left py-2 px-3 hover:bg-surface-hover inline-flex gap-2.5"