This repository has been archived by the owner on Oct 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP types * feat: more detailed hover tooltips * feat: legend shows flow IDs * chore: update types * fix: z-index and legend label * fix: update types from upstream * fix: pin.json hash * feat: clarify legend and tooltip wording
- Loading branch information
Showing
11 changed files
with
246 additions
and
46 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"version": "0.8.0", | ||
"version": "0.9.0", | ||
"x86_64-darwin": "", | ||
"x86_64-linux": "sha256-4lx4eSRv+auM27K4RLyLVS3lk4+a5SCFrsyBrOY2qMI=", | ||
"aarch64-darwin": "sha256-mSmC23SczyR2V7xoS7+bnN5g+X5EVJTy74pH3+Ld/C8=", | ||
"x86_64-linux": "sha256-0L/RHC4vHimBUV1ZxAaqK4ePQZbFV2cbLIv/Xp/iKto=", | ||
"aarch64-darwin": "sha256-7eJPigPZrdtTcZgrww6Xp529NQ3/H4i0E4Cbq9R2/Ns=", | ||
"aarch64-linux": "sha256-iHZRAxgNluI3bvXIc6hgkAs/xM9Z4ib5W1ifnvGs9SQ=" | ||
} |
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,92 @@ | ||
import { NodeVersion } from "@/types"; | ||
import { Flex } from "@chakra-ui/react"; | ||
import { | ||
Table, | ||
Thead, | ||
Tbody, | ||
Tr, | ||
Th, | ||
Td, | ||
TableContainer, | ||
} from "@chakra-ui/react"; | ||
|
||
interface Props { | ||
elements: cytoscape.ElementDefinition[]; | ||
} | ||
|
||
const Legend = ({ elements }: Props) => { | ||
const serviceVersions: NodeVersion[] = elements | ||
.map((element) => element.data.versions) | ||
.flat() | ||
.filter(Boolean); | ||
|
||
const flowIds = serviceVersions.map((version) => version.flowId); | ||
const uniqueFlowIds = [...new Set(flowIds)]; | ||
|
||
const servicesForFlowId = (flowId: string): string => { | ||
const services = elements | ||
.map((element) => { | ||
const versions = element.data.versions; | ||
if ( | ||
versions != null && | ||
versions.length > 0 && | ||
versions.some((version: NodeVersion) => version.flowId === flowId) | ||
) { | ||
return element; | ||
} | ||
return undefined; | ||
}) | ||
.filter(Boolean); | ||
// If flow ID is baseline flow, dont show all services | ||
if ( | ||
services.some( | ||
(service) => | ||
service?.data.versions.length === 1 && | ||
service?.data.versions[0].isBaseline, | ||
) | ||
) { | ||
return "All services"; | ||
} | ||
return services.map((service) => service?.data.label).join(", "); | ||
}; | ||
|
||
return ( | ||
<Flex | ||
position={"absolute"} | ||
bg={"white"} | ||
minH={100} | ||
minW={240} | ||
top={0} | ||
left={0} | ||
borderRadius={12} | ||
borderWidth={1} | ||
borderStyle={"solid"} | ||
borderColor={"gray.300"} | ||
padding={4} | ||
zIndex={5} | ||
> | ||
<TableContainer> | ||
<Table variant="simple"> | ||
<Thead> | ||
<Tr> | ||
<Th>Flow ID</Th> | ||
<Th>Deployed Services</Th> | ||
</Tr> | ||
</Thead> | ||
<Tbody> | ||
{uniqueFlowIds.map((flowId) => { | ||
return ( | ||
<Tr> | ||
<Td>{flowId}</Td> | ||
<Td>{servicesForFlowId(flowId)}</Td> | ||
</Tr> | ||
); | ||
})} | ||
</Tbody> | ||
</Table> | ||
</TableContainer> | ||
</Flex> | ||
); | ||
}; | ||
|
||
export default Legend; |
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.