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
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() {
...
@@ -43,10 +43,10 @@ $(function() {
success
:
function
(
data
,
textStatus
,
xhr
)
{
success
:
function
(
data
,
textStatus
,
xhr
)
{
$
(
'#confirmation-modal'
).
modal
(
"hide"
);
$
(
'#confirmation-modal'
).
modal
(
"hide"
);
if
(
data
.
redirect
)
{
if
(
data
.
success
)
{
$
(
'a[href="#activity"]'
).
trigger
(
"click"
);
$
(
'a[href="#activity"]'
).
trigger
(
"click"
);
if
(
data
.
messages
.
length
>
0
)
{
if
(
data
.
messages
&&
data
.
messages
.
length
>
0
)
{
addMessage
(
data
.
messages
.
join
(
"<br />"
),
"danger"
);
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) {
...
@@ -341,6 +341,7 @@ function checkNewActivity(only_status, runs) {
if
(
!
only_status
)
{
if
(
!
only_status
)
{
$
(
"#activity-timeline"
).
html
(
data
[
'activities'
]);
$
(
"#activity-timeline"
).
html
(
data
[
'activities'
]);
$
(
"#ops"
).
html
(
data
[
'ops'
]);
$
(
"#ops"
).
html
(
data
[
'ops'
]);
$
(
"#disk-ops"
).
html
(
data
[
'disk_ops'
]);
$
(
"[title]"
).
tooltip
();
$
(
"[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 @@
...
@@ -47,18 +47,9 @@
<h3>
<h3>
{% trans "Disks" %}
{% trans "Disks" %}
<div
class=
"pull-right"
>
<div
class=
"pull-right"
>
{% if op.download_disk %}
<div
id=
"disk-ops"
>
<a
href=
"{{op.download_disk.get_url}}"
class=
"btn btn-success btn-xs
{% include "dashboard/vm-detail/_disk-operations.html" %}
operation operation-{{op.download_disk.op}} btn btn-default"
>
</div>
<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>
</div>
</h3>
</h3>
...
...
circle/dashboard/views.py
View file @
00b87bac
...
@@ -579,7 +579,7 @@ class VmOperationView(OperationView):
...
@@ -579,7 +579,7 @@ class VmOperationView(OperationView):
store
=
messages
.
get_messages
(
request
)
store
=
messages
.
get_messages
(
request
)
store
.
used
=
True
store
.
used
=
True
return
HttpResponse
(
return
HttpResponse
(
json
.
dumps
({
'
redirect'
:
resp
.
url
,
json
.
dumps
({
'
success'
:
True
,
'messages'
:
[
unicode
(
m
)
for
m
in
store
]}),
'messages'
:
[
unicode
(
m
)
for
m
in
store
]}),
content_type
=
"application=json"
content_type
=
"application=json"
)
)
...
@@ -609,7 +609,7 @@ class FormOperationMixin(object):
...
@@ -609,7 +609,7 @@ class FormOperationMixin(object):
request
,
extra
,
*
args
,
**
kwargs
)
request
,
extra
,
*
args
,
**
kwargs
)
if
request
.
is_ajax
():
if
request
.
is_ajax
():
return
HttpResponse
(
return
HttpResponse
(
json
.
dumps
({
'
redirect'
:
resp
.
url
}),
json
.
dumps
({
'
success'
:
True
}),
content_type
=
"application=json"
content_type
=
"application=json"
)
)
else
:
else
:
...
@@ -624,6 +624,7 @@ class VmCreateDiskView(FormOperationMixin, VmOperationView):
...
@@ -624,6 +624,7 @@ class VmCreateDiskView(FormOperationMixin, VmOperationView):
form_class
=
VmCreateDiskForm
form_class
=
VmCreateDiskForm
show_in_toolbar
=
False
show_in_toolbar
=
False
icon
=
'hdd'
icon
=
'hdd'
is_disk_operation
=
True
class
VmDownloadDiskView
(
FormOperationMixin
,
VmOperationView
):
class
VmDownloadDiskView
(
FormOperationMixin
,
VmOperationView
):
...
@@ -632,6 +633,7 @@ class VmDownloadDiskView(FormOperationMixin, VmOperationView):
...
@@ -632,6 +633,7 @@ class VmDownloadDiskView(FormOperationMixin, VmOperationView):
form_class
=
VmDownloadDiskForm
form_class
=
VmDownloadDiskForm
show_in_toolbar
=
False
show_in_toolbar
=
False
icon
=
'download'
icon
=
'download'
is_disk_operation
=
True
class
VmMigrateView
(
VmOperationView
):
class
VmMigrateView
(
VmOperationView
):
...
@@ -2135,6 +2137,10 @@ def vm_activity(request, pk):
...
@@ -2135,6 +2137,10 @@ def vm_activity(request, pk):
"dashboard/vm-detail/_operations.html"
,
"dashboard/vm-detail/_operations.html"
,
RequestContext
(
request
,
context
),
RequestContext
(
request
,
context
),
)
)
response
[
'disk_ops'
]
=
render_to_string
(
"dashboard/vm-detail/_disk-operations.html"
,
RequestContext
(
request
,
context
),
)
return
HttpResponse
(
return
HttpResponse
(
json
.
dumps
(
response
),
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