Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9ffd1dbd
authored
Sep 22, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: i18n for graphs
parent
ccbce20a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
12 deletions
+13
-12
circle/dashboard/views/graph.py
+12
-11
circle/dashboard/views/util.py
+1
-1
No files found.
circle/dashboard/views/graph.py
View file @
9ffd1dbd
...
@@ -23,6 +23,7 @@ import requests
...
@@ -23,6 +23,7 @@ import requests
from
django.conf
import
settings
from
django.conf
import
settings
from
django.core.exceptions
import
PermissionDenied
,
SuspiciousOperation
from
django.core.exceptions
import
PermissionDenied
,
SuspiciousOperation
from
django.http
import
HttpResponse
,
Http404
from
django.http
import
HttpResponse
,
Http404
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.views.generic
import
View
from
django.views.generic
import
View
from
braces.views
import
LoginRequiredMixin
,
SuperuserRequiredMixin
from
braces.views
import
LoginRequiredMixin
,
SuperuserRequiredMixin
...
@@ -162,8 +163,8 @@ class NodeListGraphView(SuperuserRequiredMixin, GraphViewBase):
...
@@ -162,8 +163,8 @@ class NodeListGraphView(SuperuserRequiredMixin, GraphViewBase):
class
Ram
(
object
):
class
Ram
(
object
):
metric_name
=
"memory.usage"
metric_name
=
"memory.usage"
title
=
"RAM usage (
%
)"
title
=
_
(
"RAM usage (
%
)"
)
label
=
"RAM usage (
%
)"
label
=
_
(
"RAM usage (
%
)"
)
def
get_minmax
(
self
):
def
get_minmax
(
self
):
return
(
0
,
105
)
return
(
0
,
105
)
...
@@ -174,8 +175,8 @@ register_graph(Ram, 'memory', NodeGraphView)
...
@@ -174,8 +175,8 @@ register_graph(Ram, 'memory', NodeGraphView)
class
Cpu
(
object
):
class
Cpu
(
object
):
metric_name
=
"cpu.percent"
metric_name
=
"cpu.percent"
title
=
"CPU usage (
%
)"
title
=
_
(
"CPU usage (
%
)"
)
label
=
"CPU usage (
%
)"
label
=
_
(
"CPU usage (
%
)"
)
def
get_minmax
(
self
):
def
get_minmax
(
self
):
if
isinstance
(
self
.
obj
,
Node
):
if
isinstance
(
self
.
obj
,
Node
):
...
@@ -188,7 +189,7 @@ register_graph(Cpu, 'cpu', NodeGraphView)
...
@@ -188,7 +189,7 @@ register_graph(Cpu, 'cpu', NodeGraphView)
class
VmNetwork
(
object
):
class
VmNetwork
(
object
):
title
=
"Network"
title
=
_
(
"Network"
)
def
get_minmax
(
self
):
def
get_minmax
(
self
):
return
(
0
,
None
)
return
(
0
,
None
)
...
@@ -211,7 +212,7 @@ register_graph(VmNetwork, 'network', VmGraphView)
...
@@ -211,7 +212,7 @@ register_graph(VmNetwork, 'network', VmGraphView)
class
NodeNetwork
(
object
):
class
NodeNetwork
(
object
):
title
=
"Network"
title
=
_
(
"Network"
)
def
get_minmax
(
self
):
def
get_minmax
(
self
):
return
(
0
,
None
)
return
(
0
,
None
)
...
@@ -227,8 +228,8 @@ register_graph(NodeNetwork, 'network', NodeGraphView)
...
@@ -227,8 +228,8 @@ register_graph(NodeNetwork, 'network', NodeGraphView)
class
NodeVms
(
object
):
class
NodeVms
(
object
):
metric_name
=
"vmcount"
metric_name
=
"vmcount"
title
=
"Instance count"
title
=
_
(
"Instance count"
)
label
=
"instance count"
label
=
_
(
"instance count"
)
def
get_minmax
(
self
):
def
get_minmax
(
self
):
return
(
0
,
None
)
return
(
0
,
None
)
...
@@ -237,7 +238,7 @@ register_graph(NodeVms, 'vm', NodeGraphView)
...
@@ -237,7 +238,7 @@ register_graph(NodeVms, 'vm', NodeGraphView)
class
NodeAllocated
(
object
):
class
NodeAllocated
(
object
):
title
=
"Allocated memory (bytes)"
title
=
_
(
"Allocated memory (bytes)"
)
def
get_target
(
self
):
def
get_target
(
self
):
prefix
=
self
.
obj
.
metric_prefix
prefix
=
self
.
obj
.
metric_prefix
...
@@ -257,7 +258,7 @@ register_graph(NodeAllocated, 'alloc', NodeGraphView)
...
@@ -257,7 +258,7 @@ register_graph(NodeAllocated, 'alloc', NodeGraphView)
class
NodeListAllocated
(
object
):
class
NodeListAllocated
(
object
):
title
=
"Allocated memory (bytes)"
title
=
_
(
"Allocated memory (bytes)"
)
def
get_target
(
self
):
def
get_target
(
self
):
nodes
=
self
.
obj
nodes
=
self
.
obj
...
@@ -277,7 +278,7 @@ register_graph(NodeListAllocated, 'alloc', NodeListGraphView)
...
@@ -277,7 +278,7 @@ register_graph(NodeListAllocated, 'alloc', NodeListGraphView)
class
NodeListVms
(
object
):
class
NodeListVms
(
object
):
title
=
"Instance count"
title
=
_
(
"Instance count"
)
def
get_target
(
self
):
def
get_target
(
self
):
vmcount
=
','
.
join
(
'
%
s.vmcount'
%
n
.
metric_prefix
for
n
in
self
.
obj
)
vmcount
=
','
.
join
(
'
%
s.vmcount'
%
n
.
metric_prefix
for
n
in
self
.
obj
)
...
...
circle/dashboard/views/util.py
View file @
9ffd1dbd
...
@@ -31,7 +31,7 @@ from django.contrib.auth.views import redirect_to_login
...
@@ -31,7 +31,7 @@ from django.contrib.auth.views import redirect_to_login
from
django.db.models
import
Q
from
django.db.models
import
Q
from
django.http
import
HttpResponse
,
HttpResponseRedirect
from
django.http
import
HttpResponse
,
HttpResponseRedirect
from
django.shortcuts
import
redirect
from
django.shortcuts
import
redirect
from
django.utils.translation
import
ugettext
as
_
from
django.utils.translation
import
ugettext
_lazy
as
_
from
django.views.generic
import
DetailView
,
View
from
django.views.generic
import
DetailView
,
View
from
django.views.generic.detail
import
SingleObjectMixin
from
django.views.generic.detail
import
SingleObjectMixin
...
...
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