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
42c6b366
authored
Apr 17, 2014
by
Oláh István Gergely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: add generated url to index nodes
parent
7f20e972
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
20 deletions
+23
-20
circle/dashboard/static/dashboard/dashboard.js
+11
-9
circle/dashboard/views.py
+4
-3
circle/vm/models/node.py
+8
-8
No files found.
circle/dashboard/static/dashboard/dashboard.js
View file @
42c6b366
...
...
@@ -238,7 +238,8 @@ $(function () {
'name'
:
result
[
i
].
name
.
toLowerCase
(),
'icon'
:
result
[
i
].
icon
,
'status'
:
result
[
i
].
status
,
});
'url'
:
result
[
i
].
url
,
});
}
});
$
.
ajaxSetup
(
{
"async"
:
true
}
);
...
...
@@ -254,7 +255,8 @@ $(function () {
}
for
(
var
i
=
0
;
i
<
5
&&
i
<
search_result
.
length
;
i
++
)
html
+=
generateNodeHTML
(
search_result
[
i
].
pk
,
search_result
[
i
].
name
,
search_result
[
i
].
icon
,
search_result
[
i
].
status
);
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-list"
).
html
(
html
);
...
...
@@ -293,13 +295,13 @@ function generateVmHTML(pk, name, host, icon, _status, fav) {
'</a>'
;
}
function
generateNodeHTML
(
pk
,
name
,
icon
,
_status
)
{
return
'<a href="
/dashboard/node/'
+
pk
+
'/" class="list-group-item"
>'
+
'<span class="index-node-list-name">'
+
'<i class="'
+
icon
+
'" title="'
+
_status
+
'"></i> '
+
name
+
'</span>'
+
'<div style="clear: both;"></div>'
+
'</a>'
;
function
generateNodeHTML
(
pk
,
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
+
'</span>'
+
'<div style="clear: both;"></div>'
+
'</a>'
;
}
/* copare vm-s by fav, pk order */
...
...
circle/dashboard/views.py
View file @
42c6b366
...
...
@@ -931,11 +931,12 @@ class NodeList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView):
nodes
=
[{
'pk'
:
i
.
pk
,
'name'
:
i
.
name
,
'icon'
:
''
,
'status'
:
''
}
for
i
in
nodes
]
'icon'
:
i
.
get_status_icon
(),
'url'
:
i
.
get_absolute_url
(),
'status'
:
i
.
state
.
lower
()}
for
i
in
nodes
]
return
HttpResponse
(
json
.
dumps
(
list
(
nodes
)),
# instances is ValuesQuerySet
json
.
dumps
(
list
(
nodes
)),
content_type
=
"application/json"
,
)
else
:
...
...
circle/vm/models/node.py
View file @
42c6b366
...
...
@@ -268,6 +268,14 @@ class Node(OperatedMixin, TimeStampedModel):
def
byte_ram_usage
(
self
):
return
self
.
ram_usage
*
self
.
ram_size
def
get_status_icon
(
self
):
return
{
'OFFLINE'
:
'icon-minus-sign'
,
'DISABLED'
:
'icon-moon'
,
'MISSING'
:
'icon-warning-sign'
,
'ONLINE'
:
'icon-play-sign'
}
.
get
(
self
.
get_state
(),
'icon-question-sign'
)
@node_available
def
update_vm_states
(
self
):
"""Update state of Instances running on this Node.
...
...
@@ -317,14 +325,6 @@ class Node(OperatedMixin, TimeStampedModel):
cls
.
objects
.
filter
(
enabled
=
enabled
)
.
select_related
(
'host'
)
if
i
.
online
==
online
])
def
get_status_icon
(
self
):
return
{
'OFFLINE'
:
'icon-minus-sign'
,
'DISABLED'
:
'icon-moon'
,
'MISSING'
:
'icon-warning-sign'
,
'ONLINE'
:
'icon-play-sign'
}
.
get
(
self
.
get_state
(),
'icon-question-sign'
)
@permalink
def
get_absolute_url
(
self
):
return
(
'dashboard.views.node-detail'
,
None
,
{
'pk'
:
self
.
id
})
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