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
99dc70e8
authored
Jan 16, 2014
by
Oláh István Gergely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: fix node enabling in node-details
parent
6ff1e05a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
7 deletions
+40
-7
circle/dashboard/static/dashboard/node-list.js
+37
-4
circle/dashboard/templates/dashboard/node-detail.html
+3
-3
No files found.
circle/dashboard/static/dashboard/node-list.js
View file @
99dc70e8
...
...
@@ -145,14 +145,46 @@ $(':not(#anything)').on('click', function (e) {
});
// on node list, change node status with calling enable node, refresh table
$
(
'#table_container'
).
on
(
'click'
,
'#node-list-enable-button'
,
function
(){
enablenode
(
$
(
this
).
attr
(
'data-node-pk'
),
$
(
this
).
attr
(
'data-status'
));
enablenode
(
$
(
this
).
attr
(
'data-node-pk'
),
$
(
this
).
attr
(
'data-status'
),
contentrefresh
,[
"#table_container"
,
"#rendered_table"
]);
});
// on node details, change node status, with calling enable node, refresh status span, resources div
$
(
'#node-info-pane'
).
on
(
'click'
,
'#node-list-enable-button'
,
function
(){
enablenode
(
$
(
this
).
attr
(
'data-node-pk'
),
$
(
this
).
attr
(
'data-status'
),
contentrefresh
,[
"#node-info-pane"
,
"#node-info-data"
,
"#resources"
,
"#vm-details-resources-form"
]);
});
// enabling / disabling node
function
enablenode
(
pk
,
new_status
,
refresh
,
elements
)
{
var
url
=
'/dashboard/node/'
+
pk
+
'/'
;
console
.
log
(
'success'
);
$
.
ajax
({
method
:
'POST'
,
url
:
url
,
data
:
{
'new_status'
:
new_status
},
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
success
:
function
(
data
,
textStatus
,
xhr
)
{
console
.
log
(
"x++"
);
refresh
(
elements
);
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
addMessage
(
"uhoh"
,
"danger"
);
}
});
return
false
;
}
// refresh the given contents, parameter is the array of contents, in pair
function
contentrefresh
(
elements
){
for
(
var
i
=
0
;
i
<
elements
.
length
;
i
+=
2
)
{
$
(
elements
[
i
]).
load
(
location
.
href
+
" "
+
elements
[
i
+
1
]);
}
}
// enabling / disabling node
function
enablenode
(
pk
,
new_status
)
{
function
enablenode
2
(
pk
,
new_status
)
{
var
url
=
'/dashboard/node/'
+
pk
+
'/'
;
console
.
log
(
'success'
);
$
.
ajax
({
...
...
@@ -161,7 +193,8 @@ $(':not(#anything)').on('click', function (e) {
data
:
{
'new_status'
:
new_status
},
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
success
:
function
(
data
,
textStatus
,
xhr
)
{
$
(
'#table_container'
).
load
(
location
.
href
+
" "
+
'#rendered_table'
);
$
(
'#node-info-pane'
).
load
(
location
.
href
+
" "
+
'#node-info-data'
);
$
(
'#resources'
).
load
(
location
.
href
+
" "
+
'#vm-details-resources-form'
);
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
addMessage
(
"uhoh"
,
"danger"
);
...
...
circle/dashboard/templates/dashboard/node-detail.html
View file @
99dc70e8
...
...
@@ -8,8 +8,8 @@
</div>
<div
class=
"row"
>
<div
class=
"col-md-4"
id=
"node-info-pane"
>
<div
class=
"big"
>
<span
class=
"label {% if node.state == 'online' %}label-success
<div
id=
"node-info-data"
class=
"big"
>
<span
id=
"node-status-label"
class=
"label {% if node.state == 'online' %}label-success
{% elif node.state == 'missing' %}label-danger
{% elif node.state == 'disabled' %}label-warning
{% elif node.state == 'offline' %}label-warning
...
...
@@ -42,7 +42,7 @@
{% trans "Activity" %}
</a></li>
</ul>
<div
class=
"tab-content panel-body"
>
<div
id=
"panel-body"
class=
"tab-content panel-body"
>
<div
class=
"tab-pane active"
id=
"home"
>
{% include "dashboard/node-detail-home.html" %}
</div>
<div
class=
"tab-pane"
id=
"resources"
>
{% include "dashboard/node-detail-resources.html" %}
</div>
<div
class=
"tab-pane"
id=
"activity"
>
{% include "dashboard/node-detail-activity.html" %}
</div>
...
...
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