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
83af047b
Commit
83af047b
authored
Sep 10, 2020
by
Kev
Committed by
Olena Horal-Koretska
Sep 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace v-html with GlSprintf in memory_usage.vue
parent
1ec95ad8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
38 deletions
+29
-38
app/assets/javascripts/vue_merge_request_widget/components/deployment/memory_usage.vue
...rge_request_widget/components/deployment/memory_usage.vue
+24
-38
changelogs/unreleased/241968-Replace-v-html.yml
changelogs/unreleased/241968-Replace-v-html.yml
+5
-0
No files found.
app/assets/javascripts/vue_merge_request_widget/components/deployment/memory_usage.vue
View file @
83af047b
<
script
>
/* eslint-disable vue/no-v-html */
import
{
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
{
sprintf
,
s__
}
from
'
~/locale
'
;
import
{
GlLoadingIcon
,
GlSprintf
,
GlLink
}
from
'
@gitlab/ui
'
;
import
{
s__
}
from
'
~/locale
'
;
import
statusCodes
from
'
~/lib/utils/http_status
'
;
import
{
bytesToMiB
}
from
'
~/lib/utils/number_utils
'
;
import
{
backOff
}
from
'
~/lib/utils/common_utils
'
;
...
...
@@ -13,6 +12,8 @@ export default {
components
:
{
MemoryGraph
,
GlLoadingIcon
,
GlSprintf
,
GlLink
,
},
props
:
{
metricsUrl
:
{
...
...
@@ -50,45 +51,22 @@ export default {
return
!
this
.
loadingMetrics
&&
!
this
.
hasMetrics
&&
!
this
.
loadFailed
;
},
memoryChangeMessage
()
{
const
messageProps
=
{
memoryFrom
:
this
.
memoryFrom
,
memoryTo
:
this
.
memoryTo
,
metricsLinkStart
:
`<a href="
${
this
.
metricsMonitoringUrl
}
">`
,
metricsLinkEnd
:
'
</a>
'
,
emphasisStart
:
'
<b>
'
,
emphasisEnd
:
'
</b>
'
,
};
const
memoryTo
=
Number
(
this
.
memoryTo
);
const
memoryFrom
=
Number
(
this
.
memoryFrom
);
let
memoryUsageMsg
=
''
;
if
(
memoryTo
>
memoryFrom
)
{
memoryUsageMsg
=
sprintf
(
s__
(
'
mrWidget|%{metricsLinkStart} Memory %{metricsLinkEnd} usage %{emphasisStart} increased %{emphasisEnd} from %{memoryFrom}MB to %{memoryTo}MB
'
,
),
messageProps
,
false
,
return
s__
(
'
mrWidget|%{metricsLinkStart} Memory %{metricsLinkEnd} usage %{emphasisStart} increased %{emphasisEnd} from %{memoryFrom}MB to %{memoryTo}MB
'
,
);
}
else
if
(
memoryTo
<
memoryFrom
)
{
memoryUsageMsg
=
sprintf
(
s__
(
'
mrWidget|%{metricsLinkStart} Memory %{metricsLinkEnd} usage %{emphasisStart} decreased %{emphasisEnd} from %{memoryFrom}MB to %{memoryTo}MB
'
,
),
messageProps
,
false
,
);
}
else
{
memoryUsageMsg
=
sprintf
(
s__
(
'
mrWidget|%{metricsLinkStart} Memory %{metricsLinkEnd} usage is %{emphasisStart} unchanged %{emphasisEnd} at %{memoryFrom}MB
'
,
),
messageProps
,
false
,
return
s__
(
'
mrWidget|%{metricsLinkStart} Memory %{metricsLinkEnd} usage %{emphasisStart} decreased %{emphasisEnd} from %{memoryFrom}MB to %{memoryTo}MB
'
,
);
}
return
memoryUsageMsg
;
return
s__
(
'
mrWidget|%{metricsLinkStart} Memory %{metricsLinkEnd} usage is %{emphasisStart} unchanged %{emphasisEnd} at %{memoryFrom}MB
'
,
);
},
},
mounted
()
{
...
...
@@ -162,11 +140,19 @@ export default {
s__
(
'
mrWidget|Loading deployment statistics
'
)
}}
</p>
<p
v-if=
"shouldShowMemoryGraph"
class=
"usage-info js-usage-info"
v-html=
"memoryChangeMessage"
></p>
<p
v-if=
"shouldShowMemoryGraph"
class=
"usage-info js-usage-info"
>
<gl-sprintf
:message=
"memoryChangeMessage"
>
<template
#metricsLink
="
{ content }">
<gl-link
:href=
"metricsMonitoringUrl"
>
{{
content
}}
</gl-link>
</
template
>
<
template
#emphasis=
"{content}"
>
<strong>
{{
content
}}
</strong>
</
template
>
<
template
#memoryFrom
>
{{
memoryFrom
}}
</
template
>
<
template
#memoryTo
>
{{
memoryTo
}}
</
template
>
</gl-sprintf>
</p>
<p
v-if=
"shouldShowLoadFailure"
class=
"usage-info js-usage-info usage-info-failed"
>
{{ s__('mrWidget|Failed to load deployment statistics') }}
</p>
...
...
changelogs/unreleased/241968-Replace-v-html.yml
0 → 100644
View file @
83af047b
---
title
:
Replace v-html with GlSprintf in memory_usage.vue
merge_request
:
41204
author
:
Kev @KevSlashNull
type
:
other
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