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
b4235a09
Commit
b4235a09
authored
Oct 12, 2020
by
Dhiraj Bodicherla
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update unit formatter
Update units formatter from IEC to metric
parent
4ac46452
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
20 deletions
+20
-20
ee/app/assets/javascripts/storage_counter/components/storage_inline_alert.vue
...ripts/storage_counter/components/storage_inline_alert.vue
+10
-7
ee/spec/frontend/storage_counter/components/storage_inline_alert_spec.js
...d/storage_counter/components/storage_inline_alert_spec.js
+7
-8
locale/gitlab.pot
locale/gitlab.pot
+3
-5
No files found.
ee/app/assets/javascripts/storage_counter/components/storage_inline_alert.vue
View file @
b4235a09
<
script
>
import
{
GlAlert
}
from
'
@gitlab/ui
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
numberToHumanSize
}
from
'
~/lib/utils/number_utils
'
;
import
{
n__
,
__
}
from
'
~/locale
'
;
import
{
getFormatter
,
SUPPORTED_FORMATS
}
from
'
~/lib/utils/unit_format
'
;
import
{
usageRatioToThresholdLevel
}
from
'
../usage_thresholds
'
;
import
{
ALERT_THRESHOLD
,
ERROR_THRESHOLD
,
WARNING_THRESHOLD
}
from
'
../constants
'
;
...
...
@@ -46,7 +46,7 @@ export default {
},
alertTitle
()
{
if
(
!
this
.
hasPurchasedStorage
()
&&
this
.
containsLockedProjects
)
{
return
__
(
'
This namespace contains locked projects
'
);
return
__
(
'
UsageQuota|
This namespace contains locked projects
'
);
}
return
`
${
this
.
excessStoragePercentageLeft
}
% of purchased storage is available`
;
},
...
...
@@ -73,10 +73,12 @@ export default {
projectsLockedText
()
{
if
(
this
.
repositorySizeExcessProjectCount
===
0
)
{
return
''
;
}
else
if
(
this
.
repositorySizeExcessProjectCount
===
1
)
{
return
__
(
`
${
this
.
repositorySizeExcessProjectCount
}
project`
);
}
return
__
(
`
${
this
.
repositorySizeExcessProjectCount
}
projects`
);
return
`
${
this
.
repositorySizeExcessProjectCount
}
${
n__
(
'
project
'
,
'
projects
'
,
this
.
repositorySizeExcessProjectCount
,
)}
`
;
},
},
methods
:
{
...
...
@@ -84,7 +86,8 @@ export default {
return
this
.
additionalPurchasedStorageSize
>
0
;
},
formatSize
(
size
)
{
return
numberToHumanSize
(
size
);
const
formatter
=
getFormatter
(
SUPPORTED_FORMATS
.
decimalBytes
);
return
formatter
(
size
);
},
hasPurchasedStorageText
()
{
if
(
this
.
thresholdLevel
===
ERROR_THRESHOLD
)
{
...
...
ee/spec/frontend/storage_counter/components/storage_inline_alert_spec.js
View file @
b4235a09
...
...
@@ -2,10 +2,11 @@ import { shallowMount } from '@vue/test-utils';
import
StorageInlineAlert
from
'
ee/storage_counter/components/storage_inline_alert.vue
'
;
import
{
GlAlert
}
from
'
@gitlab/ui
'
;
const
THIRTEEN_GB_IN_BYTES
=
1.3e10
;
const
TEN_GB_IN_BYTES
=
1
e10
;
const
FIVE_GB_IN_BYTES
=
5
e9
;
const
THREE_GB_IN_BYTES
=
3
e9
;
const
GB_IN_BYTES
=
1
_000_000_000
;
const
THIRTEEN_GB_IN_BYTES
=
13
*
GB_IN_BYTES
;
const
TEN_GB_IN_BYTES
=
10
*
GB_IN_BYTES
;
const
FIVE_GB_IN_BYTES
=
5
*
GB_IN_BYTES
;
const
THREE_GB_IN_BYTES
=
3
*
GB_IN_BYTES
;
describe
(
'
StorageInlineAlert
'
,
()
=>
{
let
wrapper
;
...
...
@@ -53,10 +54,8 @@ describe('StorageInlineAlert', () => {
});
it
(
'
renders human readable repositoryFreeLimit
'
,
()
=>
{
// Note how we get a less good looking 9.31 GiB number
// Will be fixed in https://gitlab.com/gitlab-org/gitlab/-/issues/263284
expect
(
findAlert
().
text
()).
toBe
(
'
You have reached the free storage limit of
9.31 Gi
B on 1 project. To unlock them, please purchase additional storage.
'
,
'
You have reached the free storage limit of
10G
B on 1 project. To unlock them, please purchase additional storage.
'
,
);
});
});
...
...
@@ -80,7 +79,7 @@ describe('StorageInlineAlert', () => {
it
(
'
renders text explaining storage
'
,
()
=>
{
expect
(
findAlert
().
text
()).
toBe
(
'
When you purchase additional storage, we automatically unlock projects that were locked when you reached the
9.31 Gi
B limit.
'
,
'
When you purchase additional storage, we automatically unlock projects that were locked when you reached the
10G
B limit.
'
,
);
});
});
...
...
locale/gitlab.pot
View file @
b4235a09
...
...
@@ -8,8 +8,6 @@ msgid ""
msgstr ""
"Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-10-07 20:01+0000\n"
"PO-Revision-Date: 2020-10-07 20:01+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
...
...
@@ -26630,9 +26628,6 @@ msgstr ""
msgid "This merge request was merged. To apply this suggestion, edit this file directly."
msgstr ""
msgid "This namespace contains locked projects"
msgstr ""
msgid "This namespace has already been taken! Please choose another one."
msgstr ""
...
...
@@ -28098,6 +28093,9 @@ msgstr ""
msgid "UsageQuota|Storage"
msgstr ""
msgid "UsageQuota|This namespace contains locked projects"
msgstr ""
msgid "UsageQuota|This namespace has no projects which use shared runners"
msgstr ""
...
...
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