@gen3/frontend 0.10.53 → 0.10.55

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 (228) hide show
  1. package/dist/cjs/index.js +1899 -45
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/dts/components/MessageCards/CardContainer.d.ts +1 -0
  4. package/dist/dts/components/MessageCards/CardContainer.d.ts.map +1 -1
  5. package/dist/dts/components/MessageCards/CardContainer.js +2 -2
  6. package/dist/dts/components/MessageCards/CardContainer.js.map +1 -1
  7. package/dist/dts/components/MessageCards/MessageCard.d.ts +1 -0
  8. package/dist/dts/components/MessageCards/MessageCard.d.ts.map +1 -1
  9. package/dist/dts/components/MessageCards/MessageCard.js +2 -2
  10. package/dist/dts/components/MessageCards/MessageCard.js.map +1 -1
  11. package/dist/dts/components/NewTabLink.d.ts +8 -0
  12. package/dist/dts/components/NewTabLink.d.ts.map +1 -0
  13. package/dist/dts/components/NewTabLink.js +7 -0
  14. package/dist/dts/components/NewTabLink.js.map +1 -0
  15. package/dist/dts/components/charts/echarts/VerticalBarChart.d.ts +7 -0
  16. package/dist/dts/components/charts/echarts/VerticalBarChart.d.ts.map +1 -1
  17. package/dist/dts/components/charts/echarts/VerticalBarChart.js +7 -1
  18. package/dist/dts/components/charts/echarts/VerticalBarChart.js.map +1 -1
  19. package/dist/dts/components/jobs/JobMonitor.d.ts +2 -0
  20. package/dist/dts/components/jobs/JobMonitor.d.ts.map +1 -0
  21. package/dist/dts/components/jobs/JobMonitor.js +40 -0
  22. package/dist/dts/components/jobs/JobMonitor.js.map +1 -0
  23. package/dist/dts/components/jobs/JobsList.d.ts +6 -0
  24. package/dist/dts/components/jobs/JobsList.d.ts.map +1 -0
  25. package/dist/dts/components/jobs/JobsList.js +30 -0
  26. package/dist/dts/components/jobs/JobsList.js.map +1 -0
  27. package/dist/dts/components/jobs/JobsModal.d.ts +6 -0
  28. package/dist/dts/components/jobs/JobsModal.d.ts.map +1 -0
  29. package/dist/dts/components/jobs/JobsModal.js +10 -0
  30. package/dist/dts/components/jobs/JobsModal.js.map +1 -0
  31. package/dist/dts/components/jobs/index.d.ts +5 -0
  32. package/dist/dts/components/jobs/index.d.ts.map +1 -0
  33. package/dist/dts/components/jobs/index.js +5 -0
  34. package/dist/dts/components/jobs/index.js.map +1 -0
  35. package/dist/dts/features/Analysis/AnalysisCardEditor.d.ts.map +1 -1
  36. package/dist/dts/features/Analysis/AnalysisCardEditor.js +0 -1
  37. package/dist/dts/features/Analysis/AnalysisCardEditor.js.map +1 -1
  38. package/dist/dts/features/Analysis/AnalysisCenter.js +1 -1
  39. package/dist/dts/features/Analysis/AnalysisCenter.js.map +1 -1
  40. package/dist/dts/features/Analysis/AnalysisPanel.d.ts.map +1 -1
  41. package/dist/dts/features/Analysis/AnalysisPanel.js.map +1 -1
  42. package/dist/dts/features/CohortBuilder/QueryExpressionSection.d.ts +6 -4
  43. package/dist/dts/features/CohortBuilder/QueryExpressionSection.d.ts.map +1 -1
  44. package/dist/dts/features/CohortBuilder/QueryExpressionSection.js +7 -7
  45. package/dist/dts/features/CohortBuilder/QueryExpressionSection.js.map +1 -1
  46. package/dist/dts/features/CohortBuilder/QueryRepresentation.d.ts +3 -2
  47. package/dist/dts/features/CohortBuilder/QueryRepresentation.d.ts.map +1 -1
  48. package/dist/dts/features/CohortBuilder/QueryRepresentation.js +33 -24
  49. package/dist/dts/features/CohortBuilder/QueryRepresentation.js.map +1 -1
  50. package/dist/dts/features/CohortBuilder/downloads/CohortDispatchActionButton.d.ts +46 -0
  51. package/dist/dts/features/CohortBuilder/downloads/CohortDispatchActionButton.d.ts.map +1 -0
  52. package/dist/dts/features/CohortBuilder/downloads/CohortDispatchActionButton.js +44 -0
  53. package/dist/dts/features/CohortBuilder/downloads/CohortDispatchActionButton.js.map +1 -0
  54. package/dist/dts/features/CohortBuilder/downloads/actions/TwoStepActionButton.d.ts +42 -0
  55. package/dist/dts/features/CohortBuilder/downloads/actions/TwoStepActionButton.d.ts.map +1 -0
  56. package/dist/dts/features/CohortBuilder/downloads/actions/TwoStepActionButton.js +218 -0
  57. package/dist/dts/features/CohortBuilder/downloads/actions/TwoStepActionButton.js.map +1 -0
  58. package/dist/dts/features/CohortBuilder/downloads/actions/sowerActions.d.ts +2 -0
  59. package/dist/dts/features/CohortBuilder/downloads/actions/sowerActions.d.ts.map +1 -0
  60. package/dist/dts/features/CohortBuilder/downloads/actions/sowerActions.js +12 -0
  61. package/dist/dts/features/CohortBuilder/downloads/actions/sowerActions.js.map +1 -0
  62. package/dist/dts/features/DataLibrary/DataLibrary.d.ts +4 -0
  63. package/dist/dts/features/DataLibrary/DataLibrary.d.ts.map +1 -0
  64. package/dist/dts/features/DataLibrary/DataLibrary.js +19 -0
  65. package/dist/dts/features/DataLibrary/DataLibrary.js.map +1 -0
  66. package/dist/dts/features/DataLibrary/DataLibraryLists.d.ts +5 -0
  67. package/dist/dts/features/DataLibrary/DataLibraryLists.d.ts.map +1 -0
  68. package/dist/dts/features/DataLibrary/DataLibraryLists.js +39 -0
  69. package/dist/dts/features/DataLibrary/DataLibraryLists.js.map +1 -0
  70. package/dist/dts/features/DataLibrary/DatalistAccordionItem.d.ts +21 -0
  71. package/dist/dts/features/DataLibrary/DatalistAccordionItem.d.ts.map +1 -0
  72. package/dist/dts/features/DataLibrary/DatalistAccordionItem.js +178 -0
  73. package/dist/dts/features/DataLibrary/DatalistAccordionItem.js.map +1 -0
  74. package/dist/dts/features/DataLibrary/DatasetAccordionControl.d.ts +16 -0
  75. package/dist/dts/features/DataLibrary/DatasetAccordionControl.d.ts.map +1 -0
  76. package/dist/dts/features/DataLibrary/DatasetAccordionControl.js +45 -0
  77. package/dist/dts/features/DataLibrary/DatasetAccordionControl.js.map +1 -0
  78. package/dist/dts/features/DataLibrary/EmptyList.d.ts +4 -0
  79. package/dist/dts/features/DataLibrary/EmptyList.d.ts.map +1 -0
  80. package/dist/dts/features/DataLibrary/EmptyList.js +8 -0
  81. package/dist/dts/features/DataLibrary/EmptyList.js.map +1 -0
  82. package/dist/dts/features/DataLibrary/QueryDetails.d.ts +5 -0
  83. package/dist/dts/features/DataLibrary/QueryDetails.d.ts.map +1 -0
  84. package/dist/dts/features/DataLibrary/QueryDetails.js +20 -0
  85. package/dist/dts/features/DataLibrary/QueryDetails.js.map +1 -0
  86. package/dist/dts/features/DataLibrary/SearchAndActions.d.ts +10 -0
  87. package/dist/dts/features/DataLibrary/SearchAndActions.d.ts.map +1 -0
  88. package/dist/dts/features/DataLibrary/SearchAndActions.js +18 -0
  89. package/dist/dts/features/DataLibrary/SearchAndActions.js.map +1 -0
  90. package/dist/dts/features/DataLibrary/index.d.ts +5 -0
  91. package/dist/dts/features/DataLibrary/index.d.ts.map +1 -0
  92. package/dist/dts/features/DataLibrary/index.js +3 -0
  93. package/dist/dts/features/DataLibrary/index.js.map +1 -0
  94. package/dist/dts/features/DataLibrary/modals/SelectedItemsModal.d.ts +9 -0
  95. package/dist/dts/features/DataLibrary/modals/SelectedItemsModal.d.ts.map +1 -0
  96. package/dist/dts/features/DataLibrary/modals/SelectedItemsModal.js +191 -0
  97. package/dist/dts/features/DataLibrary/modals/SelectedItemsModal.js.map +1 -0
  98. package/dist/dts/features/DataLibrary/modals/utils.d.ts +2 -0
  99. package/dist/dts/features/DataLibrary/modals/utils.d.ts.map +1 -0
  100. package/dist/dts/features/DataLibrary/modals/utils.js +45 -0
  101. package/dist/dts/features/DataLibrary/modals/utils.js.map +1 -0
  102. package/dist/dts/features/DataLibrary/selection/SelectionContext.d.ts +67 -0
  103. package/dist/dts/features/DataLibrary/selection/SelectionContext.d.ts.map +1 -0
  104. package/dist/dts/features/DataLibrary/selection/SelectionContext.js +151 -0
  105. package/dist/dts/features/DataLibrary/selection/SelectionContext.js.map +1 -0
  106. package/dist/dts/features/DataLibrary/selection/exportActions.d.ts +3 -0
  107. package/dist/dts/features/DataLibrary/selection/exportActions.d.ts.map +1 -0
  108. package/dist/dts/features/DataLibrary/selection/exportActions.js +119 -0
  109. package/dist/dts/features/DataLibrary/selection/exportActions.js.map +1 -0
  110. package/dist/dts/features/DataLibrary/selection/registeredActions.d.ts +12 -0
  111. package/dist/dts/features/DataLibrary/selection/registeredActions.d.ts.map +1 -0
  112. package/dist/dts/features/DataLibrary/selection/registeredActions.js +29 -0
  113. package/dist/dts/features/DataLibrary/selection/registeredActions.js.map +1 -0
  114. package/dist/dts/features/DataLibrary/selection/selectedItemActions.d.ts +16 -0
  115. package/dist/dts/features/DataLibrary/selection/selectedItemActions.d.ts.map +1 -0
  116. package/dist/dts/features/DataLibrary/selection/selectedItemActions.js +76 -0
  117. package/dist/dts/features/DataLibrary/selection/selectedItemActions.js.map +1 -0
  118. package/dist/dts/features/DataLibrary/selection/selection.d.ts +32 -0
  119. package/dist/dts/features/DataLibrary/selection/selection.d.ts.map +1 -0
  120. package/dist/dts/features/DataLibrary/selection/selection.js +88 -0
  121. package/dist/dts/features/DataLibrary/selection/selection.js.map +1 -0
  122. package/dist/dts/features/DataLibrary/selection/tests/SelectionContext.unit.test.d.ts +2 -0
  123. package/dist/dts/features/DataLibrary/selection/tests/SelectionContext.unit.test.d.ts.map +1 -0
  124. package/dist/dts/features/DataLibrary/selection/tests/SelectionContext.unit.test.js +176 -0
  125. package/dist/dts/features/DataLibrary/selection/tests/SelectionContext.unit.test.js.map +1 -0
  126. package/dist/dts/features/DataLibrary/selection/tests/utils.unit.test.d.ts +2 -0
  127. package/dist/dts/features/DataLibrary/selection/tests/utils.unit.test.d.ts.map +1 -0
  128. package/dist/dts/features/DataLibrary/selection/tests/utils.unit.test.js +79 -0
  129. package/dist/dts/features/DataLibrary/selection/tests/utils.unit.test.js.map +1 -0
  130. package/dist/dts/features/DataLibrary/selection/types.d.ts +31 -0
  131. package/dist/dts/features/DataLibrary/selection/types.d.ts.map +1 -0
  132. package/dist/dts/features/DataLibrary/selection/types.js +2 -0
  133. package/dist/dts/features/DataLibrary/selection/types.js.map +1 -0
  134. package/dist/dts/features/DataLibrary/selection/utils.d.ts +15 -0
  135. package/dist/dts/features/DataLibrary/selection/utils.d.ts.map +1 -0
  136. package/dist/dts/features/DataLibrary/selection/utils.js +85 -0
  137. package/dist/dts/features/DataLibrary/selection/utils.js.map +1 -0
  138. package/dist/dts/features/DataLibrary/tables/AdditionalDataTable.d.ts +8 -0
  139. package/dist/dts/features/DataLibrary/tables/AdditionalDataTable.d.ts.map +1 -0
  140. package/dist/dts/features/DataLibrary/tables/AdditionalDataTable.js +36 -0
  141. package/dist/dts/features/DataLibrary/tables/AdditionalDataTable.js.map +1 -0
  142. package/dist/dts/features/DataLibrary/tables/DatalistContentsPanel.d.ts +1 -0
  143. package/dist/dts/features/DataLibrary/tables/DatalistContentsPanel.d.ts.map +1 -0
  144. package/dist/dts/features/DataLibrary/tables/DatalistContentsPanel.js +130 -0
  145. package/dist/dts/features/DataLibrary/tables/DatalistContentsPanel.js.map +1 -0
  146. package/dist/dts/features/DataLibrary/tables/DatasetContentsTable.d.ts +10 -0
  147. package/dist/dts/features/DataLibrary/tables/DatasetContentsTable.d.ts.map +1 -0
  148. package/dist/dts/features/DataLibrary/tables/DatasetContentsTable.js +149 -0
  149. package/dist/dts/features/DataLibrary/tables/DatasetContentsTable.js.map +1 -0
  150. package/dist/dts/features/DataLibrary/tables/FilesTable.d.ts +11 -0
  151. package/dist/dts/features/DataLibrary/tables/FilesTable.d.ts.map +1 -0
  152. package/dist/dts/features/DataLibrary/tables/FilesTable.js +57 -0
  153. package/dist/dts/features/DataLibrary/tables/FilesTable.js.map +1 -0
  154. package/dist/dts/features/DataLibrary/tables/QueriesTable.d.ts +9 -0
  155. package/dist/dts/features/DataLibrary/tables/QueriesTable.d.ts.map +1 -0
  156. package/dist/dts/features/DataLibrary/tables/QueriesTable.js +36 -0
  157. package/dist/dts/features/DataLibrary/tables/QueriesTable.js.map +1 -0
  158. package/dist/dts/features/DataLibrary/tables/SelectedItemsTable.d.ts +12 -0
  159. package/dist/dts/features/DataLibrary/tables/SelectedItemsTable.d.ts.map +1 -0
  160. package/dist/dts/features/DataLibrary/tables/SelectedItemsTable.js +156 -0
  161. package/dist/dts/features/DataLibrary/tables/SelectedItemsTable.js.map +1 -0
  162. package/dist/dts/features/DataLibrary/tables/tableSettings.d.ts +3 -0
  163. package/dist/dts/features/DataLibrary/tables/tableSettings.d.ts.map +1 -0
  164. package/dist/dts/features/DataLibrary/tables/tableSettings.js +64 -0
  165. package/dist/dts/features/DataLibrary/tables/tableSettings.js.map +1 -0
  166. package/dist/dts/features/DataLibrary/tests/utils.unit.test.d.ts +2 -0
  167. package/dist/dts/features/DataLibrary/tests/utils.unit.test.d.ts.map +1 -0
  168. package/dist/dts/features/DataLibrary/tests/utils.unit.test.js +43 -0
  169. package/dist/dts/features/DataLibrary/tests/utils.unit.test.js.map +1 -0
  170. package/dist/dts/features/DataLibrary/types.d.ts +48 -0
  171. package/dist/dts/features/DataLibrary/types.d.ts.map +1 -0
  172. package/dist/dts/features/DataLibrary/types.js +25 -0
  173. package/dist/dts/features/DataLibrary/types.js.map +1 -0
  174. package/dist/dts/features/DataLibrary/utils.d.ts +28 -0
  175. package/dist/dts/features/DataLibrary/utils.d.ts.map +1 -0
  176. package/dist/dts/features/DataLibrary/utils.js +68 -0
  177. package/dist/dts/features/DataLibrary/utils.js.map +1 -0
  178. package/dist/dts/features/Discovery/ActionBar/DownloadAsZipButton.d.ts.map +1 -1
  179. package/dist/dts/features/Discovery/ActionBar/DownloadAsZipButton.js +0 -1
  180. package/dist/dts/features/Discovery/ActionBar/DownloadAsZipButton.js.map +1 -1
  181. package/dist/dts/features/Discovery/TableRenderers/DataAccessCellRenderers.d.ts.map +1 -1
  182. package/dist/dts/features/Discovery/TableRenderers/DataAccessCellRenderers.js +3 -3
  183. package/dist/dts/features/Discovery/TableRenderers/DataAccessCellRenderers.js.map +1 -1
  184. package/dist/dts/features/Navigation/NavigationLogo.js +1 -1
  185. package/dist/dts/features/Navigation/NavigationLogo.js.map +1 -1
  186. package/dist/dts/features/Workspace/NotebookCard.d.ts.map +1 -1
  187. package/dist/dts/features/Workspace/NotebookCard.js +0 -1
  188. package/dist/dts/features/Workspace/NotebookCard.js.map +1 -1
  189. package/dist/dts/index.d.ts +2 -1
  190. package/dist/dts/index.d.ts.map +1 -1
  191. package/dist/dts/index.js +2 -1
  192. package/dist/dts/index.js.map +1 -1
  193. package/dist/dts/lib/content/filesystem.js +1 -1
  194. package/dist/dts/lib/content/filesystem.js.map +1 -1
  195. package/dist/dts/pages/DataLibrary/DataLibrary.d.ts +8 -0
  196. package/dist/dts/pages/DataLibrary/DataLibrary.d.ts.map +1 -0
  197. package/dist/dts/pages/DataLibrary/DataLibrary.js +24 -0
  198. package/dist/dts/pages/DataLibrary/DataLibrary.js.map +1 -0
  199. package/dist/dts/pages/DataLibrary/data.d.ts +4 -0
  200. package/dist/dts/pages/DataLibrary/data.d.ts.map +1 -0
  201. package/dist/dts/pages/DataLibrary/data.js +81 -0
  202. package/dist/dts/pages/DataLibrary/data.js.map +1 -0
  203. package/dist/dts/pages/DataLibrary/index.d.ts +3 -0
  204. package/dist/dts/pages/DataLibrary/index.d.ts.map +1 -0
  205. package/dist/dts/pages/DataLibrary/index.js +3 -0
  206. package/dist/dts/pages/DataLibrary/index.js.map +1 -0
  207. package/dist/dts/pages/Explorer/data.d.ts.map +1 -1
  208. package/dist/dts/pages/Explorer/data.js.map +1 -1
  209. package/dist/dts/pages/NotebookLite/NotebookLite.d.ts.map +1 -1
  210. package/dist/dts/pages/NotebookLite/NotebookLite.js +3 -1
  211. package/dist/dts/pages/NotebookLite/NotebookLite.js.map +1 -1
  212. package/dist/dts/services/SowerJobsMonitor.d.ts +30 -0
  213. package/dist/dts/services/SowerJobsMonitor.d.ts.map +1 -0
  214. package/dist/dts/services/SowerJobsMonitor.js +236 -0
  215. package/dist/dts/services/SowerJobsMonitor.js.map +1 -0
  216. package/dist/dts/utils/date.d.ts +17 -0
  217. package/dist/dts/utils/date.d.ts.map +1 -0
  218. package/dist/dts/utils/date.js +41 -0
  219. package/dist/dts/utils/date.js.map +1 -0
  220. package/dist/dts/utils/tests/date.unit.test.d.ts +2 -0
  221. package/dist/dts/utils/tests/date.unit.test.d.ts.map +1 -0
  222. package/dist/dts/utils/tests/date.unit.test.js +89 -0
  223. package/dist/dts/utils/tests/date.unit.test.js.map +1 -0
  224. package/dist/esm/index.js +1903 -51
  225. package/dist/esm/index.js.map +1 -1
  226. package/dist/index.d.ts +62 -2
  227. package/dist/tsconfig.tsbuildinfo +1 -1
  228. package/package.json +5 -5
