Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
2604e505
Commit
2604e505
authored
Apr 16, 2011
by
Christodoulos Psaltis
Browse files
Welcome screen appears based on serverlength counter, Refs #279
parent
a28ebd26
Changes
3
Hide whitespace changes
Inline
Side-by-side
ui/static/synnefo.js
View file @
2604e505
var
flavors
=
[],
images
=
[],
servers
=
[],
disks
=
[],
cpus
=
[],
ram
=
[];
var
changes_since
=
0
,
deferred
=
0
,
update_request
=
false
,
load_request
=
false
,
pending_actions
=
[];
var
API_URL
=
"
/api/v1.1
"
;
var
serverlength
=
0
;
function
ISODateString
(
d
){
//return a date in an ISO 8601 format using UTC.
...
...
@@ -71,6 +72,7 @@ function update_confirmations(){
}
function
list_view
()
{
serverlength
=
0
;
// reset server length
changes_since
=
0
;
// to reload full list
pending_actions
=
[];
// clear pending actions
update_confirmations
();
...
...
@@ -101,6 +103,7 @@ function list_view() {
}
function
standard_view
()
{
serverlength
=
0
;
// reset server length
changes_since
=
0
;
// to reload full list
pending_actions
=
[];
// clear pending actions
update_confirmations
();
...
...
ui/templates/list.html
View file @
2604e505
...
...
@@ -171,7 +171,7 @@ $("a.enabled#action-shutdown").live('click', function() {
return
false
;
});
var
serverlength
=
0
;
function
update_machines_view
(
data
){
/*
...
...
@@ -202,10 +202,10 @@ function update_machines_view(data){
try
{
console
.
info
(
server
.
name
+
'
from
'
+
status_desc
+
'
to
'
+
STATUS_MESSAGES
[
server
.
status
]);
}
catch
(
err
)
{}
serverlength
-=
1
;
// when server is in deleted status it must be removed from the list
if
(
server
.
status
==
"
DELETED
"
)
{
vmTable
.
fnDeleteRow
(
current
);
serverlength
-=
1
;
}
else
{
// when server is not be deleted, it should be updated
if
([
'
BUILD
'
,
'
ACTIVE
'
,
'
REBOOT
'
].
indexOf
(
server
.
status
)
>=
0
&&
[
STATUS_MESSAGES
[
'
STOPPED
'
],
STATUS_MESSAGES
[
'
ERROR
'
],
...
...
@@ -286,6 +286,8 @@ function update_machines_view(data){
"
group
"
,
"
<span class=status>
"
+
STATUS_MESSAGES
[
server
.
status
]
+
"
</span>
"
]);
}
else
if
(
server
.
status
==
"
DELETED
"
)
{
serverlength
-=
1
;
}
});
updateActions
();
...
...
ui/templates/standard.html
View file @
2604e505
...
...
@@ -207,14 +207,13 @@ $("div.action_error .details").live('click', function(){
$
(
this
).
parent
().
hide
();
});
var
serverlength
=
0
;
// update the servers list
function
update_machines_view
(
data
){
/*
Go through the servers in the input data. Update existing entries, add
new ones to the list
*/
*/
$
.
each
(
data
.
servers
.
values
,
function
(
i
,
server
){
existing
=
$
(
'
#
'
+
server
.
id
);
...
...
@@ -229,11 +228,11 @@ function update_machines_view(data){
serverlength
+=
1
;
// server already exists in DOM
if
(
existing
.
length
){
serverlength
-=
1
;
$
(
"
div.machine:last-child
"
).
find
(
"
div.separator
"
).
show
();
// if the status is deleted, delete it from the DOM
if
(
server
.
status
==
'
DELETED
'
)
{
existing
.
remove
();
serverlength
-=
1
;
try
{
console
.
info
(
existing
.
find
(
"
a.name span.name
"
).
text
()
+
'
removed
'
);
}
catch
(
err
)
{}
...
...
@@ -317,6 +316,8 @@ function update_machines_view(data){
$
(
'
div.#
'
+
server
.
id
+
'
a.action-shutdown
'
).
hide
();
$
(
'
div.#
'
+
server
.
id
+
'
a.action-destroy
'
).
addClass
(
'
destroy-padding
'
);
}
}
else
if
(
server
.
status
==
'
DELETED
'
)
{
serverlength
-=
1
;
}
});
...
...
@@ -332,7 +333,6 @@ function update_machines_view(data){
$
(
"
#mini.separator
"
).
fadeOut
(
"
slow
"
);
}
// show message in case user has no servers!
if
(
serverlength
==
0
)
{
showWelcome
();
...
...
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