Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
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
ab361c47
authored
Feb 07, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: mccabe for VmGraphView
parent
d4f0e64c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
+13
-11
circle/dashboard/views.py
+13
-11
No files found.
circle/dashboard/views.py
View file @
ab361c47
...
@@ -1267,19 +1267,21 @@ class VmGraphView(LoginRequiredMixin, View):
...
@@ -1267,19 +1267,21 @@ class VmGraphView(LoginRequiredMixin, View):
if
not
instance
.
has_level
(
request
.
user
,
'user'
):
if
not
instance
.
has_level
(
request
.
user
,
'user'
):
raise
PermissionDenied
()
raise
PermissionDenied
()
prefix
=
'vm.
%
s'
%
instance
.
vm_name
targets
=
{
if
metric
==
'cpu'
:
'cpu'
:
(
'cactiStyle(alias(derivative(
%
s.cpu.usage),'
target
=
(
'cactiStyle(alias(derivative(
%
s.cpu.usage),'
'"cpu usage (
%%
)"))'
),
'"cpu usage (
%%
)"))'
)
%
prefix
'memory'
:
(
'cactiStyle(alias(
%
s.memory.usage,'
elif
metric
==
'memory'
:
'"memory usage (
%%
)"))'
),
target
=
(
'cactiStyle(alias(
%
s.memory.usage,'
'network'
:
(
'cactiStyle(aliasByMetric('
'"memory usage (
%%
)"))'
)
%
prefix
'derivative(
%
s.network.bytes_*)))'
),
elif
metric
==
'network'
:
}
target
=
(
'cactiStyle(aliasByMetric('
'derivative(
%
s.network.bytes_*)))'
)
%
prefix
if
metric
not
in
targets
.
keys
():
else
:
raise
SuspiciousOperation
()
raise
SuspiciousOperation
()
prefix
=
'vm.
%
s'
%
instance
.
vm_name
target
=
targets
[
metric
]
%
prefix
title
=
'
%
s (
%
s) -
%
s'
%
(
instance
.
name
,
instance
.
vm_name
,
metric
)
title
=
'
%
s (
%
s) -
%
s'
%
(
instance
.
name
,
instance
.
vm_name
,
metric
)
params
=
urlencode
({
'target'
:
target
,
params
=
urlencode
({
'target'
:
target
,
...
...
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