summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWinnie Hellmann <winnie@gitlab.com>2018-10-26 11:04:45 +0200
committerWinnie Hellmann <winnie@gitlab.com>2018-10-29 10:57:15 +0100
commit557cf4fa7633c65e7beacb273550de85cb9e130e (patch)
tree86704cc5ff38f81611c6b7bef9580f8838908fee
parent91765b80b74776b1cd6af0e345ca8137dc707c6a (diff)
downloadgitlab-ce-winh-pipeline-actions-dynamic-timer.tar.gz
Add dynamic timer for delayed jobs in pipelines listwinh-pipeline-actions-dynamic-timer
-rw-r--r--app/assets/javascripts/pipelines/components/pipelines_actions.vue10
-rw-r--r--changelogs/unreleased/winh-pipeline-actions-dynamic-timer.yml5
-rw-r--r--spec/javascripts/pipelines/pipelines_actions_spec.js6
3 files changed, 13 insertions, 8 deletions
diff --git a/app/assets/javascripts/pipelines/components/pipelines_actions.vue b/app/assets/javascripts/pipelines/components/pipelines_actions.vue
index 16e69759091..d032ad73f71 100644
--- a/app/assets/javascripts/pipelines/components/pipelines_actions.vue
+++ b/app/assets/javascripts/pipelines/components/pipelines_actions.vue
@@ -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>
diff --git a/changelogs/unreleased/winh-pipeline-actions-dynamic-timer.yml b/changelogs/unreleased/winh-pipeline-actions-dynamic-timer.yml
new file mode 100644
index 00000000000..4ea1d3f8256
--- /dev/null
+++ b/changelogs/unreleased/winh-pipeline-actions-dynamic-timer.yml
@@ -0,0 +1,5 @@
+---
+title: Add dynamic timer for delayed jobs in pipelines list
+merge_request: 22621
+author:
+type: changed
diff --git a/spec/javascripts/pipelines/pipelines_actions_spec.js b/spec/javascripts/pipelines/pipelines_actions_spec.js
index b5c62178642..a7dcd532f4f 100644
--- a/spec/javascripts/pipelines/pipelines_actions_spec.js
+++ b/spec/javascripts/pipelines/pipelines_actions_spec.js
@@ -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', () => {