mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-20 00:02:19 +00:00
fix: fix app navbar query reactivity + hash in ctx handling is more consistent
This commit is contained in:
@@ -76,6 +76,7 @@
|
||||
export let initialArgs: Record<string, any> = {}
|
||||
export let lockedLanguage = false
|
||||
export let showMeta: boolean = false
|
||||
export let neverShowMeta: boolean = false
|
||||
export let diffDrawer: DiffDrawer | undefined = undefined
|
||||
export let savedScript: NewScriptWithDraft | undefined = undefined
|
||||
export let searchParams: URLSearchParams = new URLSearchParams()
|
||||
@@ -85,10 +86,11 @@
|
||||
export let customUi: ScriptBuilderWhitelabelCustomUi = {}
|
||||
|
||||
let metadataOpen =
|
||||
showMeta ||
|
||||
(initialPath == '' &&
|
||||
searchParams.get('state') == undefined &&
|
||||
searchParams.get('collab') == undefined)
|
||||
!neverShowMeta &&
|
||||
(showMeta ||
|
||||
(initialPath == '' &&
|
||||
searchParams.get('state') == undefined &&
|
||||
searchParams.get('collab') == undefined))
|
||||
|
||||
let editor: Editor | undefined = undefined
|
||||
let scriptEditor: ScriptEditor | undefined = undefined
|
||||
|
||||
@@ -75,11 +75,10 @@
|
||||
const queryParams = url.search
|
||||
const hash = url.hash
|
||||
replaceStateFn?.(`${window.location.pathname}${queryParams}${hash}`)
|
||||
|
||||
$worldStore.outputsById['ctx'].query.set(
|
||||
Object.fromEntries(new URLSearchParams(queryParams).entries())
|
||||
)
|
||||
$worldStore.outputsById['ctx'].hash.set(url.hash)
|
||||
$worldStore.outputsById['ctx'].hash.set(hash.substring(1))
|
||||
|
||||
$selected = resolvedPath === extractPathDetails() ? resolvedPath : undefined
|
||||
},
|
||||
|
||||
@@ -120,7 +120,7 @@
|
||||
groups: $userStore?.groups,
|
||||
username: $userStore?.username,
|
||||
query: Object.fromEntries($page.url.searchParams.entries()),
|
||||
hash: $page.url.hash,
|
||||
hash: $page.url.hash.substring(1),
|
||||
workspace: $workspaceStore,
|
||||
mode: 'editor',
|
||||
summary: $summaryStore,
|
||||
|
||||
@@ -10,7 +10,8 @@ export const forbiddenIds: string[] = [
|
||||
'for',
|
||||
'delete',
|
||||
'while',
|
||||
'new'
|
||||
'new',
|
||||
'in'
|
||||
]
|
||||
|
||||
export function numberToChars(n: number) {
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
username: $userStore?.username,
|
||||
groups: $userStore?.groups,
|
||||
query: Object.fromEntries($page.url.searchParams.entries()),
|
||||
hash: $page.url.hash
|
||||
hash: $page.url.hash.substring(1)
|
||||
}}
|
||||
workspace={$workspaceStore ?? ''}
|
||||
summary={app.summary}
|
||||
@@ -62,8 +62,13 @@
|
||||
isEditor={false}
|
||||
noBackend={false}
|
||||
{hideRefreshBar}
|
||||
replaceStateFn={(path) => replaceState(path, $page.state)}
|
||||
gotoFn={(path, opt) => goto(path, opt)}
|
||||
replaceStateFn={(path) => {
|
||||
goto(path)
|
||||
}}
|
||||
gotoFn={(path, opt) => {
|
||||
console.log(path, opt)
|
||||
goto(path, opt)
|
||||
}}
|
||||
/>
|
||||
{#if can_write && !hideEditBtn}
|
||||
<div id="app-edit-btn" class="absolute bottom-4 z-50 right-4">
|
||||
|
||||
@@ -71,10 +71,9 @@
|
||||
userStore.set(await getUserExt($page.params.workspace))
|
||||
if (!$userStore && parsedSecret.jwt) {
|
||||
jwtError = true
|
||||
sendUserToast("Could not authentify user with jwt token", true)
|
||||
sendUserToast('Could not authentify user with jwt token', true)
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
console.warn('Anonymous user')
|
||||
}
|
||||
}
|
||||
@@ -121,17 +120,17 @@
|
||||
>
|
||||
<div class="px-2 mx-auto mt-20 max-w-xl w-full">
|
||||
{#if !jwtError}
|
||||
<Login
|
||||
on:login={() => {
|
||||
// window.location.reload()
|
||||
loadUser().then(() => {
|
||||
loadApp()
|
||||
})
|
||||
app = app
|
||||
}}
|
||||
popup
|
||||
rd={$page.url.toString()}
|
||||
/>
|
||||
<Login
|
||||
on:login={() => {
|
||||
// window.location.reload()
|
||||
loadUser().then(() => {
|
||||
loadApp()
|
||||
})
|
||||
app = app
|
||||
}}
|
||||
popup
|
||||
rd={$page.url.toString()}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
{:else if app}
|
||||
@@ -151,7 +150,7 @@
|
||||
groups: $userStore?.groups,
|
||||
username: $userStore?.username,
|
||||
query: Object.fromEntries($page.url.searchParams.entries()),
|
||||
hash: $page.url.hash
|
||||
hash: $page.url.hash.substring(1)
|
||||
}}
|
||||
workspace={$page.params.workspace}
|
||||
summary={app.summary}
|
||||
@@ -160,7 +159,7 @@
|
||||
{breakpoint}
|
||||
policy={app.policy}
|
||||
isEditor={false}
|
||||
replaceStateFn={(path) => replaceState(path, $page.state)}
|
||||
replaceStateFn={(path) => goto(path)}
|
||||
gotoFn={(path, opt) => goto(path, opt)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user