From 69b6526d7359b924a893936d7aad6560397b5d3b Mon Sep 17 00:00:00 2001 From: Blake Jackson Date: Mon, 8 Jul 2024 20:28:10 -0400 Subject: [PATCH] link to the parent Signed-off-by: Blake Jackson --- .../ExecutionDetails/ExecutionMetadata.tsx | 20 ++++++++++++++++++- .../Executions/ExecutionDetails/constants.ts | 1 + .../test/ExecutionMetadata.test.tsx | 14 ++++++++++++- .../src/models/__mocks__/executionsData.ts | 15 ++++++++++++++ 4 files changed, 48 insertions(+), 2 deletions(-) diff --git a/packages/oss-console/src/components/Executions/ExecutionDetails/ExecutionMetadata.tsx b/packages/oss-console/src/components/Executions/ExecutionDetails/ExecutionMetadata.tsx index fef119a0c..86c4db73d 100644 --- a/packages/oss-console/src/components/Executions/ExecutionDetails/ExecutionMetadata.tsx +++ b/packages/oss-console/src/components/Executions/ExecutionDetails/ExecutionMetadata.tsx @@ -69,7 +69,11 @@ export const ExecutionMetadata: React.FC<{}> = () => { const startedAt = execution?.closure?.startedAt; const workflowId = execution?.closure?.workflowId; - const { referenceExecution, systemMetadata } = execution.spec.metadata; + const { + referenceExecution, + systemMetadata , + parentNodeExecution, + } = execution.spec.metadata; const cluster = systemMetadata?.executionCluster ?? dashedValueString; const details: DetailItem[] = [ @@ -107,6 +111,20 @@ export const ExecutionMetadata: React.FC<{}> = () => { }); } + if (parentNodeExecution != null && parentNodeExecution.executionId != null) { + details.push({ + label: ExecutionMetadataLabels.parent, + value: ( + + {parentNodeExecution.executionId.name} + + ) + }) + } + return ( diff --git a/packages/oss-console/src/components/Executions/ExecutionDetails/constants.ts b/packages/oss-console/src/components/Executions/ExecutionDetails/constants.ts index 55ddb8c6b..42e00c893 100644 --- a/packages/oss-console/src/components/Executions/ExecutionDetails/constants.ts +++ b/packages/oss-console/src/components/Executions/ExecutionDetails/constants.ts @@ -12,6 +12,7 @@ export enum ExecutionMetadataLabels { securityContextDefault = 'default', interruptible = 'Interruptible override', overwriteCache = 'Overwrite cached outputs', + parent = 'Parent', } export const tabs = { diff --git a/packages/oss-console/src/components/Executions/ExecutionDetails/test/ExecutionMetadata.test.tsx b/packages/oss-console/src/components/Executions/ExecutionDetails/test/ExecutionMetadata.test.tsx index 1fed6e736..d20a94190 100644 --- a/packages/oss-console/src/components/Executions/ExecutionDetails/test/ExecutionMetadata.test.tsx +++ b/packages/oss-console/src/components/Executions/ExecutionDetails/test/ExecutionMetadata.test.tsx @@ -1,4 +1,4 @@ -import { render } from '@testing-library/react'; +import { getByTestId, render } from '@testing-library/react'; import Protobuf from '@clients/common/flyteidl/protobuf'; import * as React from 'react'; import { MemoryRouter } from 'react-router'; @@ -14,6 +14,8 @@ const startTimeTestId = `metadata-${ExecutionMetadataLabels.time}`; const durationTestId = `metadata-${ExecutionMetadataLabels.duration}`; const interruptibleTestId = `metadata-${ExecutionMetadataLabels.interruptible}`; const overwriteCacheTestId = `metadata-${ExecutionMetadataLabels.overwriteCache}`; +const relatedToTestId = `metadata-${ExecutionMetadataLabels.relatedTo}`; +const parentNodeExecutionTestId = `metadata-${ExecutionMetadataLabels.parent}` jest.mock('../../../../models/Launch/api', () => ({ getLaunchPlan: jest.fn(() => Promise.resolve({ spec: {} })), @@ -106,4 +108,14 @@ describe('ExecutionMetadata', () => { const { getByTestId } = renderMetadata(); expect(getByTestId(overwriteCacheTestId)).toHaveTextContent('false'); }); + + it('shows related to if metadata is available', () => { + const { getByTestId } = renderMetadata(); + expect(getByTestId(relatedToTestId)).toHaveTextContent('name'); + }) + + it('shows parent execution if metadata is available', () => { + const { getByTestId } = renderMetadata(); + expect(getByTestId(parentNodeExecutionTestId)).toHaveTextContent('name'); + }) }); diff --git a/packages/oss-console/src/models/__mocks__/executionsData.ts b/packages/oss-console/src/models/__mocks__/executionsData.ts index 8e52b58d4..a7ee4af1f 100644 --- a/packages/oss-console/src/models/__mocks__/executionsData.ts +++ b/packages/oss-console/src/models/__mocks__/executionsData.ts @@ -21,6 +21,12 @@ export const MOCK_WORKFLOW_ID = { version: 'version', }; +export const MOCK_EXECUTION_ID = { + project: 'project', + domain: 'domain', + name: 'name', +} + export function fixedDuration(): Protobuf.Duration { return { nanos: 0, @@ -77,6 +83,15 @@ export function generateExecutionMetadata(): ExecutionMetadata { systemMetadata: { executionCluster: 'flyte', }, + referenceExecution: { + ...MOCK_EXECUTION_ID + }, + parentNodeExecution: { + nodeId: 'node', + executionId: { + ...MOCK_EXECUTION_ID + } + }, }; }