Commit 41b6aa6d authored by Penom Nom's avatar Penom Nom
Browse files

update download of urls

parent a566eb06
......@@ -80,7 +80,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{* Modal *}
<div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
......
......@@ -289,13 +289,45 @@ $(function () {
var cb = function(data){
var wfstatus = data.status
if (wfstatus == "completed"){
$("#myModalBody").html([
'<div class="alert alert-success">',
' <p><strong>Success !</strong> Your links have been created.</p>',
'</div>',
'<div id="symlink_filelist">',
'</div>'
].join(''));
$.ajax({
url : $("#server_url").val() + '/get_workflow_outputs?workflow_id=' + running_wf.id ,
dataType : 'jsonp',
timeout: 20000 , // More than enough to submit the request
success : function(data){
$.each(data, function(i, component) {
$.each(component, function(filename, file) {
if (filename == 'output_list.txt'){
$.get(file.url, function(data){
$("#myModalBody").html([
'<div class="alert">',
' <p>',
' <strong>Success !</strong> You will find bellow the list of paths for all your datas.',
' Use the <i class="glyphicon glyphicon-floppy-save"></i> button to copy all paths to the clipboard.<br/>',
' </p>',
'</div>',
'<div>',
' <button id="copy_urls" class="btn btn-default btn-sm pull-right" data-clipboard-target="url_filelist">',
' <i class="glyphicon glyphicon-floppy-save"></i>&nbsp;',
' </button><br/>',
' <textarea readonly id="url_filelist" rows="25" style="resize:none;white-space: pre; word-wrap: normal; overflow-x: scroll; width: 100%">',
data.trim(),
' </textarea>',
'</div>'
].join(''));
var client = new ZeroClipboard($("#copy_urls"));
});
}
});
});
},
error : function(jqXHR, textStatus, errorThrown){
$("#myModalBody").html([
'<div class="alert alert-danger">',
' <p><strong>Failed !</strong> to get outputs from ' + $("#server_url").val() + ' </p>',
'</div>',
].join(''));
}
});
}
else if (wfstatus == 'started' ){
get_workflow_status($("#server_url").val() , running_wf.id, cb, errcb)
......@@ -338,33 +370,30 @@ $(function () {
var link_prefix = location.href.replace(/index\.php.+/, "" ) + 'fileadmin' ;
$.get(file.url, function(data){
var file_list = [];
$.each(data.split('\n'), function(i, path){
$.each(data.trim().split('\n'), function(i, path){
file_list.push(link_prefix + path);
});
$("#myModalBody").html([
'<div class="alert alert-success">',
' <p><strong>Success !</strong> You will find bellow the list of ursl for your data</p>',
'<div class="alert">',
' <p>',
' <strong>Success !</strong> You will find bellow the list of urls for your data.',
' Use the <i class="glyphicon glyphicon-floppy-save"></i> button bellow to copy all urls to the clipboard.<br/>',
' </p>',
'</div>',
'<div>',
' <textarea id="url_filelist" rows="' + file_list.length + '" cols="70">',
file_list,
' <button id="copy_urls" class="btn btn-default btn-sm pull-right" data-clipboard-target="url_filelist">',
' <i class="glyphicon glyphicon-floppy-save"></i>&nbsp;',
' </button><br/>',
' <textarea readonly id="url_filelist" rows="25" style="resize:none;white-space: pre; word-wrap: normal; overflow-x: scroll; width: 100%">',
file_list.join('\n'),
' </textarea>',
'</div>'
].join(''));
var client = new ZeroClipboard($("#copy_urls"));
});
}
});
});
$("#myModalBody").html([
'<div class="alert alert-success">',
' <p><strong>Success !</strong> faut prendre les output maintenant </p>',
'</div>',
'<div id="url_filelist">',
'</div>'
].join(''));
},
error : function(jqXHR, textStatus, errorThrown){
$("#myModalBody").html([
......@@ -374,8 +403,6 @@ $(function () {
].join(''));
}
});
}
else if (wfstatus == 'started' ){
get_workflow_status($("#server_url").val() , running_wf.id, cb, errcb)
......
......@@ -27,6 +27,7 @@ def get_urls( ng6_username, ids_dump_path, output_url):
import pickle
import subprocess
import sys
import re
from jflow.utils import *
......@@ -49,7 +50,7 @@ def get_urls( ng6_username, ids_dump_path, output_url):
for filename in os.listdir(source_dir):
source_file_path = os.path.join(source_dir, filename)
if os.path.isfile(source_file_path) and filename not in [ "analyse.xml", "index.html", "run.cfg"] :
files.append(source_file_path.replace(data_directory, ""))
files.append(re.sub( r"\/+", "/", source_file_path.replace(data_directory, "")))
with open(output_url, "w") as fh :
for f in files :
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment