-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dt 1142 deep linking activities #1659
Changes from all commits
715dad9
2531ca8
4dc9da7
54a1bb3
ac925a7
159d947
7f404b4
b63c4df
ae5dc7c
2848bd1
94e4a1f
c78dd60
079593d
ccb46ae
0d88875
e011fca
bf59034
d90815b
3711ea3
e947ab2
199b611
795e8d1
4de13b9
d304ee8
756a01a
426ebd4
9f9c5af
7b0f036
05f3fbd
a5e4a00
4448344
d98f72c
ebc1723
8ff4fad
feb909f
1028c77
6733a68
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
<script lang="ts"> | ||
import { goto } from '$app/navigation'; | ||
import { page } from '$app/stores'; | ||
|
||
import Table from '$lib/holocene/table/table.svelte'; | ||
import type { EventGroup } from '$lib/models/event-groups/event-groups'; | ||
import { | ||
|
@@ -7,10 +10,27 @@ | |
eventOrGroupIsTerminated, | ||
} from '$lib/models/event-groups/get-event-in-group'; | ||
import { isLocalActivityMarkerEvent } from '$lib/utilities/is-event-type'; | ||
import { routeForEventHistory } from '$lib/utilities/route-for'; | ||
|
||
export let eventGroup: EventGroup; | ||
export let selectedId: string; | ||
export let onGroupClick: (id: string) => void; | ||
|
||
const handleGroupClick = (id: string) => { | ||
const { namespace, workflow, run } = $page.params; | ||
const queryParams: Record<string, string> = {}; | ||
$page.url.searchParams.forEach((value, key) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not just use a |
||
queryParams[key] = value; | ||
}); | ||
const route = routeForEventHistory({ | ||
queryParams, | ||
namespace, | ||
workflow, | ||
run, | ||
}); | ||
goto(`${route}#${id}`, { noScroll: true }); | ||
onGroupClick(id); | ||
}; | ||
</script> | ||
|
||
<div class="w-full border-gray-700 lg:w-1/3 lg:border-r-2"> | ||
|
@@ -22,11 +42,13 @@ | |
class:failure={eventOrGroupIsFailureOrTimedOut(eventInGroup)} | ||
class:canceled={eventOrGroupIsCanceled(eventInGroup)} | ||
class:terminated={eventOrGroupIsTerminated(eventInGroup)} | ||
on:click|preventDefault|stopPropagation={() => onGroupClick(id)} | ||
on:click|preventDefault|stopPropagation={() => handleGroupClick(id)} | ||
> | ||
<td class="w-1/12" /> | ||
<td class="w-24"> | ||
<p class="truncate text-sm text-gray-500 md:text-base">{id}</p> | ||
<p class="truncate text-sm text-gray-500 md:text-base"> | ||
{id} | ||
</p> | ||
</td> | ||
<td> | ||
<p class="event-type truncate text-sm md:text-base"> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
import { onMount } from 'svelte'; | ||
import { DataSet, Timeline } from 'vis-timeline/standalone'; | ||
|
||
import { page } from '$app/stores'; | ||
|
||
import Accordion from '$lib/holocene/accordion.svelte'; | ||
import Icon from '$lib/holocene/icon/icon.svelte'; | ||
import ToggleButton from '$lib/holocene/toggle-button/toggle-button.svelte'; | ||
|
@@ -150,7 +152,14 @@ | |
): void => { | ||
timeline.setGroups(groups); | ||
timeline.setItems(items); | ||
timeline.fit(); | ||
|
||
if ($page.url.hash) { | ||
setTimeout(() => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we using a |
||
timeline.fit(); | ||
}, 2000); | ||
} else { | ||
timeline.fit(); | ||
} | ||
}; | ||
|
||
const filterHistory = ( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
<script lang="ts"> | ||
import { noop } from 'svelte/internal'; | ||
import { noop, onMount } from 'svelte/internal'; | ||
import { fade } from 'svelte/transition'; | ||
|
||
import { goto } from '$app/navigation'; | ||
import { page } from '$app/stores'; | ||
|
||
import Icon from '$lib/holocene/icon/icon.svelte'; | ||
import Link from '$lib/holocene/link.svelte'; | ||
import { isEventGroup } from '$lib/models/event-groups'; | ||
|
@@ -18,6 +21,7 @@ | |
import { formatDistanceAbbreviated } from '$lib/utilities/format-time'; | ||
import { getSingleAttributeForEvent } from '$lib/utilities/get-single-attribute-for-event'; | ||
import { isLocalActivityMarkerEvent } from '$lib/utilities/is-event-type'; | ||
import { routeForEventHistory } from '$lib/utilities/route-for'; | ||
|
||
import EventDetailsFull from './event-details-full.svelte'; | ||
import EventDetailsRow from './event-details-row.svelte'; | ||
|
@@ -30,11 +34,16 @@ | |
export let active = false; | ||
export let onRowClick: () => void = noop; | ||
|
||
onMount(() => { | ||
const hash = $page.url.hash; | ||
if (`#${event.id}` === hash && !expanded) expanded = true; | ||
}); | ||
|
||
let selectedId = isEventGroup(event) | ||
? Array.from(event.events.keys()).pop() | ||
: event.id; | ||
|
||
$: expanded = expandAll || active; | ||
$: expanded = expandAll; | ||
|
||
$: descending = $eventFilterSort === 'descending'; | ||
$: showElapsed = $eventShowElapsed === 'true'; | ||
|
@@ -61,6 +70,19 @@ | |
|
||
const onLinkClick = () => { | ||
expanded = !expanded; | ||
// Dont delete query params like ?per-page | ||
const { namespace, workflow, run } = $page.params; | ||
const queryParams: Record<string, string> = {}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea, if we're doing this more than once, then we should definitely break it out. |
||
$page.url.searchParams.forEach((value, key) => { | ||
queryParams[key] = value; | ||
}); | ||
const route = routeForEventHistory({ | ||
queryParams, | ||
namespace, | ||
workflow, | ||
run, | ||
}); | ||
goto(`${route}#${event.id}`, { noScroll: true }); | ||
onRowClick(); | ||
}; | ||
|
||
|
@@ -79,7 +101,7 @@ | |
class:terminated | ||
class:typedError | ||
data-testid="event-summary-row" | ||
on:click|stopPropagation={onLinkClick} | ||
on:click|preventDefault|stopPropagation={onLinkClick} | ||
> | ||
<td /> | ||
<td class="w-24 text-left"> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
<script lang="ts"> | ||
import { onMount } from 'svelte'; | ||
|
||
import { goto } from '$app/navigation'; | ||
import { page } from '$app/stores'; | ||
|
||
import EventSummaryRow from '$lib/components/event/event-summary-row.svelte'; | ||
|
@@ -31,12 +34,29 @@ | |
$: ({ namespace, workflow: workflowId, run: runId } = $page.params); | ||
|
||
let loading = true; | ||
let hash = ''; | ||
|
||
const resetFullHistory = () => { | ||
$fullEventHistory = []; | ||
loading = true; | ||
}; | ||
|
||
onMount(() => { | ||
hash = $page.url.hash; | ||
}); | ||
|
||
function scrollIntoView(target, eventHistory) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be broken out. |
||
if (parseInt(target) > eventHistory.length) { | ||
window.location.hash = ''; | ||
return; | ||
} | ||
const element = document.getElementById(target); | ||
if (!element) return; | ||
goto(`${$page.url}`, { noScroll: true }).then(() => { | ||
element.scrollIntoView({ behavior: 'smooth', block: 'center' }); | ||
}); | ||
} | ||
|
||
const fetchEvents = async ( | ||
namespace: string, | ||
workflowId: string, | ||
|
@@ -54,6 +74,9 @@ | |
sort: compact ? 'ascending' : sort, | ||
}); | ||
loading = false; | ||
setTimeout(() => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
scrollIntoView(hash.slice(1), $fullEventHistory); | ||
}, 50); | ||
}; | ||
|
||
$: $refresh, fetchEvents(namespace, workflowId, runId, $eventFilterSort); | ||
|
@@ -112,7 +135,7 @@ | |
{compact} | ||
expandAll={$expandAllEvents === 'true'} | ||
{initialItem} | ||
active={activeRowIndex === index} | ||
active={activeRowIndex === index || event.id === hash.slice(1)} | ||
onRowClick={() => setActiveRowIndex(index)} | ||
/> | ||
{:else} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably just store these variables in the top-level instead of fetching them every time.