# HG changeset patch # User Sebastien Jodogne # Date 1624537176 -7200 # Node ID 9568082ee01313af30fafc01ce4624511835d048 # Parent 6f82cd776cf6c3103dd0a52ffc2ee7097948232c If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives diff -r 6f82cd776cf6 -r 9568082ee013 Applications/StoneWebViewer/NEWS --- a/Applications/StoneWebViewer/NEWS Thu Jun 24 13:53:33 2021 +0200 +++ b/Applications/StoneWebViewer/NEWS Thu Jun 24 14:19:36 2021 +0200 @@ -1,6 +1,8 @@ Pending changes in the mainline =============================== +* If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives + Version 2.0 (2021-05-27) ======================== diff -r 6f82cd776cf6 -r 9568082ee013 Applications/StoneWebViewer/WebApplication/app.js --- a/Applications/StoneWebViewer/WebApplication/app.js Thu Jun 24 13:53:33 2021 +0200 +++ b/Applications/StoneWebViewer/WebApplication/app.js Thu Jun 24 14:19:36 2021 +0200 @@ -401,6 +401,7 @@ creatingArchive: false, archiveJob: '', mouseTool: 0, + orthancSystem: {}, // Only available if "DicomWebRoot" configuration option is set stoneWebViewerVersion: '...', emscriptenVersion: '...', @@ -998,7 +999,7 @@ } }, - DownloadStudy: function(studyInstanceUid) + DownloadStudy: function(studyInstanceUid, event) { console.log('Creating archive for study: ' + studyInstanceUid); @@ -1010,20 +1011,31 @@ } else { var orthancId = response.data[0]['ID']; - axios.post(that.globalConfiguration.OrthancApiRoot + '/studies/' + orthancId + '/archive', - { - 'Asynchronous' : true - }) - .then(function(response) { - that.creatingArchive = true; - that.archiveJob = response.data.ID; - setTimeout(that.CheckIsDownloadComplete, 1000); - }); + var uri = that.globalConfiguration.OrthancApiRoot + '/studies/' + orthancId + '/archive'; + + if (that.orthancSystem.ApiVersion >= 13) { + // ZIP streaming is available (this is Orthanc >= + // 1.9.4): Simply give the hand to Orthanc + event.preventDefault(); + window.location.href = uri; + + } else { + // ZIP streaming is not available: Create a job to create the archive + axios.post(uri, { + 'Asynchronous' : true + }) + .then(function(response) { + that.creatingArchive = true; + that.archiveJob = response.data.ID; + setTimeout(that.CheckIsDownloadComplete, 1000); + }); + } } }) .catch(function (error) { alert('Cannot find the study in Orthanc'); }); + } }, @@ -1223,6 +1235,13 @@ .catch(function (error) { alert('Cannot load the WebAssembly framework'); }); + + if (app.globalConfiguration.OrthancApiRoot) { + axios.get(app.globalConfiguration.OrthancApiRoot + '/system') + .then(function (response) { + app.orthancSystem = response.data; + }); + } }) .catch(function (error) { alert('Cannot load the configuration file'); diff -r 6f82cd776cf6 -r 9568082ee013 Applications/StoneWebViewer/WebApplication/index.html --- a/Applications/StoneWebViewer/WebApplication/index.html Thu Jun 24 13:53:33 2021 +0200 +++ b/Applications/StoneWebViewer/WebApplication/index.html Thu Jun 24 14:19:36 2021 +0200 @@ -188,7 +188,7 @@ + @click="DownloadStudy(study.tags[STUDY_INSTANCE_UID], $event)">