Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
26a04c48
authored
Feb 20, 2013
by
Dányi Bence
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webui: implement vm-rename feature (ajax)
parent
18c6833f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
1 deletions
+21
-1
cloud/urls.py
+3
-0
one/static/script/cloud.js
+11
-1
one/views.py
+7
-0
No files found.
cloud/urls.py
View file @
26a04c48
...
@@ -80,6 +80,9 @@ urlpatterns = patterns('',
...
@@ -80,6 +80,9 @@ urlpatterns = patterns('',
url
(
r'^ajax/vm/status/(?P<iid>\d+)$'
,
url
(
r'^ajax/vm/status/(?P<iid>\d+)$'
,
'one.views.vm_ajax_instance_status'
,
'one.views.vm_ajax_instance_status'
,
name
=
'vm_ajax_instance_status'
),
name
=
'vm_ajax_instance_status'
),
url
(
r'^ajax/vm/rename/(?P<iid>\d+)/$'
,
'one.views.vm_ajax_rename'
,
name
=
'vm_ajax_rename'
),
url
(
r'^language/(?P<lang>[-A-Za-z]+)/$'
,
'school.views.language'
,
url
(
r'^language/(?P<lang>[-A-Za-z]+)/$'
,
'school.views.language'
,
name
=
'language'
),
name
=
'language'
),
url
(
r'^jsi18n/$'
,
'django.views.i18n.javascript_catalog'
,
js_info_dict
),
url
(
r'^jsi18n/$'
,
'django.views.i18n.javascript_catalog'
,
js_info_dict
),
...
...
one/static/script/cloud.js
View file @
26a04c48
...
@@ -56,7 +56,17 @@ $(function() {
...
@@ -56,7 +56,17 @@ $(function() {
$
(
'#vm-'
+
id
+
'-name'
).
find
(
'input[type=submit]'
).
click
(
function
(
f
)
{
$
(
'#vm-'
+
id
+
'-name'
).
find
(
'input[type=submit]'
).
click
(
function
(
f
)
{
f
.
preventDefault
();
f
.
preventDefault
();
f
.
stopPropagation
();
f
.
stopPropagation
();
alert
(
$
(
this
).
prev
().
val
());
var
newName
=
$
(
this
).
prev
().
val
();
$
.
ajax
({
type
:
'POST'
,
data
:
'name='
+
newName
,
dataType
:
'json'
,
url
:
'/ajax/vm/rename/'
+
id
+
'/'
,
success
:
function
(
data
)
{
$
(
'#vm-'
+
id
+
'-name-details'
).
show
();
$
(
'#vm-'
+
id
+
'-name'
).
html
(
data
.
name
);
}
});
})
})
});
});
$
(
'.try-template-button'
).
click
(
function
(
e
)
{
$
(
'.try-template-button'
).
click
(
function
(
e
)
{
...
...
one/views.py
View file @
26a04c48
...
@@ -295,6 +295,13 @@ def vm_ajax_instance_status(request, iid):
...
@@ -295,6 +295,13 @@ def vm_ajax_instance_status(request, iid):
inst
.
update_state
()
inst
.
update_state
()
return
HttpResponse
(
json
.
dumps
({
'booting'
:
not
inst
.
active_since
,
'state'
:
inst
.
state
}))
return
HttpResponse
(
json
.
dumps
({
'booting'
:
not
inst
.
active_since
,
'state'
:
inst
.
state
}))
@login_required
def
vm_ajax_rename
(
request
,
iid
):
inst
=
get_object_or_404
(
Instance
,
id
=
iid
,
owner
=
request
.
user
)
inst
.
name
=
request
.
POST
[
'name'
]
inst
.
save
()
return
HttpResponse
(
json
.
dumps
({
'name'
:
inst
.
name
}))
def
boot_token
(
request
,
token
):
def
boot_token
(
request
,
token
):
try
:
try
:
id
=
signing
.
loads
(
token
,
salt
=
'activate'
)
id
=
signing
.
loads
(
token
,
salt
=
'activate'
)
...
...
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