forked from cadence-workflow/cadence-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdomain-workflows-archival-list.tsx
More file actions
79 lines (71 loc) · 2.3 KB
/
domain-workflows-archival-list.tsx
File metadata and controls
79 lines (71 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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({
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}
/>
);
}