-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Kevin Su <[email protected]>
- Loading branch information
Showing
5 changed files
with
152 additions
and
0 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
65 changes: 65 additions & 0 deletions
65
packages/console/src/components/Executions/ExecutionDetails/ExecutionNodeURL.tsx
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,65 @@ | ||
import * as React from 'react'; | ||
import { Core } from '@flyteorg/flyteidl-types'; | ||
import { Button } from '@material-ui/core'; | ||
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'; | ||
import { darcula } from 'react-syntax-highlighter/dist/esm/styles/prism'; | ||
|
||
/** Fetches and renders the deck data for a given `nodeExecutionId` */ | ||
export const ExecutionNodeURL: React.FC<{ | ||
nodeExecutionId: Core.NodeExecutionIdentifier; | ||
suffix: string; | ||
}> = ({ nodeExecutionId, suffix }) => { | ||
const project = nodeExecutionId.executionId?.project; | ||
const domain = nodeExecutionId.executionId?.domain; | ||
const executionName = nodeExecutionId.executionId?.name; | ||
const nodeId = nodeExecutionId.nodeId; | ||
const url = `flyte://v1/${project}/${domain}/${executionName}/${nodeId}/${suffix}`; | ||
const code = `from flytekit.remote.remote import FlyteRemote | ||
from flytekit.configuration import Config | ||
rr = FlyteRemote( | ||
Config.auto(config_file="~/.flyte/config.yaml"), | ||
default_project="${project}", | ||
default_domain="${domain}", | ||
) | ||
url = "${url}" | ||
rr.get(url)`; | ||
const handleClick = event => { | ||
if (event.shiftKey) { | ||
navigator.clipboard.writeText(code); | ||
} else { | ||
navigator.clipboard.writeText(url); | ||
} | ||
}; | ||
|
||
const logoStyle = { | ||
width: '20px', | ||
height: '20px', | ||
}; | ||
|
||
const codeStyle = { | ||
fontSize: '10px', // Adjust the font size as desired | ||
}; | ||
|
||
return ( | ||
<> | ||
<Button> | ||
<img | ||
src="https://docs.flyte.org/en/latest/_static/flyte_circle_gradient_1_4x4.png" | ||
alt="Logo" | ||
style={logoStyle} | ||
onClick={handleClick} | ||
/> | ||
</Button> | ||
<div> | ||
<SyntaxHighlighter | ||
language="python" | ||
style={darcula} | ||
customStyle={codeStyle} | ||
onClick={() => navigator.clipboard.writeText(code)} | ||
> | ||
{code} | ||
</SyntaxHighlighter> | ||
</div> | ||
</> | ||
); | ||
}; |
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