Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
997d70ea
Commit
997d70ea
authored
Oct 30, 2018
by
Winnie Hellmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add dynamic timer for delayed jobs in job sidebar
parent
53a28e80
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
1 deletion
+39
-1
app/assets/javascripts/jobs/components/job_container_item.vue
...assets/javascripts/jobs/components/job_container_item.vue
+11
-1
spec/javascripts/jobs/components/job_container_item_spec.js
spec/javascripts/jobs/components/job_container_item_spec.js
+28
-0
No files found.
app/assets/javascripts/jobs/components/job_container_item.vue
View file @
997d70ea
...
...
@@ -2,6 +2,8 @@
import
{
GlTooltipDirective
,
GlLink
}
from
'
@gitlab-org/gitlab-ui
'
;
import
CiIcon
from
'
~/vue_shared/components/ci_icon.vue
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
delayedJobMixin
from
'
~/jobs/mixins/delayed_job_mixin
'
;
import
{
sprintf
}
from
'
~/locale
'
;
export
default
{
components
:
{
...
...
@@ -12,6 +14,7 @@ export default {
directives
:
{
GlTooltip
:
GlTooltipDirective
,
},
mixins
:
[
delayedJobMixin
],
props
:
{
job
:
{
type
:
Object
,
...
...
@@ -24,7 +27,14 @@ export default {
},
computed
:
{
tooltipText
()
{
return
`
${
this
.
job
.
name
}
-
${
this
.
job
.
status
.
tooltip
}
`
;
const
{
name
,
status
}
=
this
.
job
;
const
text
=
`
${
name
}
-
${
status
.
tooltip
}
`
;
if
(
this
.
isDelayedJob
)
{
return
sprintf
(
text
,
{
remainingTime
:
this
.
remainingTime
})
}
return
text
;
},
},
};
...
...
spec/javascripts/jobs/components/job_container_item_spec.js
View file @
997d70ea
...
...
@@ -4,6 +4,7 @@ import mountComponent from 'spec/helpers/vue_mount_component_helper';
import
job
from
'
../mock_data
'
;
describe
(
'
JobContainerItem
'
,
()
=>
{
const
delayedJobFixture
=
getJSONFixture
(
'
jobs/delayed.json
'
);
const
Component
=
Vue
.
extend
(
JobContainerItem
);
let
vm
;
...
...
@@ -70,4 +71,31 @@ describe('JobContainerItem', () => {
expect
(
vm
.
$el
).
toHaveSpriteIcon
(
'
retry
'
);
});
});
describe
(
'
for delayed job
'
,
()
=>
{
beforeEach
(()
=>
{
const
remainingMilliseconds
=
1337000
;
spyOn
(
Date
,
'
now
'
).
and
.
callFake
(
()
=>
new
Date
(
delayedJobFixture
.
scheduled_at
).
getTime
()
-
remainingMilliseconds
,
);
});
it
(
'
displays remaining time in tooltip
'
,
done
=>
{
vm
=
mountComponent
(
Component
,
{
job
:
delayedJobFixture
,
isActive
:
false
,
});
Vue
.
nextTick
()
.
then
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-job-link
'
)
.
getAttribute
(
'
data-original-title
'
),
).
toEqual
(
'
delayed job - delayed manual action (00:22:17)
'
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment