Skip to content

Commit 5d1f48b

Browse files
added log button in dag
1 parent a3e66fd commit 5d1f48b

File tree

2 files changed

+46
-4
lines changed

2 files changed

+46
-4
lines changed

src/ui/components/dag/index.tsx

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
import React from 'react';
1+
import React, { useEffect, useState } from 'react';
22
import { useService } from './useService';
33
import { LayoutFlow } from '../lineage';
44
import { FullWidthSpinner } from '../spinners';
5+
import { useSelector } from '../../hooks';
6+
import { sessionSelectors } from '../../../redux/selectors';
7+
import axios from 'axios';
58

69
const styles = {
710
container: { width: '100%', height: '100%' },
@@ -12,16 +15,38 @@ export const DAG: React.FC<{ runId: TId; fetching?: boolean }> = ({
1215
runId,
1316
fetching,
1417
}) => {
18+
const [metadata, setMetaData] = useState([] as any);
19+
20+
const authToken = useSelector(sessionSelectors.authenticationToken);
21+
1522
const { graph } = useService({ runId });
1623

24+
useEffect(() => {
25+
fetchMetaData();
26+
// eslint-disable-next-line react-hooks/exhaustive-deps
27+
}, [runId]);
28+
29+
const fetchMetaData = async () => {
30+
const response = await axios.get(
31+
`${process.env.REACT_APP_BASE_API_URL}/run-metadata?pipeline_run_id=${runId}&key=orchestrator_url`,
32+
{
33+
headers: {
34+
Authorization: `bearer ${authToken}`,
35+
},
36+
},
37+
);
38+
39+
setMetaData(response?.data?.items); //Setting the response into state
40+
};
41+
1742
if (fetching) {
1843
return <FullWidthSpinner color="black" size="md" />;
1944
}
20-
45+
// console.log(metadata, 'metadatametadata');
2146
return (
2247
<div style={styles.container}>
2348
<div style={styles.dag}>
24-
<LayoutFlow runId={runId} graph={graph} />
49+
<LayoutFlow graph={graph} metadata={metadata} />
2550
</div>
2651
</div>
2752
);

src/ui/components/lineage/index.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ const getLayoutedElements = (
110110

111111
const nodeTypes = { step: StepNode, artifact: ArtifactNode };
112112

113-
export const LayoutFlow: React.FC<any> = (graph: any, runId: any) => {
113+
export const LayoutFlow: React.FC<any> = (graph: any, metadata?: any) => {
114114
const dispatch = useDispatch();
115115
const {
116116
initialNodes: layoutedNodes,
@@ -142,6 +142,23 @@ export const LayoutFlow: React.FC<any> = (graph: any, runId: any) => {
142142
return (
143143
<>
144144
<div className="controls">
145+
<button
146+
onClick={() => {
147+
window.open(
148+
graph?.metadata[0]?.value
149+
? graph?.metadata[0]?.value
150+
: 'https://zenml.io/home',
151+
);
152+
153+
// dispatch(
154+
// runsActions.graphForRun({
155+
// runId: graph.runId,
156+
// }),
157+
// );
158+
}}
159+
>
160+
Logs
161+
</button>
145162
<button
146163
onClick={() => {
147164
dispatch(

0 commit comments

Comments
 (0)