-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tool Run Output Overhaul - Keep last output
Related to INSM-TUM/SimuBridge#25
- Loading branch information
Showing
3 changed files
with
82 additions
and
60 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
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,31 @@ | ||
import { Button, Card, CardBody, CardHeader, Flex, Heading, ListItem, Textarea, UnorderedList } from "@chakra-ui/react"; | ||
import { downloadFile } from "../util/Storage"; | ||
|
||
export default function ToolRunOutputCard({projectName, response, toolName, processName, filePrefix}) { | ||
|
||
|
||
return <Card bg="white"> | ||
<CardHeader> | ||
<Heading size='md'> Last {toolName} Run Output {response.finished && `[${new Date(response.finished).toLocaleString()}]`}</Heading> | ||
</CardHeader> | ||
<CardBody> | ||
<Flex flexDirection='column' gap='5'> | ||
{!response.message && !response.files && !response.finished && <> | ||
No {processName} runs in this session yet. | ||
</>} | ||
{response.message && <> | ||
<Heading size='ms' mt={-5}>Console Output:</Heading> | ||
<Textarea isDisabled value={response.message} /> | ||
</>} | ||
{response.files && <> | ||
<Heading size='ms'>Returned Files: (Click on the name of the file to download it)</Heading> | ||
<UnorderedList> | ||
{response.files.map(fileName => (<ListItem> | ||
<Button onClick={() => downloadFile(projectName, (filePrefix ? filePrefix + '/' : '') + fileName)} variant="link">{fileName}</Button> | ||
</ListItem>)) } | ||
</UnorderedList> | ||
</>} | ||
</Flex> | ||
</CardBody> | ||
</Card> | ||
} |