mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-24 08:01:38 +00:00
frontend misc
This commit is contained in:
@@ -113,7 +113,7 @@
|
||||
}
|
||||
}
|
||||
sendUserToast(`Success! flow saved at ${$flowStore.path}`)
|
||||
goto(`/flows/get/${$flowStore.path}`)
|
||||
goto(`/flows/get/${$flowStore.path}?workspace_id=${$workspaceStore}`)
|
||||
}
|
||||
|
||||
let timeout: NodeJS.Timeout | undefined = undefined
|
||||
|
||||
@@ -26,4 +26,10 @@
|
||||
$: lang = getLang(language)
|
||||
</script>
|
||||
|
||||
<Highlight className="nowrap {$$props.class}" language={lang} {code} />
|
||||
{#if code?.length < 5000}
|
||||
<Highlight className="nowrap {$$props.class}" language={lang} {code} />
|
||||
{:else}
|
||||
<pre class="overflow-auto max-h-screen {$$props.class}"
|
||||
><code class="language-{language}">{code}</code></pre
|
||||
>
|
||||
{/if}
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
})
|
||||
sendUserToast(`Success! New script version created with hash ${newHash}`)
|
||||
await goto(`/scripts/edit/${newHash}?step=2`)
|
||||
goto(`/scripts/get/${newHash}`)
|
||||
goto(`/scripts/get/${newHash}?workspace_id=${$workspaceStore}`)
|
||||
} catch (error) {
|
||||
sendUserToast(`Impossible to save the script: ${error.body}`, true)
|
||||
}
|
||||
|
||||
+3
-1
@@ -4,6 +4,7 @@
|
||||
import FlowModuleScript from '$lib/components/flows/content/FlowModuleScript.svelte'
|
||||
import FlowPathViewer from '$lib/components/flows/content/FlowPathViewer.svelte'
|
||||
import { inferArgs } from '$lib/infer'
|
||||
import { workspaceStore } from '$lib/stores'
|
||||
import { emptySchema, getScriptByPath } from '$lib/utils'
|
||||
import { faCodeBranch, faExternalLinkAlt, faEye, faPen } from '@fortawesome/free-solid-svg-icons'
|
||||
import type { AppInput, ResultAppInput } from '../../inputType'
|
||||
@@ -120,7 +121,8 @@
|
||||
startIcon={{ icon: faEye }}
|
||||
endIcon={{ icon: faExternalLinkAlt }}
|
||||
target="_blank"
|
||||
href="/flows/get/{componentInput?.['runnable']?.path}">Details page</Button
|
||||
href="/flows/get/{componentInput?.['runnable']?.path}?workspace_id={$workspaceStore}"
|
||||
>Details page</Button
|
||||
>
|
||||
</div>
|
||||
<FlowPathViewer path={componentInput.runnable.path} />
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
{/if}
|
||||
|
||||
<Button
|
||||
href="/flows/get/{path}"
|
||||
href="/flows/get/{path}?workspace_id={$workspaceStore}"
|
||||
color="light"
|
||||
variant="border"
|
||||
size="xs"
|
||||
@@ -118,7 +118,7 @@
|
||||
{
|
||||
displayName: 'View flow',
|
||||
icon: faEye,
|
||||
href: `/flows/get/${path}`
|
||||
href: `/flows/get/${path}?workspace_id=${$workspaceStore}`
|
||||
},
|
||||
{
|
||||
displayName: 'Edit',
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
{/if}
|
||||
|
||||
<Button
|
||||
href="/scripts/get/{hash}"
|
||||
href="/scripts/get/{hash}?workspace_id={$workspaceStore}"
|
||||
color="light"
|
||||
variant="border"
|
||||
size="xs"
|
||||
@@ -136,7 +136,7 @@
|
||||
{
|
||||
displayName: 'View script',
|
||||
icon: faEye,
|
||||
href: `/scripts/get/${hash}`
|
||||
href: `/scripts/get/${hash}?workspace_id=${$workspaceStore}`
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ import { superadmin, type UserExt } from './stores.js'
|
||||
|
||||
export async function refreshSuperadmin(): Promise<void> {
|
||||
if (get(superadmin) == undefined) {
|
||||
UserService.globalWhoami().then((x) => {
|
||||
await UserService.globalWhoami().then((x) => {
|
||||
if (x.super_admin) {
|
||||
superadmin.set(x.email)
|
||||
} else {
|
||||
|
||||
@@ -475,7 +475,7 @@ export function scriptPathToHref(path: string): string {
|
||||
if (path.startsWith('hub/')) {
|
||||
return 'https://hub.windmill.dev/from_version/' + path.substring(4)
|
||||
} else {
|
||||
return `/scripts/get/${path}`
|
||||
return `/scripts/get/${path}?workspace_id=${get(workspaceStore)}`
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,11 @@
|
||||
app = await AppService.getAppByPath({ workspace: $workspaceStore!, path: $page.params.path })
|
||||
}
|
||||
|
||||
let queryId = $page.url.searchParams.get('workspace_id')
|
||||
if (queryId && queryId != $workspaceStore) {
|
||||
$workspaceStore = $page.url.searchParams.get('workspace_id')!
|
||||
}
|
||||
|
||||
$: if ($workspaceStore) {
|
||||
loadApp()
|
||||
}
|
||||
|
||||
@@ -51,6 +51,11 @@
|
||||
let path = $page.params.path
|
||||
let shareModal: ShareModal
|
||||
|
||||
let queryId = $page.url.searchParams.get('workspace_id')
|
||||
if (queryId && queryId != $workspaceStore) {
|
||||
$workspaceStore = $page.url.searchParams.get('workspace_id')!
|
||||
}
|
||||
|
||||
$: {
|
||||
if ($workspaceStore && $userStore) {
|
||||
loadFlow()
|
||||
@@ -150,7 +155,7 @@
|
||||
<MoveDrawer
|
||||
bind:this={moveDrawer}
|
||||
on:update={async (e) => {
|
||||
await goto('/flows/get/' + e.detail)
|
||||
await goto('/flows/get/' + e.detail + `?workspace_id=${$workspaceStore}`)
|
||||
loadFlow()
|
||||
loadSchedule()
|
||||
}}
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
disabled={flow == undefined}
|
||||
btnClasses="mr-4"
|
||||
variant="border"
|
||||
href="/flows/get/{flow?.path}">View flow</Button
|
||||
href="/flows/get/{flow?.path}?workspace_id={$workspaceStore}">View flow</Button
|
||||
>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@@ -277,7 +277,7 @@
|
||||
{/if}
|
||||
{job.script_path ?? (job.job_kind == 'dependencies' ? 'lock dependencies' : 'No path')}
|
||||
{#if job.script_hash}
|
||||
<a href="/scripts/get/{job.script_hash}"
|
||||
<a href="/scripts/get/{job.script_hash}?workspace_id={workspace_id}}"
|
||||
><Badge color="gray">{truncateHash(job.script_hash)}</Badge></a
|
||||
>
|
||||
{/if}
|
||||
|
||||
@@ -65,6 +65,11 @@
|
||||
|
||||
let shareModal: ShareModal
|
||||
|
||||
let queryId = $page.url.searchParams.get('workspace_id')
|
||||
if (queryId && queryId != $workspaceStore) {
|
||||
$workspaceStore = $page.url.searchParams.get('workspace_id')!
|
||||
}
|
||||
|
||||
$: loading = !script
|
||||
$: if ($workspaceStore) {
|
||||
loadScript($page.params.hash)
|
||||
@@ -182,7 +187,7 @@
|
||||
<MoveDrawer
|
||||
bind:this={moveDrawer}
|
||||
on:update={async (e) => {
|
||||
await goto('/scripts/get/' + e.detail)
|
||||
await goto('/scripts/get/' + e.detail + `?workspace_id=${$workspaceStore}`)
|
||||
loadScript($page.params.hash)
|
||||
}}
|
||||
/>
|
||||
@@ -327,14 +332,17 @@
|
||||
variant="contained"
|
||||
size="xs"
|
||||
startIcon={{ icon: faArrowLeft }}
|
||||
href="/scripts/get/{script.parent_hashes[0]}"
|
||||
href="/scripts/get/{script.parent_hashes[0]}?workspace_id={$workspaceStore}"
|
||||
>
|
||||
<svelte:fragment slot="main">
|
||||
Previous version ({script.parent_hashes.length})
|
||||
</svelte:fragment>
|
||||
|
||||
{#each script.parent_hashes as hash}
|
||||
<ButtonPopupItem href="/scripts/get/{hash}" btnClasses="!m-0">
|
||||
<ButtonPopupItem
|
||||
href="/scripts/get/{hash}?workspace_id={$workspaceStore}"
|
||||
btnClasses="!m-0"
|
||||
>
|
||||
{hash}
|
||||
</ButtonPopupItem>
|
||||
{/each}
|
||||
@@ -354,7 +362,9 @@
|
||||
{#if topHash}
|
||||
<Alert type="warning" title="Not HEAD">
|
||||
This hash is not HEAD (latest non-archived version at this path) :
|
||||
<a href="/scripts/get/{topHash}">Go to the HEAD of this path</a>
|
||||
<a href="/scripts/get/{topHash}?workspace_id={$workspaceStore}"
|
||||
>Go to the HEAD of this path</a
|
||||
>
|
||||
</Alert>
|
||||
{/if}
|
||||
{#if script.archived && !topHash}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
script = await ScriptService.getScriptByHash({ workspace: $workspaceStore!, hash })
|
||||
if (script.schema == undefined) {
|
||||
script.schema = emptySchema()
|
||||
inferArgs(script.language, script.content, script.schema)
|
||||
await inferArgs(script.language, script.content, script.schema)
|
||||
script = script
|
||||
}
|
||||
if (script.path && script.archived) {
|
||||
@@ -119,7 +119,8 @@
|
||||
disabled={script == undefined}
|
||||
btnClasses="mr-4"
|
||||
variant="border"
|
||||
href="/scripts/get/{script?.hash}">View script</Button
|
||||
href="/scripts/get/{script?.hash}?workspace_id={$workspaceStore}"
|
||||
>View script</Button
|
||||
>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
// Default toast options
|
||||
const toastOptions = {
|
||||
duration: 10000, // duration of progress bar tween to the `next` value
|
||||
duration: 5000, // duration of progress bar tween to the `next` value
|
||||
initial: 1, // initial progress bar value
|
||||
next: 0, // next progress value
|
||||
pausable: true, // pause progress bar tween on mouse hover
|
||||
|
||||
Reference in New Issue
Block a user