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
21af5532
authored
Feb 26, 2014
by
Oláh István Gergely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: fix node-details status changing modal
parent
8b1979aa
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
15 deletions
+75
-15
circle/dashboard/static/dashboard/dashboard.js
+2
-14
circle/dashboard/static/dashboard/node-details.js
+40
-0
circle/dashboard/templates/dashboard/confirm/ajax-node-status.html
+27
-0
circle/dashboard/views.py
+6
-1
No files found.
circle/dashboard/static/dashboard/dashboard.js
View file @
21af5532
...
@@ -135,7 +135,7 @@ $(function () {
...
@@ -135,7 +135,7 @@ $(function () {
return
false
;
return
false
;
});
});
/* for
Node
removes buttons */
/* for
Group
removes buttons */
$
(
'.group-delete'
).
click
(
function
()
{
$
(
'.group-delete'
).
click
(
function
()
{
var
group_pk
=
$
(
this
).
data
(
'group-pk'
);
var
group_pk
=
$
(
this
).
data
(
'group-pk'
);
var
dir
=
window
.
location
.
pathname
.
indexOf
(
'list'
)
==
-
1
;
var
dir
=
window
.
location
.
pathname
.
indexOf
(
'list'
)
==
-
1
;
...
@@ -149,19 +149,6 @@ $(function () {
...
@@ -149,19 +149,6 @@ $(function () {
return
false
;
return
false
;
});
});
/* for Group removes buttons */
$
(
'.group-delete'
).
click
(
function
()
{
var
group_pk
=
$
(
this
).
data
(
'group-pk'
);
var
dir
=
window
.
location
.
pathname
.
indexOf
(
'list'
)
==
-
1
;
addModalConfirmation
(
deleteGroup
,
{
'url'
:
'/dashboard/group/delete/'
+
group_pk
+
'/'
,
'data'
:
[],
'group_pk'
:
group_pk
,
'redirect'
:
dir
});
return
false
;
});
/* search for vms */
/* search for vms */
var
my_vms
=
[]
var
my_vms
=
[]
$
(
"#dashboard-vm-search-input"
).
keyup
(
function
(
e
)
{
$
(
"#dashboard-vm-search-input"
).
keyup
(
function
(
e
)
{
...
@@ -311,6 +298,7 @@ function addModalConfirmation(func, data) {
...
@@ -311,6 +298,7 @@ function addModalConfirmation(func, data) {
url
:
data
[
'url'
],
url
:
data
[
'url'
],
data
:
jQuery
.
param
(
data
[
'data'
]),
data
:
jQuery
.
param
(
data
[
'data'
]),
success
:
function
(
result
)
{
success
:
function
(
result
)
{
console
.
log
(
result
);
$
(
'body'
).
append
(
result
);
$
(
'body'
).
append
(
result
);
$
(
'#confirmation-modal'
).
modal
(
'show'
);
$
(
'#confirmation-modal'
).
modal
(
'show'
);
$
(
'#confirmation-modal'
).
on
(
'hidden.bs.modal'
,
function
()
{
$
(
'#confirmation-modal'
).
on
(
'hidden.bs.modal'
,
function
()
{
...
...
circle/dashboard/static/dashboard/node-details.js
View file @
21af5532
...
@@ -25,3 +25,43 @@
...
@@ -25,3 +25,43 @@
});
});
return
false
;
return
false
;
});
});
/* for Node removes buttons */
$
(
'.node-enable'
).
click
(
function
()
{
var
node_pk
=
$
(
this
).
data
(
'node-pk'
);
var
node_status
=
$
(
this
).
data
(
'status'
);
var
dir
=
window
.
location
.
pathname
.
indexOf
(
'list'
)
==
-
1
;
addModalConfirmation
(
deleteObject
,
{
'url'
:
'/dashboard/node/status/'
+
node_pk
+
'/?status='
+
node_status
,
'data'
:
{
'new_status'
:
node_status
},
'pk'
:
node_pk
,
'status'
:
node_status
,
'type'
:
"node"
,
'redirect'
:
dir
});
return
false
;
});
function
changeNodeStatus
(
data
)
{
$
.
ajax
({
type
:
'POST'
,
url
:
data
[
'url'
],
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
success
:
function
(
re
,
textStatus
,
xhr
)
{
if
(
!
data
[
'redirect'
])
{
selected
=
[];
addMessage
(
re
[
'message'
],
'success'
);
$
(
'a[data-'
+
data
[
'type'
]
+
'-pk="'
+
data
[
'pk'
]
+
'"]'
).
closest
(
'tr'
).
fadeOut
(
function
()
{
$
(
this
).
remove
();
});
}
else
{
window
.
location
.
replace
(
'/dashboard'
);
}
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
addMessage
(
'Uh oh :('
,
'danger'
)
}
});
}
circle/dashboard/templates/dashboard/confirm/ajax-node-status.html
0 → 100644
View file @
21af5532
{% load i18n %}
<div
class=
"modal fade"
id=
"confirmation-modal"
tabindex=
"-1"
role=
"dialog"
>
<div
class=
"modal-dialog"
>
<div
class=
"modal-content"
>
<div
class=
"modal-body"
>
{% if text %}
{{ text }}
{% else %}
{%blocktrans with object=object%}
Are you sure you want to change
<strong>
{{ object }}
</strong>
status?
{%endblocktrans%}
{% endif %}
<div
class=
"pull-right"
>
<form
action=
""
method=
"POST"
>
{% csrf_token %}
<a
class=
"btn btn-default"
>
Back
</a>
<input
type=
"hidden"
name=
"new_status"
value=
"{{ status }}"
/>
<button
class=
"btn btn-warning"
>
Yes, {{ status }}
</button>
</form>
</div>
<div
class=
"clearfix"
></div>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
circle/dashboard/views.py
View file @
21af5532
...
@@ -1241,6 +1241,12 @@ class NodeStatus(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
...
@@ -1241,6 +1241,12 @@ class NodeStatus(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
template_name
=
"dashboard/confirm/node-status.html"
template_name
=
"dashboard/confirm/node-status.html"
model
=
Node
model
=
Node
def
get_template_names
(
self
):
if
self
.
request
.
is_ajax
():
return
[
'dashboard/confirm/ajax-node-status.html'
]
else
:
return
[
'dashboard/confirm/node-status.html'
]
def
get_success_url
(
self
):
def
get_success_url
(
self
):
next
=
self
.
request
.
GET
.
get
(
'next'
)
next
=
self
.
request
.
GET
.
get
(
'next'
)
if
next
:
if
next
:
...
@@ -1256,7 +1262,6 @@ class NodeStatus(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
...
@@ -1256,7 +1262,6 @@ class NodeStatus(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
if
request
.
POST
.
get
(
'new_status'
):
if
request
.
POST
.
get
(
'new_status'
):
print
self
.
request
.
GET
.
get
(
'next'
)
return
self
.
__set_status
(
request
)
return
self
.
__set_status
(
request
)
def
__set_status
(
self
,
request
):
def
__set_status
(
self
,
request
):
...
...
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