Skip to content

Commit

Permalink
link to the parent
Browse files Browse the repository at this point in the history
Signed-off-by: Blake Jackson <[email protected]>
  • Loading branch information
Blake Jackson committed Jul 9, 2024
1 parent a24c4d3 commit 69b6526
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [
Expand Down Expand Up @@ -107,6 +111,20 @@ export const ExecutionMetadata: React.FC<{}> = () => {
});
}

if (parentNodeExecution != null && parentNodeExecution.executionId != null) {
details.push({
label: ExecutionMetadataLabels.parent,
value: (
<RouterLink
className={commonStyles.primaryLinks}
to={Routes.ExecutionDetails.makeUrl(parentNodeExecution.executionId)}
>
{parentNodeExecution.executionId.name}
</RouterLink>
)
})
}

return (
<StyledContainer>
<Grid container className="detailsContainer" spacing={4}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export enum ExecutionMetadataLabels {
securityContextDefault = 'default',
interruptible = 'Interruptible override',
overwriteCache = 'Overwrite cached outputs',
parent = 'Parent',
}

export const tabs = {
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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: {} })),
Expand Down Expand Up @@ -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');
})
});
15 changes: 15 additions & 0 deletions packages/oss-console/src/models/__mocks__/executionsData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -77,6 +83,15 @@ export function generateExecutionMetadata(): ExecutionMetadata {
systemMetadata: {
executionCluster: 'flyte',
},
referenceExecution: {
...MOCK_EXECUTION_ID
},
parentNodeExecution: {
nodeId: 'node',
executionId: {
...MOCK_EXECUTION_ID
}
},
};
}

Expand Down

0 comments on commit 69b6526

Please sign in to comment.