Add dynamic timer for delayed jobs in pipelines list
This commit is contained in:
parent
91765b80b7
commit
557cf4fa76
|
@ -1,9 +1,9 @@
|
|||
<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>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
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', () => {
|
||||
|
|
Loading…
Reference in New Issue