-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add NodeExecutionURL #822
Add NodeExecutionURL #822
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
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 | ||
Check warning on line 17 in packages/console/src/components/Executions/ExecutionDetails/ExecutionNodeURL.tsx Codecov / codecov/patchpackages/console/src/components/Executions/ExecutionDetails/ExecutionNodeURL.tsx#L12-L17
|
||
from flytekit.configuration import Config | ||
rr = FlyteRemote( | ||
Config.auto(), | ||
default_project="${project}", | ||
default_domain="${domain}", | ||
) | ||
rr.get("${url}")`; | ||
const handleClick = event => { | ||
if (event.shiftKey) { | ||
navigator.clipboard.writeText(code); | ||
} else { | ||
navigator.clipboard.writeText(url); | ||
Check warning on line 29 in packages/console/src/components/Executions/ExecutionDetails/ExecutionNodeURL.tsx Codecov / codecov/patchpackages/console/src/components/Executions/ExecutionDetails/ExecutionNodeURL.tsx#L25-L29
|
||
} | ||
}; | ||
|
||
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> | ||
</> | ||
); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do I render
ExecutionNodeURL
only ifexecutionData.value.fullInputs?.literals
not None?{executionData.value.fullInputs?.literals &&
doesn't workThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ursucarina , can you help?