Skip to content
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

Resolving issue where Grid won't un-collapse when Details is collapsed #31561

Merged
merged 16 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions airflow/www/static/js/dag/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import Grid from "./grid";
import FilterBar from "./nav/FilterBar";
import LegendRow from "./nav/LegendRow";
import useToggleGroups from "./useToggleGroups";
import useSelection from "./useSelection";

const detailsPanelKey = "hideDetailsPanel";
const minPanelWidth = 300;
Expand Down Expand Up @@ -68,7 +67,6 @@ const Main = () => {
const gridRef = useRef<HTMLDivElement>(null);
const isPanelOpen = localStorage.getItem(detailsPanelKey) !== "true";
const { isOpen, onToggle } = useDisclosure({ defaultIsOpen: isPanelOpen });
const { clearSelection } = useSelection();
const [hoveredTaskState, setHoveredTaskState] = useState<
string | null | undefined
>();
Expand All @@ -91,8 +89,10 @@ const Main = () => {
if (!isOpen) {
localStorage.setItem(detailsPanelKey, "false");
} else {
clearSelection();
localStorage.setItem(detailsPanelKey, "true");
if (isGridCollapsed) {
setIsGridCollapsed(!isGridCollapsed);
}
}
onToggle();
};
Expand Down
38 changes: 20 additions & 18 deletions airflow/www/static/js/dag/grid/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ const Grid = ({

return (
<Box height="100%" position="relative">
{isPanelOpen && (
{(isPanelOpen || isGridCollapsed) && (
<IconButton
fontSize="2xl"
variant="ghost"
color="gray.400"
size="sm"
position="absolute"
right={0}
right={isGridCollapsed ? -10 : 0}
zIndex={2}
top={-8}
onClick={() =>
Expand All @@ -114,22 +114,24 @@ const Grid = ({
transitionProperty="none"
/>
)}
<IconButton
fontSize="2xl"
variant="ghost"
color="gray.400"
size="sm"
position="absolute"
right={isPanelOpen ? -10 : 0}
zIndex={2}
top={-8}
onClick={onPanelToggle}
title={`${isPanelOpen ? "Hide " : "Show "} Details Panel`}
aria-label={isPanelOpen ? "Show Details" : "Hide Details"}
icon={<MdDoubleArrow />}
transform={isPanelOpen ? undefined : "rotateZ(180deg)"}
transitionProperty="none"
/>
{!isGridCollapsed && (
<IconButton
fontSize="2xl"
variant="ghost"
color="gray.400"
size="sm"
position="absolute"
right={isPanelOpen ? -10 : 0}
zIndex={2}
top={-8}
onClick={onPanelToggle}
title={`${isPanelOpen ? "Hide " : "Show "} Details Panel`}
aria-label={isPanelOpen ? "Show Details" : "Hide Details"}
icon={<MdDoubleArrow />}
transform={isPanelOpen ? undefined : "rotateZ(180deg)"}
transitionProperty="none"
/>
)}
<Box
maxHeight={`calc(100% - ${offsetTop}px)`}
ref={scrollRef}
Expand Down