Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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 @@ -12,6 +12,7 @@
fetchPaginatedWorkflows,
} from '$lib/services/workflow-service';
import { configurableTableColumns } from '$lib/stores/configurable-table-columns';
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 +75,12 @@
};

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';
};
</script>

{#key [namespace, query, $refresh]}
Expand Down Expand Up @@ -128,6 +135,21 @@
</TableEmptyState>
</svelte:fragment>
<svelte:fragment slot="actions-end-additional" let:visibleItems let:page>
<Tooltip
text={compact
? translate('common.dense')
: translate('common.comfortable')}
top
>
<Button
on:click={setTableDensity}
data-testid="table-density-button"
size="xs"
variant="ghost"
leadingIcon={compact ? 'table-compact' : '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,23 +55,25 @@
};
</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}
{#if !truncate}
<FilterOrCopyButtons
copyIconTitle={translate('common.copy-icon-title')}
copySuccessIconTitle={translate('common.copy-success-icon-title')}
filterIconTitle={translate('common.filter-workflows')}
show={filterOrCopyButtonsVisible}
content={value}
onFilter={onRowFilterClick}
filtered={$workflowFilters.some(
(filter) => filter.attribute === attribute && filter.value === value,
)}
/>
{/if}
<FilterOrCopyButtons
copyIconTitle={translate('common.copy-icon-title')}
copySuccessIconTitle={translate('common.copy-success-icon-title')}
filterIconTitle={translate('common.filter-workflows')}
show={filterOrCopyButtonsVisible}
content={value}
onFilter={onRowFilterClick}
filtered={$workflowFilters.some(
(filter) => filter.attribute === attribute && filter.value === value,
)}
/>
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}
/>
{: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,9 +204,15 @@
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}
{:else if label === 'Parent Namespace'}
Expand All @@ -202,7 +224,10 @@
? 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 @@ -217,18 +242,26 @@
{@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>
Expand Down
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
4 changes: 4 additions & 0 deletions src/lib/holocene/icon/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ import sun from './svg/sun.svelte';
import support from './svg/support.svelte';
import switchIcon from './svg/switch.svelte';
import systemWindow from './svg/system-window.svelte';
import tableComfy from './svg/table-comfy.svelte';
import tableCompact from './svg/table-compact.svelte';
import table from './svg/table.svelte';
import tag from './svg/tag.svelte';
import target from './svg/target.svelte';
Expand Down Expand Up @@ -271,6 +273,8 @@ export const icons = {
support,
switch: switchIcon,
table,
'table-comfy': tableComfy,
'table-compact': tableCompact,
tag,
target,
'temporal-logo': temporalLogo,
Expand Down
14 changes: 14 additions & 0 deletions src/lib/holocene/icon/svg/table-comfy.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<script lang="ts">
import Svg from '../svg.svelte';
let props = $props();
</script>

<Svg {...props}>
<path
stroke="currentcolor"
stroke-width="2"
d="M3 22H21C21.5523 22 22 21.5523 22 21V3C22 2.44772 21.5523 2 21 2H3C2.44772 2 2 2.44772 2 3V21C2 21.5523 2.44772 22 3 22Z"
></path>
<path stroke="currentcolor" stroke-width="2" d="M22 8.75L2 8.75"></path>
<path stroke="currentcolor" stroke-width="2" d="M22 15.25L2 15.25"></path>
</Svg>
16 changes: 16 additions & 0 deletions src/lib/holocene/icon/svg/table-compact.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<script lang="ts">
import Svg from '../svg.svelte';
let props = $props();
</script>

<Svg {...props}>
<path
stroke="currentcolor"
stroke-width="2"
d="M3 22H21C21.5523 22 22 21.5523 22 21V3C22 2.44772 21.5523 2 21 2H3C2.44772 2 2 2.44772 2 3V21C2 21.5523 2.44772 22 3 22Z"
></path>
<path stroke="currentcolor" stroke-width="2" d="M22 6L2 6"></path>
<path stroke="currentcolor" stroke-width="2" d="M22 10L2 10"></path>
<path stroke="currentcolor" stroke-width="2" d="M22 14L2 14"></path>
<path stroke="currentcolor" stroke-width="2" d="M22 18L2 18"></path>
</Svg>
3 changes: 3 additions & 0 deletions src/lib/i18n/locales/en/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,7 @@ export const Strings = {
'slack-community': 'Slack Community',
'community-forum': 'Community Forum',
'change-log': 'Change Log',
compact: 'Compact',
Comment thread
Alex-Tideman marked this conversation as resolved.
Outdated
comfortable: 'Comfortable',
dense: 'Dense',
} as const;
8 changes: 8 additions & 0 deletions src/lib/stores/table-density.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { persistStore } from './persist-store';

type TableDensity = 'compact' | 'comfortable';
export const tableDensity = persistStore<TableDensity>(
'tableDensity',
'comfortable',
true,
);
Loading
Loading