Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
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
00b87bac
authored
Jun 25, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: add/remove disk operation buttons on state change
parent
9cc124e8
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
16 deletions
+24
-16
circle/dashboard/static/dashboard/vm-common.js
+2
-2
circle/dashboard/static/dashboard/vm-details.js
+1
-0
circle/dashboard/templates/dashboard/vm-detail/_disk-operations.html
+10
-0
circle/dashboard/templates/dashboard/vm-detail/resources.html
+3
-12
circle/dashboard/views.py
+8
-2
No files found.
circle/dashboard/static/dashboard/vm-common.js
View file @
00b87bac
...
...
@@ -43,10 +43,10 @@ $(function() {
success
:
function
(
data
,
textStatus
,
xhr
)
{
$
(
'#confirmation-modal'
).
modal
(
"hide"
);
if
(
data
.
redirect
)
{
if
(
data
.
success
)
{
$
(
'a[href="#activity"]'
).
trigger
(
"click"
);
if
(
data
.
messages
.
length
>
0
)
{
if
(
data
.
messages
&&
data
.
messages
.
length
>
0
)
{
addMessage
(
data
.
messages
.
join
(
"<br />"
),
"danger"
);
}
}
...
...
circle/dashboard/static/dashboard/vm-details.js
View file @
00b87bac
...
...
@@ -341,6 +341,7 @@ function checkNewActivity(only_status, runs) {
if
(
!
only_status
)
{
$
(
"#activity-timeline"
).
html
(
data
[
'activities'
]);
$
(
"#ops"
).
html
(
data
[
'ops'
]);
$
(
"#disk-ops"
).
html
(
data
[
'disk_ops'
]);
$
(
"[title]"
).
tooltip
();
}
...
...
circle/dashboard/templates/dashboard/vm-detail/_disk-operations.html
0 → 100644
View file @
00b87bac
{% load i18n %}
{% for op in ops %}
{% if op.is_disk_operation %}
<a
href=
"{{op.get_url}}"
class=
"btn btn-success btn-xs
operation operation-{{op.op}} btn btn-default"
>
<i
class=
"icon-{{op.icon}}"
></i>
{{op.name}}
</a>
{% endif %}
{% endfor %}
circle/dashboard/templates/dashboard/vm-detail/resources.html
View file @
00b87bac
...
...
@@ -47,18 +47,9 @@
<h3>
{% trans "Disks" %}
<div
class=
"pull-right"
>
{% if op.download_disk %}
<a
href=
"{{op.download_disk.get_url}}"
class=
"btn btn-success btn-xs
operation operation-{{op.download_disk.op}} btn btn-default"
>
<i
class=
"icon-{{op.download_disk.icon}}"
></i>
{{op.download_disk.name}}
</a>
{% endif %}
{% if op.create_disk %}
<a
href=
"{{op.create_disk.get_url}}"
class=
"btn btn-success btn-xs
operation operation-{{op.create_disk.op}} btn btn-default"
>
<i
class=
"icon-{{op.create_disk.icon}}"
></i>
{{op.create_disk.name}}
</a>
{% endif %}
<div
id=
"disk-ops"
>
{% include "dashboard/vm-detail/_disk-operations.html" %}
</div>
</div>
</h3>
...
...
circle/dashboard/views.py
View file @
00b87bac
...
...
@@ -579,7 +579,7 @@ class VmOperationView(OperationView):
store
=
messages
.
get_messages
(
request
)
store
.
used
=
True
return
HttpResponse
(
json
.
dumps
({
'
redirect'
:
resp
.
url
,
json
.
dumps
({
'
success'
:
True
,
'messages'
:
[
unicode
(
m
)
for
m
in
store
]}),
content_type
=
"application=json"
)
...
...
@@ -609,7 +609,7 @@ class FormOperationMixin(object):
request
,
extra
,
*
args
,
**
kwargs
)
if
request
.
is_ajax
():
return
HttpResponse
(
json
.
dumps
({
'
redirect'
:
resp
.
url
}),
json
.
dumps
({
'
success'
:
True
}),
content_type
=
"application=json"
)
else
:
...
...
@@ -624,6 +624,7 @@ class VmCreateDiskView(FormOperationMixin, VmOperationView):
form_class
=
VmCreateDiskForm
show_in_toolbar
=
False
icon
=
'hdd'
is_disk_operation
=
True
class
VmDownloadDiskView
(
FormOperationMixin
,
VmOperationView
):
...
...
@@ -632,6 +633,7 @@ class VmDownloadDiskView(FormOperationMixin, VmOperationView):
form_class
=
VmDownloadDiskForm
show_in_toolbar
=
False
icon
=
'download'
is_disk_operation
=
True
class
VmMigrateView
(
VmOperationView
):
...
...
@@ -2135,6 +2137,10 @@ def vm_activity(request, pk):
"dashboard/vm-detail/_operations.html"
,
RequestContext
(
request
,
context
),
)
response
[
'disk_ops'
]
=
render_to_string
(
"dashboard/vm-detail/_disk-operations.html"
,
RequestContext
(
request
,
context
),
)
return
HttpResponse
(
json
.
dumps
(
response
),
...
...
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