Skip to content

Commit

Permalink
Add Link Namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Tideman committed Oct 2, 2024
1 parent a1731ad commit ac246d2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 17 deletions.
15 changes: 8 additions & 7 deletions src/lib/components/event/event-link.svelte
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
<script lang="ts">
import Badge from '$lib/holocene/badge.svelte';
import Link from '$lib/holocene/link.svelte';
import { translate } from '$lib/i18n/translate';
import type { EventLink } from '$lib/types/events';
import { routeForEventHistory } from '$lib/utilities/route-for';
export let link: EventLink;
export let label = 'Link';
export let xs = false;
$: href = routeForEventHistory({
export let value = link.workflowEvent.workflowId;
export let label = translate('common.link');
export let href = routeForEventHistory({
namespace: link.workflowEvent.namespace,
workflow: link.workflowEvent.workflowId,
run: link.workflowEvent.runId,
eventId: link.workflowEvent.eventRef?.eventId,
});
export let xs = false;
</script>

<div
class="flex max-w-lg flex-row items-center gap-2 overflow-hidden first:pt-0 last:border-b-0 xl:max-w-xl {$$props.class}"
class="flex max-w-lg flex-row items-center gap-1 gap-2 overflow-hidden first:pt-0 last:border-b-0 xl:max-w-xl {$$props.class}"
>
<p class="max-w-fit whitespace-nowrap text-right text-sm" class:text-xs={xs}>
{label}
</p>
<div class="overflow-hidden truncate pr-1">
<div class="overflow-hidden truncate">
<Badge type="subtle">
<Link {href}>
{link.workflowEvent.workflowId}
{value}
</Link>
</Badge>
</div>
Expand Down
13 changes: 9 additions & 4 deletions src/lib/components/event/event-links-expanded.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<script lang="ts">
import { translate } from '$lib/i18n/translate';
import type { EventLink as ELink } from '$lib/types/events';
import { routeForNamespace } from '$lib/utilities/route-for';
import EventLink from './event-link.svelte';
Expand All @@ -13,12 +15,15 @@
>
<EventLink {link} />
</div>
{/if}
<!-- {#if link?.workflowEvent}
<div
class="block flex w-full items-center gap-4 px-2 py-1 py-1 text-left text-left xl:flex"
>
Link Namespace
<EventLink
{link}
label={translate('common.link-namespace')}
value={link.workflowEvent.namespace}
href={routeForNamespace({ namespace: link.workflowEvent.namespace })}
/>
</div>
{/if} -->
{/if}
{/each}
13 changes: 7 additions & 6 deletions src/lib/components/lines-and-dots/workflow-callback.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import { timeFormat } from '$lib/stores/time-format';
import type { CallbackInfo } from '$lib/types';
import { formatDate } from '$lib/utilities/format-date';
import { routeForNamespace } from '$lib/utilities/route-for';
import EventLink from '../event/event-link.svelte';
Expand Down Expand Up @@ -34,13 +35,13 @@
<div class="flex flex-col gap-2 pt-2">
{#if link}
<EventLink {link} />
<EventLink
{link}
label={translate('common.link-namespace')}
value={link.workflowEvent.namespace}
href={routeForNamespace({ namespace: link.workflowEvent.namespace })}
/>
{/if}
<p class="flex items-center gap-2">
{translate('common.url')}
<Badge type="subtle">
{callback.callback.nexus.url}
</Badge>
</p>
<div class="flex flex-col items-start gap-2 md:flex-row md:items-center">
<p class="flex items-center gap-2">
{translate('common.state')}
Expand Down
2 changes: 2 additions & 0 deletions src/lib/i18n/locales/en/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,6 @@ export const Strings = {
message: 'Message',
'upload-json': 'Upload JSON',
'input-valid-json': 'Input must be valid JSON',
link: 'Link',
'link-namespace': 'Link Namespace',
} as const;

0 comments on commit ac246d2

Please sign in to comment.