mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-08 00:02:27 +00:00
UX nits
This commit is contained in:
@@ -105,9 +105,11 @@
|
||||
|
||||
const uri =
|
||||
lang == 'typescript'
|
||||
? `file:///${filePath}.${langToExt(lang)}`
|
||||
? `file:///${filePath ?? rHash}.${langToExt(lang)}`
|
||||
: `file:///tmp/monaco/${randomHash()}.${langToExt(lang)}`
|
||||
|
||||
console.log('uri', uri)
|
||||
|
||||
buildWorkerDefinition('../../../workers', import.meta.url, false)
|
||||
|
||||
export function getCode(): string {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<script lang="ts">
|
||||
// import { oauthStore, workspaceStore } from '$lib/stores'
|
||||
import { DrawerContent } from './common'
|
||||
import Drawer from './common/drawer/Drawer.svelte'
|
||||
// import ToggleButton from './common/toggleButton-v2/ToggleButton.svelte'
|
||||
// import ToggleButtonGroup from './common/toggleButton-v2/ToggleButtonGroup.svelte'
|
||||
|
||||
let drawer: Drawer
|
||||
export async function open() {
|
||||
drawer.openDrawer?.()
|
||||
step = 'init'
|
||||
}
|
||||
|
||||
let step: 'init' | 'resource' = 'init'
|
||||
|
||||
// let token = 'foo'
|
||||
</script>
|
||||
|
||||
<Drawer bind:this={drawer} size="800px">
|
||||
<DrawerContent title="Connect or Create a Supabase Database" on:close={drawer.closeDrawer}>
|
||||
{#if step === 'init'}
|
||||
<h2>Connect an existing database</h2>
|
||||
<h2>Create a new database</h2>
|
||||
{/if}
|
||||
</DrawerContent>
|
||||
</Drawer>
|
||||
+56
-54
@@ -211,64 +211,66 @@
|
||||
<!-- {inlineScript.content} -->
|
||||
|
||||
<div class="border-y h-full">
|
||||
{#if inlineScript.language != 'frontend' && !drawerIsOpen}
|
||||
<Editor
|
||||
deno={inlineScript.language == 'deno'}
|
||||
path={inlineScript.path}
|
||||
bind:this={editor}
|
||||
class="flex flex-1 grow h-full"
|
||||
lang={scriptLangToEditorLang(inlineScript?.language)}
|
||||
bind:code={inlineScript.content}
|
||||
fixedOverflowWidgets={true}
|
||||
cmdEnterAction={async () => {
|
||||
if (inlineScript) {
|
||||
inlineScript.content = editor?.getCode() ?? ''
|
||||
}
|
||||
runLoading = true
|
||||
await Promise.all($runnableComponents[id]?.cb?.map((f) => f?.(inlineScript)) ?? [])
|
||||
runLoading = false
|
||||
}}
|
||||
on:change={async (e) => {
|
||||
if (inlineScript && inlineScript.language != 'frontend') {
|
||||
const oldSchema = JSON.stringify(inlineScript.schema)
|
||||
if (inlineScript.schema == undefined) {
|
||||
inlineScript.schema = emptySchema()
|
||||
{#if !drawerIsOpen}
|
||||
{#if inlineScript.language != 'frontend'}
|
||||
<Editor
|
||||
deno={inlineScript.language == 'deno'}
|
||||
path={inlineScript.path}
|
||||
bind:this={editor}
|
||||
class="flex flex-1 grow h-full"
|
||||
lang={scriptLangToEditorLang(inlineScript?.language)}
|
||||
bind:code={inlineScript.content}
|
||||
fixedOverflowWidgets={true}
|
||||
cmdEnterAction={async () => {
|
||||
if (inlineScript) {
|
||||
inlineScript.content = editor?.getCode() ?? ''
|
||||
}
|
||||
await inferInlineScriptSchema(inlineScript?.language, e.detail, inlineScript.schema)
|
||||
if (JSON.stringify(inlineScript.schema) != oldSchema) {
|
||||
inlineScript = inlineScript
|
||||
loadSchemaAndInputsByName()
|
||||
runLoading = true
|
||||
await Promise.all($runnableComponents[id]?.cb?.map((f) => f?.(inlineScript)) ?? [])
|
||||
runLoading = false
|
||||
}}
|
||||
on:change={async (e) => {
|
||||
if (inlineScript && inlineScript.language != 'frontend') {
|
||||
const oldSchema = JSON.stringify(inlineScript.schema)
|
||||
if (inlineScript.schema == undefined) {
|
||||
inlineScript.schema = emptySchema()
|
||||
}
|
||||
await inferInlineScriptSchema(inlineScript?.language, e.detail, inlineScript.schema)
|
||||
if (JSON.stringify(inlineScript.schema) != oldSchema) {
|
||||
inlineScript = inlineScript
|
||||
loadSchemaAndInputsByName()
|
||||
}
|
||||
}
|
||||
}
|
||||
$app = $app
|
||||
}}
|
||||
/>
|
||||
{:else}
|
||||
<SimpleEditor
|
||||
bind:this={simpleEditor}
|
||||
class="h-full"
|
||||
{extraLib}
|
||||
bind:code={inlineScript.content}
|
||||
lang="javascript"
|
||||
cmdEnterAction={async () => {
|
||||
runLoading = true
|
||||
await await Promise.all(
|
||||
$runnableComponents[id]?.cb?.map((f) => f(!transformer ? inlineScript : undefined))
|
||||
)
|
||||
runLoading = false
|
||||
}}
|
||||
on:change={() => {
|
||||
$app = $app
|
||||
}}
|
||||
$app = $app
|
||||
}}
|
||||
/>
|
||||
{:else}
|
||||
<SimpleEditor
|
||||
bind:this={simpleEditor}
|
||||
class="h-full"
|
||||
{extraLib}
|
||||
bind:code={inlineScript.content}
|
||||
lang="javascript"
|
||||
cmdEnterAction={async () => {
|
||||
runLoading = true
|
||||
await await Promise.all(
|
||||
$runnableComponents[id]?.cb?.map((f) => f(!transformer ? inlineScript : undefined))
|
||||
)
|
||||
runLoading = false
|
||||
}}
|
||||
on:change={() => {
|
||||
$app = $app
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
<DiffEditor
|
||||
bind:this={diffEditor}
|
||||
class="hidden h-full"
|
||||
automaticLayout
|
||||
fixedOverflowWidgets
|
||||
/>
|
||||
{/if}
|
||||
|
||||
<DiffEditor
|
||||
bind:this={diffEditor}
|
||||
class="hidden h-full"
|
||||
automaticLayout
|
||||
fixedOverflowWidgets
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -61,12 +61,12 @@ fetch(${tokenType === 'query' ? `\`${url}?token=${token}\`` : `\`${url}\``}, {
|
||||
},
|
||||
${requestType !== 'get_path' ? `body: body` : ''}
|
||||
}).then(
|
||||
response => response.json()
|
||||
response => response.${webhookType === 'sync' ? 'json' : 'text'}()
|
||||
).then(data => {
|
||||
${
|
||||
webhookType === 'sync'
|
||||
? 'console.log(data)'
|
||||
: `let UUID = data.uuid;
|
||||
: `let UUID = data;
|
||||
let checkCompletion = setInterval(() => {
|
||||
fetch(\`${$page.url.origin}/api/w/${$workspaceStore}/jobs_u/completed/get_result_maybe/\$\{UUID\}\`, {
|
||||
method: 'GET',
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
import SharedBadge from '$lib/components/SharedBadge.svelte'
|
||||
import ShareModal from '$lib/components/ShareModal.svelte'
|
||||
import SimpleEditor from '$lib/components/SimpleEditor.svelte'
|
||||
import SupabaseConnect from '$lib/components/SupabaseConnect.svelte'
|
||||
import TableCustom from '$lib/components/TableCustom.svelte'
|
||||
import Toggle from '$lib/components/Toggle.svelte'
|
||||
import Tooltip from '$lib/components/Tooltip.svelte'
|
||||
@@ -78,6 +79,7 @@
|
||||
let resourceEditor: ResourceEditor | undefined
|
||||
let shareModal: ShareModal
|
||||
let appConnect: AppConnect
|
||||
let supabaseConnect: SupabaseConnect
|
||||
let deleteConfirmedCallback: (() => void) | undefined = undefined
|
||||
let loading = {
|
||||
resources: true,
|
||||
@@ -233,8 +235,15 @@
|
||||
if ($oauthStore && resource_type) {
|
||||
appConnect.openFromOauth?.(resource_type)
|
||||
}
|
||||
if ($page.url.searchParams.get('connect_app')) {
|
||||
const rt = $page.url.searchParams.get('connect_app') ?? undefined
|
||||
|
||||
const callback = $page.url.searchParams.get('callback')
|
||||
if (callback == 'supabase') {
|
||||
supabaseConnect.open?.()
|
||||
}
|
||||
|
||||
const connect_app = $page.url.searchParams.get('connect_app')
|
||||
if (connect_app) {
|
||||
const rt = connect_app ?? undefined
|
||||
if (rt == 'undefined') {
|
||||
appConnect.open?.()
|
||||
} else {
|
||||
@@ -778,6 +787,7 @@
|
||||
{/if}
|
||||
</CenteredPage>
|
||||
|
||||
<SupabaseConnect bind:this={supabaseConnect} on:refresh={loadResources} />
|
||||
<AppConnect bind:this={appConnect} on:refresh={loadResources} />
|
||||
<ResourceEditor bind:this={resourceEditor} on:refresh={loadResources} />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user