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

Fix styles and label for cancelled steps #1769

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ class DetailsHeader extends Component {
const { intl, reason, status, taskRun } = this.props;
const { reason: taskReason, status: taskStatus } = getStatus(taskRun);

if (status === 'cancelled') {
if (
status === 'cancelled' ||
(status === 'terminated' &&
(reason === 'TaskRunCancelled' || reason === 'TaskRunTimeout'))
) {
return intl.formatMessage({
id: 'dashboard.taskRun.status.cancelled',
defaultMessage: 'Cancelled'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ limitations under the License.
}
&[data-status='cancelled'],
&[data-reason='PipelineRunCancelled'],
&[data-reason='TaskRunCancelled'] {
&[data-reason='TaskRunCancelled'],
&[data-reason='TaskRunTimeout'] {
.tkn--status-icon {
fill: $failed;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@ it('DetailsHeader renders the cancelled state', () => {
expect(queryByText(/Cancelled/i)).toBeTruthy();
});

it('DetailsHeader renders the cancelled state for TaskRunCancelled', () => {
const { queryByText } = renderWithIntl(
<DetailsHeader {...props} status="terminated" reason="TaskRunCancelled" />
);
expect(queryByText(/Cancelled/i)).toBeTruthy();
});

it('DetailsHeader renders the cancelled state for TaskRunTimeout', () => {
const { queryByText } = renderWithIntl(
<DetailsHeader {...props} status="terminated" reason="TaskRunTimeout" />
);
expect(queryByText(/Cancelled/i)).toBeTruthy();
});

it('DetailsHeader renders the failed state', () => {
const { queryByText } = renderWithIntl(
<DetailsHeader {...props} status="terminated" />
Expand Down
6 changes: 5 additions & 1 deletion packages/components/src/components/Step/Step.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ class Step extends Component {
statusLabel() {
const { intl, reason, status } = this.props;

if (status === 'cancelled') {
if (
status === 'cancelled' ||
(status === 'terminated' &&
(reason === 'TaskRunCancelled' || reason === 'TaskRunTimeout'))
) {
return intl.formatMessage({
id: 'dashboard.taskRun.status.cancelled',
defaultMessage: 'Cancelled'
Expand Down
20 changes: 12 additions & 8 deletions packages/components/src/components/Step/Step.scss
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,18 @@ limitations under the License.
font-weight: bold;
}
}
&[data-status='cancelled'] > a.tkn--step-link {
opacity: 1;
.tkn--step-icon {
fill: $failed;
}
.tkn--status-label {
color: $failed;
font-weight: bold;
&[data-status='cancelled'],
&[data-status='terminated'][data-reason='TaskRunCancelled'],
&[data-status='terminated'][data-reason='TaskRunTimeout'] {
> a.tkn--step-link {
opacity: 1;
.tkn--step-icon {
fill: $failed;
}
.tkn--status-label {
color: $failed;
font-weight: bold;
}
}
}
}
14 changes: 14 additions & 0 deletions packages/components/src/components/Step/Step.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ it('Step renders cancelled state', () => {
expect(queryByText(/Cancelled/i)).toBeTruthy();
});

it('Step renders cancelled state for TaskRunCancelled', () => {
const { queryByText } = renderWithIntl(
<Step status="terminated" reason="TaskRunCancelled" />
);
expect(queryByText(/Cancelled/i)).toBeTruthy();
});

it('Step renders cancelled state for TaskRunTimeout', () => {
const { queryByText } = renderWithIntl(
<Step status="terminated" reason="TaskRunTimeout" />
);
expect(queryByText(/Cancelled/i)).toBeTruthy();
});

it('Step renders completed state', () => {
const { queryByText } = renderWithIntl(
<Step status="terminated" reason="Completed" />
Expand Down