From d1c2e1f40baf18a993e9eefad17802902524f202 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Wed, 21 Aug 2024 15:37:26 +0200 Subject: [PATCH] improve modularity for whitelabelling --- frontend/src/lib/base.ts | 2 +- frontend/src/lib/components/EditorBar.svelte | 87 +++++++++++-------- .../src/lib/components/FlowBuilder.svelte | 33 +++---- .../lib/components/FlowStatusViewer.svelte | 8 +- .../components/FlowStatusViewerInner.svelte | 21 +++-- frontend/src/lib/components/FlowViewer.svelte | 3 +- .../src/lib/components/ScriptBuilder.svelte | 79 +++++++++-------- .../src/lib/components/ScriptEditor.svelte | 5 +- frontend/src/lib/components/custom_ui.ts | 39 ++++++++- .../flows/content/FlowInputs.svelte | 4 +- .../flows/content/FlowModuleComponent.svelte | 4 +- .../flows/content/FlowModuleHeader.svelte | 4 +- .../flows/content/FlowSettings.svelte | 41 +++++---- .../flows/map/InsertModuleButton.svelte | 4 +- frontend/src/lib/components/flows/types.ts | 2 + frontend/src/lib/components/graph/model.ts | 3 + .../src/routes/test_dev_page/+page.svelte | 75 ++++++++++++---- 17 files changed, 275 insertions(+), 139 deletions(-) diff --git a/frontend/src/lib/base.ts b/frontend/src/lib/base.ts index 7c65669ca3..0e8f2d71f6 100644 --- a/frontend/src/lib/base.ts +++ b/frontend/src/lib/base.ts @@ -1 +1 @@ -export const base: string = import.meta.env.VITE_BASE_URL ?? '' +export let base: string = import.meta.env.VITE_BASE_URL ?? '' diff --git a/frontend/src/lib/components/EditorBar.svelte b/frontend/src/lib/components/EditorBar.svelte index d7957912a3..ae8db4c0d1 100644 --- a/frontend/src/lib/components/EditorBar.svelte +++ b/frontend/src/lib/components/EditorBar.svelte @@ -45,6 +45,7 @@ import CodeCompletionStatus from './copilot/CodeCompletionStatus.svelte' import Popover from './Popover.svelte' import ResourceEditorDrawer from './ResourceEditorDrawer.svelte' + import type { EditorBarUi } from './custom_ui' export let lang: SupportedLanguage | 'bunnative' | undefined export let editor: Editor | undefined @@ -68,6 +69,7 @@ export let args: Record export let noHistory = false export let saveToWorkspace = false + export let customUi: EditorBarUi = {} let contextualVariablePicker: ItemPicker let variablePicker: ItemPicker @@ -313,6 +315,7 @@ {/if} + { @@ -513,7 +516,7 @@ $res = json_decode(curl_exec($ch));`) class="rounded-full w-2 h-2 mx-2 {validCode ? 'bg-green-300' : 'bg-red-300'}" />
- {#if showContextVarPicker} + {#if showContextVarPicker && customUi?.contextVar != false} {/if} - {#if showVarPicker} + {#if showVarPicker && customUi?.variable != false} + + {#if lang == 'deno'} + (Deno) + {:else if lang == 'go'} + (Go) + {:else if lang == 'python3'} + (Pyright + Ruff) + {:else if lang == 'bash'} + (Shellcheck) + {/if} + + + {/if} {/if} - {#if collabMode} + + {#if collabMode && customUi?.multiplayer != false}
{/if} - - - - - + {#if customUi?.autoformatting != false} + + {/if} + {#if customUi?.aiGen != false} + + {/if} + {#if customUi?.aiFix != false} + + {/if}
@@ -671,7 +682,7 @@ $res = json_decode(curl_exec($ch));`) History {/if} - {#if SCRIPT_EDITOR_SHOW_EXPLORE_OTHER_SCRIPTS} + {#if SCRIPT_EDITOR_SHOW_EXPLORE_OTHER_SCRIPTS && customUi?.library != false} {/if} -
-
- + + Path + + +
+ { + currentTarget.select() + }} + />
- { - currentTarget.select() - }} - /> - + {/if} {#if $enterpriseLicense && initialPath != ''} @@ -1106,17 +1110,19 @@ - + {#if customUi?.topBar?.settings != false} + + {/if}