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
Léo-Paul Géneau
gitlab-ce
Commits
53a28e80
Commit
53a28e80
authored
Oct 26, 2018
by
Winnie Hellmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add dynamic timer for delayed jobs in pipeline graph
parent
ff72bba1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
5 deletions
+43
-5
app/assets/javascripts/pipelines/components/graph/job_item.vue
...ssets/javascripts/pipelines/components/graph/job_item.vue
+16
-5
spec/javascripts/pipelines/graph/job_item_spec.js
spec/javascripts/pipelines/graph/job_item_spec.js
+27
-0
No files found.
app/assets/javascripts/pipelines/components/graph/job_item.vue
View file @
53a28e80
...
...
@@ -2,6 +2,8 @@
import
ActionComponent
from
'
./action_component.vue
'
;
import
JobNameComponent
from
'
./job_name_component.vue
'
;
import
tooltip
from
'
../../../vue_shared/directives/tooltip
'
;
import
{
sprintf
}
from
'
~/locale
'
;
import
delayedJobMixin
from
'
~/jobs/mixins/delayed_job_mixin
'
;
/**
* Renders the badge for the pipeline graph and the job's dropdown.
...
...
@@ -36,6 +38,7 @@ export default {
directives
:
{
tooltip
,
},
mixins
:
[
delayedJobMixin
],
props
:
{
job
:
{
type
:
Object
,
...
...
@@ -52,6 +55,7 @@ export default {
default
:
Infinity
,
},
},
computed
:
{
status
()
{
return
this
.
job
&&
this
.
job
.
status
?
this
.
job
.
status
:
{};
...
...
@@ -59,17 +63,23 @@ export default {
tooltipText
()
{
const
textBuilder
=
[];
const
{
name
:
jobName
}
=
this
.
job
;
if
(
this
.
job
.
n
ame
)
{
textBuilder
.
push
(
this
.
job
.
n
ame
);
if
(
jobN
ame
)
{
textBuilder
.
push
(
jobN
ame
);
}
if
(
this
.
job
.
name
&&
this
.
status
.
tooltip
)
{
const
{
tooltip
:
statusTooltip
}
=
this
.
status
;
if
(
jobName
&&
statusTooltip
)
{
textBuilder
.
push
(
'
-
'
);
}
if
(
this
.
status
.
tooltip
)
{
textBuilder
.
push
(
this
.
job
.
status
.
tooltip
);
if
(
statusTooltip
)
{
if
(
this
.
isDelayedJob
)
{
textBuilder
.
push
(
sprintf
(
statusTooltip
,
{
remainingTime
:
this
.
remainingTime
}));
}
else
{
textBuilder
.
push
(
statusTooltip
);
}
}
return
textBuilder
.
join
(
'
'
);
...
...
@@ -88,6 +98,7 @@ export default {
return
this
.
job
.
status
&&
this
.
job
.
status
.
action
&&
this
.
job
.
status
.
action
.
path
;
},
},
methods
:
{
pipelineActionRequestComplete
()
{
this
.
$emit
(
'
pipelineActionRequestComplete
'
);
...
...
spec/javascripts/pipelines/graph/job_item_spec.js
View file @
53a28e80
...
...
@@ -6,6 +6,7 @@ describe('pipeline graph job item', () => {
const
JobComponent
=
Vue
.
extend
(
JobItem
);
let
component
;
const
delayedJobFixture
=
getJSONFixture
(
'
jobs/delayed.json
'
);
const
mockJob
=
{
id
:
4256
,
name
:
'
test
'
,
...
...
@@ -167,4 +168,30 @@ describe('pipeline graph job item', () => {
expect
(
component
.
$el
.
querySelector
(
tooltipBoundary
)).
toBeNull
();
});
});
describe
(
'
for delayed job
'
,
()
=>
{
beforeEach
(()
=>
{
const
fifteenMinutesInMilliseconds
=
900000
;
spyOn
(
Date
,
'
now
'
).
and
.
callFake
(
()
=>
new
Date
(
delayedJobFixture
.
scheduled_at
).
getTime
()
-
fifteenMinutesInMilliseconds
,
);
});
it
(
'
displays remaining time in tooltip
'
,
done
=>
{
component
=
mountComponent
(
JobComponent
,
{
job
:
delayedJobFixture
,
});
Vue
.
nextTick
()
.
then
(()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
.js-pipeline-graph-job-link
'
)
.
getAttribute
(
'
data-original-title
'
),
).
toEqual
(
'
delayed job - delayed manual action (00:15:00)
'
);
})
.
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