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
cc40257a
authored
Jul 09, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: store remove
parent
7162b53d
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
104 additions
and
7 deletions
+104
-7
circle/dashboard/static/dashboard/dashboard.css
+9
-2
circle/dashboard/templates/dashboard/store/list.html
+9
-4
circle/dashboard/templates/dashboard/store/remove.html
+42
-0
circle/dashboard/urls.py
+3
-1
circle/dashboard/views.py
+41
-0
No files found.
circle/dashboard/static/dashboard/dashboard.css
View file @
cc40257a
...
@@ -749,7 +749,7 @@ textarea[name="list-new-namelist"] {
...
@@ -749,7 +749,7 @@ textarea[name="list-new-namelist"] {
}
}
.store-list-file-infos
{
.store-list-file-infos
{
padding
:
20
px
;
padding
:
15
px
;
display
:
none
;
display
:
none
;
border-left
:
1px
solid
#ddd
;
border-left
:
1px
solid
#ddd
;
border-right
:
1px
solid
#ddd
;
border-right
:
1px
solid
#ddd
;
...
@@ -768,8 +768,15 @@ textarea[name="list-new-namelist"] {
...
@@ -768,8 +768,15 @@ textarea[name="list-new-namelist"] {
.store-download-button
{
.store-download-button
{
position
:
absolute
;
position
:
absolute
;
right
:
15px
;
right
:
15px
;
top
:
32
px
;
top
:
18
px
;
}
}
.store-remove-button
{
position
:
absolute
;
right
:
15px
;
top
:
55px
;
}
.store-list-item-icon-directory
{
.store-list-item-icon-directory
{
color
:
#ff8c00
;
color
:
#ff8c00
;
}
}
circle/dashboard/templates/dashboard/store/list.html
View file @
cc40257a
...
@@ -41,16 +41,21 @@
...
@@ -41,16 +41,21 @@
<a
href=
"{% url "
dashboard
.
views
.
store-download
"
%}?
path=
{{
f
.
path
}}"
<a
href=
"{% url "
dashboard
.
views
.
store-download
"
%}?
path=
{{
f
.
path
}}"
class=
"btn btn-primary btn-sm store-download-button"
>
class=
"btn btn-primary btn-sm store-download-button"
>
<i
class=
"icon-download"
></i>
<i
class=
"icon-download"
></i>
Download
{% trans "Download" %}
</a>
<a
href=
"{% url "
dashboard
.
views
.
store-remove
"
%}?
path=
{{
f
.
path
}}"
class=
"btn btn-danger btn-xs store-remove-button"
>
<i
class=
"icon-remove"
></i>
{% trans "Remove" %}
</a>
</a>
<dl
class=
"dl-horizontal"
style=
"margin: 0; padding: 0;"
>
<dl
class=
"dl-horizontal"
style=
"margin: 0; padding: 0;"
>
<dt>
Filename
</dt>
<dt>
{% trans "Filename" %}
</dt>
<dd>
{{ f.NAME }}
</dd>
<dd>
{{ f.NAME }}
</dd>
<dt>
Size
</dt>
<dt>
{% trans "Size" %}
</dt>
<dd>
{{ f.human_readable_size }}
</dd>
<dd>
{{ f.human_readable_size }}
</dd>
<dt>
Latest modification
</dt>
<dt>
{% trans "Latest modification" %}
</dt>
<dd>
{{ f.human_readable_date }}
</dd>
<dd>
{{ f.human_readable_date }}
</dd>
</dl>
</dl>
</div>
</div>
...
...
circle/dashboard/templates/dashboard/store/remove.html
0 → 100644
View file @
cc40257a
{% extends "dashboard/base.html" %}
{% load i18n %}
{% block content %}
<div
class=
"body-content"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<h3
class=
"no-margin"
>
<i
class=
"icon-remove"
></i>
{% if is_dir %}
{% trans "Directory removal confirmation" %}
{% else %}
{% trans "File removal confirmation" %}
{% endif %}
</h3>
</div>
<div
class=
"panel-body"
>
{% if not is_dir %}
<h4>
{% trans "File directory" %}: {{ directory }}
</h4>
<h4>
{% trans "File name" %}: {{ name }}
</h4>
{% blocktrans with path=path %}
Are you sure you want to remove the file at
<strong>
{{ path }}
</strong>
?
{% endblocktrans %}
{% else %}
{% blocktrans with directory=directory name=name %}
Are you sure you want to remove the directory
<strong>
{{ directory }}
</strong>
?
{% endblocktrans %}
{% endif %}
<div
class=
"pull-right"
>
<form
action=
""
method=
"POST"
>
{% csrf_token %}
<a
href=
"{% url "
dashboard
.
views
.
store-list
"
%}?
directory=
{{
directory
}}"
class=
"btn btn-default"
>
{% trans "Cancel" %}
</a>
<input
type=
"hidden"
name=
"path"
value=
"{{ path }}"
/>
<button
class=
"btn btn-danger"
>
{% trans "Remove" %}
</button>
</form>
</div>
</div>
</div>
</div>
{% endblock %}
circle/dashboard/urls.py
View file @
cc40257a
...
@@ -37,7 +37,7 @@ from .views import (
...
@@ -37,7 +37,7 @@ from .views import (
get_vm_screenshot
,
get_vm_screenshot
,
ProfileView
,
toggle_use_gravatar
,
UnsubscribeFormView
,
ProfileView
,
toggle_use_gravatar
,
UnsubscribeFormView
,
UserKeyDelete
,
UserKeyDetail
,
UserKeyCreate
,
UserKeyDelete
,
UserKeyDetail
,
UserKeyCreate
,
StoreList
,
store_download
,
store_upload
,
store_get_upload_url
,
StoreList
,
store_download
,
store_upload
,
store_get_upload_url
,
StoreRemove
,
)
)
urlpatterns
=
patterns
(
urlpatterns
=
patterns
(
...
@@ -179,4 +179,6 @@ urlpatterns = patterns(
...
@@ -179,4 +179,6 @@ urlpatterns = patterns(
name
=
"dashboard.views.store-upload-url"
),
name
=
"dashboard.views.store-upload-url"
),
url
(
r"^store/upload/$"
,
store_upload
,
url
(
r"^store/upload/$"
,
store_upload
,
name
=
"dashboard.views.store-upload"
),
name
=
"dashboard.views.store-upload"
),
url
(
r"^store/remove/$"
,
StoreRemove
.
as_view
(),
name
=
"dashboard.views.store-remove"
),
)
)
circle/dashboard/views.py
View file @
cc40257a
# Copyright 2014 Budapest University of Technology and Economics (BME IK)
# Copyright 2014 Budapest University of Technology and Economics (BME IK)
#
#
# This file is part of CIRCLE Cloud.
# This file is part of CIRCLE Cloud.
#
#
...
@@ -19,6 +20,7 @@ from __future__ import unicode_literals, absolute_import
...
@@ -19,6 +20,7 @@ from __future__ import unicode_literals, absolute_import
from
itertools
import
chain
from
itertools
import
chain
from
os
import
getenv
from
os
import
getenv
import
os
import
json
import
json
import
logging
import
logging
import
re
import
re
...
@@ -27,6 +29,7 @@ import requests
...
@@ -27,6 +29,7 @@ import requests
from
django.conf
import
settings
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
,
Group
from
django.contrib.auth.models
import
User
,
Group
from
django.contrib.auth.views
import
login
,
redirect_to_login
from
django.contrib.auth.views
import
login
,
redirect_to_login
from
django.contrib.auth.decorators
import
login_required
from
django.contrib.messages
import
warning
from
django.contrib.messages
import
warning
from
django.contrib.messages.views
import
SuccessMessageMixin
from
django.contrib.messages.views
import
SuccessMessageMixin
from
django.core.exceptions
import
(
from
django.core.exceptions
import
(
...
@@ -2985,6 +2988,7 @@ class StoreList(LoginRequiredMixin, TemplateView):
...
@@ -2985,6 +2988,7 @@ class StoreList(LoginRequiredMixin, TemplateView):
@require_GET
@require_GET
@login_required
def
store_download
(
request
):
def
store_download
(
request
):
path
=
request
.
GET
.
get
(
"path"
)
path
=
request
.
GET
.
get
(
"path"
)
url
=
store_api
.
requestdownload
(
"test"
,
path
)
url
=
store_api
.
requestdownload
(
"test"
,
path
)
...
@@ -2992,6 +2996,7 @@ def store_download(request):
...
@@ -2992,6 +2996,7 @@ def store_download(request):
@require_GET
@require_GET
@login_required
def
store_upload
(
request
):
def
store_upload
(
request
):
directory
=
request
.
GET
.
get
(
"directory"
)
directory
=
request
.
GET
.
get
(
"directory"
)
action
=
store_api
.
requestupload
(
"test"
,
directory
)
action
=
store_api
.
requestupload
(
"test"
,
directory
)
...
@@ -3005,8 +3010,44 @@ def store_upload(request):
...
@@ -3005,8 +3010,44 @@ def store_upload(request):
@require_GET
@require_GET
@login_required
def
store_get_upload_url
(
request
):
def
store_get_upload_url
(
request
):
current_dir
=
request
.
GET
.
get
(
"current_dir"
)
current_dir
=
request
.
GET
.
get
(
"current_dir"
)
url
=
store_api
.
requestupload
(
"test"
,
current_dir
)
url
=
store_api
.
requestupload
(
"test"
,
current_dir
)
return
HttpResponse
(
return
HttpResponse
(
json
.
dumps
({
'url'
:
url
}),
content_type
=
"application/json"
)
json
.
dumps
({
'url'
:
url
}),
content_type
=
"application/json"
)
class
StoreRemove
(
LoginRequiredMixin
,
TemplateView
):
template_name
=
"dashboard/store/remove.html"
def
get_context_data
(
self
,
*
args
,
**
kwargs
):
context
=
super
(
StoreRemove
,
self
)
.
get_context_data
(
*
args
,
**
kwargs
)
path
=
self
.
request
.
GET
.
get
(
"path"
,
"/"
)
if
path
==
"/"
:
SuspiciousOperation
()
context
[
'path'
]
=
path
context
[
'is_dir'
]
=
path
.
endswith
(
"/"
)
if
context
[
'is_dir'
]:
context
[
'directory'
]
=
path
else
:
context
[
'directory'
]
=
os
.
path
.
dirname
(
path
)
context
[
'name'
]
=
os
.
path
.
basename
(
path
)
return
context
def
post
(
self
,
*
args
,
**
kwargs
):
path
=
self
.
request
.
POST
.
get
(
"path"
)
store_api
.
requestremove
(
"test"
,
path
)
if
path
.
endswith
(
"/"
):
return
redirect
(
"
%
s?directory=
%
s"
%
(
reverse
(
"dashboard.views.store-list"
),
os
.
path
.
dirname
(
os
.
path
.
dirname
(
path
)),
))
else
:
return
redirect
(
"
%
s?directory=
%
s"
%
(
reverse
(
"dashboard.views.store-list"
),
os
.
path
.
dirname
(
path
),
))
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