-
Notifications
You must be signed in to change notification settings - Fork 146
Redesign event detail layout and improve pending activities view #3281
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
Open
Alex-Tideman
wants to merge
7
commits into
main
Choose a base branch
from
input-order-for-activites
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f37e28a
Redesign event detail layout with payloads left, info right
Alex-Tideman b69ccb2
Remove unused imports/translations
Alex-Tideman e7907e2
Include scheduled event in pending activities tab and polish borders
Alex-Tideman 747bf4c
Move payload fields to the right instead of the left for better consiβ¦
Alex-Tideman 331ce5a
Merge branch 'main' into input-order-for-activites
Alex-Tideman 2802e2c
Better styles, add distance between events
Alex-Tideman b60eced
Fix event card label text styles to match
Alex-Tideman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,171 @@ | ||
| <script lang="ts"> | ||
| import { page } from '$app/state'; | ||
|
|
||
| import Timestamp from '$lib/components/timestamp.svelte'; | ||
| import Copyable from '$lib/holocene/copyable/index.svelte'; | ||
| import Link from '$lib/holocene/link.svelte'; | ||
| import { translate } from '$lib/i18n/translate'; | ||
| import type { EventGroup } from '$lib/models/event-groups/event-groups'; | ||
| import type { WorkflowEvent } from '$lib/types/events'; | ||
| import { getEventLinkHref } from '$lib/utilities/event-link-href'; | ||
| import { | ||
| format, | ||
| spaceBetweenCapitalLetters, | ||
| } from '$lib/utilities/format-camel-case'; | ||
| import type { CombinedAttributes } from '$lib/utilities/format-event-attributes'; | ||
| import { formatDistanceAbbreviated } from '$lib/utilities/format-time'; | ||
| import { | ||
| displayLinkType, | ||
| shouldDisplayAsTime, | ||
| } from '$lib/utilities/get-single-attribute-for-event'; | ||
| import { isLocalActivityMarkerEvent } from '$lib/utilities/is-event-type'; | ||
| import { | ||
| routeForEventHistoryEvent, | ||
| routeForNamespace, | ||
| } from '$lib/utilities/route-for'; | ||
|
|
||
| import EventDetailsLink from './event-details-link.svelte'; | ||
| import MetadataDecoder from './metadata-decoder.svelte'; | ||
|
|
||
| let { | ||
| event, | ||
| group, | ||
| attributes, | ||
| detailFields, | ||
| linkFields, | ||
| }: { | ||
| event: WorkflowEvent; | ||
| group?: EventGroup; | ||
| attributes: CombinedAttributes; | ||
| detailFields: [string, unknown][]; | ||
| linkFields: [string, unknown][]; | ||
| } = $props(); | ||
|
|
||
| const { namespace, workflow, run } = $derived(page.params); | ||
|
|
||
| const displayName = $derived( | ||
| isLocalActivityMarkerEvent(event) | ||
| ? translate('events.category.local-activity') | ||
| : spaceBetweenCapitalLetters(event.name), | ||
| ); | ||
|
|
||
| const durationSinceLastEvent = $derived.by(() => { | ||
| if (!group) return ''; | ||
| const eventIndex = group.eventList.findIndex((evt) => evt.id === event.id); | ||
| if (eventIndex === -1 || eventIndex === 0) return ''; | ||
| const previousEvent = group.eventList[eventIndex - 1]; | ||
| return formatDistanceAbbreviated({ | ||
| start: event.eventTime, | ||
| end: previousEvent.eventTime, | ||
| includeMilliseconds: true, | ||
| }); | ||
| }); | ||
| </script> | ||
|
|
||
| <div class="mb-2 flex w-full flex-wrap items-center justify-between gap-2"> | ||
| <div class="flex items-center gap-2 text-base"> | ||
| <Link | ||
| href={routeForEventHistoryEvent({ | ||
| eventId: event.id, | ||
| run, | ||
| workflow, | ||
| namespace, | ||
| })}>{event.id}</Link | ||
| > | ||
| <p class="font-medium"> | ||
| {displayName} | ||
| </p> | ||
| </div> | ||
| <div class="flex flex-col items-end gap-0 font-mono text-sm leading-4"> | ||
| <Timestamp as="p" dateTime={event.eventTime} /> | ||
| {#if durationSinceLastEvent} | ||
| <p class="font-medium text-secondary">+{durationSinceLastEvent}</p> | ||
| {/if} | ||
| </div> | ||
| </div> | ||
|
|
||
| {#if event?.links?.length} | ||
| {#each event.links as link} | ||
| {@const href = getEventLinkHref(link)} | ||
| {@const value = href.split('workflows/')?.[1] || href} | ||
| <div class="flex items-start gap-4"> | ||
| <p class="min-w-56 text-sm font-medium text-secondary"> | ||
| {translate('nexus.link')} | ||
| </p> | ||
| <Copyable | ||
| copyIconTitle={translate('common.copy-icon-title')} | ||
| copySuccessIconTitle={translate('common.copy-success-icon-title')} | ||
| content={value} | ||
| > | ||
| <Link {href} class="whitespace-pre-line">{value}</Link> | ||
| </Copyable> | ||
| </div> | ||
| {@const nsHref = routeForNamespace({ | ||
| namespace: link.workflowEvent.namespace, | ||
| })} | ||
| <div class="flex items-start gap-4"> | ||
| <p class="min-w-56 text-sm font-medium text-secondary"> | ||
| {translate('nexus.link-namespace')} | ||
| </p> | ||
| <Copyable | ||
| copyIconTitle={translate('common.copy-icon-title')} | ||
| copySuccessIconTitle={translate('common.copy-success-icon-title')} | ||
|
Contributor
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.
|
||
| content={link.workflowEvent.namespace} | ||
| > | ||
| <Link href={nsHref} class="whitespace-pre-line" | ||
|
Contributor
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.
|
||
| >{link.workflowEvent.namespace}</Link | ||
| > | ||
| </Copyable> | ||
| </div> | ||
| {/each} | ||
| {/if} | ||
|
|
||
| {#if event?.userMetadata?.summary} | ||
| <div class="flex items-start gap-4"> | ||
| <p class="min-w-56 text-sm font-medium text-secondary">Summary</p> | ||
| <p class="whitespace-pre-line"> | ||
| <MetadataDecoder | ||
| value={event.userMetadata.summary} | ||
| let:decodedValue | ||
| fallback={translate('events.decode-failed')} | ||
| > | ||
| {decodedValue} | ||
| </MetadataDecoder> | ||
| </p> | ||
| </div> | ||
| {/if} | ||
|
|
||
| {#each detailFields as [key, value] (key)} | ||
| <div class="flex items-start gap-4"> | ||
| <p class="min-w-56 text-sm font-medium text-secondary"> | ||
| {format(key)} | ||
| </p> | ||
| <p class="whitespace-pre-line break-all"> | ||
| {#if shouldDisplayAsTime(key)} | ||
|
Contributor
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.
|
||
| <Timestamp dateTime={value} /> | ||
| {:else} | ||
| {value} | ||
| {/if} | ||
| </p> | ||
| </div> | ||
| {/each} | ||
|
|
||
| {#each linkFields as [key, value] (key)} | ||
| <div class="flex items-start gap-4"> | ||
| <p class="min-w-56 text-sm font-medium text-secondary"> | ||
| {format(key)} | ||
| </p> | ||
| <Copyable | ||
| copyIconTitle={translate('common.copy-icon-title')} | ||
| copySuccessIconTitle={translate('common.copy-success-icon-title')} | ||
| content={String(value)} | ||
| > | ||
| <EventDetailsLink | ||
| value={String(value)} | ||
| {attributes} | ||
| type={displayLinkType(key, attributes)} | ||
| class="whitespace-pre-line" | ||
| /> | ||
| </Copyable> | ||
| </div> | ||
| {/each} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| <script lang="ts"> | ||
| import CodeBlock from '$lib/holocene/code-block.svelte'; | ||
| import { translate } from '$lib/i18n/translate'; | ||
| import { format } from '$lib/utilities/format-camel-case'; | ||
| import { | ||
| getCodeBlockValue, | ||
| getStackTrace, | ||
| } from '$lib/utilities/get-single-attribute-for-event'; | ||
|
|
||
| import PayloadDecoder from './payload-decoder.svelte'; | ||
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| let { payloadFields }: { payloadFields: [string, any][] } = $props(); | ||
| </script> | ||
|
|
||
| {#each payloadFields as [key, value] (key)} | ||
| {@const codeBlockValue = getCodeBlockValue(value)} | ||
| {@const stackTrace = getStackTrace(codeBlockValue)} | ||
| <div> | ||
| <p class="mb-1 min-w-56 text-sm font-medium text-secondary"> | ||
| {format(key)} | ||
| </p> | ||
| {#if value?.payloads} | ||
| <PayloadDecoder {value} key="payloads"> | ||
| {#snippet children(decodedValue)} | ||
| <CodeBlock | ||
| content={decodedValue} | ||
| maxHeight={384} | ||
| copyIconTitle={translate('common.copy-icon-title')} | ||
| copySuccessIconTitle={translate('common.copy-success-icon-title')} | ||
| /> | ||
| {/snippet} | ||
| </PayloadDecoder> | ||
| {:else if key === 'searchAttributes'} | ||
| <PayloadDecoder | ||
| key="searchAttributes" | ||
| value={{ searchAttributes: codeBlockValue }} | ||
| > | ||
| {#snippet children(decodedValue)} | ||
| <CodeBlock | ||
| content={decodedValue} | ||
| maxHeight={384} | ||
| copyIconTitle={translate('common.copy-icon-title')} | ||
| copySuccessIconTitle={translate('common.copy-success-icon-title')} | ||
| /> | ||
| {/snippet} | ||
| </PayloadDecoder> | ||
| {:else} | ||
| <PayloadDecoder value={codeBlockValue}> | ||
| {#snippet children(decodedValue)} | ||
| <CodeBlock | ||
| content={decodedValue} | ||
| maxHeight={384} | ||
| copyIconTitle={translate('common.copy-icon-title')} | ||
| copySuccessIconTitle={translate('common.copy-success-icon-title')} | ||
| /> | ||
| {/snippet} | ||
| </PayloadDecoder> | ||
| {/if} | ||
| </div> | ||
| {#if stackTrace} | ||
| <div> | ||
| <p class="mb-1 min-w-56 text-sm font-medium text-secondary"> | ||
| {translate('workflows.call-stack-tab')} | ||
| </p> | ||
| <CodeBlock | ||
| content={stackTrace} | ||
| language="text" | ||
| maxHeight={384} | ||
| copyIconTitle={translate('common.copy-icon-title')} | ||
| copySuccessIconTitle={translate('common.copy-success-icon-title')} | ||
| /> | ||
| </div> | ||
| {/if} | ||
| {/each} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.