-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix expand/collapse all buttons (#23590)
* communicate via customevents * Handle open group logic in wrapper * fix tests * Make grid action buttons sticky * Add default toggle fn * fix splitting task id by '.' * fix missing dagrun ids (cherry picked from commit afdfece)
- Loading branch information
1 parent
15fe9f6
commit abbc0b5
Showing
10 changed files
with
278 additions
and
249 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/*! | ||
* 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. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { | ||
Switch, | ||
FormControl, | ||
FormLabel, | ||
Spinner, | ||
} from '@chakra-ui/react'; | ||
|
||
import { useAutoRefresh } from './context/autorefresh'; | ||
|
||
const AutoRefresh = () => { | ||
const { isRefreshOn, toggleRefresh, isPaused } = useAutoRefresh(); | ||
|
||
return ( | ||
<FormControl display="flex" width="auto" mr={2}> | ||
<Spinner color="blue.500" speed="1s" mr="4px" visibility={isRefreshOn ? 'visible' : 'hidden'} /> | ||
<FormLabel htmlFor="auto-refresh" mb={0} fontWeight="normal"> | ||
Auto-refresh | ||
</FormLabel> | ||
<Switch | ||
id="auto-refresh" | ||
onChange={() => toggleRefresh(true)} | ||
isDisabled={isPaused} | ||
isChecked={isRefreshOn} | ||
size="lg" | ||
title={isPaused ? 'Autorefresh is disabled while the DAG is paused' : ''} | ||
/> | ||
</FormControl> | ||
); | ||
}; | ||
|
||
export default AutoRefresh; |
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,80 @@ | ||
/*! | ||
* 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 localStorage */ | ||
|
||
import React from 'react'; | ||
import { | ||
Box, | ||
Flex, | ||
useDisclosure, | ||
Button, | ||
Divider, | ||
} from '@chakra-ui/react'; | ||
|
||
import Details from './details'; | ||
import useSelection from './utils/useSelection'; | ||
import Grid from './Grid'; | ||
import FilterBar from './FilterBar'; | ||
import LegendRow from './LegendRow'; | ||
|
||
const detailsPanelKey = 'hideDetailsPanel'; | ||
|
||
const Main = () => { | ||
const isPanelOpen = localStorage.getItem(detailsPanelKey) !== 'true'; | ||
const { isOpen, onToggle } = useDisclosure({ defaultIsOpen: isPanelOpen }); | ||
const { clearSelection } = useSelection(); | ||
|
||
const toggleDetailsPanel = () => { | ||
if (!isOpen) { | ||
localStorage.setItem(detailsPanelKey, false); | ||
} else { | ||
clearSelection(); | ||
localStorage.setItem(detailsPanelKey, true); | ||
} | ||
onToggle(); | ||
}; | ||
|
||
return ( | ||
<Box> | ||
<FilterBar /> | ||
<LegendRow /> | ||
<Divider mb={5} borderBottomWidth={2} /> | ||
<Flex flexDirection="row" justifyContent="space-between"> | ||
<Grid isPanelOpen={isOpen} /> | ||
<Box borderLeftWidth={isOpen ? 1 : 0} position="relative"> | ||
<Button | ||
position="absolute" | ||
top={0} | ||
right={0} | ||
onClick={toggleDetailsPanel} | ||
aria-label={isOpen ? 'Show Details' : 'Hide Details'} | ||
variant={isOpen ? 'solid' : 'outline'} | ||
> | ||
{isOpen ? 'Hide ' : 'Show '} | ||
Details Panel | ||
</Button> | ||
{isOpen && (<Details />)} | ||
</Box> | ||
</Flex> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default Main; |
Oops, something went wrong.