Mercurial > hg > orthanc
comparison OrthancServer/Plugins/Samples/ConnectivityChecks/WebResources/app.js @ 4044:d25f4c0fa160 framework
splitting code into OrthancFramework and OrthancServer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 10 Jun 2020 20:30:34 +0200 |
parents | Plugins/Samples/ConnectivityChecks/WebResources/app.js@94f4a18a79cc |
children | 4bb7522a63e0 |
comparison
equal
deleted
inserted
replaced
4043:6c6239aec462 | 4044:d25f4c0fa160 |
---|---|
1 /** | |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU General Public License as | |
9 * published by the Free Software Foundation, either version 3 of the | |
10 * License, or (at your option) any later version. | |
11 * | |
12 * In addition, as a special exception, the copyright holders of this | |
13 * program give permission to link the code of its release with the | |
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
15 * that use the same license as the "OpenSSL" library), and distribute | |
16 * the linked executables. You must obey the GNU General Public License | |
17 * in all respects for all of the code used other than "OpenSSL". If you | |
18 * modify file(s) with this exception, you may extend this exception to | |
19 * your version of the file(s), but you are not obligated to do so. If | |
20 * you do not wish to do so, delete this exception statement from your | |
21 * version. If you delete this exception statement from all source files | |
22 * in the program, then also delete it here. | |
23 * | |
24 * This program is distributed in the hope that it will be useful, but | |
25 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
27 * General Public License for more details. | |
28 * | |
29 * You should have received a copy of the GNU General Public License | |
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
31 **/ | |
32 | |
33 | |
34 new Vue({ | |
35 el: '#app', | |
36 data: { | |
37 dicomNodes: {}, | |
38 peers: [], | |
39 canTestPeers: false, | |
40 dicomWebServers: [] | |
41 }, | |
42 methods: { | |
43 toggle: function (todo) { | |
44 todo.done = !todo.done | |
45 }, | |
46 | |
47 testDicomModalities: function () { | |
48 console.log('testing DICOM modalities'); | |
49 axios | |
50 .get('../../modalities?expand') | |
51 .then(response => { | |
52 this.dicomNodes = response.data; | |
53 for (let alias of Object.keys(this.dicomNodes)) { | |
54 this.dicomNodes[alias]['alias'] = alias; | |
55 this.dicomNodes[alias]['status'] = 'testing'; | |
56 axios | |
57 .post('../../modalities/' + alias + '/echo') | |
58 .then(response => { | |
59 this.dicomNodes[alias]['status'] = 'ok'; | |
60 this.$forceUpdate(); | |
61 }) | |
62 .catch(response => { | |
63 this.dicomNodes[alias]['status'] = 'ko'; | |
64 this.$forceUpdate(); | |
65 }) | |
66 } | |
67 }) | |
68 }, | |
69 | |
70 testOrthancPeers: function () { | |
71 console.log('testing Orthanc peers'); | |
72 axios | |
73 .get('../../peers?expand') | |
74 .then(response => { | |
75 this.peers = response.data; | |
76 for (let alias of Object.keys(this.peers)) { | |
77 this.peers[alias]['alias'] = alias; | |
78 | |
79 if (this.canTestPeers) { | |
80 this.peers[alias]['status'] = 'testing'; | |
81 axios | |
82 .get('../../peers/' + alias + '/system') // introduced in ApiVersion 5 only ! | |
83 .then(response => { | |
84 this.peers[alias]['status'] = 'ok'; | |
85 this.$forceUpdate(); | |
86 }) | |
87 .catch(response => { | |
88 this.peers[alias]['status'] = 'ko'; | |
89 this.$forceUpdate(); | |
90 }) | |
91 } | |
92 else { | |
93 this.peers[alias]['status'] = 'unknown'; | |
94 this.$forceUpdate(); | |
95 } | |
96 } | |
97 }) | |
98 }, | |
99 | |
100 testDicomWebServers: function () { | |
101 console.log('testing Dicom-web servers'); | |
102 axios | |
103 .get('../../dicom-web/servers?expand') | |
104 .then(response => { | |
105 this.dicomWebServers = response.data; | |
106 for (let alias of Object.keys(this.dicomWebServers)) { | |
107 this.dicomWebServers[alias]['alias'] = alias; | |
108 this.dicomWebServers[alias]['status'] = 'testing'; | |
109 | |
110 // perform a dummy qido-rs to test the connectivity | |
111 axios | |
112 .post('../../dicom-web/servers/' + alias + '/qido', { | |
113 'Uri' : '/studies', | |
114 'Arguments' : { | |
115 '00100010' : 'CONNECTIVITY^CHECKS' | |
116 } | |
117 }) | |
118 .then(response => { | |
119 this.dicomWebServers[alias]['status'] = 'ok'; | |
120 this.$forceUpdate(); | |
121 }) | |
122 .catch(response => { | |
123 this.dicomWebServers[alias]['status'] = 'ko'; | |
124 this.$forceUpdate(); | |
125 }) | |
126 } | |
127 }) | |
128 }, | |
129 | |
130 }, | |
131 computed: { | |
132 }, | |
133 mounted() { | |
134 axios | |
135 .get('../../system') | |
136 .then(response => { | |
137 this.canTestPeers = response.data.ApiVersion >= 5; | |
138 this.testDicomModalities(); | |
139 if (this.canTestPeers) { | |
140 this.testOrthancPeers(); | |
141 } | |
142 this.testDicomWebServers(); | |
143 }) | |
144 } | |
145 }) |