-
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 all 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 | ||
remote = FlyteRemote( | ||
Config.for_endpoint(endpoint="localhost:30080"), | ||
default_project="${project}", | ||
default_domain="${domain}" | ||
) | ||
remote.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> | ||
</> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,20 +4,28 @@ | |
import { LiteralMapViewer } from 'components/Literals/LiteralMapViewer'; | ||
import { NodeExecution } from 'models/Execution/types'; | ||
import * as React from 'react'; | ||
import { ExecutionNodeURL } from '../ExecutionNodeURL'; | ||
|
||
/** Fetches and renders the input data for a given `NodeExecution` */ | ||
export const NodeExecutionInputs: React.FC<{ | ||
execution: NodeExecution; | ||
taskIndex?: number; | ||
}> = ({ execution, taskIndex }) => { | ||
const executionData = useNodeExecutionData(execution.id); | ||
|
||
return ( | ||
<WaitForData {...executionData}> | ||
<PanelSection> | ||
<LiteralMapViewer | ||
map={executionData.value.fullInputs} | ||
mapTaskIndex={taskIndex} | ||
/> | ||
{executionData.value.fullInputs?.literals && ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do I render
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ursucarina , can you help? |
||
<ExecutionNodeURL | ||
Check warning on line 24 in packages/console/src/components/Executions/ExecutionDetails/NodeExecutionTabs/NodeExecutionInputs.tsx Codecov / codecov/patchpackages/console/src/components/Executions/ExecutionDetails/NodeExecutionTabs/NodeExecutionInputs.tsx#L23-L24
|
||
nodeExecutionId={execution.id} | ||
suffix="i" | ||
></ExecutionNodeURL> | ||
)} | ||
</PanelSection> | ||
</WaitForData> | ||
); | ||
|
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.
Can we get that address from the app itself? This should be the endpoint it uses to talk to admin, right?