summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Zallmann <tzallmann@gitlab.com>2018-10-12 17:16:47 +0000
committerJan Provaznik <jprovaznik@gitlab.com>2018-10-15 13:28:19 +0200
commitdefdf59a42e03cd307e30f0423c2112db5877eac (patch)
tree2c7ee4bd1a9c264afcea81f6b0c817973a1f0d54
parentbec3c07d8fbdcff322b4900a4b98f9794700fbb7 (diff)
downloadgitlab-ce-defdf59a42e03cd307e30f0423c2112db5877eac.tar.gz
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
-rw-r--r--app/assets/javascripts/jobs/components/job_app.vue4
-rw-r--r--app/assets/javascripts/jobs/store/getters.js4
-rw-r--r--changelogs/unreleased/52614-update-job-started-check.yml5
-rw-r--r--spec/javascripts/jobs/store/getters_spec.js10
4 files changed, 14 insertions, 9 deletions
diff --git a/app/assets/javascripts/jobs/components/job_app.vue b/app/assets/javascripts/jobs/components/job_app.vue
index acf91e2e9ed..4e8d3ad24cc 100644
--- a/app/assets/javascripts/jobs/components/job_app.vue
+++ b/app/assets/javascripts/jobs/components/job_app.vue
@@ -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>
diff --git a/app/assets/javascripts/jobs/store/getters.js b/app/assets/javascripts/jobs/store/getters.js
index afe5f88b292..9f4f372e3d2 100644
--- a/app/assets/javascripts/jobs/store/getters.js
+++ b/app/assets/javascripts/jobs/store/getters.js
@@ -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);
diff --git a/changelogs/unreleased/52614-update-job-started-check.yml b/changelogs/unreleased/52614-update-job-started-check.yml
new file mode 100644
index 00000000000..60ea237dbf3
--- /dev/null
+++ b/changelogs/unreleased/52614-update-job-started-check.yml
@@ -0,0 +1,5 @@
+---
+title: Fixes triggered/created labeled in job header
+merge_request:
+author:
+type: fixed
diff --git a/spec/javascripts/jobs/store/getters_spec.js b/spec/javascripts/jobs/store/getters_spec.js
index 160b2f4b34a..e262a47b837 100644
--- a/spec/javascripts/jobs/store/getters_spec.js
+++ b/spec/javascripts/jobs/store/getters_spec.js
@@ -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);
});
});
});