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
71b3d176
authored
Aug 28, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: use inheritance to implement MassMigrationView
parent
8b527a9e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 additions
and
29 deletions
+1
-29
circle/dashboard/views.py
+1
-29
No files found.
circle/dashboard/views.py
View file @
71b3d176
...
@@ -1101,36 +1101,8 @@ class MassOperationView(OperationView):
...
@@ -1101,36 +1101,8 @@ class MassOperationView(OperationView):
tuple
(
list
(
extra_bases
)
+
[
cls
,
vm_op
]),
kwargs
)
tuple
(
list
(
extra_bases
)
+
[
cls
,
vm_op
]),
kwargs
)
class
MassMigrationView
(
MassOperationView
):
class
MassMigrationView
(
MassOperationView
,
VmMigrateView
):
template_name
=
'dashboard/_vm-mass-migrate.html'
template_name
=
'dashboard/_vm-mass-migrate.html'
icon
=
"info"
op
=
"migrate"
icon
=
"truck"
effect
=
"info"
@classmethod
def
check_auth
(
self
,
user
=
None
):
if
user
and
not
user
.
is_superuser
:
raise
PermissionDenied
def
get_context_data
(
self
,
**
kwargs
):
ctx
=
super
(
MassMigrationView
,
self
)
.
get_context_data
(
**
kwargs
)
ctx
[
'nodes'
]
=
[
n
for
n
in
Node
.
objects
.
filter
(
enabled
=
True
)
if
n
.
state
==
"ONLINE"
]
return
ctx
def
post
(
self
,
request
,
extra
=
None
,
*
args
,
**
kwargs
):
if
extra
is
None
:
extra
=
{}
node
=
self
.
request
.
POST
.
get
(
"node"
)
if
node
:
node
=
get_object_or_404
(
Node
,
pk
=
node
)
else
:
node
=
None
extra
[
"to_node"
]
=
node
return
super
(
MassMigrationView
,
self
)
.
post
(
request
,
extra
,
*
args
,
**
kwargs
)
vm_mass_ops
=
OrderedDict
([
vm_mass_ops
=
OrderedDict
([
(
'deploy'
,
MassOperationView
.
factory
(
vm_ops
[
'deploy'
])),
(
'deploy'
,
MassOperationView
.
factory
(
vm_ops
[
'deploy'
])),
...
...
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