add gridftp view
authorMaciej Tronowski <mtro@man.poznan.pl>
Fri, 20 Mar 2015 12:30:03 +0000 (13:30 +0100)
committerMaciej Tronowski <mtro@man.poznan.pl>
Fri, 20 Mar 2015 12:30:03 +0000 (13:30 +0100)
plgng/settings_common.py
plgng/urls.py
qcg/static/qcg/main.css
qcg/templates/qcg/base.html
qcg/templates/qcg/gridftp.html [new file with mode: 0644]
qcg/urls.py
qcg/views.py

index 503c0a5..84a0283 100644 (file)
@@ -31,6 +31,7 @@ INSTALLED_APPS = (
     'django.contrib.staticfiles',
     'django.contrib.webdesign',
     'qcg',
+    'filex',
     'django_openid_auth',
     'bootstrap3',
 )
index d4e6ead..e4324f9 100644 (file)
@@ -5,5 +5,6 @@ urlpatterns = patterns('',
     url(r'^admin/', include(admin.site.urls)),
     url(r'^grappelli/', include('grappelli.urls')),  # grappelli URLS
 
+    url(r'^filex/', include('filex.urls', namespace='filex')),
     url(r'^', include('qcg.urls')),
 )
index f3ee656..881ed0c 100644 (file)
@@ -17,44 +17,40 @@ footer.navbar-fixed-bottom {
     margin-top: 0;
 }
 
+
+/* new job view */
+
 textarea {
     resize: vertical;
     min-height: 34px;
 }
 
-
 .modal-body > *:last-child {
     margin-bottom: 0;
 }
 
-
 #env-controls .form-group {
     display: inline-block;
     margin: 0;
     vertical-align: middle;
 }
 
-
 #env-controls > div {
     margin-bottom: 7px;
 }
 
-
 #env-controls > div:last-of-type {
     margin: 0;
 }
 
-
 #env-controls input[type="text"] {
     width: 160px;
 }
 
-
 #add-env-form {
     padding-top: 7px;
 }
 
-
 .timerange input {
     display: inline-block;
     width: 67%;
@@ -66,3 +62,42 @@ textarea {
     width: 30%;
     float: right;
 }
+
+
+/* GridFTP view */
+
+#filex {
+    /* needed for positioning spinner */
+    position: relative;
+}
+
+#host-controls .change {
+    display: none;
+}
+
+#host-controls.editing .view {
+    display: none;
+}
+
+#host-controls.editing .change {
+    display: initial;
+}
+
+.path.breadcrumb > li + li::before {
+    content: "› ";
+}
+
+#spinner-overlay {
+    background: url('/static/filex/spinner.gif') white center 100px no-repeat;
+    opacity: 0.5;
+    position: absolute;
+    top: 0;
+    left: 0;
+    height: 100%;
+    width: 100%;
+    display: none;
+}
+
+.busy #spinner-overlay {
+    display: initial;
+}
index 19841b4..9accb20 100644 (file)
@@ -34,6 +34,9 @@
                         <li{% ifequal request.resolver_match.url_name 'job_new' %} class="active"{% endifequal %}>
                             <a href="{% url 'job_new' %}">Zleć zadanie</a>
                         </li>
+                        <li{% ifequal request.resolver_match.url_name 'gridftp' %} class="active"{% endifequal %}>
+                            <a href="{% url 'gridftp' %}">GridFTP</a>
+                        </li>
                     </ul>
                 {% endif %}
 
