Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 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
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
createFilter,
updateQueryParamsFromFilter,
} from '$lib/utilities/query/to-list-workflow-filters';
import { truncateValue } from '$lib/utilities/truncate-value';

interface Props {
attribute?: string;
Expand Down Expand Up @@ -79,12 +80,6 @@
hideFilterOrCopy();
}
};
const truncate = (value: string | undefined | null): string => {
if (value?.length && value.length > 13) {
return `${value.slice(0, 6)}...${value.slice(-6)}`;
}
return value ?? '';
};
</script>

<td
Expand All @@ -99,11 +94,11 @@
{#if attribute === 'BuildId' || attribute === 'WorkerInstanceKey'}
{#if href}
<Tooltip text={value ?? undefined} top class="min-w-0">
<Link {href}>{truncate(value)}</Link>
<Link {href}>{truncateValue(value)}</Link>
</Tooltip>
{:else}
<Tooltip text={value ?? undefined} top class="min-w-0">
{truncate(value)}
{truncateValue(value)}
</Tooltip>
{/if}
{:else if href}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import TableEmptyState from '$lib/components/workflow/workflows-summary-configurable-table/table-empty-state.svelte';
import Button from '$lib/holocene/button.svelte';
import FeatureTag from '$lib/holocene/feature-tag.svelte';
import Icon from '$lib/holocene/icon/icon.svelte';
import PaginatedTable from '$lib/holocene/table/paginated-table/api-paginated.svelte';
import Tooltip from '$lib/holocene/tooltip.svelte';
Expand All @@ -12,6 +13,8 @@
fetchPaginatedWorkflows,
} from '$lib/services/workflow-service';
import { configurableTableColumns } from '$lib/stores/configurable-table-columns';
import { viewFeature } from '$lib/stores/new-feature-tags';
import { tableDensity } from '$lib/stores/table-density';
import { refresh, workflowCount } from '$lib/stores/workflows';
import type { WorkflowExecution } from '$lib/types/workflows';
import { exportWorkflows } from '$lib/utilities/export-workflows';
Expand Down Expand Up @@ -74,6 +77,13 @@
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • ⚠️ Argument of type 'string | null' is not assignable to parameter of type 'string | undefined'.

$: onFetch = () => fetchPaginatedWorkflows(namespace, query);

$: compact = $tableDensity === 'compact';

const setTableDensity = () => {
$tableDensity = compact ? 'comfortable' : 'compact';
viewFeature('tableDensity');
};
</script>

{#key [namespace, query, $refresh]}
Expand Down Expand Up @@ -128,6 +138,21 @@
</TableEmptyState>
</svelte:fragment>
<svelte:fragment slot="actions-end-additional" let:visibleItems let:page>
<Tooltip
text={compact
? translate('common.dense')
: translate('common.comfortable')}
top
>
<FeatureTag feature="tableDensity" alpha />
<Button
on:click={setTableDensity}
data-testid="table-density-button"
size="xs"
variant="ghost"
leadingIcon={compact ? 'table-dense' : 'table-comfy'}
></Button>
</Tooltip>
<Tooltip text={translate('common.download-json')} top>
<Button
on:click={() => exportWorkflows(visibleItems, page)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,25 @@
createFilter,
updateQueryParamsFromFilter,
} from '$lib/utilities/query/to-list-workflow-filters';
import { truncateValue } from '$lib/utilities/truncate-value';

type Props = {
attribute: string;
filterOrCopyButtonsVisible: boolean;
value: string;
href?: string;
type?: SearchAttributeType;
truncate?: boolean;
};
let {
attribute,
filterOrCopyButtonsVisible = false,
value,
href,
type = SEARCH_ATTRIBUTE_TYPE.KEYWORD,
truncate = true,
Comment thread
Alex-Tideman marked this conversation as resolved.
Outdated
}: Props = $props();

const truncateRunId = (runId: string): string => {
if (runId.length > 11) {
return `${runId.slice(0, 4)}...${runId.slice(-4)}`;
}
return runId;
};

const isRunId = attribute === 'RunId';

const onRowFilterClick = () => {
const filter = $workflowFilters.find((f) => f.attribute === attribute);
const getOtherFilters = () =>
Expand All @@ -61,14 +55,14 @@
};
</script>

{#if isRunId}
<Tooltip text={value} top class="min-w-0">
<Link {href} class="cursor-help">{truncateRunId(value)}</Link>
{#if href}
<Tooltip text={value} top class="min-w-0" hide={!truncate}>
<Link {href}>{truncate ? truncateValue(value) : value}</Link>
Comment thread
Alex-Tideman marked this conversation as resolved.
</Tooltip>
{:else if href}
<Link {href}>{value}</Link>
{:else}
{value}
<Tooltip text={value} top class="min-w-0" hide={!truncate}>
{truncate ? truncateValue(value) : value}
</Tooltip>
{/if}
<FilterOrCopyButtons
copyIconTitle={translate('common.copy-icon-title')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
import Timestamp from '$lib/components/timestamp.svelte';
import WorkflowStatus from '$lib/components/workflow-status.svelte';
import Badge from '$lib/holocene/badge.svelte';
import Tooltip from '$lib/holocene/tooltip.svelte';
import type { ConfigurableTableHeader } from '$lib/stores/configurable-table-columns';
import {
customSearchAttributes,
isCustomSearchAttribute,
workflowIncludesSearchAttribute,
} from '$lib/stores/search-attributes';
import { tableDensity } from '$lib/stores/table-density';
import {
SEARCH_ATTRIBUTE_TYPE,
type WorkflowExecution,
Expand All @@ -22,6 +24,7 @@
routeForWorkerDeployment,
routeForWorkflow,
} from '$lib/utilities/route-for';
import { truncateValue } from '$lib/utilities/truncate-value';
import { isWorkflowTaskFailure } from '$lib/utilities/workflow-task-failures';

import FilterableTableCell from './filterable-table-cell.svelte';
Expand All @@ -32,6 +35,7 @@
archival?: boolean;
};
let { column, workflow, archival = false }: Props = $props();
let truncate = $derived($tableDensity === 'compact');
Comment thread
Alex-Tideman marked this conversation as resolved.
Outdated

const { label } = $derived(column);
const namespace = $derived(page.params.namespace);
Expand Down Expand Up @@ -69,7 +73,8 @@

{#if filterableLabels.includes(label) || isCustomKeywordOrTextAttribute}
<td
class="workflows-summary-table-body-cell filterable"
class="workflows-summary-table-body-cell"
class:filterable={!truncate}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If there aren't a lot of columns in the table, the filter and copy buttons can get super far away from the actually cell data. Wondering if it would look at all better to make them stick close to the end of the text?

Image

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah was thinking about this, but if you don't have many columns, you aren't going to use Dense mode. I don't want to add a bunch of complexity here when its not really the point of the mode to use when you just have a couple of columns.

data-testid="workflows-summary-table-body-cell"
onmouseover={showFilterOrCopy}
onfocus={showFilterOrCopy}
Expand All @@ -89,6 +94,7 @@
run: workflow.runId,
archival,
})}
{truncate}
/>
{:else if label === 'Workflow ID'}
<FilterableTableCell
Expand All @@ -101,6 +107,7 @@
run: workflow.runId,
archival,
})}
{truncate}
/>
{:else if label === 'Run ID'}
<FilterableTableCell
Expand All @@ -113,6 +120,7 @@
run: workflow.runId,
archival,
})}
truncate
Comment thread
Alex-Tideman marked this conversation as resolved.
Outdated
/>
{:else if label === 'Deployment'}
{@const deployment =
Expand All @@ -127,6 +135,7 @@
deployment,
})
: undefined}
{truncate}
/>
{:else if label === 'Deployment Version'}
{@const version =
Expand All @@ -136,6 +145,7 @@
{filterOrCopyButtonsVisible}
attribute="TemporalWorkerDeploymentVersion"
value={version && typeof version === 'string' ? version : ''}
{truncate}
/>
{:else if label === 'Build ID'}
{@const buildId =
Expand All @@ -148,6 +158,7 @@
{filterOrCopyButtonsVisible}
attribute="TemporalWorkerBuildId"
value={buildId && typeof buildId === 'string' ? buildId : ''}
{truncate}
/>
{:else if label === 'Versioning Behavior'}
{@const behavior =
Expand All @@ -157,6 +168,7 @@
{filterOrCopyButtonsVisible}
attribute="TemporalWorkflowVersioningBehavior"
value={behavior && typeof behavior === 'string' ? behavior : ''}
{truncate}
/>
{:else if isCustomKeywordOrTextAttribute}
{@const content = workflow.searchAttributes?.indexedFields?.[label]}
Expand All @@ -165,6 +177,7 @@
attribute={label}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • ⚠️ Type 'string | undefined' is not assignable to type 'string'.

value={content}
type={$customSearchAttributes[label]}
{truncate}
/>
{:else if label === 'Scheduled By ID'}
{@const scheduleId =
Expand All @@ -173,13 +186,16 @@
{filterOrCopyButtonsVisible}
attribute="TemporalScheduledById"
value={scheduleId && typeof scheduleId === 'string' ? scheduleId : ''}
{truncate}
/>
{/if}
</td>
{:else}
<td
class="workflows-summary-table-body-cell"
data-testid="workflows-summary-table-body-cell"
class:comfy={!truncate}
class:dense={truncate}
Comment thread
Alex-Tideman marked this conversation as resolved.
Outdated
>
{#if label === 'Status'}
<WorkflowStatus
Expand All @@ -188,21 +204,41 @@
taskFailure={isWorkflowTaskFailure(workflow)}
/>
{:else if label === 'End'}
<Timestamp dateTime={workflow.endTime} />
<Timestamp
dateTime={workflow.endTime}
options={{ format: truncate ? 'short' : 'long' }}
/>
{:else if label === 'Start'}
<Timestamp dateTime={workflow.startTime} />
<Timestamp
dateTime={workflow.startTime}
options={{ format: truncate ? 'short' : 'long' }}
/>
{:else if label === 'Task Queue'}
{workflow.taskQueue}
<Tooltip text={workflow.taskQueue} top class="min-w-0" hide={!truncate}>
{truncate ? truncateValue(workflow.taskQueue) : workflow.taskQueue}
</Tooltip>
{:else if label === 'Parent Namespace'}
{workflow?.parentNamespaceId ?? ''}
<Tooltip
text={workflow?.parentNamespaceId ?? ''}
top
class="min-w-0"
hide={!truncate}
>
{truncate
? truncateValue(workflow?.parentNamespaceId ?? '')
: (workflow?.parentNamespaceId ?? '')}
</Tooltip>
{:else if label === 'History Size'}
{formatBytes(parseInt(workflow.historySizeBytes, 10))}
{:else if label === 'State Transitions'}
{parseInt(workflow.stateTransitionCount, 10) > 0
? workflow.stateTransitionCount
: ''}
{:else if label === 'Execution Time'}
<Timestamp dateTime={workflow.executionTime} />
<Timestamp
dateTime={workflow.executionTime}
options={{ format: truncate ? 'short' : 'long' }}
/>
{:else if label === 'Execution Duration'}
{formatDistance({
start: workflow.startTime,
Expand All @@ -212,34 +248,56 @@
{:else if label === 'History Length'}
{parseInt(workflow.historyEvents, 10) > 0 ? workflow.historyEvents : ''}
{:else if label === 'Scheduled By ID'}
{workflow.searchAttributes?.indexedFields?.TemporalScheduledById ?? ''}
<Tooltip
text={workflow.searchAttributes?.indexedFields?.TemporalScheduledById ??
''}
top
class="min-w-0"
hide={!truncate}
>
{truncate
? truncateValue(
workflow.searchAttributes?.indexedFields?.TemporalScheduledById ??
'',
)
: (workflow.searchAttributes?.indexedFields?.TemporalScheduledById ??
'')}
</Tooltip>
{:else if label === 'Scheduled Start Time'}
{@const content =
workflow.searchAttributes?.indexedFields?.TemporalScheduledStartTime}
{#if content && typeof content === 'string'}
<Timestamp dateTime={content} />
<Timestamp
dateTime={content}
options={{ format: truncate ? 'short' : 'long' }}
/>
{/if}
{:else if label === 'Change Version'}
{workflow.searchAttributes?.indexedFields?.TemporalChangeVersion}
{:else if isCustomSearchAttribute(label) && workflowIncludesSearchAttribute(workflow, label)}
{@const content = workflow.searchAttributes?.indexedFields?.[label]}
{#if $customSearchAttributes[label] === SEARCH_ATTRIBUTE_TYPE.DATETIME && typeof content === 'string'}
<Timestamp dateTime={content} />
<Timestamp
dateTime={content}
options={{ format: truncate ? 'short' : 'long' }}
/>
{:else if $customSearchAttributes[label] === SEARCH_ATTRIBUTE_TYPE.BOOL}
<Badge>{content}</Badge>
{:else}
{content}
<Tooltip text={content} top class="min-w-0" hide={!truncate}>
{truncate ? truncateValue(content) : content}
</Tooltip>
{/if}
{/if}
</td>
{/if}

<style lang="postcss">
.workflows-summary-table-body-cell {
@apply h-8 whitespace-nowrap;
@apply relative h-8 whitespace-nowrap;

&.filterable {
@apply relative pr-24;
@apply pr-16;
}
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
type BatchOperationContext,
} from '$lib/pages/workflows-with-new-search.svelte';
import { supportsBulkActions } from '$lib/stores/bulk-actions';
import { tableDensity } from '$lib/stores/table-density';
import type { WorkflowExecution } from '$lib/types/workflows';
import { workflowCreateDisabled } from '$lib/utilities/workflow-create-disabled';

Expand Down Expand Up @@ -71,6 +72,7 @@
workflowId={workflow.id}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • ⚠️ 'workflow' is possibly 'undefined'.
  • ⚠️ Type 'string | undefined' is not assignable to type 'string'.

taskQueue={workflow.taskQueue}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • ⚠️ 'workflow' is possibly 'undefined'.

workflowType={workflow.name}
class={$tableDensity === 'compact' ? 'mt-1 h-5 w-5' : ''}
/>
{/if}
<IsTemporalServerVersionGuard minimumVersion="1.23.0">
Expand All @@ -79,6 +81,7 @@
size="xs"
variant={childrenShown ? 'primary' : 'ghost'}
on:click={() => viewChildren(workflow)}
class={$tableDensity === 'compact' ? 'mt-1 h-5 w-5' : ''}
>
<Tooltip
text={childrenShown
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • ⚠️ Argument of type '{ count: number | undefined; }' is not assignable to parameter of type 'I18nReplace'.

Expand Down
Loading
Loading