package/dist/cjs/index.js CHANGED
@@ -645,10 +645,10 @@ const LoginButton = ({ icon = /*#__PURE__*/ jsxRuntime.jsx(md.MdLogin, {
645
645
  });
646
646
  };
647
647
 
648
- const CardContainer = ({ children })=>/*#__PURE__*/ jsxRuntime.jsx("div", {
649
- className: "flex justify-center pt-2 items-center",
648
+ const CardContainer = ({ children, width = 'w-1/2' })=>/*#__PURE__*/ jsxRuntime.jsx("div", {
649
+ className: `flex justify-center pt-2 items-center m-2 ${width ?? ''}`,
650
650
  children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Card, {
651
- shadow: "sm",
651
+ shadow: "xs",
652
652
  p: "md",
653
653
  className: "bg-base-lightest border-2 border-base-lighter",
654
654
  children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Group, {
@@ -665,7 +665,8 @@ const MessageText = ({ message, color })=>/*#__PURE__*/ jsxRuntime.jsx(core$1.Te
665
665
  fw: 500,
666
666
  children: message
667
667
  });
668
- const MessageCard = ({ message, icon, size = 'lg', color = 'utility.5' })=>/*#__PURE__*/ jsxRuntime.jsxs(CardContainer, {
668
+ const MessageCard = ({ message, icon, size = 'lg', color = 'utility.5', width = 'w-1/2' })=>/*#__PURE__*/ jsxRuntime.jsxs(CardContainer, {
669
+ width: width,
669
670
  children: [
670
671
  /*#__PURE__*/ jsxRuntime.jsx(core$1.ThemeIcon, {
671
672
  color: color,
@@ -2752,7 +2753,7 @@ const NavigationLogo = ({ src, title, description, width, height, divider = fals
2752
2753
  width: width ?? undefined,
2753
2754
  height: height ?? undefined,
2754
2755
  fill: !width && !height,
2755
- src: `${basePath}${src}`,
2756
+ src: `${src}`,
2756
2757
  alt: description ?? title ?? 'link back to homepage'
2757
2758
  })
2758
2759
  }),
@@ -3379,14 +3380,14 @@ var AccessLevel;
3379
3380
  const DataAccessCellRenderer = ({ value })=>{
3380
3381
  if (value === AccessLevel.PENDING) {
3381
3382
  return /*#__PURE__*/ jsxRuntime.jsx(lu.LuClock, {
3382
- color: "green",
3383
- children: "You have access to this study."
3383
+ color: "yellow",
3384
+ children: "Your access to this study is pending."
3384
3385
  });
3385
3386
  }
3386
3387
  if (value === AccessLevel.NOT_AVAILABLE) {
3387
3388
  return /*#__PURE__*/ jsxRuntime.jsx(lu.LuCircleSlash, {
3388
- color: "green",
3389
- children: "You have access to this study."
3389
+ color: "red",
3390
+ children: "Cannot determine access to this study. Please contact the study owner."
3390
3391
  });
3391
3392
  }
3392
3393
  if (value === AccessLevel.ACCESSIBLE) {
@@ -3397,8 +3398,8 @@ const DataAccessCellRenderer = ({ value })=>{
3397
3398
  }
3398
3399
  if (value === AccessLevel.UNACCESSIBLE) {
3399
3400
  return /*#__PURE__*/ jsxRuntime.jsx(lu.LuLock, {
3400
- color: "green",
3401
- children: "You have access to this study."
3401
+ color: "red",
3402
+ children: "You do not have access to this study."
3402
3403
  });
3403
3404
  }
3404
3405
  return /*#__PURE__*/ jsxRuntime.jsx(React.Fragment, {});
@@ -5084,7 +5085,7 @@ const BuildSummaryStatisticPanel = (summaries = [])=>{
5084
5085
  }
5085
5086
  });
5086
5087
  };
5087
- const columns = [
5088
+ const columns$3 = [
5088
5089
  'grid-cols-0',
5089
5090
  'grid-cols-1',
5090
5091
  'grid-cols-2',
@@ -5099,7 +5100,7 @@ const columns = [
5099
5100
  ];
5100
5101
  const SummaryStatisticPanel = ({ summaries })=>{
5101
5102
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
5102
- className: `grid ${columns[summaries.length]} grow shrink-0 divide-x-2 divide-accent`,
5103
+ className: `grid ${columns$3[summaries.length]} grow shrink-0 divide-x-2 divide-accent`,
5103
5104
  children: BuildSummaryStatisticPanel(summaries)
5104
5105
  });
5105
5106
  };
@@ -8048,7 +8049,7 @@ const isRangeOperation = (x)=>{
8048
8049
  const isNestedFilter = (x)=>{
8049
8050
  return 'path' in x;
8050
8051
  };
8051
- const IncludeExcludeQueryElement = ({ index, field, path, operator, operands })=>{
8052
+ const IncludeExcludeQueryElement = ({ index, field, path, operator, operands, displayOnly = false })=>{
8052
8053
  const dispatch = core.useCoreDispatch();
8053
8054
  const [queryExpressionsExpanded, setQueryExpressionsExpanded] = React.useContext(QueryExpressionsExpandedContext);
8054
8055
  const currentCohortId = core.useCoreSelector((state)=>core.selectCurrentCohortId(state));
@@ -8111,12 +8112,12 @@ const IncludeExcludeQueryElement = ({ index, field, path, operator, operands })=
8111
8112
  variant: "filled",
8112
8113
  color: "accent.5",
8113
8114
  size: "md",
8114
- pr: 0,
8115
- className: "normal-case items-center max-w-[162px] cursor-pointer pl-2 pr-0 hover:bg-accent-darker",
8116
- rightSection: /*#__PURE__*/ jsxRuntime.jsx(RemoveButton, {
8115
+ className: `normal-case items-center max-w-[162px] cursor-pointer hover:bg-accent-darker pl-2 ${displayOnly ? 'pr-3' : 'pr-0'}`,
8116
+ rightSection: !displayOnly && /*#__PURE__*/ jsxRuntime.jsx(RemoveButton, {
8117
8117
  value: value
8118
8118
  }),
8119
8119
  onClick: ()=>{
8120
+ if (displayOnly) return;
8120
8121
  const newOperands = operandsArray.filter((o)=>o !== x);
8121
8122
  const fieldToUpdate = path && path != '.' ? [
8122
8123
  path,
@@ -8158,7 +8159,7 @@ const IncludeExcludeQueryElement = ({ index, field, path, operator, operands })=
8158
8159
  ]
8159
8160
  });
8160
8161
  };
8161
- const ComparisonElement = ({ index, filter, showLabel = true })=>{
8162
+ const ComparisonElement = ({ index, filter, showLabel = true, displayOnly = false })=>{
8162
8163
  const coreDispatch = core.useCoreDispatch();
8163
8164
  // fix the code below
8164
8165
  const handleKeepMember = (keep)=>{
@@ -8178,7 +8179,10 @@ const ComparisonElement = ({ index, filter, showLabel = true })=>{
8178
8179
  children: [
8179
8180
  /*#__PURE__*/ jsxRuntime.jsx("button", {
8180
8181
  className: "h-[25px] w-[25px] mx-2 rounded-[50%] bg-accent-cool-lightest text-accent-cool-lightest-contrast pb-1",
8181
- onClick: ()=>handleKeepMember(filter),
8182
+ onClick: ()=>{
8183
+ if (displayOnly) return;
8184
+ handleKeepMember(filter);
8185
+ },
8182
8186
  children: filter.operator
8183
8187
  }),
8184
8188
  /*#__PURE__*/ jsxRuntime.jsx(QueryRepresentationText, {
@@ -8231,7 +8235,7 @@ const ClosedRangeQueryElement = ({ index, lower, upper, op = 'and' })=>{
8231
8235
  })
8232
8236
  });
8233
8237
  };
8234
- const QueryElement = ({ index, field, path, children })=>{
8238
+ const QueryElement = ({ index, field, path, children, displayOnly = false })=>{
8235
8239
  const coreDispatch = core.useCoreDispatch();
8236
8240
  const [, setQueryExpressionsExpanded] = React.useContext(QueryExpressionsExpandedContext);
8237
8241
  const currentCohortId = core.useCoreSelector((state)=>core.selectCurrentCohortId(state));
@@ -8253,7 +8257,7 @@ const QueryElement = ({ index, field, path, children })=>{
8253
8257
  return /*#__PURE__*/ jsxRuntime.jsxs(QueryItemContainer, {
8254
8258
  children: [
8255
8259
  children,
8256
- /*#__PURE__*/ jsxRuntime.jsx("button", {
8260
+ !displayOnly && /*#__PURE__*/ jsxRuntime.jsx("button", {
8257
8261
  className: "bg-accent-vivid p-0 m-0 h-full rounded-r-sm text-white hover:bg-accent-darker",
8258
8262
  onClick: handleRemoveFilter,
8259
8263
  "aria-label": `remove ${core.fieldNameToTitle(field)}`,
@@ -8268,85 +8272,102 @@ const QueryElement = ({ index, field, path, children })=>{
8268
8272
  /**
8269
8273
  * Processes a Filter into a component representation
8270
8274
  */ class CohortFilterToComponent {
8271
- constructor(index, path = '.'){
8275
+ constructor(index, path = '.', displayOnly = false){
8272
8276
  this.handleIncludes = (f)=>/*#__PURE__*/ jsxRuntime.jsx(QueryElement, {
8273
8277
  ...f,
8274
8278
  index: this.index,
8275
8279
  path: this.path,
8280
+ displayOnly: this.displayOnly,
8276
8281
  children: /*#__PURE__*/ jsxRuntime.jsx(IncludeExcludeQueryElement, {
8277
8282
  ...f,
8278
8283
  index: this.index,
8279
- path: this.path
8284
+ path: this.path,
8285
+ displayOnly: this.displayOnly
8280
8286
  })
8281
8287
  }, f.field);
8282
8288
  this.handleExcludes = (f)=>/*#__PURE__*/ jsxRuntime.jsx(QueryElement, {
8283
8289
  ...f,
8284
8290
  index: this.index,
8285
8291
  path: this.path,
8292
+ displayOnly: this.displayOnly,
8286
8293
  children: /*#__PURE__*/ jsxRuntime.jsx(IncludeExcludeQueryElement, {
8287
8294
  ...f,
8288
8295
  index: this.index,
8289
- path: this.path
8296
+ path: this.path,
8297
+ displayOnly: this.displayOnly
8290
8298
  })
8291
8299
  }, f.field);
8292
8300
  this.handleEquals = (f)=>/*#__PURE__*/ jsxRuntime.jsx(QueryElement, {
8293
8301
  ...f,
8294
8302
  index: this.index,
8295
8303
  path: this.path,
8304
+ displayOnly: this.displayOnly,
8296
8305
  children: /*#__PURE__*/ jsxRuntime.jsx(ComparisonElement, {
8297
8306
  filter: f,
8298
- index: this.index
8307
+ index: this.index,
8308
+ displayOnly: this.displayOnly
8299
8309
  })
8300
8310
  }, f.field);
8301
8311
  this.handleNotEquals = (f)=>/*#__PURE__*/ jsxRuntime.jsx(QueryElement, {
8302
8312
  ...f,
8303
8313
  index: this.index,
8304
8314
  path: this.path,
8315
+ displayOnly: this.displayOnly,
8305
8316
  children: /*#__PURE__*/ jsxRuntime.jsx(ComparisonElement, {
8306
8317
  filter: f,
8307
- index: this.index
8318
+ index: this.index,
8319
+ displayOnly: this.displayOnly
8308
8320
  })
8309
8321
  }, f.field);
8310
8322
  this.handleLessThan = (f)=>/*#__PURE__*/ jsxRuntime.jsx(QueryElement, {
8311
8323
  ...f,
8312
8324
  index: this.index,
8313
8325
  path: this.path,
8326
+ displayOnly: this.displayOnly,
8314
8327
  children: /*#__PURE__*/ jsxRuntime.jsx(ComparisonElement, {
8315
8328
  filter: f,
8316
- index: this.index
8329
+ index: this.index,
8330
+ displayOnly: this.displayOnly
8317
8331
  })
8318
8332
  }, f.field);
8319
8333
  this.handleLessThanOrEquals = (f)=>/*#__PURE__*/ jsxRuntime.jsx(QueryElement, {
8320
8334
  ...f,
8321
8335
  index: this.index,
8322
8336
  path: this.path,
8337
+ displayOnly: this.displayOnly,
8323
8338
  children: /*#__PURE__*/ jsxRuntime.jsx(ComparisonElement, {
8324
8339
  filter: f,
8325
- index: this.index
8340
+ index: this.index,
8341
+ displayOnly: this.displayOnly
8326
8342
  })
8327
8343
  }, f.field);
8328
8344
  this.handleGreaterThan = (f)=>/*#__PURE__*/ jsxRuntime.jsx(QueryElement, {
8329
8345
  ...f,
8330
8346
  index: this.index,
8331
8347
  path: this.path,
8348
+ displayOnly: this.displayOnly,
8332
8349
  children: /*#__PURE__*/ jsxRuntime.jsx(ComparisonElement, {
8333
8350
  filter: f,
8334
- index: this.index
8351
+ index: this.index,
8352
+ displayOnly: this.displayOnly
8335
8353
  })
8336
8354
  }, f.field);
8337
8355
  this.handleGreaterThanOrEquals = (f)=>/*#__PURE__*/ jsxRuntime.jsx(QueryElement, {
8338
8356
  ...f,
8339
8357
  index: this.index,
8340
8358
  path: this.path,
8359
+ displayOnly: this.displayOnly,
8341
8360
  children: /*#__PURE__*/ jsxRuntime.jsx(ComparisonElement, {
8342
8361
  filter: f,
8343
- index: this.index
8362
+ index: this.index,
8363
+ displayOnly: this.displayOnly
8344
8364
  })
8345
8365
  }, f.field);
8346
8366
  this.handleExists = (f)=>/*#__PURE__*/ jsxRuntime.jsx(QueryElement, {
8347
8367
  ...f,
8348
8368
  index: this.index,
8349
8369
  path: this.path,
8370
+ displayOnly: this.displayOnly,
8350
8371
  children: /*#__PURE__*/ jsxRuntime.jsx(ExistsElement, {
8351
8372
  ...f
8352
8373
  })
@@ -8355,6 +8376,7 @@ const QueryElement = ({ index, field, path, children })=>{
8355
8376
  ...f,
8356
8377
  index: this.index,
8357
8378
  path: this.path,
8379
+ displayOnly: this.displayOnly,
8358
8380
  children: /*#__PURE__*/ jsxRuntime.jsx(ExistsElement, {
8359
8381
  ...f
8360
8382
  })
@@ -8363,9 +8385,11 @@ const QueryElement = ({ index, field, path, children })=>{
8363
8385
  ...f,
8364
8386
  index: this.index,
8365
8387
  path: this.path,
8388
+ displayOnly: this.displayOnly,
8366
8389
  children: /*#__PURE__*/ jsxRuntime.jsx(IncludeExcludeQueryElement, {
8367
8390
  ...f,
8368
- index: this.index
8391
+ index: this.index,
8392
+ displayOnly: this.displayOnly
8369
8393
  })
8370
8394
  }, f.field);
8371
8395
  this.handleIntersection = (f)=>{
@@ -8399,17 +8423,18 @@ const QueryElement = ({ index, field, path, children })=>{
8399
8423
  return convertFilterToComponent(newOp, this.index, [
8400
8424
  op.path,
8401
8425
  op.operand.path
8402
- ].join('.'));
8426
+ ].join('.'), this.displayOnly);
8403
8427
  } else {
8404
- return convertFilterToComponent(op.operand, this.index, op.path);
8428
+ return convertFilterToComponent(op.operand, this.index, op.path, this.displayOnly);
8405
8429
  }
8406
8430
  };
8407
8431
  this.index = index;
8408
8432
  this.path = path;
8433
+ this.displayOnly = displayOnly;
8409
8434
  }
8410
8435
  }
8411
- const convertFilterToComponent = (filter, index, path = '.')=>{
8412
- const handler = new CohortFilterToComponent(index, path);
8436
+ const convertFilterToComponent = (filter, index, path = '.', displayOnly = false)=>{
8437
+ const handler = new CohortFilterToComponent(index, path, displayOnly);
8413
8438
  return core.handleOperation(handler, filter);
8414
8439
  };
8415
8440
 
@@ -8619,7 +8644,7 @@ const reducer = (state, action)=>{
8619
8644
  }
8620
8645
  }
8621
8646
  };
8622
- const QueryExpressionSection = ({ index, filters, currentCohortName, currentCohortId })=>{
8647
+ const QueryExpressionSection = ({ index, filters, currentCohortName, currentCohortId, displayOnly = false, showTitle = true })=>{
8623
8648
  const [expandedState, setExpandedState] = React.useReducer(reducer, {});
8624
8649
  const [filtersSectionCollapsed, setFiltersSectionCollapsed] = React.useState(true);
8625
8650
  const filtersRef = React.useRef(null);
@@ -8676,14 +8701,14 @@ const QueryExpressionSection = ({ index, filters, currentCohortName, currentCoho
8676
8701
  "data-testid": "text-cohort-filters-top-row",
8677
8702
  className: "flex flex-row py-2 items-center border-secondary-darkest border-b-1",
8678
8703
  children: [
8679
- /*#__PURE__*/ jsxRuntime.jsx(OverflowTooltippedLabel, {
8704
+ showTitle && /*#__PURE__*/ jsxRuntime.jsx(OverflowTooltippedLabel, {
8680
8705
  label: currentCohortName,
8681
8706
  className: "font-bold text-secondary-contrast-darkest ml-3 max-w-[260px]",
8682
8707
  children: currentCohortName
8683
8708
  }),
8684
8709
  /*#__PURE__*/ jsxRuntime.jsxs(React.Fragment, {
8685
8710
  children: [
8686
- /*#__PURE__*/ jsxRuntime.jsx("button", {
8711
+ !displayOnly && /*#__PURE__*/ jsxRuntime.jsx("button", {
8687
8712
  "data-testid": "button-clear-all-cohort-filters",
8688
8713
  className: `text-sm font-montserrat ml-2 px-1 hover:bg-primary-darkest hover:text-primary-content-lightest hover:rounded-md ${noFilters ? 'hidden' : 'cursor-pointer text-secondary-contrast-darkest'}`,
8689
8714
  onClick: clearAllFilters,
@@ -8768,7 +8793,7 @@ const QueryExpressionSection = ({ index, filters, currentCohortName, currentCoho
8768
8793
  className: "font-content",
8769
8794
  children: "No filters currently applied."
8770
8795
  }) : Object.keys(filters.root).map((k)=>{
8771
- return convertFilterToComponent(filters.root[k], index);
8796
+ return convertFilterToComponent(filters.root[k], index, '.', displayOnly);
8772
8797
  })
8773
8798
  })
8774
8799
  ]
@@ -10395,7 +10420,6 @@ const NotebookCard = ({ info })=>{
10395
10420
  const { status } = core.useCoreSelector(core.selectWorkspaceStatusFromService);
10396
10421
  const requestedStatus = core.useCoreSelector(core.selectRequestedWorkspaceStatus);
10397
10422
  const workspaceId = core.useCoreSelector(core.selectActiveWorkspaceId);
10398
- console.log('NotebookCard: ', requestedStatus, workspaceId, status);
10399
10423
  return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Card, {
10400
10424
  withBorder: true,
10401
10425
  radius: "xs",
@@ -11130,7 +11154,7 @@ const AnalysisCenter = ({ tools, showFilterAndSort = false })=>{
11130
11154
  className: "p-0 rounded-sm",
11131
11155
  children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Image, {
11132
11156
  component: Image,
11133
- src: `/images/apps/${image}`,
11157
+ src: `${image}`,
11134
11158
  alt: `${title} image`,
11135
11159
  height: 1000,
11136
11160
  width: 1000,
@@ -11144,7 +11168,7 @@ const AnalysisCenter = ({ tools, showFilterAndSort = false })=>{
11144
11168
  className: "p-0.5 rounded-sm bg-base-lightest ml-5 border-2 border-base",
11145
11169
  children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Image, {
11146
11170
  component: Image,
11147
- src: `/icons/apps/${icon}`,
11171
+ src: `${icon}`,
11148
11172
  alt: `${title} logo`,
11149
11173
  width: 40,
11150
11174
  height: 40,
@@ -11225,7 +11249,7 @@ class FilesystemContent {
11225
11249
  }
11226
11250
  async get(filepath) {
11227
11251
  try {
11228
- return await JSON.parse(fs.readFileSync(path.join(this.rootPath, filepath)).toString('utf-8'));
11252
+ return await JSON.parse(fs.readFileSync(path.join(this.rootPath, filepath)).toString('utf8'));
11229
11253
  } catch (err) {
11230
11254
  throw new Error(`Cannot process ${filepath}`);
11231
11255
  }
@@ -16648,7 +16672,6 @@ const AnalysisCardEditor = ()=>{
16648
16672
  });
16649
16673
  if (Array.isArray(withImages)) {
16650
16674
  updateHistory(withImages);
16651
- console.log('Imported cards:', withImages);
16652
16675
  }
16653
16676
  } catch (error) {
16654
16677
  alert('Invalid file format');
@@ -17183,6 +17206,7 @@ const AISearchPageGetServerSideProps = async ()=>{
17183
17206
  };
17184
17207
 
17185
17208
  const NotebookLitePage = ({ headerProps, footerProps })=>{
17209
+ const router$1 = router.useRouter();
17186
17210
  return /*#__PURE__*/ jsxRuntime.jsx(NavPageLayout, {
17187
17211
  footerProps,
17188
17212
  headerProps,
@@ -17195,7 +17219,7 @@ const NotebookLitePage = ({ headerProps, footerProps })=>{
17195
17219
  className: "flex justify-items-center w-full",
17196
17220
  children: /*#__PURE__*/ jsxRuntime.jsx("iframe", {
17197
17221
  allow: "cross-origin",
17198
- src: "/jupyter/index.html",
17222
+ src: `${router$1.basePath}/jupyter/index.html`,
17199
17223
  width: "100%",
17200
17224
  height: "100%",
17201
17225
  title: "client notebook"
@@ -17214,6 +17238,1834 @@ const NotebookLitePageGetStaticProps = async ()=>{
17214
17238
  };
17215
17239
  };
17216
17240
 
17241
+ const getDataLibraryItem = (dataLibrary, listId, dataId, fileId)=>{
17242
+ if (!(listId in dataLibrary)) return undefined;
17243
+ if (!(dataId in dataLibrary[listId].items)) return undefined;
17244
+ const datasetOrCohort = dataLibrary[listId].items[dataId];
17245
+ const { name } = datasetOrCohort;
17246
+ if (core.isCohortItem(datasetOrCohort)) {
17247
+ return {
17248
+ ...datasetOrCohort,
17249
+ datasetId: dataId,
17250
+ datasetName: name
17251
+ };
17252
+ } else {
17253
+ if (!fileId) return undefined;
17254
+ if (!(fileId in datasetOrCohort.items)) return undefined;
17255
+ if (core.isFileItem(datasetOrCohort.items[fileId])) {
17256
+ return {
17257
+ datasetName: name,
17258
+ datasetId: dataId,
17259
+ ...datasetOrCohort.items[fileId]
17260
+ };
17261
+ }
17262
+ return undefined;
17263
+ }
17264
+ };
17265
+ const getSelectionPaths = (selections)=>{
17266
+ const paths = [];
17267
+ for (const [listId, listMembers] of Object.entries(selections)){
17268
+ for (const [memberId, member] of Object.entries(listMembers)){
17269
+ if (Object.keys(member.objectIds).length === 0) {
17270
+ // If there are no objectIds, add a path with undefined objectId
17271
+ paths.push({
17272
+ listId,
17273
+ memberId
17274
+ });
17275
+ } else {
17276
+ for (const [objectId, isSelected] of Object.entries(member.objectIds)){
17277
+ if (isSelected) {
17278
+ paths.push({
17279
+ listId,
17280
+ memberId,
17281
+ objectId
17282
+ });
17283
+ }
17284
+ }
17285
+ }
17286
+ }
17287
+ }
17288
+ return paths;
17289
+ };
17290
+ const getSelectedItemsFromDataLibrary = (selections, dataLibrary)=>{
17291
+ const selectedPaths = getSelectionPaths(selections);
17292
+ const uniqueItems = new Map();
17293
+ selectedPaths.forEach((path)=>{
17294
+ const item = getDataLibraryItem(dataLibrary, path.listId, path.memberId, path.objectId);
17295
+ if (item) {
17296
+ const key = getUniqueItemKey(item);
17297
+ uniqueItems.set(key, item);
17298
+ }
17299
+ });
17300
+ return Array.from(uniqueItems.values());
17301
+ };
17302
+ const getUniqueItemKey = (item)=>{
17303
+ if (core.isCohortItem(item)) {
17304
+ // For CohortItems
17305
+ return `cohort_${item.datasetId}`;
17306
+ } else {
17307
+ // For FileItems
17308
+ return `file_${item.datasetId}_${item.id}`;
17309
+ }
17310
+ };
17311
+
17312
+ // Create the context
17313
+ const DataLibrarySelectionContext = /*#__PURE__*/ React.createContext(undefined);
17314
+ // Reducer function
17315
+ const dataLibrarySelectionReducer = (selections, action)=>{
17316
+ switch(action.type){
17317
+ case 'UPDATE_DATA_LIBRARY_SELECTION':
17318
+ return {
17319
+ ...selections,
17320
+ [action.payload.listId]: action.payload.members
17321
+ };
17322
+ case 'UPDATE_DATALIST_MEMBER_SELECTION':
17323
+ if (Object.keys(action.payload.selection).length === 0) {
17324
+ // need to remove the dataset
17325
+ const { [action.payload.listId]: { [action.payload.memberId]: _unused, ...restState } } = selections;
17326
+ if (Object.keys(restState).length === 0) {
17327
+ const { [action.payload.listId]: _unused2, ...restList } = selections;
17328
+ return restList;
17329
+ }
17330
+ return {
17331
+ ...selections,
17332
+ [action.payload.listId]: {
17333
+ ...restState
17334
+ }
17335
+ };
17336
+ }
17337
+ return {
17338
+ ...selections,
17339
+ [action.payload.listId]: {
17340
+ ...selections[action.payload.listId],
17341
+ [action.payload.memberId]: {
17342
+ id: action.payload.memberId,
17343
+ objectIds: action.payload.selection
17344
+ }
17345
+ }
17346
+ };
17347
+ case 'DELETE_DATA_LIBRARY_LIST':
17348
+ {
17349
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
17350
+ const { [action.payload.listId]: _unused, ...restState } = selections;
17351
+ return restState;
17352
+ }
17353
+ case 'DELETE_DATA_LIBRARY_LIST_MEMBER':
17354
+ {
17355
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
17356
+ if (!(action.payload.listId in selections)) return selections;
17357
+ const { [action.payload.listId]: { [action.payload.memberId]: _unused, ...restState } } = selections;
17358
+ return {
17359
+ ...selections,
17360
+ [action.payload.listId]: {
17361
+ ...restState
17362
+ }
17363
+ };
17364
+ }
17365
+ case 'CLEAR_DATA_LIBRARY_SELECTION':
17366
+ return {};
17367
+ default:
17368
+ return selections;
17369
+ }
17370
+ };
17371
+ // Provider component
17372
+ const DataLibrarySelectionProvider = ({ children })=>{
17373
+ const [selections, dispatch] = React.useReducer(dataLibrarySelectionReducer, {});
17374
+ const [gatheredItems, setGatheredItems] = React.useState([]);
17375
+ const updateSelections = (listId, members)=>{
17376
+ dispatch(updateDataLibrarySelection(listId, members));
17377
+ };
17378
+ const updateListMemberSelections = (listId, memberId, selection)=>{
17379
+ dispatch(updateDataLibraryListMemberSelection(listId, memberId, selection));
17380
+ };
17381
+ const clearSelections = ()=>{
17382
+ dispatch(clearDataLibrarySelection());
17383
+ };
17384
+ const removeList = (listId)=>{
17385
+ dispatch(removeDataLibrarySelection(listId));
17386
+ };
17387
+ const removeListMember = (listId, memberId)=>{
17388
+ dispatch(removeDataLibraryMemberSelection(listId, memberId));
17389
+ };
17390
+ const gatherSelectedItems = (dataLibrary)=>{
17391
+ if (dataLibrary) {
17392
+ const gatheredItems = getSelectedItemsFromDataLibrary(selections, dataLibrary);
17393
+ setGatheredItems(gatheredItems);
17394
+ }
17395
+ };
17396
+ return /*#__PURE__*/ jsxRuntime.jsx(DataLibrarySelectionContext.Provider, {
17397
+ value: {
17398
+ selections,
17399
+ gatheredItems,
17400
+ dispatch,
17401
+ updateSelections,
17402
+ updateListMemberSelections,
17403
+ clearSelections,
17404
+ removeList,
17405
+ removeListMember,
17406
+ gatherSelectedItems
17407
+ },
17408
+ children: children
17409
+ });
17410
+ };
17411
+ // Custom hook for using the data library
17412
+ const useDataLibrarySelection = ()=>{
17413
+ const context = React.useContext(DataLibrarySelectionContext);
17414
+ if (!context) {
17415
+ throw new Error('useDataLibrary must be used within a DataLibraryProvider');
17416
+ }
17417
+ return context;
17418
+ };
17419
+ const updateDataLibrarySelection = (listId, members)=>({
17420
+ type: 'UPDATE_DATA_LIBRARY_SELECTION',
17421
+ payload: {
17422
+ listId,
17423
+ members
17424
+ }
17425
+ });
17426
+ const updateDataLibraryListMemberSelection = (listId, memberId, selection)=>({
17427
+ type: 'UPDATE_DATALIST_MEMBER_SELECTION',
17428
+ payload: {
17429
+ listId,
17430
+ memberId,
17431
+ selection
17432
+ }
17433
+ });
17434
+ const clearDataLibrarySelection = ()=>({
17435
+ type: 'CLEAR_DATA_LIBRARY_SELECTION'
17436
+ });
17437
+ const removeDataLibrarySelection = (listId)=>({
17438
+ type: 'DELETE_DATA_LIBRARY_LIST',
17439
+ payload: {
17440
+ listId
17441
+ }
17442
+ });
17443
+ const removeDataLibraryMemberSelection = (listId, memberId)=>({
17444
+ type: 'DELETE_DATA_LIBRARY_LIST_MEMBER',
17445
+ payload: {
17446
+ listId,
17447
+ memberId
17448
+ }
17449
+ });
17450
+ const getNumberOfDataSetItemsSelected = (selections, listId, itemId)=>{
17451
+ return Object.keys(selections?.[listId]?.[itemId]?.objectIds ?? {}).length;
17452
+ };
17453
+ const getNumberOfSelectedItemsInList = (selections, listId)=>{
17454
+ if (!(listId in selections)) return -1; // return -1 indicating there is no listId in selection
17455
+ return Object.keys(selections[listId]).reduce((count, datasetId)=>{
17456
+ try {
17457
+ return count + getNumberOfDataSetItemsSelected(selections, listId, datasetId);
17458
+ } catch (error) {
17459
+ console.error(`Failed to get number of selected items for dataset ${datasetId} in list ${listId}:`, error);
17460
+ return count;
17461
+ }
17462
+ }, 0);
17463
+ };
17464
+ const isListInSelection = (listId, selections)=>listId in selections;
17465
+
17466
+ const IconSize = {
17467
+ xs: 14,
17468
+ sm: 16,
17469
+ md: 20,
17470
+ lg: 24,
17471
+ xl: 32,
17472
+ 'xl-2': 36
17473
+ };
17474
+
17475
+ const SearchAndActions = ({ createList, gatherData, size = 'sm' })=>{
17476
+ const { selections, clearSelections } = useDataLibrarySelection();
17477
+ const retrieveDisabled = Object.keys(selections).length === 0;
17478
+ const iconSize = IconSize[size] || IconSize['sm'];
17479
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
17480
+ className: "flex justify-between p-2 bg-primary-dark text-primary-contrast-dark",
17481
+ children: /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
17482
+ children: [
17483
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
17484
+ label: "Retrieve selections",
17485
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Button, {
17486
+ disabled: retrieveDisabled,
17487
+ // disabled={Object.keys(selections).length === 0}
17488
+ size: `compact-${size}`,
17489
+ variant: "outline",
17490
+ onClick: ()=>gatherData(),
17491
+ "aria-label": "Retrieve Selected Data",
17492
+ classNames: {
17493
+ root: 'bg-base-max hover:bg-base-light'
17494
+ },
17495
+ children: "Retrieve Selected"
17496
+ })
17497
+ }),
17498
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
17499
+ label: "Clear selections",
17500
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.ActionIcon, {
17501
+ disabled: retrieveDisabled,
17502
+ variant: "outline",
17503
+ size: size,
17504
+ onClick: ()=>{
17505
+ clearSelections();
17506
+ },
17507
+ color: "accent-contrast.4",
17508
+ "aria-label": "clear selections",
17509
+ children: /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
17510
+ icon: "gen3:clear-list",
17511
+ width: iconSize,
17512
+ height: iconSize
17513
+ })
17514
+ })
17515
+ })
17516
+ ]
17517
+ })
17518
+ });
17519
+ };
17520
+
17521
+ const HTTPUserFriendlyErrorMessages = {
17522
+ // 4xx Client Errors
17523
+ 400: 'Sorry, there was a problem with your request. Please check the information you provided and try again.',
17524
+ 401: 'Please sign in to access this content. If you need to create an account, please contact support.',
17525
+ 402: 'This feature requires payment to continue. Please update your subscription.',
17526
+ 403: "You don't have permission to access this. If you think this is a mistake, please contact support.",
17527
+ 404: "We couldn't find what you're looking for. The link might be broken or the content may have been moved.",
17528
+ 405: 'This action is not supported. Please try a different approach.',
17529
+ 406: "Your browser sent a request that this server couldn't understand. Try updating your browser.",
17530
+ 407: 'Please authenticate with the network proxy first.',
17531
+ 408: 'The request took too long to complete. Please check your internet connection and try again.',
17532
+ 409: 'There was a conflict with your request. Someone might have modified the same content.',
17533
+ 410: 'This content has been permanently removed and is no longer available.',
17534
+ 411: 'There was a technical problem with your request. Please try again.',
17535
+ 412: "Some conditions for this request weren't met. Please try again.",
17536
+ 413: "The file you're trying to upload is too large. Please choose a smaller file.",
17537
+ 414: 'The web address is too long. Please try a shorter URL.',
17538
+ 415: 'This type of file is not supported. Please try a different format.',
17539
+ 416: 'The requested content range is not available.',
17540
+ 417: "Your request couldn't be completed as expected. Please try again.",
17541
+ 418: 'Unusual error occurred. Please try again or contact support if the problem persists.',
17542
+ 421: 'Your request was sent to the wrong server. Please try again.',
17543
+ 422: "We couldn't process your request. Please check the information and try again.",
17544
+ 423: 'This resource is temporarily locked. Please try again in a few moments.',
17545
+ 424: 'The request failed because it depends on another request that failed.',
17546
+ 425: 'Your request was processed too early. Please try again in a moment.',
17547
+ 426: 'You need to upgrade your browser or app to continue.',
17548
+ 428: "Some required conditions weren't met. Please check all requirements and try again.",
17549
+ 429: "You've made too many requests. Please wait a while before trying again.",
17550
+ 431: 'Request failed because the headers are too large. Please simplify your request.',
17551
+ 451: 'This content is not available for legal reasons.',
17552
+ // 5xx Server Errors
17553
+ 500: "Something went wrong on our end. We're working to fix it. Please try again later.",
17554
+ 501: "This feature isn't available yet. Check back later.",
17555
+ 502: "We're having trouble connecting to our servers. Please try again in a few minutes.",
17556
+ 503: "Our service is temporarily unavailable. We're working to restore it as quickly as possible.",
17557
+ 504: 'The server took too long to respond. Please try again later.',
17558
+ 505: "Your browser's HTTP version isn't supported. Please try updating your browser.",
17559
+ 506: 'We encountered a configuration error.',
17560
+ 507: "We're out of storage space.",
17561
+ 508: 'We detected an infinite loop in our servers.',
17562
+ 510: 'This server requires additional extensions to process your request.',
17563
+ 511: 'Please sign in to the network before continuing.'
17564
+ };
17565
+
17566
+ const SelectedItemsTableHeader = ({ numberOfItems, numberOfWarnings, size = 'sm' })=>{
17567
+ const iconSize = IconSize[size] || IconSize['sm'];
17568
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
17569
+ className: "flex items-center bg-primary-darker px-4 py-2 mt-2 min-h-10 text-heading",
17570
+ children: [
17571
+ numberOfItems > 0 && /*#__PURE__*/ jsxRuntime.jsxs("div", {
17572
+ className: "flex items-center flex-nowrap overflow-ellipsis text-primary-contrast-darker",
17573
+ children: [
17574
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
17575
+ fw: 600,
17576
+ size: size,
17577
+ className: "mr-1 ",
17578
+ children: numberOfItems
17579
+ }),
17580
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
17581
+ fw: 400,
17582
+ size: size,
17583
+ className: "mr-1 text-primary-contrast-lighter",
17584
+ children: "selected"
17585
+ })
17586
+ ]
17587
+ }),
17588
+ numberOfItems > 0 && numberOfWarnings > 0 && /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
17589
+ icon: "gen3:dot",
17590
+ className: "text-primary-contrast-lighter",
17591
+ width: iconSize,
17592
+ height: iconSize
17593
+ }),
17594
+ numberOfWarnings > 0 && /*#__PURE__*/ jsxRuntime.jsxs("div", {
17595
+ className: "flex items-center flex-nowrap overflow-ellipsis",
17596
+ children: [
17597
+ /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
17598
+ icon: "gen3:warning",
17599
+ width: iconSize,
17600
+ height: iconSize,
17601
+ className: "text-utility-warning m-1"
17602
+ }),
17603
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
17604
+ fw: 600,
17605
+ size: size,
17606
+ className: "mr-1 text-primary-contrast-lighter",
17607
+ children: numberOfWarnings
17608
+ }),
17609
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
17610
+ fw: 400,
17611
+ size: size,
17612
+ className: "text-primary-contrast-lighter",
17613
+ children: `${numberOfWarnings == 1 ? 'warning' : 'warnings'}`
17614
+ })
17615
+ ]
17616
+ })
17617
+ ]
17618
+ });
17619
+ };
17620
+ const SelectedItemsTable = ({ validatedItems, rowSelection, setRowSelection, size = 'sm' })=>{
17621
+ const handleRowSelectionChange = (updater)=>{
17622
+ let value = {};
17623
+ setRowSelection((prevSelection)=>{
17624
+ value = updater instanceof Function ? updater(prevSelection) : updater;
17625
+ return value;
17626
+ });
17627
+ };
17628
+ const iconSize = IconSize[size] || IconSize['sm'];
17629
+ const columns = React.useMemo(()=>[
17630
+ {
17631
+ accessorKey: 'valid',
17632
+ enableHiding: true,
17633
+ size: 40,
17634
+ maxSize: 50,
17635
+ header: 'Valid',
17636
+ Cell: ({ row })=>{
17637
+ if (row.original.valid === undefined) return /*#__PURE__*/ jsxRuntime.jsx("span", {});
17638
+ if (!row.original.valid) {
17639
+ return /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
17640
+ label: row.original?.messages?.join('\n') ?? 'Unknown Error',
17641
+ children: /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
17642
+ icon: "gen3:warning",
17643
+ width: iconSize,
17644
+ height: iconSize,
17645
+ className: "text-utility-warning text-xl",
17646
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
17647
+ fw: 400,
17648
+ size: size,
17649
+ children: row.original?.messages?.length
17650
+ })
17651
+ })
17652
+ });
17653
+ } else {
17654
+ return /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
17655
+ icon: "gen3:check-fill",
17656
+ width: iconSize,
17657
+ height: iconSize,
17658
+ className: "text-utility-success"
17659
+ });
17660
+ }
17661
+ }
17662
+ },
17663
+ {
17664
+ accessorKey: 'id',
17665
+ header: 'Id'
17666
+ },
17667
+ {
17668
+ accessorKey: 'description',
17669
+ header: 'Description',
17670
+ size: 150,
17671
+ maxSize: 250,
17672
+ Cell: ({ cell })=>{
17673
+ return /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
17674
+ fw: 400,
17675
+ size: size,
17676
+ lineClamp: 2,
17677
+ children: cell.getValue() ?? 'N/A'
17678
+ });
17679
+ }
17680
+ },
17681
+ {
17682
+ accessorKey: 'type',
17683
+ header: 'Type'
17684
+ },
17685
+ {
17686
+ accessorKey: 'size',
17687
+ header: 'Size'
17688
+ },
17689
+ {
17690
+ accessorKey: 'datasetId',
17691
+ header: 'Dataset ID'
17692
+ }
17693
+ ], [
17694
+ iconSize,
17695
+ size
17696
+ ]);
17697
+ const tableRows = useDeepCompare.useDeepCompareMemo(()=>{
17698
+ let hasInvalidRows = false;
17699
+ const rows = validatedItems.map((item)=>{
17700
+ if (!item.valid) hasInvalidRows = true;
17701
+ if (core.isCohortItem(item)) {
17702
+ return {
17703
+ id: item.id,
17704
+ name: item.name,
17705
+ description: item.description,
17706
+ type: item.itemType,
17707
+ size: undefined,
17708
+ datasetName: item.name,
17709
+ datasetId: item.datasetId,
17710
+ valid: item.valid,
17711
+ messages: item?.errorMessages
17712
+ };
17713
+ }
17714
+ return {
17715
+ id: item.id,
17716
+ name: item.name,
17717
+ description: item.description,
17718
+ type: item.type,
17719
+ size: item.size,
17720
+ datasetId: item.datasetId,
17721
+ datasetName: item.datasetName,
17722
+ valid: item.valid,
17723
+ messages: item?.errorMessages
17724
+ };
17725
+ });
17726
+ return {
17727
+ rows,
17728
+ hasInvalidRows
17729
+ };
17730
+ }, [
17731
+ validatedItems
17732
+ ]);
17733
+ const table = mantineReactTable.useMantineReactTable({
17734
+ columns,
17735
+ data: tableRows.rows,
17736
+ enableColumnResizing: false,
17737
+ icons: TableIcons,
17738
+ enableTopToolbar: false,
17739
+ enableRowSelection: true,
17740
+ enableBottomToolbar: tableRows.rows.length > 10,
17741
+ enablePagination: tableRows.rows.length > 10,
17742
+ enableRowActions: false,
17743
+ enableStickyFooter: true,
17744
+ enableStickyHeader: true,
17745
+ enableHiding: true,
17746
+ onRowSelectionChange: handleRowSelectionChange,
17747
+ state: {
17748
+ rowSelection
17749
+ },
17750
+ initialState: {
17751
+ density: 'xs',
17752
+ columnPinning: {
17753
+ left: [
17754
+ 'mrt-row-select',
17755
+ 'mrt-row-expand'
17756
+ ],
17757
+ right: [
17758
+ 'mrt-row-actions'
17759
+ ]
17760
+ }
17761
+ },
17762
+ layoutMode: 'semantic',
17763
+ mantineDetailPanelProps: {
17764
+ style: {
17765
+ boxShadow: '0 -2px 0px 0px var(--table-border-color) inset'
17766
+ }
17767
+ },
17768
+ mantineTableProps: {
17769
+ style: {
17770
+ backgroundColor: 'var(--mantine-color-base-1)',
17771
+ '--mrt-striped-row-background-color': 'var(--mantine-color-base-3)'
17772
+ }
17773
+ },
17774
+ mantineTableHeadCellProps: {
17775
+ style: {
17776
+ backgroundColor: 'var(--mantine-color-table-1)',
17777
+ color: 'var(--mantine-color-table-contrast-1)',
17778
+ textAlign: 'center',
17779
+ padding: '0.25rem 0.5rem 0.25rem 0.5rem',
17780
+ fontWeight: 600,
17781
+ fontSize: `var(--mantine-font-size-${size})`
17782
+ }
17783
+ }
17784
+ });
17785
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
17786
+ className: "flex flex-col ml-8",
17787
+ children: [
17788
+ /*#__PURE__*/ jsxRuntime.jsx(SelectedItemsTableHeader, {
17789
+ numberOfItems: Object.keys(rowSelection).length,
17790
+ numberOfWarnings: tableRows.rows.filter((x)=>x.valid === false).length,
17791
+ size: size
17792
+ }),
17793
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
17794
+ className: "mt-2",
17795
+ children: /*#__PURE__*/ jsxRuntime.jsx(mantineReactTable.MantineReactTable, {
17796
+ table: table
17797
+ })
17798
+ })
17799
+ ]
17800
+ });
17801
+ };
17802
+
17803
+ const isArrayField = (value)=>Array.isArray(value);
17804
+ const isNumeric = (value)=>typeof value === 'number' && !isNaN(value);
17805
+ const evaluateItemRule = (rule, item)=>{
17806
+ switch(rule.operator){
17807
+ case 'equals':
17808
+ case 'not':
17809
+ {
17810
+ const fieldValue = item[rule.field];
17811
+ return rule.operator === 'equals' ? fieldValue === rule.value : fieldValue !== rule.value;
17812
+ }
17813
+ case 'includes':
17814
+ case 'excludes':
17815
+ {
17816
+ const fieldValue = item[rule.field];
17817
+ if (!isArrayField(fieldValue)) return false;
17818
+ return rule.operator === 'includes' ? fieldValue.includes(rule.value) : !fieldValue.includes(rule.value);
17819
+ }
17820
+ case 'greater':
17821
+ case 'less':
17822
+ {
17823
+ const fieldValue = item[rule.field];
17824
+ if (isNumeric(fieldValue) && isNumeric(rule.value)) return rule.operator === 'greater' ? fieldValue > rule.value : fieldValue < rule.value;
17825
+ return false;
17826
+ }
17827
+ default:
17828
+ return false;
17829
+ }
17830
+ };
17831
+ const evaluateGroupRule = (rule, items)=>{
17832
+ switch(rule.operator){
17833
+ case 'count':
17834
+ {
17835
+ const fieldValue = items.map((item)=>item[rule.field]);
17836
+ return fieldValue.length === rule.total;
17837
+ }
17838
+ }
17839
+ };
17840
+ /**
17841
+ * Retrieves an action configuration from a set of actions by its unique identifier.
17842
+ *
17843
+ * @param {ActionsConfig} actions - An array of action configurations.
17844
+ * @param {string} id - The unique identifier of the desired action configuration.
17845
+ * @returns {DataLibraryActionConfig | undefined} The action configuration with the matching identifier, or undefined if not found.
17846
+ */ const getActionById = (actions, id)=>{
17847
+ if (!id) return undefined;
17848
+ return actions.find((action)=>action.id === id);
17849
+ };
17850
+ const doesItemFailRule = (item, action)=>{
17851
+ return action?.itemRules?.reduce((acc, rule)=>{
17852
+ if (!evaluateItemRule(rule, item)) {
17853
+ acc.push(rule.errorMessage);
17854
+ }
17855
+ return acc;
17856
+ }, []) ?? [];
17857
+ };
17858
+ const doesGroupFailRule = (items, action)=>{
17859
+ return action?.groupRules?.reduce((acc, rule)=>{
17860
+ if (!evaluateGroupRule(rule, items)) {
17861
+ acc.push(rule.errorMessage);
17862
+ }
17863
+ return acc;
17864
+ }, []) ?? [];
17865
+ };
17866
+
17867
+ const PRESIGNED_URL_TEMPLATE_VARIABLE = '{{PRESIGNED_URL}}';
17868
+ const isSendExistingPFBToURLParameters = (value)=>{
17869
+ if (!value || typeof value !== 'object') {
17870
+ return false;
17871
+ }
17872
+ const candidate = value;
17873
+ return 'targetURLTemplate' in candidate && typeof candidate.targetURLTemplate === 'string';
17874
+ };
17875
+ const sendExistingPFBToURL = async (validatedSelections, params, done = ()=>null, error = ()=>null, onAbort = ()=>null, signal = undefined)=>{
17876
+ if (!isSendExistingPFBToURLParameters(params)) {
17877
+ console.error('Invalid parameters for sendPFBToURL action:', params);
17878
+ return;
17879
+ }
17880
+ const { targetURLTemplate } = params;
17881
+ // get the selection
17882
+ if (validatedSelections.length !== 1 || !core.isFileItem(validatedSelections[0])) {
17883
+ notifications.notifications.show({
17884
+ id: 'data-library-send-existing-pfb-to-url-validate-length',
17885
+ position: 'bottom-center',
17886
+ withCloseButton: true,
17887
+ autoClose: 5000,
17888
+ title: 'Action Error',
17889
+ message: 'Invalid data passed to send PFB to URL',
17890
+ color: 'red',
17891
+ loading: false
17892
+ });
17893
+ return;
17894
+ }
17895
+ const { guid } = validatedSelections[0];
17896
+ // get the pre-signed URL for the selected PFB
17897
+ try {
17898
+ const presignedURL = await core.fetchFencePresignedURL({
17899
+ guid: guid,
17900
+ onAbort: onAbort,
17901
+ signal: signal
17902
+ });
17903
+ // the PFB export target URL is a template URL that should have a {{PRESIGNED_URL}} template
17904
+ // variable in it.
17905
+ const signedURL = encodeURIComponent(presignedURL);
17906
+ const targetURL = targetURLTemplate.replace(PRESIGNED_URL_TEMPLATE_VARIABLE, signedURL);
17907
+ return new Promise(()=>{
17908
+ if (window) window.open(targetURL, '_blank', 'noopener,noreferrer');
17909
+ if (done) done(targetURL);
17910
+ });
17911
+ } catch (e) {
17912
+ return new Promise(()=>{
17913
+ error(e);
17914
+ });
17915
+ }
17916
+ };
17917
+
17918
+ const registeredDataLibraryActions = {};
17919
+ const NullAction = ()=>{
17920
+ return new Promise((done)=>{
17921
+ if (done) done();
17922
+ });
17923
+ };
17924
+ const registerAction = (actionName, action)=>{
17925
+ registeredDataLibraryActions[actionName] = action;
17926
+ };
17927
+ const findAction = (actionName)=>{
17928
+ if (actionName === undefined) {
17929
+ console.error('DataLibrary: findAction: no name provided');
17930
+ return undefined;
17931
+ }
17932
+ if (!(actionName in registeredDataLibraryActions)) {
17933
+ console.error('getButtonAction: no action found for', actionName);
17934
+ return undefined;
17935
+ }
17936
+ return registeredDataLibraryActions[actionName];
17937
+ };
17938
+ const registerDefaultDataLibraryActions = ()=>{
17939
+ registerAction('export-pfb-to-url', {
17940
+ action: sendExistingPFBToURL
17941
+ });
17942
+ };
17943
+ registerDefaultDataLibraryActions();
17944
+
17945
+ const ModalHeader = ()=>{
17946
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
17947
+ className: "flex justify-between items-center",
17948
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
17949
+ fw: 600,
17950
+ className: "text-heading",
17951
+ children: "Retrieve Data"
17952
+ })
17953
+ });
17954
+ };
17955
+ const bindAction = (action)=>{
17956
+ const actionFunction = findAction(action.actionFunction);
17957
+ if (!actionFunction) {
17958
+ return NullAction;
17959
+ }
17960
+ return actionFunction.action;
17961
+ };
17962
+ const SelectedItemsModal = (props)=>{
17963
+ const [value, setValue] = React.useState(null);
17964
+ const { actions } = props;
17965
+ const { gatheredItems } = useDataLibrarySelection();
17966
+ const [rowSelection, setRowSelection] = React.useState({});
17967
+ const [actionFunction, setActionFunction] = React.useState({
17968
+ action: NullAction
17969
+ });
17970
+ const [actionConfig, setActionConfig] = React.useState(null);
17971
+ const [isRunning, setIsRunning] = React.useState(false);
17972
+ const destinations = React.useMemo(()=>{
17973
+ return actions.map((action)=>{
17974
+ return {
17975
+ label: action.label,
17976
+ value: action.id
17977
+ };
17978
+ });
17979
+ }, [
17980
+ actions
17981
+ ]);
17982
+ const onError = (error)=>{
17983
+ setIsRunning(false);
17984
+ if (error instanceof core.HTTPError) {
17985
+ notifications.notifications.show({
17986
+ id: 'data-library-selection-action-error',
17987
+ position: 'bottom-center',
17988
+ withCloseButton: true,
17989
+ autoClose: 5000,
17990
+ title: 'Action Error',
17991
+ message: HTTPUserFriendlyErrorMessages[error.status],
17992
+ color: 'red',
17993
+ icon: /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
17994
+ icon: "gen3:outline-error"
17995
+ }),
17996
+ loading: false
17997
+ });
17998
+ }
17999
+ };
18000
+ const onDone = (arg)=>{
18001
+ setIsRunning(false);
18002
+ notifications.notifications.show({
18003
+ id: 'data-library-selection-action-done',
18004
+ position: 'bottom-center',
18005
+ withCloseButton: true,
18006
+ autoClose: 5000,
18007
+ title: 'Submission Complete',
18008
+ message: actionConfig ? `${actionConfig.label} completed successfully` : 'Completed successfully',
18009
+ loading: false
18010
+ });
18011
+ };
18012
+ const setSelectionAction = React.useCallback((actionId)=>{
18013
+ const actionConfig = getActionById(actions, actionId);
18014
+ if (actionConfig) {
18015
+ setActionConfig(actionConfig);
18016
+ const action = bindAction(actionConfig);
18017
+ if (action) setActionFunction({
18018
+ action: action,
18019
+ parameters: actionConfig.parameters
18020
+ });
18021
+ return;
18022
+ }
18023
+ setActionFunction({
18024
+ action: NullAction
18025
+ });
18026
+ }, [
18027
+ actions
18028
+ ]);
18029
+ const validatedLibrarySelections = useDeepCompare.useDeepCompareMemo(()=>{
18030
+ // get the action
18031
+ const action = getActionById(actions, value?.value);
18032
+ // if there are no actions then everything is valid
18033
+ if (!action) return gatheredItems.map((item)=>{
18034
+ return {
18035
+ ...item,
18036
+ valid: undefined
18037
+ };
18038
+ });
18039
+ // get all selected items
18040
+ const selectedActionItems = gatheredItems.filter((_, index)=>Object.hasOwn(rowSelection, index));
18041
+ // apply group rules of action if any fail then add error message and set flag
18042
+ const groupFailsRule = doesGroupFailRule(selectedActionItems, action);
18043
+ const validItems = gatheredItems.map((item, index)=>{
18044
+ if (rowSelection[index]) {
18045
+ // if selected then validate item rules
18046
+ const itemFailsRule = doesItemFailRule(item, action);
18047
+ const itemAndGroupTestMessages = [
18048
+ ...itemFailsRule,
18049
+ ...groupFailsRule
18050
+ ];
18051
+ if (itemAndGroupTestMessages.length > 0) return {
18052
+ ...item,
18053
+ valid: false,
18054
+ errorMessages: itemAndGroupTestMessages
18055
+ };
18056
+ // defaults return true
18057
+ return {
18058
+ ...item,
18059
+ valid: true
18060
+ };
18061
+ } else return {
18062
+ ...item,
18063
+ valid: undefined
18064
+ };
18065
+ });
18066
+ return validItems;
18067
+ }, [
18068
+ gatheredItems,
18069
+ rowSelection,
18070
+ actions,
18071
+ value
18072
+ ]);
18073
+ const actionButtonDisabled = actionFunction.action === NullAction || validatedLibrarySelections.length === 0 || validatedLibrarySelections.some((x)=>x.valid === false);
18074
+ return /*#__PURE__*/ jsxRuntime.jsx(core$1.Modal, {
18075
+ ...props,
18076
+ closeOnEscape: true,
18077
+ centered: true,
18078
+ withinPortal: false,
18079
+ title: /*#__PURE__*/ jsxRuntime.jsx(ModalHeader, {}),
18080
+ classNames: {
18081
+ header: 'm-0 p-2 min-h-10 bg-primary-lightest',
18082
+ content: 'scroll-smooth'
18083
+ },
18084
+ overlayProps: {
18085
+ opacity: 0.5
18086
+ },
18087
+ children: /*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
18088
+ children: [
18089
+ /*#__PURE__*/ jsxRuntime.jsx(SelectedItemsTable, {
18090
+ validatedItems: validatedLibrarySelections,
18091
+ rowSelection: rowSelection,
18092
+ setRowSelection: setRowSelection
18093
+ }),
18094
+ /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
18095
+ justify: "space-between",
18096
+ children: [
18097
+ /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
18098
+ children: [
18099
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
18100
+ fw: 600,
18101
+ children: "Destination:"
18102
+ }),
18103
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Select, {
18104
+ data: destinations,
18105
+ value: value ? value.value : null,
18106
+ onChange: (value, option)=>{
18107
+ setValue(option);
18108
+ if (value) setSelectionAction(value);
18109
+ else setActionFunction({
18110
+ action: NullAction
18111
+ });
18112
+ }
18113
+ })
18114
+ ]
18115
+ }),
18116
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Button, {
18117
+ loading: isRunning,
18118
+ rightSection: actionConfig?.rightIcon ? /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
18119
+ icon: actionConfig?.rightIcon
18120
+ }) : undefined,
18121
+ disabled: actionButtonDisabled,
18122
+ onClick: async ()=>{
18123
+ setIsRunning(true);
18124
+ await actionFunction.action(validatedLibrarySelections, actionFunction.parameters, onDone, onError);
18125
+ },
18126
+ children: actionConfig ? actionConfig.buttonLabel : 'Submit'
18127
+ })
18128
+ ]
18129
+ })
18130
+ ]
18131
+ })
18132
+ });
18133
+ };
18134
+
18135
+ /**
18136
+ * Extracts and consolidates GUIDs and IDs from dataset contents into a single object.
18137
+ *
18138
+ * @param {DatasetContents} dataset - The dataset containing files and queries to extract IDs from.
18139
+ * @returns {SelectedMembers} An object where each key is a unique identifier from the dataset,
18140
+ * with a boolean value set to true.
18141
+ */ const getObjectIds = (dataset)=>{
18142
+ return [
18143
+ ...dataset.files.map((file)=>file.id),
18144
+ ...dataset.queries.map((query)=>query.id)
18145
+ ].reduce((acc, key)=>{
18146
+ acc[key] = true;
18147
+ return acc;
18148
+ }, {});
18149
+ };
18150
+ /**
18151
+ * Function that generates a mapping of dataset IDs to their respective member objects.
18152
+ *
18153
+ * @param {Array<string>} datasetIds - Array of dataset IDs to be processed.
18154
+ * @param {DatalistMembers} datasetContents - Object containing details about dataset members.
18155
+ * @returns {ListMembers} - An object mapping each dataset ID to its respective member objects.
18156
+ */ const selectAllDatasetMembers = (datasetIds, datasetContents)=>{
18157
+ return datasetIds.reduce((acc, datasetId)=>{
18158
+ acc[datasetId] = {
18159
+ id: datasetId,
18160
+ objectIds: getObjectIds(datasetContents[datasetId])
18161
+ };
18162
+ return acc;
18163
+ }, {});
18164
+ };
18165
+ /**
18166
+ * Retrieves the members of a given dataset or cohort.
18167
+ *
18168
+ * This function takes either a dataset or a cohort item and returns an
18169
+ * object representing the selected members. In the case of a cohort item,
18170
+ * it returns an object with the cohort's ID set to true. For a dataset,
18171
+ * it iterates through the dataset items and sets the keys of file items
18172
+ * to true in the returned object.
18173
+ *
18174
+ * @param {RegisteredDataListEntry | CohortItem} dataSetOrCohort - The dataset or cohort item to process.
18175
+ * @returns {SelectedMembers} An object representing the selected members.
18176
+ */ const getDatasetMembers = (dataSetOrCohort)=>{
18177
+ if (core.isCohortItem(dataSetOrCohort)) {
18178
+ return {
18179
+ [dataSetOrCohort.id]: true
18180
+ };
18181
+ }
18182
+ return Object.entries(dataSetOrCohort.items).reduce((acc, [key, item])=>{
18183
+ if (core.isFileItem(item)) acc[key] = true;
18184
+ return acc;
18185
+ }, {});
18186
+ };
18187
+ /**
18188
+ * Selects all list items from the provided data list and transforms them into a ListMembers structure.
18189
+ *
18190
+ * @param {Datalist} members - The data list containing items to be transformed.
18191
+ * @return {ListMembers} - Transformed structure containing the selected list items with dataset IDs and their corresponding object IDs.
18192
+ */ const selectAllListItems = (members)=>{
18193
+ return Object.entries(members.items).reduce((acc, [datasetId, datasetContents])=>{
18194
+ if (core.isCohortItem(datasetContents)) {
18195
+ acc[datasetId] = {
18196
+ id: datasetId,
18197
+ objectIds: {
18198
+ [datasetId]: true
18199
+ }
18200
+ };
18201
+ } else acc[datasetId] = {
18202
+ id: datasetId,
18203
+ objectIds: getDatasetMembers(datasetContents)
18204
+ };
18205
+ return acc;
18206
+ }, {});
18207
+ };
18208
+
18209
+ const EmptyList = ()=>{
18210
+ return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
18211
+ gap: "xs",
18212
+ classNames: {
18213
+ root: 'w-100'
18214
+ },
18215
+ children: [
18216
+ /*#__PURE__*/ jsxRuntime.jsx("span", {
18217
+ className: "text-utility-warning",
18218
+ children: /*#__PURE__*/ jsxRuntime.jsx(io.IoMdInformationCircleOutline, {
18219
+ size: "1.5rem"
18220
+ })
18221
+ }),
18222
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
18223
+ fw: 600,
18224
+ children: "list is empty"
18225
+ })
18226
+ ]
18227
+ });
18228
+ };
18229
+
18230
+ /**
18231
+ * Formats a given date string into a specific format.
18232
+ *
18233
+ * @param {string} datestr - The date string to be formatted.
18234
+ * @returns {string} The formatted date string.
18235
+ * @throws {Error} Throws an error if the provided date string is invalid or the format is incorrect.
18236
+ *
18237
+ * The function parses the provided date string into a timestamp.
18238
+ */ const formatDate = (datestr)=>{
18239
+ const timestamp = Date.parse(datestr);
18240
+ if (isNaN(timestamp)) {
18241
+ throw new Error('Invalid date string');
18242
+ }
18243
+ const date = new Date(timestamp);
18244
+ const parts = new Intl.DateTimeFormat('en-US', {
18245
+ month: 'short',
18246
+ day: 'numeric',
18247
+ year: 'numeric',
18248
+ hour: '2-digit',
18249
+ minute: '2-digit',
18250
+ second: '2-digit',
18251
+ hour12: false,
18252
+ timeZone: 'UTC'
18253
+ }).formatToParts(date).filter((p)=>p.type !== 'literal') // Filter out literal types like spaces and commas
18254
+ .map((p)=>p.value);
18255
+ if (parts.length !== 6) throw new Error('format date wrong length');
18256
+ const day = parts.slice(0, 3).join('-');
18257
+ const time = parts.slice(3).join(':');
18258
+ return `${day} ${time}`;
18259
+ };
18260
+
18261
+ const DatasetAccordionControl = ({ listName, numberOfItems, updatedTime, createdTime, updateHandler, deleteListHandler, selectListHandler, selectedState, size = 'sm', ...props })=>{
18262
+ const [value, setValue] = React.useState(undefined);
18263
+ const handleUpdateName = ()=>{
18264
+ updateHandler({
18265
+ name: value
18266
+ });
18267
+ setValue(undefined);
18268
+ };
18269
+ const theme = core$1.useMantineTheme();
18270
+ const iconSize = IconSize[size] || IconSize['sm'];
18271
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
18272
+ className: "flex justify-start w-full items-center px-4 group-data-[active]:bg-secondary-lightest",
18273
+ children: [
18274
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
18275
+ className: "flex items-center w-1/4",
18276
+ children: [
18277
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Checkbox, {
18278
+ size: size,
18279
+ onChange: (event)=>{
18280
+ selectListHandler(event.currentTarget.checked);
18281
+ event.stopPropagation();
18282
+ },
18283
+ checked: selectedState == 'checked',
18284
+ indeterminate: selectedState == 'indeterminate'
18285
+ }),
18286
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Accordion.Control, {
18287
+ ...props,
18288
+ className: "w-4 mr-3"
18289
+ }),
18290
+ value ? /*#__PURE__*/ jsxRuntime.jsx(core$1.TextInput, {
18291
+ size: size,
18292
+ classNames: {
18293
+ root: 'ml-2',
18294
+ input: 'font-bold'
18295
+ },
18296
+ value: value,
18297
+ onChange: (e)=>setValue(e.target.value),
18298
+ onKeyDown: hooks.getHotkeyHandler([
18299
+ [
18300
+ 'Enter',
18301
+ handleUpdateName
18302
+ ]
18303
+ ]),
18304
+ rightSection: /*#__PURE__*/ jsxRuntime.jsx(core$1.CloseButton, {
18305
+ "aria-label": "Clear input",
18306
+ onClick: ()=>setValue(undefined),
18307
+ style: {
18308
+ display: value ? undefined : 'none'
18309
+ }
18310
+ })
18311
+ }) : /*#__PURE__*/ jsxRuntime.jsxs("div", {
18312
+ className: "flex items-center justify-end",
18313
+ children: [
18314
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
18315
+ fw: 600,
18316
+ className: "ml-2 w-100 py-2 mr-2",
18317
+ "aria-label": listName,
18318
+ size: size,
18319
+ children: listName
18320
+ }),
18321
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
18322
+ label: "Change name of list",
18323
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.ActionIcon, {
18324
+ color: "accent.4",
18325
+ variant: "transparent",
18326
+ "aria-label": "Change datalist name",
18327
+ onClick: ()=>setValue(listName),
18328
+ children: /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
18329
+ icon: "gen3:edit",
18330
+ height: iconSize,
18331
+ width: iconSize,
18332
+ color: theme.colors.accent[4]
18333
+ })
18334
+ })
18335
+ })
18336
+ ]
18337
+ })
18338
+ ]
18339
+ }),
18340
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
18341
+ className: "flex items-center ml-auto space-x-2",
18342
+ children: [
18343
+ numberOfItems === 0 && /*#__PURE__*/ jsxRuntime.jsx(EmptyList, {}),
18344
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
18345
+ className: "flex items-center space-x-2",
18346
+ children: [
18347
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
18348
+ fw: 600,
18349
+ c: "base-contrast.2",
18350
+ tt: "uppercase",
18351
+ size: size,
18352
+ children: "Created:"
18353
+ }),
18354
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
18355
+ fw: 500,
18356
+ c: "base-contrast.2",
18357
+ size: size,
18358
+ children: formatDate(createdTime)
18359
+ }),
18360
+ /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
18361
+ icon: "gen3:dot",
18362
+ height: iconSize,
18363
+ width: iconSize,
18364
+ color: theme.colors.accent[4]
18365
+ }),
18366
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
18367
+ fw: 600,
18368
+ c: "base-contrast.2",
18369
+ tt: "uppercase",
18370
+ size: size,
18371
+ children: "Updated:"
18372
+ }),
18373
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
18374
+ fw: 500,
18375
+ c: "base-contrast.2",
18376
+ size: size,
18377
+ children: formatDate(updatedTime)
18378
+ })
18379
+ ]
18380
+ }),
18381
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
18382
+ label: `Delete ${listName}. Will not delete dataset`,
18383
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.ActionIcon, {
18384
+ color: "accent.4",
18385
+ variant: "transparent",
18386
+ "aria-label": "delete list",
18387
+ onClick: ()=>deleteListHandler(),
18388
+ children: /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
18389
+ icon: "gen3:delete",
18390
+ height: iconSize,
18391
+ width: iconSize,
18392
+ color: theme.colors.primary[5]
18393
+ })
18394
+ })
18395
+ })
18396
+ ]
18397
+ })
18398
+ ]
18399
+ });
18400
+ };
18401
+
18402
+ const commonTableSettings = (size = 'sm')=>{
18403
+ return {
18404
+ enableColumnResizing: false,
18405
+ icons: TableIcons,
18406
+ enableTopToolbar: false,
18407
+ enableColumnFilters: false,
18408
+ enableColumnActions: false,
18409
+ enableRowActions: true,
18410
+ enableColumnOrdering: false,
18411
+ enableFacetedValues: true,
18412
+ enableGrouping: false,
18413
+ enableColumnPinning: false,
18414
+ enableRowSelection: true,
18415
+ enablePagination: false,
18416
+ enableSelectAll: false,
18417
+ enableExpandAll: false,
18418
+ displayColumnDefOptions: {
18419
+ 'mrt-row-select': {
18420
+ size: 5,
18421
+ header: ''
18422
+ },
18423
+ 'mrt-row-expand': {
18424
+ size: 5,
18425
+ header: ''
18426
+ },
18427
+ 'mrt-row-actions': {
18428
+ header: ''
18429
+ }
18430
+ },
18431
+ initialState: {
18432
+ density: 'xs',
18433
+ columnPinning: {
18434
+ left: [
18435
+ 'mrt-row-select',
18436
+ 'mrt-row-expand'
18437
+ ],
18438
+ right: [
18439
+ 'mrt-row-actions'
18440
+ ]
18441
+ }
18442
+ },
18443
+ layoutMode: 'semantic',
18444
+ mantineDetailPanelProps: {
18445
+ style: {
18446
+ boxShadow: '0 -2px 0px 0px var(--table-border-color) inset'
18447
+ }
18448
+ },
18449
+ mantineTableProps: {
18450
+ style: {
18451
+ backgroundColor: 'var(--mantine-color-base-1)',
18452
+ '--mrt-striped-row-background-color': 'var(--mantine-color-base-3)',
18453
+ fontSize: `var(--mantine-font-size-${size})`
18454
+ }
18455
+ },
18456
+ mantineTableHeadCellProps: {
18457
+ style: {
18458
+ backgroundColor: 'var(--mantine-color-table-1)',
18459
+ color: 'var(--mantine-color-table-contrast-1)',
18460
+ textAlign: 'center',
18461
+ fontWeight: 600,
18462
+ fontSize: `var(--mantine-font-size-${size})`,
18463
+ textTransform: 'uppercase'
18464
+ }
18465
+ }
18466
+ };
18467
+ };
18468
+
18469
+ const columns$2 = [
18470
+ {
18471
+ accessorKey: 'name',
18472
+ header: 'Name'
18473
+ },
18474
+ {
18475
+ accessorKey: 'description',
18476
+ header: 'Description'
18477
+ },
18478
+ {
18479
+ accessorKey: 'documentation',
18480
+ header: 'Documentation'
18481
+ }
18482
+ ];
18483
+ const AdditionalDataTableTable = ({ data, header, size = 'sm' })=>{
18484
+ const table = mantineReactTable.useMantineReactTable({
18485
+ columns: columns$2,
18486
+ data: data,
18487
+ ...commonTableSettings(size),
18488
+ enableRowActions: false,
18489
+ enableRowSelection: false,
18490
+ enableBottomToolbar: data.length > 10,
18491
+ enablePagination: data.length > 10
18492
+ });
18493
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
18494
+ className: "flex flex-col w-inherit gap-y-1",
18495
+ children: [
18496
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
18497
+ fw: 600,
18498
+ fs: "md",
18499
+ c: "secondary.5",
18500
+ tt: "uppercase",
18501
+ children: header
18502
+ }),
18503
+ /*#__PURE__*/ jsxRuntime.jsx(mantineReactTable.MantineReactTable, {
18504
+ table: table
18505
+ })
18506
+ ]
18507
+ });
18508
+ };
18509
+
18510
+ const columns$1 = [
18511
+ {
18512
+ accessorKey: 'name',
18513
+ header: 'Name'
18514
+ },
18515
+ {
18516
+ accessorKey: 'description',
18517
+ header: 'Description'
18518
+ },
18519
+ {
18520
+ accessorKey: 'type',
18521
+ header: 'Type'
18522
+ },
18523
+ {
18524
+ accessorKey: 'size',
18525
+ header: 'Size'
18526
+ }
18527
+ ];
18528
+ const FilesTable = ({ listId, datasetId, data, header, size = 'sm' })=>{
18529
+ const [rowSelection, setRowSelection] = React.useState({});
18530
+ const { selections, updateListMemberSelections } = useDataLibrarySelection();
18531
+ React.useEffect(()=>{
18532
+ const sel = selections?.[listId]?.[datasetId]?.objectIds ?? {};
18533
+ setRowSelection(sel);
18534
+ }, [
18535
+ listId,
18536
+ datasetId,
18537
+ selections
18538
+ ]);
18539
+ const handleRowSelectionChange = (updater)=>{
18540
+ let value = {};
18541
+ setRowSelection((prevSelection)=>{
18542
+ value = updater instanceof Function ? updater(prevSelection) : updater;
18543
+ return value;
18544
+ });
18545
+ updateListMemberSelections(listId, datasetId, value);
18546
+ };
18547
+ const table = mantineReactTable.useMantineReactTable({
18548
+ columns: columns$1,
18549
+ data: data,
18550
+ ...commonTableSettings(size),
18551
+ enableBottomToolbar: data.length > 10,
18552
+ enablePagination: data.length > 10,
18553
+ enableRowActions: true,
18554
+ enableHiding: true,
18555
+ getRowId: (originalRow)=>originalRow.id,
18556
+ onRowSelectionChange: handleRowSelectionChange,
18557
+ state: {
18558
+ rowSelection
18559
+ }
18560
+ });
18561
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
18562
+ className: "flex flex-col gap-y-1",
18563
+ children: [
18564
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
18565
+ fw: 600,
18566
+ fs: size,
18567
+ c: "secondary.5",
18568
+ tt: "uppercase",
18569
+ children: header
18570
+ }),
18571
+ /*#__PURE__*/ jsxRuntime.jsx(mantineReactTable.MantineReactTable, {
18572
+ table: table
18573
+ })
18574
+ ]
18575
+ });
18576
+ };
18577
+
18578
+ const LabeledText = ({ label, text })=>{
18579
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
18580
+ className: "flex p-1 space-x-2",
18581
+ children: [
18582
+ /*#__PURE__*/ jsxRuntime.jsxs(core$1.Text, {
18583
+ fw: 600,
18584
+ children: [
18585
+ label,
18586
+ ":"
18587
+ ]
18588
+ }),
18589
+ /*#__PURE__*/ jsxRuntime.jsxs(core$1.Text, {
18590
+ fw: 400,
18591
+ children: [
18592
+ " ",
18593
+ text
18594
+ ]
18595
+ })
18596
+ ]
18597
+ });
18598
+ };
18599
+ const QueryDetails = ({ name, schemaVersion, index, data, id })=>{
18600
+ if (!data) {
18601
+ return /*#__PURE__*/ jsxRuntime.jsx(ErrorCard, {
18602
+ message: "No cohort query"
18603
+ });
18604
+ }
18605
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
18606
+ className: "flex flex-col",
18607
+ children: [
18608
+ /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
18609
+ classNames: {
18610
+ root: 'p-2 bg-base-lighter rounded-t-lg border-2 border-b-0 border-base-light'
18611
+ },
18612
+ children: [
18613
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
18614
+ fw: 700,
18615
+ children: name
18616
+ }),
18617
+ /*#__PURE__*/ jsxRuntime.jsx(LabeledText, {
18618
+ label: "Index:",
18619
+ text: index
18620
+ }),
18621
+ /*#__PURE__*/ jsxRuntime.jsx(LabeledText, {
18622
+ label: "Schema Version:",
18623
+ text: schemaVersion
18624
+ }),
18625
+ /*#__PURE__*/ jsxRuntime.jsx(LabeledText, {
18626
+ label: "ID:",
18627
+ text: id
18628
+ })
18629
+ ]
18630
+ }),
18631
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
18632
+ className: "p-2 overflow-scroll w-full bg-base-lighter rounded-b-lg border-2 border-t-0 border-base-light",
18633
+ children: core.isFilterSet(data) ? /*#__PURE__*/ jsxRuntime.jsx(QueryExpressionSection, {
18634
+ currentCohortId: id,
18635
+ index: index,
18636
+ currentCohortName: name,
18637
+ filters: data,
18638
+ displayOnly: true,
18639
+ showTitle: false
18640
+ }) : /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
18641
+ fw: 400,
18642
+ children: JSON.stringify(data, null, 2)
18643
+ })
18644
+ })
18645
+ ]
18646
+ });
18647
+ };
18648
+
18649
+ /**
18650
+ * Component that manages a List items, which are composed of Dataset and/or Cohorts
18651
+ */ const columns = [
18652
+ {
18653
+ accessorKey: 'name',
18654
+ header: 'Name'
18655
+ },
18656
+ {
18657
+ accessorKey: 'id',
18658
+ header: 'Id'
18659
+ },
18660
+ {
18661
+ accessorKey: 'numFiles',
18662
+ header: '# Files'
18663
+ },
18664
+ {
18665
+ accessorKey: 'isAddDataSource',
18666
+ header: 'Additional Data Sources'
18667
+ }
18668
+ ];
18669
+ const DataSetContentsTable = ({ listId, data, removeList, size = 'sm' })=>{
18670
+ const [rowSelection, setRowSelection] = React.useState({});
18671
+ const { selections, updateSelections } = useDataLibrarySelection();
18672
+ // build the rows
18673
+ const rows = useDeepCompare.useDeepCompareMemo(()=>Object.keys(data).map((key)=>{
18674
+ return {
18675
+ name: data[key].name,
18676
+ id: data[key].id,
18677
+ numFiles: data[key]?.files.length || 0,
18678
+ numItems: (data[key]?.files.length || 0) + (data[key]?.queries.length || 0),
18679
+ isAddDataSource: data[key]?.additionalData.length !== 0 ? 'True' : 'False',
18680
+ isCohort: data[key]?.queries.length !== 0 ? 'True' : 'False'
18681
+ };
18682
+ }), [
18683
+ data
18684
+ ]);
18685
+ /**
18686
+ * Handles the change in row selection.
18687
+ *
18688
+ * @param {MRT_Updater<MRT_RowSelectionState>} updater - A function or value
18689
+ * that provides the new state of row selection. If a function is provided,
18690
+ * it will be called with the previous selection state.
18691
+ *
18692
+ * This function updates the state of selected rows by transforming the
18693
+ * updater's value. It generates a mapping of selected members for each
18694
+ * dataset, containing the dataset ID and an object representing the selected
18695
+ * object IDs. It then updates the selections for a given list and filters
18696
+ * the values to indicate whether each dataset has any selected objects.
18697
+ */ const handleRowSelectionChange = (updater)=>{
18698
+ setRowSelection((prevSelection)=>{
18699
+ const value = updater instanceof Function ? updater(prevSelection) : updater;
18700
+ const members = selectAllDatasetMembers(Object.keys(value), data);
18701
+ updateSelections(listId, members);
18702
+ return Object.keys(members).reduce((acc, key)=>{
18703
+ acc[key] = Object.keys(members[key].objectIds).length > 0;
18704
+ return acc;
18705
+ }, {});
18706
+ });
18707
+ };
18708
+ useDeepCompare.useDeepCompareEffect(()=>{
18709
+ if (!selections[listId]) {
18710
+ // not found in selections, unselect all
18711
+ setRowSelection({});
18712
+ return;
18713
+ }
18714
+ const filteredValues = Object.keys(selections[listId]).reduce((acc, key)=>{
18715
+ const objectIds = selections[listId][key]?.objectIds;
18716
+ if (!objectIds) {
18717
+ console.warn(`Object IDs for key ${key} in list ${listId} are not available`);
18718
+ return acc;
18719
+ }
18720
+ acc[key] = Object.keys(objectIds).length > 0;
18721
+ return acc;
18722
+ }, {});
18723
+ setRowSelection(filteredValues);
18724
+ }, [
18725
+ setRowSelection,
18726
+ selections,
18727
+ listId
18728
+ ]);
18729
+ const table = mantineReactTable.useMantineReactTable({
18730
+ columns: columns,
18731
+ data: rows,
18732
+ ...commonTableSettings(size),
18733
+ getRowId: (originalRow)=>originalRow.id,
18734
+ onRowSelectionChange: handleRowSelectionChange,
18735
+ enableSelectAll: false,
18736
+ enableBottomToolbar: rows.length > 10,
18737
+ enablePagination: rows.length > 10,
18738
+ enableRowSelection: true,
18739
+ state: {
18740
+ rowSelection
18741
+ },
18742
+ renderEmptyRowsFallback: ()=>/*#__PURE__*/ jsxRuntime.jsx(EmptyList, {}),
18743
+ defaultColumn: {
18744
+ minSize: 2
18745
+ },
18746
+ displayColumnDefOptions: {
18747
+ 'mrt-row-select': {
18748
+ size: 5,
18749
+ maxSize: 5,
18750
+ header: ''
18751
+ },
18752
+ 'mrt-row-expand': {
18753
+ size: 5,
18754
+ maxSize: 5,
18755
+ header: ''
18756
+ },
18757
+ 'mrt-row-actions': {
18758
+ size: 10,
18759
+ header: ''
18760
+ }
18761
+ },
18762
+ mantineSelectCheckboxProps: ({ row })=>{
18763
+ const selectedCount = getNumberOfDataSetItemsSelected(selections, listId, row.id);
18764
+ const isIndeterminate = selectedCount > 0 && selectedCount != row.original.numItems;
18765
+ return {
18766
+ indeterminate: isIndeterminate,
18767
+ ...isIndeterminate ? {
18768
+ checked: false
18769
+ } : {}
18770
+ };
18771
+ },
18772
+ renderRowActions: ({ row })=>/*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
18773
+ label: row.original.isCohort ? 'Remove cohort from list' : 'Remove dataset from list',
18774
+ children: /*#__PURE__*/ jsxRuntime.jsxs(core$1.Button, {
18775
+ variant: "transparent",
18776
+ "aria-label": `remove ${row.original.isCohort ? 'cohort' : 'dataset'} ${row.original.name} from list`,
18777
+ onClick: ()=>{
18778
+ removeList(row.id);
18779
+ },
18780
+ children: [
18781
+ /*#__PURE__*/ jsxRuntime.jsx(md.MdOutlineRemoveCircle, {
18782
+ size: "1.5rem"
18783
+ }),
18784
+ row.original.itemType
18785
+ ]
18786
+ })
18787
+ }),
18788
+ mantineDetailPanelProps: {
18789
+ style: {
18790
+ padding: '0px',
18791
+ margin: '0px'
18792
+ }
18793
+ },
18794
+ renderDetailPanel: ({ row })=>{
18795
+ const rowData = data[row.id];
18796
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
18797
+ className: "flex flex-col w-full gap-y-4 pr-4",
18798
+ children: [
18799
+ rowData?.files.length > 0 && /*#__PURE__*/ jsxRuntime.jsx(FilesTable, {
18800
+ header: 'Files',
18801
+ datasetId: rowData.id,
18802
+ listId: listId,
18803
+ data: rowData?.files
18804
+ }),
18805
+ rowData.additionalData.length > 0 && /*#__PURE__*/ jsxRuntime.jsx(AdditionalDataTableTable, {
18806
+ header: 'Additional Data',
18807
+ data: rowData?.additionalData
18808
+ }),
18809
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Stack, {
18810
+ children: rowData?.queries.map((query)=>/*#__PURE__*/ React.createElement(QueryDetails, {
18811
+ header: "Queries",
18812
+ ...query,
18813
+ key: query.id
18814
+ }))
18815
+ })
18816
+ ]
18817
+ });
18818
+ }
18819
+ });
18820
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
18821
+ className: "flex flex-col w-full mr-8",
18822
+ children: /*#__PURE__*/ jsxRuntime.jsx(mantineReactTable.MantineReactTable, {
18823
+ table: table
18824
+ })
18825
+ });
18826
+ };
18827
+
18828
+ /**
18829
+ * Renders an accordion item with data list details.
18830
+ *
18831
+ * @param {Object} dataListAccordionItemParams - Parameters for the DataListAccordionItem.
18832
+ * @param {Object} dataListAccordionItemParams.dataList - The data list to be displayed in the accordion item.
18833
+ * @param {Function} dataListAccordionItemParams.updateListInDataLibrary - Function to update the list in the data library.
18834
+ * @param {Function} dataListAccordionItemParams.deleteListFromDataLibrary - Function to delete the list from the data library.
18835
+ *
18836
+ * @return {JSX.Element} A rendered accordion item component with controls for data list updates and deletions.
18837
+ */ const DatalistAccordionItem = ({ dataList, updateListInDataLibrary, deleteListFromDataLibrary, size = 'sm' })=>{
18838
+ const [selectedState, setSelectedState] = React.useState('unchecked');
18839
+ const { id: listId, name: listName } = dataList;
18840
+ const numberOfItemsInList = React.useMemo(()=>{
18841
+ return core.getNumberOfItemsInDatalist(dataList);
18842
+ }, [
18843
+ dataList
18844
+ ]);
18845
+ const { selections, updateSelections, removeListMember, removeList } = useDataLibrarySelection();
18846
+ const updateList = async (update)=>{
18847
+ await updateListInDataLibrary(listId, {
18848
+ ...dataList,
18849
+ ...update,
18850
+ updatedTime: core.getTimestamp()
18851
+ });
18852
+ };
18853
+ const tableRowData = React.useMemo(()=>Object.entries(dataList.items).reduce((acc, [datasetId, dataItem])=>{
18854
+ const [queries, files, additionalData] = [
18855
+ [],
18856
+ [],
18857
+ []
18858
+ ];
18859
+ if (core.isCohortItem(dataItem)) {
18860
+ queries.push({
18861
+ ...dataItem,
18862
+ description: '',
18863
+ index: dataItem.index,
18864
+ id: datasetId
18865
+ });
18866
+ } else {
18867
+ // handle RegisteredDataListEntry
18868
+ Object.entries(dataItem.items).forEach(([itemId, item])=>{
18869
+ if (core.isFileItem(item)) {
18870
+ files.push({
18871
+ ...item,
18872
+ id: itemId
18873
+ });
18874
+ } else if (core.isAdditionalDataItem(item)) {
18875
+ additionalData.push(item);
18876
+ } else {
18877
+ console.warn('DataLibrary: unknown item', item);
18878
+ }
18879
+ });
18880
+ }
18881
+ // return the
18882
+ acc[datasetId] = {
18883
+ id: datasetId,
18884
+ name: dataItem.name,
18885
+ queries: queries,
18886
+ files: files,
18887
+ additionalData: additionalData
18888
+ };
18889
+ return acc;
18890
+ }, {}), [
18891
+ dataList
18892
+ ]);
18893
+ React.useEffect(()=>{
18894
+ // list is not in selection
18895
+ if (!isListInSelection(listId, selections)) {
18896
+ setSelectedState('unchecked');
18897
+ return;
18898
+ }
18899
+ const numberOfSelectedItemsInList = getNumberOfSelectedItemsInList(selections, listId);
18900
+ // everything in the list is selected
18901
+ if (numberOfSelectedItemsInList == numberOfItemsInList) {
18902
+ setSelectedState('checked');
18903
+ return;
18904
+ }
18905
+ // list is not in selections
18906
+ if (numberOfSelectedItemsInList === 0) {
18907
+ setSelectedState('unchecked');
18908
+ return;
18909
+ }
18910
+ // some checked items
18911
+ if (numberOfSelectedItemsInList < numberOfItemsInList) setSelectedState('indeterminate');
18912
+ }, [
18913
+ listId,
18914
+ numberOfItemsInList,
18915
+ selections
18916
+ ]);
18917
+ const removeItemFromList = async (itemId)=>{
18918
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
18919
+ const { [itemId]: _removedKey, ...newObject } = dataList.items;
18920
+ await updateListInDataLibrary(listId, {
18921
+ ...dataList,
18922
+ items: newObject,
18923
+ updatedTime: core.getTimestamp()
18924
+ });
18925
+ // update selections
18926
+ removeListMember(listId, itemId);
18927
+ };
18928
+ const handleSelectList = (checked)=>{
18929
+ if (!checked) {
18930
+ removeList(listId);
18931
+ return;
18932
+ }
18933
+ const selectAllDatasets = selectAllListItems(dataList);
18934
+ updateSelections(listId, selectAllDatasets); // select all the datasets in the list
18935
+ };
18936
+ return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Accordion.Item, {
18937
+ value: listName,
18938
+ className: "group",
18939
+ children: [
18940
+ /*#__PURE__*/ jsxRuntime.jsx(DatasetAccordionControl, {
18941
+ listName: listName,
18942
+ numberOfItems: numberOfItemsInList,
18943
+ updatedTime: dataList.updatedTime,
18944
+ createdTime: dataList.createdTime,
18945
+ updateHandler: updateList,
18946
+ deleteListHandler: ()=>deleteListFromDataLibrary(listId),
18947
+ selectListHandler: handleSelectList,
18948
+ selectedState: selectedState,
18949
+ size: size
18950
+ }),
18951
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Accordion.Panel, {
18952
+ children: /*#__PURE__*/ jsxRuntime.jsx(DataSetContentsTable, {
18953
+ listId: listId,
18954
+ data: tableRowData,
18955
+ removeList: removeItemFromList,
18956
+ size: size
18957
+ })
18958
+ })
18959
+ ]
18960
+ }, listName);
18961
+ };
18962
+
18963
+ const DataLibraryLists = ({ useAPI, actions, size })=>{
18964
+ const { dataLibrary, isError, isLoading, error: dataLibraryError, addListToDataLibrary, updateListInDataLibrary, deleteListFromDataLibrary } = core.useDataLibrary(useAPI);
18965
+ const [selectedItemsOpen, { open, close }] = hooks.useDisclosure(false);
18966
+ const { gatherSelectedItems } = useDataLibrarySelection();
18967
+ const gatherData = ()=>{
18968
+ gatherSelectedItems(dataLibrary);
18969
+ open();
18970
+ };
18971
+ if (isError) {
18972
+ let message = 'There was a error getting the library';
18973
+ if (dataLibraryError && 'data' in dataLibraryError && dataLibraryError?.status in HTTPUserFriendlyErrorMessages) {
18974
+ message = HTTPUserFriendlyErrorMessages[dataLibraryError?.status];
18975
+ }
18976
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
18977
+ className: "flex flex-col w-full ml-2",
18978
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Center, {
18979
+ children: /*#__PURE__*/ jsxRuntime.jsx(ErrorCard, {
18980
+ message: message
18981
+ })
18982
+ })
18983
+ });
18984
+ }
18985
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
18986
+ className: "flex flex-col w-full ml-2",
18987
+ children: [
18988
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.LoadingOverlay, {
18989
+ visible: isLoading
18990
+ }),
18991
+ /*#__PURE__*/ jsxRuntime.jsx(SelectedItemsModal, {
18992
+ opened: selectedItemsOpen,
18993
+ onClose: close,
18994
+ size: "auto",
18995
+ actions: actions
18996
+ }),
18997
+ /*#__PURE__*/ jsxRuntime.jsx(SearchAndActions, {
18998
+ createList: addListToDataLibrary,
18999
+ gatherData: gatherData
19000
+ }),
19001
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
19002
+ className: "flex items-center",
19003
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Accordion, {
19004
+ chevronPosition: "left",
19005
+ classNames: {
19006
+ root: 'w-full',
19007
+ control: 'data-active:bg-secondary-lightest'
19008
+ },
19009
+ children: dataLibrary && Object.values(dataLibrary).map((datalist)=>{
19010
+ return /*#__PURE__*/ jsxRuntime.jsx(DatalistAccordionItem, {
19011
+ dataList: datalist,
19012
+ size: size,
19013
+ updateListInDataLibrary: updateListInDataLibrary,
19014
+ deleteListFromDataLibrary: deleteListFromDataLibrary
19015
+ }, datalist.id);
19016
+ })
19017
+ })
19018
+ })
19019
+ ]
19020
+ });
19021
+ };
19022
+
19023
+ const DataLibrary = (config)=>{
19024
+ return /*#__PURE__*/ jsxRuntime.jsx(DataLibrarySelectionProvider, {
19025
+ children: /*#__PURE__*/ jsxRuntime.jsx(DataLibraryLists, {
19026
+ ...config
19027
+ })
19028
+ });
19029
+ };
19030
+
19031
+ const DataLibraryPage = ({ headerProps, footerProps, config })=>{
19032
+ return /*#__PURE__*/ jsxRuntime.jsx(NavPageLayout, {
19033
+ headerProps,
19034
+ footerProps,
19035
+ headerData: {
19036
+ title: 'Gen3 DataLibrary Page',
19037
+ content: 'DataLibrary Data',
19038
+ key: 'gen3-data-library-page'
19039
+ },
19040
+ children: /*#__PURE__*/ jsxRuntime.jsx(DataLibrary, {
19041
+ ...config
19042
+ })
19043
+ });
19044
+ };
19045
+
19046
+ const DataLibraryPageGetServerSideProps = async ()=>{
19047
+ try {
19048
+ const datalibraryConfig = await ContentSource.get(`config/${core.GEN3_COMMONS_NAME}/dataLibrary.json`);
19049
+ return {
19050
+ props: {
19051
+ ...await getNavPageLayoutPropsFromConfig(),
19052
+ config: datalibraryConfig
19053
+ }
19054
+ };
19055
+ } catch (err) {
19056
+ console.error(err);
19057
+ return {
19058
+ props: {
19059
+ ...await getNavPageLayoutPropsFromConfig(),
19060
+ config: {
19061
+ useAPI: false,
19062
+ actions: []
19063
+ }
19064
+ }
19065
+ };
19066
+ }
19067
+ };
19068
+
17217
19069
  const CrosswalkTable = ({ mapping, data, isFetching, isError, tableMessage, showSubmittedIdInTable })=>{
17218
19070
  const cols = React.useMemo(()=>{
17219
19071
  return [
@@ -17806,6 +19658,8 @@ exports.CreateCredentialsAPIKeyModal = CreateCredentialsAPIKeyModal;
17806
19658
  exports.CrosswalkPage = CrosswalkPage;
17807
19659
  exports.CrosswalkPageGetServerSideProps = CrosswalkPageGetServerSideProps;
17808
19660
  exports.Custom404Page = Custom404Page;
19661
+ exports.DataLibraryPage = DataLibraryPage;
19662
+ exports.DataLibraryPageGetServerSideProps = DataLibraryPageGetServerSideProps;
17809
19663
  exports.DictionaryPage = DictionaryPage;
17810
19664
  exports.DictionaryPageGetServerSideProps = DictionaryPageGetServerSideProps;
17811
19665
  exports.DiscoveryCellRendererFactory = DiscoveryCellRendererFactory;