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
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 @@
...
@@ -2,6 +2,8 @@
import
ActionComponent
from
'
./action_component.vue
'
;
import
ActionComponent
from
'
./action_component.vue
'
;
import
JobNameComponent
from
'
./job_name_component.vue
'
;
import
JobNameComponent
from
'
./job_name_component.vue
'
;
import
tooltip
from
'
../../../vue_shared/directives/tooltip
'
;
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.
* Renders the badge for the pipeline graph and the job's dropdown.
...
@@ -36,6 +38,7 @@ export default {
...
@@ -36,6 +38,7 @@ export default {
directives
:
{
directives
:
{
tooltip
,
tooltip
,
},
},
mixins
:
[
delayedJobMixin
],
props
:
{
props
:
{
job
:
{
job
:
{
type
:
Object
,
type
:
Object
,
...
@@ -52,6 +55,7 @@ export default {
...
@@ -52,6 +55,7 @@ export default {
default
:
Infinity
,
default
:
Infinity
,
},
},
},
},
computed
:
{
computed
:
{
status
()
{
status
()
{
return
this
.
job
&&
this
.
job
.
status
?
this
.
job
.
status
:
{};
return
this
.
job
&&
this
.
job
.
status
?
this
.
job
.
status
:
{};
...
@@ -59,17 +63,23 @@ export default {
...
@@ -59,17 +63,23 @@ export default {
tooltipText
()
{
tooltipText
()
{
const
textBuilder
=
[];
const
textBuilder
=
[];
const
{
name
:
jobName
}
=
this
.
job
;
if
(
this
.
job
.
n
ame
)
{
if
(
jobN
ame
)
{
textBuilder
.
push
(
this
.
job
.
n
ame
);
textBuilder
.
push
(
jobN
ame
);
}
}
if
(
this
.
job
.
name
&&
this
.
status
.
tooltip
)
{
const
{
tooltip
:
statusTooltip
}
=
this
.
status
;
if
(
jobName
&&
statusTooltip
)
{
textBuilder
.
push
(
'
-
'
);
textBuilder
.
push
(
'
-
'
);
}
}
if
(
this
.
status
.
tooltip
)
{
if
(
statusTooltip
)
{
textBuilder
.
push
(
this
.
job
.
status
.
tooltip
);
if
(
this
.
isDelayedJob
)
{
textBuilder
.
push
(
sprintf
(
statusTooltip
,
{
remainingTime
:
this
.
remainingTime
}));
}
else
{
textBuilder
.
push
(
statusTooltip
);
}
}
}
return
textBuilder
.
join
(
'
'
);
return
textBuilder
.
join
(
'
'
);
...
@@ -88,6 +98,7 @@ export default {
...
@@ -88,6 +98,7 @@ export default {
return
this
.
job
.
status
&&
this
.
job
.
status
.
action
&&
this
.
job
.
status
.
action
.
path
;
return
this
.
job
.
status
&&
this
.
job
.
status
.
action
&&
this
.
job
.
status
.
action
.
path
;
},
},
},
},
methods
:
{
methods
:
{
pipelineActionRequestComplete
()
{
pipelineActionRequestComplete
()
{
this
.
$emit
(
'
pipelineActionRequestComplete
'
);
this
.
$emit
(
'
pipelineActionRequestComplete
'
);
...
...
spec/javascripts/pipelines/graph/job_item_spec.js
View file @
53a28e80
...
@@ -6,6 +6,7 @@ describe('pipeline graph job item', () => {
...
@@ -6,6 +6,7 @@ describe('pipeline graph job item', () => {
const
JobComponent
=
Vue
.
extend
(
JobItem
);
const
JobComponent
=
Vue
.
extend
(
JobItem
);
let
component
;
let
component
;
const
delayedJobFixture
=
getJSONFixture
(
'
jobs/delayed.json
'
);
const
mockJob
=
{
const
mockJob
=
{
id
:
4256
,
id
:
4256
,
name
:
'
test
'
,
name
:
'
test
'
,
...
@@ -167,4 +168,30 @@ describe('pipeline graph job item', () => {
...
@@ -167,4 +168,30 @@ describe('pipeline graph job item', () => {
expect
(
component
.
$el
.
querySelector
(
tooltipBoundary
)).
toBeNull
();
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