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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
ff72bba1
Commit
ff72bba1
authored
Oct 26, 2018
by
Winnie Hellmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add dynamic timer for delayed jobs on single job page
parent
74f22d26
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
1 deletion
+44
-1
app/assets/javascripts/jobs/components/job_app.vue
app/assets/javascripts/jobs/components/job_app.vue
+15
-1
spec/javascripts/jobs/components/job_app_spec.js
spec/javascripts/jobs/components/job_app_spec.js
+29
-0
No files found.
app/assets/javascripts/jobs/components/job_app.vue
View file @
ff72bba1
...
...
@@ -14,6 +14,8 @@ import Log from './job_log.vue';
import
LogTopBar
from
'
./job_log_controllers.vue
'
;
import
StuckBlock
from
'
./stuck_block.vue
'
;
import
Sidebar
from
'
./sidebar.vue
'
;
import
{
sprintf
}
from
'
~/locale
'
;
import
delayedJobMixin
from
'
../mixins/delayed_job_mixin
'
;
export
default
{
name
:
'
JobPageApp
'
,
...
...
@@ -30,6 +32,7 @@ export default {
StuckBlock
,
Sidebar
,
},
mixins
:
[
delayedJobMixin
],
props
:
{
runnerSettingsUrl
:
{
type
:
String
,
...
...
@@ -89,6 +92,17 @@ export default {
shouldRenderContent
()
{
return
!
this
.
isLoading
&&
!
this
.
hasError
;
},
emptyStateTitle
()
{
const
{
emptyStateIllustration
,
remainingTime
}
=
this
;
const
{
title
}
=
emptyStateIllustration
;
if
(
this
.
isDelayedJob
)
{
return
sprintf
(
title
,
{
remainingTime
});
}
return
title
;
},
},
watch
:
{
// Once the job log is loaded,
...
...
@@ -250,7 +264,7 @@ export default {
class=
"js-job-empty-state"
:illustration-path=
"emptyStateIllustration.image"
:illustration-size-class=
"emptyStateIllustration.size"
:title=
"emptyState
Illustration.t
itle"
:title=
"emptyState
T
itle"
:content=
"emptyStateIllustration.content"
:action=
"emptyStateAction"
/>
...
...
spec/javascripts/jobs/components/job_app_spec.js
View file @
ff72bba1
...
...
@@ -8,6 +8,7 @@ import { resetStore } from '../store/helpers';
import
job
from
'
../mock_data
'
;
describe
(
'
Job App
'
,
()
=>
{
const
delayedJobFixture
=
getJSONFixture
(
'
jobs/delayed.json
'
);
const
Component
=
Vue
.
extend
(
jobApp
);
let
store
;
let
vm
;
...
...
@@ -420,6 +421,34 @@ describe('Job App ', () => {
done
();
},
0
);
});
it
(
'
displays remaining time for a delayed job
'
,
(
done
)
=>
{
const
oneHourInMilliseconds
=
3600000
;
spyOn
(
Date
,
'
now
'
).
and
.
callFake
(()
=>
new
Date
(
delayedJobFixture
.
scheduled_at
).
getTime
()
-
oneHourInMilliseconds
);
mock
.
onGet
(
props
.
endpoint
).
replyOnce
(
200
,
{
...
delayedJobFixture
});
vm
=
mountComponentWithStore
(
Component
,
{
props
,
store
,
});
store
.
subscribeAction
((
action
)
=>
{
if
(
action
.
type
!==
'
receiveJobSuccess
'
)
{
return
;
}
Vue
.
nextTick
()
.
then
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-job-empty-state
'
)).
not
.
toBeNull
();
const
title
=
vm
.
$el
.
querySelector
(
'
.js-job-empty-state-title
'
);
expect
(
title
).
toContainText
(
'
01:00:00
'
);
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