-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
19943 Grid view status filters (#23392)
* Move tree filtering inside react and add some filters * Move filters from context to utils * Fix tests for useTreeData * Fix last tests. * Add tests for useFilters * Refact to use existing SimpleStatus component * Additional fix after rebase. * Update following bbovenzi code review * Update following code review * Fix tests. * Fix page flickering issues from react-query * Fix side panel and small changes. * Use default_dag_run_display_number in the filter options * Handle timezone * Fix flaky test Co-authored-by: Brent Bovenzi <brent.bovenzi@gmail.com>
- Loading branch information
1 parent
7354d2e
commit 46c1c00
Showing
22 changed files
with
471 additions
and
82 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
@@ -0,0 +1,127 @@ | ||
/*! | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
/* global filtersOptions, moment */ | ||
|
||
import { | ||
Box, | ||
Button, | ||
Flex, | ||
Input, | ||
Select, | ||
} from '@chakra-ui/react'; | ||
import React from 'react'; | ||
import { useTimezone } from './context/timezone'; | ||
import { isoFormatWithoutTZ } from '../datetime_utils'; | ||
|
||
import useFilters from './utils/useFilters'; | ||
|
||
const FilterBar = () => { | ||
const { | ||
filters, | ||
onBaseDateChange, | ||
onNumRunsChange, | ||
onRunTypeChange, | ||
onRunStateChange, | ||
onTaskStateChange, | ||
clearFilters, | ||
} = useFilters(); | ||
|
||
const { timezone } = useTimezone(); | ||
const time = moment(filters.baseDate); | ||
const formattedTime = time.tz(timezone).format(isoFormatWithoutTZ); | ||
|
||
const inputStyles = { backgroundColor: 'white', size: 'lg' }; | ||
|
||
return ( | ||
<Flex backgroundColor="#f0f0f0" mt={0} mb={2} p={4}> | ||
<Box px={2}> | ||
<Input | ||
{...inputStyles} | ||
type="datetime-local" | ||
value={formattedTime || ''} | ||
onChange={onBaseDateChange} | ||
/> | ||
</Box> | ||
<Box px={2}> | ||
<Select | ||
{...inputStyles} | ||
placeholder="Runs" | ||
value={filters.numRuns || ''} | ||
onChange={onNumRunsChange} | ||
> | ||
{filtersOptions.numRuns.map((value) => ( | ||
<option value={value} key={value}>{value}</option> | ||
))} | ||
</Select> | ||
</Box> | ||
<Box px={2}> | ||
<Select | ||
{...inputStyles} | ||
value={filters.runType || ''} | ||
onChange={onRunTypeChange} | ||
> | ||
<option value="" key="all">All Run Types</option> | ||
{filtersOptions.runTypes.map((value) => ( | ||
<option value={value} key={value}>{value}</option> | ||
))} | ||
</Select> | ||
</Box> | ||
<Box /> | ||
<Box px={2}> | ||
<Select | ||
{...inputStyles} | ||
value={filters.runState || ''} | ||
onChange={onRunStateChange} | ||
> | ||
<option value="" key="all">All Run States</option> | ||
{filtersOptions.dagStates.map((value) => ( | ||
<option value={value} key={value}>{value}</option> | ||
))} | ||
</Select> | ||
</Box> | ||
<Box px={2}> | ||
<Select | ||
{...inputStyles} | ||
value={filters.taskState || ''} | ||
onChange={onTaskStateChange} | ||
> | ||
<option value="" key="all">All Task States</option> | ||
{filtersOptions.taskStates.map((value) => ( | ||
<option value={value} key={value}>{value}</option> | ||
))} | ||
</Select> | ||
</Box> | ||
<Box px={2}> | ||
<Button | ||
colorScheme="cyan" | ||
aria-label="Reset filters" | ||
background="white" | ||
variant="outline" | ||
onClick={clearFilters} | ||
size="lg" | ||
> | ||
Clear Filters | ||
</Button> | ||
</Box> | ||
</Flex> | ||
); | ||
}; | ||
|
||
export default FilterBar; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/*! | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
/* global stateColors */ | ||
|
||
import { | ||
Flex, | ||
Text, | ||
} from '@chakra-ui/react'; | ||
import React from 'react'; | ||
import { SimpleStatus } from './StatusBox'; | ||
|
||
const LegendRow = () => ( | ||
<Flex mt={0} mb={2} p={4} flexWrap="wrap"> | ||
{ | ||
Object.entries(stateColors).map(([state, stateColor]) => ( | ||
<Flex alignItems="center" mr={3} key={stateColor}> | ||
<SimpleStatus mr={1} state={state} /> | ||
<Text fontSize="md">{state}</Text> | ||
</Flex> | ||
)) | ||
} | ||
</Flex> | ||
); | ||
|
||
export default LegendRow; |
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
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.