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
6be3e029
Commit
6be3e029
authored
May 29, 2017
by
kushalpandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `bytesToMiB` to convert bytes into MB, add comments for array accessor
parent
a7652553
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_memory_usage.js
...merge_request_widget/components/mr_widget_memory_usage.js
+11
-3
No files found.
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_memory_usage.js
View file @
6be3e029
import
statusCodes
from
'
~/lib/utils/http_status
'
;
import
{
bytesToMiB
}
from
'
~/lib/utils/number_utils
'
;
import
MemoryGraph
from
'
../../vue_shared/components/memory_graph
'
;
import
MRWidgetService
from
'
../services/mr_widget_service
'
;
...
...
@@ -36,9 +38,12 @@ export default {
return
!
this
.
loadingMetrics
&&
!
this
.
hasMetrics
&&
!
this
.
loadFailed
;
},
memoryChangeType
()
{
if
(
this
.
memoryTo
>
this
.
memoryFrom
)
{
const
memoryTo
=
Number
(
this
.
memoryTo
);
const
memoryFrom
=
Number
(
this
.
memoryFrom
);
if
(
memoryTo
>
memoryFrom
)
{
return
'
increased
'
;
}
else
if
(
this
.
memoryTo
<
this
.
memoryFrom
)
{
}
else
if
(
memoryTo
<
memoryFrom
)
{
return
'
decreased
'
;
}
...
...
@@ -48,12 +53,15 @@ export default {
methods
:
{
getMegabytes
(
bytesString
)
{
const
valueInBytes
=
Number
(
bytesString
).
toFixed
(
2
);
return
(
valueInBytes
/
(
1024
*
1024
)).
toFixed
(
2
);
return
(
bytesToMiB
(
valueInBytes
)).
toFixed
(
2
);
},
computeGraphData
(
metrics
,
deploymentTime
)
{
this
.
loadingMetrics
=
false
;
const
{
memory_before
,
memory_after
,
memory_values
}
=
metrics
;
// Both `memory_before` and `memory_after` objects
// have peculiar structure where accessing only a specific
// index yeilds correct value that we can use to show memory delta.
if
(
memory_before
.
length
>
0
)
{
this
.
memoryFrom
=
this
.
getMegabytes
(
memory_before
[
0
].
value
[
1
]);
}
...
...
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