Mercurial > hg > orthanc-stone
comparison Applications/StoneWebViewer/WebApplication/app.js @ 1842:9568082ee013
If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 24 Jun 2021 14:19:36 +0200 |
parents | 21ccc00839f7 |
children | 251d7f7a6c4e |
comparison
equal
deleted
inserted
replaced
1841:6f82cd776cf6 | 1842:9568082ee013 |
---|---|
399 synchronizedBrowsing: false, | 399 synchronizedBrowsing: false, |
400 globalConfiguration: {}, | 400 globalConfiguration: {}, |
401 creatingArchive: false, | 401 creatingArchive: false, |
402 archiveJob: '', | 402 archiveJob: '', |
403 mouseTool: 0, | 403 mouseTool: 0, |
404 orthancSystem: {}, // Only available if "DicomWebRoot" configuration option is set | |
404 stoneWebViewerVersion: '...', | 405 stoneWebViewerVersion: '...', |
405 emscriptenVersion: '...', | 406 emscriptenVersion: '...', |
406 | 407 |
407 modalWarning: false, | 408 modalWarning: false, |
408 modalNotDiagnostic: false, | 409 modalNotDiagnostic: false, |
996 that.creatingArchive = false; | 997 that.creatingArchive = false; |
997 }); | 998 }); |
998 } | 999 } |
999 }, | 1000 }, |
1000 | 1001 |
1001 DownloadStudy: function(studyInstanceUid) | 1002 DownloadStudy: function(studyInstanceUid, event) |
1002 { | 1003 { |
1003 console.log('Creating archive for study: ' + studyInstanceUid); | 1004 console.log('Creating archive for study: ' + studyInstanceUid); |
1004 | 1005 |
1005 var that = this; | 1006 var that = this; |
1006 axios.post(this.globalConfiguration.OrthancApiRoot + '/tools/lookup', studyInstanceUid) | 1007 axios.post(this.globalConfiguration.OrthancApiRoot + '/tools/lookup', studyInstanceUid) |
1008 if (response.data.length != 1) { | 1009 if (response.data.length != 1) { |
1009 throw(''); | 1010 throw(''); |
1010 } | 1011 } |
1011 else { | 1012 else { |
1012 var orthancId = response.data[0]['ID']; | 1013 var orthancId = response.data[0]['ID']; |
1013 axios.post(that.globalConfiguration.OrthancApiRoot + '/studies/' + orthancId + '/archive', | 1014 var uri = that.globalConfiguration.OrthancApiRoot + '/studies/' + orthancId + '/archive'; |
1014 { | 1015 |
1015 'Asynchronous' : true | 1016 if (that.orthancSystem.ApiVersion >= 13) { |
1016 }) | 1017 // ZIP streaming is available (this is Orthanc >= |
1017 .then(function(response) { | 1018 // 1.9.4): Simply give the hand to Orthanc |
1018 that.creatingArchive = true; | 1019 event.preventDefault(); |
1019 that.archiveJob = response.data.ID; | 1020 window.location.href = uri; |
1020 setTimeout(that.CheckIsDownloadComplete, 1000); | 1021 |
1021 }); | 1022 } else { |
1023 // ZIP streaming is not available: Create a job to create the archive | |
1024 axios.post(uri, { | |
1025 'Asynchronous' : true | |
1026 }) | |
1027 .then(function(response) { | |
1028 that.creatingArchive = true; | |
1029 that.archiveJob = response.data.ID; | |
1030 setTimeout(that.CheckIsDownloadComplete, 1000); | |
1031 }); | |
1032 } | |
1022 } | 1033 } |
1023 }) | 1034 }) |
1024 .catch(function (error) { | 1035 .catch(function (error) { |
1025 alert('Cannot find the study in Orthanc'); | 1036 alert('Cannot find the study in Orthanc'); |
1026 }); | 1037 }); |
1038 | |
1027 } | 1039 } |
1028 }, | 1040 }, |
1029 | 1041 |
1030 mounted: function() { | 1042 mounted: function() { |
1031 this.SetViewportLayout('1x1'); | 1043 this.SetViewportLayout('1x1'); |
1221 document.body.appendChild(script); | 1233 document.body.appendChild(script); |
1222 }) | 1234 }) |
1223 .catch(function (error) { | 1235 .catch(function (error) { |
1224 alert('Cannot load the WebAssembly framework'); | 1236 alert('Cannot load the WebAssembly framework'); |
1225 }); | 1237 }); |
1238 | |
1239 if (app.globalConfiguration.OrthancApiRoot) { | |
1240 axios.get(app.globalConfiguration.OrthancApiRoot + '/system') | |
1241 .then(function (response) { | |
1242 app.orthancSystem = response.data; | |
1243 }); | |
1244 } | |
1226 }) | 1245 }) |
1227 .catch(function (error) { | 1246 .catch(function (error) { |
1228 alert('Cannot load the configuration file'); | 1247 alert('Cannot load the configuration file'); |
1229 }); | 1248 }); |
1230 }); | 1249 }); |