Skip to content

Commit e10ca5e

Browse files
author
Filipa Lacerda
committed
Merge branch 'winh-pipeline-actions-dynamic-timer' into 'master'
Add dynamic timer for delayed jobs in pipelines list See merge request gitlab-org/gitlab-ce!22621
2 parents 6fd7a2d + 557cf4f commit e10ca5e

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

app/assets/javascripts/pipelines/components/pipelines_actions.vue

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
<script>
22
import { s__, sprintf } from '~/locale';
3-
import { formatTime } from '~/lib/utils/datetime_utility';
43
import eventHub from '../event_hub';
54
import icon from '../../vue_shared/components/icon.vue';
65
import tooltip from '../../vue_shared/directives/tooltip';
6+
import GlCountdown from '~/vue_shared/components/gl_countdown.vue';
77
88
export default {
99
directives: {
1010
tooltip,
1111
},
1212
components: {
1313
icon,
14+
GlCountdown,
1415
},
1516
props: {
1617
actions: {
@@ -51,11 +52,6 @@ export default {
5152
5253
return !action.playable;
5354
},
54-
55-
remainingTime(action) {
56-
const remainingMilliseconds = new Date(action.scheduled_at).getTime() - Date.now();
57-
return formatTime(Math.max(0, remainingMilliseconds));
58-
},
5955
},
6056
};
6157
</script>
@@ -100,7 +96,7 @@ export default {
10096
class="pull-right"
10197
>
10298
<icon name="clock" />
103-
{{ remainingTime(action) }}
99+
<gl-countdown :end-date-string="action.scheduled_at" />
104100
</span>
105101
</button>
106102
</li>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: Add dynamic timer for delayed jobs in pipelines list
3+
merge_request: 22621
4+
author:
5+
type: changed

spec/javascripts/pipelines/pipelines_actions_spec.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,13 @@ describe('Pipelines Actions dropdown', () => {
6262
);
6363
};
6464

65-
beforeEach(() => {
65+
beforeEach(done => {
6666
spyOn(Date, 'now').and.callFake(() => new Date('2063-04-04T00:42:00Z').getTime());
6767
vm = mountComponent(Component, { actions: [scheduledJobAction, expiredJobAction] });
68+
69+
Vue.nextTick()
70+
.then(done)
71+
.catch(done.fail);
6872
});
6973

7074
it('emits postAction event after confirming', () => {

0 commit comments

Comments
 (0)