-
Notifications
You must be signed in to change notification settings - Fork 125
feat: [2/n] Implement new Workflows List Table #1229
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
Merged
adhityamamallan
merged 11 commits into
cadence-workflow:master
from
adhityamamallan:pr2-workflows-list-grid
Apr 8, 2026
Merged
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
bbd2f81
Add unit tests
adhityamamallan e62568f
use updated config and fix it
adhityamamallan af431d6
Implement workflows list grid
adhityamamallan 87a58bf
resolve build issues
adhityamamallan 3ca5045
fix test
adhityamamallan 805087a
Make cluster attributes smaller
adhityamamallan 25b1281
Fix nits
adhityamamallan f2ed7bb
Add null check to datetime search attribute
adhityamamallan 47c966a
fix tests
adhityamamallan a976615
Merge branch 'master' into pr2-workflows-list-grid
adhityamamallan d004492
fix tests for real this time
adhityamamallan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
82 changes: 71 additions & 11 deletions
82
...archival/domain-workflows-archival-list/__tests__/domain-workflows-archival-list.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,82 @@ | ||
| import { HttpResponse } from 'msw'; | ||
|
|
||
| import { render, screen } from '@/test-utils/rtl'; | ||
|
|
||
| import { getMockWorkflowListItem } from '@/route-handlers/list-workflows/__fixtures__/mock-workflow-list-items'; | ||
| import { type ListWorkflowsResponse } from '@/route-handlers/list-workflows/list-workflows.types'; | ||
|
|
||
| import type { Props as MSWMocksHandlersProps } from '../../../../test-utils/msw-mock-handlers/msw-mock-handlers.types'; | ||
| import { mockDomainPageQueryParamsValues } from '../../../domain-page/__fixtures__/domain-page-query-params'; | ||
| import DomainWorkflowsArchivalList from '../domain-workflows-archival-list'; | ||
|
|
||
| jest.mock('@/components/error-panel/error-panel', () => | ||
| jest.fn(({ message }: { message: string }) => <div>{message}</div>) | ||
| ); | ||
|
|
||
| jest.mock('@/views/shared/workflows-list/workflows-list', () => | ||
| jest.fn(() => <div>Mock workflows list</div>) | ||
| ); | ||
|
|
||
| jest.mock('@/hooks/use-page-query-params/use-page-query-params', () => | ||
| jest.fn(() => [mockDomainPageQueryParamsValues, jest.fn()]) | ||
| ); | ||
|
|
||
| jest.mock('@/hooks/use-config-value/use-suspense-config-value', () => | ||
| jest.fn(() => ({ data: true })) | ||
| ); | ||
|
|
||
| jest.mock('query-string', () => ({ | ||
| stringifyUrl: jest.fn( | ||
| () => '/api/domains/mock-domain/mock-cluster/workflows' | ||
| ), | ||
| })); | ||
|
|
||
| describe(DomainWorkflowsArchivalList.name, () => { | ||
| it('renders workflows list', () => { | ||
| render( | ||
| <DomainWorkflowsArchivalList | ||
| domain="mock-domain" | ||
| cluster="mock-cluster" | ||
| timeRangeStart="mock-time-range-start" | ||
| timeRangeEnd="mock-time-range-end" | ||
| /> | ||
| ); | ||
|
|
||
| expect(screen.getByText('Mock workflows list')).toBeInTheDocument(); | ||
| beforeEach(() => { | ||
| jest.clearAllMocks(); | ||
| }); | ||
|
|
||
| it('renders workflows list when data is loaded', async () => { | ||
| setup({}); | ||
|
|
||
| expect(await screen.findByText('Mock workflows list')).toBeInTheDocument(); | ||
adhityamamallan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }); | ||
| }); | ||
|
|
||
| function setup({ errorCase }: { errorCase?: 'no-workflows' }) { | ||
| const mockResponse: ListWorkflowsResponse = | ||
| errorCase === 'no-workflows' | ||
| ? { workflows: [], nextPage: '' } | ||
| : { | ||
| workflows: Array.from({ length: 5 }, (_, i) => | ||
| getMockWorkflowListItem({ | ||
| workflowID: `mock-wf-${i}`, | ||
| runID: `mock-run-${i}`, | ||
| workflowName: `mock-name-${i}`, | ||
| status: 'WORKFLOW_EXECUTION_CLOSE_STATUS_COMPLETED', | ||
| startTime: 1684800000000, | ||
| }) | ||
| ), | ||
| nextPage: '', | ||
| }; | ||
|
|
||
| render( | ||
| <DomainWorkflowsArchivalList | ||
| domain="mock-domain" | ||
| cluster="mock-cluster" | ||
| visibleColumns={[]} | ||
| timeRangeStart="mock-time-range-start" | ||
| timeRangeEnd="mock-time-range-end" | ||
| />, | ||
| { | ||
| endpointsMocks: [ | ||
| { | ||
| path: '/api/domains/:domain/:cluster/workflows', | ||
| httpMethod: 'GET', | ||
| mockOnce: false, | ||
| httpResolver: async () => HttpResponse.json(mockResponse), | ||
| }, | ||
| ] as MSWMocksHandlersProps['endpointsMocks'], | ||
| } | ||
| ); | ||
| } | ||
74 changes: 72 additions & 2 deletions
74
...main-workflows-archival/domain-workflows-archival-list/domain-workflows-archival-list.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,79 @@ | ||
| 'use client'; | ||
|
|
||
| import ErrorPanel from '@/components/error-panel/error-panel'; | ||
| import PanelSection from '@/components/panel-section/panel-section'; | ||
| import SectionLoadingIndicator from '@/components/section-loading-indicator/section-loading-indicator'; | ||
| import usePageQueryParams from '@/hooks/use-page-query-params/use-page-query-params'; | ||
| import domainPageQueryParamsConfig from '@/views/domain-page/config/domain-page-query-params.config'; | ||
| import useListWorkflows from '@/views/shared/hooks/use-list-workflows'; | ||
| import WorkflowsList from '@/views/shared/workflows-list/workflows-list'; | ||
|
|
||
| import DOMAIN_WORKFLOWS_ARCHIVAL_PAGE_SIZE from '../config/domain-workflows-archival-page-size.config'; | ||
| import getArchivalErrorPanelProps from '../domain-workflows-archival-table/helpers/get-archival-error-panel-props'; | ||
| import useArchivalInputType from '../hooks/use-archival-input-type'; | ||
|
|
||
| import { type Props } from './domain-workflows-archival-list.types'; | ||
|
|
||
| export default function DomainWorkflowsArchivalList(_props: Props) { | ||
| return <WorkflowsList />; | ||
| export default function DomainWorkflowsArchivalList({ | ||
| domain, | ||
| cluster, | ||
| visibleColumns, | ||
| timeRangeStart, | ||
| timeRangeEnd, | ||
| }: Props) { | ||
| const [queryParams] = usePageQueryParams(domainPageQueryParamsConfig); | ||
| const { inputType } = useArchivalInputType(); | ||
|
|
||
| const { | ||
| workflows, | ||
| error, | ||
| isLoading, | ||
| hasNextPage, | ||
| fetchNextPage, | ||
| isFetchingNextPage, | ||
| refetch, | ||
| } = useListWorkflows({ | ||
| domain, | ||
| cluster, | ||
| listType: 'archived', | ||
| pageSize: DOMAIN_WORKFLOWS_ARCHIVAL_PAGE_SIZE, | ||
| inputType, | ||
| search: queryParams.searchArchival, | ||
| statuses: queryParams.statusesArchival, | ||
| timeRangeStart, | ||
| timeRangeEnd, | ||
| sortColumn: queryParams.sortColumnArchival, | ||
| sortOrder: queryParams.sortOrderArchival, | ||
| query: queryParams.queryArchival, | ||
| }); | ||
|
|
||
| if (isLoading) { | ||
| return <SectionLoadingIndicator />; | ||
| } | ||
|
|
||
| if (workflows.length === 0 && error) { | ||
| return ( | ||
| <PanelSection> | ||
| <ErrorPanel | ||
| {...getArchivalErrorPanelProps({ | ||
| inputType, | ||
| error, | ||
| queryString: queryParams.queryArchival, | ||
| })} | ||
| reset={refetch} | ||
| /> | ||
| </PanelSection> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <WorkflowsList | ||
| workflows={workflows} | ||
| columns={visibleColumns} | ||
| error={error} | ||
| hasNextPage={hasNextPage} | ||
| fetchNextPage={fetchNextPage} | ||
| isFetchingNextPage={isFetchingNextPage} | ||
| /> | ||
| ); | ||
| } |
3 changes: 3 additions & 0 deletions
3
...workflows-archival/domain-workflows-archival-list/domain-workflows-archival-list.types.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,9 @@ | ||
| import { type WorkflowsListColumn } from '@/views/shared/workflows-list/workflows-list.types'; | ||
|
|
||
| export type Props = { | ||
| domain: string; | ||
| cluster: string; | ||
| visibleColumns: Array<WorkflowsListColumn>; | ||
| timeRangeStart: string; | ||
| timeRangeEnd: string; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 72 additions & 10 deletions
82
src/views/domain-workflows/domain-workflows-list/__tests__/domain-workflows-list.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,83 @@ | ||
| import { HttpResponse } from 'msw'; | ||
|
|
||
| import { render, screen } from '@/test-utils/rtl'; | ||
|
|
||
| import { getMockWorkflowListItem } from '@/route-handlers/list-workflows/__fixtures__/mock-workflow-list-items'; | ||
| import { type ListWorkflowsResponse } from '@/route-handlers/list-workflows/list-workflows.types'; | ||
|
|
||
| import type { Props as MSWMocksHandlersProps } from '../../../../test-utils/msw-mock-handlers/msw-mock-handlers.types'; | ||
| import { mockDomainPageQueryParamsValues } from '../../../domain-page/__fixtures__/domain-page-query-params'; | ||
| import DomainWorkflowsList from '../domain-workflows-list'; | ||
|
|
||
| jest.mock('@/components/error-panel/error-panel', () => | ||
| jest.fn(({ message }: { message: string }) => <div>{message}</div>) | ||
| ); | ||
|
|
||
| jest.mock('@/views/shared/workflows-list/workflows-list', () => | ||
| jest.fn(() => <div>Mock workflows list</div>) | ||
| ); | ||
|
|
||
| jest.mock('@/hooks/use-page-query-params/use-page-query-params', () => | ||
| jest.fn(() => [mockDomainPageQueryParamsValues, jest.fn()]) | ||
| ); | ||
|
|
||
| jest.mock('query-string', () => ({ | ||
| stringifyUrl: jest.fn( | ||
| () => '/api/domains/mock-domain/mock-cluster/workflows' | ||
| ), | ||
| })); | ||
|
|
||
| describe(DomainWorkflowsList.name, () => { | ||
| it('renders workflows list', () => { | ||
| render( | ||
| <DomainWorkflowsList | ||
| domain="mock-domain" | ||
| cluster="mock-cluster" | ||
| timeRangeEnd="mock-time-range-end" | ||
| /> | ||
| ); | ||
|
|
||
| expect(screen.getByText('Mock workflows list')).toBeInTheDocument(); | ||
| beforeEach(() => { | ||
| jest.clearAllMocks(); | ||
| }); | ||
|
|
||
| it('renders workflows list when data is loaded', async () => { | ||
| setup({}); | ||
|
|
||
| expect(await screen.findByText('Mock workflows list')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('renders loading indicator while fetching', () => { | ||
| setup({ errorCase: 'no-workflows' }); | ||
|
|
||
| expect(screen.getByRole('progressbar')).toBeInTheDocument(); | ||
| }); | ||
| }); | ||
|
|
||
| function setup({ errorCase }: { errorCase?: 'no-workflows' }) { | ||
| const mockResponse: ListWorkflowsResponse = | ||
| errorCase === 'no-workflows' | ||
| ? { workflows: [], nextPage: '' } | ||
| : { | ||
| workflows: Array.from({ length: 5 }, (_, i) => | ||
| getMockWorkflowListItem({ | ||
| workflowID: `mock-wf-${i}`, | ||
| runID: `mock-run-${i}`, | ||
| workflowName: `mock-name-${i}`, | ||
| status: 'WORKFLOW_EXECUTION_CLOSE_STATUS_COMPLETED', | ||
| startTime: 1684800000000, | ||
| }) | ||
| ), | ||
| nextPage: '', | ||
| }; | ||
|
|
||
| render( | ||
| <DomainWorkflowsList | ||
| domain="mock-domain" | ||
| cluster="mock-cluster" | ||
| visibleColumns={[]} | ||
| timeRangeEnd="mock-time-range-end" | ||
| />, | ||
| { | ||
| endpointsMocks: [ | ||
| { | ||
| path: '/api/domains/:domain/:cluster/workflows', | ||
| httpMethod: 'GET', | ||
| mockOnce: false, | ||
| httpResolver: async () => HttpResponse.json(mockResponse), | ||
| }, | ||
| ] as MSWMocksHandlersProps['endpointsMocks'], | ||
| } | ||
| ); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.