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
bf0575e5
authored
Oct 02, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: remove copypasted code
parent
00df56d1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
33 deletions
+8
-33
circle/dashboard/views/vm.py
+8
-33
No files found.
circle/dashboard/views/vm.py
View file @
bf0575e5
...
...
@@ -369,37 +369,8 @@ class VmAddInterfaceView(FormOperationMixin, VmOperationView):
return
val
class
VmDiskResizeView
(
FormOperationMixin
,
VmOperationView
):
op
=
'resize_disk'
form_class
=
VmDiskResizeForm
show_in_toolbar
=
False
icon
=
'arrows-alt'
effect
=
"warning"
def
get_form_kwargs
(
self
):
choices
=
self
.
get_op
()
.
instance
.
disks
disk_pk
=
self
.
request
.
GET
.
get
(
'disk'
)
if
disk_pk
:
try
:
default
=
choices
.
get
(
pk
=
disk_pk
)
except
(
ValueError
,
Disk
.
DoesNotExist
):
raise
Http404
()
else
:
default
=
None
val
=
super
(
VmDiskResizeView
,
self
)
.
get_form_kwargs
()
val
.
update
({
'choices'
:
choices
,
'default'
:
default
})
return
val
class
VmDiskRemoveView
(
FormOperationMixin
,
VmOperationView
):
op
=
'remove_disk'
form_class
=
VmDiskRemoveForm
class
VmDiskModifyView
(
FormOperationMixin
,
VmOperationView
):
show_in_toolbar
=
False
icon
=
"times"
effect
=
"danger"
def
get_form_kwargs
(
self
):
choices
=
self
.
get_op
()
.
instance
.
disks
...
...
@@ -412,7 +383,7 @@ class VmDiskRemoveView(FormOperationMixin, VmOperationView):
else
:
default
=
None
val
=
super
(
VmDisk
Remove
View
,
self
)
.
get_form_kwargs
()
val
=
super
(
VmDisk
Modify
View
,
self
)
.
get_form_kwargs
()
val
.
update
({
'choices'
:
choices
,
'default'
:
default
})
return
val
...
...
@@ -663,8 +634,12 @@ vm_ops = OrderedDict([
op
=
'destroy'
,
icon
=
'times'
,
effect
=
'danger'
)),
(
'create_disk'
,
VmCreateDiskView
),
(
'download_disk'
,
VmDownloadDiskView
),
(
'resize_disk'
,
VmDiskResizeView
),
(
'remove_disk'
,
VmDiskRemoveView
),
(
'resize_disk'
,
VmDiskModifyView
.
factory
(
op
=
'resize_disk'
,
form_class
=
VmDiskResizeForm
,
icon
=
'arrows-alt'
,
effect
=
"warning"
)),
(
'remove_disk'
,
VmDiskModifyView
.
factory
(
op
=
'remove_disk'
,
form_class
=
VmDiskRemoveForm
,
icon
=
'times'
,
effect
=
"danger"
)),
(
'add_interface'
,
VmAddInterfaceView
),
(
'renew'
,
VmRenewView
),
(
'resources_change'
,
VmResourcesChangeView
),
...
...
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