Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
circlestack
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
16d245c1
authored
Mar 06, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: display downloading disks
parent
43a921d6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
3 deletions
+48
-3
circle/dashboard/templates/dashboard/_disk-list-element.html
+14
-0
circle/dashboard/templates/dashboard/template-edit.html
+19
-2
circle/dashboard/templates/dashboard/vm-detail/resources.html
+1
-1
circle/storage/models.py
+14
-0
No files found.
circle/dashboard/templates/dashboard/_disk-list-element.html
0 → 100644
View file @
16d245c1
{% load i18n %}
{% load sizefieldtags %}
<i
class=
"{% if d.is_downloading %}icon-refresh icon-spin{% else %}icon-file{% endif %}"
></i>
{{ d.name }} (#{{ d.id }}) -
{% if not d.is_downloading %}
{% if d.ready %}
{{ d.size|filesize }}
{% else %}
<div
class=
"label label-danger"
>
failed
</div>
{% endif %}
{% else %}
<span
class=
"disk-list-disk-percentage"
data-disk-pk=
"{{ d.pk }}"
>
{{ d.get_download_percentage }}
</span>
%{% endif %}
<div
class=
"btn btn-xs btn-danger pull-right"
><i
class=
"icon-remove"
></i>
Remove
</div>
circle/dashboard/templates/dashboard/template-edit.html
View file @
16d245c1
{% extends "dashboard/base.html" %}
{% load i18n %}
{% load sizefieldtags %}
{% load crispy_forms_tags %}
{% block content %}
...
...
@@ -22,7 +23,7 @@
<div
class=
"col-md-4"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<h
3
class=
"no-margin"
><i
class=
"icon-group"
></i>
{% trans "Manage access" %}
</h3
>
<h
4
class=
"no-margin"
><i
class=
"icon-group"
></i>
{% trans "Manage access" %}
</h4
>
</div>
<div
class=
"panel-body"
>
<form
action=
"{% url "
dashboard
.
views
.
template-acl
"
pk=
object.pk
%}"
method=
"post"
>
{% csrf_token %}
...
...
@@ -65,9 +66,25 @@
</div>
</div>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<h3
class=
"no-margin"
><i
class=
"icon-file"
></i>
{% trans "Create new disk" %}
</h3>
<h4
class=
"no-margin"
><i
class=
"icon-file"
></i>
{% trans "Disk list" %}
</h4>
</div>
<div
class=
"panel-body"
>
<ul
style=
"list-style: none; padding-left: 0;"
>
{% for d in disks %}
<li>
{% include "dashboard/_disk-list-element.html" %}
</li>
{% endfor %}
</ul>
</div>
</div>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<h4
class=
"no-margin"
><i
class=
"icon-folder-open"
></i>
{% trans "Create new disk" %}
</h4>
</div>
<div
class=
"panel-body"
>
<form
action=
"{% url "
dashboard
.
views
.
disk-add
"
%}"
method=
"POST"
>
...
...
circle/dashboard/templates/dashboard/vm-detail/resources.html
View file @
16d245c1
...
...
@@ -60,7 +60,7 @@
{% endif %}
{% for d in instance.disks.all %}
<h4
class=
"list-group-item-heading dashboard-vm-details-network-h3"
>
<i
class=
"icon-file"
></i>
{{ d.name }} (#{{ d.id }}) - {{ d.size|filesize }
}
{% include "dashboard/_disk-list-element.html" %
}
</h4>
{% endfor %}
</div>
...
...
circle/storage/models.py
View file @
16d245c1
...
...
@@ -16,6 +16,7 @@ from datetime import timedelta
from
acl.models
import
AclBase
from
.tasks
import
local_tasks
,
remote_tasks
from
celery.exceptions
import
TimeoutError
from
manager.mancelery
import
celery
from
common.models
import
ActivityModel
,
activitycontextimpl
,
WorkerNotFound
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -133,6 +134,19 @@ class Disk(AclBase, TimeStampedModel):
'raw-rw'
:
'vd'
,
}[
self
.
type
]
def
is_downloading
(
self
):
da
=
DiskActivity
.
objects
.
filter
(
disk
=
self
)
.
latest
(
"created"
)
return
(
da
.
activity_code
==
"storage.Disk.download"
and
da
.
succeeded
is
None
)
def
get_download_percentage
(
self
):
if
not
self
.
is_downloading
():
return
None
task
=
DiskActivity
.
objects
.
latest
(
"created"
)
.
task_uuid
result
=
celery
.
AsyncResult
(
id
=
task
)
return
result
.
info
.
get
(
"percent"
)
def
is_deletable
(
self
):
"""Returns whether the file can be deleted.
...
...
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