Skip to content
Open
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: 2 additions & 0 deletions src/lib/stores/search-attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const searchAttributes: Readable<SearchAttributes> = derived(
([$allSearchAttributes]) => ({
...$allSearchAttributes.customAttributes,
...$allSearchAttributes.systemAttributes,
ActivityId: SEARCH_ATTRIBUTE_TYPE.KEYWORD,
}),
);

Expand Down Expand Up @@ -172,6 +173,7 @@ export const sortedSearchAttributeOptions: Readable<SearchAttributeOption[]> =
'WorkflowId',
'WorkflowType',
'RunId',
'ActivityId',
'StartTime',
'CloseTime',
];
Expand Down
1 change: 1 addition & 0 deletions src/lib/types/workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export type FilterParameters = {
executionStatus?: WorkflowStatus;
timeRange?: Duration | string;
query?: string;
activityId?: string;
};

export type ArchiveFilterParameters = Omit<FilterParameters, 'timeRange'> & {
Expand Down
4 changes: 3 additions & 1 deletion src/lib/utilities/query/filter-workflow-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export type QueryKey =
| 'CloseTime'
| 'ExecutionTime'
| 'ExecutionStatus'
| 'RunId';
| 'RunId'
| 'ActivityId';

type FilterValue = string | Duration;

Expand All @@ -29,6 +30,7 @@ const filterKeys: Readonly<Record<string, QueryKey>> = {
executionStatus: 'ExecutionStatus',
closeTime: 'CloseTime',
runId: 'RunId',
activityId: 'ActivityId',
} as const;

const isValid = (value: unknown, conditional: string): boolean => {
Expand Down
8 changes: 6 additions & 2 deletions src/lib/utilities/query/list-workflow-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ export type QueryKey =
| 'StartTime'
| 'CloseTime'
| 'ExecutionTime'
| 'ExecutionStatus';
| 'ExecutionStatus'
| 'ActivityId';

export type FilterKey =
| 'workflowId'
| 'workflowType'
| 'timeRange'
| 'executionStatus'
| 'closeTime';
| 'closeTime'
| 'activityId';

type FilterValue = string | Duration;

Expand All @@ -31,6 +33,7 @@ const queryKeys: Readonly<Record<string, QueryKey>> = {
timeRange: 'StartTime',
executionStatus: 'ExecutionStatus',
closeTime: 'CloseTime',
activityId: 'ActivityId',
} as const;

const filterKeys: readonly FilterKey[] = [
Expand All @@ -39,6 +42,7 @@ const filterKeys: readonly FilterKey[] = [
'timeRange',
'executionStatus',
'closeTime',
'activityId',
] as const;

const isValid = (value: unknown): boolean => {
Expand Down
1 change: 1 addition & 0 deletions src/lib/utilities/query/to-list-workflow-filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ const DefaultAttributes: SearchAttributes = {
WorkflowId: SEARCH_ATTRIBUTE_TYPE.KEYWORD,
WorkflowType: SEARCH_ATTRIBUTE_TYPE.KEYWORD,
RunId: SEARCH_ATTRIBUTE_TYPE.KEYWORD,
ActivityId: SEARCH_ATTRIBUTE_TYPE.KEYWORD,
};

export const toListWorkflowFilters = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const defaultParameters = {
workflowId: '',
workflowType: '',
executionStatus: null,
timeRange: null,
timeRange: undefined,
activityId: '',
};

describe('toListWorkflowParameters', () => {
Expand Down
7 changes: 6 additions & 1 deletion src/lib/utilities/query/to-list-workflow-parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@ const isWorkflowTypeStatement = is('WorkflowType');
const isWorkflowIdStatement = is('WorkflowId');
const isStartTimeStatement = is('StartTime');
const isExecutionStatusStatement = is('ExecutionStatus');
const isActivityIdStatement = is('ActivityId');

export const toListWorkflowParameters = (query: string): ParsedParameters => {
const tokens = tokenize(query);
const parameters: ParsedParameters = {
workflowId: '',
workflowType: '',
executionStatus: null,
timeRange: null,
timeRange: undefined,
activityId: '',
};

tokens.forEach((token, index) => {
Expand All @@ -66,6 +68,9 @@ export const toListWorkflowParameters = (query: string): ParsedParameters => {
console.error('Error parsing StartTime from query', error);
}
}

if (isActivityIdStatement(token))
parameters.activityId = getTwoAhead(tokens, index);
});

return parameters;
Expand Down
Loading