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
7112e5f5
Commit
7112e5f5
authored
Oct 02, 2020
by
Denys Mishunov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Abstracted repetitive funcs into utility
parent
c570d719
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
39 deletions
+36
-39
app/assets/javascripts/ide/components/ide.vue
app/assets/javascripts/ide/components/ide.vue
+17
-39
app/assets/javascripts/ide/utils.js
app/assets/javascripts/ide/utils.js
+19
-0
No files found.
app/assets/javascripts/ide/components/ide.vue
View file @
7112e5f5
...
...
@@ -25,46 +25,24 @@ import ErrorMessage from './error_message.vue';
import
CommitEditorHeader
from
'
./commit_sidebar/editor_header.vue
'
;
import
glFeatureFlagsMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
const
markTreePerformance
=
()
=>
{
performanceMarkAndMeasure
({
mark
:
WEBIDE_MARK_TREE_FINISH
,
measures
:
[
{
name
:
WEBIDE_MEASURE_TREE_FROM_REQUEST
,
start
:
undefined
,
end
:
WEBIDE_MARK_TREE_FINISH
,
},
],
});
};
const
markEditorLoadPerformance
=
()
=>
{
performanceMarkAndMeasure
({
mark
:
WEBIDE_MARK_FILE_FINISH
,
measures
:
[
{
name
:
WEBIDE_MEASURE_FILE_FROM_REQUEST
,
start
:
undefined
,
end
:
WEBIDE_MARK_FILE_FINISH
,
},
],
});
};
const
markEditorInteractionPerformance
=
()
=>
{
performanceMarkAndMeasure
({
mark
:
WEBIDE_MARK_FILE_FINISH
,
measures
:
[
{
name
:
WEBIDE_MEASURE_FILE_AFTER_INTERACTION
,
start
:
WEBIDE_MARK_FILE_CLICKED
,
end
:
WEBIDE_MARK_FILE_FINISH
,
},
],
});
};
import
{
measurePerformance
}
from
'
../utils
'
;
eventHub
.
$on
(
WEBIDE_MEASURE_TREE_FROM_REQUEST
,
markTreePerformance
);
eventHub
.
$on
(
WEBIDE_MEASURE_FILE_FROM_REQUEST
,
markEditorLoadPerformance
);
eventHub
.
$on
(
WEBIDE_MEASURE_FILE_AFTER_INTERACTION
,
markEditorInteractionPerformance
);
eventHub
.
$on
(
WEBIDE_MEASURE_TREE_FROM_REQUEST
,
measurePerformance
.
bind
(
WEBIDE_MARK_TREE_FINISH
,
WEBIDE_MEASURE_TREE_FROM_REQUEST
),
);
eventHub
.
$on
(
WEBIDE_MEASURE_FILE_FROM_REQUEST
,
measurePerformance
.
bind
(
WEBIDE_MARK_FILE_FINISH
,
WEBIDE_MEASURE_FILE_FROM_REQUEST
),
);
eventHub
.
$on
(
WEBIDE_MEASURE_FILE_AFTER_INTERACTION
,
measurePerformance
.
bind
(
WEBIDE_MARK_FILE_FINISH
,
WEBIDE_MEASURE_FILE_AFTER_INTERACTION
,
WEBIDE_MARK_FILE_CLICKED
,
),
);
export
default
{
components
:
{
...
...
app/assets/javascripts/ide/utils.js
View file @
7112e5f5
import
{
languages
}
from
'
monaco-editor
'
;
import
{
flatten
,
isString
}
from
'
lodash
'
;
import
{
SIDE_LEFT
,
SIDE_RIGHT
}
from
'
./constants
'
;
import
{
performanceMarkAndMeasure
}
from
'
~/performance_utils
'
;
const
toLowerCase
=
x
=>
x
.
toLowerCase
();
...
...
@@ -137,3 +138,21 @@ export function readFileAsDataURL(file) {
export
function
getFileEOL
(
content
=
''
)
{
return
content
.
includes
(
'
\r\n
'
)
?
'
CRLF
'
:
'
LF
'
;
}
export
const
measurePerformance
=
(
mark
,
measureName
,
measureStart
=
undefined
,
measureEnd
=
mark
,
)
=>
{
performanceMarkAndMeasure
({
mark
,
measures
:
[
{
name
:
measureName
,
start
:
measureStart
,
end
:
measureEnd
,
},
],
});
};
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