Skip to content
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

Dont show task/run durations when there is no start_date #28395

Merged
merged 2 commits into from
Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions airflow/www/static/js/dag/InstanceTooltip.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ describe('Test Task InstanceTooltip', () => {

expect(getByText('Status: success')).toBeDefined();
expect(queryByText('Contains a note')).toBeNull();
expect(getByText('Duration: 00:00:00')).toBeDefined();
});

test('Displays a mapped task with overall status', () => {
Expand Down Expand Up @@ -111,4 +112,17 @@ describe('Test Task InstanceTooltip', () => {

expect(getByText('Contains a note')).toBeInTheDocument();
});

test('Hides duration if there is no start date', () => {
const { queryByText, getByText } = render(
<InstanceTooltip
group={{ id: 'task', label: 'task', instances: [] }}
instance={{ ...instance, startDate: null }}
/>,
{ wrapper: Wrapper },
);

expect(getByText('Status: success')).toBeDefined();
expect(queryByText('Duration: 00:00:00')).toBeNull();
});
});
24 changes: 14 additions & 10 deletions airflow/www/static/js/dag/InstanceTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,20 @@ const InstanceTooltip = ({
{state || 'no status'}
</Text>
{(isGroup || isMapped) && summary}
<Text>
Started:
{' '}
<Time dateTime={startDate} />
</Text>
<Text>
Duration:
{' '}
{formatDuration(getDuration(startDate, endDate))}
</Text>
{startDate && (
<>
<Text>
Started:
{' '}
<Time dateTime={startDate} />
</Text>
<Text>
Duration:
{' '}
{formatDuration(getDuration(startDate, endDate))}
</Text>
</>
)}
{note && (
<Text>Contains a note</Text>
)}
Expand Down
14 changes: 8 additions & 6 deletions airflow/www/static/js/dag/details/dagRun/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,14 @@ const DagRun = ({ runId }: Props) => {
{runType}
</Td>
</Tr>
<Tr>
<Td>Run duration</Td>
<Td>
{formatDuration(getDuration(startDate, endDate))}
</Td>
</Tr>
{startDate && (
<Tr>
<Td>Run duration</Td>
<Td>
{formatDuration(getDuration(startDate, endDate))}
</Td>
</Tr>
)}
{lastSchedulingDecision && (
<Tr>
<Td>Last scheduling decision</Td>
Expand Down
16 changes: 9 additions & 7 deletions airflow/www/static/js/dag/details/taskInstance/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,15 @@ const Details = ({ instance, group, dagId }: Props) => {
<Td>{operator}</Td>
</Tr>
)}
<Tr>
<Td>
{isOverall}
Duration
</Td>
<Td>{formatDuration(getDuration(startDate, endDate))}</Td>
</Tr>
{startDate && (
<Tr>
<Td>
{isOverall}
Duration
</Td>
<Td>{formatDuration(getDuration(startDate, endDate))}</Td>
</Tr>
)}
{startDate && (
<Tr>
<Td>Started</Td>
Expand Down
18 changes: 4 additions & 14 deletions airflow/www/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3947,20 +3947,10 @@ caniuse-api@^3.0.0:
lodash.memoize "^4.1.2"
lodash.uniq "^4.5.0"

caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001109:
version "1.0.30001355"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001355.tgz#e240b7177443ed0198c737a7f609536976701c77"
integrity sha512-Sd6pjJHF27LzCB7pT7qs+kuX2ndurzCzkpJl6Qct7LPSZ9jn0bkOA8mdgMgmqnQAWLVOOGjLpc+66V57eLtb1g==

caniuse-lite@^1.0.30001219:
version "1.0.30001312"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001312.tgz"
integrity sha512-Wiz1Psk2MEK0pX3rUzWaunLTZzqS2JYZFzNKqAiJGiuxIjRPLgV6+VDPOg6lQOUxmDwhTlh198JsTTi8Hzw6aQ==

caniuse-lite@^1.0.30001349:
version "1.0.30001354"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001354.tgz#95c5efdb64148bb4870771749b9a619304755ce5"
integrity sha512-mImKeCkyGDAHNywYFA4bqnLAzTUvVkqPvhY4DV47X+Gl2c5Z8c3KNETnXp14GQt11LvxE8AwjzGxJ+rsikiOzg==
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001219, caniuse-lite@^1.0.30001349:
version "1.0.30001439"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001439.tgz"
integrity sha512-1MgUzEkoMO6gKfXflStpYgZDlFM7M/ck/bgfVCACO5vnAf0fXoNVHdWtqGU+MYca+4bL9Z5bpOVmR33cWW9G2A==

chakra-react-select@^4.0.0:
version "4.0.3"
Expand Down