Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c0b4ef92
authored
Oct 18, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard remove PortDelete
parent
d3b23cb1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 additions
and
49 deletions
+1
-49
circle/dashboard/urls.py
+1
-3
circle/dashboard/views/vm.py
+0
-46
No files found.
circle/dashboard/urls.py
View file @
c0b4ef92
...
...
@@ -26,7 +26,7 @@ from .views import (
InstanceActivityDetail
,
LeaseCreate
,
LeaseDelete
,
LeaseDetail
,
MyPreferencesView
,
NodeAddTraitView
,
NodeCreate
,
NodeDelete
,
NodeDetailView
,
NodeList
,
NodeStatus
,
NotificationView
,
PortDelete
,
TemplateAclUpdateView
,
TemplateCreate
,
NotificationView
,
TemplateAclUpdateView
,
TemplateCreate
,
TemplateDelete
,
TemplateDetail
,
TemplateList
,
TransferOwnershipConfirmView
,
TransferOwnershipView
,
vm_activity
,
VmCreate
,
VmDetailView
,
VmDetailVncTokenView
,
VmList
,
...
...
@@ -78,8 +78,6 @@ urlpatterns = patterns(
name
=
"dashboard.views.template-list"
),
url
(
r"^template/delete/(?P<pk>\d+)/$"
,
TemplateDelete
.
as_view
(),
name
=
"dashboard.views.template-delete"
),
url
(
r'^vm/(?P<pk>\d+)/remove_port/(?P<rule>\d+)/$'
,
PortDelete
.
as_view
(),
name
=
'dashboard.views.remove-port'
),
url
(
r'^vm/(?P<pk>\d+)/$'
,
VmDetailView
.
as_view
(),
name
=
'dashboard.views.detail'
),
url
(
r'^vm/(?P<pk>\d+)/vnctoken/$'
,
VmDetailVncTokenView
.
as_view
(),
...
...
circle/dashboard/views/vm.py
View file @
c0b4ef92
...
...
@@ -1166,52 +1166,6 @@ def get_disk_download_status(request, pk):
)
class
PortDelete
(
LoginRequiredMixin
,
DeleteView
):
model
=
Rule
pk_url_kwarg
=
'rule'
def
get_template_names
(
self
):
if
self
.
request
.
is_ajax
():
return
[
'dashboard/confirm/ajax-delete.html'
]
else
:
return
[
'dashboard/confirm/base-delete.html'
]
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
PortDelete
,
self
)
.
get_context_data
(
**
kwargs
)
rule
=
kwargs
.
get
(
'object'
)
instance
=
rule
.
host
.
interface_set
.
get
()
.
instance
context
[
'title'
]
=
_
(
"Port delete confirmation"
)
context
[
'text'
]
=
_
(
"Are you sure you want to close
%(port)
d/"
"
%(proto)
s on
%(vm)
s?"
%
{
'port'
:
rule
.
dport
,
'proto'
:
rule
.
proto
,
'vm'
:
instance
})
return
context
def
delete
(
self
,
request
,
*
args
,
**
kwargs
):
rule
=
Rule
.
objects
.
get
(
pk
=
kwargs
.
get
(
"rule"
))
instance
=
rule
.
host
.
interface_set
.
get
()
.
instance
if
not
instance
.
has_level
(
request
.
user
,
'owner'
):
raise
PermissionDenied
()
super
(
PortDelete
,
self
)
.
delete
(
request
,
*
args
,
**
kwargs
)
success_url
=
self
.
get_success_url
()
success_message
=
_
(
"Port successfully removed."
)
if
request
.
is_ajax
():
return
HttpResponse
(
json
.
dumps
({
'message'
:
success_message
}),
content_type
=
"application/json"
,
)
else
:
messages
.
success
(
request
,
success_message
)
return
HttpResponseRedirect
(
"
%
s#network"
%
success_url
)
def
get_success_url
(
self
):
return
reverse_lazy
(
'dashboard.views.detail'
,
kwargs
=
{
'pk'
:
self
.
kwargs
.
get
(
"pk"
)})
class
ClientCheck
(
LoginRequiredMixin
,
TemplateView
):
def
get_template_names
(
self
):
...
...
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