Commit 1103f589 authored by Tim Zallmann's avatar Tim Zallmann

Merge branch '52614-update-job-started-check' into 'master'

Updates the check for started in job header

See merge request gitlab-org/gitlab-ce!22329
parents 7e342757 85c30d74
......@@ -30,7 +30,7 @@
'headerActions',
'headerTime',
'shouldRenderCalloutMessage',
'jobHasStarted',
'shouldRenderTriggeredLabel',
'hasEnvironment',
'isJobStuck',
'hasTrace',
......@@ -58,7 +58,7 @@
:user="job.user"
:actions="headerActions"
:has-sidebar-button="true"
:should-render-triggered-label="jobHasStarted"
:should-render-triggered-label="shouldRenderTriggeredLabel"
:item-name="__('Job')"
/>
</div>
......
......@@ -22,10 +22,10 @@ export const shouldRenderCalloutMessage = state =>
!_.isEmpty(state.job.status) && !_.isEmpty(state.job.callout_message);
/**
* When job has not started the key will be `false`
* When job has not started the key will be null
* When job started the key will be a string with a date.
*/
export const jobHasStarted = state => !(state.job.started === false);
export const shouldRenderTriggeredLabel = state => _.isString(state.job.started);
export const hasEnvironment = state => !_.isEmpty(state.job.deployment_status);
......
---
title: Fixes triggered/created labeled in job header
merge_request:
author:
type: fixed
......@@ -77,18 +77,18 @@ describe('Job Store Getters', () => {
});
});
describe('jobHasStarted', () => {
describe('when started equals false', () => {
describe('shouldRenderTriggeredLabel', () => {
describe('when started equals null', () => {
it('returns false', () => {
localState.job.started = false;
expect(getters.jobHasStarted(localState)).toEqual(false);
localState.job.started = null;
expect(getters.shouldRenderTriggeredLabel(localState)).toEqual(false);
});
});
describe('when started equals string', () => {
it('returns true', () => {
localState.job.started = '2018-08-31T16:20:49.023Z';
expect(getters.jobHasStarted(localState)).toEqual(true);
expect(getters.shouldRenderTriggeredLabel(localState)).toEqual(true);
});
});
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment