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
601f4803
authored
Aug 14, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue-246' into 'master'
Operation result message doesn't disappear if with_reload
parents
126c44bc
1c151318
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
19 deletions
+11
-19
circle/dashboard/static/dashboard/vm-details.js
+1
-12
circle/dashboard/views.py
+10
-7
No files found.
circle/dashboard/static/dashboard/vm-details.js
View file @
601f4803
...
...
@@ -186,18 +186,7 @@ $(function() {
success
:
function
(
re
,
textStatus
,
xhr
)
{
/* remove the html element */
$
(
'a[data-interface-pk="'
+
data
.
pk
+
'"]'
).
closest
(
"div"
).
fadeOut
();
/* add the removed element to the list */
network_select
=
$
(
'select[name="new_network_vlan"]'
);
name_html
=
(
re
.
removed_network
.
managed
?
""
:
""
)
+
" "
+
re
.
removed_network
.
vlan
;
option_html
=
'<option value="'
+
re
.
removed_network
.
vlan_pk
+
'">'
+
name_html
+
'</option>'
;
// if it's -1 then it's a dummy placeholder so we can use .html
if
(
$
(
"option"
,
network_select
)[
0
].
value
===
"-1"
)
{
network_select
.
html
(
option_html
);
network_select
.
next
(
"div"
).
children
(
"button"
).
prop
(
"disabled"
,
false
);
}
else
{
network_select
.
append
(
option_html
);
}
location
.
reload
();
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
addMessage
(
'Uh oh :('
,
'danger'
)
...
...
circle/dashboard/views.py
View file @
601f4803
...
...
@@ -518,6 +518,7 @@ class OperationView(RedirectToLoginMixin, DetailView):
show_in_toolbar
=
True
effect
=
None
wait_for_result
=
None
with_reload
=
False
@property
def
name
(
self
):
...
...
@@ -660,11 +661,14 @@ class AjaxOperationMixin(object):
resp
=
super
(
AjaxOperationMixin
,
self
)
.
post
(
request
,
extra
,
*
args
,
**
kwargs
)
if
request
.
is_ajax
():
store
=
messages
.
get_messages
(
request
)
store
.
used
=
True
if
not
self
.
with_reload
:
store
=
messages
.
get_messages
(
request
)
store
.
used
=
True
else
:
store
=
[]
return
HttpResponse
(
json
.
dumps
({
'success'
:
True
,
'with_reload'
:
getattr
(
self
,
'with_reload'
,
False
)
,
'with_reload'
:
self
.
with_reload
,
'messages'
:
[
unicode
(
m
)
for
m
in
store
]}),
content_type
=
"application=json"
)
...
...
@@ -706,9 +710,8 @@ class FormOperationMixin(object):
return
HttpResponse
(
json
.
dumps
({
'success'
:
True
,
'with_reload'
:
getattr
(
self
,
'with_reload'
,
False
)}),
content_type
=
"application=json"
)
'with_reload'
:
self
.
with_reload
}),
content_type
=
"application=json"
)
else
:
return
resp
else
:
...
...
@@ -718,7 +721,7 @@ class FormOperationMixin(object):
class
RequestFormOperationMixin
(
FormOperationMixin
):
def
get_form_kwargs
(
self
):
val
=
super
(
FormOperationMixin
,
self
)
.
get_form_kwargs
()
val
=
super
(
Request
FormOperationMixin
,
self
)
.
get_form_kwargs
()
val
.
update
({
'request'
:
self
.
request
})
return
val
...
...
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