Skip to content

Commit 14ad957

Browse files
authored
Add Asset Details page with events and graph (#47162)
* Initialize Asset Details page with events and graph * Fix AssetNode icon * Load backup info when Dag Details are still loading
1 parent dfeeeb4 commit 14ad957

20 files changed

Lines changed: 516 additions & 51 deletions
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*!
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
import { HStack, Stat } from "@chakra-ui/react";
20+
import type { ReactNode } from "react";
21+
import { LiaSlashSolid } from "react-icons/lia";
22+
import { Link as RouterLink } from "react-router-dom";
23+
24+
import { Breadcrumb } from "src/components/ui";
25+
26+
type Links = Array<{ label: ReactNode | string; labelExtra?: ReactNode; title?: string; value?: string }>;
27+
28+
export const BreadcrumbStats = ({ links }: { readonly links: Links }) => (
29+
<Breadcrumb.Root separator={<LiaSlashSolid />}>
30+
{links.map((link, index) => (
31+
// eslint-disable-next-line react/no-array-index-key
32+
<Stat.Root gap={0} key={`${link.title}-${index}`}>
33+
<Stat.Label fontSize="xs" fontWeight="bold">
34+
{link.title}
35+
</Stat.Label>
36+
<Stat.ValueText fontSize="sm" fontWeight="normal">
37+
{index === links.length - 1 ? (
38+
<Breadcrumb.CurrentLink>
39+
<HStack>{link.label}</HStack>
40+
</Breadcrumb.CurrentLink>
41+
) : (
42+
<Breadcrumb.Link asChild color="fg.info">
43+
<HStack>
44+
{link.labelExtra}
45+
<RouterLink to={link.value ?? ""}>{link.label}</RouterLink>
46+
</HStack>
47+
</Breadcrumb.Link>
48+
)}
49+
</Stat.ValueText>
50+
</Stat.Root>
51+
))}
52+
</Breadcrumb.Root>
53+
);
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*!
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
import { Flex, Heading, HStack } from "@chakra-ui/react";
20+
import type { NodeProps, Node as NodeType } from "@xyflow/react";
21+
import { FiDatabase } from "react-icons/fi";
22+
23+
import { NodeWrapper } from "./NodeWrapper";
24+
import type { CustomNodeProps } from "./reactflowUtils";
25+
26+
export const AssetNode = ({
27+
data: { height, isSelected, label, width },
28+
}: NodeProps<NodeType<CustomNodeProps, "asset">>) => (
29+
<NodeWrapper>
30+
<Flex
31+
bg="bg"
32+
borderColor={isSelected ? "border.inverted" : "border"}
33+
borderRadius={5}
34+
borderWidth={isSelected ? 6 : 2}
35+
cursor="default"
36+
flexDirection="column"
37+
height={`${height}px`}
38+
px={3}
39+
py={isSelected ? 0 : 1}
40+
width={`${width}px`}
41+
>
42+
<HStack>
43+
<Heading ml={-2} size="sm">
44+
<FiDatabase />
45+
</Heading>
46+
{label}
47+
</HStack>
48+
</Flex>
49+
</NodeWrapper>
50+
);
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*!
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
import { Flex, HStack, Link } from "@chakra-ui/react";
20+
import type { NodeProps, Node as NodeType } from "@xyflow/react";
21+
import { Link as RouterLink } from "react-router-dom";
22+
23+
import { useDagServiceGetDag } from "openapi/queries";
24+
import { DagIcon } from "src/assets/DagIcon";
25+
import { TogglePause } from "src/components/TogglePause";
26+
27+
import { NodeWrapper } from "./NodeWrapper";
28+
import type { CustomNodeProps } from "./reactflowUtils";
29+
30+
export const DagNode = ({
31+
data: { height, isSelected, label, width },
32+
}: NodeProps<NodeType<CustomNodeProps, "dag">>) => {
33+
const { data: dag } = useDagServiceGetDag({ dagId: label });
34+
35+
return (
36+
<NodeWrapper>
37+
<Flex
38+
bg="bg"
39+
borderRadius={5}
40+
borderWidth={isSelected ? 6 : 2}
41+
cursor="default"
42+
flexDirection="column"
43+
height={`${height}px`}
44+
px={3}
45+
py={isSelected ? 0 : 1}
46+
width={`${width}px`}
47+
>
48+
<HStack alignItems="center" gap={1}>
49+
<DagIcon />
50+
<Link asChild color="fg.info" mb={2}>
51+
<RouterLink to={`/dags/${dag?.dag_id}`}>{dag?.dag_display_name ?? label}</RouterLink>
52+
</Link>
53+
</HStack>
54+
<TogglePause
55+
dagId={dag?.dag_id ?? label}
56+
disabled={!Boolean(dag)}
57+
isPaused={dag?.is_paused ?? false}
58+
/>
59+
</Flex>
60+
</NodeWrapper>
61+
);
62+
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)