Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
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
6329df0b
authored
Apr 17, 2014
by
Oláh István Gergely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: add label coloring to searching in node tags
parent
bc6d45ee
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
9 deletions
+11
-9
circle/dashboard/static/dashboard/dashboard.js
+7
-6
circle/dashboard/views.py
+1
-0
circle/vm/models/node.py
+3
-3
No files found.
circle/dashboard/static/dashboard/dashboard.js
View file @
6329df0b
...
...
@@ -238,6 +238,7 @@ $(function () {
'name'
:
result
[
i
].
name
.
toLowerCase
(),
'icon'
:
result
[
i
].
icon
,
'status'
:
result
[
i
].
status
,
'label'
:
result
[
i
].
label
,
'url'
:
result
[
i
].
url
,
});
}
...
...
@@ -254,7 +255,7 @@ $(function () {
}
}
for
(
var
i
=
0
;
i
<
5
&&
i
<
search_result
.
length
;
i
++
)
html
+=
generateNodeHTML
(
search_result
[
i
].
pk
,
search_result
[
i
].
name
,
html
+=
generateNodeHTML
(
search_result
[
i
].
name
,
search_result
[
i
].
icon
,
search_result
[
i
].
status
,
search_result
[
i
].
url
);
if
(
search_result
.
length
==
0
)
...
...
@@ -264,9 +265,9 @@ $(function () {
html
=
''
;
for
(
var
i
=
0
;
i
<
5
&&
i
<
search_result
.
length
;
i
++
)
html
+=
generateNodeTagHTML
(
search_result
[
i
].
pk
,
search_result
[
i
].
name
,
html
+=
generateNodeTagHTML
(
search_result
[
i
].
name
,
search_result
[
i
].
icon
,
search_result
[
i
].
status
,
search_result
[
i
].
url
);
search_result
[
i
].
label
,
search_result
[
i
].
url
);
if
(
search_result
.
length
==
0
)
html
+=
'<div class="list-group-item">No result</div>'
;
$
(
"#dashboard-node-taglist"
).
html
(
html
);
...
...
@@ -305,7 +306,7 @@ function generateVmHTML(pk, name, host, icon, _status, fav) {
'</a>'
;
}
function
generateNodeHTML
(
pk
,
name
,
icon
,
_status
,
url
)
{
function
generateNodeHTML
(
name
,
icon
,
_status
,
url
)
{
return
'<a href="'
+
url
+
'" class="list-group-item" >'
+
'<span class="index-node-list-name">'
+
'<i class="'
+
icon
+
'" title="'
+
_status
+
'"></i> '
+
name
+
...
...
@@ -314,8 +315,8 @@ function generateNodeHTML(pk, name, icon, _status, url) {
'</a>'
;
}
function
generateNodeTagHTML
(
pk
,
name
,
icon
,
_status
,
url
)
{
return
'<a href="'
+
url
+
'" class="label
label-danger
" >'
+
function
generateNodeTagHTML
(
name
,
icon
,
_status
,
label
,
url
)
{
return
'<a href="'
+
url
+
'" class="label
'
+
label
+
'
" >'
+
'<i class="'
+
icon
+
'" title="'
+
_status
+
'"></i> '
+
name
+
'</a> '
;
}
...
...
circle/dashboard/views.py
View file @
6329df0b
...
...
@@ -933,6 +933,7 @@ class NodeList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView):
'name'
:
i
.
name
,
'icon'
:
i
.
get_status_icon
(),
'url'
:
i
.
get_absolute_url
(),
'label'
:
i
.
get_status_label
(),
'status'
:
i
.
state
.
lower
()}
for
i
in
nodes
]
return
HttpResponse
(
...
...
circle/vm/models/node.py
View file @
6329df0b
...
...
@@ -278,9 +278,9 @@ class Node(OperatedMixin, TimeStampedModel):
def
get_status_label
(
self
):
return
{
'OFFLINE'
:
'label-
warning
'
,
'DISABLED'
:
'label-
warning
'
,
'MISSING'
:
'label-
danger
'
,
'OFFLINE'
:
'label-
danger
'
,
'DISABLED'
:
'label-
danger
'
,
'MISSING'
:
'label-
warning
'
,
'ONLINE'
:
'label-success'
}
.
get
(
self
.
get_state
(),
'label-danger'
)
...
...
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