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
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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
9 deletions
+42
-9
circle/dashboard/static/dashboard/node-list.js
+38
-5
circle/dashboard/templates/dashboard/node-detail.html
+4
-4
No files found.
circle/dashboard/static/dashboard/node-list.js
View file @
99dc70e8
...
@@ -145,14 +145,46 @@ $(':not(#anything)').on('click', function (e) {
...
@@ -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
(){
$
(
'#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
// enabling / disabling node
function
enablenode
(
pk
,
new_status
)
{
function
enablenode
2
(
pk
,
new_status
)
{
var
url
=
'/dashboard/node/'
+
pk
+
'/'
;
var
url
=
'/dashboard/node/'
+
pk
+
'/'
;
console
.
log
(
'success'
);
console
.
log
(
'success'
);
$
.
ajax
({
$
.
ajax
({
...
@@ -161,8 +193,9 @@ $(':not(#anything)').on('click', function (e) {
...
@@ -161,8 +193,9 @@ $(':not(#anything)').on('click', function (e) {
data
:
{
'new_status'
:
new_status
},
data
:
{
'new_status'
:
new_status
},
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
success
:
function
(
data
,
textStatus
,
xhr
)
{
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
)
{
error
:
function
(
xhr
,
textStatus
,
error
)
{
addMessage
(
"uhoh"
,
"danger"
);
addMessage
(
"uhoh"
,
"danger"
);
}
}
...
...
circle/dashboard/templates/dashboard/node-detail.html
View file @
99dc70e8
...
@@ -8,8 +8,8 @@
...
@@ -8,8 +8,8 @@
</div>
</div>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-md-4"
id=
"node-info-pane"
>
<div
class=
"col-md-4"
id=
"node-info-pane"
>
<div
class=
"big"
>
<div
id=
"node-info-data"
class=
"big"
>
<span
class=
"label {% if node.state == 'online' %}label-success
<span
id=
"node-status-label"
class=
"label {% if node.state == 'online' %}label-success
{% elif node.state == 'missing' %}label-danger
{% elif node.state == 'missing' %}label-danger
{% elif node.state == 'disabled' %}label-warning
{% elif node.state == 'disabled' %}label-warning
{% elif node.state == 'offline' %}label-warning
{% elif node.state == 'offline' %}label-warning
...
@@ -42,9 +42,9 @@
...
@@ -42,9 +42,9 @@
{% trans "Activity" %}
</a></li>
{% trans "Activity" %}
</a></li>
</ul>
</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 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=
"resources"
>
{% include "dashboard/node-detail-resources.html" %}
</div>
<div
class=
"tab-pane"
id=
"activity"
>
{% include "dashboard/node-detail-activity.html" %}
</div>
<div
class=
"tab-pane"
id=
"activity"
>
{% include "dashboard/node-detail-activity.html" %}
</div>
<div
class=
"tab-pane"
id=
"virtualmachines"
>
{% include "dashboard/node-detail-vm.html" %}
</div>
<div
class=
"tab-pane"
id=
"virtualmachines"
>
{% include "dashboard/node-detail-vm.html" %}
</div>
</div>
</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