Commit e10ca5eb authored by Filipa Lacerda's avatar Filipa Lacerda

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
parents 6fd7a2dc 557cf4fa
<script>
import { s__, sprintf } from '~/locale';
import { formatTime } from '~/lib/utils/datetime_utility';
import eventHub from '../event_hub';
import icon from '../../vue_shared/components/icon.vue';
import tooltip from '../../vue_shared/directives/tooltip';
import GlCountdown from '~/vue_shared/components/gl_countdown.vue';
export default {
directives: {
......@@ -11,6 +11,7 @@ export default {
},
components: {
icon,
GlCountdown,
},
props: {
actions: {
......@@ -51,11 +52,6 @@ export default {
return !action.playable;
},
remainingTime(action) {
const remainingMilliseconds = new Date(action.scheduled_at).getTime() - Date.now();
return formatTime(Math.max(0, remainingMilliseconds));
},
},
};
</script>
......@@ -100,7 +96,7 @@ export default {
class="pull-right"
>
<icon name="clock" />
{{ remainingTime(action) }}
<gl-countdown :end-date-string="action.scheduled_at" />
</span>
</button>
</li>
......
---
title: Add dynamic timer for delayed jobs in pipelines list
merge_request: 22621
author:
type: changed
......@@ -62,9 +62,13 @@ describe('Pipelines Actions dropdown', () => {
);
};
beforeEach(() => {
beforeEach(done => {
spyOn(Date, 'now').and.callFake(() => new Date('2063-04-04T00:42:00Z').getTime());
vm = mountComponent(Component, { actions: [scheduledJobAction, expiredJobAction] });
Vue.nextTick()
.then(done)
.catch(done.fail);
});
it('emits postAction event after confirming', () => {
......
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