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
Commit
6cb335d7
authored
Sep 01, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix js code style
parent
411a478b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
131 additions
and
133 deletions
+131
-133
circle/dashboard/static/dashboard/dashboard.js
+0
-0
circle/dashboard/static/dashboard/disk-list.js
+4
-4
circle/dashboard/static/dashboard/group-details.js
+4
-4
circle/dashboard/static/dashboard/group-list.js
+4
-4
circle/dashboard/static/dashboard/node-details.js
+10
-10
circle/dashboard/static/dashboard/node-list.js
+10
-12
circle/dashboard/static/dashboard/profile.js
+2
-2
circle/dashboard/static/dashboard/store.js
+3
-3
circle/dashboard/static/dashboard/template-list.js
+14
-14
circle/dashboard/static/dashboard/vm-common.js
+1
-1
circle/dashboard/static/dashboard/vm-console.js
+3
-3
circle/dashboard/static/dashboard/vm-create.js
+20
-20
circle/dashboard/static/dashboard/vm-details.js
+41
-41
circle/dashboard/static/dashboard/vm-list.js
+8
-8
circle/dashboard/static/dashboard/vm-tour.js
+7
-7
No files found.
circle/dashboard/static/dashboard/dashboard.js
View file @
6cb335d7
This diff is collapsed.
Click to expand it.
circle/dashboard/static/dashboard/disk-list.js
View file @
6cb335d7
...
@@ -8,16 +8,16 @@ $(function() {
...
@@ -8,16 +8,16 @@ $(function() {
function
refreshDisk
(
disk
,
element
)
{
function
refreshDisk
(
disk
,
element
)
{
$
.
get
(
"/dashboard/disk/"
+
disk
+
"/status/"
,
function
(
result
)
{
$
.
get
(
"/dashboard/disk/"
+
disk
+
"/status/"
,
function
(
result
)
{
if
(
result
.
percentage
==
null
||
result
.
failed
==
"True"
)
{
if
(
result
.
percentage
==
=
null
||
result
.
failed
==
"True"
)
{
location
.
reload
();
location
.
reload
();
}
else
{
}
else
{
var
diff
=
result
.
percentage
-
parseInt
(
element
.
html
());
var
diff
=
result
.
percentage
-
parseInt
(
element
.
html
());
var
refresh
=
5
-
diff
;
var
refresh
=
5
-
diff
;
refresh
=
refresh
<
1
?
1
:
(
result
.
percentage
==
0
?
1
:
refresh
);
refresh
=
refresh
<
1
?
1
:
(
result
.
percentage
==
=
0
?
1
:
refresh
);
if
(
isNaN
(
refresh
))
refresh
=
2
;
// this should not happen
if
(
isNaN
(
refresh
))
refresh
=
2
;
// this should not happen
element
.
html
(
result
.
percentage
);
element
.
html
(
result
.
percentage
);
setTimeout
(
function
()
{
refreshDisk
(
disk
,
element
)},
refresh
*
1000
);
setTimeout
(
function
()
{
refreshDisk
(
disk
,
element
)
;
},
refresh
*
1000
);
}
}
});
});
}
}
circle/dashboard/static/dashboard/group-details.js
View file @
6cb335d7
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
data
:
{
'new_name'
:
name
},
data
:
{
'new_name'
:
name
},
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
success
:
function
(
data
,
textStatus
,
xhr
)
{
success
:
function
(
data
,
textStatus
,
xhr
)
{
$
(
"#group-details-h1-name"
).
html
(
data
[
'new_name'
]
).
show
();
$
(
"#group-details-h1-name"
).
html
(
data
.
new_name
).
show
();
$
(
'#group-details-rename'
).
hide
();
$
(
'#group-details-rename'
).
hide
();
// addMessage(data['message'], "success");
// addMessage(data['message'], "success");
},
},
...
@@ -51,14 +51,14 @@
...
@@ -51,14 +51,14 @@
function
removeMember
(
data
)
{
function
removeMember
(
data
)
{
$
.
ajax
({
$
.
ajax
({
type
:
'POST'
,
type
:
'POST'
,
url
:
data
[
'url'
]
,
url
:
data
.
url
,
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
success
:
function
(
re
,
textStatus
,
xhr
)
{
success
:
function
(
re
,
textStatus
,
xhr
)
{
data
[
'tr'
]
.
fadeOut
(
function
()
{
data
.
tr
.
fadeOut
(
function
()
{
$
(
this
).
remove
();});
$
(
this
).
remove
();});
},
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
error
:
function
(
xhr
,
textStatus
,
error
)
{
addMessage
(
'Uh oh :('
,
'danger'
)
addMessage
(
'Uh oh :('
,
'danger'
)
;
}
}
});
});
}
}
...
...
circle/dashboard/static/dashboard/group-list.js
View file @
6cb335d7
...
@@ -7,7 +7,7 @@ $(function() {
...
@@ -7,7 +7,7 @@ $(function() {
/* rename ajax */
/* rename ajax */
$
(
'.group-list-rename-submit'
).
click
(
function
()
{
$
(
'.group-list-rename-submit'
).
click
(
function
()
{
var
row
=
$
(
this
).
closest
(
"tr"
)
var
row
=
$
(
this
).
closest
(
"tr"
)
;
var
name
=
$
(
'#group-list-rename-name'
,
row
).
val
();
var
name
=
$
(
'#group-list-rename-name'
,
row
).
val
();
var
url
=
'/dashboard/group/'
+
row
.
children
(
"td:first-child"
).
text
().
replace
(
" "
,
""
)
+
'/'
;
var
url
=
'/dashboard/group/'
+
row
.
children
(
"td:first-child"
).
text
().
replace
(
" "
,
""
)
+
'/'
;
$
.
ajax
({
$
.
ajax
({
...
@@ -16,12 +16,12 @@ $(function() {
...
@@ -16,12 +16,12 @@ $(function() {
data
:
{
'new_name'
:
name
},
data
:
{
'new_name'
:
name
},
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
success
:
function
(
data
,
textStatus
,
xhr
)
{
success
:
function
(
data
,
textStatus
,
xhr
)
{
$
(
"#group-list-column-name"
,
row
).
html
(
$
(
"#group-list-column-name"
,
row
).
html
(
$
(
"<a/>"
,
{
$
(
"<a/>"
,
{
'class'
:
"real-link"
,
'class'
:
"real-link"
,
href
:
"/dashboard/group/"
+
data
[
'group_pk'
]
+
"/"
,
href
:
"/dashboard/group/"
+
data
.
group_pk
+
"/"
,
text
:
data
[
'new_name'
]
text
:
data
.
new_name
})
})
).
show
();
).
show
();
$
(
'#group-list-rename'
,
row
).
hide
();
$
(
'#group-list-rename'
,
row
).
hide
();
...
...
circle/dashboard/static/dashboard/node-details.js
View file @
6cb335d7
...
@@ -15,9 +15,9 @@ $(function() {
...
@@ -15,9 +15,9 @@ $(function() {
data
:
{
'new_name'
:
name
},
data
:
{
'new_name'
:
name
},
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
success
:
function
(
data
,
textStatus
,
xhr
)
{
success
:
function
(
data
,
textStatus
,
xhr
)
{
$
(
"#node-details-h1-name"
).
html
(
data
[
'new_name'
]
).
show
();
$
(
"#node-details-h1-name"
).
html
(
data
.
new_name
).
show
();
$
(
'#node-details-rename'
).
hide
();
$
(
'#node-details-rename'
).
hide
();
// addMessage(data
['message']
, "success");
// addMessage(data
.message
, "success");
},
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
error
:
function
(
xhr
,
textStatus
,
error
)
{
addMessage
(
"Error during renaming!"
,
"danger"
);
addMessage
(
"Error during renaming!"
,
"danger"
);
...
@@ -34,7 +34,7 @@ $(function() {
...
@@ -34,7 +34,7 @@ $(function() {
$
(
'.node-enable'
).
click
(
function
()
{
$
(
'.node-enable'
).
click
(
function
()
{
var
node_pk
=
$
(
this
).
data
(
'node-pk'
);
var
node_pk
=
$
(
this
).
data
(
'node-pk'
);
var
dir
=
window
.
location
.
pathname
.
indexOf
(
'list'
)
==
-
1
;
var
dir
=
window
.
location
.
pathname
.
indexOf
(
'list'
)
==
-
1
;
addModalConfirmation
(
changeNodeStatus
,
addModalConfirmation
(
changeNodeStatus
,
{
'url'
:
'/dashboard/node/status/'
+
node_pk
+
'/'
,
{
'url'
:
'/dashboard/node/status/'
+
node_pk
+
'/'
,
'data'
:
[],
'data'
:
[],
'pk'
:
node_pk
,
'pk'
:
node_pk
,
...
@@ -51,17 +51,17 @@ $(function() {
...
@@ -51,17 +51,17 @@ $(function() {
$
.
ajax
({
$
.
ajax
({
type
:
'POST'
,
type
:
'POST'
,
url
:
location
.
href
,
url
:
location
.
href
,
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
data
:
{
'to_remove'
:
to_remove
},
data
:
{
'to_remove'
:
to_remove
},
success
:
function
(
re
)
{
success
:
function
(
re
)
{
if
(
re
[
'message'
]
.
toLowerCase
()
==
"success"
)
{
if
(
re
.
message
.
toLowerCase
()
==
"success"
)
{
$
(
clicked
).
closest
(
".label"
).
fadeOut
(
500
,
function
()
{
$
(
clicked
).
closest
(
".label"
).
fadeOut
(
500
,
function
()
{
$
(
this
).
remove
();
$
(
this
).
remove
();
});
});
}
}
},
},
error
:
function
()
{
error
:
function
()
{
addMessage
(
re
[
'message'
]
,
'danger'
);
addMessage
(
re
.
message
,
'danger'
);
}
}
});
});
...
@@ -73,18 +73,18 @@ $(function() {
...
@@ -73,18 +73,18 @@ $(function() {
function
changeNodeStatus
(
data
)
{
function
changeNodeStatus
(
data
)
{
$
.
ajax
({
$
.
ajax
({
type
:
'POST'
,
type
:
'POST'
,
url
:
data
[
'url'
]
,
url
:
data
.
url
,
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
success
:
function
(
re
,
textStatus
,
xhr
)
{
success
:
function
(
re
,
textStatus
,
xhr
)
{
if
(
!
data
[
'redirect'
]
)
{
if
(
!
data
.
redirect
)
{
selected
=
[];
selected
=
[];
addMessage
(
re
[
'message'
]
,
'success'
);
addMessage
(
re
.
message
,
'success'
);
}
else
{
}
else
{
window
.
location
.
replace
(
'/dashboard'
);
window
.
location
.
replace
(
'/dashboard'
);
}
}
},
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
error
:
function
(
xhr
,
textStatus
,
error
)
{
addMessage
(
'Uh oh :('
,
'danger'
)
addMessage
(
'Uh oh :('
,
'danger'
)
;
}
}
});
});
}
}
circle/dashboard/static/dashboard/node-list.js
View file @
6cb335d7
...
@@ -4,12 +4,10 @@ $(function() {
...
@@ -4,12 +4,10 @@ $(function() {
});
});
// find disabled nodes, set danger (red) on the rows
// find disabled nodes, set danger (red) on the rows
function
colortable
()
function
colortable
()
{
{
var
tr
=
$
(
'.false'
).
closest
(
"tr"
);
$
(
'.false'
).
closest
(
"tr"
).
addClass
(
'danger'
);
tr
.
addClass
(
'danger'
);
$
(
'.true'
).
closest
(
"tr"
).
removeClass
(
'danger'
);
var
tr
=
$
(
'.true'
).
closest
(
"tr"
);
tr
.
removeClass
(
'danger'
);
}
}
/* rename */
/* rename */
...
@@ -20,7 +18,7 @@ $(function() {
...
@@ -20,7 +18,7 @@ $(function() {
/* rename ajax */
/* rename ajax */
$
(
'.node-list-rename-submit'
).
click
(
function
()
{
$
(
'.node-list-rename-submit'
).
click
(
function
()
{
var
row
=
$
(
this
).
closest
(
"tr"
)
var
row
=
$
(
this
).
closest
(
"tr"
)
;
var
name
=
$
(
'#node-list-rename-name'
,
row
).
val
();
var
name
=
$
(
'#node-list-rename-name'
,
row
).
val
();
var
url
=
'/dashboard/node/'
+
row
.
children
(
"td:first-child"
).
text
().
replace
(
" "
,
""
)
+
'/'
;
var
url
=
'/dashboard/node/'
+
row
.
children
(
"td:first-child"
).
text
().
replace
(
" "
,
""
)
+
'/'
;
$
.
ajax
({
$
.
ajax
({
...
@@ -29,12 +27,12 @@ $(function() {
...
@@ -29,12 +27,12 @@ $(function() {
data
:
{
'new_name'
:
name
},
data
:
{
'new_name'
:
name
},
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
success
:
function
(
data
,
textStatus
,
xhr
)
{
success
:
function
(
data
,
textStatus
,
xhr
)
{
$
(
"#node-list-column-name"
,
row
).
html
(
$
(
"#node-list-column-name"
,
row
).
html
(
$
(
"<a/>"
,
{
$
(
"<a/>"
,
{
'class'
:
"real-link"
,
'class'
:
"real-link"
,
href
:
"/dashboard/node/"
+
data
[
'node_pk'
]
+
"/"
,
href
:
"/dashboard/node/"
+
data
.
node_pk
+
"/"
,
text
:
data
[
'new_name'
]
text
:
data
.
new_name
})
})
).
show
();
).
show
();
$
(
'#node-list-rename'
,
row
).
hide
();
$
(
'#node-list-rename'
,
row
).
hide
();
...
@@ -50,7 +48,7 @@ $(function() {
...
@@ -50,7 +48,7 @@ $(function() {
function
statuschangeSuccess
(
tr
){
function
statuschangeSuccess
(
tr
){
var
tspan
=
tr
.
children
(
'.enabled'
).
children
();
var
tspan
=
tr
.
children
(
'.enabled'
).
children
();
var
buttons
=
tr
.
children
(
'.actions'
).
children
(
'.btn-group'
).
children
(
'.dropdown-menu'
).
children
(
'li'
).
children
(
'.node-enable'
);
var
buttons
=
tr
.
children
(
'.actions'
).
children
(
'.btn-group'
).
children
(
'.dropdown-menu'
).
children
(
'li'
).
children
(
'.node-enable'
);
buttons
.
each
(
function
(
index
){
buttons
.
each
(
function
(
index
){
if
(
$
(
this
).
css
(
"display"
)
==
"block"
){
if
(
$
(
this
).
css
(
"display"
)
==
"block"
){
$
(
this
).
css
(
"display"
,
"none"
);
$
(
this
).
css
(
"display"
,
"none"
);
...
@@ -58,12 +56,12 @@ $(function() {
...
@@ -58,12 +56,12 @@ $(function() {
else
{
else
{
$
(
this
).
css
(
"display"
,
"block"
);
$
(
this
).
css
(
"display"
,
"block"
);
}
}
});
});
if
(
tspan
.
hasClass
(
"false"
)){
if
(
tspan
.
hasClass
(
"false"
)){
tspan
.
removeClass
(
"false"
);
tspan
.
removeClass
(
"false"
);
tspan
.
addClass
(
"true"
);
tspan
.
addClass
(
"true"
);
tspan
.
text
(
"✔"
);
tspan
.
text
(
"✔"
);
}
}
else
{
else
{
tspan
.
removeClass
(
"true"
);
tspan
.
removeClass
(
"true"
);
tspan
.
addClass
(
"false"
);
tspan
.
addClass
(
"false"
);
...
...
circle/dashboard/static/dashboard/profile.js
View file @
6cb335d7
...
@@ -7,10 +7,10 @@ $(function() {
...
@@ -7,10 +7,10 @@ $(function() {
$
.
ajax
({
$
.
ajax
({
type
:
'POST'
,
type
:
'POST'
,
url
:
"/dashboard/profile/"
+
user
+
"/use_gravatar/"
,
url
:
"/dashboard/profile/"
+
user
+
"/use_gravatar/"
,
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
success
:
function
(
re
)
{
success
:
function
(
re
)
{
if
(
re
.
new_avatar_url
)
{
if
(
re
.
new_avatar_url
)
{
$
(
"#dashboard-profile-avatar"
).
prop
(
"src"
,
re
.
new_avatar_url
);
$
(
"#dashboard-profile-avatar"
).
prop
(
"src"
,
re
.
new_avatar_url
);
}
}
},
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
error
:
function
(
xhr
,
textStatus
,
error
)
{
...
...
circle/dashboard/static/dashboard/store.js
View file @
6cb335d7
...
@@ -25,18 +25,18 @@ $(function() {
...
@@ -25,18 +25,18 @@ $(function() {
$
(
'#store-upload-form button[type="submit"] i'
).
addClass
(
"fa-spinner fa-spin"
);
$
(
'#store-upload-form button[type="submit"] i'
).
addClass
(
"fa-spinner fa-spin"
);
var
current_dir
=
$
(
"#store-upload-form"
).
find
(
'[name="current_dir"]'
).
val
();
var
current_dir
=
$
(
"#store-upload-form"
).
find
(
'[name="current_dir"]'
).
val
();
$
.
get
(
$
(
"#store-upload-form"
).
data
(
"action"
)
+
"?current_dir="
+
current_dir
,
function
(
result
)
{
$
.
get
(
$
(
"#store-upload-form"
).
data
(
"action"
)
+
"?current_dir="
+
current_dir
,
function
(
result
)
{
$
(
"#store-upload-form"
).
get
(
0
).
setAttribute
(
"action"
,
result
[
'url'
]
);
$
(
"#store-upload-form"
).
get
(
0
).
setAttribute
(
"action"
,
result
.
url
);
$
(
"#store-upload-form"
).
submit
();
$
(
"#store-upload-form"
).
submit
();
});
});
return
false
;
return
false
;
});
});
/* "fake" browse button */
/* "fake" browse button */
$
(
"#store-list-container"
).
on
(
"click"
,
"#store-upload-browse"
,
function
()
{
$
(
"#store-list-container"
).
on
(
"click"
,
"#store-upload-browse"
,
function
()
{
$
(
'#store-upload-form input[type="file"]'
).
click
();
$
(
'#store-upload-form input[type="file"]'
).
click
();
});
});
$
(
"#store-list-container"
).
on
(
"change"
,
"#store-upload-file"
,
function
()
{
$
(
"#store-list-container"
).
on
(
"change"
,
"#store-upload-file"
,
function
()
{
var
input
=
$
(
this
);
var
input
=
$
(
this
);
var
numFiles
=
input
.
get
(
0
).
files
?
input
.
get
(
0
).
files
.
length
:
1
;
var
numFiles
=
input
.
get
(
0
).
files
?
input
.
get
(
0
).
files
.
length
:
1
;
...
...
circle/dashboard/static/dashboard/template-list.js
View file @
6cb335d7
...
@@ -20,7 +20,7 @@ $(function() {
...
@@ -20,7 +20,7 @@ $(function() {
});
});
return
false
;
return
false
;
});
});
/* template table sort */
/* template table sort */
var
ttable
=
$
(
".template-list-table"
).
stupidtable
();
var
ttable
=
$
(
".template-list-table"
).
stupidtable
();
...
@@ -37,7 +37,7 @@ $(function() {
...
@@ -37,7 +37,7 @@ $(function() {
// only if js is enabled
// only if js is enabled
$
(
".template-list-table thead th"
).
css
(
"cursor"
,
"pointer"
);
$
(
".template-list-table thead th"
).
css
(
"cursor"
,
"pointer"
);
$
(
".template-list-table th a"
).
on
(
"click"
,
function
(
event
)
{
$
(
".template-list-table th a"
).
on
(
"click"
,
function
(
event
)
{
event
.
preventDefault
();
event
.
preventDefault
();
});
});
...
@@ -48,16 +48,16 @@ $(function() {
...
@@ -48,16 +48,16 @@ $(function() {
function
deleteTemplate
(
data
)
{
function
deleteTemplate
(
data
)
{
$
.
ajax
({
$
.
ajax
({
type
:
'POST'
,
type
:
'POST'
,
url
:
data
[
'url'
]
,
url
:
data
.
url
,
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
success
:
function
(
re
,
textStatus
,
xhr
)
{
success
:
function
(
re
,
textStatus
,
xhr
)
{
addMessage
(
re
[
'message'
]
,
'success'
);
addMessage
(
re
.
message
,
'success'
);
$
(
'a[data-template-pk="'
+
data
[
'template_pk'
]
+
'"]'
).
closest
(
'tr'
).
fadeOut
(
function
()
{
$
(
'a[data-template-pk="'
+
data
.
template_pk
+
'"]'
).
closest
(
'tr'
).
fadeOut
(
function
()
{
$
(
this
).
remove
();
$
(
this
).
remove
();
});
});
},
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
error
:
function
(
xhr
,
textStatus
,
error
)
{
addMessage
(
'Uh oh :('
,
'danger'
)
addMessage
(
'Uh oh :('
,
'danger'
)
;
}
}
});
});
}
}
...
@@ -67,16 +67,16 @@ function deleteTemplate(data) {
...
@@ -67,16 +67,16 @@ function deleteTemplate(data) {
function
deleteLease
(
data
)
{
function
deleteLease
(
data
)
{
$
.
ajax
({
$
.
ajax
({
type
:
'POST'
,
type
:
'POST'
,
url
:
data
[
'url'
]
,
url
:
data
.
url
,
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
success
:
function
(
re
,
textStatus
,
xhr
)
{
success
:
function
(
re
,
textStatus
,
xhr
)
{
addMessage
(
re
[
'message'
]
,
'success'
);
addMessage
(
re
.
message
,
'success'
);
$
(
'a[data-lease-pk="'
+
data
[
'lease_pk'
]
+
'"]'
).
closest
(
'tr'
).
fadeOut
(
function
()
{
$
(
'a[data-lease-pk="'
+
data
.
lease_pk
+
'"]'
).
closest
(
'tr'
).
fadeOut
(
function
()
{
$
(
this
).
remove
();
$
(
this
).
remove
();
});
});
},
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
error
:
function
(
xhr
,
textStatus
,
error
)
{
addMessage
(
'Uh oh :('
,
'danger'
)
addMessage
(
'Uh oh :('
,
'danger'
)
;
}
}
});
});
}
}
circle/dashboard/static/dashboard/vm-common.js
View file @
6cb335d7
...
@@ -74,7 +74,7 @@ $(function() {
...
@@ -74,7 +74,7 @@ $(function() {
},
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
error
:
function
(
xhr
,
textStatus
,
error
)
{
$
(
'#confirmation-modal'
).
modal
(
"hide"
);
$
(
'#confirmation-modal'
).
modal
(
"hide"
);
if
(
xhr
.
status
==
500
)
{
if
(
xhr
.
status
==
500
)
{
addMessage
(
"500 Internal Server Error"
,
"danger"
);
addMessage
(
"500 Internal Server Error"
,
"danger"
);
}
else
{
}
else
{
...
...
circle/dashboard/static/dashboard/vm-console.js
View file @
6cb335d7
...
@@ -6,7 +6,7 @@ $(function() {
...
@@ -6,7 +6,7 @@ $(function() {
var
rfb
;
var
rfb
;
function
updateState
(
rfb
,
state
,
oldstate
,
msg
)
{
function
updateState
(
rfb
,
state
,
oldstate
,
msg
)
{
$
(
'#_console .btn-toolbar button'
).
attr
(
'disabled'
,
!
(
state
=
==
"normal"
));
$
(
'#_console .btn-toolbar button'
).
attr
(
'disabled'
,
(
state
!
==
"normal"
));
rfb
.
sendKey
(
0xffe3
);
// press and release ctrl to kill screensaver
rfb
.
sendKey
(
0xffe3
);
// press and release ctrl to kill screensaver
if
(
typeof
(
msg
)
!==
'undefined'
)
{
if
(
typeof
(
msg
)
!==
'undefined'
)
{
...
@@ -42,13 +42,13 @@ $(function() {
...
@@ -42,13 +42,13 @@ $(function() {
if
(
window
.
location
.
port
==
8080
)
{
if
(
window
.
location
.
port
==
8080
)
{
port
=
9999
;
port
=
9999
;
}
else
{
}
else
{
port
=
window
.
location
.
port
==
""
?
"443"
:
window
.
location
.
port
;
port
=
window
.
location
.
port
==
=
""
?
"443"
:
window
.
location
.
port
;
}
}
password
=
''
;
password
=
''
;
$
(
'#_console .btn-toolbar button'
).
attr
(
'disabled'
,
true
);
$
(
'#_console .btn-toolbar button'
).
attr
(
'disabled'
,
true
);
$
(
'#noVNC_status'
).
html
(
'Retreiving authorization token.'
);
$
(
'#noVNC_status'
).
html
(
'Retreiving authorization token.'
);
$
.
get
(
VNC_URL
,
function
(
data
)
{
$
.
get
(
VNC_URL
,
function
(
data
)
{
if
(
data
.
indexOf
(
'vnc'
)
!=
0
)
{
if
(
data
.
indexOf
(
'vnc'
)
!=
=
0
)
{
$
(
'#noVNC_status'
).
html
(
'No authorization token received.'
);
$
(
'#noVNC_status'
).
html
(
'No authorization token received.'
);
}
}
else
{
else
{
...
...
circle/dashboard/static/dashboard/vm-create.js
View file @
6cb335d7
...
@@ -18,7 +18,7 @@ function vmCreateLoaded() {
...
@@ -18,7 +18,7 @@ function vmCreateLoaded() {
$
(
".customize-vm"
).
click
(
function
()
{
$
(
".customize-vm"
).
click
(
function
()
{
var
template
=
$
(
this
).
data
(
"template-pk"
);
var
template
=
$
(
this
).
data
(
"template-pk"
);
$
.
get
(
"/dashboard/vm/create/?template="
+
template
,
function
(
data
)
{
$
.
get
(
"/dashboard/vm/create/?template="
+
template
,
function
(
data
)
{
var
r
=
$
(
'#create-modal'
);
r
.
next
(
'div'
).
remove
();
r
.
remove
();
var
r
=
$
(
'#create-modal'
);
r
.
next
(
'div'
).
remove
();
r
.
remove
();
$
(
'body'
).
append
(
data
);
$
(
'body'
).
append
(
data
);
...
@@ -34,7 +34,7 @@ function vmCreateLoaded() {
...
@@ -34,7 +34,7 @@ function vmCreateLoaded() {
});
});
return
false
;
return
false
;
});
});
/* start vm button clicks */
/* start vm button clicks */
$
(
'.vm-create-start'
).
click
(
function
()
{
$
(
'.vm-create-start'
).
click
(
function
()
{
template
=
$
(
this
).
data
(
"template-pk"
);
template
=
$
(
this
).
data
(
"template-pk"
);
...
@@ -60,7 +60,7 @@ function vmCreateLoaded() {
...
@@ -60,7 +60,7 @@ function vmCreateLoaded() {
},
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
error
:
function
(
xhr
,
textStatus
,
error
)
{
var
r
=
$
(
'#create-modal'
);
r
.
next
(
'div'
).
remove
();
r
.
remove
();
var
r
=
$
(
'#create-modal'
);
r
.
next
(
'div'
).
remove
();
r
.
remove
();
if
(
xhr
.
status
==
500
)
{
if
(
xhr
.
status
==
500
)
{
addMessage
(
"500 Internal Server Error"
,
"danger"
);
addMessage
(
"500 Internal Server Error"
,
"danger"
);
}
else
{
}
else
{
...
@@ -77,7 +77,7 @@ function vmCreateLoaded() {
...
@@ -77,7 +77,7 @@ function vmCreateLoaded() {
var
now
=
$
(
this
).
attr
(
'aria-valuenow'
);
var
now
=
$
(
this
).
attr
(
'aria-valuenow'
);
var
siz
=
(
now
-
min
)
*
100
/
(
max
-
min
);
var
siz
=
(
now
-
min
)
*
100
/
(
max
-
min
);
$
(
this
).
css
(
'width'
,
siz
+
'%'
);
$
(
this
).
css
(
'width'
,
siz
+
'%'
);
});
});
}
}
...
@@ -93,18 +93,18 @@ function vmCustomizeLoaded() {
...
@@ -93,18 +93,18 @@ function vmCustomizeLoaded() {
// remove the hex chars
// remove the hex chars
name
=
name
.
substring
(
name
.
indexOf
(
" "
),
name
.
length
);
name
=
name
.
substring
(
name
.
indexOf
(
" "
),
name
.
length
);
if
(
$
(
'#vm-create-network-list'
).
children
(
'span'
).
length
<
1
)
{
if
(
$
(
'#vm-create-network-list'
).
children
(
'span'
).
length
<
1
)
{
$
(
'#vm-create-network-list'
).
html
(
''
);
$
(
'#vm-create-network-list'
).
html
(
''
);
}
}
$
(
'#vm-create-network-list'
).
append
(
$
(
'#vm-create-network-list'
).
append
(
vmCreateNetworkLabel
(
vlan_pk
,
name
,
managed
)
vmCreateNetworkLabel
(
vlan_pk
,
name
,
managed
)
);
);
/* select the network in the hidden network select */
/* select the network in the hidden network select */
$
(
'#vm-create-network-add-vlan option[value="'
+
vlan_pk
+
'"]'
).
prop
(
'selected'
,
true
);
$
(
'#vm-create-network-add-vlan option[value="'
+
vlan_pk
+
'"]'
).
prop
(
'selected'
,
true
);
$
(
'option:selected'
,
$
(
'#vm-create-network-add-select'
)).
remove
();
$
(
'option:selected'
,
$
(
'#vm-create-network-add-select'
)).
remove
();
/* add dummy text if no more networks are available */
/* add dummy text if no more networks are available */
if
(
$
(
'#vm-create-network-add-select option'
).
length
<
1
)
{
if
(
$
(
'#vm-create-network-add-select option'
).
length
<
1
)
{
$
(
'#vm-create-network-add-button'
).
attr
(
'disabled'
,
true
);
$
(
'#vm-create-network-add-button'
).
attr
(
'disabled'
,
true
);
...
@@ -117,23 +117,23 @@ function vmCustomizeLoaded() {
...
@@ -117,23 +117,23 @@ function vmCustomizeLoaded() {
/* remove network */
/* remove network */
// event for network remove button (icon, X)
// event for network remove button (icon, X)
$
(
'body'
).
on
(
'click'
,
'.vm-create-remove-network'
,
function
()
{
$
(
'body'
).
on
(
'click'
,
'.vm-create-remove-network'
,
function
()
{
var
vlan_pk
=
(
$
(
this
).
parent
(
'span'
).
prop
(
'id'
)).
replace
(
'vlan-'
,
''
)
var
vlan_pk
=
(
$
(
this
).
parent
(
'span'
).
prop
(
'id'
)).
replace
(
'vlan-'
,
''
)
;
// if it's "blue" then it's managed, kinda not cool
// if it's "blue" then it's managed, kinda not cool
var
managed
=
$
(
this
).
parent
(
'span'
).
hasClass
(
'label-primary'
);
var
managed
=
$
(
this
).
parent
(
'span'
).
hasClass
(
'label-primary'
);
$
(
this
).
parent
(
'span'
).
fadeOut
(
500
,
function
()
{
$
(
this
).
parent
(
'span'
).
fadeOut
(
500
,
function
()
{
/* if ther are no more vlans disabled the add button */
/* if ther are no more vlans disabled the add button */
if
(
$
(
'#vm-create-network-add-select option'
)[
0
].
value
==
-
1
)
{
if
(
$
(
'#vm-create-network-add-select option'
)[
0
].
value
==
-
1
)
{
$
(
'#vm-create-network-add-button'
).
attr
(
'disabled'
,
false
);
$
(
'#vm-create-network-add-button'
).
attr
(
'disabled'
,
false
);
$
(
'#vm-create-network-add-select'
).
html
(
''
);
$
(
'#vm-create-network-add-select'
).
html
(
''
);
}
}
/* remove the network label */
/* remove the network label */
$
(
this
).
remove
();
$
(
this
).
remove
();
var
vlan_name
=
$
(
this
).
text
();
var
vlan_name
=
$
(
this
).
text
();
var
html
=
'<option data-managed="'
+
(
managed
?
1
:
0
)
+
'" value="'
+
vlan_pk
+
'">'
+
var
html
=
'<option data-managed="'
+
(
managed
?
1
:
0
)
+
'" value="'
+
vlan_pk
+
'">'
+
(
managed
?
""
:
""
)
+
vlan_name
+
'</option>'
;
(
managed
?
""
:
""
)
+
vlan_name
+
'</option>'
;
$
(
'#vm-create-network-add-select'
).
append
(
html
);
$
(
'#vm-create-network-add-select'
).
append
(
html
);
...
@@ -148,7 +148,7 @@ function vmCustomizeLoaded() {
...
@@ -148,7 +148,7 @@ function vmCustomizeLoaded() {
/* copy networks from hidden select */
/* copy networks from hidden select */
$
(
'#vm-create-network-add-vlan option'
).
each
(
function
()
{
$
(
'#vm-create-network-add-vlan option'
).
each
(
function
()
{
var
managed
=
$
(
this
).
text
().
indexOf
(
"mana"
)
==
0
;
var
managed
=
$
(
this
).
text
().
indexOf
(
"mana"
)
==
=
0
;
var
raw_text
=
$
(
this
).
text
();
var
raw_text
=
$
(
this
).
text
();
var
pk
=
$
(
this
).
val
();
var
pk
=
$
(
this
).
val
();
if
(
managed
)
{
if
(
managed
)
{
...
@@ -157,7 +157,7 @@ function vmCustomizeLoaded() {
...
@@ -157,7 +157,7 @@ function vmCustomizeLoaded() {
text
=
raw_text
.
replace
(
"unmanaged -"
,
""
);
text
=
raw_text
.
replace
(
"unmanaged -"
,
""
);
}
}
var
html
=
'<option data-managed="'
+
(
managed
?
1
:
0
)
+
'" value="'
+
pk
+
'">'
+
text
+
'</option>'
;
var
html
=
'<option data-managed="'
+
(
managed
?
1
:
0
)
+
'" value="'
+
pk
+
'">'
+
text
+
'</option>'
;
if
(
$
(
'#vm-create-network-list span'
).
length
<
1
)
{
if
(
$
(
'#vm-create-network-list span'
).
length
<
1
)
{
$
(
"#vm-create-network-list"
).
html
(
""
);
$
(
"#vm-create-network-list"
).
html
(
""
);
}
}
...
@@ -180,7 +180,7 @@ function vmCustomizeLoaded() {
...
@@ -180,7 +180,7 @@ function vmCustomizeLoaded() {
vlans
.
push
({
vlans
.
push
({
'name'
:
$
(
this
).
text
().
replace
(
"unmanaged -"
,
""
).
replace
(
"managed -"
,
""
),
'name'
:
$
(
this
).
text
().
replace
(
"unmanaged -"
,
""
).
replace
(
"managed -"
,
""
),
'pk'
:
parseInt
(
$
(
this
).
val
()),
'pk'
:
parseInt
(
$
(
this
).
val
()),
'managed'
:
$
(
this
).
text
().
indexOf
(
"mana"
)
==
0
,
'managed'
:
$
(
this
).
text
().
indexOf
(
"mana"
)
==
=
0
,
});
});
});
});
...
@@ -248,7 +248,7 @@ function vmCustomizeLoaded() {
...
@@ -248,7 +248,7 @@ function vmCustomizeLoaded() {
},
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
error
:
function
(
xhr
,
textStatus
,
error
)
{
var
r
=
$
(
'#create-modal'
);
r
.
next
(
'div'
).
remove
();
r
.
remove
();
var
r
=
$
(
'#create-modal'
);
r
.
next
(
'div'
).
remove
();
r
.
remove
();
if
(
xhr
.
status
==
500
)
{
if
(
xhr
.
status
==
500
)
{
addMessage
(
"500 Internal Server Error"
,
"danger"
);
addMessage
(
"500 Internal Server Error"
,
"danger"
);
}
else
{
}
else
{
...
@@ -260,8 +260,8 @@ function vmCustomizeLoaded() {
...
@@ -260,8 +260,8 @@ function vmCustomizeLoaded() {
});
});
/* for no js stuff */
/* for no js stuff */
$
(
'.no-js-hidden'
).
show
();
$
(
'.no-js-hidden'
).
show
();
$
(
'.js-hidden'
).
hide
();
$
(
'.js-hidden'
).
hide
();
}
}
...
...
circle/dashboard/static/dashboard/vm-details.js
View file @
6cb335d7
...
@@ -41,7 +41,7 @@ $(function() {
...
@@ -41,7 +41,7 @@ $(function() {
var
vm
=
$
(
this
).
data
(
"vm"
);
var
vm
=
$
(
this
).
data
(
"vm"
);
$
.
ajax
({
$
.
ajax
({
type
:
'POST'
,
type
:
'POST'
,
url
:
"/dashboard/vm/"
+
vm
+
"/op/resources_change/"
,
url
:
"/dashboard/vm/"
+
vm
+
"/op/resources_change/"
,
data
:
$
(
'#vm-details-resources-form'
).
serialize
(),
data
:
$
(
'#vm-details-resources-form'
).
serialize
(),
success
:
function
(
data
,
textStatus
,
xhr
)
{
success
:
function
(
data
,
textStatus
,
xhr
)
{
if
(
data
.
success
)
{
if
(
data
.
success
)
{
...
@@ -57,7 +57,7 @@ $(function() {
...
@@ -57,7 +57,7 @@ $(function() {
addMessage
(
"500 Internal Server Error"
,
"danger"
);
addMessage
(
"500 Internal Server Error"
,
"danger"
);
}
else
{
}
else
{
addMessage
(
xhr
.
status
+
" Unknown Error"
,
"danger"
);
addMessage
(
xhr
.
status
+
" Unknown Error"
,
"danger"
);
}
}
}
}
});
});
return
false
;
return
false
;
...
@@ -70,17 +70,17 @@ $(function() {
...
@@ -70,17 +70,17 @@ $(function() {
$
.
ajax
({
$
.
ajax
({
type
:
'POST'
,
type
:
'POST'
,
url
:
location
.
href
,