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
12a777b2
Commit
12a777b2
authored
Jun 13, 2019
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds specs and changelog - squash
parent
cb0616fe
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
6 deletions
+62
-6
app/assets/javascripts/jobs/components/job_log.vue
app/assets/javascripts/jobs/components/job_log.vue
+5
-6
changelogs/unreleased/generate-spans-for-sections.yml
changelogs/unreleased/generate-spans-for-sections.yml
+5
-0
spec/javascripts/jobs/components/job_log_spec.js
spec/javascripts/jobs/components/job_log_spec.js
+37
-0
spec/javascripts/jobs/mock_data.js
spec/javascripts/jobs/mock_data.js
+15
-0
No files found.
app/assets/javascripts/jobs/components/job_log.vue
View file @
12a777b2
...
@@ -49,12 +49,12 @@ export default {
...
@@ -49,12 +49,12 @@ export default {
},
},
removeEventListener
()
{
removeEventListener
()
{
this
.
$el
this
.
$el
.
querySelector
(
'
.js-section-start
'
)
.
querySelector
All
(
'
.js-section-start
'
)
.
removeEventListener
(
'
click
'
,
this
.
handleSectionClick
);
.
forEach
(
el
=>
el
.
removeEventListener
(
'
click
'
,
this
.
handleSectionClick
)
);
},
},
/**
/**
* The collapsible rows are sent in HTML from the backend
* The collapsible rows are sent in HTML from the backend
* We need to add a onclick handler for the divs that match `.js-section-start`
* We need to
s
add a onclick handler for the divs that match `.js-section-start`
*
*
*/
*/
handleCollapsibleRows
()
{
handleCollapsibleRows
()
{
...
@@ -68,13 +68,12 @@ export default {
...
@@ -68,13 +68,12 @@ export default {
*/
*/
handleSectionClick
(
evt
)
{
handleSectionClick
(
evt
)
{
const
clickedArrow
=
evt
.
currentTarget
;
const
clickedArrow
=
evt
.
currentTarget
;
// toggle the arrow class
// toggle the arrow class
clickedArrow
.
classList
.
toggle
(
'
fa-caret-right
'
);
clickedArrow
.
classList
.
toggle
(
'
fa-caret-right
'
);
clickedArrow
.
classList
.
toggle
(
'
fa-caret-down
'
);
clickedArrow
.
classList
.
toggle
(
'
fa-caret-down
'
);
const
dataSection
=
clickedArrow
.
getAttribute
(
'
data-section
'
)
;
const
{
section
}
=
clickedArrow
.
dataset
;
const
sibilings
=
this
.
$el
.
querySelectorAll
(
`.js-s_
${
dataS
ection
}
:not(.js-section-header)`
);
const
sibilings
=
this
.
$el
.
querySelectorAll
(
`.js-s_
${
s
ection
}
:not(.js-section-header)`
);
sibilings
.
forEach
(
row
=>
row
.
classList
.
toggle
(
'
hidden
'
));
sibilings
.
forEach
(
row
=>
row
.
classList
.
toggle
(
'
hidden
'
));
},
},
...
...
changelogs/unreleased/generate-spans-for-sections.yml
0 → 100644
View file @
12a777b2
---
title
:
Adds collapsible sections for job log
merge_request
:
28642
author
:
type
:
added
spec/javascripts/jobs/components/job_log_spec.js
View file @
12a777b2
...
@@ -3,6 +3,7 @@ import component from '~/jobs/components/job_log.vue';
...
@@ -3,6 +3,7 @@ import component from '~/jobs/components/job_log.vue';
import
createStore
from
'
~/jobs/store
'
;
import
createStore
from
'
~/jobs/store
'
;
import
{
mountComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
mountComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
resetStore
}
from
'
../store/helpers
'
;
import
{
resetStore
}
from
'
../store/helpers
'
;
import
{
logWithCollapsibleSections
}
from
'
../mock_data
'
;
describe
(
'
Job Log
'
,
()
=>
{
describe
(
'
Job Log
'
,
()
=>
{
const
Component
=
Vue
.
extend
(
component
);
const
Component
=
Vue
.
extend
(
component
);
...
@@ -62,4 +63,40 @@ describe('Job Log', () => {
...
@@ -62,4 +63,40 @@ describe('Job Log', () => {
expect
(
vm
.
$el
.
querySelector
(
'
.js-log-animation
'
)).
toBeNull
();
expect
(
vm
.
$el
.
querySelector
(
'
.js-log-animation
'
)).
toBeNull
();
});
});
});
});
describe
(
'
Collapsible sections
'
,
()
=>
{
beforeEach
(()
=>
{
vm
=
mountComponentWithStore
(
Component
,
{
props
:
{
trace
:
logWithCollapsibleSections
.
html
,
isComplete
:
true
,
},
store
,
});
});
it
(
'
renders open arrow
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.fa-caret-down
'
)).
not
.
toBeNull
();
});
it
(
'
toggles hidden class to the sibilings rows when arrow is clicked
'
,
done
=>
{
vm
.
$nextTick
()
.
then
(()
=>
{
const
{
section
}
=
vm
.
$el
.
querySelector
(
'
.js-section-start
'
).
dataset
;
vm
.
$el
.
querySelector
(
'
.js-section-start
'
).
click
();
vm
.
$el
.
querySelectorAll
(
`.js-s_
${
section
}
:not(.js-section-header)`
).
forEach
(
el
=>
{
expect
(
el
.
classList
.
contains
(
'
hidden
'
)).
toEqual
(
true
);
});
vm
.
$el
.
querySelector
(
'
.js-section-start
'
).
click
();
vm
.
$el
.
querySelectorAll
(
`.js-s_
${
section
}
:not(.js-section-header)`
).
forEach
(
el
=>
{
expect
(
el
.
classList
.
contains
(
'
hidden
'
)).
toEqual
(
false
);
});
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
});
});
});
spec/javascripts/jobs/mock_data.js
View file @
12a777b2
...
@@ -1190,3 +1190,18 @@ export const jobsInStage = {
...
@@ -1190,3 +1190,18 @@ export const jobsInStage = {
path
:
'
/gitlab-org/gitlab-shell/pipelines/27#build
'
,
path
:
'
/gitlab-org/gitlab-shell/pipelines/27#build
'
,
dropdown_path
:
'
/gitlab-org/gitlab-shell/pipelines/27/stage.json?stage=build
'
,
dropdown_path
:
'
/gitlab-org/gitlab-shell/pipelines/27/stage.json?stage=build
'
,
};
};
export
const
logWithCollapsibleSections
=
{
append
:
false
,
complete
:
true
,
html
:
'
<div class="js-section-start fa fa-caret-down append-right-8 cursor-pointer" data-timestamp="1559571405" data-section="after-script" role="button"></div><span class="term-fg-l-green term-bold section js-section-header js-s_after-script">Running after script...</span><span class="section js-section-header js-s_after-script"><br /></span><span class="section s_after-script line"></span><span class="section js-s_after-script"></span><span class="term-fg-l-green term-bold section js-s_after-script">$ date</span><span class="section js-s_after-script"><br /></span><span class="section s_after-script line"></span><span class="section js-s_after-script">Mon Jun 3 14:16:46 UTC 2019<br /></span><span class="section s_after-script line"></span><span class="section js-s_after-script"></span><div class="section-end" data-section="after-script"></div><div class="js-section-start fa fa-caret-down append-right-8 cursor-pointer"data-timestamp="1559571408" data-section="archive-cache" role="button" ></div><span class="term-fg-l-green term-bold section js-section-header js-s_archive-cache">Not uploading cache debian-stretch-ruby-2.6.3-node-10.x-3 due to policy</span><span class="section js-section-header js-s_archive-cache"><br /></span><span class="section s_archive-cache line"></span><span class="section js-s_archive-cache"></span><div class="section-end" data-section="archive-cache"></div><div class="js-section-start fa fa-caret-down append-right-8 cursor-pointer" data-timestamp="1559571409" data-section="upload-artifacts-on-success" role="button"></div><span class="term-fg-l-green term-bold section js-section-header js-s_upload-artifacts-on-success">Uploading artifacts...</span><span class="section js-section-header js-s_upload-artifacts-on-success"><br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s_upload-artifacts-on-success">coverage/: found 5 matching files </span><span class="section js-s_upload-artifacts-on-success"> <br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s_upload-artifacts-on-success">knapsack/: found 4 matching files </span><span class="section js-s_upload-artifacts-on-success"> <br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s_upload-artifacts-on-success">rspec_flaky/: found 4 matching files </span><span class="section js-s_upload-artifacts-on-success"> <br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s_upload-artifacts-on-success">rspec_profiling/: found 1 matching files </span><span class="section js-s_upload-artifacts-on-success"> <br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s_upload-artifacts-on-success"></span><span class="term-fg-yellow section js-s_upload-artifacts-on-success">WARNING: tmp/capybara/: no matching files </span><span class="section js-s_upload-artifacts-on-success"> <br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s_upload-artifacts-on-success">Uploading artifacts to coordinator... ok </span><span class="section js-s_upload-artifacts-on-success"> id</span><span class="section js-s_upload-artifacts-on-success">=224162288 responseStatus</span><span class="section js-s_upload-artifacts-on-success">=201 Created token</span><span class="section js-s_upload-artifacts-on-success">=bBmyXJNW<br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s_upload-artifacts-on-success"></span><span class="term-fg-l-green term-bold section js-s_upload-artifacts-on-success">Uploading artifacts...</span><span class="section js-s_upload-artifacts-on-success"><br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s_upload-artifacts-on-success">junit_rspec.xml: found 1 matching files </span><span class="section js-s_upload-artifacts-on-success"> <br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s_upload-artifacts-on-success">Uploading artifacts to coordinator... ok </span><span class="section js-s_upload-artifacts-on-success"> id</span><span class="section js-s_upload-artifacts-on-success">=224162288 responseStatus</span><span class="section js-s_upload-artifacts-on-success">=201 Created token</span><span class="section js-s_upload-artifacts-on-success">=bBmyXJNW<br /></span><span class="section s_upload-artifacts-on-success line"></span><span class="section js-s_upload-artifacts-on-success"></span><div class="section-end" data-section="upload-artifacts-on-success"></div><span class="term-fg-l-green term-bold">Job succeeded<br /><span class="term-fg-l-green term-bold"></span></span>
'
,
id
:
1385
,
offset
:
0
,
size
:
78815
,
state
:
'
eyJvZmZzZXQiOjc4ODE1LCJuX29wZW5fdGFncyI6MCwiZmdfY29sb3IiOm51bGwsImJnX2NvbG9yIjpudWxsLCJzdHlsZV9tYXNrIjowLCJzZWN0aW9ucyI6W10sImxpbmVub19pbl9zZWN0aW9uIjoxMX0=
'
,
status
:
'
success
'
,
total
:
78815
,
truncated
:
false
,
};
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