diff --git a/qcg/templates/qcg/gridftp.html b/qcg/templates/qcg/gridftp.html
new file mode 100644 (file)
index 0000000..7b2cd65
--- /dev/null
@@ -0,0 +1,107 @@
+{% extends 'qcg/base.html' %}
+{% load staticfiles %}
+
+{% block extra_css %}
+    <link href="{% static 'qcg/selectize/selectize.bootstrap3.css' %}" rel="stylesheet">
+{% endblock %}
+
+{% block extra_js %}
+    <script src="{% static 'qcg/selectize/selectize.min.js' %}"></script>
+    <script src="{% static 'filex/underscore/underscore.js' %}"></script>
+    <script src="{% static 'filex/backbone/backbone.js' %}"></script>
+    <script src="{% static 'filex/filex.js' %}"></script>
+
+    <script>
+        var app;
+        $(function() {
+            app = new Filex.FilexView({
+                host: 'qcg.man.poznan.pl',
+                hostOptions: [
+                    {host: 'qcg.man.poznan.pl', path: '/home/plgrid/{{ request.user.username }}/reef'},
+                    {host: 'ui.grid.icm.edu.pl', path: '/icm/hydra/home/grid/{{ request.user.username }}'},
+                    {host: 'ui.plgrid.wcss.wroc.pl', path: '/home/grid/users/{{ request.user.username }}'},
+                    {host: 'ui.grid.task.gda.pl', path: '/home/plgrid/{{ request.user.username }}'},
+                    {host: 'zeus.cyfronet.pl', path: '/people/{{ request.user.username }}'}
+                ]
+            });
+        });
+    </script>
+
+    <script type="text/template" id="path-bit-template">
+        <a href="#"><%= name %></a>
+    </script>
+
+    <script type="text/template" id="dir-template">
+        <td class="text-center"><span class="glyphicon glyphicon-folder-open" aria-hidden="true"></span></td>
+        <td><a class="link" href="#"><%= name %></a></td>
+        <td class="text-right"><%= size %></td>
+        <td><%= date %></td>
+    </script>
+
+    <script type="text/template" id="file-template">
+        <td class="text-center"><span class="glyphicon glyphicon-file" aria-hidden="true"></span></td>
+        <td>
+            <a href="{% url 'filex:download' %}?<%= url_params %>" class="btn btn-default btn-xs pull-right link" title="Pobierz plik">
+                <span class="glyphicon glyphicon-cloud-download" aria-hidden="true"></span>
+            </a>
+            <%= name %>
+        </td>
+        <td class="text-right"><%= size %></td>
+        <td><%= date %></td>
+    </script>
+{% endblock extra_js %}
+
+{% block container %}
+    <h1 class="page-header">{% block title %}Zarządzanie plikami GridFTP{% endblock %}</h1>
+
+    <div id="filex">
+        <div class="row">
+            <div class="col-sm-3">
+                <div id="host-controls" style="margin-top: 1px">
+                    <div class="change">
+                        <label for="host-selector" class="sr-only">Wybierz host</label>
+                        <select id="host-selector"></select>
+                    </div>
+                    <button class="btn btn-default view"></button>
+                </div>
+            </div>
+
+            <div class="col-sm-7">
+                <ol class="breadcrumb path"></ol>
+            </div>
+
+            <div class="col-sm-2 text-right">
+                <div class="btn-group" data-toggle="buttons" style="margin-top: 1px">
+                    <label class="btn btn-default">
+                        <input id="show-hidden" type="checkbox" autocomplete="off"> Pokaż ukryte
+                    </label>
+                </div>
+            </div>
+        </div>
+
+        <table class="table table-hover">
+            <thead>
+                <tr>
+                    <th style="width: 40px"></th>
+                    <th>Nazwa</th>
+                    <th style="width: 120px">Rozmiar</th>
+                    <th style="width: 200px">Data</th>
+                </tr>
+            </thead>
+            <tbody></tbody>
+        </table>
+
+        <div id="no-items" class="alert alert-info" hidden>
+            <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
+            Brak elementów
+        </div>
+
+        <div id="error" class="alert alert-danger" hidden>
+            <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
+            <span class="msg"></span>
+        </div>
+
+        <div id="spinner-overlay"></div>
+    </div>
+
+{% endblock container %}
index 085bfd3..a45e85d 100644 (file)
@@ -1,4 +1,4 @@
-from django.conf.urls import patterns, url, include
+from django.conf.urls import patterns, url
 
 from qcg import views
 
@@ -12,4 +12,6 @@ urlpatterns = patterns('',
     url(r'^job/new/$', views.job_new, name='job_new'),
     url(r'^job/(?P<job_id>[\w]+)/?$', views.job_details, name='job'),
     url(r'^job/(?P<job_id>[\w]+)/(?P<task_id>[\w]+)/?$', views.task_details, name='task'),
+
+    url(r'^gridftp/$', views.gridftp, name='gridftp'),
 )
index 3da9dfe..b8947b3 100644 (file)
@@ -202,3 +202,7 @@ def job_new(request):
     errors = form.errors or (env_formset.is_bound and not env_formset.is_valid)
 
     return render(request, 'qcg/job_new.html', {'form': form, 'env_formset': env_formset, 'errors': errors})
+
+
+def gridftp(request):
+    return render(request, 'qcg/gridftp.html')