|
1
|
|
|
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[5],{ |
|
2
|
|
|
|
|
3
|
|
|
/***/ 940: |
|
4
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
5
|
|
|
|
|
6
|
|
|
"use strict"; |
|
7
|
|
|
__webpack_require__.r(__webpack_exports__); |
|
8
|
|
|
|
|
9
|
|
|
// EXTERNAL MODULE: /home/salim/GaelO-Dev/OHIF/Viewers/node_modules/react/index.js |
|
10
|
|
|
var react = __webpack_require__(0); |
|
11
|
|
|
var react_default = /*#__PURE__*/__webpack_require__.n(react); |
|
12
|
|
|
|
|
13
|
|
|
// EXTERNAL MODULE: /home/salim/GaelO-Dev/OHIF/Viewers/node_modules/prop-types/index.js |
|
14
|
|
|
var prop_types = __webpack_require__(1); |
|
15
|
|
|
var prop_types_default = /*#__PURE__*/__webpack_require__.n(prop_types); |
|
16
|
|
|
|
|
17
|
|
|
// EXTERNAL MODULE: /home/salim/GaelO-Dev/OHIF/Viewers/node_modules/react-router/esm/react-router.js + 1 modules |
|
18
|
|
|
var react_router = __webpack_require__(75); |
|
19
|
|
|
|
|
20
|
|
|
// EXTERNAL MODULE: /home/salim/GaelO-Dev/OHIF/Viewers/node_modules/react-redux/es/index.js + 21 modules |
|
21
|
|
|
var es = __webpack_require__(59); |
|
22
|
|
|
|
|
23
|
|
|
// EXTERNAL MODULE: /home/salim/GaelO-Dev/OHIF/Viewers/platform/core/src/index.js + 33 modules |
|
24
|
|
|
var src = __webpack_require__(13); |
|
25
|
|
|
|
|
26
|
|
|
// EXTERNAL MODULE: /home/salim/GaelO-Dev/OHIF/Viewers/node_modules/react-i18next/dist/es/index.js + 9 modules |
|
27
|
|
|
var dist_es = __webpack_require__(34); |
|
28
|
|
|
|
|
29
|
|
|
// EXTERNAL MODULE: /home/salim/GaelO-Dev/OHIF/Viewers/platform/ui/src/index.js + 119 modules |
|
30
|
|
|
var ui_src = __webpack_require__(16); |
|
31
|
|
|
|
|
32
|
|
|
// EXTERNAL MODULE: ./connectedComponents/ConnectedHeader.js + 8 modules |
|
33
|
|
|
var ConnectedHeader = __webpack_require__(972); |
|
34
|
|
|
|
|
35
|
|
|
// EXTERNAL MODULE: ./routes/routesUtil.js |
|
36
|
|
|
var routesUtil = __webpack_require__(169); |
|
37
|
|
|
|
|
38
|
|
|
// EXTERNAL MODULE: /home/salim/GaelO-Dev/OHIF/Viewers/node_modules/moment/moment.js |
|
39
|
|
|
var moment = __webpack_require__(6); |
|
40
|
|
|
var moment_default = /*#__PURE__*/__webpack_require__.n(moment); |
|
41
|
|
|
|
|
42
|
|
|
// CONCATENATED MODULE: ./googleCloud/utils/helpers.js |
|
43
|
|
|
function formatFileSize(size) { |
|
44
|
|
|
if (size === 0) return '0 B'; |
|
|
|
|
|
|
45
|
|
|
var n = Math.floor(Math.log(size) / Math.log(1024)); |
|
46
|
|
|
return (size / Math.pow(1024, n)).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][n]; |
|
47
|
|
|
} |
|
48
|
|
|
function httpErrorToStr(error) { |
|
49
|
|
|
if (!error) return 'Unknown error'; |
|
|
|
|
|
|
50
|
|
|
|
|
51
|
|
|
if (error.response) { |
|
52
|
|
|
try { |
|
53
|
|
|
var jsonResponse = JSON.parse(error.response); |
|
54
|
|
|
if (jsonResponse.error && jsonResponse.error.code && jsonResponse.error.message) return jsonResponse.error.code + ' - ' + jsonResponse.error.message; |
|
|
|
|
|
|
55
|
|
|
} catch (err) { |
|
56
|
|
|
return error.response; |
|
57
|
|
|
} |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
return error.message || 'Unknown error.'; |
|
61
|
|
|
} |
|
62
|
|
|
/* eslint-disable */ |
|
63
|
|
|
|
|
64
|
|
|
function checkDicomFile(arrayBuffer) { |
|
65
|
|
|
if (arrayBuffer.length <= 132) return false; |
|
|
|
|
|
|
66
|
|
|
var arr = new Uint8Array(arrayBuffer.slice(128, 132)); // bytes from 128 to 132 must be "DICM" |
|
67
|
|
|
|
|
68
|
|
|
return Array.from('DICM').every(function (char, i) { |
|
69
|
|
|
return char.charCodeAt(0) === arr[i]; |
|
70
|
|
|
}); |
|
71
|
|
|
} |
|
72
|
|
|
// CONCATENATED MODULE: ./googleCloud/utils/CancellationToken.js |
|
73
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
74
|
|
|
|
|
75
|
|
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } |
|
|
|
|
|
|
76
|
|
|
|
|
77
|
|
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } |
|
|
|
|
|
|
78
|
|
|
|
|
79
|
|
|
var CancellationToken = |
|
80
|
|
|
/*#__PURE__*/ |
|
81
|
|
|
function () { |
|
82
|
|
|
function CancellationToken() { |
|
83
|
|
|
_classCallCheck(this, CancellationToken); |
|
84
|
|
|
|
|
85
|
|
|
this.cancelled = false; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
_createClass(CancellationToken, [{ |
|
89
|
|
|
key: "get", |
|
90
|
|
|
value: function get() { |
|
91
|
|
|
return this.cancelled; |
|
92
|
|
|
} |
|
93
|
|
|
}, { |
|
94
|
|
|
key: "set", |
|
95
|
|
|
value: function set(value) { |
|
96
|
|
|
this.cancelled = value; |
|
97
|
|
|
} |
|
98
|
|
|
}]); |
|
99
|
|
|
|
|
100
|
|
|
return CancellationToken; |
|
101
|
|
|
}(); |
|
102
|
|
|
|
|
103
|
|
|
|
|
104
|
|
|
// EXTERNAL MODULE: /home/salim/GaelO-Dev/OHIF/Viewers/node_modules/dicomweb-client/build/dicomweb-client.es.js |
|
105
|
|
|
var dicomweb_client_es = __webpack_require__(27); |
|
106
|
|
|
|
|
107
|
|
|
// EXTERNAL MODULE: /home/salim/GaelO-Dev/OHIF/Viewers/platform/core/src/errorHandler.js |
|
108
|
|
|
var errorHandler = __webpack_require__(36); |
|
109
|
|
|
|
|
110
|
|
|
// CONCATENATED MODULE: ./googleCloud/api/DicomUploadService.js |
|
111
|
|
|
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } |
|
|
|
|
|
|
112
|
|
|
|
|
113
|
|
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } |
|
114
|
|
|
|
|
115
|
|
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } |
|
116
|
|
|
|
|
117
|
|
|
function DicomUploadService_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
118
|
|
|
|
|
119
|
|
|
function DicomUploadService_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } |
|
|
|
|
|
|
120
|
|
|
|
|
121
|
|
|
function DicomUploadService_createClass(Constructor, protoProps, staticProps) { if (protoProps) DicomUploadService_defineProperties(Constructor.prototype, protoProps); if (staticProps) DicomUploadService_defineProperties(Constructor, staticProps); return Constructor; } |
|
|
|
|
|
|
122
|
|
|
|
|
123
|
|
|
|
|
124
|
|
|
|
|
125
|
|
|
|
|
126
|
|
|
|
|
127
|
|
|
var DicomUploadService_DicomUploadService = |
|
128
|
|
|
/*#__PURE__*/ |
|
129
|
|
|
function () { |
|
130
|
|
|
function DicomUploadService() { |
|
131
|
|
|
DicomUploadService_classCallCheck(this, DicomUploadService); |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
DicomUploadService_createClass(DicomUploadService, [{ |
|
135
|
|
|
key: "smartUpload", |
|
136
|
|
|
value: function () { |
|
137
|
|
|
var _smartUpload = _asyncToGenerator( |
|
138
|
|
|
/*#__PURE__*/ |
|
139
|
|
|
regeneratorRuntime.mark(function _callee2(files, url, uploadCallback, cancellationToken) { |
|
|
|
|
|
|
140
|
|
|
var _this = this; |
|
141
|
|
|
|
|
142
|
|
|
var CHUNK_SIZE, MAX_PARALLEL_JOBS, filesArray, parallelJobsCount, completed, processJob; |
|
143
|
|
|
return regeneratorRuntime.wrap(function _callee2$(_context3) { |
|
|
|
|
|
|
144
|
|
|
while (1) { |
|
145
|
|
|
switch (_context3.prev = _context3.next) { |
|
146
|
|
|
case 0: |
|
147
|
|
|
CHUNK_SIZE = 1; // Only one file per request is supported so far |
|
148
|
|
|
|
|
149
|
|
|
MAX_PARALLEL_JOBS = 50; // FIXME: tune MAX_PARALLEL_JOBS number |
|
150
|
|
|
|
|
151
|
|
|
filesArray = Array.from(files); |
|
152
|
|
|
|
|
153
|
|
|
if (!(filesArray.length === 0)) { |
|
|
|
|
|
|
154
|
|
|
_context3.next = 5; |
|
155
|
|
|
break; |
|
156
|
|
|
} |
|
157
|
|
|
|
|
158
|
|
|
throw new Error('No files were provided.'); |
|
159
|
|
|
|
|
160
|
|
|
case 5: |
|
161
|
|
|
parallelJobsCount = Math.min(filesArray.length, MAX_PARALLEL_JOBS); |
|
|
|
|
|
|
162
|
|
|
completed = false; |
|
163
|
|
|
|
|
164
|
|
|
processJob = |
|
165
|
|
|
/*#__PURE__*/ |
|
166
|
|
|
function () { |
|
167
|
|
|
var _ref = _asyncToGenerator( |
|
168
|
|
|
/*#__PURE__*/ |
|
169
|
|
|
regeneratorRuntime.mark(function _callee(resolve, reject) { |
|
|
|
|
|
|
170
|
|
|
var _loop, _ret; |
|
|
|
|
|
|
171
|
|
|
|
|
172
|
|
|
return regeneratorRuntime.wrap(function _callee$(_context2) { |
|
|
|
|
|
|
173
|
|
|
while (1) { |
|
174
|
|
|
switch (_context2.prev = _context2.next) { |
|
175
|
|
|
case 0: |
|
176
|
|
|
_loop = |
|
177
|
|
|
/*#__PURE__*/ |
|
178
|
|
|
regeneratorRuntime.mark(function _loop() { |
|
|
|
|
|
|
179
|
|
|
var chunk, error; |
|
180
|
|
|
return regeneratorRuntime.wrap(function _loop$(_context) { |
|
|
|
|
|
|
181
|
|
|
while (1) { |
|
182
|
|
|
switch (_context.prev = _context.next) { |
|
183
|
|
|
case 0: |
|
184
|
|
|
if (!cancellationToken.get()) { |
|
185
|
|
|
_context.next = 2; |
|
186
|
|
|
break; |
|
187
|
|
|
} |
|
188
|
|
|
|
|
189
|
|
|
return _context.abrupt("return", { |
|
190
|
|
|
v: void 0 |
|
|
|
|
|
|
191
|
|
|
}); |
|
192
|
|
|
|
|
193
|
|
|
case 2: |
|
194
|
|
|
chunk = filesArray.slice(0, CHUNK_SIZE); |
|
|
|
|
|
|
195
|
|
|
filesArray = filesArray.slice(CHUNK_SIZE); |
|
196
|
|
|
error = null; |
|
197
|
|
|
_context.prev = 5; |
|
198
|
|
|
|
|
199
|
|
|
if (!(chunk.length > 1)) { |
|
|
|
|
|
|
200
|
|
|
_context.next = 8; |
|
201
|
|
|
break; |
|
202
|
|
|
} |
|
203
|
|
|
|
|
204
|
|
|
throw new Error('Not implemented'); |
|
205
|
|
|
|
|
206
|
|
|
case 8: |
|
207
|
|
|
if (!(chunk.length === 1)) { |
|
|
|
|
|
|
208
|
|
|
_context.next = 11; |
|
209
|
|
|
break; |
|
210
|
|
|
} |
|
211
|
|
|
|
|
212
|
|
|
_context.next = 11; |
|
213
|
|
|
return _this.simpleUpload(chunk[0], url); |
|
214
|
|
|
|
|
215
|
|
|
case 11: |
|
216
|
|
|
_context.next = 16; |
|
217
|
|
|
break; |
|
218
|
|
|
|
|
219
|
|
|
case 13: |
|
220
|
|
|
_context.prev = 13; |
|
221
|
|
|
_context.t0 = _context["catch"](5); |
|
222
|
|
|
// It looks like a stupid bug of Babel that err is not an actual Exception object |
|
223
|
|
|
error = httpErrorToStr(_context.t0); |
|
|
|
|
|
|
224
|
|
|
|
|
225
|
|
|
case 16: |
|
226
|
|
|
chunk.forEach(function (file) { |
|
227
|
|
|
return uploadCallback(file.fileId, error); |
|
|
|
|
|
|
228
|
|
|
}); |
|
229
|
|
|
|
|
230
|
|
|
if (!(!completed && filesArray.length === 0)) { |
|
231
|
|
|
_context.next = 21; |
|
232
|
|
|
break; |
|
233
|
|
|
} |
|
234
|
|
|
|
|
235
|
|
|
completed = true; |
|
236
|
|
|
resolve(); |
|
237
|
|
|
return _context.abrupt("return", { |
|
238
|
|
|
v: void 0 |
|
|
|
|
|
|
239
|
|
|
}); |
|
240
|
|
|
|
|
241
|
|
|
case 21: |
|
242
|
|
|
case "end": |
|
243
|
|
|
return _context.stop(); |
|
244
|
|
|
} |
|
245
|
|
|
} |
|
|
|
|
|
|
246
|
|
|
}, _loop, null, [[5, 13]]); |
|
|
|
|
|
|
247
|
|
|
}); |
|
|
|
|
|
|
248
|
|
|
|
|
249
|
|
|
case 1: |
|
250
|
|
|
if (!(filesArray.length > 0)) { |
|
|
|
|
|
|
251
|
|
|
_context2.next = 8; |
|
252
|
|
|
break; |
|
253
|
|
|
} |
|
254
|
|
|
|
|
255
|
|
|
return _context2.delegateYield(_loop(), "t0", 3); |
|
256
|
|
|
|
|
257
|
|
|
case 3: |
|
258
|
|
|
_ret = _context2.t0; |
|
259
|
|
|
|
|
260
|
|
|
if (!(_typeof(_ret) === "object")) { |
|
|
|
|
|
|
261
|
|
|
_context2.next = 6; |
|
262
|
|
|
break; |
|
263
|
|
|
} |
|
264
|
|
|
|
|
265
|
|
|
return _context2.abrupt("return", _ret.v); |
|
266
|
|
|
|
|
267
|
|
|
case 6: |
|
268
|
|
|
_context2.next = 1; |
|
269
|
|
|
break; |
|
270
|
|
|
|
|
271
|
|
|
case 8: |
|
272
|
|
|
case "end": |
|
273
|
|
|
return _context2.stop(); |
|
274
|
|
|
} |
|
275
|
|
|
} |
|
|
|
|
|
|
276
|
|
|
}, _callee); |
|
277
|
|
|
})); |
|
278
|
|
|
|
|
279
|
|
|
return function processJob(_x5, _x6) { |
|
|
|
|
|
|
280
|
|
|
return _ref.apply(this, arguments); |
|
281
|
|
|
}; |
|
282
|
|
|
}(); |
|
283
|
|
|
|
|
284
|
|
|
_context3.next = 10; |
|
285
|
|
|
return new Promise(function (resolve) { |
|
286
|
|
|
for (var i = 0; i < parallelJobsCount; i++) { |
|
287
|
|
|
processJob(resolve); |
|
288
|
|
|
} |
|
289
|
|
|
}); |
|
290
|
|
|
|
|
291
|
|
|
case 10: |
|
292
|
|
|
case "end": |
|
293
|
|
|
return _context3.stop(); |
|
294
|
|
|
} |
|
295
|
|
|
} |
|
|
|
|
|
|
296
|
|
|
}, _callee2); |
|
297
|
|
|
})); |
|
298
|
|
|
|
|
299
|
|
|
function smartUpload(_x, _x2, _x3, _x4) { |
|
|
|
|
|
|
300
|
|
|
return _smartUpload.apply(this, arguments); |
|
301
|
|
|
} |
|
302
|
|
|
|
|
303
|
|
|
return smartUpload; |
|
304
|
|
|
}() |
|
305
|
|
|
}, { |
|
306
|
|
|
key: "simpleUpload", |
|
307
|
|
|
value: function () { |
|
308
|
|
|
var _simpleUpload = _asyncToGenerator( |
|
309
|
|
|
/*#__PURE__*/ |
|
310
|
|
|
regeneratorRuntime.mark(function _callee3(file, url) { |
|
|
|
|
|
|
311
|
|
|
var client, loadedFile, content; |
|
312
|
|
|
return regeneratorRuntime.wrap(function _callee3$(_context4) { |
|
|
|
|
|
|
313
|
|
|
while (1) { |
|
314
|
|
|
switch (_context4.prev = _context4.next) { |
|
315
|
|
|
case 0: |
|
316
|
|
|
client = this.getClient(url); |
|
317
|
|
|
_context4.next = 3; |
|
318
|
|
|
return this.readFile(file); |
|
319
|
|
|
|
|
320
|
|
|
case 3: |
|
321
|
|
|
loadedFile = _context4.sent; |
|
322
|
|
|
content = loadedFile.content; |
|
|
|
|
|
|
323
|
|
|
|
|
324
|
|
|
if (checkDicomFile(content)) { |
|
|
|
|
|
|
325
|
|
|
_context4.next = 7; |
|
326
|
|
|
break; |
|
327
|
|
|
} |
|
328
|
|
|
|
|
329
|
|
|
throw new Error('This is not a valid DICOM file.'); |
|
330
|
|
|
|
|
331
|
|
|
case 7: |
|
332
|
|
|
_context4.next = 9; |
|
333
|
|
|
return client.storeInstances({ |
|
334
|
|
|
datasets: [content] |
|
|
|
|
|
|
335
|
|
|
}); |
|
336
|
|
|
|
|
337
|
|
|
case 9: |
|
338
|
|
|
case "end": |
|
339
|
|
|
return _context4.stop(); |
|
340
|
|
|
} |
|
341
|
|
|
} |
|
|
|
|
|
|
342
|
|
|
}, _callee3, this); |
|
343
|
|
|
})); |
|
344
|
|
|
|
|
345
|
|
|
function simpleUpload(_x7, _x8) { |
|
|
|
|
|
|
346
|
|
|
return _simpleUpload.apply(this, arguments); |
|
347
|
|
|
} |
|
348
|
|
|
|
|
349
|
|
|
return simpleUpload; |
|
350
|
|
|
}() |
|
351
|
|
|
}, { |
|
352
|
|
|
key: "readFile", |
|
353
|
|
|
value: function readFile(file) { |
|
354
|
|
|
return new Promise(function (resolve, reject) { |
|
355
|
|
|
var reader = new FileReader(); |
|
|
|
|
|
|
356
|
|
|
|
|
357
|
|
|
reader.onload = function () { |
|
358
|
|
|
resolve({ |
|
359
|
|
|
name: file.name, |
|
360
|
|
|
size: file.size, |
|
361
|
|
|
type: file.type, |
|
362
|
|
|
content: reader.result |
|
363
|
|
|
}); |
|
364
|
|
|
}; |
|
365
|
|
|
|
|
366
|
|
|
reader.onerror = function (error) { |
|
367
|
|
|
return reject(error); |
|
368
|
|
|
}; |
|
369
|
|
|
|
|
370
|
|
|
reader.readAsArrayBuffer(file); |
|
371
|
|
|
}); |
|
372
|
|
|
} |
|
373
|
|
|
}, { |
|
374
|
|
|
key: "setRetrieveAuthHeaderFunction", |
|
375
|
|
|
value: function setRetrieveAuthHeaderFunction(func) { |
|
376
|
|
|
this.retrieveAuthHeaderFunc = func; |
|
377
|
|
|
} |
|
378
|
|
|
}, { |
|
379
|
|
|
key: "getClient", |
|
380
|
|
|
value: function getClient(url) { |
|
381
|
|
|
var headers = this.retrieveAuthHeaderFunc(); |
|
382
|
|
|
var errorInterceptor = errorHandler["a" /* default */].getHTTPErrorHandler(); // TODO: a bit weird we are creating a new dicomweb client instance for every upload |
|
|
|
|
|
|
383
|
|
|
|
|
384
|
|
|
return new dicomweb_client_es["a" /* api */].DICOMwebClient({ |
|
385
|
|
|
url: url, |
|
386
|
|
|
headers: headers |
|
387
|
|
|
}); |
|
388
|
|
|
} |
|
389
|
|
|
}]); |
|
390
|
|
|
|
|
391
|
|
|
return DicomUploadService; |
|
392
|
|
|
}(); |
|
393
|
|
|
|
|
394
|
|
|
/* harmony default export */ var api_DicomUploadService = (new DicomUploadService_DicomUploadService()); |
|
395
|
|
|
// EXTERNAL MODULE: ./googleCloud/DicomUploader.css |
|
396
|
|
|
var googleCloud_DicomUploader = __webpack_require__(988); |
|
|
|
|
|
|
397
|
|
|
|
|
398
|
|
|
// CONCATENATED MODULE: ./googleCloud/DicomUploader.js |
|
399
|
|
|
function DicomUploader_typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { DicomUploader_typeof = function _typeof(obj) { return typeof obj; }; } else { DicomUploader_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return DicomUploader_typeof(obj); } |
|
|
|
|
|
|
400
|
|
|
|
|
401
|
|
|
function DicomUploader_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
402
|
|
|
|
|
403
|
|
|
function DicomUploader_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } |
|
|
|
|
|
|
404
|
|
|
|
|
405
|
|
|
function DicomUploader_createClass(Constructor, protoProps, staticProps) { if (protoProps) DicomUploader_defineProperties(Constructor.prototype, protoProps); if (staticProps) DicomUploader_defineProperties(Constructor, staticProps); return Constructor; } |
|
|
|
|
|
|
406
|
|
|
|
|
407
|
|
|
function _possibleConstructorReturn(self, call) { if (call && (DicomUploader_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } |
|
408
|
|
|
|
|
409
|
|
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } |
|
410
|
|
|
|
|
411
|
|
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } |
|
|
|
|
|
|
412
|
|
|
|
|
413
|
|
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } |
|
|
|
|
|
|
414
|
|
|
|
|
415
|
|
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } |
|
416
|
|
|
|
|
417
|
|
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
|
418
|
|
|
|
|
419
|
|
|
|
|
420
|
|
|
|
|
421
|
|
|
|
|
422
|
|
|
|
|
423
|
|
|
|
|
424
|
|
|
|
|
425
|
|
|
|
|
426
|
|
|
var DicomUploader_DicomUploader = |
|
427
|
|
|
/*#__PURE__*/ |
|
428
|
|
|
function (_Component) { |
|
429
|
|
|
_inherits(DicomUploader, _Component); |
|
430
|
|
|
|
|
431
|
|
|
function DicomUploader() { |
|
432
|
|
|
var _getPrototypeOf2; |
|
433
|
|
|
|
|
434
|
|
|
var _this; |
|
435
|
|
|
|
|
436
|
|
|
DicomUploader_classCallCheck(this, DicomUploader); |
|
437
|
|
|
|
|
438
|
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
|
|
|
|
|
|
439
|
|
|
args[_key] = arguments[_key]; |
|
440
|
|
|
} |
|
441
|
|
|
|
|
442
|
|
|
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(DicomUploader)).call.apply(_getPrototypeOf2, [this].concat(args))); |
|
443
|
|
|
|
|
444
|
|
|
_defineProperty(_assertThisInitialized(_this), "state", { |
|
445
|
|
|
status: 'Upload', |
|
446
|
|
|
isCancelled: false, |
|
447
|
|
|
errorsCount: 0, |
|
448
|
|
|
files: null, |
|
449
|
|
|
uploadedVolume: null, |
|
450
|
|
|
wholeVolumeStr: null, |
|
451
|
|
|
isFilesListHidden: true, |
|
452
|
|
|
timeLeft: null, |
|
453
|
|
|
uploadedList: null, |
|
454
|
|
|
totalCount: 0, |
|
455
|
|
|
successfullyUploadedCount: 0, |
|
456
|
|
|
lastFile: '', |
|
457
|
|
|
uploadContext: null // this is probably not needed, but we use this variable to distinguish between different downloads |
|
458
|
|
|
|
|
459
|
|
|
}); |
|
460
|
|
|
|
|
461
|
|
|
_defineProperty(_assertThisInitialized(_this), "uploadFiles", function (files) { |
|
462
|
|
|
var filesArray = Array.from(files.target.files); |
|
463
|
|
|
var filesDict = {}; |
|
464
|
|
|
filesArray.forEach(function (file, i) { |
|
465
|
|
|
var fileDesc = { |
|
466
|
|
|
id: i, |
|
467
|
|
|
name: file.name, |
|
468
|
|
|
path: file.webkitRelativePath || file.name, |
|
469
|
|
|
size: file.size, |
|
470
|
|
|
error: null, |
|
471
|
|
|
processed: false, |
|
472
|
|
|
processedInUI: false |
|
473
|
|
|
}; |
|
474
|
|
|
filesDict[i] = fileDesc; |
|
475
|
|
|
file.fileId = i; |
|
476
|
|
|
}); |
|
477
|
|
|
var wholeVolume = filesArray.map(function (f) { |
|
478
|
|
|
return f.size; |
|
479
|
|
|
}).reduce(function (a, b) { |
|
480
|
|
|
return a + b; |
|
481
|
|
|
}); |
|
482
|
|
|
var uploadContext = Math.random(); |
|
483
|
|
|
|
|
484
|
|
|
_this.setState({ |
|
485
|
|
|
status: 'Uploading...', |
|
486
|
|
|
files: filesDict, |
|
487
|
|
|
uploadedList: [], |
|
488
|
|
|
uploadedVolume: 0, |
|
489
|
|
|
lastFile: filesArray[0].name, |
|
490
|
|
|
totalCount: filesArray.length, |
|
491
|
|
|
wholeVolumeStr: formatFileSize(wholeVolume), |
|
492
|
|
|
uploadContext: uploadContext, |
|
493
|
|
|
cancellationToken: new CancellationToken() |
|
494
|
|
|
}); |
|
495
|
|
|
|
|
496
|
|
|
var cancellationToken = new CancellationToken(); |
|
497
|
|
|
|
|
498
|
|
|
var uploadCallback = function uploadCallback(fileId, error) { |
|
499
|
|
|
return uploadContext === _this.state.uploadContext && _this.uploadCallback.call(_assertThisInitialized(_this), fileId, error); |
|
500
|
|
|
}; |
|
501
|
|
|
|
|
502
|
|
|
api_DicomUploadService.setRetrieveAuthHeaderFunction(_this.props.retrieveAuthHeaderFunction); |
|
503
|
|
|
api_DicomUploadService.smartUpload(files.target.files, _this.props.url, uploadCallback, cancellationToken); |
|
504
|
|
|
}); |
|
505
|
|
|
|
|
506
|
|
|
_defineProperty(_assertThisInitialized(_this), "renderTableRow", function (file) { |
|
507
|
|
|
var error = null; |
|
508
|
|
|
|
|
509
|
|
|
if (file.error !== null) { |
|
510
|
|
|
error = react_default.a.createElement("p", { |
|
511
|
|
|
style: { |
|
512
|
|
|
color: 'red' |
|
513
|
|
|
} |
|
514
|
|
|
}, file.error); |
|
515
|
|
|
} |
|
516
|
|
|
|
|
517
|
|
|
return react_default.a.createElement("tr", { |
|
518
|
|
|
key: file.id |
|
519
|
|
|
}, react_default.a.createElement("td", { |
|
520
|
|
|
className: "project" |
|
521
|
|
|
}, file.name, " ", error)); |
|
522
|
|
|
}); |
|
523
|
|
|
|
|
524
|
|
|
return _this; |
|
525
|
|
|
} |
|
526
|
|
|
|
|
527
|
|
|
DicomUploader_createClass(DicomUploader, [{ |
|
528
|
|
|
key: "filesLeft", |
|
529
|
|
|
value: function filesLeft() { |
|
530
|
|
|
return this.state.uploadedList.length + ' of ' + this.state.totalCount + ' files'; |
|
531
|
|
|
} |
|
532
|
|
|
}, { |
|
533
|
|
|
key: "volumeLeft", |
|
534
|
|
|
value: function volumeLeft() { |
|
535
|
|
|
var left = formatFileSize(this.state.uploadedVolume); |
|
536
|
|
|
return left + ' of ' + this.state.wholeVolumeStr; |
|
537
|
|
|
} |
|
538
|
|
|
}, { |
|
539
|
|
|
key: "percents", |
|
540
|
|
|
value: function percents() { |
|
541
|
|
|
return parseInt(100 * this.state.uploadedList.length / Object.keys(this.state.files).length); |
|
542
|
|
|
} |
|
543
|
|
|
}, { |
|
544
|
|
|
key: "isFinished", |
|
545
|
|
|
value: function isFinished() { |
|
546
|
|
|
return this.state.isCancelled || Object.keys(this.state.files).length === this.state.uploadedList.length; |
|
547
|
|
|
} |
|
548
|
|
|
}, { |
|
549
|
|
|
key: "errorsMessage", |
|
550
|
|
|
value: function errorsMessage() { |
|
551
|
|
|
var errors = this.state.errorsCount === 1 ? ' error' : ' errors'; |
|
552
|
|
|
return this.state.errorsCount + errors + ' while uploading, click for more info'; |
|
553
|
|
|
} |
|
554
|
|
|
}, { |
|
555
|
|
|
key: "uploadCallback", |
|
556
|
|
|
value: function uploadCallback(fileId, error) { |
|
557
|
|
|
var file = this.state.files[fileId]; |
|
558
|
|
|
file.processed = true; |
|
559
|
|
|
|
|
560
|
|
|
if (!error) { |
|
561
|
|
|
var uploadedVolume = this.state.uploadedVolume + file.size; |
|
562
|
|
|
this.setState({ |
|
563
|
|
|
uploadedVolume: uploadedVolume |
|
564
|
|
|
}); |
|
565
|
|
|
} else { |
|
566
|
|
|
file.error = error; |
|
567
|
|
|
this.setState({ |
|
568
|
|
|
errorsCount: this.state.errorsCount + 1 |
|
569
|
|
|
}); |
|
570
|
|
|
} |
|
571
|
|
|
|
|
572
|
|
|
this.setState({ |
|
573
|
|
|
lastFile: file.name |
|
574
|
|
|
}); |
|
575
|
|
|
var uploadedList = this.state.uploadedList; |
|
576
|
|
|
uploadedList.push(file); |
|
577
|
|
|
this.setState({ |
|
578
|
|
|
uploadedList: uploadedList |
|
579
|
|
|
}); |
|
580
|
|
|
} |
|
581
|
|
|
}, { |
|
582
|
|
|
key: "render", |
|
583
|
|
|
value: function render() { |
|
584
|
|
|
if (this.state.files === null) { |
|
585
|
|
|
return react_default.a.createElement("div", { |
|
586
|
|
|
className: "dicom-uploader" |
|
587
|
|
|
}, react_default.a.createElement("div", { |
|
588
|
|
|
className: "button" |
|
589
|
|
|
}, react_default.a.createElement("label", { |
|
590
|
|
|
htmlFor: "file" |
|
591
|
|
|
}, react_default.a.createElement("img", { |
|
592
|
|
|
src: "./assets/Button_File.svg", |
|
593
|
|
|
alt: "upload file" |
|
594
|
|
|
})), react_default.a.createElement("input", { |
|
595
|
|
|
className: "invisible-input", |
|
596
|
|
|
onChange: this.uploadFiles, |
|
597
|
|
|
type: "file", |
|
598
|
|
|
id: "file", |
|
599
|
|
|
multiple: true |
|
600
|
|
|
})), react_default.a.createElement("div", { |
|
601
|
|
|
className: "button" |
|
602
|
|
|
}, react_default.a.createElement("label", { |
|
603
|
|
|
htmlFor: "folder" |
|
604
|
|
|
}, react_default.a.createElement("img", { |
|
605
|
|
|
src: "./assets/Button_Folder.svg", |
|
606
|
|
|
alt: "upload folder" |
|
607
|
|
|
})), react_default.a.createElement("input", { |
|
608
|
|
|
className: "invisible-input", |
|
609
|
|
|
type: "file", |
|
610
|
|
|
onChange: this.uploadFiles, |
|
611
|
|
|
id: "folder", |
|
612
|
|
|
webkitdirectory: "true", |
|
613
|
|
|
mozdirectory: "true", |
|
614
|
|
|
multiple: true |
|
615
|
|
|
}))); |
|
616
|
|
|
} |
|
617
|
|
|
|
|
618
|
|
|
return react_default.a.createElement("table", { |
|
619
|
|
|
id: "tblProjectList", |
|
620
|
|
|
className: "table noselect" |
|
621
|
|
|
}, react_default.a.createElement("thead", null, react_default.a.createElement("tr", null, react_default.a.createElement("th", { |
|
622
|
|
|
className: "table-header" |
|
623
|
|
|
}, this.percents(), "% ", this.filesLeft()))), react_default.a.createElement("tbody", { |
|
624
|
|
|
id: "ProjectList" |
|
625
|
|
|
}, this.state.uploadedList.map(this.renderTableRow))); |
|
626
|
|
|
} |
|
627
|
|
|
}]); |
|
628
|
|
|
|
|
629
|
|
|
return DicomUploader; |
|
630
|
|
|
}(react["Component"]); |
|
631
|
|
|
|
|
632
|
|
|
_defineProperty(DicomUploader_DicomUploader, "propTypes", { |
|
633
|
|
|
id: prop_types_default.a.string, |
|
634
|
|
|
event: prop_types_default.a.string, |
|
635
|
|
|
url: prop_types_default.a.string, |
|
636
|
|
|
retrieveAuthHeaderFunction: prop_types_default.a.func |
|
637
|
|
|
}); |
|
638
|
|
|
|
|
639
|
|
|
|
|
640
|
|
|
// EXTERNAL MODULE: ./App.js + 33 modules |
|
641
|
|
|
var App = __webpack_require__(253); |
|
642
|
|
|
|
|
643
|
|
|
// CONCATENATED MODULE: ./googleCloud/DicomFileUploaderModal.js |
|
644
|
|
|
|
|
645
|
|
|
|
|
646
|
|
|
|
|
647
|
|
|
|
|
648
|
|
|
|
|
649
|
|
|
|
|
650
|
|
|
function DicomFileUploaderModal(_ref) { |
|
651
|
|
|
var _ref$isOpen = _ref.isOpen, |
|
652
|
|
|
isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen, |
|
|
|
|
|
|
653
|
|
|
onClose = _ref.onClose, |
|
654
|
|
|
url = _ref.url, |
|
655
|
|
|
retrieveAuthHeaderFunction = _ref.retrieveAuthHeaderFunction, |
|
656
|
|
|
t = _ref.t; |
|
657
|
|
|
var UIModalService = App["e" /* servicesManager */].services.UIModalService; |
|
658
|
|
|
|
|
659
|
|
|
var showDicomStorePickerModal = function showDicomStorePickerModal() { |
|
660
|
|
|
if (!UIModalService) { |
|
661
|
|
|
return; |
|
662
|
|
|
} |
|
663
|
|
|
|
|
664
|
|
|
UIModalService.show({ |
|
665
|
|
|
content: DicomUploader_DicomUploader, |
|
666
|
|
|
title: t('Upload DICOM Files'), |
|
667
|
|
|
contentProps: { |
|
668
|
|
|
url: url, |
|
669
|
|
|
retrieveAuthHeaderFunction: retrieveAuthHeaderFunction |
|
670
|
|
|
}, |
|
671
|
|
|
onClose: onClose |
|
672
|
|
|
}); |
|
673
|
|
|
}; |
|
674
|
|
|
|
|
675
|
|
|
return react_default.a.createElement(react_default.a.Fragment, null, isOpen && showDicomStorePickerModal()); |
|
676
|
|
|
} |
|
677
|
|
|
|
|
678
|
|
|
DicomFileUploaderModal.propTypes = { |
|
679
|
|
|
isOpen: prop_types_default.a.bool.isRequired, |
|
680
|
|
|
retrieveAuthHeaderFunction: prop_types_default.a.func.isRequired, |
|
681
|
|
|
onClose: prop_types_default.a.func, |
|
682
|
|
|
url: prop_types_default.a.string |
|
683
|
|
|
}; |
|
684
|
|
|
/* harmony default export */ var googleCloud_DicomFileUploaderModal = (Object(dist_es["d" /* withTranslation */])('Common')(DicomFileUploaderModal)); |
|
685
|
|
|
// CONCATENATED MODULE: ./googleCloud/ConnectedDicomFilesUploader.js |
|
686
|
|
|
|
|
687
|
|
|
|
|
688
|
|
|
|
|
689
|
|
|
|
|
690
|
|
|
var isActive = function isActive(a) { |
|
691
|
|
|
return a.active === true; |
|
692
|
|
|
}; |
|
693
|
|
|
|
|
694
|
|
|
var ConnectedDicomFilesUploader_mapStateToProps = function mapStateToProps(state) { |
|
695
|
|
|
var activeServer = state.servers.servers.find(isActive); // TODO: Not sure I like this approach since it means we are recreating |
|
696
|
|
|
// this function every time redux changes |
|
697
|
|
|
|
|
698
|
|
|
var retrieveAuthHeaderFunction = function retrieveAuthHeaderFunction() { |
|
699
|
|
|
return src["a" /* default */].DICOMWeb.getAuthorizationHeader(activeServer); |
|
700
|
|
|
}; |
|
701
|
|
|
|
|
702
|
|
|
return { |
|
703
|
|
|
retrieveAuthHeaderFunction: retrieveAuthHeaderFunction, |
|
704
|
|
|
url: activeServer && activeServer.qidoRoot |
|
705
|
|
|
}; |
|
706
|
|
|
}; |
|
707
|
|
|
|
|
708
|
|
|
var ConnectedDicomFileUploader = Object(es["b" /* connect */])(ConnectedDicomFilesUploader_mapStateToProps, null)(googleCloud_DicomFileUploaderModal); |
|
709
|
|
|
/* harmony default export */ var ConnectedDicomFilesUploader = (ConnectedDicomFileUploader); |
|
710
|
|
|
// EXTERNAL MODULE: ./googleCloud/api/GoogleCloudApi.js |
|
711
|
|
|
var GoogleCloudApi = __webpack_require__(958); |
|
712
|
|
|
|
|
713
|
|
|
// EXTERNAL MODULE: ./googleCloud/googleCloud.css |
|
714
|
|
|
var googleCloud = __webpack_require__(956); |
|
|
|
|
|
|
715
|
|
|
|
|
716
|
|
|
// CONCATENATED MODULE: ./googleCloud/DicomStoreList.js |
|
717
|
|
|
function DicomStoreList_typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { DicomStoreList_typeof = function _typeof(obj) { return typeof obj; }; } else { DicomStoreList_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return DicomStoreList_typeof(obj); } |
|
|
|
|
|
|
718
|
|
|
|
|
719
|
|
|
function DicomStoreList_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
720
|
|
|
|
|
721
|
|
|
function DicomStoreList_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } |
|
|
|
|
|
|
722
|
|
|
|
|
723
|
|
|
function DicomStoreList_createClass(Constructor, protoProps, staticProps) { if (protoProps) DicomStoreList_defineProperties(Constructor.prototype, protoProps); if (staticProps) DicomStoreList_defineProperties(Constructor, staticProps); return Constructor; } |
|
|
|
|
|
|
724
|
|
|
|
|
725
|
|
|
function DicomStoreList_possibleConstructorReturn(self, call) { if (call && (DicomStoreList_typeof(call) === "object" || typeof call === "function")) { return call; } return DicomStoreList_assertThisInitialized(self); } |
|
726
|
|
|
|
|
727
|
|
|
function DicomStoreList_getPrototypeOf(o) { DicomStoreList_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return DicomStoreList_getPrototypeOf(o); } |
|
|
|
|
|
|
728
|
|
|
|
|
729
|
|
|
function DicomStoreList_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } |
|
|
|
|
|
|
730
|
|
|
|
|
731
|
|
|
function DicomStoreList_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) DicomStoreList_setPrototypeOf(subClass, superClass); } |
|
|
|
|
|
|
732
|
|
|
|
|
733
|
|
|
function DicomStoreList_setPrototypeOf(o, p) { DicomStoreList_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return DicomStoreList_setPrototypeOf(o, p); } |
|
|
|
|
|
|
734
|
|
|
|
|
735
|
|
|
function DicomStoreList_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
|
736
|
|
|
|
|
737
|
|
|
|
|
738
|
|
|
|
|
739
|
|
|
|
|
740
|
|
|
|
|
741
|
|
|
|
|
742
|
|
|
|
|
743
|
|
|
var DicomStoreList_DicomStoreList = |
|
744
|
|
|
/*#__PURE__*/ |
|
745
|
|
|
function (_Component) { |
|
746
|
|
|
DicomStoreList_inherits(DicomStoreList, _Component); |
|
747
|
|
|
|
|
748
|
|
|
function DicomStoreList() { |
|
749
|
|
|
var _getPrototypeOf2; |
|
750
|
|
|
|
|
751
|
|
|
var _this; |
|
752
|
|
|
|
|
753
|
|
|
DicomStoreList_classCallCheck(this, DicomStoreList); |
|
754
|
|
|
|
|
755
|
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
|
|
|
|
|
|
756
|
|
|
args[_key] = arguments[_key]; |
|
757
|
|
|
} |
|
758
|
|
|
|
|
759
|
|
|
_this = DicomStoreList_possibleConstructorReturn(this, (_getPrototypeOf2 = DicomStoreList_getPrototypeOf(DicomStoreList)).call.apply(_getPrototypeOf2, [this].concat(args))); |
|
760
|
|
|
|
|
761
|
|
|
DicomStoreList_defineProperty(DicomStoreList_assertThisInitialized(_this), "state", { |
|
762
|
|
|
search: '' |
|
763
|
|
|
}); |
|
764
|
|
|
|
|
765
|
|
|
DicomStoreList_defineProperty(DicomStoreList_assertThisInitialized(_this), "renderTableRow", function (store) { |
|
766
|
|
|
return react_default.a.createElement("tr", { |
|
767
|
|
|
key: store.name, |
|
768
|
|
|
className: _this.state.highlightedItem === store.name ? 'noselect active' : 'noselect', |
|
769
|
|
|
onMouseEnter: function onMouseEnter() { |
|
770
|
|
|
_this.onHighlightItem(store.name); |
|
771
|
|
|
}, |
|
772
|
|
|
onClick: function onClick() { |
|
773
|
|
|
_this.props.onSelect(store); |
|
774
|
|
|
} |
|
775
|
|
|
}, react_default.a.createElement("td", { |
|
776
|
|
|
className: "project" |
|
777
|
|
|
}, store.name.split('/')[7])); |
|
778
|
|
|
}); |
|
779
|
|
|
|
|
780
|
|
|
return _this; |
|
781
|
|
|
} |
|
782
|
|
|
|
|
783
|
|
|
DicomStoreList_createClass(DicomStoreList, [{ |
|
784
|
|
|
key: "onHighlightItem", |
|
785
|
|
|
value: function onHighlightItem(store) { |
|
786
|
|
|
this.setState({ |
|
787
|
|
|
highlightedItem: store |
|
788
|
|
|
}); |
|
789
|
|
|
} |
|
790
|
|
|
}, { |
|
791
|
|
|
key: "render", |
|
792
|
|
|
value: function render() { |
|
793
|
|
|
var _this$props = this.props, |
|
794
|
|
|
loading = _this$props.loading, |
|
795
|
|
|
stores = _this$props.stores, |
|
796
|
|
|
filter = _this$props.filter, |
|
797
|
|
|
error = _this$props.error; |
|
798
|
|
|
|
|
799
|
|
|
if (error) { |
|
800
|
|
|
return react_default.a.createElement("p", null, error); |
|
801
|
|
|
} |
|
802
|
|
|
|
|
803
|
|
|
var loadingIcon = react_default.a.createElement(ui_src["j" /* Icon */], { |
|
804
|
|
|
name: "circle-notch", |
|
805
|
|
|
className: "loading-icon-spin loading-icon" |
|
806
|
|
|
}); |
|
807
|
|
|
|
|
808
|
|
|
if (loading) { |
|
809
|
|
|
return loadingIcon; |
|
810
|
|
|
} |
|
811
|
|
|
|
|
812
|
|
|
var body = react_default.a.createElement("tbody", { |
|
813
|
|
|
id: "StoreList" |
|
814
|
|
|
}, stores.filter(function (store) { |
|
815
|
|
|
return store.name.split('/')[7].toLowerCase().includes(filter.toLowerCase()) || filter == ""; |
|
816
|
|
|
}).map(this.renderTableRow)); |
|
817
|
|
|
return react_default.a.createElement("table", { |
|
818
|
|
|
id: "tblStoreList", |
|
819
|
|
|
className: "gcp-table table noselect" |
|
820
|
|
|
}, react_default.a.createElement("thead", null, react_default.a.createElement("tr", null, react_default.a.createElement("th", null, this.props.t('DICOM Store')))), stores && body); |
|
821
|
|
|
} |
|
822
|
|
|
}]); |
|
823
|
|
|
|
|
824
|
|
|
return DicomStoreList; |
|
825
|
|
|
}(react["Component"]); |
|
826
|
|
|
|
|
827
|
|
|
DicomStoreList_defineProperty(DicomStoreList_DicomStoreList, "propTypes", { |
|
828
|
|
|
stores: prop_types_default.a.array, |
|
829
|
|
|
loading: prop_types_default.a.bool.isRequired, |
|
830
|
|
|
error: prop_types_default.a.string, |
|
831
|
|
|
onSelect: prop_types_default.a.func |
|
832
|
|
|
}); |
|
833
|
|
|
|
|
834
|
|
|
DicomStoreList_defineProperty(DicomStoreList_DicomStoreList, "defaultProps", { |
|
835
|
|
|
loading: true |
|
836
|
|
|
}); |
|
837
|
|
|
|
|
838
|
|
|
/* harmony default export */ var googleCloud_DicomStoreList = (Object(dist_es["d" /* withTranslation */])('Common')(DicomStoreList_DicomStoreList)); |
|
839
|
|
|
// CONCATENATED MODULE: ./googleCloud/DicomStorePicker.js |
|
840
|
|
|
function DicomStorePicker_typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { DicomStorePicker_typeof = function _typeof(obj) { return typeof obj; }; } else { DicomStorePicker_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return DicomStorePicker_typeof(obj); } |
|
|
|
|
|
|
841
|
|
|
|
|
842
|
|
|
function DicomStorePicker_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } |
|
843
|
|
|
|
|
844
|
|
|
function DicomStorePicker_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { DicomStorePicker_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { DicomStorePicker_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } |
|
845
|
|
|
|
|
846
|
|
|
function DicomStorePicker_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
847
|
|
|
|
|
848
|
|
|
function DicomStorePicker_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } |
|
|
|
|
|
|
849
|
|
|
|
|
850
|
|
|
function DicomStorePicker_createClass(Constructor, protoProps, staticProps) { if (protoProps) DicomStorePicker_defineProperties(Constructor.prototype, protoProps); if (staticProps) DicomStorePicker_defineProperties(Constructor, staticProps); return Constructor; } |
|
|
|
|
|
|
851
|
|
|
|
|
852
|
|
|
function DicomStorePicker_possibleConstructorReturn(self, call) { if (call && (DicomStorePicker_typeof(call) === "object" || typeof call === "function")) { return call; } return DicomStorePicker_assertThisInitialized(self); } |
|
853
|
|
|
|
|
854
|
|
|
function DicomStorePicker_getPrototypeOf(o) { DicomStorePicker_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return DicomStorePicker_getPrototypeOf(o); } |
|
|
|
|
|
|
855
|
|
|
|
|
856
|
|
|
function DicomStorePicker_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } |
|
|
|
|
|
|
857
|
|
|
|
|
858
|
|
|
function DicomStorePicker_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) DicomStorePicker_setPrototypeOf(subClass, superClass); } |
|
|
|
|
|
|
859
|
|
|
|
|
860
|
|
|
function DicomStorePicker_setPrototypeOf(o, p) { DicomStorePicker_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return DicomStorePicker_setPrototypeOf(o, p); } |
|
|
|
|
|
|
861
|
|
|
|
|
862
|
|
|
function DicomStorePicker_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
|
863
|
|
|
|
|
864
|
|
|
|
|
865
|
|
|
|
|
866
|
|
|
|
|
867
|
|
|
|
|
868
|
|
|
|
|
869
|
|
|
|
|
870
|
|
|
var DicomStorePicker_DicomStorePicker = |
|
871
|
|
|
/*#__PURE__*/ |
|
872
|
|
|
function (_Component) { |
|
873
|
|
|
DicomStorePicker_inherits(DicomStorePicker, _Component); |
|
874
|
|
|
|
|
875
|
|
|
function DicomStorePicker() { |
|
876
|
|
|
var _getPrototypeOf2; |
|
877
|
|
|
|
|
878
|
|
|
var _this; |
|
879
|
|
|
|
|
880
|
|
|
DicomStorePicker_classCallCheck(this, DicomStorePicker); |
|
881
|
|
|
|
|
882
|
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
|
|
|
|
|
|
883
|
|
|
args[_key] = arguments[_key]; |
|
884
|
|
|
} |
|
885
|
|
|
|
|
886
|
|
|
_this = DicomStorePicker_possibleConstructorReturn(this, (_getPrototypeOf2 = DicomStorePicker_getPrototypeOf(DicomStorePicker)).call.apply(_getPrototypeOf2, [this].concat(args))); |
|
887
|
|
|
|
|
888
|
|
|
DicomStorePicker_defineProperty(DicomStorePicker_assertThisInitialized(_this), "state", { |
|
889
|
|
|
error: null, |
|
890
|
|
|
loading: true, |
|
891
|
|
|
stores: [], |
|
892
|
|
|
locations: [], |
|
893
|
|
|
filterStr: '' |
|
894
|
|
|
}); |
|
895
|
|
|
|
|
896
|
|
|
return _this; |
|
897
|
|
|
} |
|
898
|
|
|
|
|
899
|
|
|
DicomStorePicker_createClass(DicomStorePicker, [{ |
|
900
|
|
|
key: "componentDidMount", |
|
901
|
|
|
value: function () { |
|
902
|
|
|
var _componentDidMount = DicomStorePicker_asyncToGenerator( |
|
903
|
|
|
/*#__PURE__*/ |
|
904
|
|
|
regeneratorRuntime.mark(function _callee() { |
|
|
|
|
|
|
905
|
|
|
var response; |
|
906
|
|
|
return regeneratorRuntime.wrap(function _callee$(_context) { |
|
|
|
|
|
|
907
|
|
|
while (1) { |
|
908
|
|
|
switch (_context.prev = _context.next) { |
|
909
|
|
|
case 0: |
|
910
|
|
|
GoogleCloudApi["a" /* default */].setAccessToken(this.props.accessToken); |
|
911
|
|
|
_context.next = 3; |
|
912
|
|
|
return GoogleCloudApi["a" /* default */].loadDicomStores(this.props.dataset.name); |
|
913
|
|
|
|
|
914
|
|
|
case 3: |
|
915
|
|
|
response = _context.sent; |
|
916
|
|
|
|
|
917
|
|
|
if (!response.isError) { |
|
|
|
|
|
|
918
|
|
|
_context.next = 7; |
|
919
|
|
|
break; |
|
920
|
|
|
} |
|
921
|
|
|
|
|
922
|
|
|
this.setState({ |
|
923
|
|
|
error: response.message |
|
924
|
|
|
}); |
|
925
|
|
|
return _context.abrupt("return"); |
|
926
|
|
|
|
|
927
|
|
|
case 7: |
|
928
|
|
|
this.setState({ |
|
929
|
|
|
stores: response.data.dicomStores || [], |
|
|
|
|
|
|
930
|
|
|
loading: false |
|
931
|
|
|
}); |
|
932
|
|
|
|
|
933
|
|
|
case 8: |
|
934
|
|
|
case "end": |
|
935
|
|
|
return _context.stop(); |
|
936
|
|
|
} |
|
937
|
|
|
} |
|
|
|
|
|
|
938
|
|
|
}, _callee, this); |
|
939
|
|
|
})); |
|
940
|
|
|
|
|
941
|
|
|
function componentDidMount() { |
|
942
|
|
|
return _componentDidMount.apply(this, arguments); |
|
943
|
|
|
} |
|
944
|
|
|
|
|
945
|
|
|
return componentDidMount; |
|
946
|
|
|
}() |
|
947
|
|
|
}, { |
|
948
|
|
|
key: "render", |
|
949
|
|
|
value: function render() { |
|
950
|
|
|
var _this2 = this; |
|
951
|
|
|
|
|
952
|
|
|
var _this$state = this.state, |
|
953
|
|
|
stores = _this$state.stores, |
|
954
|
|
|
loading = _this$state.loading, |
|
955
|
|
|
error = _this$state.error, |
|
956
|
|
|
filterStr = _this$state.filterStr; |
|
957
|
|
|
var onSelect = this.props.onSelect; |
|
958
|
|
|
return react_default.a.createElement("div", null, react_default.a.createElement("input", { |
|
959
|
|
|
className: "form-control gcp-input", |
|
960
|
|
|
type: "text", |
|
961
|
|
|
value: filterStr, |
|
962
|
|
|
onChange: function onChange(e) { |
|
963
|
|
|
return _this2.setState({ |
|
964
|
|
|
filterStr: e.target.value |
|
965
|
|
|
}); |
|
966
|
|
|
} |
|
967
|
|
|
}), react_default.a.createElement(googleCloud_DicomStoreList, { |
|
968
|
|
|
stores: stores, |
|
969
|
|
|
loading: loading, |
|
970
|
|
|
error: error, |
|
971
|
|
|
filter: filterStr, |
|
972
|
|
|
onSelect: onSelect |
|
973
|
|
|
})); |
|
974
|
|
|
} |
|
975
|
|
|
}]); |
|
976
|
|
|
|
|
977
|
|
|
return DicomStorePicker; |
|
978
|
|
|
}(react["Component"]); |
|
979
|
|
|
|
|
980
|
|
|
DicomStorePicker_defineProperty(DicomStorePicker_DicomStorePicker, "propTypes", { |
|
981
|
|
|
dataset: prop_types_default.a.object, |
|
982
|
|
|
onSelect: prop_types_default.a.func, |
|
983
|
|
|
accessToken: prop_types_default.a.string.isRequired |
|
984
|
|
|
}); |
|
985
|
|
|
|
|
986
|
|
|
|
|
987
|
|
|
// CONCATENATED MODULE: ./googleCloud/DatasetsList.js |
|
988
|
|
|
function DatasetsList_typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { DatasetsList_typeof = function _typeof(obj) { return typeof obj; }; } else { DatasetsList_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return DatasetsList_typeof(obj); } |
|
|
|
|
|
|
989
|
|
|
|
|
990
|
|
|
function DatasetsList_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
991
|
|
|
|
|
992
|
|
|
function DatasetsList_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } |
|
|
|
|
|
|
993
|
|
|
|
|
994
|
|
|
function DatasetsList_createClass(Constructor, protoProps, staticProps) { if (protoProps) DatasetsList_defineProperties(Constructor.prototype, protoProps); if (staticProps) DatasetsList_defineProperties(Constructor, staticProps); return Constructor; } |
|
|
|
|
|
|
995
|
|
|
|
|
996
|
|
|
function DatasetsList_possibleConstructorReturn(self, call) { if (call && (DatasetsList_typeof(call) === "object" || typeof call === "function")) { return call; } return DatasetsList_assertThisInitialized(self); } |
|
997
|
|
|
|
|
998
|
|
|
function DatasetsList_getPrototypeOf(o) { DatasetsList_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return DatasetsList_getPrototypeOf(o); } |
|
|
|
|
|
|
999
|
|
|
|
|
1000
|
|
|
function DatasetsList_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } |
|
|
|
|
|
|
1001
|
|
|
|
|
1002
|
|
|
function DatasetsList_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) DatasetsList_setPrototypeOf(subClass, superClass); } |
|
|
|
|
|
|
1003
|
|
|
|
|
1004
|
|
|
function DatasetsList_setPrototypeOf(o, p) { DatasetsList_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return DatasetsList_setPrototypeOf(o, p); } |
|
|
|
|
|
|
1005
|
|
|
|
|
1006
|
|
|
function DatasetsList_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
|
1007
|
|
|
|
|
1008
|
|
|
|
|
1009
|
|
|
|
|
1010
|
|
|
|
|
1011
|
|
|
|
|
1012
|
|
|
|
|
1013
|
|
|
|
|
1014
|
|
|
var DatasetsList_DatasetsList = |
|
1015
|
|
|
/*#__PURE__*/ |
|
1016
|
|
|
function (_Component) { |
|
1017
|
|
|
DatasetsList_inherits(DatasetsList, _Component); |
|
1018
|
|
|
|
|
1019
|
|
|
function DatasetsList() { |
|
1020
|
|
|
var _getPrototypeOf2; |
|
1021
|
|
|
|
|
1022
|
|
|
var _this; |
|
1023
|
|
|
|
|
1024
|
|
|
DatasetsList_classCallCheck(this, DatasetsList); |
|
1025
|
|
|
|
|
1026
|
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
|
|
|
|
|
|
1027
|
|
|
args[_key] = arguments[_key]; |
|
1028
|
|
|
} |
|
1029
|
|
|
|
|
1030
|
|
|
_this = DatasetsList_possibleConstructorReturn(this, (_getPrototypeOf2 = DatasetsList_getPrototypeOf(DatasetsList)).call.apply(_getPrototypeOf2, [this].concat(args))); |
|
1031
|
|
|
|
|
1032
|
|
|
DatasetsList_defineProperty(DatasetsList_assertThisInitialized(_this), "state", { |
|
1033
|
|
|
search: '' |
|
1034
|
|
|
}); |
|
1035
|
|
|
|
|
1036
|
|
|
DatasetsList_defineProperty(DatasetsList_assertThisInitialized(_this), "renderTableRow", function (dataset) { |
|
1037
|
|
|
return react_default.a.createElement("tr", { |
|
1038
|
|
|
key: dataset.name, |
|
1039
|
|
|
className: _this.state.highlightedItem === dataset.name ? 'noselect active' : 'noselect', |
|
1040
|
|
|
onMouseEnter: function onMouseEnter() { |
|
1041
|
|
|
_this.onHighlightItem(dataset.name); |
|
1042
|
|
|
}, |
|
1043
|
|
|
onClick: function onClick() { |
|
1044
|
|
|
_this.props.onSelect(dataset); |
|
1045
|
|
|
} |
|
1046
|
|
|
}, react_default.a.createElement("td", null, dataset.name.split('/')[5])); |
|
1047
|
|
|
}); |
|
1048
|
|
|
|
|
1049
|
|
|
return _this; |
|
1050
|
|
|
} |
|
1051
|
|
|
|
|
1052
|
|
|
DatasetsList_createClass(DatasetsList, [{ |
|
1053
|
|
|
key: "onHighlightItem", |
|
1054
|
|
|
value: function onHighlightItem(dataset) { |
|
1055
|
|
|
this.setState({ |
|
1056
|
|
|
highlightedItem: dataset |
|
1057
|
|
|
}); |
|
1058
|
|
|
} |
|
1059
|
|
|
}, { |
|
1060
|
|
|
key: "render", |
|
1061
|
|
|
value: function render() { |
|
1062
|
|
|
var _this$props = this.props, |
|
1063
|
|
|
loading = _this$props.loading, |
|
1064
|
|
|
datasets = _this$props.datasets, |
|
1065
|
|
|
filter = _this$props.filter, |
|
1066
|
|
|
error = _this$props.error; |
|
1067
|
|
|
|
|
1068
|
|
|
if (error) { |
|
1069
|
|
|
return react_default.a.createElement("p", null, error); |
|
1070
|
|
|
} |
|
1071
|
|
|
|
|
1072
|
|
|
var loadingIcon = react_default.a.createElement(ui_src["j" /* Icon */], { |
|
1073
|
|
|
name: "circle-notch", |
|
1074
|
|
|
className: "loading-icon-spin loading-icon" |
|
1075
|
|
|
}); |
|
1076
|
|
|
|
|
1077
|
|
|
if (loading) { |
|
1078
|
|
|
return loadingIcon; |
|
1079
|
|
|
} |
|
1080
|
|
|
|
|
1081
|
|
|
var body = react_default.a.createElement("tbody", { |
|
1082
|
|
|
id: "DatasetList" |
|
1083
|
|
|
}, datasets.filter(function (dataset) { |
|
1084
|
|
|
return dataset.name.split('/')[5].toLowerCase().includes(filter.toLowerCase()) || filter == ""; |
|
1085
|
|
|
}).map(this.renderTableRow)); |
|
1086
|
|
|
return react_default.a.createElement("table", { |
|
1087
|
|
|
id: "tblDatasetList", |
|
1088
|
|
|
className: "gcp-table table noselect" |
|
1089
|
|
|
}, react_default.a.createElement("thead", null, react_default.a.createElement("tr", null, react_default.a.createElement("th", null, this.props.t('Dataset')))), datasets && body); |
|
1090
|
|
|
} |
|
1091
|
|
|
}]); |
|
1092
|
|
|
|
|
1093
|
|
|
return DatasetsList; |
|
1094
|
|
|
}(react["Component"]); |
|
1095
|
|
|
|
|
1096
|
|
|
DatasetsList_defineProperty(DatasetsList_DatasetsList, "propTypes", { |
|
1097
|
|
|
datasets: prop_types_default.a.array, |
|
1098
|
|
|
loading: prop_types_default.a.bool, |
|
1099
|
|
|
error: prop_types_default.a.string, |
|
1100
|
|
|
onSelect: prop_types_default.a.func |
|
1101
|
|
|
}); |
|
1102
|
|
|
|
|
1103
|
|
|
DatasetsList_defineProperty(DatasetsList_DatasetsList, "defaultProps", { |
|
1104
|
|
|
loading: true |
|
1105
|
|
|
}); |
|
1106
|
|
|
|
|
1107
|
|
|
/* harmony default export */ var googleCloud_DatasetsList = (Object(dist_es["d" /* withTranslation */])('Common')(DatasetsList_DatasetsList)); |
|
1108
|
|
|
// CONCATENATED MODULE: ./googleCloud/DatasetPicker.js |
|
1109
|
|
|
function DatasetPicker_typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { DatasetPicker_typeof = function _typeof(obj) { return typeof obj; }; } else { DatasetPicker_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return DatasetPicker_typeof(obj); } |
|
|
|
|
|
|
1110
|
|
|
|
|
1111
|
|
|
function DatasetPicker_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } |
|
1112
|
|
|
|
|
1113
|
|
|
function DatasetPicker_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { DatasetPicker_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { DatasetPicker_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } |
|
1114
|
|
|
|
|
1115
|
|
|
function DatasetPicker_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
1116
|
|
|
|
|
1117
|
|
|
function DatasetPicker_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } |
|
|
|
|
|
|
1118
|
|
|
|
|
1119
|
|
|
function DatasetPicker_createClass(Constructor, protoProps, staticProps) { if (protoProps) DatasetPicker_defineProperties(Constructor.prototype, protoProps); if (staticProps) DatasetPicker_defineProperties(Constructor, staticProps); return Constructor; } |
|
|
|
|
|
|
1120
|
|
|
|
|
1121
|
|
|
function DatasetPicker_possibleConstructorReturn(self, call) { if (call && (DatasetPicker_typeof(call) === "object" || typeof call === "function")) { return call; } return DatasetPicker_assertThisInitialized(self); } |
|
1122
|
|
|
|
|
1123
|
|
|
function DatasetPicker_getPrototypeOf(o) { DatasetPicker_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return DatasetPicker_getPrototypeOf(o); } |
|
|
|
|
|
|
1124
|
|
|
|
|
1125
|
|
|
function DatasetPicker_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } |
|
|
|
|
|
|
1126
|
|
|
|
|
1127
|
|
|
function DatasetPicker_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) DatasetPicker_setPrototypeOf(subClass, superClass); } |
|
|
|
|
|
|
1128
|
|
|
|
|
1129
|
|
|
function DatasetPicker_setPrototypeOf(o, p) { DatasetPicker_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return DatasetPicker_setPrototypeOf(o, p); } |
|
|
|
|
|
|
1130
|
|
|
|
|
1131
|
|
|
function DatasetPicker_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
|
1132
|
|
|
|
|
1133
|
|
|
|
|
1134
|
|
|
|
|
1135
|
|
|
|
|
1136
|
|
|
|
|
1137
|
|
|
|
|
1138
|
|
|
|
|
1139
|
|
|
var DatasetPicker_DatasetPicker = |
|
1140
|
|
|
/*#__PURE__*/ |
|
1141
|
|
|
function (_Component) { |
|
1142
|
|
|
DatasetPicker_inherits(DatasetPicker, _Component); |
|
1143
|
|
|
|
|
1144
|
|
|
function DatasetPicker() { |
|
1145
|
|
|
var _getPrototypeOf2; |
|
1146
|
|
|
|
|
1147
|
|
|
var _this; |
|
1148
|
|
|
|
|
1149
|
|
|
DatasetPicker_classCallCheck(this, DatasetPicker); |
|
1150
|
|
|
|
|
1151
|
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
|
|
|
|
|
|
1152
|
|
|
args[_key] = arguments[_key]; |
|
1153
|
|
|
} |
|
1154
|
|
|
|
|
1155
|
|
|
_this = DatasetPicker_possibleConstructorReturn(this, (_getPrototypeOf2 = DatasetPicker_getPrototypeOf(DatasetPicker)).call.apply(_getPrototypeOf2, [this].concat(args))); |
|
1156
|
|
|
|
|
1157
|
|
|
DatasetPicker_defineProperty(DatasetPicker_assertThisInitialized(_this), "state", { |
|
1158
|
|
|
error: null, |
|
1159
|
|
|
loading: true, |
|
1160
|
|
|
datasets: [], |
|
1161
|
|
|
filterStr: '' |
|
1162
|
|
|
}); |
|
1163
|
|
|
|
|
1164
|
|
|
return _this; |
|
1165
|
|
|
} |
|
1166
|
|
|
|
|
1167
|
|
|
DatasetPicker_createClass(DatasetPicker, [{ |
|
1168
|
|
|
key: "componentDidMount", |
|
1169
|
|
|
value: function () { |
|
1170
|
|
|
var _componentDidMount = DatasetPicker_asyncToGenerator( |
|
1171
|
|
|
/*#__PURE__*/ |
|
1172
|
|
|
regeneratorRuntime.mark(function _callee() { |
|
|
|
|
|
|
1173
|
|
|
var response; |
|
1174
|
|
|
return regeneratorRuntime.wrap(function _callee$(_context) { |
|
|
|
|
|
|
1175
|
|
|
while (1) { |
|
1176
|
|
|
switch (_context.prev = _context.next) { |
|
1177
|
|
|
case 0: |
|
1178
|
|
|
GoogleCloudApi["a" /* default */].setAccessToken(this.props.accessToken); |
|
1179
|
|
|
_context.next = 3; |
|
1180
|
|
|
return GoogleCloudApi["a" /* default */].loadDatasets(this.props.project.projectId, this.props.location.locationId); |
|
1181
|
|
|
|
|
1182
|
|
|
case 3: |
|
1183
|
|
|
response = _context.sent; |
|
1184
|
|
|
|
|
1185
|
|
|
if (!response.isError) { |
|
|
|
|
|
|
1186
|
|
|
_context.next = 7; |
|
1187
|
|
|
break; |
|
1188
|
|
|
} |
|
1189
|
|
|
|
|
1190
|
|
|
this.setState({ |
|
1191
|
|
|
error: response.message |
|
1192
|
|
|
}); |
|
1193
|
|
|
return _context.abrupt("return"); |
|
1194
|
|
|
|
|
1195
|
|
|
case 7: |
|
1196
|
|
|
this.setState({ |
|
1197
|
|
|
datasets: response.data.datasets || [], |
|
|
|
|
|
|
1198
|
|
|
loading: false |
|
1199
|
|
|
}); |
|
1200
|
|
|
|
|
1201
|
|
|
case 8: |
|
1202
|
|
|
case "end": |
|
1203
|
|
|
return _context.stop(); |
|
1204
|
|
|
} |
|
1205
|
|
|
} |
|
|
|
|
|
|
1206
|
|
|
}, _callee, this); |
|
1207
|
|
|
})); |
|
1208
|
|
|
|
|
1209
|
|
|
function componentDidMount() { |
|
1210
|
|
|
return _componentDidMount.apply(this, arguments); |
|
1211
|
|
|
} |
|
1212
|
|
|
|
|
1213
|
|
|
return componentDidMount; |
|
1214
|
|
|
}() |
|
1215
|
|
|
}, { |
|
1216
|
|
|
key: "render", |
|
1217
|
|
|
value: function render() { |
|
1218
|
|
|
var _this2 = this; |
|
1219
|
|
|
|
|
1220
|
|
|
var _this$state = this.state, |
|
1221
|
|
|
datasets = _this$state.datasets, |
|
1222
|
|
|
loading = _this$state.loading, |
|
1223
|
|
|
error = _this$state.error, |
|
1224
|
|
|
filterStr = _this$state.filterStr; |
|
1225
|
|
|
var onSelect = this.props.onSelect; |
|
1226
|
|
|
return react_default.a.createElement("div", null, react_default.a.createElement("input", { |
|
1227
|
|
|
className: "form-control gcp-input", |
|
1228
|
|
|
type: "text", |
|
1229
|
|
|
value: filterStr, |
|
1230
|
|
|
onChange: function onChange(e) { |
|
1231
|
|
|
return _this2.setState({ |
|
1232
|
|
|
filterStr: e.target.value |
|
1233
|
|
|
}); |
|
1234
|
|
|
} |
|
1235
|
|
|
}), react_default.a.createElement(googleCloud_DatasetsList, { |
|
1236
|
|
|
datasets: datasets, |
|
1237
|
|
|
loading: loading, |
|
1238
|
|
|
error: error, |
|
1239
|
|
|
filter: filterStr, |
|
1240
|
|
|
onSelect: onSelect |
|
1241
|
|
|
})); |
|
1242
|
|
|
} |
|
1243
|
|
|
}]); |
|
1244
|
|
|
|
|
1245
|
|
|
return DatasetPicker; |
|
1246
|
|
|
}(react["Component"]); |
|
1247
|
|
|
|
|
1248
|
|
|
DatasetPicker_defineProperty(DatasetPicker_DatasetPicker, "propTypes", { |
|
1249
|
|
|
project: prop_types_default.a.object, |
|
1250
|
|
|
location: prop_types_default.a.object, |
|
1251
|
|
|
onSelect: prop_types_default.a.func, |
|
1252
|
|
|
accessToken: prop_types_default.a.string |
|
1253
|
|
|
}); |
|
1254
|
|
|
|
|
1255
|
|
|
|
|
1256
|
|
|
// CONCATENATED MODULE: ./googleCloud/ProjectsList.js |
|
1257
|
|
|
function ProjectsList_typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ProjectsList_typeof = function _typeof(obj) { return typeof obj; }; } else { ProjectsList_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ProjectsList_typeof(obj); } |
|
|
|
|
|
|
1258
|
|
|
|
|
1259
|
|
|
function ProjectsList_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
1260
|
|
|
|
|
1261
|
|
|
function ProjectsList_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } |
|
|
|
|
|
|
1262
|
|
|
|
|
1263
|
|
|
function ProjectsList_createClass(Constructor, protoProps, staticProps) { if (protoProps) ProjectsList_defineProperties(Constructor.prototype, protoProps); if (staticProps) ProjectsList_defineProperties(Constructor, staticProps); return Constructor; } |
|
|
|
|
|
|
1264
|
|
|
|
|
1265
|
|
|
function ProjectsList_possibleConstructorReturn(self, call) { if (call && (ProjectsList_typeof(call) === "object" || typeof call === "function")) { return call; } return ProjectsList_assertThisInitialized(self); } |
|
1266
|
|
|
|
|
1267
|
|
|
function ProjectsList_getPrototypeOf(o) { ProjectsList_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return ProjectsList_getPrototypeOf(o); } |
|
|
|
|
|
|
1268
|
|
|
|
|
1269
|
|
|
function ProjectsList_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } |
|
|
|
|
|
|
1270
|
|
|
|
|
1271
|
|
|
function ProjectsList_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) ProjectsList_setPrototypeOf(subClass, superClass); } |
|
|
|
|
|
|
1272
|
|
|
|
|
1273
|
|
|
function ProjectsList_setPrototypeOf(o, p) { ProjectsList_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ProjectsList_setPrototypeOf(o, p); } |
|
|
|
|
|
|
1274
|
|
|
|
|
1275
|
|
|
function ProjectsList_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
|
1276
|
|
|
|
|
1277
|
|
|
|
|
1278
|
|
|
|
|
1279
|
|
|
|
|
1280
|
|
|
|
|
1281
|
|
|
|
|
1282
|
|
|
|
|
1283
|
|
|
var ProjectsList_ProjectsList = |
|
1284
|
|
|
/*#__PURE__*/ |
|
1285
|
|
|
function (_Component) { |
|
1286
|
|
|
ProjectsList_inherits(ProjectsList, _Component); |
|
1287
|
|
|
|
|
1288
|
|
|
function ProjectsList() { |
|
1289
|
|
|
var _getPrototypeOf2; |
|
1290
|
|
|
|
|
1291
|
|
|
var _this; |
|
1292
|
|
|
|
|
1293
|
|
|
ProjectsList_classCallCheck(this, ProjectsList); |
|
1294
|
|
|
|
|
1295
|
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
|
|
|
|
|
|
1296
|
|
|
args[_key] = arguments[_key]; |
|
1297
|
|
|
} |
|
1298
|
|
|
|
|
1299
|
|
|
_this = ProjectsList_possibleConstructorReturn(this, (_getPrototypeOf2 = ProjectsList_getPrototypeOf(ProjectsList)).call.apply(_getPrototypeOf2, [this].concat(args))); |
|
1300
|
|
|
|
|
1301
|
|
|
ProjectsList_defineProperty(ProjectsList_assertThisInitialized(_this), "state", { |
|
1302
|
|
|
search: '', |
|
1303
|
|
|
highlightedItem: null |
|
1304
|
|
|
}); |
|
1305
|
|
|
|
|
1306
|
|
|
ProjectsList_defineProperty(ProjectsList_assertThisInitialized(_this), "renderTableRow", function (project) { |
|
1307
|
|
|
return react_default.a.createElement("tr", { |
|
1308
|
|
|
key: project.projectId, |
|
1309
|
|
|
className: _this.state.highlightedItem === project.projectId ? 'noselect active' : 'noselect', |
|
1310
|
|
|
onMouseEnter: function onMouseEnter() { |
|
1311
|
|
|
_this.onHighlightItem(project.projectId); |
|
1312
|
|
|
}, |
|
1313
|
|
|
onClick: function onClick() { |
|
1314
|
|
|
_this.onHighlightItem(project.projectId); |
|
1315
|
|
|
|
|
1316
|
|
|
_this.props.onSelect(project); |
|
1317
|
|
|
} |
|
1318
|
|
|
}, react_default.a.createElement("td", null, project.name), react_default.a.createElement("td", null, project.projectId)); |
|
1319
|
|
|
}); |
|
1320
|
|
|
|
|
1321
|
|
|
return _this; |
|
1322
|
|
|
} |
|
1323
|
|
|
|
|
1324
|
|
|
ProjectsList_createClass(ProjectsList, [{ |
|
1325
|
|
|
key: "onHighlightItem", |
|
1326
|
|
|
value: function onHighlightItem(project) { |
|
1327
|
|
|
this.setState({ |
|
1328
|
|
|
highlightedItem: project |
|
1329
|
|
|
}); |
|
1330
|
|
|
} |
|
1331
|
|
|
}, { |
|
1332
|
|
|
key: "render", |
|
1333
|
|
|
value: function render() { |
|
1334
|
|
|
var _this$props = this.props, |
|
1335
|
|
|
loading = _this$props.loading, |
|
1336
|
|
|
projects = _this$props.projects, |
|
1337
|
|
|
filter = _this$props.filter, |
|
1338
|
|
|
error = _this$props.error; |
|
1339
|
|
|
|
|
1340
|
|
|
if (error) { |
|
1341
|
|
|
return react_default.a.createElement("p", null, error); |
|
1342
|
|
|
} |
|
1343
|
|
|
|
|
1344
|
|
|
var loadingIcon = react_default.a.createElement(ui_src["j" /* Icon */], { |
|
1345
|
|
|
name: "circle-notch", |
|
1346
|
|
|
className: "loading-icon-spin loading-icon" |
|
1347
|
|
|
}); |
|
1348
|
|
|
|
|
1349
|
|
|
if (loading) { |
|
1350
|
|
|
return loadingIcon; |
|
1351
|
|
|
} |
|
1352
|
|
|
|
|
1353
|
|
|
var lowerCaseFilter = filter.toLowerCase(); |
|
1354
|
|
|
var filteredProjects = projects.filter(function (project) { |
|
1355
|
|
|
return typeof project.name === 'string' && (filter === "" || project.name.toLowerCase().includes(lowerCaseFilter)); |
|
1356
|
|
|
}); |
|
1357
|
|
|
var body = react_default.a.createElement("tbody", { |
|
1358
|
|
|
id: "ProjectList" |
|
1359
|
|
|
}, filteredProjects.map(this.renderTableRow)); |
|
1360
|
|
|
return react_default.a.createElement("table", { |
|
1361
|
|
|
id: "tblProjectList", |
|
1362
|
|
|
className: "gcp-table table noselect" |
|
1363
|
|
|
}, react_default.a.createElement("thead", null, react_default.a.createElement("tr", null, react_default.a.createElement("th", null, this.props.t('Project')), react_default.a.createElement("th", null, this.props.t('ID')))), projects && body); |
|
1364
|
|
|
} |
|
1365
|
|
|
}]); |
|
1366
|
|
|
|
|
1367
|
|
|
return ProjectsList; |
|
1368
|
|
|
}(react["Component"]); |
|
1369
|
|
|
|
|
1370
|
|
|
ProjectsList_defineProperty(ProjectsList_ProjectsList, "propTypes", { |
|
1371
|
|
|
projects: prop_types_default.a.array, |
|
1372
|
|
|
loading: prop_types_default.a.bool.isRequired, |
|
1373
|
|
|
error: prop_types_default.a.string, |
|
1374
|
|
|
onSelect: prop_types_default.a.func.isRequired, |
|
1375
|
|
|
t: prop_types_default.a.func |
|
1376
|
|
|
}); |
|
1377
|
|
|
|
|
1378
|
|
|
ProjectsList_defineProperty(ProjectsList_ProjectsList, "defaultProps", { |
|
1379
|
|
|
loading: true |
|
1380
|
|
|
}); |
|
1381
|
|
|
|
|
1382
|
|
|
/* harmony default export */ var googleCloud_ProjectsList = (Object(dist_es["d" /* withTranslation */])('Common')(ProjectsList_ProjectsList)); |
|
1383
|
|
|
// CONCATENATED MODULE: ./googleCloud/ProjectPicker.js |
|
1384
|
|
|
function ProjectPicker_typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ProjectPicker_typeof = function _typeof(obj) { return typeof obj; }; } else { ProjectPicker_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ProjectPicker_typeof(obj); } |
|
|
|
|
|
|
1385
|
|
|
|
|
1386
|
|
|
function ProjectPicker_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } |
|
1387
|
|
|
|
|
1388
|
|
|
function ProjectPicker_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { ProjectPicker_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { ProjectPicker_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } |
|
1389
|
|
|
|
|
1390
|
|
|
function ProjectPicker_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
1391
|
|
|
|
|
1392
|
|
|
function ProjectPicker_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } |
|
|
|
|
|
|
1393
|
|
|
|
|
1394
|
|
|
function ProjectPicker_createClass(Constructor, protoProps, staticProps) { if (protoProps) ProjectPicker_defineProperties(Constructor.prototype, protoProps); if (staticProps) ProjectPicker_defineProperties(Constructor, staticProps); return Constructor; } |
|
|
|
|
|
|
1395
|
|
|
|
|
1396
|
|
|
function ProjectPicker_possibleConstructorReturn(self, call) { if (call && (ProjectPicker_typeof(call) === "object" || typeof call === "function")) { return call; } return ProjectPicker_assertThisInitialized(self); } |
|
1397
|
|
|
|
|
1398
|
|
|
function ProjectPicker_getPrototypeOf(o) { ProjectPicker_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return ProjectPicker_getPrototypeOf(o); } |
|
|
|
|
|
|
1399
|
|
|
|
|
1400
|
|
|
function ProjectPicker_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } |
|
|
|
|
|
|
1401
|
|
|
|
|
1402
|
|
|
function ProjectPicker_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) ProjectPicker_setPrototypeOf(subClass, superClass); } |
|
|
|
|
|
|
1403
|
|
|
|
|
1404
|
|
|
function ProjectPicker_setPrototypeOf(o, p) { ProjectPicker_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ProjectPicker_setPrototypeOf(o, p); } |
|
|
|
|
|
|
1405
|
|
|
|
|
1406
|
|
|
function ProjectPicker_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
|
1407
|
|
|
|
|
1408
|
|
|
|
|
1409
|
|
|
|
|
1410
|
|
|
|
|
1411
|
|
|
|
|
1412
|
|
|
|
|
1413
|
|
|
|
|
1414
|
|
|
var ProjectPicker_ProjectPicker = |
|
1415
|
|
|
/*#__PURE__*/ |
|
1416
|
|
|
function (_Component) { |
|
1417
|
|
|
ProjectPicker_inherits(ProjectPicker, _Component); |
|
1418
|
|
|
|
|
1419
|
|
|
function ProjectPicker() { |
|
1420
|
|
|
var _getPrototypeOf2; |
|
1421
|
|
|
|
|
1422
|
|
|
var _this; |
|
1423
|
|
|
|
|
1424
|
|
|
ProjectPicker_classCallCheck(this, ProjectPicker); |
|
1425
|
|
|
|
|
1426
|
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
|
|
|
|
|
|
1427
|
|
|
args[_key] = arguments[_key]; |
|
1428
|
|
|
} |
|
1429
|
|
|
|
|
1430
|
|
|
_this = ProjectPicker_possibleConstructorReturn(this, (_getPrototypeOf2 = ProjectPicker_getPrototypeOf(ProjectPicker)).call.apply(_getPrototypeOf2, [this].concat(args))); |
|
1431
|
|
|
|
|
1432
|
|
|
ProjectPicker_defineProperty(ProjectPicker_assertThisInitialized(_this), "state", { |
|
1433
|
|
|
error: null, |
|
1434
|
|
|
loading: true, |
|
1435
|
|
|
projects: [] |
|
1436
|
|
|
}); |
|
1437
|
|
|
|
|
1438
|
|
|
return _this; |
|
1439
|
|
|
} |
|
1440
|
|
|
|
|
1441
|
|
|
ProjectPicker_createClass(ProjectPicker, [{ |
|
1442
|
|
|
key: "componentDidMount", |
|
1443
|
|
|
value: function () { |
|
1444
|
|
|
var _componentDidMount = ProjectPicker_asyncToGenerator( |
|
1445
|
|
|
/*#__PURE__*/ |
|
1446
|
|
|
regeneratorRuntime.mark(function _callee() { |
|
|
|
|
|
|
1447
|
|
|
var response; |
|
1448
|
|
|
return regeneratorRuntime.wrap(function _callee$(_context) { |
|
|
|
|
|
|
1449
|
|
|
while (1) { |
|
1450
|
|
|
switch (_context.prev = _context.next) { |
|
1451
|
|
|
case 0: |
|
1452
|
|
|
GoogleCloudApi["a" /* default */].setAccessToken(this.props.accessToken); |
|
1453
|
|
|
_context.next = 3; |
|
1454
|
|
|
return GoogleCloudApi["a" /* default */].loadProjects(); |
|
1455
|
|
|
|
|
1456
|
|
|
case 3: |
|
1457
|
|
|
response = _context.sent; |
|
1458
|
|
|
|
|
1459
|
|
|
if (!response.isError) { |
|
|
|
|
|
|
1460
|
|
|
_context.next = 7; |
|
1461
|
|
|
break; |
|
1462
|
|
|
} |
|
1463
|
|
|
|
|
1464
|
|
|
this.setState({ |
|
1465
|
|
|
error: response.message |
|
1466
|
|
|
}); |
|
1467
|
|
|
return _context.abrupt("return"); |
|
1468
|
|
|
|
|
1469
|
|
|
case 7: |
|
1470
|
|
|
this.setState({ |
|
1471
|
|
|
projects: response.data.projects || [], |
|
|
|
|
|
|
1472
|
|
|
filterStr: '', |
|
1473
|
|
|
loading: false |
|
1474
|
|
|
}); |
|
1475
|
|
|
|
|
1476
|
|
|
case 8: |
|
1477
|
|
|
case "end": |
|
1478
|
|
|
return _context.stop(); |
|
1479
|
|
|
} |
|
1480
|
|
|
} |
|
|
|
|
|
|
1481
|
|
|
}, _callee, this); |
|
1482
|
|
|
})); |
|
1483
|
|
|
|
|
1484
|
|
|
function componentDidMount() { |
|
1485
|
|
|
return _componentDidMount.apply(this, arguments); |
|
1486
|
|
|
} |
|
1487
|
|
|
|
|
1488
|
|
|
return componentDidMount; |
|
1489
|
|
|
}() |
|
1490
|
|
|
}, { |
|
1491
|
|
|
key: "render", |
|
1492
|
|
|
value: function render() { |
|
1493
|
|
|
var _this2 = this; |
|
1494
|
|
|
|
|
1495
|
|
|
var _this$state = this.state, |
|
1496
|
|
|
projects = _this$state.projects, |
|
1497
|
|
|
loading = _this$state.loading, |
|
1498
|
|
|
filterStr = _this$state.filterStr, |
|
1499
|
|
|
error = _this$state.error; |
|
1500
|
|
|
var onSelect = this.props.onSelect; |
|
1501
|
|
|
return react_default.a.createElement("div", null, react_default.a.createElement("input", { |
|
1502
|
|
|
className: "form-control gcp-input", |
|
1503
|
|
|
type: "text", |
|
1504
|
|
|
value: filterStr, |
|
1505
|
|
|
onChange: function onChange(e) { |
|
1506
|
|
|
return _this2.setState({ |
|
1507
|
|
|
filterStr: e.target.value |
|
1508
|
|
|
}); |
|
1509
|
|
|
} |
|
1510
|
|
|
}), react_default.a.createElement(googleCloud_ProjectsList, { |
|
1511
|
|
|
projects: projects, |
|
1512
|
|
|
loading: loading, |
|
1513
|
|
|
filter: filterStr, |
|
1514
|
|
|
error: error, |
|
1515
|
|
|
onSelect: onSelect |
|
1516
|
|
|
})); |
|
1517
|
|
|
} |
|
1518
|
|
|
}]); |
|
1519
|
|
|
|
|
1520
|
|
|
return ProjectPicker; |
|
1521
|
|
|
}(react["Component"]); |
|
1522
|
|
|
|
|
1523
|
|
|
ProjectPicker_defineProperty(ProjectPicker_ProjectPicker, "propTypes", { |
|
1524
|
|
|
onSelect: prop_types_default.a.func, |
|
1525
|
|
|
accessToken: prop_types_default.a.string |
|
1526
|
|
|
}); |
|
1527
|
|
|
|
|
1528
|
|
|
|
|
1529
|
|
|
// CONCATENATED MODULE: ./googleCloud/LocationsList.js |
|
1530
|
|
|
function LocationsList_typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { LocationsList_typeof = function _typeof(obj) { return typeof obj; }; } else { LocationsList_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return LocationsList_typeof(obj); } |
|
|
|
|
|
|
1531
|
|
|
|
|
1532
|
|
|
function LocationsList_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
1533
|
|
|
|
|
1534
|
|
|
function LocationsList_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } |
|
|
|
|
|
|
1535
|
|
|
|
|
1536
|
|
|
function LocationsList_createClass(Constructor, protoProps, staticProps) { if (protoProps) LocationsList_defineProperties(Constructor.prototype, protoProps); if (staticProps) LocationsList_defineProperties(Constructor, staticProps); return Constructor; } |
|
|
|
|
|
|
1537
|
|
|
|
|
1538
|
|
|
function LocationsList_possibleConstructorReturn(self, call) { if (call && (LocationsList_typeof(call) === "object" || typeof call === "function")) { return call; } return LocationsList_assertThisInitialized(self); } |
|
1539
|
|
|
|
|
1540
|
|
|
function LocationsList_getPrototypeOf(o) { LocationsList_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return LocationsList_getPrototypeOf(o); } |
|
|
|
|
|
|
1541
|
|
|
|
|
1542
|
|
|
function LocationsList_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } |
|
|
|
|
|
|
1543
|
|
|
|
|
1544
|
|
|
function LocationsList_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) LocationsList_setPrototypeOf(subClass, superClass); } |
|
|
|
|
|
|
1545
|
|
|
|
|
1546
|
|
|
function LocationsList_setPrototypeOf(o, p) { LocationsList_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return LocationsList_setPrototypeOf(o, p); } |
|
|
|
|
|
|
1547
|
|
|
|
|
1548
|
|
|
function LocationsList_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
|
1549
|
|
|
|
|
1550
|
|
|
|
|
1551
|
|
|
|
|
1552
|
|
|
|
|
1553
|
|
|
|
|
1554
|
|
|
|
|
1555
|
|
|
|
|
1556
|
|
|
var LocationsList_LocationsList = |
|
1557
|
|
|
/*#__PURE__*/ |
|
1558
|
|
|
function (_Component) { |
|
1559
|
|
|
LocationsList_inherits(LocationsList, _Component); |
|
1560
|
|
|
|
|
1561
|
|
|
function LocationsList() { |
|
1562
|
|
|
var _getPrototypeOf2; |
|
1563
|
|
|
|
|
1564
|
|
|
var _this; |
|
1565
|
|
|
|
|
1566
|
|
|
LocationsList_classCallCheck(this, LocationsList); |
|
1567
|
|
|
|
|
1568
|
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
|
|
|
|
|
|
1569
|
|
|
args[_key] = arguments[_key]; |
|
1570
|
|
|
} |
|
1571
|
|
|
|
|
1572
|
|
|
_this = LocationsList_possibleConstructorReturn(this, (_getPrototypeOf2 = LocationsList_getPrototypeOf(LocationsList)).call.apply(_getPrototypeOf2, [this].concat(args))); |
|
1573
|
|
|
|
|
1574
|
|
|
LocationsList_defineProperty(LocationsList_assertThisInitialized(_this), "state", { |
|
1575
|
|
|
search: '' |
|
1576
|
|
|
}); |
|
1577
|
|
|
|
|
1578
|
|
|
LocationsList_defineProperty(LocationsList_assertThisInitialized(_this), "renderTableRow", function (location) { |
|
1579
|
|
|
return react_default.a.createElement("tr", { |
|
1580
|
|
|
key: location.locationId, |
|
1581
|
|
|
className: _this.state.highlightedItem === location.locationId ? 'noselect active' : 'noselect', |
|
1582
|
|
|
onMouseEnter: function onMouseEnter() { |
|
1583
|
|
|
_this.onHighlightItem(location.locationId); |
|
1584
|
|
|
}, |
|
1585
|
|
|
onClick: function onClick() { |
|
1586
|
|
|
_this.props.onSelect(location); |
|
1587
|
|
|
} |
|
1588
|
|
|
}, react_default.a.createElement("td", null, location.name.split('/')[3])); |
|
1589
|
|
|
}); |
|
1590
|
|
|
|
|
1591
|
|
|
return _this; |
|
1592
|
|
|
} |
|
1593
|
|
|
|
|
1594
|
|
|
LocationsList_createClass(LocationsList, [{ |
|
1595
|
|
|
key: "onHighlightItem", |
|
1596
|
|
|
value: function onHighlightItem(locationId) { |
|
1597
|
|
|
this.setState({ |
|
1598
|
|
|
highlightedItem: locationId |
|
1599
|
|
|
}); |
|
1600
|
|
|
} |
|
1601
|
|
|
}, { |
|
1602
|
|
|
key: "render", |
|
1603
|
|
|
value: function render() { |
|
1604
|
|
|
var _this$props = this.props, |
|
1605
|
|
|
loading = _this$props.loading, |
|
1606
|
|
|
locations = _this$props.locations, |
|
1607
|
|
|
filter = _this$props.filter, |
|
1608
|
|
|
error = _this$props.error; |
|
1609
|
|
|
|
|
1610
|
|
|
if (error) { |
|
1611
|
|
|
return react_default.a.createElement("p", null, error); |
|
1612
|
|
|
} |
|
1613
|
|
|
|
|
1614
|
|
|
var loadingIcon = react_default.a.createElement(ui_src["j" /* Icon */], { |
|
1615
|
|
|
name: "circle-notch", |
|
1616
|
|
|
className: "loading-icon-spin loading-icon" |
|
1617
|
|
|
}); |
|
1618
|
|
|
|
|
1619
|
|
|
if (loading) { |
|
1620
|
|
|
return loadingIcon; |
|
1621
|
|
|
} |
|
1622
|
|
|
|
|
1623
|
|
|
var body = react_default.a.createElement("tbody", { |
|
1624
|
|
|
id: "LocationList" |
|
1625
|
|
|
}, locations.filter(function (location) { |
|
1626
|
|
|
return location.name.split('/')[3].toLowerCase().includes(filter.toLowerCase()) || filter == ""; |
|
1627
|
|
|
}).map(this.renderTableRow)); |
|
1628
|
|
|
return react_default.a.createElement("table", { |
|
1629
|
|
|
id: "tblLocationList", |
|
1630
|
|
|
className: "gcp-table table noselect" |
|
1631
|
|
|
}, react_default.a.createElement("thead", null, react_default.a.createElement("tr", null, react_default.a.createElement("th", null, this.props.t('Location')))), locations && body); |
|
1632
|
|
|
} |
|
1633
|
|
|
}]); |
|
1634
|
|
|
|
|
1635
|
|
|
return LocationsList; |
|
1636
|
|
|
}(react["Component"]); |
|
1637
|
|
|
|
|
1638
|
|
|
LocationsList_defineProperty(LocationsList_LocationsList, "propTypes", { |
|
1639
|
|
|
locations: prop_types_default.a.array, |
|
1640
|
|
|
loading: prop_types_default.a.bool.isRequired, |
|
1641
|
|
|
error: prop_types_default.a.string, |
|
1642
|
|
|
onSelect: prop_types_default.a.func |
|
1643
|
|
|
}); |
|
1644
|
|
|
|
|
1645
|
|
|
LocationsList_defineProperty(LocationsList_LocationsList, "defaultProps", { |
|
1646
|
|
|
loading: true |
|
1647
|
|
|
}); |
|
1648
|
|
|
|
|
1649
|
|
|
/* harmony default export */ var googleCloud_LocationsList = (Object(dist_es["d" /* withTranslation */])('Common')(LocationsList_LocationsList)); |
|
1650
|
|
|
// CONCATENATED MODULE: ./googleCloud/LocationPicker.js |
|
1651
|
|
|
function LocationPicker_typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { LocationPicker_typeof = function _typeof(obj) { return typeof obj; }; } else { LocationPicker_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return LocationPicker_typeof(obj); } |
|
|
|
|
|
|
1652
|
|
|
|
|
1653
|
|
|
function LocationPicker_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } |
|
1654
|
|
|
|
|
1655
|
|
|
function LocationPicker_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { LocationPicker_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { LocationPicker_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } |
|
1656
|
|
|
|
|
1657
|
|
|
function LocationPicker_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
1658
|
|
|
|
|
1659
|
|
|
function LocationPicker_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } |
|
|
|
|
|
|
1660
|
|
|
|
|
1661
|
|
|
function LocationPicker_createClass(Constructor, protoProps, staticProps) { if (protoProps) LocationPicker_defineProperties(Constructor.prototype, protoProps); if (staticProps) LocationPicker_defineProperties(Constructor, staticProps); return Constructor; } |
|
|
|
|
|
|
1662
|
|
|
|
|
1663
|
|
|
function LocationPicker_possibleConstructorReturn(self, call) { if (call && (LocationPicker_typeof(call) === "object" || typeof call === "function")) { return call; } return LocationPicker_assertThisInitialized(self); } |
|
1664
|
|
|
|
|
1665
|
|
|
function LocationPicker_getPrototypeOf(o) { LocationPicker_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return LocationPicker_getPrototypeOf(o); } |
|
|
|
|
|
|
1666
|
|
|
|
|
1667
|
|
|
function LocationPicker_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } |
|
|
|
|
|
|
1668
|
|
|
|
|
1669
|
|
|
function LocationPicker_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) LocationPicker_setPrototypeOf(subClass, superClass); } |
|
|
|
|
|
|
1670
|
|
|
|
|
1671
|
|
|
function LocationPicker_setPrototypeOf(o, p) { LocationPicker_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return LocationPicker_setPrototypeOf(o, p); } |
|
|
|
|
|
|
1672
|
|
|
|
|
1673
|
|
|
function LocationPicker_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
|
1674
|
|
|
|
|
1675
|
|
|
|
|
1676
|
|
|
|
|
1677
|
|
|
|
|
1678
|
|
|
|
|
1679
|
|
|
|
|
1680
|
|
|
|
|
1681
|
|
|
var LocationPicker_LocationPicker = |
|
1682
|
|
|
/*#__PURE__*/ |
|
1683
|
|
|
function (_Component) { |
|
1684
|
|
|
LocationPicker_inherits(LocationPicker, _Component); |
|
1685
|
|
|
|
|
1686
|
|
|
function LocationPicker() { |
|
1687
|
|
|
var _getPrototypeOf2; |
|
1688
|
|
|
|
|
1689
|
|
|
var _this; |
|
1690
|
|
|
|
|
1691
|
|
|
LocationPicker_classCallCheck(this, LocationPicker); |
|
1692
|
|
|
|
|
1693
|
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
|
|
|
|
|
|
1694
|
|
|
args[_key] = arguments[_key]; |
|
1695
|
|
|
} |
|
1696
|
|
|
|
|
1697
|
|
|
_this = LocationPicker_possibleConstructorReturn(this, (_getPrototypeOf2 = LocationPicker_getPrototypeOf(LocationPicker)).call.apply(_getPrototypeOf2, [this].concat(args))); |
|
1698
|
|
|
|
|
1699
|
|
|
LocationPicker_defineProperty(LocationPicker_assertThisInitialized(_this), "state", { |
|
1700
|
|
|
error: null, |
|
1701
|
|
|
loading: true, |
|
1702
|
|
|
locations: [], |
|
1703
|
|
|
filterStr: '' |
|
1704
|
|
|
}); |
|
1705
|
|
|
|
|
1706
|
|
|
return _this; |
|
1707
|
|
|
} |
|
1708
|
|
|
|
|
1709
|
|
|
LocationPicker_createClass(LocationPicker, [{ |
|
1710
|
|
|
key: "componentDidMount", |
|
1711
|
|
|
value: function () { |
|
1712
|
|
|
var _componentDidMount = LocationPicker_asyncToGenerator( |
|
1713
|
|
|
/*#__PURE__*/ |
|
1714
|
|
|
regeneratorRuntime.mark(function _callee() { |
|
|
|
|
|
|
1715
|
|
|
var response; |
|
1716
|
|
|
return regeneratorRuntime.wrap(function _callee$(_context) { |
|
|
|
|
|
|
1717
|
|
|
while (1) { |
|
1718
|
|
|
switch (_context.prev = _context.next) { |
|
1719
|
|
|
case 0: |
|
1720
|
|
|
GoogleCloudApi["a" /* default */].setAccessToken(this.props.accessToken); |
|
1721
|
|
|
_context.next = 3; |
|
1722
|
|
|
return GoogleCloudApi["a" /* default */].loadLocations(this.props.project.projectId); |
|
1723
|
|
|
|
|
1724
|
|
|
case 3: |
|
1725
|
|
|
response = _context.sent; |
|
1726
|
|
|
|
|
1727
|
|
|
if (!response.isError) { |
|
|
|
|
|
|
1728
|
|
|
_context.next = 7; |
|
1729
|
|
|
break; |
|
1730
|
|
|
} |
|
1731
|
|
|
|
|
1732
|
|
|
this.setState({ |
|
1733
|
|
|
error: response.message |
|
1734
|
|
|
}); |
|
1735
|
|
|
return _context.abrupt("return"); |
|
1736
|
|
|
|
|
1737
|
|
|
case 7: |
|
1738
|
|
|
this.setState({ |
|
1739
|
|
|
locations: response.data.locations || [], |
|
|
|
|
|
|
1740
|
|
|
loading: false |
|
1741
|
|
|
}); |
|
1742
|
|
|
|
|
1743
|
|
|
case 8: |
|
1744
|
|
|
case "end": |
|
1745
|
|
|
return _context.stop(); |
|
1746
|
|
|
} |
|
1747
|
|
|
} |
|
|
|
|
|
|
1748
|
|
|
}, _callee, this); |
|
1749
|
|
|
})); |
|
1750
|
|
|
|
|
1751
|
|
|
function componentDidMount() { |
|
1752
|
|
|
return _componentDidMount.apply(this, arguments); |
|
1753
|
|
|
} |
|
1754
|
|
|
|
|
1755
|
|
|
return componentDidMount; |
|
1756
|
|
|
}() |
|
1757
|
|
|
}, { |
|
1758
|
|
|
key: "render", |
|
1759
|
|
|
value: function render() { |
|
1760
|
|
|
var _this2 = this; |
|
1761
|
|
|
|
|
1762
|
|
|
var _this$state = this.state, |
|
1763
|
|
|
locations = _this$state.locations, |
|
1764
|
|
|
loading = _this$state.loading, |
|
1765
|
|
|
error = _this$state.error, |
|
1766
|
|
|
filterStr = _this$state.filterStr; |
|
1767
|
|
|
var onSelect = this.props.onSelect; |
|
1768
|
|
|
return react_default.a.createElement("div", null, react_default.a.createElement("input", { |
|
1769
|
|
|
className: "form-control gcp-input", |
|
1770
|
|
|
type: "text", |
|
1771
|
|
|
value: filterStr, |
|
1772
|
|
|
onChange: function onChange(e) { |
|
1773
|
|
|
return _this2.setState({ |
|
1774
|
|
|
filterStr: e.target.value |
|
1775
|
|
|
}); |
|
1776
|
|
|
} |
|
1777
|
|
|
}), react_default.a.createElement(googleCloud_LocationsList, { |
|
1778
|
|
|
locations: locations, |
|
1779
|
|
|
loading: loading, |
|
1780
|
|
|
error: error, |
|
1781
|
|
|
filter: filterStr, |
|
1782
|
|
|
onSelect: onSelect |
|
1783
|
|
|
})); |
|
1784
|
|
|
} |
|
1785
|
|
|
}]); |
|
1786
|
|
|
|
|
1787
|
|
|
return LocationPicker; |
|
1788
|
|
|
}(react["Component"]); |
|
1789
|
|
|
|
|
1790
|
|
|
LocationPicker_defineProperty(LocationPicker_LocationPicker, "propTypes", { |
|
1791
|
|
|
project: prop_types_default.a.object, |
|
1792
|
|
|
onSelect: prop_types_default.a.func, |
|
1793
|
|
|
accessToken: prop_types_default.a.string |
|
1794
|
|
|
}); |
|
1795
|
|
|
|
|
1796
|
|
|
|
|
1797
|
|
|
// CONCATENATED MODULE: ./googleCloud/DatasetSelector.js |
|
1798
|
|
|
function DatasetSelector_typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { DatasetSelector_typeof = function _typeof(obj) { return typeof obj; }; } else { DatasetSelector_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return DatasetSelector_typeof(obj); } |
|
|
|
|
|
|
1799
|
|
|
|
|
1800
|
|
|
function DatasetSelector_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
1801
|
|
|
|
|
1802
|
|
|
function DatasetSelector_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } |
|
|
|
|
|
|
1803
|
|
|
|
|
1804
|
|
|
function DatasetSelector_createClass(Constructor, protoProps, staticProps) { if (protoProps) DatasetSelector_defineProperties(Constructor.prototype, protoProps); if (staticProps) DatasetSelector_defineProperties(Constructor, staticProps); return Constructor; } |
|
|
|
|
|
|
1805
|
|
|
|
|
1806
|
|
|
function DatasetSelector_possibleConstructorReturn(self, call) { if (call && (DatasetSelector_typeof(call) === "object" || typeof call === "function")) { return call; } return DatasetSelector_assertThisInitialized(self); } |
|
1807
|
|
|
|
|
1808
|
|
|
function DatasetSelector_getPrototypeOf(o) { DatasetSelector_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return DatasetSelector_getPrototypeOf(o); } |
|
|
|
|
|
|
1809
|
|
|
|
|
1810
|
|
|
function DatasetSelector_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } |
|
|
|
|
|
|
1811
|
|
|
|
|
1812
|
|
|
function DatasetSelector_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) DatasetSelector_setPrototypeOf(subClass, superClass); } |
|
|
|
|
|
|
1813
|
|
|
|
|
1814
|
|
|
function DatasetSelector_setPrototypeOf(o, p) { DatasetSelector_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return DatasetSelector_setPrototypeOf(o, p); } |
|
|
|
|
|
|
1815
|
|
|
|
|
1816
|
|
|
function DatasetSelector_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
|
1817
|
|
|
|
|
1818
|
|
|
|
|
1819
|
|
|
|
|
1820
|
|
|
|
|
1821
|
|
|
|
|
1822
|
|
|
|
|
1823
|
|
|
|
|
1824
|
|
|
|
|
1825
|
|
|
|
|
1826
|
|
|
|
|
1827
|
|
|
|
|
1828
|
|
|
var DatasetSelector_DatasetSelector = |
|
1829
|
|
|
/*#__PURE__*/ |
|
1830
|
|
|
function (_Component) { |
|
1831
|
|
|
DatasetSelector_inherits(DatasetSelector, _Component); |
|
1832
|
|
|
|
|
1833
|
|
|
function DatasetSelector() { |
|
1834
|
|
|
var _getPrototypeOf2; |
|
1835
|
|
|
|
|
1836
|
|
|
var _this; |
|
1837
|
|
|
|
|
1838
|
|
|
DatasetSelector_classCallCheck(this, DatasetSelector); |
|
1839
|
|
|
|
|
1840
|
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
|
|
|
|
|
|
1841
|
|
|
args[_key] = arguments[_key]; |
|
1842
|
|
|
} |
|
1843
|
|
|
|
|
1844
|
|
|
_this = DatasetSelector_possibleConstructorReturn(this, (_getPrototypeOf2 = DatasetSelector_getPrototypeOf(DatasetSelector)).call.apply(_getPrototypeOf2, [this].concat(args))); |
|
1845
|
|
|
|
|
1846
|
|
|
DatasetSelector_defineProperty(DatasetSelector_assertThisInitialized(_this), "state", { |
|
1847
|
|
|
project: null, |
|
1848
|
|
|
location: null, |
|
1849
|
|
|
dataset: null, |
|
1850
|
|
|
unloading: false |
|
1851
|
|
|
}); |
|
1852
|
|
|
|
|
1853
|
|
|
DatasetSelector_defineProperty(DatasetSelector_assertThisInitialized(_this), "onProjectSelect", function (project) { |
|
1854
|
|
|
_this.setState({ |
|
1855
|
|
|
project: project |
|
1856
|
|
|
}); |
|
1857
|
|
|
}); |
|
1858
|
|
|
|
|
1859
|
|
|
DatasetSelector_defineProperty(DatasetSelector_assertThisInitialized(_this), "onLocationSelect", function (location) { |
|
1860
|
|
|
_this.setState({ |
|
1861
|
|
|
location: location |
|
1862
|
|
|
}); |
|
1863
|
|
|
}); |
|
1864
|
|
|
|
|
1865
|
|
|
DatasetSelector_defineProperty(DatasetSelector_assertThisInitialized(_this), "onDatasetSelect", function (dataset) { |
|
1866
|
|
|
_this.setState({ |
|
1867
|
|
|
dataset: dataset |
|
1868
|
|
|
}); |
|
1869
|
|
|
}); |
|
1870
|
|
|
|
|
1871
|
|
|
DatasetSelector_defineProperty(DatasetSelector_assertThisInitialized(_this), "onProjectClick", function () { |
|
1872
|
|
|
_this.setState({ |
|
1873
|
|
|
dataset: null, |
|
1874
|
|
|
location: null, |
|
1875
|
|
|
project: null |
|
1876
|
|
|
}); |
|
1877
|
|
|
}); |
|
1878
|
|
|
|
|
1879
|
|
|
DatasetSelector_defineProperty(DatasetSelector_assertThisInitialized(_this), "onLocationClick", function () { |
|
1880
|
|
|
_this.setState({ |
|
1881
|
|
|
dataset: null, |
|
1882
|
|
|
location: null |
|
1883
|
|
|
}); |
|
1884
|
|
|
}); |
|
1885
|
|
|
|
|
1886
|
|
|
DatasetSelector_defineProperty(DatasetSelector_assertThisInitialized(_this), "onDatasetClick", function () { |
|
1887
|
|
|
_this.setState({ |
|
1888
|
|
|
dataset: null |
|
1889
|
|
|
}); |
|
1890
|
|
|
}); |
|
1891
|
|
|
|
|
1892
|
|
|
DatasetSelector_defineProperty(DatasetSelector_assertThisInitialized(_this), "onDicomStoreSelect", function (dicomStoreJson) { |
|
1893
|
|
|
var dicomStore = dicomStoreJson.name; |
|
1894
|
|
|
var parts = dicomStore.split('/'); |
|
1895
|
|
|
var result = { |
|
1896
|
|
|
wadoUriRoot: GoogleCloudApi["a" /* default */].urlBase + "/".concat(dicomStore, "/dicomWeb"), |
|
1897
|
|
|
qidoRoot: GoogleCloudApi["a" /* default */].urlBase + "/".concat(dicomStore, "/dicomWeb"), |
|
1898
|
|
|
wadoRoot: GoogleCloudApi["a" /* default */].urlBase + "/".concat(dicomStore, "/dicomWeb"), |
|
1899
|
|
|
project: parts[1], |
|
1900
|
|
|
location: parts[3], |
|
1901
|
|
|
dataset: parts[5], |
|
1902
|
|
|
dicomStore: parts[7] |
|
1903
|
|
|
}; |
|
1904
|
|
|
|
|
1905
|
|
|
_this.props.setServers(result); |
|
1906
|
|
|
}); |
|
1907
|
|
|
|
|
1908
|
|
|
return _this; |
|
1909
|
|
|
} |
|
1910
|
|
|
|
|
1911
|
|
|
DatasetSelector_createClass(DatasetSelector, [{ |
|
1912
|
|
|
key: "render", |
|
1913
|
|
|
value: function render() { |
|
1914
|
|
|
var accessToken = this.props.user.access_token; |
|
1915
|
|
|
var _this$state = this.state, |
|
1916
|
|
|
project = _this$state.project, |
|
1917
|
|
|
location = _this$state.location, |
|
1918
|
|
|
dataset = _this$state.dataset; |
|
1919
|
|
|
var onProjectClick = this.onProjectClick, |
|
1920
|
|
|
onLocationClick = this.onLocationClick, |
|
1921
|
|
|
onDatasetClick = this.onDatasetClick, |
|
1922
|
|
|
onProjectSelect = this.onProjectSelect, |
|
1923
|
|
|
onLocationSelect = this.onLocationSelect, |
|
1924
|
|
|
onDatasetSelect = this.onDatasetSelect, |
|
1925
|
|
|
onDicomStoreSelect = this.onDicomStoreSelect; |
|
1926
|
|
|
var projectBreadcrumbs = react_default.a.createElement("div", { |
|
1927
|
|
|
className: "gcp-picker--path" |
|
1928
|
|
|
}, react_default.a.createElement("span", null, this.props.t('Select a Project'))); |
|
1929
|
|
|
|
|
1930
|
|
|
if (project) { |
|
1931
|
|
|
projectBreadcrumbs = react_default.a.createElement("div", { |
|
1932
|
|
|
className: "gcp-picker--path" |
|
1933
|
|
|
}, react_default.a.createElement("span", { |
|
1934
|
|
|
onClick: onProjectClick |
|
1935
|
|
|
}, project.name), project && location && react_default.a.createElement("span", { |
|
1936
|
|
|
onClick: onLocationClick |
|
1937
|
|
|
}, ' ', "-> ", location.name.split('/')[3]), project && location && dataset && react_default.a.createElement("span", { |
|
1938
|
|
|
onClick: onDatasetClick |
|
1939
|
|
|
}, ' ', "-> ", dataset.name.split('/')[5])); |
|
1940
|
|
|
} |
|
1941
|
|
|
|
|
1942
|
|
|
return react_default.a.createElement(react_default.a.Fragment, null, projectBreadcrumbs, !project && react_default.a.createElement(ProjectPicker_ProjectPicker, { |
|
1943
|
|
|
accessToken: accessToken, |
|
1944
|
|
|
onSelect: onProjectSelect |
|
1945
|
|
|
}), project && !location && react_default.a.createElement(LocationPicker_LocationPicker, { |
|
1946
|
|
|
accessToken: accessToken, |
|
1947
|
|
|
project: project, |
|
1948
|
|
|
onSelect: onLocationSelect |
|
1949
|
|
|
}), project && location && !dataset && react_default.a.createElement(DatasetPicker_DatasetPicker, { |
|
1950
|
|
|
accessToken: accessToken, |
|
1951
|
|
|
project: project, |
|
1952
|
|
|
location: location, |
|
1953
|
|
|
onSelect: onDatasetSelect |
|
1954
|
|
|
}), project && location && dataset && react_default.a.createElement(DicomStorePicker_DicomStorePicker, { |
|
1955
|
|
|
accessToken: accessToken, |
|
1956
|
|
|
dataset: dataset, |
|
1957
|
|
|
onSelect: onDicomStoreSelect |
|
1958
|
|
|
})); |
|
1959
|
|
|
} |
|
1960
|
|
|
}]); |
|
1961
|
|
|
|
|
1962
|
|
|
return DatasetSelector; |
|
1963
|
|
|
}(react["Component"]); |
|
1964
|
|
|
|
|
1965
|
|
|
DatasetSelector_defineProperty(DatasetSelector_DatasetSelector, "propTypes", { |
|
1966
|
|
|
id: prop_types_default.a.string, |
|
1967
|
|
|
event: prop_types_default.a.string, |
|
1968
|
|
|
user: prop_types_default.a.object, |
|
1969
|
|
|
canClose: prop_types_default.a.string, |
|
1970
|
|
|
setServers: prop_types_default.a.func.isRequired |
|
1971
|
|
|
}); |
|
1972
|
|
|
|
|
1973
|
|
|
/* harmony default export */ var googleCloud_DatasetSelector = (Object(dist_es["d" /* withTranslation */])('Common')(DatasetSelector_DatasetSelector)); |
|
1974
|
|
|
// EXTERNAL MODULE: ./googleCloud/utils/getServers.js |
|
1975
|
|
|
var getServers = __webpack_require__(963); |
|
1976
|
|
|
|
|
1977
|
|
|
// CONCATENATED MODULE: ./googleCloud/DicomStorePickerModal.js |
|
1978
|
|
|
|
|
1979
|
|
|
|
|
1980
|
|
|
|
|
1981
|
|
|
|
|
1982
|
|
|
|
|
1983
|
|
|
|
|
1984
|
|
|
|
|
1985
|
|
|
|
|
1986
|
|
|
function DicomStorePickerModal(_ref) { |
|
1987
|
|
|
var _ref$isOpen = _ref.isOpen, |
|
1988
|
|
|
isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen, |
|
|
|
|
|
|
1989
|
|
|
setServers = _ref.setServers, |
|
1990
|
|
|
onClose = _ref.onClose, |
|
1991
|
|
|
user = _ref.user, |
|
1992
|
|
|
url = _ref.url, |
|
1993
|
|
|
t = _ref.t; |
|
1994
|
|
|
var UIModalService = App["e" /* servicesManager */].services.UIModalService; |
|
1995
|
|
|
|
|
1996
|
|
|
var showDicomStorePickerModal = function showDicomStorePickerModal() { |
|
1997
|
|
|
var handleEvent = function handleEvent(data) { |
|
1998
|
|
|
var servers = getServers["a" /* getServers */](data, data.dicomstore); |
|
1999
|
|
|
setServers(servers); // Force auto close |
|
2000
|
|
|
|
|
2001
|
|
|
UIModalService.hide(); |
|
2002
|
|
|
onClose(); |
|
2003
|
|
|
}; |
|
2004
|
|
|
|
|
2005
|
|
|
if (UIModalService) { |
|
2006
|
|
|
UIModalService.show({ |
|
2007
|
|
|
content: googleCloud_DatasetSelector, |
|
2008
|
|
|
title: t('Google Cloud Healthcare API'), |
|
2009
|
|
|
contentProps: { |
|
2010
|
|
|
setServers: handleEvent, |
|
2011
|
|
|
user: user, |
|
2012
|
|
|
url: url |
|
2013
|
|
|
}, |
|
2014
|
|
|
onClose: onClose |
|
2015
|
|
|
}); |
|
2016
|
|
|
} |
|
2017
|
|
|
}; |
|
2018
|
|
|
|
|
2019
|
|
|
return react_default.a.createElement(react_default.a.Fragment, null, isOpen && showDicomStorePickerModal()); |
|
2020
|
|
|
} |
|
2021
|
|
|
|
|
2022
|
|
|
DicomStorePickerModal.propTypes = { |
|
2023
|
|
|
isOpen: prop_types_default.a.bool.isRequired, |
|
2024
|
|
|
setServers: prop_types_default.a.func.isRequired, |
|
2025
|
|
|
onClose: prop_types_default.a.func, |
|
2026
|
|
|
user: prop_types_default.a.object.isRequired, |
|
2027
|
|
|
url: prop_types_default.a.string |
|
2028
|
|
|
}; |
|
2029
|
|
|
/* harmony default export */ var googleCloud_DicomStorePickerModal = (Object(dist_es["d" /* withTranslation */])('Common')(DicomStorePickerModal)); |
|
2030
|
|
|
// CONCATENATED MODULE: ./googleCloud/ConnectedDicomStorePicker.js |
|
2031
|
|
|
|
|
2032
|
|
|
|
|
2033
|
|
|
|
|
2034
|
|
|
var ConnectedDicomStorePicker_isActive = function isActive(a) { |
|
2035
|
|
|
return a.active === true; |
|
2036
|
|
|
}; |
|
2037
|
|
|
|
|
2038
|
|
|
var ConnectedDicomStorePicker_mapStateToProps = function mapStateToProps(state) { |
|
2039
|
|
|
var activeServer = state.servers.servers.find(ConnectedDicomStorePicker_isActive); |
|
2040
|
|
|
return { |
|
2041
|
|
|
user: state.oidc && state.oidc.user, |
|
2042
|
|
|
url: activeServer && activeServer.qidoRoot |
|
2043
|
|
|
}; |
|
2044
|
|
|
}; |
|
2045
|
|
|
|
|
2046
|
|
|
var mapDispatchToProps = function mapDispatchToProps(dispatch) { |
|
2047
|
|
|
return { |
|
2048
|
|
|
setServers: function setServers(servers) { |
|
2049
|
|
|
var action = { |
|
2050
|
|
|
type: 'SET_SERVERS', |
|
2051
|
|
|
servers: servers |
|
2052
|
|
|
}; |
|
2053
|
|
|
dispatch(action); |
|
2054
|
|
|
} |
|
2055
|
|
|
}; |
|
2056
|
|
|
}; |
|
2057
|
|
|
|
|
2058
|
|
|
var ConnectedDicomStorePicker = Object(es["b" /* connect */])(ConnectedDicomStorePicker_mapStateToProps, mapDispatchToProps)(googleCloud_DicomStorePickerModal); |
|
2059
|
|
|
/* harmony default export */ var googleCloud_ConnectedDicomStorePicker = (ConnectedDicomStorePicker); |
|
2060
|
|
|
// EXTERNAL MODULE: ./lib/filesToStudies.js + 4 modules |
|
2061
|
|
|
var filesToStudies = __webpack_require__(969); |
|
2062
|
|
|
|
|
2063
|
|
|
// EXTERNAL MODULE: ./context/UserManagerContext.js |
|
2064
|
|
|
var UserManagerContext = __webpack_require__(255); |
|
2065
|
|
|
|
|
2066
|
|
|
// EXTERNAL MODULE: ./context/WhiteLabelingContext.js |
|
2067
|
|
|
var WhiteLabelingContext = __webpack_require__(236); |
|
2068
|
|
|
|
|
2069
|
|
|
// EXTERNAL MODULE: ./context/AppContext.js |
|
2070
|
|
|
var AppContext = __webpack_require__(90); |
|
2071
|
|
|
|
|
2072
|
|
|
// CONCATENATED MODULE: ./studylist/StudyListRoute.js |
|
2073
|
|
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
|
|
|
|
|
2074
|
|
|
|
|
2075
|
|
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { StudyListRoute_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
|
|
|
|
|
2076
|
|
|
|
|
2077
|
|
|
function StudyListRoute_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
|
2078
|
|
|
|
|
2079
|
|
|
function StudyListRoute_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } |
|
2080
|
|
|
|
|
2081
|
|
|
function StudyListRoute_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { StudyListRoute_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { StudyListRoute_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } |
|
2082
|
|
|
|
|
2083
|
|
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } |
|
2084
|
|
|
|
|
2085
|
|
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } |
|
2086
|
|
|
|
|
2087
|
|
|
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } |
|
|
|
|
|
|
2088
|
|
|
|
|
2089
|
|
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } |
|
|
|
|
|
|
2090
|
|
|
|
|
2091
|
|
|
|
|
2092
|
|
|
|
|
2093
|
|
|
|
|
2094
|
|
|
|
|
2095
|
|
|
|
|
2096
|
|
|
|
|
2097
|
|
|
|
|
2098
|
|
|
|
|
2099
|
|
|
|
|
2100
|
|
|
|
|
2101
|
|
|
|
|
2102
|
|
|
// Contexts |
|
2103
|
|
|
|
|
2104
|
|
|
|
|
2105
|
|
|
|
|
2106
|
|
|
|
|
2107
|
|
|
var UrlUtil = src["a" /* default */].utils.urlUtil; |
|
2108
|
|
|
|
|
2109
|
|
|
function StudyListRoute(props) { |
|
2110
|
|
|
var history = props.history, |
|
2111
|
|
|
server = props.server, |
|
2112
|
|
|
user = props.user, |
|
2113
|
|
|
studyListFunctionsEnabled = props.studyListFunctionsEnabled; |
|
2114
|
|
|
|
|
2115
|
|
|
var _useTranslation = Object(dist_es["c" /* useTranslation */])('Common'), |
|
2116
|
|
|
_useTranslation2 = _slicedToArray(_useTranslation, 1), |
|
2117
|
|
|
t = _useTranslation2[0]; // ~~ STATE |
|
2118
|
|
|
|
|
2119
|
|
|
|
|
2120
|
|
|
var _useState = Object(react["useState"])({ |
|
2121
|
|
|
fieldName: 'PatientName', |
|
2122
|
|
|
direction: 'desc' |
|
2123
|
|
|
}), |
|
2124
|
|
|
_useState2 = _slicedToArray(_useState, 2), |
|
2125
|
|
|
sort = _useState2[0], |
|
2126
|
|
|
setSort = _useState2[1]; |
|
2127
|
|
|
|
|
2128
|
|
|
var _useState3 = Object(react["useState"])({ |
|
2129
|
|
|
studyDateTo: null, |
|
2130
|
|
|
studyDateFrom: null, |
|
2131
|
|
|
PatientName: '', |
|
2132
|
|
|
PatientID: '', |
|
2133
|
|
|
AccessionNumber: '', |
|
2134
|
|
|
StudyDate: '', |
|
2135
|
|
|
modalities: '', |
|
2136
|
|
|
StudyDescription: '', |
|
2137
|
|
|
// |
|
2138
|
|
|
patientNameOrId: '', |
|
2139
|
|
|
accessionOrModalityOrDescription: '', |
|
2140
|
|
|
// |
|
2141
|
|
|
allFields: '' |
|
2142
|
|
|
}), |
|
2143
|
|
|
_useState4 = _slicedToArray(_useState3, 2), |
|
2144
|
|
|
filterValues = _useState4[0], |
|
2145
|
|
|
setFilterValues = _useState4[1]; |
|
2146
|
|
|
|
|
2147
|
|
|
var _useState5 = Object(react["useState"])([]), |
|
2148
|
|
|
_useState6 = _slicedToArray(_useState5, 2), |
|
2149
|
|
|
studies = _useState6[0], |
|
2150
|
|
|
setStudies = _useState6[1]; |
|
2151
|
|
|
|
|
2152
|
|
|
var _useState7 = Object(react["useState"])({ |
|
2153
|
|
|
isSearchingForStudies: false, |
|
2154
|
|
|
error: null |
|
2155
|
|
|
}), |
|
2156
|
|
|
_useState8 = _slicedToArray(_useState7, 2), |
|
2157
|
|
|
searchStatus = _useState8[0], |
|
2158
|
|
|
setSearchStatus = _useState8[1]; |
|
2159
|
|
|
|
|
2160
|
|
|
var _useState9 = Object(react["useState"])(null), |
|
2161
|
|
|
_useState10 = _slicedToArray(_useState9, 2), |
|
2162
|
|
|
activeModalId = _useState10[0], |
|
2163
|
|
|
setActiveModalId = _useState10[1]; |
|
2164
|
|
|
|
|
2165
|
|
|
var _useState11 = Object(react["useState"])(25), |
|
2166
|
|
|
_useState12 = _slicedToArray(_useState11, 2), |
|
2167
|
|
|
rowsPerPage = _useState12[0], |
|
2168
|
|
|
setRowsPerPage = _useState12[1]; |
|
2169
|
|
|
|
|
2170
|
|
|
var _useState13 = Object(react["useState"])(0), |
|
2171
|
|
|
_useState14 = _slicedToArray(_useState13, 2), |
|
2172
|
|
|
pageNumber = _useState14[0], |
|
2173
|
|
|
setPageNumber = _useState14[1]; |
|
2174
|
|
|
|
|
2175
|
|
|
var appContext = Object(react["useContext"])(AppContext["c" /* default */]); // ~~ RESPONSIVE |
|
2176
|
|
|
|
|
2177
|
|
|
var displaySize = Object(ui_src["K" /* useMedia */])(['(min-width: 1750px)', '(min-width: 1000px) and (max-width: 1749px)', '(max-width: 999px)'], ['large', 'medium', 'small'], 'small'); // ~~ DEBOUNCED INPUT |
|
2178
|
|
|
|
|
2179
|
|
|
var debouncedSort = Object(ui_src["J" /* useDebounce */])(sort, 200); |
|
2180
|
|
|
var debouncedFilters = Object(ui_src["J" /* useDebounce */])(filterValues, 250); // Google Cloud Adapter for DICOM Store Picking |
|
2181
|
|
|
|
|
2182
|
|
|
var _appContext$appConfig = appContext.appConfig, |
|
2183
|
|
|
appConfig = _appContext$appConfig === void 0 ? {} : _appContext$appConfig; |
|
|
|
|
|
|
2184
|
|
|
var isGoogleCHAIntegrationEnabled = !server && appConfig.enableGoogleCloudAdapter; |
|
2185
|
|
|
|
|
2186
|
|
|
if (isGoogleCHAIntegrationEnabled && activeModalId !== 'DicomStorePicker') { |
|
2187
|
|
|
setActiveModalId('DicomStorePicker'); |
|
2188
|
|
|
} // Called when relevant state/props are updated |
|
2189
|
|
|
// Watches filters and sort, debounced |
|
2190
|
|
|
|
|
2191
|
|
|
|
|
2192
|
|
|
Object(react["useEffect"])(function () { |
|
2193
|
|
|
var fetchStudies = |
|
2194
|
|
|
/*#__PURE__*/ |
|
2195
|
|
|
function () { |
|
2196
|
|
|
var _ref = StudyListRoute_asyncToGenerator( |
|
2197
|
|
|
/*#__PURE__*/ |
|
2198
|
|
|
regeneratorRuntime.mark(function _callee() { |
|
|
|
|
|
|
2199
|
|
|
var response; |
|
2200
|
|
|
return regeneratorRuntime.wrap(function _callee$(_context) { |
|
|
|
|
|
|
2201
|
|
|
while (1) { |
|
2202
|
|
|
switch (_context.prev = _context.next) { |
|
2203
|
|
|
case 0: |
|
2204
|
|
|
_context.prev = 0; |
|
2205
|
|
|
setSearchStatus({ |
|
2206
|
|
|
error: null, |
|
2207
|
|
|
isSearchingForStudies: true |
|
2208
|
|
|
}); |
|
2209
|
|
|
_context.next = 4; |
|
2210
|
|
|
return getStudyList(server, debouncedFilters, debouncedSort, rowsPerPage, pageNumber, displaySize); |
|
2211
|
|
|
|
|
2212
|
|
|
case 4: |
|
2213
|
|
|
response = _context.sent; |
|
2214
|
|
|
setStudies(response); |
|
|
|
|
|
|
2215
|
|
|
setSearchStatus({ |
|
2216
|
|
|
error: null, |
|
2217
|
|
|
isSearchingForStudies: false |
|
2218
|
|
|
}); |
|
2219
|
|
|
_context.next = 13; |
|
2220
|
|
|
break; |
|
2221
|
|
|
|
|
2222
|
|
|
case 9: |
|
2223
|
|
|
_context.prev = 9; |
|
2224
|
|
|
_context.t0 = _context["catch"](0); |
|
2225
|
|
|
console.warn(_context.t0); |
|
2226
|
|
|
setSearchStatus({ |
|
2227
|
|
|
error: true, |
|
2228
|
|
|
isFetching: false |
|
2229
|
|
|
}); |
|
2230
|
|
|
|
|
2231
|
|
|
case 13: |
|
2232
|
|
|
case "end": |
|
2233
|
|
|
return _context.stop(); |
|
2234
|
|
|
} |
|
2235
|
|
|
} |
|
|
|
|
|
|
2236
|
|
|
}, _callee, null, [[0, 9]]); |
|
2237
|
|
|
})); |
|
2238
|
|
|
|
|
2239
|
|
|
return function fetchStudies() { |
|
2240
|
|
|
return _ref.apply(this, arguments); |
|
2241
|
|
|
}; |
|
2242
|
|
|
}(); |
|
2243
|
|
|
|
|
2244
|
|
|
if (server) { |
|
2245
|
|
|
fetchStudies(); |
|
2246
|
|
|
} |
|
2247
|
|
|
}, // TODO: Can we update studies directly? |
|
2248
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps |
|
2249
|
|
|
[debouncedFilters, debouncedSort, rowsPerPage, pageNumber, displaySize, server]); // TODO: Update Server |
|
2250
|
|
|
// if (this.props.server !== prevProps.server) { |
|
2251
|
|
|
// this.setState({ |
|
2252
|
|
|
// modalComponentId: null, |
|
2253
|
|
|
// searchData: null, |
|
2254
|
|
|
// studies: null, |
|
2255
|
|
|
// }); |
|
2256
|
|
|
// } |
|
2257
|
|
|
|
|
2258
|
|
|
var onDrop = |
|
|
|
|
|
|
2259
|
|
|
/*#__PURE__*/ |
|
2260
|
|
|
function () { |
|
2261
|
|
|
var _ref2 = StudyListRoute_asyncToGenerator( |
|
2262
|
|
|
/*#__PURE__*/ |
|
2263
|
|
|
regeneratorRuntime.mark(function _callee2(acceptedFiles) { |
|
|
|
|
|
|
2264
|
|
|
var studiesFromFiles; |
|
2265
|
|
|
return regeneratorRuntime.wrap(function _callee2$(_context2) { |
|
|
|
|
|
|
2266
|
|
|
while (1) { |
|
2267
|
|
|
switch (_context2.prev = _context2.next) { |
|
2268
|
|
|
case 0: |
|
2269
|
|
|
_context2.prev = 0; |
|
2270
|
|
|
_context2.next = 3; |
|
2271
|
|
|
return Object(filesToStudies["a" /* default */])(acceptedFiles); |
|
2272
|
|
|
|
|
2273
|
|
|
case 3: |
|
2274
|
|
|
studiesFromFiles = _context2.sent; |
|
2275
|
|
|
setStudies(studiesFromFiles); |
|
|
|
|
|
|
2276
|
|
|
_context2.next = 10; |
|
2277
|
|
|
break; |
|
2278
|
|
|
|
|
2279
|
|
|
case 7: |
|
2280
|
|
|
_context2.prev = 7; |
|
2281
|
|
|
_context2.t0 = _context2["catch"](0); |
|
2282
|
|
|
setSearchStatus({ |
|
2283
|
|
|
isSearchingForStudies: false, |
|
2284
|
|
|
error: _context2.t0 |
|
2285
|
|
|
}); |
|
2286
|
|
|
|
|
2287
|
|
|
case 10: |
|
2288
|
|
|
case "end": |
|
2289
|
|
|
return _context2.stop(); |
|
2290
|
|
|
} |
|
2291
|
|
|
} |
|
|
|
|
|
|
2292
|
|
|
}, _callee2, null, [[0, 7]]); |
|
2293
|
|
|
})); |
|
2294
|
|
|
|
|
2295
|
|
|
return function onDrop(_x) { |
|
|
|
|
|
|
2296
|
|
|
return _ref2.apply(this, arguments); |
|
2297
|
|
|
}; |
|
2298
|
|
|
}(); |
|
2299
|
|
|
|
|
2300
|
|
|
if (searchStatus.error) { |
|
2301
|
|
|
return react_default.a.createElement("div", null, "Error: ", JSON.stringify(searchStatus.error)); |
|
2302
|
|
|
} else if (studies === [] && !activeModalId) { |
|
2303
|
|
|
return react_default.a.createElement("div", null, "Loading..."); |
|
2304
|
|
|
} |
|
2305
|
|
|
|
|
2306
|
|
|
var healthCareApiButtons = null; |
|
2307
|
|
|
var healthCareApiWindows = null; |
|
2308
|
|
|
|
|
2309
|
|
|
if (appConfig.enableGoogleCloudAdapter) { |
|
2310
|
|
|
var isModalOpen = activeModalId === 'DicomStorePicker'; |
|
2311
|
|
|
updateURL(isModalOpen, appConfig, server, history); |
|
2312
|
|
|
healthCareApiWindows = react_default.a.createElement(googleCloud_ConnectedDicomStorePicker, { |
|
2313
|
|
|
isOpen: activeModalId === 'DicomStorePicker', |
|
2314
|
|
|
onClose: function onClose() { |
|
2315
|
|
|
return setActiveModalId(null); |
|
2316
|
|
|
} |
|
2317
|
|
|
}); |
|
2318
|
|
|
healthCareApiButtons = react_default.a.createElement("div", { |
|
2319
|
|
|
className: "form-inline btn-group pull-right", |
|
2320
|
|
|
style: { |
|
2321
|
|
|
padding: '20px' |
|
2322
|
|
|
} |
|
2323
|
|
|
}, react_default.a.createElement("button", { |
|
2324
|
|
|
className: "btn btn-primary", |
|
2325
|
|
|
onClick: function onClick() { |
|
2326
|
|
|
return setActiveModalId('DicomStorePicker'); |
|
2327
|
|
|
} |
|
2328
|
|
|
}, t('Change DICOM Store'))); |
|
2329
|
|
|
} |
|
2330
|
|
|
|
|
2331
|
|
|
function handleSort(fieldName) { |
|
2332
|
|
|
var sortFieldName = fieldName; |
|
2333
|
|
|
var sortDirection = 'asc'; |
|
2334
|
|
|
|
|
2335
|
|
|
if (fieldName === sort.fieldName) { |
|
2336
|
|
|
if (sort.direction === 'asc') { |
|
2337
|
|
|
sortDirection = 'desc'; |
|
2338
|
|
|
} else { |
|
2339
|
|
|
sortFieldName = null; |
|
2340
|
|
|
sortDirection = null; |
|
2341
|
|
|
} |
|
2342
|
|
|
} |
|
2343
|
|
|
|
|
2344
|
|
|
setSort({ |
|
2345
|
|
|
fieldName: sortFieldName, |
|
2346
|
|
|
direction: sortDirection |
|
2347
|
|
|
}); |
|
2348
|
|
|
} |
|
2349
|
|
|
|
|
2350
|
|
|
function handleFilterChange(fieldName, value) { |
|
2351
|
|
|
setFilterValues(function (state) { |
|
2352
|
|
|
return _objectSpread({}, state, StudyListRoute_defineProperty({}, fieldName, value)); |
|
2353
|
|
|
}); |
|
2354
|
|
|
} |
|
2355
|
|
|
|
|
2356
|
|
|
return react_default.a.createElement(react_default.a.Fragment, null, studyListFunctionsEnabled ? react_default.a.createElement(ConnectedDicomFilesUploader, { |
|
2357
|
|
|
isOpen: activeModalId === 'DicomFilesUploader', |
|
2358
|
|
|
onClose: function onClose() { |
|
2359
|
|
|
return setActiveModalId(null); |
|
2360
|
|
|
} |
|
2361
|
|
|
}) : null, healthCareApiWindows, react_default.a.createElement(WhiteLabelingContext["a" /* default */].Consumer, null, function (whiteLabeling) { |
|
2362
|
|
|
return react_default.a.createElement(UserManagerContext["a" /* default */].Consumer, null, function (userManager) { |
|
2363
|
|
|
return react_default.a.createElement(ConnectedHeader["a" /* default */], { |
|
2364
|
|
|
useLargeLogo: true, |
|
2365
|
|
|
user: user, |
|
2366
|
|
|
userManager: userManager |
|
2367
|
|
|
}, whiteLabeling && whiteLabeling.createLogoComponentFn && whiteLabeling.createLogoComponentFn(react_default.a)); |
|
2368
|
|
|
}); |
|
2369
|
|
|
}), react_default.a.createElement("div", { |
|
2370
|
|
|
className: "study-list-header" |
|
2371
|
|
|
}, react_default.a.createElement("div", { |
|
2372
|
|
|
className: "header" |
|
2373
|
|
|
}, react_default.a.createElement("h1", { |
|
2374
|
|
|
style: { |
|
2375
|
|
|
fontWeight: 300, |
|
2376
|
|
|
fontSize: '22px' |
|
2377
|
|
|
} |
|
2378
|
|
|
}, t('StudyList'))), react_default.a.createElement("div", { |
|
2379
|
|
|
className: "actions" |
|
2380
|
|
|
}, studyListFunctionsEnabled && healthCareApiButtons, studyListFunctionsEnabled && react_default.a.createElement(ui_src["q" /* PageToolbar */], { |
|
2381
|
|
|
onImport: function onImport() { |
|
2382
|
|
|
return setActiveModalId('DicomFilesUploader'); |
|
2383
|
|
|
} |
|
2384
|
|
|
}), react_default.a.createElement("span", { |
|
2385
|
|
|
className: "study-count" |
|
2386
|
|
|
}, studies.length))), react_default.a.createElement("div", { |
|
2387
|
|
|
className: "table-head-background" |
|
2388
|
|
|
}), react_default.a.createElement("div", { |
|
2389
|
|
|
className: "study-list-container" |
|
2390
|
|
|
}, react_default.a.createElement(ui_src["z" /* StudyList */], { |
|
2391
|
|
|
isLoading: searchStatus.isSearchingForStudies, |
|
2392
|
|
|
hasError: searchStatus.error === true // Rows |
|
2393
|
|
|
, |
|
2394
|
|
|
studies: studies, |
|
2395
|
|
|
onSelectItem: function onSelectItem(studyInstanceUID) { |
|
2396
|
|
|
var viewerPath = routesUtil["c" /* parseViewerPath */](appConfig, server, { |
|
2397
|
|
|
studyInstanceUIDs: studyInstanceUID |
|
2398
|
|
|
}); |
|
2399
|
|
|
history.push(viewerPath); |
|
2400
|
|
|
} // Table Header |
|
2401
|
|
|
, |
|
2402
|
|
|
sort: sort, |
|
2403
|
|
|
onSort: handleSort, |
|
2404
|
|
|
filterValues: filterValues, |
|
2405
|
|
|
onFilterChange: handleFilterChange, |
|
2406
|
|
|
studyListDateFilterNumDays: appConfig.studyListDateFilterNumDays, |
|
2407
|
|
|
displaySize: displaySize |
|
2408
|
|
|
}), react_default.a.createElement(ui_src["E" /* TablePagination */], { |
|
2409
|
|
|
currentPage: pageNumber, |
|
2410
|
|
|
nextPageFunc: function nextPageFunc() { |
|
2411
|
|
|
return setPageNumber(pageNumber + 1); |
|
2412
|
|
|
}, |
|
2413
|
|
|
prevPageFunc: function prevPageFunc() { |
|
2414
|
|
|
return setPageNumber(pageNumber - 1); |
|
2415
|
|
|
}, |
|
2416
|
|
|
onRowsPerPageChange: function onRowsPerPageChange(Rows) { |
|
2417
|
|
|
return setRowsPerPage(Rows); |
|
2418
|
|
|
}, |
|
2419
|
|
|
rowsPerPage: rowsPerPage, |
|
2420
|
|
|
recordCount: studies.length |
|
2421
|
|
|
}))); |
|
2422
|
|
|
} |
|
2423
|
|
|
|
|
2424
|
|
|
StudyListRoute.propTypes = { |
|
2425
|
|
|
filters: prop_types_default.a.object, |
|
2426
|
|
|
PatientID: prop_types_default.a.string, |
|
2427
|
|
|
server: prop_types_default.a.object, |
|
2428
|
|
|
user: prop_types_default.a.object, |
|
2429
|
|
|
history: prop_types_default.a.object, |
|
2430
|
|
|
studyListFunctionsEnabled: prop_types_default.a.bool |
|
2431
|
|
|
}; |
|
2432
|
|
|
StudyListRoute.defaultProps = { |
|
2433
|
|
|
studyListFunctionsEnabled: true |
|
2434
|
|
|
}; |
|
2435
|
|
|
|
|
2436
|
|
|
function updateURL(isModalOpen, appConfig, server, history) { |
|
2437
|
|
|
if (isModalOpen) { |
|
2438
|
|
|
return; |
|
2439
|
|
|
} |
|
2440
|
|
|
|
|
2441
|
|
|
var listPath = routesUtil["b" /* parseStudyListPath */](appConfig, server); |
|
2442
|
|
|
|
|
2443
|
|
|
if (UrlUtil.paramString.isValidPath(listPath)) { |
|
2444
|
|
|
var _history$location = history.location, |
|
2445
|
|
|
location = _history$location === void 0 ? {} : _history$location; |
|
|
|
|
|
|
2446
|
|
|
|
|
2447
|
|
|
if (location.pathname !== listPath) { |
|
2448
|
|
|
history.replace(listPath); |
|
2449
|
|
|
} |
|
2450
|
|
|
} |
|
2451
|
|
|
} |
|
2452
|
|
|
/** |
|
2453
|
|
|
* Not ideal, but we use displaySize to determine how the filters should be used |
|
2454
|
|
|
* to build the collection of promises we need to fetch a result set. |
|
2455
|
|
|
* |
|
2456
|
|
|
* @param {*} server |
|
2457
|
|
|
* @param {*} filters |
|
2458
|
|
|
* @param {object} sort |
|
2459
|
|
|
* @param {string} sort.fieldName - field to sort by |
|
2460
|
|
|
* @param {string} sort.direction - direction to sort |
|
2461
|
|
|
* @param {number} rowsPerPage - Number of results to return |
|
2462
|
|
|
* @param {number} pageNumber - Used to determine results offset |
|
2463
|
|
|
* @param {string} displaySize - small, medium, large |
|
2464
|
|
|
* @returns |
|
2465
|
|
|
*/ |
|
2466
|
|
|
|
|
2467
|
|
|
|
|
2468
|
|
|
function getStudyList(_x2, _x3, _x4, _x5, _x6, _x7) { |
|
|
|
|
|
|
2469
|
|
|
return _getStudyList.apply(this, arguments); |
|
2470
|
|
|
} |
|
2471
|
|
|
/** |
|
2472
|
|
|
* |
|
2473
|
|
|
* |
|
2474
|
|
|
* @param {object[]} studies - Array of studies to sort |
|
2475
|
|
|
* @param {string} studies.StudyDate - Date in 'MMM DD, YYYY' format |
|
2476
|
|
|
* @param {string} field - name of properties on study to sort by |
|
2477
|
|
|
* @param {string} order - 'asc' or 'desc' |
|
2478
|
|
|
* @returns |
|
2479
|
|
|
*/ |
|
2480
|
|
|
|
|
2481
|
|
|
|
|
2482
|
|
|
function _getStudyList() { |
|
2483
|
|
|
_getStudyList = StudyListRoute_asyncToGenerator( |
|
|
|
|
|
|
2484
|
|
|
/*#__PURE__*/ |
|
2485
|
|
|
regeneratorRuntime.mark(function _callee3(server, filters, sort, rowsPerPage, pageNumber, displaySize) { |
|
|
|
|
|
|
2486
|
|
|
var allFields, patientNameOrId, accessionOrModalityOrDescription, sortFieldName, sortDirection, studyDateFrom, studyDateTo, mappedFilters, studies, mappedStudies, sortFieldNameMapping, mappedSortFieldName, sortedStudies, numToTake, result; |
|
2487
|
|
|
return regeneratorRuntime.wrap(function _callee3$(_context3) { |
|
|
|
|
|
|
2488
|
|
|
while (1) { |
|
2489
|
|
|
switch (_context3.prev = _context3.next) { |
|
2490
|
|
|
case 0: |
|
2491
|
|
|
allFields = filters.allFields, patientNameOrId = filters.patientNameOrId, accessionOrModalityOrDescription = filters.accessionOrModalityOrDescription; |
|
|
|
|
|
|
2492
|
|
|
sortFieldName = sort.fieldName || 'PatientName'; |
|
2493
|
|
|
sortDirection = sort.direction || 'desc'; |
|
2494
|
|
|
studyDateFrom = filters.studyDateFrom || moment_default()().subtract(25000, 'days').toDate(); |
|
2495
|
|
|
studyDateTo = filters.studyDateTo || new Date(); |
|
2496
|
|
|
mappedFilters = { |
|
2497
|
|
|
PatientID: filters.PatientID, |
|
2498
|
|
|
PatientName: filters.PatientName, |
|
2499
|
|
|
AccessionNumber: filters.AccessionNumber, |
|
2500
|
|
|
StudyDescription: filters.StudyDescription, |
|
2501
|
|
|
ModalitiesInStudy: filters.modalities, |
|
2502
|
|
|
// NEVER CHANGE |
|
2503
|
|
|
studyDateFrom: studyDateFrom, |
|
|
|
|
|
|
2504
|
|
|
studyDateTo: studyDateTo, |
|
|
|
|
|
|
2505
|
|
|
limit: rowsPerPage, |
|
2506
|
|
|
offset: pageNumber * rowsPerPage, |
|
2507
|
|
|
fuzzymatching: server.supportsFuzzyMatching === true |
|
2508
|
|
|
}; |
|
2509
|
|
|
_context3.next = 8; |
|
2510
|
|
|
return _fetchStudies(server, mappedFilters, displaySize, { |
|
|
|
|
|
|
2511
|
|
|
allFields: allFields, |
|
|
|
|
|
|
2512
|
|
|
patientNameOrId: patientNameOrId, |
|
|
|
|
|
|
2513
|
|
|
accessionOrModalityOrDescription: accessionOrModalityOrDescription |
|
|
|
|
|
|
2514
|
|
|
}); |
|
2515
|
|
|
|
|
2516
|
|
|
case 8: |
|
2517
|
|
|
studies = _context3.sent; |
|
2518
|
|
|
// Only the fields we use |
|
2519
|
|
|
mappedStudies = studies.map(function (study) { |
|
|
|
|
|
|
2520
|
|
|
var PatientName = typeof study.PatientName === 'string' ? study.PatientName : undefined; |
|
2521
|
|
|
return { |
|
2522
|
|
|
AccessionNumber: study.AccessionNumber, |
|
2523
|
|
|
// "1" |
|
2524
|
|
|
modalities: study.modalities, |
|
2525
|
|
|
// "SEG\\MR" |
|
2526
|
|
|
// numberOfStudyRelatedInstances: "3" |
|
2527
|
|
|
// numberOfStudyRelatedSeries: "3" |
|
2528
|
|
|
// PatientBirthdate: undefined |
|
2529
|
|
|
PatientID: study.PatientID, |
|
2530
|
|
|
// "NOID" |
|
2531
|
|
|
PatientName: PatientName, |
|
2532
|
|
|
// "NAME^NONE" |
|
2533
|
|
|
// PatientSex: "M" |
|
2534
|
|
|
// referringPhysicianName: undefined |
|
2535
|
|
|
StudyDate: study.StudyDate, |
|
2536
|
|
|
// "Jun 28, 2002" |
|
2537
|
|
|
StudyDescription: study.StudyDescription, |
|
2538
|
|
|
// "BRAIN" |
|
2539
|
|
|
// studyId: "No Study ID" |
|
2540
|
|
|
StudyInstanceUID: study.StudyInstanceUID // "1.3.6.1.4.1.5962.99.1.3814087073.479799962.1489872804257.3.0" |
|
2541
|
|
|
// StudyTime: "160956.0" |
|
2542
|
|
|
|
|
2543
|
|
|
}; |
|
2544
|
|
|
}); // For our smaller displays, map our field name to a single |
|
2545
|
|
|
// field we can actually sort by. |
|
2546
|
|
|
|
|
2547
|
|
|
sortFieldNameMapping = { |
|
2548
|
|
|
allFields: 'PatientName', |
|
2549
|
|
|
patientNameOrId: 'PatientName', |
|
2550
|
|
|
accessionOrModalityOrDescription: 'modalities' |
|
2551
|
|
|
}; |
|
2552
|
|
|
mappedSortFieldName = sortFieldNameMapping[sortFieldName] || sortFieldName; |
|
|
|
|
|
|
2553
|
|
|
sortedStudies = _sortStudies(mappedStudies, mappedSortFieldName, sortDirection); // Because we've merged multiple requests, we may have more than |
|
|
|
|
|
|
2554
|
|
|
// our Rows per page. Let's `take` that number from our sorted array. |
|
2555
|
|
|
// This "might" cause paging issues. |
|
2556
|
|
|
|
|
2557
|
|
|
numToTake = sortedStudies.length < rowsPerPage ? sortedStudies.length : rowsPerPage; |
|
|
|
|
|
|
2558
|
|
|
result = sortedStudies.slice(0, numToTake); |
|
|
|
|
|
|
2559
|
|
|
return _context3.abrupt("return", result); |
|
|
|
|
|
|
2560
|
|
|
|
|
2561
|
|
|
case 16: |
|
2562
|
|
|
case "end": |
|
2563
|
|
|
return _context3.stop(); |
|
2564
|
|
|
} |
|
2565
|
|
|
} |
|
|
|
|
|
|
2566
|
|
|
}, _callee3); |
|
2567
|
|
|
})); |
|
2568
|
|
|
return _getStudyList.apply(this, arguments); |
|
2569
|
|
|
} |
|
2570
|
|
|
|
|
2571
|
|
|
function _sortStudies(studies, field, order) { |
|
2572
|
|
|
// Make sure our StudyDate is in a valid format and create copy of studies array |
|
2573
|
|
|
var sortedStudies = studies.map(function (study) { |
|
2574
|
|
|
if (!moment_default()(study.StudyDate, 'MMM DD, YYYY', true).isValid()) { |
|
2575
|
|
|
study.StudyDate = moment_default()(study.StudyDate, 'YYYYMMDD').format('MMM DD, YYYY'); |
|
2576
|
|
|
} |
|
2577
|
|
|
|
|
2578
|
|
|
return study; |
|
2579
|
|
|
}); // Sort by field |
|
2580
|
|
|
|
|
2581
|
|
|
sortedStudies.sort(function (a, b) { |
|
2582
|
|
|
var fieldA = a[field]; |
|
2583
|
|
|
var fieldB = b[field]; |
|
2584
|
|
|
|
|
2585
|
|
|
if (field === 'StudyDate') { |
|
2586
|
|
|
fieldA = moment_default()(fieldA).toISOString(); |
|
2587
|
|
|
fieldB = moment_default()(fieldB).toISOString(); |
|
2588
|
|
|
} // Order |
|
2589
|
|
|
|
|
2590
|
|
|
|
|
2591
|
|
View Code Duplication |
if (order === 'desc') { |
|
|
|
|
|
|
2592
|
|
|
if (fieldA < fieldB) { |
|
2593
|
|
|
return -1; |
|
2594
|
|
|
} |
|
2595
|
|
|
|
|
2596
|
|
|
if (fieldA > fieldB) { |
|
2597
|
|
|
return 1; |
|
2598
|
|
|
} |
|
2599
|
|
|
|
|
2600
|
|
|
return 0; |
|
2601
|
|
|
} else { |
|
|
|
|
|
|
2602
|
|
|
if (fieldA > fieldB) { |
|
2603
|
|
|
return -1; |
|
2604
|
|
|
} |
|
2605
|
|
|
|
|
2606
|
|
|
if (fieldA < fieldB) { |
|
2607
|
|
|
return 1; |
|
2608
|
|
|
} |
|
2609
|
|
|
|
|
2610
|
|
|
return 0; |
|
2611
|
|
|
} |
|
2612
|
|
|
}); |
|
2613
|
|
|
return sortedStudies; |
|
2614
|
|
|
} |
|
2615
|
|
|
/** |
|
2616
|
|
|
* We're forced to do this because DICOMWeb does not support "AND|OR" searches |
|
2617
|
|
|
* across multiple fields. This allows us to make multiple requests, remove |
|
2618
|
|
|
* duplicates, and return the result set as if it were supported |
|
2619
|
|
|
* |
|
2620
|
|
|
* @param {object} server |
|
2621
|
|
|
* @param {Object} filters |
|
2622
|
|
|
* @param {string} displaySize - small, medium, or large |
|
2623
|
|
|
* @param {string} multi.allFields |
|
2624
|
|
|
* @param {string} multi.patientNameOrId |
|
2625
|
|
|
* @param {string} multi.accessionOrModalityOrDescription |
|
2626
|
|
|
*/ |
|
2627
|
|
|
|
|
2628
|
|
|
|
|
2629
|
|
|
function _fetchStudies(_x8, _x9, _x10, _x11) { |
|
|
|
|
|
|
2630
|
|
|
return _fetchStudies2.apply(this, arguments); |
|
2631
|
|
|
} |
|
2632
|
|
|
/** |
|
2633
|
|
|
* |
|
2634
|
|
|
* |
|
2635
|
|
|
* @param {*} filters |
|
2636
|
|
|
* @param {*} fields - Array of string fields |
|
2637
|
|
|
* @param {*} value |
|
2638
|
|
|
*/ |
|
2639
|
|
|
|
|
2640
|
|
|
|
|
2641
|
|
|
function _fetchStudies2() { |
|
2642
|
|
|
_fetchStudies2 = StudyListRoute_asyncToGenerator( |
|
|
|
|
|
|
2643
|
|
|
/*#__PURE__*/ |
|
2644
|
|
|
regeneratorRuntime.mark(function _callee4(server, filters, displaySize, _ref3) { |
|
|
|
|
|
|
2645
|
|
|
var allFields, patientNameOrId, accessionOrModalityOrDescription, queryFiltersArray, firstSet, _firstSet, secondSet, queryPromises, lotsOfStudies, studies; |
|
2646
|
|
|
|
|
2647
|
|
|
return regeneratorRuntime.wrap(function _callee4$(_context4) { |
|
|
|
|
|
|
2648
|
|
|
while (1) { |
|
2649
|
|
|
switch (_context4.prev = _context4.next) { |
|
2650
|
|
|
case 0: |
|
2651
|
|
|
allFields = _ref3.allFields, patientNameOrId = _ref3.patientNameOrId, accessionOrModalityOrDescription = _ref3.accessionOrModalityOrDescription; |
|
|
|
|
|
|
2652
|
|
|
queryFiltersArray = [filters]; |
|
2653
|
|
|
|
|
2654
|
|
|
if (displaySize === 'small') { |
|
2655
|
|
|
firstSet = _getQueryFiltersForValue(filters, ['PatientID', 'PatientName', 'AccessionNumber', 'StudyDescription', 'ModalitiesInStudy'], allFields); |
|
|
|
|
|
|
2656
|
|
|
|
|
2657
|
|
|
if (firstSet.length) { |
|
|
|
|
|
|
2658
|
|
|
queryFiltersArray = firstSet; |
|
2659
|
|
|
} |
|
2660
|
|
|
} else if (displaySize === 'medium') { |
|
2661
|
|
|
_firstSet = _getQueryFiltersForValue(filters, ['PatientID', 'PatientName'], patientNameOrId); |
|
|
|
|
|
|
2662
|
|
|
secondSet = _getQueryFiltersForValue(filters, ['AccessionNumber', 'StudyDescription', 'ModalitiesInStudy'], accessionOrModalityOrDescription); |
|
|
|
|
|
|
2663
|
|
|
|
|
2664
|
|
|
if (_firstSet.length || secondSet.length) { |
|
|
|
|
|
|
2665
|
|
|
queryFiltersArray = _firstSet.concat(secondSet); |
|
2666
|
|
|
} |
|
2667
|
|
|
} |
|
2668
|
|
|
|
|
2669
|
|
|
queryPromises = []; |
|
2670
|
|
|
queryFiltersArray.forEach(function (filter) { |
|
|
|
|
|
|
2671
|
|
|
var searchStudiesPromise = src["a" /* default */].studies.searchStudies(server, filter); |
|
2672
|
|
|
queryPromises.push(searchStudiesPromise); |
|
|
|
|
|
|
2673
|
|
|
}); |
|
2674
|
|
|
_context4.next = 7; |
|
2675
|
|
|
return Promise.all(queryPromises); |
|
|
|
|
|
|
2676
|
|
|
|
|
2677
|
|
|
case 7: |
|
2678
|
|
|
lotsOfStudies = _context4.sent; |
|
2679
|
|
|
studies = []; // Flatten and dedupe |
|
2680
|
|
|
|
|
2681
|
|
|
lotsOfStudies.forEach(function (arrayOfStudies) { |
|
|
|
|
|
|
2682
|
|
|
if (arrayOfStudies) { |
|
2683
|
|
|
arrayOfStudies.forEach(function (study) { |
|
2684
|
|
|
if (!studies.some(function (s) { |
|
|
|
|
|
|
2685
|
|
|
return s.StudyInstanceUID === study.StudyInstanceUID; |
|
2686
|
|
|
})) { |
|
2687
|
|
|
studies.push(study); |
|
2688
|
|
|
} |
|
2689
|
|
|
}); |
|
2690
|
|
|
} |
|
2691
|
|
|
}); |
|
2692
|
|
|
return _context4.abrupt("return", studies); |
|
|
|
|
|
|
2693
|
|
|
|
|
2694
|
|
|
case 11: |
|
2695
|
|
|
case "end": |
|
2696
|
|
|
return _context4.stop(); |
|
2697
|
|
|
} |
|
2698
|
|
|
} |
|
|
|
|
|
|
2699
|
|
|
}, _callee4); |
|
2700
|
|
|
})); |
|
2701
|
|
|
return _fetchStudies2.apply(this, arguments); |
|
2702
|
|
|
} |
|
2703
|
|
|
|
|
2704
|
|
|
function _getQueryFiltersForValue(filters, fields, value) { |
|
2705
|
|
|
var queryFilters = []; |
|
2706
|
|
|
|
|
2707
|
|
|
if (value === '' || !value) { |
|
2708
|
|
|
return queryFilters; |
|
2709
|
|
|
} |
|
2710
|
|
|
|
|
2711
|
|
|
fields.forEach(function (field) { |
|
2712
|
|
|
var filter = Object.assign({ |
|
2713
|
|
|
PatientID: '', |
|
2714
|
|
|
PatientName: '', |
|
2715
|
|
|
AccessionNumber: '', |
|
2716
|
|
|
StudyDescription: '', |
|
2717
|
|
|
ModalitiesInStudy: '' |
|
2718
|
|
|
}, filters); |
|
2719
|
|
|
filter[field] = value; |
|
2720
|
|
|
queryFilters.push(filter); |
|
2721
|
|
|
}); |
|
2722
|
|
|
return queryFilters; |
|
2723
|
|
|
} |
|
2724
|
|
|
|
|
2725
|
|
|
/* harmony default export */ var studylist_StudyListRoute = (Object(react_router["g" /* withRouter */])(StudyListRoute)); |
|
2726
|
|
|
// CONCATENATED MODULE: ./studylist/ConnectedStudyList.js |
|
2727
|
|
|
|
|
2728
|
|
|
|
|
2729
|
|
|
|
|
2730
|
|
|
var ConnectedStudyList_isActive = function isActive(a) { |
|
2731
|
|
|
return a.active === true; |
|
2732
|
|
|
}; |
|
2733
|
|
|
|
|
2734
|
|
|
var ConnectedStudyList_mapStateToProps = function mapStateToProps(state) { |
|
2735
|
|
|
var activeServer = state.servers.servers.find(ConnectedStudyList_isActive); |
|
2736
|
|
|
return { |
|
2737
|
|
|
server: activeServer, |
|
2738
|
|
|
user: state.oidc.user |
|
2739
|
|
|
}; |
|
2740
|
|
|
}; |
|
2741
|
|
|
|
|
2742
|
|
|
var ConnectedStudyList = Object(es["b" /* connect */])(ConnectedStudyList_mapStateToProps, null)(studylist_StudyListRoute); |
|
2743
|
|
|
/* harmony default export */ var studylist_ConnectedStudyList = (ConnectedStudyList); |
|
2744
|
|
|
// EXTERNAL MODULE: ./customHooks/useServer.js |
|
2745
|
|
|
var useServer = __webpack_require__(965); |
|
2746
|
|
|
|
|
2747
|
|
|
// CONCATENATED MODULE: ./studylist/StudyListRouting.js |
|
2748
|
|
|
|
|
2749
|
|
|
|
|
2750
|
|
|
|
|
2751
|
|
|
|
|
2752
|
|
|
|
|
2753
|
|
|
|
|
2754
|
|
|
var StudyListRouting_UrlUtil = src["a" /* default */].utils.urlUtil; // Contexts |
|
2755
|
|
|
|
|
2756
|
|
|
|
|
2757
|
|
|
|
|
2758
|
|
|
function StudyListRouting(_ref) { |
|
2759
|
|
|
var routeMatch = _ref.match, |
|
2760
|
|
|
routeLocation = _ref.location; |
|
2761
|
|
|
var _routeMatch$params = routeMatch.params, |
|
2762
|
|
|
project = _routeMatch$params.project, |
|
2763
|
|
|
location = _routeMatch$params.location, |
|
2764
|
|
|
dataset = _routeMatch$params.dataset, |
|
2765
|
|
|
dicomStore = _routeMatch$params.dicomStore, |
|
2766
|
|
|
studyInstanceUIDs = _routeMatch$params.studyInstanceUIDs, |
|
|
|
|
|
|
2767
|
|
|
seriesInstanceUIDs = _routeMatch$params.seriesInstanceUIDs; |
|
|
|
|
|
|
2768
|
|
|
var server = Object(useServer["a" /* default */])({ |
|
|
|
|
|
|
2769
|
|
|
project: project, |
|
2770
|
|
|
location: location, |
|
2771
|
|
|
dataset: dataset, |
|
2772
|
|
|
dicomStore: dicomStore |
|
2773
|
|
|
}); |
|
2774
|
|
|
|
|
2775
|
|
|
var _useContext = Object(react["useContext"])(AppContext["c" /* default */]), |
|
2776
|
|
|
_useContext$appConfig = _useContext.appConfig, |
|
2777
|
|
|
appConfig = _useContext$appConfig === void 0 ? {} : _useContext$appConfig; |
|
|
|
|
|
|
2778
|
|
|
|
|
2779
|
|
|
var filters = StudyListRouting_UrlUtil.queryString.getQueryFilters(routeLocation); |
|
2780
|
|
|
var studyListFunctionsEnabled = false; |
|
2781
|
|
|
|
|
2782
|
|
|
if (appConfig.studyListFunctionsEnabled) { |
|
2783
|
|
|
studyListFunctionsEnabled = appConfig.studyListFunctionsEnabled; |
|
2784
|
|
|
} |
|
2785
|
|
|
|
|
2786
|
|
|
return react_default.a.createElement(studylist_ConnectedStudyList, { |
|
2787
|
|
|
filters: filters, |
|
2788
|
|
|
studyListFunctionsEnabled: studyListFunctionsEnabled |
|
2789
|
|
|
}); |
|
2790
|
|
|
} |
|
2791
|
|
|
|
|
2792
|
|
|
StudyListRouting.propTypes = { |
|
2793
|
|
|
location: prop_types_default.a.shape({ |
|
2794
|
|
|
search: prop_types_default.a.string |
|
2795
|
|
|
}).isRequired |
|
2796
|
|
|
}; |
|
2797
|
|
|
/* harmony default export */ var studylist_StudyListRouting = __webpack_exports__["default"] = (Object(react_router["g" /* withRouter */])(StudyListRouting)); |
|
|
|
|
|
|
2798
|
|
|
|
|
2799
|
|
|
/***/ }), |
|
2800
|
|
|
|
|
2801
|
|
|
/***/ 956: |
|
2802
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
|
|
|
|
|
|
2803
|
|
|
|
|
2804
|
|
|
// extracted by extract-css-chunks-webpack-plugin |
|
2805
|
|
|
|
|
2806
|
|
|
/***/ }), |
|
2807
|
|
|
|
|
2808
|
|
|
/***/ 957: |
|
2809
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
2810
|
|
|
|
|
2811
|
|
|
"use strict"; |
|
2812
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return usePrevious; }); |
|
2813
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); |
|
2814
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
|
|
|
|
|
|
2815
|
|
|
|
|
2816
|
|
|
function usePrevious(value) { |
|
2817
|
|
|
var ref = Object(react__WEBPACK_IMPORTED_MODULE_0__["useRef"])(); |
|
2818
|
|
|
Object(react__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(function () { |
|
2819
|
|
|
ref.current = value; |
|
2820
|
|
|
}, [value]); |
|
2821
|
|
|
return ref.current; |
|
2822
|
|
|
} |
|
2823
|
|
|
|
|
2824
|
|
|
/***/ }), |
|
2825
|
|
|
|
|
2826
|
|
|
/***/ 958: |
|
2827
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
|
|
|
|
2828
|
|
|
|
|
2829
|
|
|
"use strict"; |
|
2830
|
|
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
|
|
|
|
|
2831
|
|
|
|
|
2832
|
|
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
|
|
|
|
|
2833
|
|
|
|
|
2834
|
|
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
|
2835
|
|
|
|
|
2836
|
|
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } |
|
2837
|
|
|
|
|
2838
|
|
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } |
|
2839
|
|
|
|
|
2840
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
2841
|
|
|
|
|
2842
|
|
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } |
|
|
|
|
|
|
2843
|
|
|
|
|
2844
|
|
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } |
|
|
|
|
|
|
2845
|
|
|
|
|
2846
|
|
|
var GoogleCloudApi = |
|
2847
|
|
|
/*#__PURE__*/ |
|
2848
|
|
|
function () { |
|
2849
|
|
|
function GoogleCloudApi() { |
|
2850
|
|
|
_classCallCheck(this, GoogleCloudApi); |
|
2851
|
|
|
} |
|
2852
|
|
|
|
|
2853
|
|
|
_createClass(GoogleCloudApi, [{ |
|
2854
|
|
|
key: "setAccessToken", |
|
2855
|
|
|
value: function setAccessToken(accessToken) { |
|
2856
|
|
|
if (!accessToken) console.error('Access token is empty'); |
|
|
|
|
|
|
2857
|
|
|
this.accessToken = accessToken; |
|
2858
|
|
|
} |
|
2859
|
|
|
}, { |
|
2860
|
|
|
key: "getUrlBaseDicomWeb", |
|
2861
|
|
|
value: function getUrlBaseDicomWeb(project, location, dataset, dicomStore) { |
|
2862
|
|
|
return this.urlBase + "/projects/".concat(project, "/locations/").concat(location, "/datasets/").concat(dataset, "/dicomStores/").concat(dicomStore, "/dicomWeb"); |
|
2863
|
|
|
} |
|
2864
|
|
|
}, { |
|
2865
|
|
|
key: "getUrlPath", |
|
2866
|
|
|
value: function getUrlPath(project, location, dataset, dicomStore) { |
|
2867
|
|
|
"/projects/".concat(project, "/locations/").concat(location, "/datasets/").concat(dataset, "/dicomStores/").concat(dicomStore); |
|
2868
|
|
|
} |
|
2869
|
|
|
}, { |
|
2870
|
|
|
key: "doRequest", |
|
2871
|
|
|
value: function () { |
|
2872
|
|
|
var _doRequest = _asyncToGenerator( |
|
2873
|
|
|
/*#__PURE__*/ |
|
2874
|
|
|
regeneratorRuntime.mark(function _callee(urlStr) { |
|
|
|
|
|
|
2875
|
|
|
var config, |
|
2876
|
|
|
params, |
|
2877
|
|
|
url, |
|
2878
|
|
|
data, |
|
2879
|
|
|
response, |
|
2880
|
|
|
subPage, |
|
2881
|
|
|
key, |
|
2882
|
|
|
_args = arguments; |
|
2883
|
|
|
return regeneratorRuntime.wrap(function _callee$(_context) { |
|
|
|
|
|
|
2884
|
|
|
while (1) { |
|
2885
|
|
|
switch (_context.prev = _context.next) { |
|
2886
|
|
|
case 0: |
|
2887
|
|
|
config = _args.length > 1 && _args[1] !== undefined ? _args[1] : {}; |
|
2888
|
|
|
params = _args.length > 2 && _args[2] !== undefined ? _args[2] : {}; |
|
2889
|
|
|
url = new URL(urlStr); |
|
|
|
|
|
|
2890
|
|
|
data = null; |
|
2891
|
|
|
url.search = new URLSearchParams(params); |
|
|
|
|
|
|
2892
|
|
|
_context.prev = 5; |
|
2893
|
|
|
_context.next = 8; |
|
2894
|
|
|
return fetch(url, _objectSpread({}, this.fetchConfig, { |
|
2895
|
|
|
config: config |
|
|
|
|
|
|
2896
|
|
|
})); |
|
2897
|
|
|
|
|
2898
|
|
|
case 8: |
|
2899
|
|
|
response = _context.sent; |
|
2900
|
|
|
_context.prev = 9; |
|
2901
|
|
|
_context.next = 12; |
|
2902
|
|
|
return response.json(); |
|
|
|
|
|
|
2903
|
|
|
|
|
2904
|
|
|
case 12: |
|
2905
|
|
|
data = _context.sent; |
|
2906
|
|
|
_context.next = 17; |
|
2907
|
|
|
break; |
|
2908
|
|
|
|
|
2909
|
|
|
case 15: |
|
2910
|
|
|
_context.prev = 15; |
|
2911
|
|
|
_context.t0 = _context["catch"](9); |
|
|
|
|
|
|
2912
|
|
|
|
|
2913
|
|
|
case 17: |
|
2914
|
|
|
if (!(response.status >= 200 && response.status < 300 && data != null)) { |
|
|
|
|
|
|
2915
|
|
|
_context.next = 27; |
|
2916
|
|
|
break; |
|
2917
|
|
|
} |
|
2918
|
|
|
|
|
2919
|
|
|
if (!(data.nextPageToken != null)) { |
|
|
|
|
|
|
2920
|
|
|
_context.next = 24; |
|
2921
|
|
|
break; |
|
2922
|
|
|
} |
|
2923
|
|
|
|
|
2924
|
|
|
params.pageToken = data.nextPageToken; |
|
2925
|
|
|
_context.next = 22; |
|
2926
|
|
|
return this.doRequest(urlStr, config, params); |
|
2927
|
|
|
|
|
2928
|
|
|
case 22: |
|
2929
|
|
|
subPage = _context.sent; |
|
2930
|
|
|
|
|
2931
|
|
|
for (key in data) { |
|
2932
|
|
|
if (data.hasOwnProperty(key)) { |
|
|
|
|
|
|
2933
|
|
|
data[key] = data[key].concat(subPage.data[key]); |
|
2934
|
|
|
} |
|
2935
|
|
|
} |
|
|
|
|
|
|
2936
|
|
|
|
|
2937
|
|
|
case 24: |
|
2938
|
|
|
return _context.abrupt("return", { |
|
2939
|
|
|
isError: false, |
|
2940
|
|
|
status: response.status, |
|
2941
|
|
|
data: data |
|
2942
|
|
|
}); |
|
2943
|
|
|
|
|
2944
|
|
|
case 27: |
|
2945
|
|
|
return _context.abrupt("return", { |
|
2946
|
|
|
isError: true, |
|
2947
|
|
|
status: response.status, |
|
2948
|
|
|
message: data && data.error && data.error.message || 'Unknown error' |
|
|
|
|
|
|
2949
|
|
|
}); |
|
2950
|
|
|
|
|
2951
|
|
|
case 28: |
|
2952
|
|
|
_context.next = 35; |
|
2953
|
|
|
break; |
|
2954
|
|
|
|
|
2955
|
|
|
case 30: |
|
2956
|
|
|
_context.prev = 30; |
|
2957
|
|
|
_context.t1 = _context["catch"](5); |
|
2958
|
|
|
|
|
2959
|
|
|
if (!(data && data.error)) { |
|
2960
|
|
|
_context.next = 34; |
|
2961
|
|
|
break; |
|
2962
|
|
|
} |
|
2963
|
|
|
|
|
2964
|
|
|
return _context.abrupt("return", { |
|
2965
|
|
|
isError: true, |
|
2966
|
|
|
status: _context.t1.status, |
|
2967
|
|
|
message: _context.t1.response.data.error.message || 'Unspecified error' |
|
2968
|
|
|
}); |
|
2969
|
|
|
|
|
2970
|
|
|
case 34: |
|
2971
|
|
|
return _context.abrupt("return", { |
|
2972
|
|
|
isError: true, |
|
2973
|
|
|
message: _context.t1 && _context.t1.message || 'Oops! Something went wrong' |
|
2974
|
|
|
}); |
|
2975
|
|
|
|
|
2976
|
|
|
case 35: |
|
2977
|
|
|
case "end": |
|
2978
|
|
|
return _context.stop(); |
|
2979
|
|
|
} |
|
2980
|
|
|
} |
|
|
|
|
|
|
2981
|
|
|
}, _callee, this, [[5, 30], [9, 15]]); |
|
2982
|
|
|
})); |
|
2983
|
|
|
|
|
2984
|
|
|
function doRequest(_x) { |
|
|
|
|
|
|
2985
|
|
|
return _doRequest.apply(this, arguments); |
|
2986
|
|
|
} |
|
2987
|
|
|
|
|
2988
|
|
|
return doRequest; |
|
2989
|
|
|
}() |
|
2990
|
|
|
}, { |
|
2991
|
|
|
key: "loadProjects", |
|
2992
|
|
|
value: function () { |
|
2993
|
|
|
var _loadProjects = _asyncToGenerator( |
|
2994
|
|
|
/*#__PURE__*/ |
|
2995
|
|
|
regeneratorRuntime.mark(function _callee2() { |
|
|
|
|
|
|
2996
|
|
|
return regeneratorRuntime.wrap(function _callee2$(_context2) { |
|
|
|
|
|
|
2997
|
|
|
while (1) { |
|
2998
|
|
|
switch (_context2.prev = _context2.next) { |
|
2999
|
|
|
case 0: |
|
3000
|
|
|
return _context2.abrupt("return", this.doRequest('https://cloudresourcemanager.googleapis.com/v1/projects')); |
|
3001
|
|
|
|
|
3002
|
|
|
case 1: |
|
3003
|
|
|
case "end": |
|
3004
|
|
|
return _context2.stop(); |
|
3005
|
|
|
} |
|
3006
|
|
|
} |
|
|
|
|
|
|
3007
|
|
|
}, _callee2, this); |
|
3008
|
|
|
})); |
|
3009
|
|
|
|
|
3010
|
|
|
function loadProjects() { |
|
3011
|
|
|
return _loadProjects.apply(this, arguments); |
|
3012
|
|
|
} |
|
3013
|
|
|
|
|
3014
|
|
|
return loadProjects; |
|
3015
|
|
|
}() |
|
3016
|
|
|
}, { |
|
3017
|
|
|
key: "loadLocations", |
|
3018
|
|
|
value: function () { |
|
3019
|
|
|
var _loadLocations = _asyncToGenerator( |
|
3020
|
|
|
/*#__PURE__*/ |
|
3021
|
|
|
regeneratorRuntime.mark(function _callee3(projectId) { |
|
|
|
|
|
|
3022
|
|
|
return regeneratorRuntime.wrap(function _callee3$(_context3) { |
|
|
|
|
|
|
3023
|
|
|
while (1) { |
|
3024
|
|
|
switch (_context3.prev = _context3.next) { |
|
3025
|
|
|
case 0: |
|
3026
|
|
|
return _context3.abrupt("return", this.doRequest("".concat(this.urlBaseProject, "/").concat(projectId, "/locations"))); |
|
3027
|
|
|
|
|
3028
|
|
|
case 1: |
|
3029
|
|
|
case "end": |
|
3030
|
|
|
return _context3.stop(); |
|
3031
|
|
|
} |
|
3032
|
|
|
} |
|
|
|
|
|
|
3033
|
|
|
}, _callee3, this); |
|
3034
|
|
|
})); |
|
3035
|
|
|
|
|
3036
|
|
|
function loadLocations(_x2) { |
|
|
|
|
|
|
3037
|
|
|
return _loadLocations.apply(this, arguments); |
|
3038
|
|
|
} |
|
3039
|
|
|
|
|
3040
|
|
|
return loadLocations; |
|
3041
|
|
|
}() |
|
3042
|
|
|
}, { |
|
3043
|
|
|
key: "loadDatasets", |
|
3044
|
|
|
value: function () { |
|
3045
|
|
|
var _loadDatasets = _asyncToGenerator( |
|
3046
|
|
|
/*#__PURE__*/ |
|
3047
|
|
|
regeneratorRuntime.mark(function _callee4(projectId, locationId) { |
|
|
|
|
|
|
3048
|
|
|
return regeneratorRuntime.wrap(function _callee4$(_context4) { |
|
|
|
|
|
|
3049
|
|
|
while (1) { |
|
3050
|
|
|
switch (_context4.prev = _context4.next) { |
|
3051
|
|
|
case 0: |
|
3052
|
|
|
return _context4.abrupt("return", this.doRequest("".concat(this.urlBaseProject, "/").concat(projectId, "/locations/").concat(locationId, "/datasets"))); |
|
3053
|
|
|
|
|
3054
|
|
|
case 1: |
|
3055
|
|
|
case "end": |
|
3056
|
|
|
return _context4.stop(); |
|
3057
|
|
|
} |
|
3058
|
|
|
} |
|
|
|
|
|
|
3059
|
|
|
}, _callee4, this); |
|
3060
|
|
|
})); |
|
3061
|
|
|
|
|
3062
|
|
|
function loadDatasets(_x3, _x4) { |
|
|
|
|
|
|
3063
|
|
|
return _loadDatasets.apply(this, arguments); |
|
3064
|
|
|
} |
|
3065
|
|
|
|
|
3066
|
|
|
return loadDatasets; |
|
3067
|
|
|
}() |
|
3068
|
|
|
}, { |
|
3069
|
|
|
key: "loadDicomStores", |
|
3070
|
|
|
value: function () { |
|
3071
|
|
|
var _loadDicomStores = _asyncToGenerator( |
|
3072
|
|
|
/*#__PURE__*/ |
|
3073
|
|
|
regeneratorRuntime.mark(function _callee5(dataset) { |
|
|
|
|
|
|
3074
|
|
|
return regeneratorRuntime.wrap(function _callee5$(_context5) { |
|
|
|
|
|
|
3075
|
|
|
while (1) { |
|
3076
|
|
|
switch (_context5.prev = _context5.next) { |
|
3077
|
|
|
case 0: |
|
3078
|
|
|
return _context5.abrupt("return", this.doRequest("".concat(this.urlBase, "/").concat(dataset, "/dicomStores"))); |
|
3079
|
|
|
|
|
3080
|
|
|
case 1: |
|
3081
|
|
|
case "end": |
|
3082
|
|
|
return _context5.stop(); |
|
3083
|
|
|
} |
|
3084
|
|
|
} |
|
|
|
|
|
|
3085
|
|
|
}, _callee5, this); |
|
3086
|
|
|
})); |
|
3087
|
|
|
|
|
3088
|
|
|
function loadDicomStores(_x5) { |
|
|
|
|
|
|
3089
|
|
|
return _loadDicomStores.apply(this, arguments); |
|
3090
|
|
|
} |
|
3091
|
|
|
|
|
3092
|
|
|
return loadDicomStores; |
|
3093
|
|
|
}() |
|
3094
|
|
|
}, { |
|
3095
|
|
|
key: "fetchConfig", |
|
3096
|
|
|
get: function get() { |
|
3097
|
|
|
if (!this.accessToken) throw new Error('OIDC access_token is not set'); |
|
|
|
|
|
|
3098
|
|
|
return { |
|
3099
|
|
|
method: 'GET', |
|
3100
|
|
|
headers: { |
|
3101
|
|
|
Authorization: 'Bearer ' + this.accessToken |
|
3102
|
|
|
} |
|
3103
|
|
|
}; |
|
3104
|
|
|
} |
|
3105
|
|
|
}, { |
|
3106
|
|
|
key: "urlBase", |
|
3107
|
|
|
get: function get() { |
|
3108
|
|
|
return this.healthcareApiEndpoint || 'https://healthcare.googleapis.com/v1beta1'; |
|
3109
|
|
|
}, |
|
3110
|
|
|
set: function set(url) { |
|
3111
|
|
|
this.healthcareApiEndpoint = url; |
|
3112
|
|
|
} |
|
3113
|
|
|
}, { |
|
3114
|
|
|
key: "urlBaseProject", |
|
3115
|
|
|
get: function get() { |
|
3116
|
|
|
return this.urlBase + "/projects"; |
|
3117
|
|
|
} |
|
3118
|
|
|
}]); |
|
3119
|
|
|
|
|
3120
|
|
|
return GoogleCloudApi; |
|
3121
|
|
|
}(); |
|
3122
|
|
|
|
|
3123
|
|
|
/* harmony default export */ __webpack_exports__["a"] = (new GoogleCloudApi()); |
|
3124
|
|
|
|
|
3125
|
|
|
/***/ }), |
|
3126
|
|
|
|
|
3127
|
|
|
/***/ 963: |
|
3128
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
3129
|
|
|
|
|
3130
|
|
|
"use strict"; |
|
3131
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getServers; }); |
|
3132
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return isValidServer; }); |
|
3133
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isEqualServer; }); |
|
3134
|
|
|
var getServers = function getServers(data, name) { |
|
3135
|
|
|
var wadoUriRoot = data.wadoUriRoot, |
|
3136
|
|
|
qidoRoot = data.qidoRoot, |
|
3137
|
|
|
wadoRoot = data.wadoRoot, |
|
3138
|
|
|
_data$dataset = data.dataset, |
|
3139
|
|
|
dataset = _data$dataset === void 0 ? '' : _data$dataset, |
|
|
|
|
|
|
3140
|
|
|
_data$dicomStore = data.dicomStore, |
|
3141
|
|
|
dicomStore = _data$dicomStore === void 0 ? '' : _data$dicomStore, |
|
|
|
|
|
|
3142
|
|
|
_data$location = data.location, |
|
3143
|
|
|
location = _data$location === void 0 ? '' : _data$location, |
|
|
|
|
|
|
3144
|
|
|
_data$project = data.project, |
|
3145
|
|
|
project = _data$project === void 0 ? '' : _data$project; |
|
|
|
|
|
|
3146
|
|
|
return [{ |
|
3147
|
|
|
name: name, |
|
3148
|
|
|
dataset: dataset, |
|
3149
|
|
|
dicomStore: dicomStore, |
|
3150
|
|
|
location: location, |
|
3151
|
|
|
project: project, |
|
3152
|
|
|
imageRendering: 'wadors', |
|
3153
|
|
|
thumbnailRendering: 'wadors', |
|
3154
|
|
|
type: 'dicomWeb', |
|
3155
|
|
|
active: true, |
|
3156
|
|
|
wadoUriRoot: wadoUriRoot, |
|
3157
|
|
|
qidoRoot: qidoRoot, |
|
3158
|
|
|
wadoRoot: wadoRoot, |
|
3159
|
|
|
supportsFuzzyMatching: false, |
|
3160
|
|
|
qidoSupportsIncludeField: false |
|
3161
|
|
|
}]; |
|
3162
|
|
|
}; |
|
3163
|
|
|
|
|
3164
|
|
|
var isValidServer = function isValidServer(server) { |
|
3165
|
|
|
return server && !!server.dataset && !!server.dicomStore && !!server.location && !!server.project; |
|
3166
|
|
|
}; |
|
3167
|
|
|
|
|
3168
|
|
|
var isEqualServer = function isEqualServer() { |
|
3169
|
|
|
var server = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
3170
|
|
|
var toCompare = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; |
|
3171
|
|
|
var serverLength = Object.keys(server).length; |
|
3172
|
|
|
var toCompareLength = Object.keys(toCompare).length; |
|
3173
|
|
|
|
|
3174
|
|
|
if (!serverLength || !toCompareLength) { |
|
3175
|
|
|
return false; |
|
3176
|
|
|
} |
|
3177
|
|
|
|
|
3178
|
|
|
return server.dataset === toCompare.dataset && server.dataset === toCompare.dataset && server.dicomStore === toCompare.dicomStore && server.location === toCompare.location && server.project === toCompare.project; |
|
3179
|
|
|
}; |
|
3180
|
|
|
|
|
3181
|
|
|
|
|
3182
|
|
|
|
|
3183
|
|
|
/***/ }), |
|
3184
|
|
|
|
|
3185
|
|
|
/***/ 965: |
|
3186
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
3187
|
|
|
|
|
3188
|
|
|
"use strict"; |
|
3189
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useServer; }); |
|
3190
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); |
|
3191
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
|
|
|
|
|
|
3192
|
|
|
/* harmony import */ var _googleCloud_api_GoogleCloudApi__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(958); |
|
3193
|
|
|
/* harmony import */ var _usePrevious__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(957); |
|
3194
|
|
|
/* harmony import */ var _googleCloud_utils_getServers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(963); |
|
3195
|
|
|
/* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(59); |
|
3196
|
|
|
/* harmony import */ var lodash_isequal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(227); |
|
3197
|
|
|
/* harmony import */ var lodash_isequal__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(lodash_isequal__WEBPACK_IMPORTED_MODULE_5__); |
|
|
|
|
|
|
3198
|
|
|
/* harmony import */ var _context_AppContext__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(90); |
|
3199
|
|
|
|
|
3200
|
|
|
|
|
3201
|
|
|
|
|
3202
|
|
|
|
|
3203
|
|
|
|
|
3204
|
|
|
// Contexts |
|
3205
|
|
|
|
|
3206
|
|
|
|
|
3207
|
|
|
|
|
3208
|
|
|
var getActiveServer = function getActiveServer(servers) { |
|
3209
|
|
|
var isActive = function isActive(a) { |
|
3210
|
|
|
return a.active === true; |
|
3211
|
|
|
}; |
|
3212
|
|
|
|
|
3213
|
|
|
return servers && servers.servers && servers.servers.find(isActive); |
|
3214
|
|
|
}; |
|
3215
|
|
|
|
|
3216
|
|
|
var getServers = function getServers(appConfig, project, location, dataset, dicomStore) { |
|
3217
|
|
|
var servers = []; |
|
3218
|
|
|
|
|
3219
|
|
|
if (appConfig.enableGoogleCloudAdapter) { |
|
3220
|
|
|
_googleCloud_api_GoogleCloudApi__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].urlBase = appConfig.healthcareApiEndpoint; |
|
3221
|
|
|
var pathUrl = _googleCloud_api_GoogleCloudApi__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].getUrlBaseDicomWeb(project, location, dataset, dicomStore); |
|
3222
|
|
|
var data = { |
|
3223
|
|
|
project: project, |
|
3224
|
|
|
location: location, |
|
3225
|
|
|
dataset: dataset, |
|
3226
|
|
|
dicomStore: dicomStore, |
|
3227
|
|
|
wadoUriRoot: pathUrl, |
|
3228
|
|
|
qidoRoot: pathUrl, |
|
3229
|
|
|
wadoRoot: pathUrl |
|
3230
|
|
|
}; |
|
3231
|
|
|
servers = _googleCloud_utils_getServers__WEBPACK_IMPORTED_MODULE_3__[/* getServers */ "a"](data, dicomStore); |
|
3232
|
|
|
|
|
3233
|
|
|
if (!isValidServer(servers[0], appConfig)) { |
|
3234
|
|
|
return; |
|
|
|
|
|
|
3235
|
|
|
} |
|
3236
|
|
|
} |
|
3237
|
|
|
|
|
3238
|
|
|
return servers; |
|
3239
|
|
|
}; |
|
3240
|
|
|
|
|
3241
|
|
|
var isValidServer = function isValidServer(server, appConfig) { |
|
3242
|
|
|
if (appConfig.enableGoogleCloudAdapter) { |
|
3243
|
|
|
return _googleCloud_utils_getServers__WEBPACK_IMPORTED_MODULE_3__[/* isValidServer */ "c"](server); |
|
3244
|
|
|
} |
|
3245
|
|
|
|
|
3246
|
|
|
return !!server; |
|
3247
|
|
|
}; |
|
3248
|
|
|
|
|
3249
|
|
|
var setServers = function setServers(dispatch, servers) { |
|
3250
|
|
|
var action = { |
|
3251
|
|
|
type: 'SET_SERVERS', |
|
3252
|
|
|
servers: servers |
|
3253
|
|
|
}; |
|
3254
|
|
|
dispatch(action); |
|
3255
|
|
|
}; |
|
3256
|
|
|
|
|
3257
|
|
|
var useServerFromUrl = function useServerFromUrl() { |
|
3258
|
|
|
var servers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; |
|
3259
|
|
|
var previousServers = arguments.length > 1 ? arguments[1] : undefined; |
|
3260
|
|
|
var activeServer = arguments.length > 2 ? arguments[2] : undefined; |
|
3261
|
|
|
var urlBasedServers = arguments.length > 3 ? arguments[3] : undefined; |
|
3262
|
|
|
var appConfig = arguments.length > 4 ? arguments[4] : undefined; |
|
3263
|
|
|
var project = arguments.length > 5 ? arguments[5] : undefined; |
|
|
|
|
|
|
3264
|
|
|
var location = arguments.length > 6 ? arguments[6] : undefined; |
|
|
|
|
|
|
3265
|
|
|
var dataset = arguments.length > 7 ? arguments[7] : undefined; |
|
|
|
|
|
|
3266
|
|
|
var dicomStore = arguments.length > 8 ? arguments[8] : undefined; |
|
|
|
|
|
|
3267
|
|
|
|
|
3268
|
|
|
// update state from url available only when gcloud on |
|
3269
|
|
|
if (!appConfig.enableGoogleCloudAdapter) { |
|
3270
|
|
|
return false; |
|
3271
|
|
|
} |
|
3272
|
|
|
|
|
3273
|
|
|
var serverHasChanged = previousServers !== servers && previousServers; // do not update from url. use state instead. |
|
3274
|
|
|
|
|
3275
|
|
|
if (serverHasChanged) { |
|
3276
|
|
|
return false; |
|
3277
|
|
|
} // if no valid urlbased servers |
|
3278
|
|
|
|
|
3279
|
|
|
|
|
3280
|
|
|
if (!urlBasedServers || !urlBasedServers.length) { |
|
3281
|
|
|
return false; |
|
3282
|
|
|
} else if (!servers.length || !activeServer) { |
|
3283
|
|
|
// no current valid server |
|
3284
|
|
|
return true; |
|
3285
|
|
|
} |
|
3286
|
|
|
|
|
3287
|
|
|
var newServer = urlBasedServers[0]; |
|
3288
|
|
|
var exists = servers.some(_googleCloud_utils_getServers__WEBPACK_IMPORTED_MODULE_3__[/* isEqualServer */ "b"].bind(undefined, newServer)); |
|
3289
|
|
|
return !exists; |
|
3290
|
|
|
}; |
|
3291
|
|
|
|
|
3292
|
|
|
function useServer() { |
|
3293
|
|
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, |
|
3294
|
|
|
project = _ref.project, |
|
3295
|
|
|
location = _ref.location, |
|
3296
|
|
|
dataset = _ref.dataset, |
|
3297
|
|
|
dicomStore = _ref.dicomStore; |
|
3298
|
|
|
|
|
3299
|
|
|
// Hooks |
|
3300
|
|
|
var servers = Object(react_redux__WEBPACK_IMPORTED_MODULE_4__[/* useSelector */ "d"])(function (state) { |
|
3301
|
|
|
return state && state.servers; |
|
3302
|
|
|
}); |
|
3303
|
|
|
var previousServers = Object(_usePrevious__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(servers); |
|
3304
|
|
|
var dispatch = Object(react_redux__WEBPACK_IMPORTED_MODULE_4__[/* useDispatch */ "c"])(); |
|
3305
|
|
|
|
|
3306
|
|
|
var _useContext = Object(react__WEBPACK_IMPORTED_MODULE_0__["useContext"])(_context_AppContext__WEBPACK_IMPORTED_MODULE_6__[/* default */ "c"]), |
|
3307
|
|
|
_useContext$appConfig = _useContext.appConfig, |
|
3308
|
|
|
appConfig = _useContext$appConfig === void 0 ? {} : _useContext$appConfig; |
|
|
|
|
|
|
3309
|
|
|
|
|
3310
|
|
|
var activeServer = getActiveServer(servers); |
|
3311
|
|
|
var urlBasedServers = getServers(appConfig, project, location, dataset, dicomStore) || []; |
|
3312
|
|
|
var shouldUpdateServer = useServerFromUrl(servers.servers, previousServers, activeServer, urlBasedServers, appConfig, project, location, dataset, dicomStore); |
|
3313
|
|
|
|
|
3314
|
|
|
if (shouldUpdateServer) { |
|
3315
|
|
|
setServers(dispatch, urlBasedServers); |
|
|
|
|
|
|
3316
|
|
|
} else if (isValidServer(activeServer, appConfig)) { |
|
|
|
|
|
|
3317
|
|
|
return activeServer; |
|
3318
|
|
|
} |
|
3319
|
|
|
} |
|
3320
|
|
|
|
|
3321
|
|
|
/***/ }), |
|
3322
|
|
|
|
|
3323
|
|
|
/***/ 969: |
|
3324
|
|
View Code Duplication |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
|
|
|
|
|
3325
|
|
|
|
|
3326
|
|
|
"use strict"; |
|
3327
|
|
|
|
|
3328
|
|
|
// EXTERNAL MODULE: /home/salim/GaelO-Dev/OHIF/Viewers/node_modules/cornerstone-wado-image-loader/dist/cornerstoneWADOImageLoader.min.js |
|
3329
|
|
|
var cornerstoneWADOImageLoader_min = __webpack_require__(55); |
|
3330
|
|
|
var cornerstoneWADOImageLoader_min_default = /*#__PURE__*/__webpack_require__.n(cornerstoneWADOImageLoader_min); |
|
3331
|
|
|
|
|
3332
|
|
|
// CONCATENATED MODULE: ./lib/localFileLoaders/fileLoader.js |
|
3333
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
3334
|
|
|
|
|
3335
|
|
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } |
|
|
|
|
|
|
3336
|
|
|
|
|
3337
|
|
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } |
|
|
|
|
|
|
3338
|
|
|
|
|
3339
|
|
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
|
3340
|
|
|
|
|
3341
|
|
|
var FileLoader = |
|
3342
|
|
|
/*#__PURE__*/ |
|
3343
|
|
|
function () { |
|
3344
|
|
|
function FileLoader() { |
|
3345
|
|
|
_classCallCheck(this, FileLoader); |
|
3346
|
|
|
|
|
3347
|
|
|
_defineProperty(this, "fileType", void 0); |
|
|
|
|
|
|
3348
|
|
|
} |
|
3349
|
|
|
|
|
3350
|
|
|
_createClass(FileLoader, [{ |
|
3351
|
|
|
key: "loadFile", |
|
3352
|
|
|
value: function loadFile(file, imageId) {} |
|
|
|
|
|
|
3353
|
|
|
}, { |
|
3354
|
|
|
key: "getDataset", |
|
3355
|
|
|
value: function getDataset(image, imageId) {} |
|
|
|
|
|
|
3356
|
|
|
}, { |
|
3357
|
|
|
key: "getStudies", |
|
3358
|
|
|
value: function getStudies(dataset, imageId) {} |
|
|
|
|
|
|
3359
|
|
|
}]); |
|
3360
|
|
|
|
|
3361
|
|
|
return FileLoader; |
|
3362
|
|
|
}(); |
|
3363
|
|
|
|
|
3364
|
|
|
|
|
3365
|
|
|
// CONCATENATED MODULE: ./lib/localFileLoaders/pdfFileLoader.js |
|
3366
|
|
|
var pdfFileLoader_temp; |
|
3367
|
|
|
|
|
3368
|
|
|
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } |
|
|
|
|
|
|
3369
|
|
|
|
|
3370
|
|
|
function pdfFileLoader_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
3371
|
|
|
|
|
3372
|
|
|
function pdfFileLoader_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } |
|
|
|
|
|
|
3373
|
|
|
|
|
3374
|
|
|
function pdfFileLoader_createClass(Constructor, protoProps, staticProps) { if (protoProps) pdfFileLoader_defineProperties(Constructor.prototype, protoProps); if (staticProps) pdfFileLoader_defineProperties(Constructor, staticProps); return Constructor; } |
|
|
|
|
|
|
3375
|
|
|
|
|
3376
|
|
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } |
|
3377
|
|
|
|
|
3378
|
|
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } |
|
3379
|
|
|
|
|
3380
|
|
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } |
|
|
|
|
|
|
3381
|
|
|
|
|
3382
|
|
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } |
|
|
|
|
|
|
3383
|
|
|
|
|
3384
|
|
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } |
|
3385
|
|
|
|
|
3386
|
|
|
function pdfFileLoader_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
|
3387
|
|
|
|
|
3388
|
|
|
|
|
3389
|
|
|
|
|
3390
|
|
|
var PDFFileLoader = new (pdfFileLoader_temp = |
|
|
|
|
|
|
3391
|
|
|
/*#__PURE__*/ |
|
3392
|
|
|
function (_FileLoader) { |
|
3393
|
|
|
_inherits(_temp, _FileLoader); |
|
3394
|
|
|
|
|
3395
|
|
|
function _temp() { |
|
3396
|
|
|
var _getPrototypeOf2; |
|
3397
|
|
|
|
|
3398
|
|
|
var _this; |
|
3399
|
|
|
|
|
3400
|
|
|
pdfFileLoader_classCallCheck(this, _temp); |
|
3401
|
|
|
|
|
3402
|
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
|
|
|
|
|
|
3403
|
|
|
args[_key] = arguments[_key]; |
|
3404
|
|
|
} |
|
3405
|
|
|
|
|
3406
|
|
|
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(_temp)).call.apply(_getPrototypeOf2, [this].concat(args))); |
|
3407
|
|
|
|
|
3408
|
|
|
pdfFileLoader_defineProperty(_assertThisInitialized(_this), "fileType", 'application/pdf'); |
|
3409
|
|
|
|
|
3410
|
|
|
return _this; |
|
3411
|
|
|
} |
|
3412
|
|
|
|
|
3413
|
|
|
pdfFileLoader_createClass(_temp, [{ |
|
3414
|
|
|
key: "loadFile", |
|
3415
|
|
|
value: function loadFile(file, imageId) { |
|
3416
|
|
|
return cornerstoneWADOImageLoader_min_default.a.wadouri.loadFileRequest(imageId); |
|
3417
|
|
|
} |
|
3418
|
|
|
}, { |
|
3419
|
|
|
key: "getDataset", |
|
3420
|
|
|
value: function getDataset(image, imageId) { |
|
3421
|
|
|
var dataset = {}; |
|
3422
|
|
|
dataset.imageId = image.imageId || imageId; |
|
3423
|
|
|
return dataset; |
|
3424
|
|
|
} |
|
3425
|
|
|
}, { |
|
3426
|
|
|
key: "getStudies", |
|
3427
|
|
|
value: function getStudies(dataset, imageId) { |
|
3428
|
|
|
return this.getDefaultStudy(imageId); |
|
3429
|
|
|
} |
|
3430
|
|
|
}, { |
|
3431
|
|
|
key: "getDefaultStudy", |
|
3432
|
|
|
value: function getDefaultStudy(imageId) { |
|
3433
|
|
|
var study = { |
|
3434
|
|
|
StudyInstanceUID: '', |
|
3435
|
|
|
StudyDate: '', |
|
3436
|
|
|
StudyTime: '', |
|
3437
|
|
|
AccessionNumber: '', |
|
3438
|
|
|
ReferringPhysicianName: '', |
|
3439
|
|
|
PatientName: '', |
|
3440
|
|
|
PatientID: '', |
|
3441
|
|
|
PatientBirthdate: '', |
|
3442
|
|
|
PatientSex: '', |
|
3443
|
|
|
StudyId: '', |
|
3444
|
|
|
StudyDescription: '', |
|
3445
|
|
|
series: [{ |
|
3446
|
|
|
SeriesInstanceUID: '', |
|
3447
|
|
|
SeriesDescription: '', |
|
3448
|
|
|
SeriesNumber: '', |
|
3449
|
|
|
instances: [{ |
|
3450
|
|
|
metadata: { |
|
3451
|
|
|
SOPInstanceUID: '', |
|
3452
|
|
|
SOPClassUID: '1.2.840.10008.5.1.4.1.1.104.1', |
|
3453
|
|
|
Rows: '', |
|
3454
|
|
|
Columns: '', |
|
3455
|
|
|
NumberOfFrames: 0, |
|
3456
|
|
|
InstanceNumber: 1 |
|
3457
|
|
|
}, |
|
3458
|
|
|
getImageId: function getImageId() { |
|
3459
|
|
|
return imageId; |
|
3460
|
|
|
}, |
|
3461
|
|
|
isLocalFile: true |
|
3462
|
|
|
}] |
|
3463
|
|
|
}] |
|
3464
|
|
|
}; |
|
3465
|
|
|
return study; |
|
3466
|
|
|
} |
|
3467
|
|
|
}]); |
|
3468
|
|
|
|
|
3469
|
|
|
return _temp; |
|
3470
|
|
|
}(FileLoader), pdfFileLoader_temp)(); |
|
3471
|
|
|
/* harmony default export */ var pdfFileLoader = (PDFFileLoader); |
|
3472
|
|
|
// EXTERNAL MODULE: /home/salim/GaelO-Dev/OHIF/Viewers/node_modules/dcmjs/build/dcmjs.es.js |
|
3473
|
|
|
var dcmjs_es = __webpack_require__(30); |
|
3474
|
|
|
|
|
3475
|
|
|
// EXTERNAL MODULE: /home/salim/GaelO-Dev/OHIF/Viewers/platform/core/src/index.js + 33 modules |
|
3476
|
|
|
var src = __webpack_require__(13); |
|
3477
|
|
|
|
|
3478
|
|
|
// CONCATENATED MODULE: ./lib/localFileLoaders/dicomFileLoader.js |
|
3479
|
|
|
var dicomFileLoader_temp; |
|
3480
|
|
|
|
|
3481
|
|
|
function dicomFileLoader_typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { dicomFileLoader_typeof = function _typeof(obj) { return typeof obj; }; } else { dicomFileLoader_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return dicomFileLoader_typeof(obj); } |
|
|
|
|
|
|
3482
|
|
|
|
|
3483
|
|
|
function dicomFileLoader_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
3484
|
|
|
|
|
3485
|
|
|
function dicomFileLoader_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } |
|
|
|
|
|
|
3486
|
|
|
|
|
3487
|
|
|
function dicomFileLoader_createClass(Constructor, protoProps, staticProps) { if (protoProps) dicomFileLoader_defineProperties(Constructor.prototype, protoProps); if (staticProps) dicomFileLoader_defineProperties(Constructor, staticProps); return Constructor; } |
|
|
|
|
|
|
3488
|
|
|
|
|
3489
|
|
|
function dicomFileLoader_possibleConstructorReturn(self, call) { if (call && (dicomFileLoader_typeof(call) === "object" || typeof call === "function")) { return call; } return dicomFileLoader_assertThisInitialized(self); } |
|
3490
|
|
|
|
|
3491
|
|
|
function dicomFileLoader_getPrototypeOf(o) { dicomFileLoader_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return dicomFileLoader_getPrototypeOf(o); } |
|
|
|
|
|
|
3492
|
|
|
|
|
3493
|
|
|
function dicomFileLoader_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } |
|
|
|
|
|
|
3494
|
|
|
|
|
3495
|
|
|
function dicomFileLoader_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) dicomFileLoader_setPrototypeOf(subClass, superClass); } |
|
|
|
|
|
|
3496
|
|
|
|
|
3497
|
|
|
function dicomFileLoader_setPrototypeOf(o, p) { dicomFileLoader_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return dicomFileLoader_setPrototypeOf(o, p); } |
|
|
|
|
|
|
3498
|
|
|
|
|
3499
|
|
|
function dicomFileLoader_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
|
3500
|
|
|
|
|
3501
|
|
|
|
|
3502
|
|
|
|
|
3503
|
|
|
|
|
3504
|
|
|
|
|
3505
|
|
|
var metadataProvider = src["a" /* default */].cornerstone.metadataProvider; |
|
3506
|
|
|
var DICOMFileLoader = new (dicomFileLoader_temp = |
|
|
|
|
|
|
3507
|
|
|
/*#__PURE__*/ |
|
3508
|
|
|
function (_FileLoader) { |
|
3509
|
|
|
dicomFileLoader_inherits(_temp, _FileLoader); |
|
3510
|
|
|
|
|
3511
|
|
|
function _temp() { |
|
3512
|
|
|
var _getPrototypeOf2; |
|
3513
|
|
|
|
|
3514
|
|
|
var _this; |
|
3515
|
|
|
|
|
3516
|
|
|
dicomFileLoader_classCallCheck(this, _temp); |
|
3517
|
|
|
|
|
3518
|
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
|
|
|
|
|
|
3519
|
|
|
args[_key] = arguments[_key]; |
|
3520
|
|
|
} |
|
3521
|
|
|
|
|
3522
|
|
|
_this = dicomFileLoader_possibleConstructorReturn(this, (_getPrototypeOf2 = dicomFileLoader_getPrototypeOf(_temp)).call.apply(_getPrototypeOf2, [this].concat(args))); |
|
3523
|
|
|
|
|
3524
|
|
|
dicomFileLoader_defineProperty(dicomFileLoader_assertThisInitialized(_this), "fileType", 'application/dicom'); |
|
3525
|
|
|
|
|
3526
|
|
|
return _this; |
|
3527
|
|
|
} |
|
3528
|
|
|
|
|
3529
|
|
|
dicomFileLoader_createClass(_temp, [{ |
|
3530
|
|
|
key: "loadFile", |
|
3531
|
|
|
value: function loadFile(file, imageId) { |
|
3532
|
|
|
return cornerstoneWADOImageLoader_min_default.a.wadouri.loadFileRequest(imageId); |
|
3533
|
|
|
} |
|
3534
|
|
|
}, { |
|
3535
|
|
|
key: "getDataset", |
|
3536
|
|
|
value: function getDataset(image, imageId) { |
|
3537
|
|
|
var dataset = {}; |
|
3538
|
|
|
|
|
3539
|
|
|
try { |
|
3540
|
|
|
var dicomData = dcmjs_es["a" /* default */].data.DicomMessage.readFile(image); |
|
3541
|
|
|
dataset = dcmjs_es["a" /* default */].data.DicomMetaDictionary.naturalizeDataset(dicomData.dict); |
|
3542
|
|
|
metadataProvider.addInstance(dataset); |
|
3543
|
|
|
dataset._meta = dcmjs_es["a" /* default */].data.DicomMetaDictionary.namifyDataset(dicomData.meta); |
|
3544
|
|
|
} catch (e) { |
|
3545
|
|
|
console.error('Error reading dicom file', e); |
|
3546
|
|
|
} // Set imageId on dataset to be consumed later on |
|
3547
|
|
|
|
|
3548
|
|
|
|
|
3549
|
|
|
dataset.imageId = imageId; |
|
3550
|
|
|
return dataset; |
|
3551
|
|
|
} |
|
3552
|
|
|
}, { |
|
3553
|
|
|
key: "getStudies", |
|
3554
|
|
|
value: function getStudies(dataset, imageId) { |
|
|
|
|
|
|
3555
|
|
|
return this.getStudyFromDataset(dataset); |
|
3556
|
|
|
} |
|
3557
|
|
|
}, { |
|
3558
|
|
|
key: "getStudyFromDataset", |
|
3559
|
|
|
value: function getStudyFromDataset() { |
|
3560
|
|
|
var dataset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
3561
|
|
|
var StudyInstanceUID = dataset.StudyInstanceUID, |
|
3562
|
|
|
StudyDate = dataset.StudyDate, |
|
3563
|
|
|
StudyTime = dataset.StudyTime, |
|
3564
|
|
|
AccessionNumber = dataset.AccessionNumber, |
|
3565
|
|
|
ReferringPhysicianName = dataset.ReferringPhysicianName, |
|
3566
|
|
|
PatientName = dataset.PatientName, |
|
3567
|
|
|
PatientID = dataset.PatientID, |
|
3568
|
|
|
PatientBirthDate = dataset.PatientBirthDate, |
|
3569
|
|
|
PatientSex = dataset.PatientSex, |
|
3570
|
|
|
StudyID = dataset.StudyID, |
|
3571
|
|
|
StudyDescription = dataset.StudyDescription, |
|
3572
|
|
|
SeriesInstanceUID = dataset.SeriesInstanceUID, |
|
3573
|
|
|
SeriesDescription = dataset.SeriesDescription, |
|
3574
|
|
|
SeriesNumber = dataset.SeriesNumber, |
|
3575
|
|
|
imageId = dataset.imageId; |
|
3576
|
|
|
var instance = { |
|
3577
|
|
|
metadata: dataset, |
|
3578
|
|
|
url: imageId |
|
3579
|
|
|
}; |
|
3580
|
|
|
var series = { |
|
3581
|
|
|
SeriesInstanceUID: SeriesInstanceUID, |
|
3582
|
|
|
SeriesDescription: SeriesDescription, |
|
3583
|
|
|
SeriesNumber: SeriesNumber, |
|
3584
|
|
|
instances: [instance] |
|
3585
|
|
|
}; |
|
3586
|
|
|
var study = { |
|
3587
|
|
|
StudyInstanceUID: StudyInstanceUID, |
|
3588
|
|
|
StudyDate: StudyDate, |
|
3589
|
|
|
StudyTime: StudyTime, |
|
3590
|
|
|
AccessionNumber: AccessionNumber, |
|
3591
|
|
|
ReferringPhysicianName: ReferringPhysicianName, |
|
3592
|
|
|
PatientName: PatientName, |
|
3593
|
|
|
PatientID: PatientID, |
|
3594
|
|
|
PatientBirthDate: PatientBirthDate, |
|
3595
|
|
|
PatientSex: PatientSex, |
|
3596
|
|
|
StudyID: StudyID, |
|
3597
|
|
|
StudyDescription: StudyDescription, |
|
3598
|
|
|
|
|
3599
|
|
|
/* |
|
3600
|
|
|
TODO: in case necessary to uncomment this block, double check every property |
|
3601
|
|
|
numberOfStudyRelatedSeries: NumberOfStudyRelatedSeries || DICOMWeb.getString(dataset['00201206']), |
|
3602
|
|
|
numberOfStudyRelatedInstances: NumberOfStudyRelatedInstances || DICOMWeb.getString(dataset['00201208']), |
|
3603
|
|
|
Modality: Modality || DICOMWeb.getString(dataset['00080060']), |
|
3604
|
|
|
ModalitiesInStudy: ModalitiesInStudy || DICOMWeb.getString(dataset['00080061']), |
|
3605
|
|
|
modalities: |
|
3606
|
|
|
*/ |
|
3607
|
|
|
series: [series] |
|
3608
|
|
|
}; |
|
3609
|
|
|
return study; |
|
3610
|
|
|
} |
|
3611
|
|
|
}]); |
|
3612
|
|
|
|
|
3613
|
|
|
return _temp; |
|
3614
|
|
|
}(FileLoader), dicomFileLoader_temp)(); |
|
3615
|
|
|
/* harmony default export */ var dicomFileLoader = (DICOMFileLoader); |
|
3616
|
|
|
// CONCATENATED MODULE: ./lib/localFileLoaders/fileLoaderService.js |
|
3617
|
|
|
function fileLoaderService_typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { fileLoaderService_typeof = function _typeof(obj) { return typeof obj; }; } else { fileLoaderService_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return fileLoaderService_typeof(obj); } |
|
|
|
|
|
|
3618
|
|
|
|
|
3619
|
|
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } |
|
3620
|
|
|
|
|
3621
|
|
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } |
|
3622
|
|
|
|
|
3623
|
|
|
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } |
|
|
|
|
|
|
3624
|
|
|
|
|
3625
|
|
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } |
|
|
|
|
|
|
3626
|
|
|
|
|
3627
|
|
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
|
|
|
|
|
3628
|
|
|
|
|
3629
|
|
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { fileLoaderService_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
|
|
|
|
|
3630
|
|
|
|
|
3631
|
|
|
function fileLoaderService_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
3632
|
|
|
|
|
3633
|
|
|
function fileLoaderService_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } |
|
|
|
|
|
|
3634
|
|
|
|
|
3635
|
|
|
function fileLoaderService_createClass(Constructor, protoProps, staticProps) { if (protoProps) fileLoaderService_defineProperties(Constructor.prototype, protoProps); if (staticProps) fileLoaderService_defineProperties(Constructor, staticProps); return Constructor; } |
|
|
|
|
|
|
3636
|
|
|
|
|
3637
|
|
|
function fileLoaderService_possibleConstructorReturn(self, call) { if (call && (fileLoaderService_typeof(call) === "object" || typeof call === "function")) { return call; } return fileLoaderService_assertThisInitialized(self); } |
|
3638
|
|
|
|
|
3639
|
|
|
function fileLoaderService_getPrototypeOf(o) { fileLoaderService_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return fileLoaderService_getPrototypeOf(o); } |
|
|
|
|
|
|
3640
|
|
|
|
|
3641
|
|
|
function fileLoaderService_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } |
|
|
|
|
|
|
3642
|
|
|
|
|
3643
|
|
|
function fileLoaderService_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) fileLoaderService_setPrototypeOf(subClass, superClass); } |
|
|
|
|
|
|
3644
|
|
|
|
|
3645
|
|
|
function fileLoaderService_setPrototypeOf(o, p) { fileLoaderService_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return fileLoaderService_setPrototypeOf(o, p); } |
|
|
|
|
|
|
3646
|
|
|
|
|
3647
|
|
|
function fileLoaderService_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
|
3648
|
|
|
|
|
3649
|
|
|
|
|
3650
|
|
|
|
|
3651
|
|
|
|
|
3652
|
|
|
|
|
3653
|
|
|
|
|
3654
|
|
|
var fileLoaderService_FileLoaderService = |
|
3655
|
|
|
/*#__PURE__*/ |
|
3656
|
|
|
function (_FileLoader) { |
|
3657
|
|
|
fileLoaderService_inherits(FileLoaderService, _FileLoader); |
|
3658
|
|
|
|
|
3659
|
|
|
function FileLoaderService(file) { |
|
3660
|
|
|
var _this; |
|
3661
|
|
|
|
|
3662
|
|
|
fileLoaderService_classCallCheck(this, FileLoaderService); |
|
3663
|
|
|
|
|
3664
|
|
|
_this = fileLoaderService_possibleConstructorReturn(this, fileLoaderService_getPrototypeOf(FileLoaderService).call(this)); |
|
3665
|
|
|
|
|
3666
|
|
|
fileLoaderService_defineProperty(fileLoaderService_assertThisInitialized(_this), "fileType", void 0); |
|
|
|
|
|
|
3667
|
|
|
|
|
3668
|
|
|
fileLoaderService_defineProperty(fileLoaderService_assertThisInitialized(_this), "loader", void 0); |
|
|
|
|
|
|
3669
|
|
|
|
|
3670
|
|
|
var fileType = file && file.type; |
|
3671
|
|
|
_this.loader = _this.getLoader(fileType); |
|
3672
|
|
|
_this.fileType = _this.loader.fileType; |
|
3673
|
|
|
return _this; |
|
3674
|
|
|
} |
|
3675
|
|
|
|
|
3676
|
|
|
fileLoaderService_createClass(FileLoaderService, [{ |
|
3677
|
|
|
key: "addFile", |
|
3678
|
|
|
value: function addFile(file) { |
|
3679
|
|
|
return cornerstoneWADOImageLoader_min_default.a.wadouri.fileManager.add(file); |
|
3680
|
|
|
} |
|
3681
|
|
|
}, { |
|
3682
|
|
|
key: "loadFile", |
|
3683
|
|
|
value: function loadFile(file, imageId) { |
|
3684
|
|
|
return this.loader.loadFile(file, imageId); |
|
3685
|
|
|
} |
|
3686
|
|
|
}, { |
|
3687
|
|
|
key: "getDataset", |
|
3688
|
|
|
value: function getDataset(image, imageId) { |
|
3689
|
|
|
return this.loader.getDataset(image, imageId); |
|
3690
|
|
|
} |
|
3691
|
|
|
}, { |
|
3692
|
|
|
key: "getStudies", |
|
3693
|
|
|
value: function getStudies(dataset, imageId) { |
|
3694
|
|
|
return this.loader.getStudies(dataset, imageId); |
|
3695
|
|
|
} |
|
3696
|
|
|
}, { |
|
3697
|
|
|
key: "getLoader", |
|
3698
|
|
|
value: function getLoader(fileType) { |
|
3699
|
|
|
if (fileType === 'application/pdf') { |
|
3700
|
|
|
return pdfFileLoader; |
|
3701
|
|
|
} else { |
|
|
|
|
|
|
3702
|
|
|
// Default to dicom loader |
|
3703
|
|
|
return dicomFileLoader; |
|
3704
|
|
|
} |
|
3705
|
|
|
} |
|
3706
|
|
|
}], [{ |
|
3707
|
|
|
key: "groupSeries", |
|
3708
|
|
|
value: function groupSeries(studies) { |
|
3709
|
|
|
var groupBy = function groupBy(list, groupByKey, listKey) { |
|
3710
|
|
|
var nonKeyCounter = 1; |
|
3711
|
|
|
return list.reduce(function (acc, obj) { |
|
3712
|
|
|
var _acc$key$listKey; |
|
3713
|
|
|
|
|
3714
|
|
|
var key = obj[groupByKey]; |
|
3715
|
|
|
var list = obj[listKey]; // in case key not found, group it using counter |
|
3716
|
|
|
|
|
3717
|
|
|
key = !!key ? key : '' + nonKeyCounter++; |
|
3718
|
|
|
|
|
3719
|
|
|
if (!acc[key]) { |
|
3720
|
|
|
acc[key] = _objectSpread({}, obj); |
|
3721
|
|
|
acc[key][listKey] = []; |
|
3722
|
|
|
} |
|
3723
|
|
|
|
|
3724
|
|
|
(_acc$key$listKey = acc[key][listKey]).push.apply(_acc$key$listKey, _toConsumableArray(list)); |
|
3725
|
|
|
|
|
3726
|
|
|
return acc; |
|
3727
|
|
|
}, {}); |
|
3728
|
|
|
}; |
|
3729
|
|
|
|
|
3730
|
|
|
var studiesGrouped = Object.values(groupBy(studies, 'StudyInstanceUID', 'series')); |
|
3731
|
|
|
var result = studiesGrouped.map(function (studyGroup) { |
|
3732
|
|
|
var seriesGrouped = groupBy(studyGroup.series, 'SeriesInstanceUID', 'instances'); |
|
3733
|
|
|
studyGroup.series = Object.values(seriesGrouped); |
|
3734
|
|
|
return studyGroup; |
|
3735
|
|
|
}); |
|
3736
|
|
|
return result; |
|
3737
|
|
|
} |
|
3738
|
|
|
}]); |
|
3739
|
|
|
|
|
3740
|
|
|
return FileLoaderService; |
|
3741
|
|
|
}(FileLoader); |
|
3742
|
|
|
|
|
3743
|
|
|
/* harmony default export */ var localFileLoaders_fileLoaderService = (fileLoaderService_FileLoaderService); |
|
3744
|
|
|
// CONCATENATED MODULE: ./lib/filesToStudies.js |
|
3745
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return filesToStudies; }); |
|
3746
|
|
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } |
|
3747
|
|
|
|
|
3748
|
|
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } |
|
3749
|
|
|
|
|
3750
|
|
|
|
|
3751
|
|
|
|
|
3752
|
|
|
var processFile = |
|
3753
|
|
|
/*#__PURE__*/ |
|
3754
|
|
|
function () { |
|
3755
|
|
|
var _ref = _asyncToGenerator( |
|
3756
|
|
|
/*#__PURE__*/ |
|
3757
|
|
|
regeneratorRuntime.mark(function _callee(file) { |
|
|
|
|
|
|
3758
|
|
|
var fileLoaderService, imageId, image, dataset, studies; |
|
3759
|
|
|
return regeneratorRuntime.wrap(function _callee$(_context) { |
|
|
|
|
|
|
3760
|
|
|
while (1) { |
|
3761
|
|
|
switch (_context.prev = _context.next) { |
|
3762
|
|
|
case 0: |
|
3763
|
|
|
_context.prev = 0; |
|
3764
|
|
|
fileLoaderService = new localFileLoaders_fileLoaderService(file); |
|
|
|
|
|
|
3765
|
|
|
imageId = fileLoaderService.addFile(file); |
|
|
|
|
|
|
3766
|
|
|
_context.next = 5; |
|
3767
|
|
|
return fileLoaderService.loadFile(file, imageId); |
|
|
|
|
|
|
3768
|
|
|
|
|
3769
|
|
|
case 5: |
|
3770
|
|
|
image = _context.sent; |
|
3771
|
|
|
_context.next = 8; |
|
3772
|
|
|
return fileLoaderService.getDataset(image, imageId); |
|
|
|
|
|
|
3773
|
|
|
|
|
3774
|
|
|
case 8: |
|
3775
|
|
|
dataset = _context.sent; |
|
3776
|
|
|
_context.next = 11; |
|
3777
|
|
|
return fileLoaderService.getStudies(dataset, imageId); |
|
|
|
|
|
|
3778
|
|
|
|
|
3779
|
|
|
case 11: |
|
3780
|
|
|
studies = _context.sent; |
|
3781
|
|
|
return _context.abrupt("return", studies); |
|
|
|
|
|
|
3782
|
|
|
|
|
3783
|
|
|
case 15: |
|
3784
|
|
|
_context.prev = 15; |
|
3785
|
|
|
_context.t0 = _context["catch"](0); |
|
3786
|
|
|
console.log(_context.t0.name, ':Error when trying to load and process local files:', _context.t0.message); |
|
|
|
|
|
|
3787
|
|
|
|
|
3788
|
|
|
case 18: |
|
3789
|
|
|
case "end": |
|
3790
|
|
|
return _context.stop(); |
|
3791
|
|
|
} |
|
3792
|
|
|
} |
|
|
|
|
|
|
3793
|
|
|
}, _callee, null, [[0, 15]]); |
|
3794
|
|
|
})); |
|
3795
|
|
|
|
|
3796
|
|
|
return function processFile(_x) { |
|
|
|
|
|
|
3797
|
|
|
return _ref.apply(this, arguments); |
|
3798
|
|
|
}; |
|
3799
|
|
|
}(); |
|
3800
|
|
|
|
|
3801
|
|
|
function filesToStudies(_x2) { |
|
|
|
|
|
|
3802
|
|
|
return _filesToStudies.apply(this, arguments); |
|
3803
|
|
|
} |
|
3804
|
|
|
|
|
3805
|
|
|
function _filesToStudies() { |
|
3806
|
|
|
_filesToStudies = _asyncToGenerator( |
|
|
|
|
|
|
3807
|
|
|
/*#__PURE__*/ |
|
3808
|
|
|
regeneratorRuntime.mark(function _callee2(files) { |
|
|
|
|
|
|
3809
|
|
|
var processFilesPromises, studies; |
|
3810
|
|
|
return regeneratorRuntime.wrap(function _callee2$(_context2) { |
|
|
|
|
|
|
3811
|
|
|
while (1) { |
|
3812
|
|
|
switch (_context2.prev = _context2.next) { |
|
3813
|
|
|
case 0: |
|
3814
|
|
|
processFilesPromises = files.map(processFile); |
|
3815
|
|
|
_context2.next = 3; |
|
3816
|
|
|
return Promise.all(processFilesPromises); |
|
|
|
|
|
|
3817
|
|
|
|
|
3818
|
|
|
case 3: |
|
3819
|
|
|
studies = _context2.sent; |
|
3820
|
|
|
return _context2.abrupt("return", localFileLoaders_fileLoaderService.groupSeries(studies.flat())); |
|
|
|
|
|
|
3821
|
|
|
|
|
3822
|
|
|
case 5: |
|
3823
|
|
|
case "end": |
|
3824
|
|
|
return _context2.stop(); |
|
3825
|
|
|
} |
|
3826
|
|
|
} |
|
|
|
|
|
|
3827
|
|
|
}, _callee2); |
|
3828
|
|
|
})); |
|
3829
|
|
|
return _filesToStudies.apply(this, arguments); |
|
3830
|
|
|
} |
|
3831
|
|
|
|
|
3832
|
|
|
/***/ }), |
|
3833
|
|
|
|
|
3834
|
|
|
/***/ 988: |
|
3835
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
|
|
|
|
|
|
3836
|
|
|
|
|
3837
|
|
|
// extracted by extract-css-chunks-webpack-plugin |
|
3838
|
|
|
|
|
3839
|
|
|
/***/ }) |
|
3840
|
|
|
|
|
3841
|
|
|
}]); |
Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.
Consider:
If you or someone else later decides to put another statement in, only the first statement will be executed.
In this case the statement
b = 42will always be executed, while the logging statement will be executed conditionally.ensures that the proper code will be executed conditionally no matter how many statements are added or removed.