-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #486 from DataRecce/feature/drc-894-enter-multi-no…
…des-mode-by-selecting-the-checkbox-of-a-node Add multi-select checkbox on the node
- Loading branch information
Showing
7 changed files
with
791 additions
and
815 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,62 @@ | ||
import { Box, Button, HStack, StackDivider } from "@chakra-ui/react"; | ||
import { LineageGraphNode } from "./lineage"; | ||
import { useLineageViewContext } from "./LineageViewContext"; | ||
|
||
export interface ActionControlProps { | ||
onClose: () => void; | ||
} | ||
|
||
export function ActionControl({ onClose }: ActionControlProps) { | ||
const { cancel, actionState } = useLineageViewContext(); | ||
|
||
const getProgressMessage = () => { | ||
if (actionState.mode === "per_node") { | ||
return `${actionState.completed} / ${actionState.total}`; | ||
} else { | ||
if (actionState.currentRun?.progress?.percentage) { | ||
return `${actionState.currentRun.progress.percentage * 100}%`; | ||
} else { | ||
if (actionState.status === "completed") { | ||
return "100%"; | ||
} else { | ||
return "0%"; | ||
} | ||
} | ||
} | ||
}; | ||
|
||
return ( | ||
<Box bg="white" rounded="md" shadow="dark-lg"> | ||
<HStack | ||
p="5px 15px" | ||
mt="4" | ||
divider={<StackDivider borderColor="gray.200" />} | ||
spacing={4} | ||
> | ||
<Box fontSize="10pt"> | ||
Progress: {getProgressMessage()}{" "} | ||
{actionState.status === "canceled" ? " (canceled)" : ""} | ||
</Box> | ||
|
||
{actionState.status === "running" || | ||
actionState.status === "canceling" ? ( | ||
<Button | ||
size="xs" | ||
variant="outline" | ||
onClick={cancel} | ||
isLoading={actionState.status === "canceling"} | ||
loadingText="Canceling" | ||
> | ||
Cancel | ||
</Button> | ||
) : ( | ||
<HStack> | ||
<Button size="xs" variant="outline" onClick={onClose}> | ||
Close | ||
</Button> | ||
</HStack> | ||
)} | ||
</HStack> | ||
</Box> | ||
); | ||
} |
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.