Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
bc6d45ee
authored
Apr 17, 2014
by
Oláh István Gergely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: change searchbox place, fix search
parent
42c6b366
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
37 deletions
+45
-37
circle/dashboard/static/dashboard/dashboard.js
+17
-1
circle/dashboard/templates/dashboard/index-nodes.html
+20
-36
circle/vm/models/node.py
+8
-0
No files found.
circle/dashboard/static/dashboard/dashboard.js
View file @
bc6d45ee
...
...
@@ -260,7 +260,17 @@ $(function () {
if
(
search_result
.
length
==
0
)
html
+=
'<div class="list-group-item">No result</div>'
;
$
(
"#dashboard-node-list"
).
html
(
html
);
html
=
''
;
for
(
var
i
=
0
;
i
<
5
&&
i
<
search_result
.
length
;
i
++
)
html
+=
generateNodeTagHTML
(
search_result
[
i
].
pk
,
search_result
[
i
].
name
,
search_result
[
i
].
icon
,
search_result
[
i
].
status
,
search_result
[
i
].
url
);
if
(
search_result
.
length
==
0
)
html
+=
'<div class="list-group-item">No result</div>'
;
$
(
"#dashboard-node-taglist"
).
html
(
html
);
// if there is only one result and ENTER is pressed redirect
if
(
e
.
keyCode
==
13
&&
search_result
.
length
==
1
)
{
window
.
location
.
href
=
"/dashboard/node/"
+
search_result
[
0
].
pk
+
"/"
;
...
...
@@ -304,6 +314,12 @@ function generateNodeHTML(pk, name, icon, _status, url) {
'</a>'
;
}
function
generateNodeTagHTML
(
pk
,
name
,
icon
,
_status
,
url
)
{
return
'<a href="'
+
url
+
'" class="label label-danger" >'
+
'<i class="'
+
icon
+
'" title="'
+
_status
+
'"></i> '
+
name
+
'</a> '
;
}
/* copare vm-s by fav, pk order */
function
compareVmByFav
(
a
,
b
)
{
if
(
a
.
fav
&&
b
.
fav
)
{
...
...
circle/dashboard/templates/dashboard/index-nodes.html
View file @
bc6d45ee
...
...
@@ -25,56 +25,40 @@
</a>
{% endfor %}
</div>
<div
href=
"#"
class=
"list-group-item list-group-footer"
>
<div
class=
"row"
>
<div
class=
"col-sm-6 col-xs-6 input-group input-group-sm"
>
<input
id=
"dashboard-node-search-input"
type=
"text"
class=
"form-control"
placeholder=
"{% trans "
Search
..."
%}"
/>
<div
class=
"input-group-btn"
>
<button
type=
"submit"
class=
"form-control btn btn-primary"
title=
"search"
><i
class=
"icon-search"
></i></button>
</div>
</div>
<div
class=
"col-sm-6 text-right"
>
{% if more_nodes > 0 %}
<a
class=
"btn btn-primary btn-xs"
href=
"{% url "
dashboard
.
views
.
node-list
"
%}"
>
<i
class=
"icon-chevron-sign-right"
></i>
<strong>
{{ more_nodes }}
</strong>
more
</a>
{% endif %}
<a
class=
"btn btn-success btn-xs node-create"
href=
"{% url "
dashboard
.
views
.
node-create
"
%}"
><i
class=
"icon-plus-sign"
></i>
{% trans "new" %}
</a>
</div>
</div>
</div>
</div>
<div
class=
"panel-body"
id=
"node-graph-view"
style=
"display: none"
>
<p
class=
"pull-right"
>
<input
class=
"knob"
data-fgColor=
"chartreuse"
data-thickness=
".4"
data-width=
"60"
data-height=
"60"
data-readOnly=
"true"
value=
"{% widthratio node_num.running sum_node_num 100 %}"
></p>
<p><span
class=
"big"
><big>
{{ node_num.running }}
</big>
running
</span>
+
<big>
{{ node_num.missing }}
</big>
missing +
<br><big>
{{ node_num.disabled }}
</big>
disabled +
<big>
{{ node_num.offline }}
</big>
offline
</p>
<ul
class=
"list-inline
"
>
{% for i in nodes %}
<a
class=
"label {% if i.state == 'ONLINE' %}label-success
<div
class=
"list-group"
id=
"dashboard-node-taglist
"
>
{% for i in nodes %}
<a
class=
"label {% if i.state == 'ONLINE' %}label-success
{% elif i.state == 'MISSING' %}label-danger
{% elif i.state == 'DISABLED' %}label-warning
{% elif i.state == 'OFFLINE' %}label-warning
{% endif %}"
href=
"{% url "
dashboard
.
views
.
node-detail
"
pk=
i.pk
%}"
><i
class=
"icon-{% if i.enabled == True %}play-sign{% else %}pause{% endif %}"
></i>
{{ i.name}}
</a>
{% endfor %}
</ul
>
{% endfor %}
</div
>
<div
class=
"clearfix"
></div>
<div
class=
"row"
>
<div
class=
"col-sm-6 col-xs-6 input-group input-group-sm"
>
<input
type=
"text"
class=
"form-control"
placeholder=
"{% trans "
Search
..."
%}"
/>
<div
class=
"input-group-btn"
>
<button
type=
"submit"
class=
"form-control btn btn-primary"
title=
"search"
><i
class=
"icon-search"
></i></button>
</div>
</div>
<div
href=
"#"
class=
"list-group-item list-group-footer"
>
<div
class=
"row"
>
<div
class=
"col-sm-6 col-xs-6 input-group input-group-sm"
>
<input
id=
"dashboard-node-search-input"
type=
"text"
class=
"form-control"
placeholder=
"{% trans "
Search
..."
%}"
/>
<div
class=
"input-group-btn"
>
<button
type=
"submit"
class=
"form-control btn btn-primary"
title=
"search"
><i
class=
"icon-search"
></i></button>
</div>
</div>
<div
class=
"col-sm-6 text-right"
>
{% if more_nodes >= 0
%}
{% if more_nodes > 0
%}
<a
class=
"btn btn-primary btn-xs"
href=
"{% url "
dashboard
.
views
.
node-list
"
%}"
>
<i
class=
"icon-chevron-sign-right"
></i>
{% blocktrans with count=more_nodes %}
<strong>
{{count}}
</strong>
more{% endblocktrans %}
<i
class=
"icon-chevron-sign-right"
></i>
<strong>
{{ more_nodes }}
</strong>
more
</a>
{% endif %}
<a
class=
"btn btn-success btn-xs node-create"
href=
"{% url "
dashboard
.
views
.
node-create
"
%}"
><i
class=
"icon-plus-sign"
></i>
{% trans "new" %}
</a>
</div>
</div>
</div>
{% endif %}
<a
class=
"btn btn-success btn-xs node-create"
href=
"{% url "
dashboard
.
views
.
node-create
"
%}"
><i
class=
"icon-plus-sign"
></i>
{% trans "new" %}
</a>
</div>
</div>
</div>
</div>
circle/vm/models/node.py
View file @
bc6d45ee
...
...
@@ -276,6 +276,14 @@ class Node(OperatedMixin, TimeStampedModel):
'ONLINE'
:
'icon-play-sign'
}
.
get
(
self
.
get_state
(),
'icon-question-sign'
)
def
get_status_label
(
self
):
return
{
'OFFLINE'
:
'label-warning'
,
'DISABLED'
:
'label-warning'
,
'MISSING'
:
'label-danger'
,
'ONLINE'
:
'label-success'
}
.
get
(
self
.
get_state
(),
'label-danger'
)
@node_available
def
update_vm_states
(
self
):
"""Update state of Instances running on this Node.
...
...
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