Skip to content

Commit

Permalink
Win 465 index observability 1 (#4538)
Browse files Browse the repository at this point in the history
* Factor isJobCancellable function in a utils file

* Add message for last indexed job and warning of deployement

* Prepare sqlx

* Update ee repo ref
  • Loading branch information
wendrul authored Oct 16, 2024
1 parent 01b95eb commit c06c42a
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 15 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion backend/ee-repo-ref.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f120cf90c1795f8254418c227c74b043c8b07185
0428068e4fbbd1380a4d8bbaab5c8e7955decdb8
5 changes: 1 addition & 4 deletions frontend/src/lib/components/runs/RunRow.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -39,9 +39,6 @@
$: isExternal = job && job.id === '-'
function isJobCancelable(j: Job): boolean {
return j.type === 'QueuedJob' && !j.schedule_path
}
</script>

<Portal name="run-row">
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/lib/components/runs/RunsTable.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -138,9 +139,6 @@
}
}
*/
function isJobCancelable(j: Job): boolean {
return j.type === 'QueuedJob' && !j.schedule_path
}
let allSelected: boolean = false
Expand Down
32 changes: 30 additions & 2 deletions frontend/src/lib/components/search/GlobalSearchModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down Expand Up @@ -240,6 +242,7 @@
})
itemMap['runs'] = searchResults.hits
queryParseErrors = searchResults.query_parse_errors
indexMetadata = searchResults.index_metadata
} catch (e) {
sendUserToast(e, true)
}
Expand Down Expand Up @@ -680,8 +683,33 @@
{#if selectedItem === undefined}
Select a result to preview
{:else}
<div class="w-8/12 overflow-y-scroll max-h-[70vh]">
<JobPreview id={selectedItem?.document?.id[0]} workspace={selectedWorkspace} />
<div class="w-8/12 max-h-[70vh]">
<div class="h-[95%] overflow-y-scroll">
<JobPreview
id={selectedItem?.document?.id[0]}
workspace={selectedWorkspace}
/>
</div>
<div class="flex flex-row pt-3 pl-4 items-center text-xs text-secondary">
{#if indexMetadata.indexed_until}
<span class="px-2">
Most recent indexed job was created <TimeAgo
agoOnlyIfRecent
date={indexMetadata.indexed_until || ''}
/>
</span>
{/if}
{#if indexMetadata.lost_lock_ownership}
<Popover notClickable placement="top">
<AlertTriangle size={16} class="text-gray-500" />
<svelte:fragment slot="text">
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.
</svelte:fragment>
</Popover>
{/if}
</div>
</div>
{/if}
{:else}
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = []
Expand Down Expand Up @@ -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'}`
}
Expand Down

0 comments on commit c06c42a

Please sign in to comment.