fix: improve scripts duplicity error in global search

This commit is contained in:
Ruben Fiszel
2025-09-23 15:03:37 +00:00
parent b64e509e60
commit 2de7134b85
9 changed files with 54 additions and 56 deletions
@@ -2054,6 +2054,13 @@ pub async fn handle_python_reqs(
.unwrap_or(Err(anyhow!("Problem by joining handle")))
{
failed = true;
append_logs(
&job_id,
w_id,
format!("\nEnv installation failed: {:?}", e),
conn,
)
.await;
tracing::warn!(
workspace_id = %w_id,
"Env installation failed: {:?}",
+3 -1
View File
@@ -81,13 +81,15 @@ ${Object.entries(args)
</Head>
<tbody class="divide-y w-full">
{#if args && Object.keys(args).length > 0}
{#if args && typeof args === 'object' && Object.keys(args).length > 0}
{#each Object.entries(args).sort((a, b) => a[0].localeCompare(b[0])) as [arg, value]}
<Row>
<Cell first>{arg}</Cell>
<Cell><ArgInfo {value} /></Cell>
</Row>
{/each}
{:else if args && typeof args !== 'object'}
<Row><Cell>Argument is not an object (type: {typeof args})</Cell></Row>
{:else if args}
<Row><Cell>No arguments</Cell></Row>
{:else}
@@ -21,6 +21,7 @@
import InitializeComponent from '../../helpers/InitializeComponent.svelte'
import DebouncedInput from '../../helpers/DebouncedInput.svelte'
import RunnableComponent from '../../helpers/RunnableComponent.svelte'
import { CancelablePromise } from '$lib/gen'
interface Props {
id: string
@@ -163,6 +164,8 @@
$effect(() => {
searchValue !== undefined && untrack(() => updateSearchInOutputs())
})
let ignoreFirst = true
</script>
{#each Object.keys(components['aggridinfinitecomponent'].initialData.configuration) as key (key)}
@@ -194,10 +197,17 @@
bind:result
bind:loading
bind:runnableComponent
on:recompute={() => {
console.log('recompute')
clear()
}}
preventDefaultRefresh
overrideCallback={() =>
new CancelablePromise(async (resolve) => {
if (ignoreFirst) {
ignoreFirst = false
resolve()
return
}
clear()
resolve()
})}
{render}
autoRefresh={true}
allowConcurentRequests
@@ -118,11 +118,12 @@
}
})
let keys = $derived(Object.keys(result[0] ?? []).filter((x) => x !== '__index'))
async function syncColumns() {
const gridItem = findGridItem($app, id)
if (gridItem && result) {
const keys = Object.keys(result[0] ?? {}) ?? []
const conf = gridItem.data.configuration.columnDefs as ColumnDefsConfiguration
const newColumns: WindmillColumnDef[] = keys.map((key) => ({
@@ -171,7 +172,7 @@
<div class="flex flex-col items-start gap-2">
<div class="text-xs"> No columns definition found. Columns found in data: </div>
<div class="text-sm flex flex-row gap-2">
{#each Object.keys(result[0] ?? []) as key}
{#each keys as key}
<Badge small color="dark-gray">{key}</Badge>
{/each}
</div>
@@ -32,13 +32,17 @@
color="light"
size="xs2"
btnClasses={twMerge(loading ? ' bg-blue-100 dark:bg-blue-400' : '', 'transition-all')}
on:click={() => {
on:click={(e) => {
if (buttonHover && loading) {
cancelCallbacks?.forEach((cb) => cb.cancel())
} else {
cancelCallbacks = $runnableComponents[id]?.cb?.map((cb) => cb())
}
}}
on:pointerdown={(e) => {
e.preventDefault()
e.stopPropagation()
}}
iconOnly
/>
{#snippet text()}
@@ -163,48 +163,8 @@
}
}
// $: sendUserToast('args' + JSON.stringify(runnableInputValues) + Boolean(extraQueryParams) || args)
// $: console.log(runnableInputValues)
let firstRefresh = true
// on:started={(e) => {
// console.log('started', e.detail)
// loading = true
// setJobId(e.detail)
// dispatch('started', e.detail)
// }}
// on:done={(e) => {
// lastJobId = e.detail.id
// setResult(e.detail.result, e.detail.id)
// loading = false
// dispatch('done', { id: e.detail?.id, result: e.detail?.result })
// }}
// on:cancel={(e) => {
// let jobId = e.detail
// console.debug('cancel', jobId)
// let job = $jobsById[jobId]
// if (job && job.created_at && !job.duration_ms) {
// $jobsById[jobId] = {
// ...job,
// started_at: job.started_at ?? Date.now(),
// duration_ms: Date.now() - (job.started_at ?? job.created_at)
// }
// }
// dispatch('cancel', { id: e.detail })
// }}
// on:running={(e) => {
// let jobId = e.detail
// let job = $jobsById[jobId]
// if (job && !job.started_at) {
// $jobsById[jobId] = { ...job, started_at: Date.now() }
// }
// }}
// on:doneError={(e) => {
// setResult({ error: e.detail.error }, e.detail.id)
// loading = false
// dispatch('doneError', { id: e.detail.id, result: e.detail.result })
// }}
type RunnableCallback = {
onDone?: (r: any) => void
onCancel?: () => void
@@ -91,6 +91,7 @@
onSuccess?: (result: any) => void
children?: import('svelte').Snippet
nonRenderedPlaceholder?: import('svelte').Snippet
preventDefaultRefresh?: boolean
}
let {
@@ -1,10 +1,22 @@
<script lang="ts">
import { twMerge } from 'tailwind-merge'
export let horizontal: boolean = false
export let gap: 'none' | 'sm' | 'md' | 'lg' = 'sm'
export let justify: 'start' | 'center' | 'end' | 'between' = 'start'
export let wFull = true
export let hFull = true
interface Props {
horizontal?: boolean
gap?: 'none' | 'sm' | 'md' | 'lg'
justify?: 'start' | 'center' | 'end' | 'between'
wFull?: boolean
hFull?: boolean
children?: import('svelte').Snippet
}
let {
horizontal = false,
gap = 'sm',
justify = 'start',
wFull = true,
hFull = true,
children
}: Props = $props()
const gapMap = {
none: '',
@@ -27,7 +39,7 @@
justify
]}"
>
<slot />
{@render children?.()}
</div>
{:else}
<div
@@ -39,6 +51,6 @@
justifyMap[justify]
)}
>
<slot />
{@render children?.()}
</div>
{/if}
@@ -56,6 +56,7 @@
time?: number
starred?: boolean
has_draft?: boolean
hash?: string
}
type TableScript = TableItem<Script, 'script'>
@@ -553,7 +554,7 @@
/>
{:else}
<div class="border rounded-md">
{#each (items ?? []).slice(0, nbDisplayed) as item (item.type + '/' + item.path)}
{#each (items ?? []).slice(0, nbDisplayed) as item (item.type + '/' + item.path + (item.hash ? '/' + item.hash : ''))}
<Item
{item}
on:scriptChanged={() => loadScripts(includeWithoutMain)}