-
Notifications
You must be signed in to change notification settings - Fork 146
refactor: replace PayloadDecoder and MetadataDecoder with unified Payload component #3299
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
rossedfort
wants to merge
24
commits into
main
Choose a base branch
from
refactor-payload-component
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 20 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
fb7d660
refactor: replace PayloadDecoder and MetadataDecoder with unified Pay…
rossedfort aa66e2d
remove unused component, fix css
rossedfort 5a5794f
refactor: move Payload component into payload/ directory
rossedfort d89d123
docs: add Payload component improvement suggestions
rossedfort 13f0e56
docs: add decode-payload usage report and refactoring recommendations
rossedfort aadc984
Merge branch 'main' into refactor-payload-component
rossedfort 3bc7c9f
Merge branch 'main' into refactor-payload-component
rossedfort d174838
refactor(payload): split Payload component into focused mode-specific…
rossedfort fda5e2c
fix(payload-summary): use decodeUserMetadata and add onDecode prop
rossedfort 4ce968e
refactor(payload): extract shared decode logic into decode-payload-va…
rossedfort 00288d0
fix(payload): replace onMount with \$effect for reactive value updates
rossedfort 1265db8
add workflow with user metadata
rossedfort 47f80ec
Merge branch 'main' into refactor-payload-component
rossedfort f38770f
remove unnecessary props from payload code block
rossedfort a627493
fix summary display
rossedfort 9700eb9
add improvements
rossedfort adaf39d
fix heading levels
rossedfort 5da1c5c
add multi input workflow
rossedfort ceae496
get rid of fieldName prop and fix most of the call sites
rossedfort cb00653
fix remaining type errors
rossedfort 51a5c44
fix tests
rossedfort 6fd76a0
rm inspect
rossedfort 1d27eb4
rm console.log
rossedfort 86127b9
Merge branch 'main' into refactor-payload-component
rossedfort 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,15 @@ | ||
| <script lang="ts"> | ||
| import { page } from '$app/state'; | ||
|
|
||
| import PayloadCodeBlock from '$lib/components/payload/payload-code-block.svelte'; | ||
| import PayloadSummary from '$lib/components/payload/payload-summary.svelte'; | ||
| import Timestamp from '$lib/components/timestamp.svelte'; | ||
| import CodeBlock from '$lib/holocene/code-block.svelte'; | ||
| import Copyable from '$lib/holocene/copyable/index.svelte'; | ||
| import Link from '$lib/holocene/link.svelte'; | ||
| import { translate } from '$lib/i18n/translate'; | ||
| import type { EventLink as ELink } from '$lib/types'; | ||
| import { type Payload } from '$lib/types'; | ||
| import { type Payload as RawPayload } from '$lib/types'; | ||
| import type { WorkflowEvent } from '$lib/types/events'; | ||
| import { getEventLinkHref } from '$lib/utilities/event-link-href'; | ||
| import { | ||
|
|
@@ -28,8 +30,6 @@ | |
| } from '$lib/utilities/route-for'; | ||
|
|
||
| import EventDetailsLink from './event-details-link.svelte'; | ||
| import MetadataDecoder from './metadata-decoder.svelte'; | ||
| import PayloadDecoder from './payload-decoder.svelte'; | ||
|
|
||
| let { event }: { event: WorkflowEvent } = $props(); | ||
| const { namespace, workflow, run } = $derived(page.params); | ||
|
|
@@ -52,6 +52,7 @@ | |
| typeof value === 'object' && Object.keys(value).length > 0, | ||
| ), | ||
| ); | ||
| $inspect(payloadFields); | ||
| const linkFields = $derived( | ||
| fields.filter( | ||
| ([key, _value]) => displayLinkType(key, attributes) !== 'none', | ||
|
|
@@ -157,24 +158,20 @@ | |
| {/snippet} | ||
|
|
||
| {#snippet eventLinks(links: ELink[])} | ||
| {#each links as link} | ||
| {#each links as link (link)} | ||
| {@render eventLink(link)} | ||
| {@render eventNamespaceLink(link)} | ||
| {/each} | ||
| {/snippet} | ||
|
|
||
| {#snippet eventSummary(value: Payload)} | ||
| {#snippet eventSummary(value: RawPayload)} | ||
| <div class="flex items-start gap-4"> | ||
| <p class="min-w-56 text-sm text-secondary/80">Summary</p> | ||
| <p class="whitespace-pre-line"> | ||
| <MetadataDecoder | ||
| {value} | ||
| let:decodedValue | ||
| fallback={translate('events.decode-failed')} | ||
| > | ||
| {decodedValue} | ||
| </MetadataDecoder> | ||
| </p> | ||
| <PayloadSummary | ||
| class="whitespace-pre-line" | ||
| {value} | ||
| fallback={translate('events.decode-failed')} | ||
| /> | ||
| </div> | ||
| {/snippet} | ||
|
|
||
|
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.
|
||
|
|
@@ -186,55 +183,17 @@ | |
| {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> | ||
| <PayloadCodeBlock {value} maxHeight={384} /> | ||
| {: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> | ||
| <PayloadCodeBlock value={codeBlockValue} maxHeight={384} /> | ||
| {/if} | ||
| </div> | ||
| {#if stackTrace} | ||
| <div> | ||
| <p class="mb-1 min-w-56 text-sm text-secondary/80"> | ||
| {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')} | ||
| /> | ||
| <CodeBlock content={stackTrace} language="text" maxHeight={384} /> | ||
| </div> | ||
| {/if} | ||
| {/snippet} | ||
|
|
||
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 was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.