forked from flyteorg/flyte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: fix TaskType display to ensure consistency, code cleanup, add …
…mapTaskListItem component (flyteorg#338) * chore: add component for mapped task support * test: add test coverage for isMapTaskType and MapTaskStatusInfo * chore: ignore *.stories.tsx files when collecting coverage Signed-off-by: Nastya Rusina <[email protected]>
- Loading branch information
Showing
30 changed files
with
277 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
src/components/Executions/ExecutionDetails/ExecutionNodeViews.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/components/common/MapTaskExecutionsList/MapTaskStatusInfo.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import * as React from 'react'; | ||
import { ComponentStory, ComponentMeta } from '@storybook/react'; | ||
import { NodeExecutionPhase } from 'models/Execution/enums'; | ||
import { MapTaskStatusInfo } from './MapTaskStatusInfo'; | ||
import { PanelViewDecorator } from '../__stories__/Decorators'; | ||
|
||
export default { | ||
title: 'Common/MapTaskExecutionList/MapTaskStatusInfo', | ||
component: MapTaskStatusInfo, | ||
parameters: { actions: { argTypesRegex: 'toggleExpanded' } }, | ||
} as ComponentMeta<typeof MapTaskStatusInfo>; | ||
|
||
const Template: ComponentStory<typeof MapTaskStatusInfo> = (args) => ( | ||
<MapTaskStatusInfo {...args} /> | ||
); | ||
|
||
export const Default = Template.bind({}); | ||
Default.decorators = [(Story) => PanelViewDecorator(Story)]; | ||
Default.args = { | ||
taskLogs: [ | ||
{ uri: '#', name: 'Kubernetes Logs #0-0' }, | ||
{ uri: '#', name: 'Kubernetes Logs #0-1' }, | ||
{ uri: '#', name: 'Kubernetes Logs #0-2' }, | ||
{ uri: '#', name: 'Kubernetes Logs #0-3' }, | ||
{ uri: '#', name: 'Kubernetes Logs #0-4' }, | ||
], | ||
status: NodeExecutionPhase.QUEUED, | ||
expanded: true, | ||
}; | ||
|
||
export const AllSpace = Template.bind({}); | ||
AllSpace.args = { | ||
taskLogs: [], | ||
status: NodeExecutionPhase.SUCCEEDED, | ||
}; |
48 changes: 48 additions & 0 deletions
48
src/components/common/MapTaskExecutionsList/MapTaskStatusInfo.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { fireEvent, render, waitFor } from '@testing-library/react'; | ||
import { noLogsFoundString } from 'components/Executions/constants'; | ||
import { getNodeExecutionPhaseConstants } from 'components/Executions/utils'; | ||
import { NodeExecutionPhase } from 'models/Execution/enums'; | ||
import * as React from 'react'; | ||
|
||
import { MapTaskStatusInfo } from './MapTaskStatusInfo'; | ||
|
||
const taskLogs = [ | ||
{ uri: '#', name: 'Kubernetes Logs #0-0' }, | ||
{ uri: '#', name: 'Kubernetes Logs #0-1' }, | ||
{ uri: '#', name: 'Kubernetes Logs #0-2' }, | ||
]; | ||
|
||
describe('MapTaskStatusInfo', () => { | ||
it('Phase and amount of links rendered correctly', async () => { | ||
const status = NodeExecutionPhase.RUNNING; | ||
const phaseData = getNodeExecutionPhaseConstants(status); | ||
|
||
const { queryByText, getByTitle } = render( | ||
<MapTaskStatusInfo taskLogs={taskLogs} status={status} expanded={false} />, | ||
); | ||
|
||
expect(queryByText(phaseData.text)).toBeInTheDocument(); | ||
expect(queryByText(`x${taskLogs.length}`)).toBeInTheDocument(); | ||
expect(queryByText('Logs')).not.toBeInTheDocument(); | ||
|
||
// Expand item - see logs section | ||
const buttonEl = getByTitle('Expand row'); | ||
fireEvent.click(buttonEl); | ||
await waitFor(() => { | ||
expect(queryByText('Logs')).toBeInTheDocument(); | ||
}); | ||
}); | ||
|
||
it('Phase with no links show proper texts when opened', () => { | ||
const status = NodeExecutionPhase.ABORTED; | ||
const phaseData = getNodeExecutionPhaseConstants(status); | ||
|
||
const { queryByText } = render( | ||
<MapTaskStatusInfo taskLogs={[]} status={status} expanded={true} />, | ||
); | ||
|
||
expect(queryByText(phaseData.text)).toBeInTheDocument(); | ||
expect(queryByText(`x0`)).toBeInTheDocument(); | ||
expect(queryByText(noLogsFoundString)).toBeInTheDocument(); | ||
}); | ||
}); |
Oops, something went wrong.