feat(frontend): add missing date in the previous run panel (#3693)

This commit is contained in:
Faton Ramadani
2024-05-09 02:49:30 +02:00
committed by GitHub
parent 49688ff395
commit c03f97f94d
2 changed files with 21 additions and 3 deletions
@@ -8,7 +8,7 @@
type Job
} from '$lib/gen/index.js'
import { userStore, workspaceStore } from '$lib/stores.js'
import { classNames, displayDate, sendUserToast } from '$lib/utils.js'
import { classNames, displayDate, displayDateOnly, sendUserToast } from '$lib/utils.js'
import { createEventDispatcher } from 'svelte'
import { Pane, Splitpanes } from 'svelte-splitpanes'
import ObjectViewer from './propertyPicker/ObjectViewer.svelte'
@@ -377,11 +377,16 @@
{i.created_by}
</div>
<div
class="whitespace-nowrap col-span-3 !text-tertiary !text-2xs overflow-hidden text-ellipsis flex-shrink text-center"
class="whitespace-nowrap col-span-2 !text-tertiary !text-2xs overflow-hidden text-ellipsis flex-shrink text-center"
>
{displayDateOnly(new Date(i.created_at))}
</div>
<div
class="whitespace-nowrap col-span-2 !text-tertiary !text-2xs overflow-hidden text-ellipsis flex-shrink text-center"
>
<TimeAgo date={i.created_at ?? ''} />
</div>
<div class="col-span-2">
<div class="col-span-1">
<a
target="_blank"
href="/run/{i.id}?workspace={$workspaceStore}"
+13
View File
@@ -36,6 +36,19 @@ export function parseQueryParams(url: string | undefined) {
return params
}
export function displayDateOnly(dateString: string | Date | undefined): string {
const date = new Date(dateString ?? '')
if (date.toString() === 'Invalid Date') {
return ''
} else {
return date.toLocaleDateString([], {
year: 'numeric',
month: '2-digit',
day: '2-digit'
})
}
}
export function displayDate(
dateString: string | Date | undefined,
displaySecond = false,