Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
exosphere
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
Exosphere
exosphere
Commits
405d1d87
Commit
405d1d87
authored
3 years ago
by
Chris Martin
Browse files
Options
Downloads
Patches
Plain Diff
Show meters for quota/usage items
parent
4a3c4f27
No related branches found
No related tags found
Loading
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Page/QuotaUsage.elm
+33
-42
33 additions, 42 deletions
src/Page/QuotaUsage.elm
src/Style/Widgets/Meter.elm
+1
-2
1 addition, 2 deletions
src/Style/Widgets/Meter.elm
with
34 additions
and
44 deletions
src/Page/QuotaUsage.elm
+
33
−
42
View file @
405d1d87
module
Page
.
QuotaUsage
exposing
(
ResourceType
(
..
)
,
view
)
import
Element
import
Element
.
Background
as
Background
import
Element
.
Border
as
Border
import
Element
.
Font
as
Font
import
FormatNumber
.
Locales
exposing
(
Decimals
(
..
))
import
Helpers
.
Formatting
exposing
(
Unit
(
..
)
,
humanNumber
)
import
Helpers
.
String
import
OpenStack
.
Types
as
OSTypes
import
RemoteData
exposing
(
RemoteData
(
..
)
,
WebData
)
import
Style
.
Helpers
as
SH
import
Style
.
Widgets
.
Meter
import
View
.
Helpers
as
VH
import
View
.
Types
...
...
@@ -47,53 +44,43 @@ infoItem context detail ( label, units ) =
|>
Maybe
.
map
(
humanNumber
{
locale
|
decimals
=
Exact
0
}
units
)
|>
Maybe
.
withDefault
(
"
"
,
"
N/A"
)
bg
=
Background
.
color
<|
SH
.
toElementColor
context
.
palette
.
surface
border
=
Border
.
rounded
5
pad
=
Element
.
paddingXY
4
2
text
=
String
.
join
"
"
<|
List
.
concat
[
[
usedCount
]
,
if
usedLabel
==
limitLabel
then
[]
else
[
usedLabel
]
,
[
"
of"
]
,
[
limitCount
]
,
[
limitLabel
]
]
in
Element
.
row
(
VH
.
exoRowAttributes
++
[
Element
.
spacing
5
,
Element
.
width
Element
.
fill
])
(
List
.
concat
[
[
Element
.
el
[
Font
.
bold
]
<|
Element
.
text
label
,
Element
.
el
[
bg
,
border
,
pad
]
<|
Element
.
text
usedCount
]
,
if
usedLabel
==
limitLabel
then
[]
else
[
Element
.
el
[
Font
.
italic
]
(
Element
.
text
usedLabel
)
]
,
[
Element
.
el
[]
(
Element
.
text
"
of"
)
,
Element
.
el
[
bg
,
border
,
pad
]
<|
Element
.
text
limitCount
,
Element
.
el
[
Font
.
italic
]
<|
Element
.
text
limitLabel
]
]
)
Style
.
Widgets
.
Meter
.
meter
context
.
palette
label
text
detail
.
inUse
(
Maybe
.
withDefault
-
1
detail
.
limit
)
computeInfoItems
:
View
.
Types
.
Context
->
OSTypes
.
ComputeQuota
->
Element
.
Element
msg
computeInfoItems
context
quota
=
Element
.
wrappedRow
(
VH
.
exoRowAttributes
++
[
Element
.
width
Element
.
fill
])
(
VH
.
exoRowAttributes
++
[
Element
.
width
Element
.
fill
,
Element
.
spacing
35
]
)
[
infoItem
context
quota
.
instances
(
String
.
join
"
"
[
context
.
localization
.
virtualComputer
|>
Helpers
.
String
.
pluralize
|>
Helpers
.
String
.
toTitleCase
,
"
used
:
"
,
"
used"
]
,
Count
)
,
infoItem
context
quota
.
cores
(
"
Cores used
:
"
,
Count
)
,
infoItem
context
quota
.
ram
(
"
RAM used
:
"
,
MebiBytes
)
,
infoItem
context
quota
.
cores
(
"
Cores used"
,
Count
)
,
infoItem
context
quota
.
ram
(
"
RAM used"
,
MebiBytes
)
]
...
...
@@ -138,14 +125,14 @@ floatingIpInfoItems context floatingIpsUsed quota =
{
incorrectIpsQuota
|
inUse
=
floatingIpsUsed
}
in
Element
.
wrappedRow
(
VH
.
exoRowAttributes
++
[
Element
.
width
Element
.
fill
])
(
VH
.
exoRowAttributes
++
[
Element
.
centerX
])
[
infoItem
context
correctedIpsQuota
(
String
.
join
"
"
[
context
.
localization
.
floatingIpAddress
|>
Helpers
.
String
.
pluralize
|>
Helpers
.
String
.
toTitleCase
,
"
used
:
"
,
"
used"
]
,
Count
)
...
...
@@ -161,8 +148,12 @@ floatingIpQuotaDetails context quota floatingIpsUsed =
volumeInfoItems
:
View
.
Types
.
Context
->
OSTypes
.
VolumeQuota
->
Element
.
Element
msg
volumeInfoItems
context
quota
=
Element
.
wrappedRow
(
VH
.
exoRowAttributes
++
[
Element
.
width
Element
.
fill
])
Element
.
row
(
VH
.
exoRowAttributes
++
[
Element
.
centerX
,
Element
.
spacing
35
]
)
[
infoItem
context
quota
.
volumes
...
...
@@ -170,11 +161,11 @@ volumeInfoItems context quota =
[
context
.
localization
.
blockDevice
|>
Helpers
.
String
.
pluralize
|>
Helpers
.
String
.
toTitleCase
,
"
used
:
"
,
"
used"
]
,
Count
)
,
infoItem
context
quota
.
gigabytes
(
"
Storage used
:
"
,
GibiBytes
)
,
infoItem
context
quota
.
gigabytes
(
"
Storage used"
,
GibiBytes
)
]
...
...
This diff is collapsed.
Click to expand it.
src/Style/Widgets/Meter.elm
+
1
−
2
View file @
405d1d87
module
Style
.
Widgets
.
Meter
exposing
(
meter
)
import
Color
import
Css
import
Css
.
Global
import
Element
...
...
@@ -66,7 +65,7 @@ meter palette title subtitle value maximum =
]
,
Html
.
meter
[
HtmlA
.
css
[
Css
.
width
(
Css
.
px
30
0
)
[
Css
.
width
(
Css
.
px
26
0
)
,
Css
.
height
(
Css
.
px
25
)
,
Css
.
property
"
background"
"
none"
,
Css
.
backgroundColor
(
Css
.
hex
"
#F5F5F5"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment