cloudmr-ux 2.0.7 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/README.md +24 -24
  2. package/dist/CmrComponents/CmrButton/CmrButton.css +0 -0
  3. package/dist/CmrComponents/CmrButton/CmrButton.d.ts +4 -0
  4. package/dist/CmrComponents/CmrButton/CmrButton.js +30 -0
  5. package/dist/CmrComponents/CmrButton/index.d.ts +1 -0
  6. package/dist/CmrComponents/CmrButton/index.js +1 -0
  7. package/dist/CmrComponents/CmrCheckbox/CmrCheckbox.css +29 -0
  8. package/dist/CmrComponents/CmrCheckbox/CmrCheckbox.d.ts +14 -0
  9. package/dist/CmrComponents/CmrCheckbox/CmrCheckbox.js +30 -0
  10. package/dist/CmrComponents/CmrCheckbox/index.d.ts +1 -0
  11. package/dist/CmrComponents/CmrCheckbox/index.js +1 -0
  12. package/dist/CmrComponents/CmrColorPicker/CmrColorPicker.d.ts +8 -0
  13. package/dist/CmrComponents/CmrColorPicker/CmrColorPicker.js +29 -0
  14. package/dist/CmrComponents/CmrColorPicker/CmrColorPicker.scss +27 -0
  15. package/dist/CmrComponents/CmrInput/CmrInput.css +27 -0
  16. package/dist/CmrComponents/CmrInput/CmrInput.d.ts +17 -0
  17. package/dist/CmrComponents/CmrInput/CmrInput.js +29 -0
  18. package/dist/CmrComponents/CmrInput/index.d.ts +1 -0
  19. package/dist/CmrComponents/CmrInput/index.js +1 -0
  20. package/dist/CmrComponents/CmrRadioGroup/CmrRadioGroup.css +25 -0
  21. package/dist/CmrComponents/CmrRadioGroup/CmrRadioGroup.d.ts +15 -0
  22. package/dist/CmrComponents/CmrRadioGroup/CmrRadioGroup.js +37 -0
  23. package/dist/CmrComponents/CmrRadioGroup/index.d.ts +1 -0
  24. package/dist/CmrComponents/CmrRadioGroup/index.js +1 -0
  25. package/dist/CmrComponents/CmrSelect/CmrSelect.css +1 -0
  26. package/dist/CmrComponents/CmrSelect/CmrSelect.d.ts +24 -0
  27. package/dist/CmrComponents/CmrSelect/CmrSelect.js +46 -0
  28. package/dist/CmrComponents/CmrSelect/index.d.ts +1 -0
  29. package/dist/CmrComponents/CmrSelect/index.js +1 -0
  30. package/dist/CmrComponents/checkbox/Checkbox.css +8 -0
  31. package/dist/CmrComponents/checkbox/Checkbox.d.ts +15 -0
  32. package/dist/CmrComponents/checkbox/Checkbox.js +25 -0
  33. package/dist/CmrComponents/collapse/Collapse.css +3 -0
  34. package/dist/CmrComponents/collapse/Collapse.d.ts +18 -0
  35. package/dist/CmrComponents/collapse/Collapse.js +87 -0
  36. package/dist/CmrComponents/dialogue/Confirmation.d.ts +20 -0
  37. package/dist/CmrComponents/dialogue/Confirmation.js +36 -0
  38. package/dist/CmrComponents/dialogue/DeletionDialog.d.ts +4 -0
  39. package/dist/CmrComponents/dialogue/DeletionDialog.js +39 -0
  40. package/dist/CmrComponents/dialogue/EditConfirmation.d.ts +13 -0
  41. package/dist/CmrComponents/dialogue/EditConfirmation.js +45 -0
  42. package/dist/CmrComponents/double-slider/DualSlider.d.ts +21 -0
  43. package/dist/CmrComponents/double-slider/DualSlider.js +152 -0
  44. package/dist/CmrComponents/double-slider/InvertibleDualSlider.d.ts +24 -0
  45. package/dist/CmrComponents/double-slider/InvertibleDualSlider.js +174 -0
  46. package/dist/CmrComponents/gui-slider/ControlledSlider.d.ts +9 -0
  47. package/dist/CmrComponents/gui-slider/ControlledSlider.js +96 -0
  48. package/dist/CmrComponents/gui-slider/Slider.d.ts +20 -0
  49. package/dist/CmrComponents/gui-slider/Slider.js +127 -0
  50. package/dist/CmrComponents/header/Header.d.ts +17 -0
  51. package/dist/CmrComponents/header/Header.js +90 -0
  52. package/dist/CmrComponents/header/Header.scss +32 -0
  53. package/dist/CmrComponents/input-number/InputNumber.css +0 -0
  54. package/dist/CmrComponents/input-number/InputNumber.d.ts +17 -0
  55. package/dist/CmrComponents/input-number/InputNumber.js +30 -0
  56. package/dist/CmrComponents/label/Label.css +13 -0
  57. package/dist/CmrComponents/label/Label.d.ts +9 -0
  58. package/dist/CmrComponents/label/Label.js +18 -0
  59. package/dist/CmrComponents/panel/Panel.css +5 -0
  60. package/dist/CmrComponents/panel/Panel.d.ts +12 -0
  61. package/dist/CmrComponents/panel/Panel.js +42 -0
  62. package/dist/CmrComponents/rename/edit.d.ts +7 -0
  63. package/dist/CmrComponents/rename/edit.js +117 -0
  64. package/dist/CmrComponents/select-upload/SelectUpload.css +26 -0
  65. package/dist/CmrComponents/select-upload/SelectUpload.d.ts +33 -0
  66. package/dist/CmrComponents/select-upload/SelectUpload.js +90 -0
  67. package/dist/CmrComponents/tk-dualrange/TKDualRange.d.ts +17 -0
  68. package/dist/CmrComponents/tk-dualrange/TKDualRange.js +65 -0
  69. package/dist/CmrComponents/tk-dualrange/tk-dual-range.css +140 -0
  70. package/dist/CmrComponents/tooltip/Tooltip.css +0 -0
  71. package/dist/CmrComponents/tooltip/Tooltip.d.ts +18 -0
  72. package/dist/CmrComponents/tooltip/Tooltip.js +30 -0
  73. package/dist/CmrComponents/upload/Upload.css +5 -0
  74. package/dist/CmrComponents/upload/Upload.d.ts +80 -0
  75. package/dist/CmrComponents/upload/Upload.js +185 -0
  76. package/dist/CmrComponents/upload/UploadWindow.d.ts +15 -0
  77. package/dist/CmrComponents/upload/UploadWindow.js +286 -0
  78. package/dist/CmrTable/CmrTable.css +26 -0
  79. package/dist/CmrTable/CmrTable.d.ts +13 -0
  80. package/dist/CmrTable/CmrTable.js +47 -0
  81. package/dist/CmrTabs/CmrTabs.d.ts +7 -0
  82. package/dist/CmrTabs/CmrTabs.js +64 -0
  83. package/dist/CmrTabs/tab.model.d.ts +12 -0
  84. package/dist/CmrTabs/tab.model.js +1 -0
  85. package/dist/core/app/main/Main.d.ts +6 -0
  86. package/dist/core/app/main/Main.js +18 -0
  87. package/dist/core/app/results/Logs.d.ts +1 -0
  88. package/dist/core/app/results/Logs.js +33 -0
  89. package/dist/core/app/results/PreprocessJob.d.ts +1 -0
  90. package/dist/core/app/results/PreprocessJob.js +100 -0
  91. package/dist/core/app/results/Results.d.ts +15 -0
  92. package/dist/core/app/results/Results.js +372 -0
  93. package/dist/core/app/results/Results.scss +92 -0
  94. package/dist/core/app/results/Rois.d.ts +11 -0
  95. package/dist/core/app/results/Rois.js +269 -0
  96. package/dist/core/app/settings/Settings.d.ts +1 -0
  97. package/dist/core/app/settings/Settings.js +109 -0
  98. package/dist/core/app/signin/ForgotPassword.d.ts +3 -0
  99. package/dist/core/app/signin/ForgotPassword.js +142 -0
  100. package/dist/core/app/signin/Register.d.ts +3 -0
  101. package/dist/core/app/signin/Register.js +126 -0
  102. package/dist/core/app/signin/Signin.d.ts +5 -0
  103. package/dist/core/app/signin/Signin.js +84 -0
  104. package/dist/core/app/signin/Signin.scss +86 -0
  105. package/dist/core/app/upload/Upload.d.ts +3 -0
  106. package/dist/core/app/upload/Upload.js +261 -0
  107. package/dist/core/app/upload/Upload.scss +0 -0
  108. package/dist/core/common/components/CmrColorPicker/CmrColorPicker.d.ts +8 -0
  109. package/dist/core/common/components/CmrColorPicker/CmrColorPicker.js +29 -0
  110. package/dist/core/common/components/CmrColorPicker/CmrColorPicker.scss +27 -0
  111. package/dist/core/common/components/NiivueTools/Niivue.css +8 -0
  112. package/dist/core/common/components/NiivueTools/Niivue.d.ts +14 -0
  113. package/dist/core/common/components/NiivueTools/Niivue.js +1270 -0
  114. package/dist/core/common/components/NiivueTools/NiivuePatcher.js +1875 -0
  115. package/dist/core/common/components/NiivueTools/components/ColorPicker.d.ts +5 -0
  116. package/dist/core/common/components/NiivueTools/components/ColorPicker.js +68 -0
  117. package/dist/core/common/components/NiivueTools/components/DrawPlatte.d.ts +10 -0
  118. package/dist/core/common/components/NiivueTools/components/DrawPlatte.js +88 -0
  119. package/dist/core/common/components/NiivueTools/components/DrawToolKit.d.ts +32 -0
  120. package/dist/core/common/components/NiivueTools/components/DrawToolKit.js +164 -0
  121. package/dist/core/common/components/NiivueTools/components/EraserPlatte.d.ts +10 -0
  122. package/dist/core/common/components/NiivueTools/components/EraserPlatte.js +43 -0
  123. package/dist/core/common/components/NiivueTools/components/Layer.d.ts +10 -0
  124. package/dist/core/common/components/NiivueTools/components/Layer.js +117 -0
  125. package/dist/core/common/components/NiivueTools/components/LayersPanel.d.ts +8 -0
  126. package/dist/core/common/components/NiivueTools/components/LayersPanel.js +108 -0
  127. package/dist/core/common/components/NiivueTools/components/LocationTable.d.ts +9 -0
  128. package/dist/core/common/components/NiivueTools/components/LocationTable.js +42 -0
  129. package/dist/core/common/components/NiivueTools/components/MaskPlatte.d.ts +10 -0
  130. package/dist/core/common/components/NiivueTools/components/MaskPlatte.js +123 -0
  131. package/dist/core/common/components/NiivueTools/components/NiivuePanel.d.ts +34 -0
  132. package/dist/core/common/components/NiivueTools/components/NiivuePanel.js +305 -0
  133. package/dist/core/common/components/NiivueTools/components/NumberPicker.d.ts +8 -0
  134. package/dist/core/common/components/NiivueTools/components/NumberPicker.js +40 -0
  135. package/dist/core/common/components/NiivueTools/components/SettingsPanel.d.ts +7 -0
  136. package/dist/core/common/components/NiivueTools/components/SettingsPanel.js +30 -0
  137. package/dist/core/common/components/NiivueTools/components/Switch.d.ts +5 -0
  138. package/dist/core/common/components/NiivueTools/components/Switch.js +26 -0
  139. package/dist/core/common/components/NiivueTools/components/Toolbar.d.ts +40 -0
  140. package/dist/core/common/components/NiivueTools/components/Toolbar.js +184 -0
  141. package/dist/core/common/components/NiivueTools/components/Toolbar.scss +39 -0
  142. package/dist/core/common/components/NiivueTools/components/stats.d.ts +2 -0
  143. package/dist/core/common/components/NiivueTools/components/stats.js +13 -0
  144. package/dist/core/common/components/NiivueTools/index.css +14 -0
  145. package/dist/core/common/components/NiivueTools/util.js +309 -0
  146. package/dist/core/common/components/footer/Footer.d.ts +3 -0
  147. package/dist/core/common/components/footer/Footer.js +20 -0
  148. package/dist/core/common/components/footer/Footer.scss +5 -0
  149. package/dist/core/common/utilities/AuthenticatedRequests.d.ts +16 -0
  150. package/dist/core/common/utilities/AuthenticatedRequests.js +158 -0
  151. package/dist/core/common/utilities/CalendarHelper.d.ts +5 -0
  152. package/dist/core/common/utilities/CalendarHelper.js +27 -0
  153. package/dist/core/common/utilities/DownloadFromText.d.ts +3 -0
  154. package/dist/core/common/utilities/DownloadFromText.js +20 -0
  155. package/dist/core/common/utilities/StoreToRequest.d.ts +1 -0
  156. package/dist/core/common/utilities/StoreToRequest.js +4 -0
  157. package/dist/core/common/utilities/SystemUtilities.d.ts +4 -0
  158. package/dist/core/common/utilities/SystemUtilities.js +79 -0
  159. package/dist/core/common/utilities/file-transformation/anonymize.d.ts +1 -0
  160. package/dist/core/common/utilities/file-transformation/anonymize.js +114 -0
  161. package/dist/core/common/utilities/file-transformation/utilities.d.ts +2 -0
  162. package/dist/core/common/utilities/file-transformation/utilities.js +23 -0
  163. package/dist/core/common/utilities/index.d.ts +25 -0
  164. package/dist/core/common/utilities/index.js +118 -0
  165. package/dist/core/common/utilities/parse-jwt.d.ts +1 -0
  166. package/dist/core/common/utilities/parse-jwt.js +14 -0
  167. package/dist/core/components/PasswordRequirements.d.ts +7 -0
  168. package/dist/core/components/PasswordRequirements.js +30 -0
  169. package/dist/core/config/AppConfig.d.ts +5 -0
  170. package/dist/core/config/AppConfig.js +42 -0
  171. package/dist/core/config/types.d.ts +40 -0
  172. package/dist/core/config/types.js +1 -0
  173. package/dist/core/features/authenticate/authenticateActionCreation.d.ts +46 -0
  174. package/dist/core/features/authenticate/authenticateActionCreation.js +326 -0
  175. package/dist/core/features/authenticate/authenticateSlice.d.ts +45 -0
  176. package/dist/core/features/authenticate/authenticateSlice.js +203 -0
  177. package/dist/core/features/data/dataActionCreation.d.ts +40 -0
  178. package/dist/core/features/data/dataActionCreation.js +340 -0
  179. package/dist/core/features/data/dataSlice.d.ts +37 -0
  180. package/dist/core/features/data/dataSlice.js +87 -0
  181. package/dist/core/features/jobs/jobActionCreation.d.ts +35 -0
  182. package/dist/core/features/jobs/jobActionCreation.js +242 -0
  183. package/dist/core/features/jobs/jobsSlice.d.ts +57 -0
  184. package/dist/core/features/jobs/jobsSlice.js +54 -0
  185. package/dist/core/features/rois/resultActionCreation.d.ts +21 -0
  186. package/dist/core/features/rois/resultActionCreation.js +114 -0
  187. package/dist/core/features/rois/resultSlice.d.ts +24 -0
  188. package/dist/core/features/rois/resultSlice.js +68 -0
  189. package/dist/core/features/rois/roiTypes.d.ts +44 -0
  190. package/dist/core/features/rois/roiTypes.js +1 -0
  191. package/dist/core/features/setup/setupActionCreation.d.ts +7 -0
  192. package/dist/core/features/setup/setupActionCreation.js +100 -0
  193. package/dist/core/index.d.ts +22 -0
  194. package/dist/core/index.js +27 -0
  195. package/dist/core/store/configureStore.d.ts +13 -0
  196. package/dist/core/store/configureStore.js +38 -0
  197. package/dist/core/store/hooks.d.ts +11 -0
  198. package/dist/core/store/hooks.js +5 -0
  199. package/dist/core/utils/passwordValidation.d.ts +25 -0
  200. package/dist/core/utils/passwordValidation.js +19 -0
  201. package/dist/index.d.ts +29 -329
  202. package/dist/index.js +26 -1402
  203. package/dist/style.css +47 -0
  204. package/package.json +309 -41
  205. package/dist/index.css +0 -170
  206. package/dist/index.mjs +0 -1354
@@ -0,0 +1,242 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import axios from 'axios';
38
+ import { createAsyncThunk } from '@reduxjs/toolkit';
39
+ import { getFileExtension } from "../../common/utilities/SystemUtilities";
40
+ import { is_safe_twix } from "../../common/utilities/file-transformation/anonymize";
41
+ import { AuthenticatedHttpClient } from '../../common/utilities/AuthenticatedRequests';
42
+ import { getEndpoints } from '../../config/AppConfig';
43
+ export var getUpstreamJobs = createAsyncThunk('GetJobs', function () { return __awaiter(void 0, void 0, void 0, function () {
44
+ var endpoints, response;
45
+ return __generator(this, function (_a) {
46
+ switch (_a.label) {
47
+ case 0:
48
+ endpoints = getEndpoints();
49
+ return [4 /*yield*/, AuthenticatedHttpClient.get(endpoints.JOBS_RETRIEVE_API)];
50
+ case 1:
51
+ response = _a.sent();
52
+ return [2 /*return*/, response.data];
53
+ }
54
+ });
55
+ }); });
56
+ export var renameUpstreamJob = createAsyncThunk('RenameJob', function (arg) { return __awaiter(void 0, void 0, void 0, function () {
57
+ var endpoints, response;
58
+ return __generator(this, function (_a) {
59
+ switch (_a.label) {
60
+ case 0:
61
+ endpoints = getEndpoints();
62
+ return [4 /*yield*/, AuthenticatedHttpClient.post(endpoints.JOBS_RENAME_API, arg.jobReference)];
63
+ case 1:
64
+ response = _a.sent();
65
+ if (response.status === 200)
66
+ getUpstreamJobs();
67
+ return [2 /*return*/];
68
+ }
69
+ });
70
+ }); });
71
+ export var deleteUpstreamJob = createAsyncThunk('DeleteJob', function (arg) { return __awaiter(void 0, void 0, void 0, function () {
72
+ var endpoints, response;
73
+ return __generator(this, function (_a) {
74
+ switch (_a.label) {
75
+ case 0:
76
+ endpoints = getEndpoints();
77
+ return [4 /*yield*/, AuthenticatedHttpClient["delete"]("".concat(endpoints.JOBS_DELETE_API, "?id=").concat(arg.jobId))];
78
+ case 1:
79
+ response = _a.sent();
80
+ if (response.status === 200)
81
+ getUpstreamJobs();
82
+ return [2 /*return*/];
83
+ }
84
+ });
85
+ }); });
86
+ export var uploadJob = createAsyncThunk('UploadJob', function (_a, thunkAPI) {
87
+ var uploadToken = _a.uploadToken, file = _a.file, fileAlias = _a.fileAlias, onProgress = _a.onProgress, onUploaded = _a.onUploaded, uploadTarget = _a.uploadTarget;
88
+ return __awaiter(void 0, void 0, void 0, function () {
89
+ // thunkAPI.dispatch(setupSetters.setUploadProgress({target: uploadTarget, progress: 0}));
90
+ // @ts-ignore
91
+ function uploadPartWithRetries(partUrl, part, cancelTokenSource, index, retries) {
92
+ if (retries === void 0) { retries = 2; }
93
+ return __awaiter(this, void 0, void 0, function () {
94
+ var response, error_1, newCancelTokenSource;
95
+ return __generator(this, function (_a) {
96
+ switch (_a.label) {
97
+ case 0:
98
+ _a.trys.push([0, 2, , 7]);
99
+ return [4 /*yield*/, AuthenticatedHttpClient.put(partUrl, part, {
100
+ headers: {
101
+ 'Content-Type': ""
102
+ },
103
+ onUploadProgress: function (progressEvent) {
104
+ totalUploadedParts_1[index] = progressEvent.loaded;
105
+ var totalUploaded = totalUploadedParts_1.reduce(function (a, b) { return a + b; }, 0);
106
+ var totalProgress = totalUploaded / totalSize_1;
107
+ onProgress && onProgress(totalProgress);
108
+ // thunkAPI.dispatch(setupSetters.setUploadProgress({
109
+ // target: uploadTarget,
110
+ // progress: totalProgress
111
+ // }));
112
+ },
113
+ cancelToken: cancelTokenSource.token
114
+ })];
115
+ case 1:
116
+ response = _a.sent();
117
+ return [2 /*return*/, response];
118
+ case 2:
119
+ error_1 = _a.sent();
120
+ if (!axios.isCancel(error_1)) return [3 /*break*/, 3];
121
+ console.log('Upload cancelled:', partUrl);
122
+ return [3 /*break*/, 6];
123
+ case 3:
124
+ if (!(retries > 0)) return [3 /*break*/, 5];
125
+ console.log("Retrying upload for part: ".concat(partUrl, ", attempts remaining: ").concat(retries));
126
+ // Cancel the current request before retrying
127
+ cancelTokenSource.cancel('Cancelling the current request before retry.');
128
+ newCancelTokenSource = axios.CancelToken.source();
129
+ return [4 /*yield*/, uploadPartWithRetries(partUrl, part, newCancelTokenSource, index, retries - 1)];
130
+ case 4: return [2 /*return*/, _a.sent()];
131
+ case 5: throw error_1; // rethrow the error after exhausting retries
132
+ case 6: return [3 /*break*/, 7];
133
+ case 7: return [2 /*return*/];
134
+ }
135
+ });
136
+ });
137
+ }
138
+ var endpoints, FILE_CHUNK_SIZE, payload, initResponse, _b, uploadId, partUrls_1, Key, fileParts, i, part, totalSize_1, totalUploadedParts_1, uploadedParts, finalizeResponse, e_1;
139
+ return __generator(this, function (_c) {
140
+ switch (_c.label) {
141
+ case 0:
142
+ endpoints = getEndpoints();
143
+ _c.label = 1;
144
+ case 1:
145
+ _c.trys.push([1, 6, , 7]);
146
+ FILE_CHUNK_SIZE = 10 * 1024 * 1024;
147
+ return [4 /*yield*/, createPayload(uploadToken, file, fileAlias)];
148
+ case 2:
149
+ payload = _c.sent();
150
+ if (payload === undefined)
151
+ return [2 /*return*/, { code: 403, response: 'file not found', file: undefined, uploadTarget: uploadTarget }
152
+ // thunkAPI.dispatch(setupSetters.setUploadProgress({target: uploadTarget, progress: 0}));
153
+ // @ts-ignore
154
+ ];
155
+ return [4 /*yield*/, AuthenticatedHttpClient.post(payload.destination, payload.lambdaFile, payload.config)];
156
+ case 3:
157
+ initResponse = _c.sent();
158
+ console.log(initResponse);
159
+ _b = initResponse.data, uploadId = _b.uploadId, partUrls_1 = _b.partUrls, Key = _b.Key;
160
+ fileParts = [];
161
+ for (i = 0; i < file.size; i += FILE_CHUNK_SIZE) {
162
+ part = file.slice(i, i + FILE_CHUNK_SIZE);
163
+ fileParts.push(part);
164
+ }
165
+ totalSize_1 = payload.file.size;
166
+ totalUploadedParts_1 = new Array(fileParts.length).fill(0);
167
+ return [4 /*yield*/, Promise.all(fileParts.map(function (part, index) { return __awaiter(void 0, void 0, void 0, function () {
168
+ var partUrl, cancelTokenSource, partResponse, etag;
169
+ return __generator(this, function (_a) {
170
+ switch (_a.label) {
171
+ case 0:
172
+ partUrl = partUrls_1[index];
173
+ cancelTokenSource = axios.CancelToken.source();
174
+ return [4 /*yield*/, uploadPartWithRetries(partUrl, part, cancelTokenSource, index)];
175
+ case 1:
176
+ partResponse = _a.sent();
177
+ etag = partResponse === null || partResponse === void 0 ? void 0 : partResponse.headers['etag'].replace(/"/g, '');
178
+ return [2 /*return*/, { partNumber: index + 1, etag: etag }];
179
+ }
180
+ });
181
+ }); }))];
182
+ case 4:
183
+ uploadedParts = _c.sent();
184
+ return [4 /*yield*/, axios.post(endpoints.JOB_UPLOAD_FINALIZE, {
185
+ uploadId: uploadId,
186
+ parts: uploadedParts,
187
+ Key: Key
188
+ }, payload.config)];
189
+ case 5:
190
+ finalizeResponse = _c.sent();
191
+ console.log(finalizeResponse);
192
+ console.log('all uploads completed');
193
+ if (onUploaded)
194
+ onUploaded(initResponse, file);
195
+ thunkAPI.dispatch(getUpstreamJobs());
196
+ return [2 /*return*/, { code: 200, response: initResponse.data.response, file: payload.lambdaFile, uploadTarget: uploadTarget }];
197
+ case 6:
198
+ e_1 = _c.sent();
199
+ console.log("Following error encountered during uploading:");
200
+ console.error(e_1);
201
+ return [2 /*return*/, { code: 500, response: e_1.response, file: undefined, uploadTarget: uploadTarget }];
202
+ case 7: return [2 /*return*/];
203
+ }
204
+ });
205
+ });
206
+ });
207
+ var createPayload = function (uploadToken, file, fileAlias) { return __awaiter(void 0, void 0, void 0, function () {
208
+ var endpoints, lambdaFile, fileExtension, safe, UploadHeaders;
209
+ return __generator(this, function (_a) {
210
+ switch (_a.label) {
211
+ case 0:
212
+ endpoints = getEndpoints();
213
+ if (!file) return [3 /*break*/, 3];
214
+ lambdaFile = {
215
+ "filename": fileAlias,
216
+ "filetype": file.type,
217
+ "filesize": "".concat(file.size),
218
+ "filemd5": '',
219
+ "file": file
220
+ };
221
+ console.log(file.type);
222
+ fileExtension = getFileExtension(file.name);
223
+ if (!(fileExtension === 'dat')) return [3 /*break*/, 2];
224
+ return [4 /*yield*/, is_safe_twix(file)];
225
+ case 1:
226
+ safe = _a.sent();
227
+ if (!safe) {
228
+ alert('This file contains PIH data. Please anonymize the file before uploading');
229
+ return [2 /*return*/, undefined];
230
+ }
231
+ _a.label = 2;
232
+ case 2:
233
+ UploadHeaders = {
234
+ headers: {
235
+ 'Content-Type': 'application/json'
236
+ }
237
+ };
238
+ return [2 /*return*/, { destination: endpoints.JOB_UPLOAD_INIT, lambdaFile: lambdaFile, file: file, config: UploadHeaders }];
239
+ case 3: return [2 /*return*/];
240
+ }
241
+ });
242
+ }); };
@@ -0,0 +1,57 @@
1
+ import { PayloadAction } from '@reduxjs/toolkit';
2
+ import { UploadedFile } from "../data/dataSlice";
3
+ export interface Job {
4
+ id: number;
5
+ alias: string;
6
+ status: string;
7
+ pipeline_id: string;
8
+ createdAt: string;
9
+ updatedAt: string;
10
+ setup: any;
11
+ files: UploadedFile[];
12
+ logs?: LogItem[];
13
+ slices?: number;
14
+ }
15
+ export interface LogItem {
16
+ type: string;
17
+ when: string;
18
+ what: string;
19
+ }
20
+ interface JobsState {
21
+ jobs: Array<Job>;
22
+ loading: boolean;
23
+ submittingText: string;
24
+ }
25
+ export declare const jobsSlice: import("@reduxjs/toolkit").Slice<JobsState, {
26
+ /**
27
+ * Delete job referenced by its index
28
+ * @param state
29
+ * @param action
30
+ */
31
+ renameJob(state: JobsState, action: PayloadAction<{
32
+ index: number;
33
+ alias: string;
34
+ }>): void;
35
+ deleteJob(state: JobsState, action: PayloadAction<{
36
+ index: number;
37
+ }>): void;
38
+ resetSubmissionState(state: JobsState): void;
39
+ setSubmittingText(state: import("immer").WritableDraft<JobsState>, action: PayloadAction<string>): void;
40
+ }, "job", "job", import("@reduxjs/toolkit").SliceSelectors<JobsState>>;
41
+ export declare const jobActions: import("@reduxjs/toolkit").CaseReducerActions<{
42
+ /**
43
+ * Delete job referenced by its index
44
+ * @param state
45
+ * @param action
46
+ */
47
+ renameJob(state: JobsState, action: PayloadAction<{
48
+ index: number;
49
+ alias: string;
50
+ }>): void;
51
+ deleteJob(state: JobsState, action: PayloadAction<{
52
+ index: number;
53
+ }>): void;
54
+ resetSubmissionState(state: JobsState): void;
55
+ setSubmittingText(state: import("immer").WritableDraft<JobsState>, action: PayloadAction<string>): void;
56
+ }, "job">;
57
+ export {};
@@ -0,0 +1,54 @@
1
+ import { createSlice } from '@reduxjs/toolkit';
2
+ import { getUpstreamJobs } from './jobActionCreation';
3
+ import { convertTimestamp } from "../../common/utilities/CalendarHelper";
4
+ var initialState = {
5
+ jobs: [],
6
+ loading: true,
7
+ submittingText: 'Submitting Jobs...'
8
+ };
9
+ export var jobsSlice = createSlice({
10
+ name: 'job',
11
+ initialState: initialState,
12
+ reducers: {
13
+ // submitJob(state: JobsState, action: PayloadAction<SNR>){
14
+ // state.jobs.push({
15
+ // setup:action.payload, alias: "", createdAt: "", files: [], id: 0, status: "", updatedAt: ""
16
+ // });
17
+ // },
18
+ /**
19
+ * Delete job referenced by its index
20
+ * @param state
21
+ * @param action
22
+ */
23
+ renameJob: function (state, action) {
24
+ state.jobs[action.payload.index].alias = action.payload.alias;
25
+ },
26
+ deleteJob: function (state, action) {
27
+ state.jobs.splice(action.payload.index, 1);
28
+ },
29
+ resetSubmissionState: function (state) {
30
+ state.submittingText = 'Submitting jobs...';
31
+ },
32
+ setSubmittingText: function (state, action) {
33
+ state.submittingText = action.payload;
34
+ }
35
+ },
36
+ extraReducers: function (builder) { return (builder.addCase(getUpstreamJobs.pending, function (state, action) {
37
+ state.loading = true;
38
+ }),
39
+ builder.addCase(getUpstreamJobs.fulfilled, function (state, action) {
40
+ var data = [];
41
+ var payloadData = action.payload;
42
+ if (payloadData.jobs.length > 0) {
43
+ payloadData.jobs.forEach(function (element) {
44
+ element.createdAt = convertTimestamp(element.createdAt);
45
+ data.push(element);
46
+ });
47
+ }
48
+ state.jobs = data;
49
+ // state.jobs = [sampleJob]
50
+ state.loading = false;
51
+ state.submittingText = 'Jobs submitted!';
52
+ })); }
53
+ });
54
+ export var jobActions = jobsSlice.actions;
@@ -0,0 +1,21 @@
1
+ import { Job } from "../jobs/jobsSlice";
2
+ export declare const getPipelineROI: import("@reduxjs/toolkit").AsyncThunk<{
3
+ rois: any;
4
+ pipeline_id: string;
5
+ }, {
6
+ pipeline: string;
7
+ }, import("@reduxjs/toolkit").AsyncThunkConfig>;
8
+ export declare function niiToVolume(nii: any): {
9
+ url: any;
10
+ name: string;
11
+ alias: any;
12
+ };
13
+ export declare const loadResult: import("@reduxjs/toolkit").AsyncThunk<{
14
+ pipelineID: string;
15
+ job: Job;
16
+ volumes: any[];
17
+ niis: any[];
18
+ result: any;
19
+ }, {
20
+ job: Job;
21
+ }, import("@reduxjs/toolkit").AsyncThunkConfig>;
@@ -0,0 +1,114 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import { createAsyncThunk } from "@reduxjs/toolkit";
38
+ import { getEndpoints } from "../../config/AppConfig";
39
+ import { AuthenticatedHttpClient } from "../../common/utilities/AuthenticatedRequests";
40
+ export var getPipelineROI = createAsyncThunk("GetROI", function (_a) {
41
+ var pipeline = _a.pipeline;
42
+ return __awaiter(void 0, void 0, void 0, function () {
43
+ var endpoints, config, response;
44
+ return __generator(this, function (_b) {
45
+ switch (_b.label) {
46
+ case 0:
47
+ endpoints = getEndpoints();
48
+ config = {
49
+ params: {
50
+ pipeline_id: pipeline
51
+ }
52
+ };
53
+ return [4 /*yield*/, AuthenticatedHttpClient.get(endpoints.ROI_GET, config)];
54
+ case 1:
55
+ response = _b.sent();
56
+ // console.log(response);
57
+ return [2 /*return*/, { rois: response.data, pipeline_id: pipeline }];
58
+ }
59
+ });
60
+ });
61
+ });
62
+ export function niiToVolume(nii) {
63
+ return {
64
+ //URL is for NiiVue blob loading
65
+ url: nii.link,
66
+ //name is for NiiVue name replacer (needs proper extension like .nii)
67
+ name: nii.filename.split("/").pop(),
68
+ //alias is for user selection in toolbar
69
+ alias: nii.name
70
+ };
71
+ }
72
+ export var loadResult = createAsyncThunk("LoadResult", function (_a) {
73
+ var job = _a.job;
74
+ return __awaiter(void 0, void 0, void 0, function () {
75
+ var endpoints, volumes, file, result, niis;
76
+ return __generator(this, function (_b) {
77
+ switch (_b.label) {
78
+ case 0:
79
+ endpoints = getEndpoints();
80
+ volumes = [];
81
+ file = job.files[0];
82
+ return [4 /*yield*/, AuthenticatedHttpClient.post(endpoints.UNZIP, JSON.parse(file.location), {
83
+ timeout: 100000000
84
+ })];
85
+ case 1:
86
+ result = (_b.sent()).data;
87
+ niis = result.data;
88
+ // console.log(niis);
89
+ niis.forEach(function (value) {
90
+ // console.log(value);
91
+ volumes.push({
92
+ //URL is for NiiVue blob loading
93
+ url: value.link,
94
+ //name is for NiiVue name replacer (needs proper extension like .nii)
95
+ name: value.filename.split("/").pop(),
96
+ //alias is for user selection in toolbar
97
+ alias: value.name
98
+ });
99
+ });
100
+ return [2 /*return*/, { pipelineID: job.pipeline_id, job: job, volumes: volumes, niis: niis, result: result }];
101
+ }
102
+ });
103
+ });
104
+ }, {
105
+ // Adding extra information to the meta field
106
+ getPendingMeta: function (_a) {
107
+ var arg = _a.arg, requestId = _a.requestId;
108
+ // console.log('Pending Meta:');
109
+ return {
110
+ jobId: arg.job.id,
111
+ requestId: requestId
112
+ };
113
+ }
114
+ });
@@ -0,0 +1,24 @@
1
+ import { ROIState } from "./roiTypes";
2
+ import { Job } from "../jobs/jobsSlice";
3
+ import { PayloadAction } from "@reduxjs/toolkit";
4
+ export declare const initialState: ROIState;
5
+ export declare const resultSlice: import("@reduxjs/toolkit").Slice<ROIState, {
6
+ setPipelineID(state: ROIState, action: PayloadAction<Job>): void;
7
+ selectVolume(state: ROIState, action: PayloadAction<number>): void;
8
+ setOpenPanel(state: ROIState, action: PayloadAction<number[]>): void;
9
+ }, "job", "job", import("@reduxjs/toolkit").SliceSelectors<ROIState>>;
10
+ declare const _default: import("@reduxjs/toolkit").CaseReducerActions<{
11
+ setPipelineID(state: ROIState, action: {
12
+ payload: Job;
13
+ type: string;
14
+ }): void;
15
+ selectVolume(state: ROIState, action: {
16
+ payload: number;
17
+ type: string;
18
+ }): void;
19
+ setOpenPanel(state: ROIState, action: {
20
+ payload: number[];
21
+ type: string;
22
+ }): void;
23
+ }, "job">;
24
+ export default _default;
@@ -0,0 +1,68 @@
1
+ import { createSlice } from "@reduxjs/toolkit";
2
+ import { loadResult, getPipelineROI } from "./resultActionCreation";
3
+ export var initialState = {
4
+ rois: {},
5
+ niis: { "-1": [] },
6
+ resultLoading: -1,
7
+ loading: false,
8
+ activeJob: undefined,
9
+ selectedVolume: 2,
10
+ openPanel: [0]
11
+ };
12
+ export var resultSlice = createSlice({
13
+ name: "job",
14
+ initialState: initialState,
15
+ reducers: {
16
+ setPipelineID: function (state, action) {
17
+ state.activeJob = action.payload;
18
+ },
19
+ selectVolume: function (state, action) {
20
+ state.selectedVolume = action.payload;
21
+ },
22
+ setOpenPanel: function (state, action) {
23
+ state.openPanel = action.payload;
24
+ }
25
+ },
26
+ extraReducers: function (builder) { return (builder.addCase(getPipelineROI.pending, function (state, action) {
27
+ state.loading = true;
28
+ }),
29
+ builder.addCase(getPipelineROI.fulfilled, function (state, action) {
30
+ var _a = action.payload, rois = _a.rois, pipeline_id = _a.pipeline_id;
31
+ state.rois[pipeline_id] = [];
32
+ if (rois.length > 0) {
33
+ rois.forEach(function (element) {
34
+ if (state.rois[pipeline_id] == undefined)
35
+ state.rois[pipeline_id] = [];
36
+ state.rois[pipeline_id].push(element);
37
+ });
38
+ }
39
+ state.loading = false;
40
+ }),
41
+ builder.addCase(loadResult.pending, function (state, action) {
42
+ // @ts-ignore
43
+ state.resultLoading = action.meta.jobId;
44
+ }),
45
+ builder.addCase(loadResult.fulfilled, function (state, action) {
46
+ var _a;
47
+ // console.log(action.payload);
48
+ state.activeJob = action.payload.job;
49
+ //@ts-ignore
50
+ state.activeJob.setup = { alias: "-", version: "v0" };
51
+ //@ts-ignore
52
+ state.activeJob.setup.task = action.payload.result.headers.options;
53
+ //@ts-ignore
54
+ state.activeJob.logs =
55
+ action.payload.result.log || action.payload.result.headers.log;
56
+ //@ts-ignore
57
+ state.activeJob.slices = (_a = action.payload.result.info) === null || _a === void 0 ? void 0 : _a.slices;
58
+ //@ts-ignore
59
+ state.niis[state.activeJob.pipeline_id] = action.payload.niis;
60
+ state.selectedVolume = 1;
61
+ //ts-ignore
62
+ state.resultLoading = -1;
63
+ }),
64
+ builder.addCase(loadResult.rejected, function (state, action) {
65
+ state.resultLoading = -1;
66
+ })); }
67
+ });
68
+ export default resultSlice.actions;
@@ -0,0 +1,44 @@
1
+ import { Job } from '../jobs/jobsSlice';
2
+ export interface ROI {
3
+ id: number;
4
+ created_at: string;
5
+ updated_at: string;
6
+ location: string;
7
+ link: string;
8
+ filename: string;
9
+ size: null | number;
10
+ md5: null | string;
11
+ status: string;
12
+ database: string;
13
+ type: string;
14
+ pivot: {
15
+ pipeline_id: string;
16
+ roi_id: string;
17
+ };
18
+ }
19
+ export interface Volume {
20
+ name: string;
21
+ url: string;
22
+ alias: string;
23
+ }
24
+ export interface NiiFile {
25
+ filename: string;
26
+ id: number;
27
+ dim: number;
28
+ name: string;
29
+ type: string;
30
+ link: string;
31
+ }
32
+ export interface ROIState {
33
+ rois: {
34
+ [pipeline_id: string]: ROI[];
35
+ };
36
+ resultLoading: number;
37
+ loading: boolean;
38
+ niis: {
39
+ [pipeline_id: string]: NiiFile[];
40
+ };
41
+ activeJob?: Job;
42
+ selectedVolume: number;
43
+ openPanel: number[];
44
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { Job } from "../jobs/jobsSlice";
2
+ export declare const submitJobs: import("@reduxjs/toolkit").AsyncThunk<{
3
+ id: number;
4
+ status: number;
5
+ }[], {
6
+ jobQueue: (Job | undefined)[];
7
+ }, import("@reduxjs/toolkit").AsyncThunkConfig>;