Skip to content
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

Display Local Activity, move Close button to right #2215

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/components/lines-and-dots/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,13 @@ export const getCategoryColor = (type: EventTypeCategory): string => {
switch (type) {
case 'command':
case 'marker':
case 'local-activity':
return '#ebebeb';
case 'timer':
return '#fbbf24';
case 'signal':
return '#ec4899';
case 'activity':
case 'local-activity':
return '#a78bfa';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add an import { colors } from '$lib/theme/colors' to this component and use colors here instead?

case 'workflow':
return '#059669';
Expand Down
21 changes: 13 additions & 8 deletions src/lib/components/lines-and-dots/svg/event-detail-row.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
} from '$lib/utilities/format-camel-case';
import { formatDate } from '$lib/utilities/format-date';
import { formatAttributes } from '$lib/utilities/format-event-attributes';
import { isLocalActivityMarkerEvent } from '$lib/utilities/is-event-type';

import {
DetailsConfig,
Expand Down Expand Up @@ -55,13 +56,15 @@
</script>

{#if active && !group?.pendingActivity}
<foreignObject {x} y={y - 20} {width} height={fontSizeRatio}>
<button
class="flex items-center gap-0.5 rounded-t bg-white pl-1.5 pr-0.5 text-sm text-black"
on:click|stopPropagation={() => setActiveEvent(event, group)}
>
{translate('common.close')}<Icon name="close" />
</button>
<foreignObject {x} y={y - 24} {width} height={fontSizeRatio}>
<div class="flex w-full items-center justify-end px-1">
<button
class="flex items-center gap-0.5 rounded-t bg-white pl-1.5 pr-0.5 text-black"
on:click|stopPropagation={() => setActiveEvent(event, group)}
>
{translate('common.close')}<Icon name="close" />
</button>
</div>
</foreignObject>
{/if}
<Box
Expand All @@ -79,7 +82,9 @@
<div class="flex items-center justify-between px-2 py-1 text-sm text-white">
<div class="flex items-center gap-2">
{event.id}
{spaceBetweenCapitalLetters(event?.name)}
{spaceBetweenCapitalLetters(
isLocalActivityMarkerEvent(event) ? 'LocalActivity' : event?.name,
)}
</div>
{#if showTimestamp}
<div class="text-xs">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
staticCodeBlockHeight * codeBlockAttributes.length - textHeight,
);

$: title = group.name;
$: title = group.displayName;
$: attributes = mergeEventGroupDetails(group);
$: codeBlockAttributes = Object.entries(attributes).filter(
([, value]) => typeof value === 'object',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
: 'pending'
: event.classification;
$: detailsWidth = canvasWidth - visualWidth;
$: icon = isLocalActivityMarkerEvent(event)
$: isLocalActivity = isLocalActivityMarkerEvent(event);
$: icon = isLocalActivity
? CategoryIcon['local-activity']
: CategoryIcon[event.category];
</script>
Expand Down Expand Up @@ -65,7 +66,9 @@
{event.id}
<div class="flex items-center gap-1">
<Icon name={icon} class="text-white" />
{spaceBetweenCapitalLetters(event?.name)}
{spaceBetweenCapitalLetters(
isLocalActivity ? 'LocalActivity' : event?.name,
)}
{#if group && group.displayName && showDetails}<span
style="color: {getCategoryColor(group.category)}"
>{group.displayName}</span
Expand Down
4 changes: 4 additions & 0 deletions src/lib/models/event-groups/get-group-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ export const getEventGroupLabel = (event: CommonHistoryEvent): string => {
return 'Signal received';
}

if (isLocalActivityMarkerEvent(event)) {
return 'Local Activity';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return 'Local Activity';
return translate('events.category.local-activity');

}

if (isMarkerRecordedEvent(event)) {
return 'Marker';
}
Expand Down
Loading