Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6282576e
authored
Aug 26, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: add instance count to mass ops
parent
4387a950
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
circle/dashboard/templates/dashboard/mass-operate.html
+4
-2
circle/dashboard/views.py
+7
-2
No files found.
circle/dashboard/templates/dashboard/mass-operate.html
View file @
6282576e
...
...
@@ -3,8 +3,10 @@
{% block question %}
<p>
{% blocktrans with op=op.name %}
Do you want to perform the following operation:
<strong>
{{op}}
</strong>
?
{% blocktrans with op=op.name count count=vm_count %}
Do you want to perform the
<strong>
{{op}}
</strong>
operation on the following instance?
{% plural %}
Do you want to perform the
<strong>
{{op}}
</strong>
operation on the following {{ count }} instances?
{% endblocktrans %}
</p>
<p
class=
"text-info"
>
{{op.description}}
</p>
...
...
circle/dashboard/views.py
View file @
6282576e
...
...
@@ -1020,7 +1020,8 @@ class MassOperationView(OperationView):
ctx
=
super
(
MassOperationView
,
self
)
.
get_context_data
(
**
kwargs
)
instances
=
self
.
request
.
GET
.
getlist
(
"vm"
)
instances
=
Instance
.
objects
.
filter
(
pk__in
=
instances
)
ctx
[
'instances'
]
=
self
.
_check_instances
(
instances
,
self
.
request
.
user
)
ctx
[
'instances'
],
ctx
[
'vm_count'
]
=
self
.
_check_instances
(
instances
,
self
.
request
.
user
)
return
ctx
...
...
@@ -1032,6 +1033,7 @@ class MassOperationView(OperationView):
def
_check_instances
(
self
,
instances
,
user
):
vms
=
[]
ok_vm_count
=
0
for
i
in
instances
:
try
:
self
.
_op_checks
(
i
,
user
)
...
...
@@ -1043,8 +1045,10 @@ class MassOperationView(OperationView):
setattr
(
i
,
"disabled"
,
_
(
"Permission denied"
))
except
Exception
:
raise
else
:
ok_vm_count
+=
1
vms
.
append
(
i
)
return
vms
return
vms
,
ok_vm_count
def
post
(
self
,
request
,
extra
=
None
,
*
args
,
**
kwargs
):
if
extra
is
None
:
...
...
@@ -1109,6 +1113,7 @@ class MassMigrationView(MassOperationView):
return
super
(
MassMigrationView
,
self
)
.
post
(
request
,
extra
,
*
args
,
**
kwargs
)
vm_mass_ops
=
OrderedDict
([
(
'deploy'
,
MassOperationView
.
factory
(
vm_ops
[
'deploy'
])),
(
'wake_up'
,
MassOperationView
.
factory
(
vm_ops
[
'wake_up'
])),
...
...
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