Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c6e0603f
authored
Nov 28, 2018
by
Gelencsér Szabolcs
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into 'master'
Quota widget created See merge request
!1
parents
fd8ddbfb
746a5447
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
130 additions
and
3 deletions
+130
-3
circle/dashboard/static/dashboard/dashboard.less
+28
-1
circle/dashboard/templates/dashboard/index-quota.html
+59
-0
circle/dashboard/templates/dashboard/index.html
+6
-1
circle/dashboard/views/index.py
+37
-1
No files found.
circle/dashboard/static/dashboard/dashboard.less
View file @
c6e0603f
...
@@ -585,7 +585,7 @@ footer a, footer a:hover, footer a:visited {
...
@@ -585,7 +585,7 @@ footer a, footer a:hover, footer a:visited {
#dashboard-vm-list, #dashboard-node-list, #dashboard-group-list,
#dashboard-vm-list, #dashboard-node-list, #dashboard-group-list,
#dashboard-template-list, #dashboard-files-toplist, #dashboard-user-list,
#dashboard-template-list, #dashboard-files-toplist, #dashboard-user-list,
#dashboard-vxlan-list {
#dashboard-vxlan-list
, #dashboard-quota-list
{
min-height: 200px;
min-height: 200px;
}
}
...
@@ -1193,6 +1193,33 @@ textarea[name="new_members"] {
...
@@ -1193,6 +1193,33 @@ textarea[name="new_members"] {
}
}
}
}
#dashboard-quota-list{
.list-group-item {
display: flex;
}
.index-quota-list-name {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.index-quota-list-name {
width: 100%;
}
.index-quota-list-name .quota-label{
width:90px;
display:inline-block;
}
.index-quota-list-name .quota-percentage{
width:40px;
display:inline-block;
text-align:right;
}
}
#dashboard-user-list {
#dashboard-user-list {
.list-group-item {
.list-group-item {
...
...
circle/dashboard/templates/dashboard/index-quota.html
0 → 100644
View file @
c6e0603f
{% load i18n %}
{% load instance_tags %}
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<div
class=
"pull-right toolbar"
>
<div
class=
"btn-group"
>
</div>
<span
class=
"btn btn-default btn-xs infobtn"
data-container=
"body"
title=
"{% trans "
Report
on
used
resources
based
on
quota
statistics
."
%}"
><i
class=
"fa fa-info-circle"
></i></span>
</div>
<h3
class=
"no-margin"
>
<span
class=
"visible-xs"
>
<i
class=
"fa fa-desktop"
></i>
{% trans "Quota" %}
</span>
<span
class=
"hidden-xs"
>
<i
class=
"fa fa-desktop"
></i>
{% trans "Resources" %}
</span>
</h3>
</div>
<div
class=
"list-group"
id=
"vm-list-view"
>
<div
id=
"dashboard-quota-list"
>
{% for metric, quotastats in quotas.items %}
<div
class=
"list-group-item"
>
<span
class=
"index-quota-list-name"
>
<span
class=
"quota-label"
>
<i
class=
"fa fa-{{ quotastats.icon }}"
title=
"{{ metric }}"
></i>
{{ metric }}
</span>
<progress
style=
"width:50%;"
title=
"{{ quotastats.usage }} / {{ quotastats.limit }} "
max=
"{{ quotastats.limit }}"
value=
"{{ quotastats.usage }}"
></progress>
<span
class=
"quota-percentage"
>
{% widthratio quotastats.usage quotastats.limit 100 %} %
</span>
</span>
</div>
{% empty %}
<div
class=
"list-group-item list-group-item-last"
>
{% trans "You have no quota stats available." %}
</div>
<div
id=
"empty-vm-help"
>
{% trans "Please try reloading." %}
<br
/>
</div>
{% endfor %}
</div>
<div
class=
"list-group-item list-group-footer"
>
<div
class=
"row"
>
</div>
</div>
</div>
</div>
\ No newline at end of file
circle/dashboard/templates/dashboard/index.html
View file @
c6e0603f
...
@@ -52,6 +52,10 @@
...
@@ -52,6 +52,10 @@
{% include "dashboard/index-vxlans.html" %}
{% include "dashboard/index-vxlans.html" %}
</div>
</div>
<div
class=
"col-lg-4 col-sm-6"
>
{% include "dashboard/index-quota.html" %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% endblock %}
\ No newline at end of file
circle/dashboard/views/index.py
View file @
c6e0603f
...
@@ -44,6 +44,7 @@ class IndexView(LoginRequiredMixin, TemplateView):
...
@@ -44,6 +44,7 @@ class IndexView(LoginRequiredMixin, TemplateView):
instances
=
openstack_api
.
nova
.
server_list
(
self
.
request
)[
0
]
#TODO: flatten?
instances
=
openstack_api
.
nova
.
server_list
(
self
.
request
)[
0
]
#TODO: flatten?
quotas
=
openstack_api
.
nova
.
tenant_quota_get
(
self
.
request
,
user
.
project_id
)
quotas
=
openstack_api
.
nova
.
tenant_quota_get
(
self
.
request
,
user
.
project_id
)
# instances
# instances
favs
=
[
f
.
instance
for
f
in
Favourite
.
objects
.
filter
(
user
=
user
.
id
)]
favs
=
[
f
.
instance
for
f
in
Favourite
.
objects
.
filter
(
user
=
user
.
id
)]
fav_instances
=
[
fav_instances
=
[
...
@@ -133,6 +134,40 @@ class IndexView(LoginRequiredMixin, TemplateView):
...
@@ -133,6 +134,40 @@ class IndexView(LoginRequiredMixin, TemplateView):
else
:
else
:
context
[
'no_store'
]
=
True
context
[
'no_store'
]
=
True
# quotas widget
novaLimits
=
openstack_api
.
nova
.
tenant_absolute_limits
(
self
.
request
,
False
,
user
.
project_id
)
cinderLimits
=
openstack_api
.
cinder
.
tenant_absolute_limits
(
self
.
request
,
user
.
project_id
)
context
.
update
({
'quotas'
:
{
'RAM'
:
{
'icon'
:
'tasks'
,
'usage'
:
novaLimits
[
"totalRAMUsed"
],
'limit'
:
novaLimits
[
"maxTotalRAMSize"
]
},
'Cores'
:
{
'icon'
:
'desktop'
,
'usage'
:
novaLimits
[
"totalCoresUsed"
],
'limit'
:
novaLimits
[
"maxTotalCores"
]
},
'Float IPs'
:
{
'icon'
:
'slack'
,
'usage'
:
novaLimits
[
"totalFloatingIpsUsed"
],
'limit'
:
novaLimits
[
"maxTotalFloatingIps"
]
},
'Instances'
:
{
'icon'
:
'cubes'
,
'usage'
:
novaLimits
[
"totalInstancesUsed"
],
'limit'
:
novaLimits
[
"maxTotalInstances"
]
},
'Volumes'
:
{
'icon'
:
'database'
,
'usage'
:
cinderLimits
[
"totalVolumesUsed"
],
'limit'
:
cinderLimits
[
"maxTotalVolumes"
]
},
}
})
return
context
return
context
...
@@ -161,4 +196,4 @@ class IndexView(LoginRequiredMixin, TemplateView):
...
@@ -161,4 +196,4 @@ class IndexView(LoginRequiredMixin, TemplateView):
# **kwargs)
# **kwargs)
# context['url'] = self.request.build_absolute_uri(
# context['url'] = self.request.build_absolute_uri(
# reverse("dashboard.views.vm-list"))
# reverse("dashboard.views.vm-list"))
# return context
# return context
\ No newline at end of file
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