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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
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 () {
...
@@ -238,6 +238,7 @@ $(function () {
'name'
:
result
[
i
].
name
.
toLowerCase
(),
'name'
:
result
[
i
].
name
.
toLowerCase
(),
'icon'
:
result
[
i
].
icon
,
'icon'
:
result
[
i
].
icon
,
'status'
:
result
[
i
].
status
,
'status'
:
result
[
i
].
status
,
'label'
:
result
[
i
].
label
,
'url'
:
result
[
i
].
url
,
'url'
:
result
[
i
].
url
,
});
});
}
}
...
@@ -254,7 +255,7 @@ $(function () {
...
@@ -254,7 +255,7 @@ $(function () {
}
}
}
}
for
(
var
i
=
0
;
i
<
5
&&
i
<
search_result
.
length
;
i
++
)
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
].
icon
,
search_result
[
i
].
status
,
search_result
[
i
].
url
);
search_result
[
i
].
url
);
if
(
search_result
.
length
==
0
)
if
(
search_result
.
length
==
0
)
...
@@ -264,9 +265,9 @@ $(function () {
...
@@ -264,9 +265,9 @@ $(function () {
html
=
''
;
html
=
''
;
for
(
var
i
=
0
;
i
<
5
&&
i
<
search_result
.
length
;
i
++
)
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
].
icon
,
search_result
[
i
].
status
,
search_result
[
i
].
url
);
search_result
[
i
].
label
,
search_result
[
i
].
url
);
if
(
search_result
.
length
==
0
)
if
(
search_result
.
length
==
0
)
html
+=
'<div class="list-group-item">No result</div>'
;
html
+=
'<div class="list-group-item">No result</div>'
;
$
(
"#dashboard-node-taglist"
).
html
(
html
);
$
(
"#dashboard-node-taglist"
).
html
(
html
);
...
@@ -305,7 +306,7 @@ function generateVmHTML(pk, name, host, icon, _status, fav) {
...
@@ -305,7 +306,7 @@ function generateVmHTML(pk, name, host, icon, _status, fav) {
'</a>'
;
'</a>'
;
}
}
function
generateNodeHTML
(
pk
,
name
,
icon
,
_status
,
url
)
{
function
generateNodeHTML
(
name
,
icon
,
_status
,
url
)
{
return
'<a href="'
+
url
+
'" class="list-group-item" >'
+
return
'<a href="'
+
url
+
'" class="list-group-item" >'
+
'<span class="index-node-list-name">'
+
'<span class="index-node-list-name">'
+
'<i class="'
+
icon
+
'" title="'
+
_status
+
'"></i> '
+
name
+
'<i class="'
+
icon
+
'" title="'
+
_status
+
'"></i> '
+
name
+
...
@@ -314,8 +315,8 @@ function generateNodeHTML(pk, name, icon, _status, url) {
...
@@ -314,8 +315,8 @@ function generateNodeHTML(pk, name, icon, _status, url) {
'</a>'
;
'</a>'
;
}
}
function
generateNodeTagHTML
(
pk
,
name
,
icon
,
_status
,
url
)
{
function
generateNodeTagHTML
(
name
,
icon
,
_status
,
label
,
url
)
{
return
'<a href="'
+
url
+
'" class="label
label-danger
" >'
+
return
'<a href="'
+
url
+
'" class="label
'
+
label
+
'
" >'
+
'<i class="'
+
icon
+
'" title="'
+
_status
+
'"></i> '
+
name
+
'<i class="'
+
icon
+
'" title="'
+
_status
+
'"></i> '
+
name
+
'</a> '
;
'</a> '
;
}
}
...
...
circle/dashboard/views.py
View file @
6329df0b
...
@@ -933,6 +933,7 @@ class NodeList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView):
...
@@ -933,6 +933,7 @@ class NodeList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView):
'name'
:
i
.
name
,
'name'
:
i
.
name
,
'icon'
:
i
.
get_status_icon
(),
'icon'
:
i
.
get_status_icon
(),
'url'
:
i
.
get_absolute_url
(),
'url'
:
i
.
get_absolute_url
(),
'label'
:
i
.
get_status_label
(),
'status'
:
i
.
state
.
lower
()}
for
i
in
nodes
]
'status'
:
i
.
state
.
lower
()}
for
i
in
nodes
]
return
HttpResponse
(
return
HttpResponse
(
...
...
circle/vm/models/node.py
View file @
6329df0b
...
@@ -278,9 +278,9 @@ class Node(OperatedMixin, TimeStampedModel):
...
@@ -278,9 +278,9 @@ class Node(OperatedMixin, TimeStampedModel):
def
get_status_label
(
self
):
def
get_status_label
(
self
):
return
{
return
{
'OFFLINE'
:
'label-
warning
'
,
'OFFLINE'
:
'label-
danger
'
,
'DISABLED'
:
'label-
warning
'
,
'DISABLED'
:
'label-
danger
'
,
'MISSING'
:
'label-
danger
'
,
'MISSING'
:
'label-
warning
'
,
'ONLINE'
:
'label-success'
}
.
get
(
self
.
get_state
(),
'ONLINE'
:
'label-success'
}
.
get
(
self
.
get_state
(),
'label-danger'
)
'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