From 6bf53767a33d2ac14fd68c2c1dd2df57a5c949fb Mon Sep 17 00:00:00 2001 From: wendrul Date: Wed, 16 Oct 2024 16:56:44 +0200 Subject: [PATCH 1/4] Factor isJobCancellable function in a utils file --- frontend/src/lib/components/runs/RunRow.svelte | 5 +---- frontend/src/lib/components/runs/RunsTable.svelte | 4 +--- frontend/src/lib/utils.ts | 6 +++++- .../src/routes/(root)/(logged)/runs/[...path]/+page.svelte | 5 +---- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/frontend/src/lib/components/runs/RunRow.svelte b/frontend/src/lib/components/runs/RunRow.svelte index 2a024c318cdc6..f79b1b7307e65 100644 --- a/frontend/src/lib/components/runs/RunRow.svelte +++ b/frontend/src/lib/components/runs/RunRow.svelte @@ -2,7 +2,7 @@ import { base } from '$lib/base' import { goto } from '$lib/navigation' import type { Job } from '$lib/gen' - import { displayDate, msToReadableTime, truncateHash, truncateRev } from '$lib/utils' + import { displayDate, msToReadableTime, truncateHash, truncateRev, isJobCancelable } from '$lib/utils' import { Badge, Button } from '../common' import ScheduleEditor from '../ScheduleEditor.svelte' import BarsStaggered from '$lib/components/icons/BarsStaggered.svelte' @@ -39,9 +39,6 @@ $: isExternal = job && job.id === '-' - function isJobCancelable(j: Job): boolean { - return j.type === 'QueuedJob' && !j.schedule_path - } diff --git a/frontend/src/lib/components/runs/RunsTable.svelte b/frontend/src/lib/components/runs/RunsTable.svelte index 291709e2a5d3e..340eaeba9b7ef 100644 --- a/frontend/src/lib/components/runs/RunsTable.svelte +++ b/frontend/src/lib/components/runs/RunsTable.svelte @@ -8,6 +8,7 @@ import Popover from '../Popover.svelte' import { workspaceStore } from '$lib/stores' import { twMerge } from 'tailwind-merge' + import { isJobCancelable } from '$lib/utils' //import InfiniteLoading from 'svelte-infinite-loading' export let jobs: Job[] | undefined = undefined @@ -138,9 +139,6 @@ } } */ - function isJobCancelable(j: Job): boolean { - return j.type === 'QueuedJob' && !j.schedule_path - } let allSelected: boolean = false diff --git a/frontend/src/lib/utils.ts b/frontend/src/lib/utils.ts index 16692ee0aebd1..c8913a3d31008 100644 --- a/frontend/src/lib/utils.ts +++ b/frontend/src/lib/utils.ts @@ -11,11 +11,15 @@ import { deepEqual } from 'fast-equals' import YAML from 'yaml' import type { UserExt } from './stores' import { sendUserToast } from './toast' -import type { Script } from './gen' +import type { Job, Script } from './gen' import type { EnumType, SchemaProperty } from './common' import type { Schema } from './common' export { sendUserToast } +export function isJobCancelable(j: Job): boolean { + return j.type === 'QueuedJob' && !j.schedule_path && !j.canceled +} + export function validateUsername(username: string): string { if (username != '' && !/^[a-zA-Z]\w+$/.test(username)) { return 'username can only contain letters and numbers and must start with a letter' diff --git a/frontend/src/routes/(root)/(logged)/runs/[...path]/+page.svelte b/frontend/src/routes/(root)/(logged)/runs/[...path]/+page.svelte index 31c2423029f60..120699e183739 100644 --- a/frontend/src/routes/(root)/(logged)/runs/[...path]/+page.svelte +++ b/frontend/src/routes/(root)/(logged)/runs/[...path]/+page.svelte @@ -38,6 +38,7 @@ import DropdownV2 from '$lib/components/DropdownV2.svelte' import { goto } from '$app/navigation' import { base } from '$app/paths' + import { isJobCancelable } from '$lib/utils' let jobs: Job[] | undefined let selectedIds: string[] = [] @@ -496,10 +497,6 @@ isCancelingVisibleJobs = true } - function isJobCancelable(j: Job): boolean { - return j.type === 'QueuedJob' && !j.schedule_path && !j.canceled - } - function jobCountString(count: number) { return `${count} ${count == 1 ? 'job' : 'jobs'}` } From 6ab3c1bb54129f18c01d1c7f5ac80fb61dfa7e17 Mon Sep 17 00:00:00 2001 From: wendrul Date: Wed, 16 Oct 2024 18:59:50 +0200 Subject: [PATCH 2/4] Add message for last indexed job and warning of deployement --- .../search/GlobalSearchModal.svelte | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/frontend/src/lib/components/search/GlobalSearchModal.svelte b/frontend/src/lib/components/search/GlobalSearchModal.svelte index c99fd1c1f90ad..c1e74e90749c4 100644 --- a/frontend/src/lib/components/search/GlobalSearchModal.svelte +++ b/frontend/src/lib/components/search/GlobalSearchModal.svelte @@ -180,7 +180,9 @@ let debounceTimeout: any = undefined const debouncePeriod: number = 1000 let loadingCompletedRuns: boolean = false + let queryParseErrors: string[] = [] + let indexMetadata: any = {} async function handleSearch() { queryParseErrors = [] @@ -240,6 +242,7 @@ }) itemMap['runs'] = searchResults.hits queryParseErrors = searchResults.query_parse_errors + indexMetadata = searchResults.index_metadata } catch (e) { sendUserToast(e, true) } @@ -680,8 +683,33 @@ {#if selectedItem === undefined} Select a result to preview {:else} -
- +
+
+ +
+
+ {#if indexMetadata.indexed_until} + + Most recent indexed job was created + + {/if} + {#if indexMetadata.lost_lock_ownership} + + + + The current indexer is no longer indexing new jobs. This is most likely + because of an ongoing deployment and indexing will resume once it's + complete. + + + {/if} +
{/if} {:else} From 824d907e4ee10b25539ab1653226b99993952aa7 Mon Sep 17 00:00:00 2001 From: wendrul Date: Wed, 16 Oct 2024 19:09:32 +0200 Subject: [PATCH 3/4] Prepare sqlx --- ...f82b5951f17d1b7eade53c6d89253d55f8b9f.json | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 backend/.sqlx/query-5fd70c70ce52cbc51fa9124cb05f82b5951f17d1b7eade53c6d89253d55f8b9f.json diff --git a/backend/.sqlx/query-5fd70c70ce52cbc51fa9124cb05f82b5951f17d1b7eade53c6d89253d55f8b9f.json b/backend/.sqlx/query-5fd70c70ce52cbc51fa9124cb05f82b5951f17d1b7eade53c6d89253d55f8b9f.json new file mode 100644 index 0000000000000..51f58cb81cacf --- /dev/null +++ b/backend/.sqlx/query-5fd70c70ce52cbc51fa9124cb05f82b5951f17d1b7eade53c6d89253d55f8b9f.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT owner FROM concurrency_locks WHERE id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "owner", + "type_info": "Varchar" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + true + ] + }, + "hash": "5fd70c70ce52cbc51fa9124cb05f82b5951f17d1b7eade53c6d89253d55f8b9f" +} From d609140a4bd1b0f71268e1394657ba873bb5bf60 Mon Sep 17 00:00:00 2001 From: wendrul Date: Wed, 16 Oct 2024 19:09:44 +0200 Subject: [PATCH 4/4] Update ee repo ref --- backend/ee-repo-ref.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/ee-repo-ref.txt b/backend/ee-repo-ref.txt index e33bb79ab4c8c..1472a7591ac59 100644 --- a/backend/ee-repo-ref.txt +++ b/backend/ee-repo-ref.txt @@ -1 +1 @@ -f120cf90c1795f8254418c227c74b043c8b07185 +0428068e4fbbd1380a4d8bbaab5c8e7955decdb8