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
a16d972b
authored
Jan 23, 2014
by
Oláh István Gergely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: cleanup node-list.js, highlighting disabled nodes
parent
99dc70e8
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
64 deletions
+27
-64
circle/dashboard/static/dashboard/node-list.js
+21
-59
circle/dashboard/templates/dashboard/node-list.html
+1
-1
circle/dashboard/templates/dashboard/node-list/column-details.html
+2
-2
circle/vm/models/node.py
+3
-2
No files found.
circle/dashboard/static/dashboard/node-list.js
View file @
a16d972b
...
...
@@ -59,40 +59,15 @@ $(function() {
return
retval
;
});
/*
$('.popover-link').popover();
$(':not(#anything)').on('click', function (e) {
$('.popover-link').each(function () {
//the 'is' for buttons that trigger popups
//the 'has' for icons and other elements within a button that triggers a popup
if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
$(this).popover('hide');
return;
}
});
});
*/
$
(
':not(#anything)'
).
on
(
'click'
,
function
(
e
)
{
$
(
'.node-list-details'
).
each
(
function
()
{
//the 'is' for buttons that trigger popups
// //the 'has' for icons and other elements within a button that triggers a popup
if
(
!
$
(
this
).
is
(
e
.
target
)
&&
$
(
this
).
has
(
e
.
target
).
length
===
0
&&
$
(
'.popover'
).
has
(
e
.
target
).
length
===
0
)
{
$
(
this
).
popover
(
'hide'
);
return
;
}
});
});
$
(
'#node-list-group-migrate'
).
click
(
function
()
{
console
.
log
(
collectIds
(
selected
));
});
$
(
'.node-list-details'
).
popover
({
'placement'
:
'auto'
,
'html'
:
true
,
'trigger'
:
'click'
$
(
'#table_container'
).
popover
({
selector
:
'.node-list-details'
,
placement
:
'auto'
,
html
:
true
,
trigger
:
'click'
,
});
...
...
@@ -109,6 +84,16 @@ $(':not(#anything)').on('click', function (e) {
}
});
// find disabled nodes, set danger (red) on the rows
function
colortable
()
{
var
tr
=
$
(
'.false'
).
closest
(
"tr"
);
tr
.
addClass
(
'danger'
);
}
$
(
document
).
on
(
'ready reload'
,
function
()
{
colortable
();
});
/* rename */
$
(
"#node-list-rename-button, .node-details-rename-button"
).
click
(
function
()
{
$
(
"#node-list-column-name"
,
$
(
this
).
closest
(
"tr"
)).
hide
();
...
...
@@ -147,26 +132,24 @@ $(':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'
),
contentrefresh
,[
"#table_container"
,
"#rendered_table"
]);
enablenode
(
$
(
this
).
attr
(
'data-node-pk'
),
$
(
this
).
attr
(
'data-status'
),
contentrefresh
,[
"#table_container"
,
"#rendered_table"
],[
colortable
]);
});
// 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"
]);
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
)
{
function
enablenode
(
pk
,
new_status
,
refresh
,
elements
,
callback
)
{
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
);
refresh
(
elements
,
callback
);
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
addMessage
(
"uhoh"
,
"danger"
);
...
...
@@ -176,31 +159,10 @@ $(':not(#anything)').on('click', function (e) {
}
// refresh the given contents, parameter is the array of contents, in pair
function
contentrefresh
(
elements
){
function
contentrefresh
(
elements
,
callbacks
){
for
(
var
i
=
0
;
i
<
elements
.
length
;
i
+=
2
)
{
$
(
elements
[
i
]).
load
(
location
.
href
+
" "
+
elements
[
i
+
1
]);
}
$
(
elements
[
i
]).
load
(
location
.
href
+
" "
+
elements
[
i
+
1
],
callbacks
[
i
/
2
]);
}
// enabling / disabling node
function
enablenode2
(
pk
,
new_status
)
{
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
)
{
$
(
'#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"
);
}
});
return
false
;
}
/* group actions */
...
...
circle/dashboard/templates/dashboard/node-list.html
View file @
a16d972b
...
...
@@ -28,6 +28,7 @@
</p>
</div>
<div
id=
"table_container"
>
<div
id=
"rendered_table"
class=
"panel-body"
>
{% render_table table %}
</div>
...
...
@@ -35,7 +36,6 @@
</div>
</div>
</div>
<style>
.popover
{
max-width
:
600px
;
...
...
circle/dashboard/templates/dashboard/node-list/column-details.html
View file @
a16d972b
<a
class=
"btn btn-info btn-xs node-list-details"
href=
"#"
data-toggle=
"popover"
<a
class=
"btn btn-info btn-xs node-list-details"
rel=
"popover"
href=
"#"
data-toggle=
"popover"
data-content=
'
<h4>Quick details</h4>
<dl class="dl-horizontal">
...
...
@@ -11,4 +11,4 @@
<dt>IPv6 address:</dt><dd> 2001:2001:2001:2001:2001:2001::</dd>
<dt>DNS name:</dt><dd>1825.vm.ik.bme.hu</dd>
</ul>
'
>
Details
</a>
'
>
Details
</a>
circle/vm/models/node.py
View file @
a16d972b
...
...
@@ -60,7 +60,6 @@ class Node(TimeStampedModel):
def
num_cores
(
self
):
"""Number of CPU threads available to the virtual machines.
"""
return
self
.
remote_query
(
vm_tasks
.
get_core_num
)
@property
...
...
@@ -94,11 +93,13 @@ class Node(TimeStampedModel):
def
get_remote_queue_name
(
self
,
queue_id
):
return
self
.
host
.
hostname
+
"."
+
queue_id
def
remote_query
(
self
,
task
,
timeout
=
30
,
raise_
=
False
,
default
=
None
):
def
remote_query
(
self
,
task
,
timeout
=
1
,
raise_
=
False
,
default
=
None
):
"""Query the given task, and get the result.
If the result is not ready in timeout secs, return default value or
raise a TimeoutError."""
if
task
!=
vm_tasks
.
ping
and
not
self
.
online
:
return
default
r
=
task
.
apply_async
(
queue
=
self
.
get_remote_queue_name
(
'vm'
),
expires
=
timeout
+
60
)
try
:
...
...
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