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
f49d43c3
Commit
f49d43c3
authored
Jul 01, 2020
by
Simon Knox
Committed by
Enrique Alcántara
Jul 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Speed up job log rendering
Use funtional component to save time rendering thousands of instances
parent
ac01a943
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
55 deletions
+47
-55
app/assets/javascripts/jobs/components/log/line.vue
app/assets/javascripts/jobs/components/log/line.vue
+24
-16
app/assets/javascripts/jobs/components/log/line_number.vue
app/assets/javascripts/jobs/components/log/line_number.vue
+18
-39
changelogs/unreleased/psi-funtional-line-component.yml
changelogs/unreleased/psi-funtional-line-component.yml
+5
-0
No files found.
app/assets/javascripts/jobs/components/log/line.vue
View file @
f49d43c3
...
...
@@ -2,9 +2,7 @@
import
LineNumber
from
'
./line_number.vue
'
;
export
default
{
components
:
{
LineNumber
,
},
functional
:
true
,
props
:
{
line
:
{
type
:
Object
,
...
...
@@ -15,18 +13,28 @@ export default {
required
:
true
,
},
},
render
(
h
,
{
props
})
{
const
{
line
,
path
}
=
props
;
const
chars
=
line
.
content
.
map
(
content
=>
{
return
h
(
'
span
'
,
{
class
:
[
'
ws-pre-wrap
'
,
content
.
style
],
},
content
.
text
,
);
});
return
h
(
'
div
'
,
{
class
:
'
js-line log-line
'
},
[
h
(
LineNumber
,
{
props
:
{
lineNumber
:
line
.
lineNumber
,
path
,
},
}),
...
chars
,
]);
},
};
</
script
>
<
template
>
<div
class=
"js-line log-line"
>
<line-number
:line-number=
"line.lineNumber"
:path=
"path"
/>
<span
v-for=
"(content, i) in line.content"
:key=
"i"
:class=
"content.style"
class=
"ws-pre-wrap"
>
{{
content
.
text
}}
</span
>
</div>
</
template
>
app/assets/javascripts/jobs/components/log/line_number.vue
View file @
f49d43c3
<
script
>
import
{
GlLink
}
from
'
@gitlab/ui
'
;
export
default
{
components
:
{
GlLink
,
},
functional
:
true
,
props
:
{
lineNumber
:
{
type
:
Number
,
...
...
@@ -15,41 +11,24 @@ export default {
required
:
true
,
},
},
computed
:
{
/**
* Builds the url for each line number
*
* @returns {String}
*/
buildLineNumber
()
{
return
`
${
this
.
path
}
#
${
this
.
lineNumberId
}
`
;
},
/**
* Array indexes start with 0, so we add 1
* to create the line number
*
* @returns {Number} the line number
*/
parsedLineNumber
()
{
return
this
.
lineNumber
+
1
;
},
render
(
h
,
{
props
})
{
const
{
lineNumber
,
path
}
=
props
;
/**
* Creates the anchor for each link
*
* @returns {String}
*/
lineNumberId
()
{
return
`L
${
this
.
parsedLineNumber
}
`
;
},
const
parsedLineNumber
=
lineNumber
+
1
;
const
lineId
=
`L
${
parsedLineNumber
}
`
;
const
lineHref
=
`
${
path
}
#
${
lineId
}
`
;
return
h
(
'
a
'
,
{
class
:
'
gl-link d-inline-block text-right line-number flex-shrink-0
'
,
attrs
:
{
id
:
lineId
,
href
:
lineHref
,
},
},
parsedLineNumber
,
);
},
};
</
script
>
<
template
>
<gl-link
:id=
"lineNumberId"
class=
"d-inline-block text-right line-number flex-shrink-0"
:href=
"buildLineNumber"
>
{{
parsedLineNumber
}}
</gl-link
>
</
template
>
changelogs/unreleased/psi-funtional-line-component.yml
0 → 100644
View file @
f49d43c3
---
title
:
Performance improvement for job logs
merge_request
:
35504
author
:
type
:
performance
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