-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce67a14
commit bd52c85
Showing
37 changed files
with
438 additions
and
236 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...xtures__/domain-workflows-query-params.ts → .../__fixtures__/domain-page-query-params.ts
This file contains 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
4 changes: 2 additions & 2 deletions
4
src/views/domain-page/config/domain-page-query-params.config.ts
This file contains 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 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
3 changes: 0 additions & 3 deletions
3
src/views/domain-workflows/config/domain-workflows-page-size.config.ts
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
src/views/domain-workflows/config/domain-workflows-search-debounce-ms.config.ts
This file was deleted.
Oops, something went wrong.
This file contains 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 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
106 changes: 22 additions & 84 deletions
106
src/views/domain-workflows/domain-workflows-header/domain-workflows-header.tsx
This file contains 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,96 +1,34 @@ | ||
'use client'; | ||
import { useState } from 'react'; | ||
|
||
import { Segment, SegmentedControl } from 'baseui/segmented-control'; | ||
|
||
import usePageFilters from '@/components/page-filters/hooks/use-page-filters'; | ||
import PageFiltersFields from '@/components/page-filters/page-filters-fields/page-filters-fields'; | ||
import PageFiltersSearch from '@/components/page-filters/page-filters-search/page-filters-search'; | ||
import PageFiltersToggle from '@/components/page-filters/page-filters-toggle/page-filters-toggle'; | ||
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 WorkflowsHeader from '@/views/shared/workflows-header/workflows-header'; | ||
|
||
import domainWorkflowsFiltersConfig from '../config/domain-workflows-filters.config'; | ||
import DOMAIN_WORKFLOWS_SEARCH_DEBOUNCE_MS from '../config/domain-workflows-search-debounce-ms.config'; | ||
import DomainWorkflowsQueryInput from '../domain-workflows-query-input/domain-workflows-query-input'; | ||
import DomainWorkflowsQueryLabel from '../domain-workflows-query-label/domain-workflows-query-label'; | ||
import useListWorkflows from '../hooks/use-list-workflows'; | ||
|
||
import { overrides, styled } from './domain-workflows-header.styles'; | ||
import { type Props } from './domain-workflows-header.types'; | ||
|
||
export default function DomainWorkflowsHeader({ domain, cluster }: Props) { | ||
const [areFiltersShown, setAreFiltersShown] = useState(false); | ||
|
||
const { resetAllFilters, activeFiltersCount, queryParams, setQueryParams } = | ||
usePageFilters({ | ||
pageFiltersConfig: domainWorkflowsFiltersConfig, | ||
pageQueryParamsConfig: domainPageQueryParamsConfig, | ||
}); | ||
|
||
const { refetch, isFetching } = useListWorkflows({ | ||
domain, | ||
cluster, | ||
}); | ||
const [queryParams] = usePageQueryParams(domainPageQueryParamsConfig); | ||
|
||
return ( | ||
<styled.HeaderContainer> | ||
<styled.InputContainer> | ||
<SegmentedControl | ||
activeKey={queryParams.inputType} | ||
onChange={({ activeKey }) => { | ||
setQueryParams( | ||
{ | ||
inputType: activeKey === 'query' ? 'query' : 'search', | ||
}, | ||
{ replace: false, pageRerender: true } | ||
); | ||
}} | ||
overrides={overrides.inputToggle} | ||
> | ||
<Segment | ||
overrides={overrides.inputToggleSegment} | ||
key="search" | ||
label="Search" | ||
/> | ||
<Segment | ||
overrides={overrides.inputToggleSegment} | ||
key="query" | ||
label={<DomainWorkflowsQueryLabel />} | ||
/> | ||
</SegmentedControl> | ||
{queryParams.inputType === 'query' ? ( | ||
<DomainWorkflowsQueryInput | ||
value={queryParams.query} | ||
setValue={(v) => setQueryParams({ query: v })} | ||
refetchQuery={refetch} | ||
isQueryRunning={isFetching} | ||
/> | ||
) : ( | ||
<styled.SearchContainer> | ||
<PageFiltersSearch | ||
pageQueryParamsConfig={domainPageQueryParamsConfig} | ||
searchQueryParamKey="search" | ||
searchPlaceholder="Search for Workflow ID, Run ID, or Workflow Type" | ||
inputDebounceDurationMs={DOMAIN_WORKFLOWS_SEARCH_DEBOUNCE_MS} | ||
/> | ||
<PageFiltersToggle | ||
isActive={areFiltersShown} | ||
onClick={() => { | ||
setAreFiltersShown((value) => !value); | ||
}} | ||
activeFiltersCount={activeFiltersCount} | ||
/> | ||
</styled.SearchContainer> | ||
)} | ||
</styled.InputContainer> | ||
{queryParams.inputType === 'search' && areFiltersShown && ( | ||
<PageFiltersFields | ||
pageFiltersConfig={domainWorkflowsFiltersConfig} | ||
resetAllFilters={resetAllFilters} | ||
queryParams={queryParams} | ||
setQueryParams={setQueryParams} | ||
/> | ||
)} | ||
</styled.HeaderContainer> | ||
<WorkflowsHeader | ||
domain={domain} | ||
cluster={cluster} | ||
pageQueryParamsConfig={domainPageQueryParamsConfig} | ||
pageFiltersConfig={domainWorkflowsFiltersConfig} | ||
filtersValues={{ | ||
inputType: queryParams.inputType, | ||
search: queryParams.search, | ||
status: queryParams.status, | ||
timeRangeStart: queryParams.timeRangeStart, | ||
timeRangeEnd: queryParams.timeRangeEnd, | ||
sortColumn: queryParams.sortColumn, | ||
sortOrder: queryParams.sortOrder, | ||
query: queryParams.query, | ||
}} | ||
inputTypeQueryParamKey="inputType" | ||
searchQueryParamKey="search" | ||
queryStringQueryParamKey="query" | ||
/> | ||
); | ||
} |
5 changes: 0 additions & 5 deletions
5
src/views/domain-workflows/domain-workflows-header/domain-workflows-header.types.ts
This file contains 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 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
3 changes: 0 additions & 3 deletions
3
src/views/domain-workflows/domain-workflows-table/domain-workflows-table.styles.ts
This file contains 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 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
7 changes: 0 additions & 7 deletions
7
src/views/domain-workflows/domain-workflows-table/domain-workflows-table.types.ts
This file contains 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,11 +1,4 @@ | ||
import { type TableColumn } from '@/components/table/table.types'; | ||
import { type DomainWorkflow } from '@/views/domain-page/domain-page.types'; | ||
|
||
export type Props = { | ||
domain: string; | ||
cluster: string; | ||
}; | ||
|
||
export type DomainWorkflowsQueryTableConfig = Array< | ||
Omit<TableColumn<DomainWorkflow>, 'sortable'> | ||
>; |
5 changes: 2 additions & 3 deletions
5
src/views/domain-workflows/domain-workflows-table/helpers/get-workflows-error-panel-props.ts
This file contains 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
Oops, something went wrong.