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
2143ee09
authored
Oct 29, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: vm create sends data to view via AJAX
parent
97341109
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
1 deletions
+42
-1
circle/dashboard/static/dashboard/vm-create.js
+41
-0
circle/dashboard/templates/dashboard/vm-create.html
+1
-1
No files found.
circle/dashboard/static/dashboard/vm-create.js
View file @
2143ee09
...
...
@@ -169,6 +169,21 @@ function vmCreateLoaded() {
'pk'
:
parseInt
(
$
(
this
).
val
())
});
});
/* add button */
$
(
'#vm-create-submit'
).
click
(
function
()
{
$
.
ajax
({
url
:
'/dashboard/vm/create/'
,
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
type
:
'POST'
,
data
:
$
(
'form'
).
serialize
(),
success
:
function
(
data
,
textStatus
,
xhr
)
{
console
.
log
(
data
);
}
});
return
false
;
});
/* no js compatibility */
$
(
'.no-js-hidden'
).
show
();
$
(
'.js-hidden'
).
hide
();
...
...
@@ -267,3 +282,29 @@ function vmCreateNetworkLabel(pk, name, managed) {
function
vmCreateDiskLabel
(
pk
,
name
)
{
return
'<span id="vlan-'
+
pk
+
'" class="label label-primary"><i class="icon-file"></i> '
+
name
+
' <a href="#" class="hover-black vm-create-remove-disk"><i class="icon-remove-sign"></i></a></span> '
;
}
/* copied from /static/js/network.js
* we gonna need this anyways for ajax POSTs */
// for AJAX calls
/**
* Getter for user cookies
* @param {String} name Cookie name
* @return {String} Cookie value
*/
function
getCookie
(
name
)
{
var
cookieValue
=
null
;
if
(
document
.
cookie
&&
document
.
cookie
!=
''
)
{
var
cookies
=
document
.
cookie
.
split
(
';'
);
for
(
var
i
=
0
;
i
<
cookies
.
length
;
i
++
)
{
var
cookie
=
jQuery
.
trim
(
cookies
[
i
]);
if
(
cookie
.
substring
(
0
,
name
.
length
+
1
)
==
(
name
+
'='
))
{
cookieValue
=
decodeURIComponent
(
cookie
.
substring
(
name
.
length
+
1
));
break
;
}
}
}
return
cookieValue
;
}
circle/dashboard/templates/dashboard/vm-create.html
View file @
2143ee09
...
...
@@ -21,7 +21,7 @@
<a
class=
"btn btn-info vm-create-advanced-btn"
>
Advanced
<i
class=
"vm-create-advanced-icon icon-caret-down"
></i></a>
</div>
<div
class=
"col-sm-5 text-right"
>
<button
type=
"submit"
class=
"btn btn-success "
><i
class=
"icon-play"
></i>
Start
</button>
<button
id=
"vm-create-submit"
type=
"submit"
class=
"btn btn-success "
><i
class=
"icon-play"
></i>
Start
</button>
</div>
</div>
...
...
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