@dhis2/analytics 22.0.0-alpha.2 → 23.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/build/cjs/__demo__/FileMenu.stories.js +9 -17
  2. package/build/cjs/__demo__/OpenFileDialog.stories.js +39 -6
  3. package/build/cjs/__fixtures__/fixtures.js +1 -0
  4. package/build/cjs/__fixtures__/json/api/analytics/enrollments.json +206 -0
  5. package/build/cjs/api/analytics/Analytics.js +6 -0
  6. package/build/cjs/api/analytics/AnalyticsEnrollments.js +48 -0
  7. package/build/cjs/api/analytics/__tests__/AnalyticsEnrollments.spec.js +50 -0
  8. package/build/cjs/api/analytics/__tests__/__snapshots__/AnalyticsEnrollments.spec.js.snap +3 -0
  9. package/build/cjs/components/CachedDataQueryProvider.js +70 -0
  10. package/build/cjs/components/FileMenu/FileMenu.js +3 -4
  11. package/build/cjs/components/FileMenu/__tests__/FileMenu.spec.js +3 -5
  12. package/build/cjs/components/FileMenu/utils.js +1 -1
  13. package/build/cjs/components/OpenFileDialog/CustomSelectOption.js +2 -2
  14. package/build/cjs/components/OpenFileDialog/OpenFileDialog.js +12 -8
  15. package/build/cjs/components/OpenFileDialog/OpenFileDialog.styles.js +2 -2
  16. package/build/cjs/components/OpenFileDialog/utils.js +37 -59
  17. package/build/cjs/index.js +14 -0
  18. package/build/cjs/locales/ar/translations.json +9 -0
  19. package/build/cjs/locales/ar_EG/translations.json +9 -0
  20. package/build/cjs/locales/ar_IQ/translations.json +9 -0
  21. package/build/cjs/locales/ckb/translations.json +9 -0
  22. package/build/cjs/locales/cs/translations.json +17 -8
  23. package/build/cjs/locales/da/translations.json +9 -0
  24. package/build/cjs/locales/en/translations.json +9 -7
  25. package/build/cjs/locales/es/translations.json +9 -0
  26. package/build/cjs/locales/fr/translations.json +9 -0
  27. package/build/cjs/locales/id/translations.json +9 -0
  28. package/build/cjs/locales/km/translations.json +9 -0
  29. package/build/cjs/locales/lo/translations.json +9 -0
  30. package/build/cjs/locales/my/translations.json +9 -0
  31. package/build/cjs/locales/nb/translations.json +9 -0
  32. package/build/cjs/locales/nl/translations.json +9 -0
  33. package/build/cjs/locales/prs/translations.json +9 -0
  34. package/build/cjs/locales/ps/translations.json +9 -0
  35. package/build/cjs/locales/pt/translations.json +9 -0
  36. package/build/cjs/locales/pt_BR/translations.json +9 -0
  37. package/build/cjs/locales/ru/translations.json +9 -0
  38. package/build/cjs/locales/sv/translations.json +9 -0
  39. package/build/cjs/locales/tet/translations.json +9 -0
  40. package/build/cjs/locales/tg/translations.json +9 -0
  41. package/build/cjs/locales/uk/translations.json +9 -0
  42. package/build/cjs/locales/ur/translations.json +9 -0
  43. package/build/cjs/locales/uz/translations.json +9 -0
  44. package/build/cjs/locales/uz_Latn/translations.json +9 -0
  45. package/build/cjs/locales/vi/translations.json +9 -0
  46. package/build/cjs/locales/zh/translations.json +10 -1
  47. package/build/cjs/locales/zh_CN/translations.json +9 -0
  48. package/build/cjs/modules/layoutUiRules/rules.js +5 -1
  49. package/build/es/__demo__/FileMenu.stories.js +9 -17
  50. package/build/es/__demo__/OpenFileDialog.stories.js +38 -6
  51. package/build/es/__fixtures__/fixtures.js +1 -0
  52. package/build/es/__fixtures__/json/api/analytics/enrollments.json +206 -0
  53. package/build/es/api/analytics/Analytics.js +5 -0
  54. package/build/es/api/analytics/AnalyticsEnrollments.js +38 -0
  55. package/build/es/api/analytics/__tests__/AnalyticsEnrollments.spec.js +40 -0
  56. package/build/es/api/analytics/__tests__/__snapshots__/AnalyticsEnrollments.spec.js.snap +3 -0
  57. package/build/es/components/CachedDataQueryProvider.js +50 -0
  58. package/build/es/components/FileMenu/FileMenu.js +3 -4
  59. package/build/es/components/FileMenu/__tests__/FileMenu.spec.js +3 -5
  60. package/build/es/components/FileMenu/utils.js +1 -1
  61. package/build/es/components/OpenFileDialog/CustomSelectOption.js +2 -2
  62. package/build/es/components/OpenFileDialog/OpenFileDialog.js +12 -8
  63. package/build/es/components/OpenFileDialog/OpenFileDialog.styles.js +2 -2
  64. package/build/es/components/OpenFileDialog/utils.js +35 -56
  65. package/build/es/index.js +2 -1
  66. package/build/es/locales/ar/translations.json +9 -0
  67. package/build/es/locales/ar_EG/translations.json +9 -0
  68. package/build/es/locales/ar_IQ/translations.json +9 -0
  69. package/build/es/locales/ckb/translations.json +9 -0
  70. package/build/es/locales/cs/translations.json +17 -8
  71. package/build/es/locales/da/translations.json +9 -0
  72. package/build/es/locales/en/translations.json +9 -7
  73. package/build/es/locales/es/translations.json +9 -0
  74. package/build/es/locales/fr/translations.json +9 -0
  75. package/build/es/locales/id/translations.json +9 -0
  76. package/build/es/locales/km/translations.json +9 -0
  77. package/build/es/locales/lo/translations.json +9 -0
  78. package/build/es/locales/my/translations.json +9 -0
  79. package/build/es/locales/nb/translations.json +9 -0
  80. package/build/es/locales/nl/translations.json +9 -0
  81. package/build/es/locales/prs/translations.json +9 -0
  82. package/build/es/locales/ps/translations.json +9 -0
  83. package/build/es/locales/pt/translations.json +9 -0
  84. package/build/es/locales/pt_BR/translations.json +9 -0
  85. package/build/es/locales/ru/translations.json +9 -0
  86. package/build/es/locales/sv/translations.json +9 -0
  87. package/build/es/locales/tet/translations.json +9 -0
  88. package/build/es/locales/tg/translations.json +9 -0
  89. package/build/es/locales/uk/translations.json +9 -0
  90. package/build/es/locales/ur/translations.json +9 -0
  91. package/build/es/locales/uz/translations.json +9 -0
  92. package/build/es/locales/uz_Latn/translations.json +9 -0
  93. package/build/es/locales/vi/translations.json +9 -0
  94. package/build/es/locales/zh/translations.json +10 -1
  95. package/build/es/locales/zh_CN/translations.json +9 -0
  96. package/build/es/modules/layoutUiRules/rules.js +6 -2
  97. package/package.json +2 -2
@@ -16,6 +16,8 @@
16
16
  "Unsubscribe": "",
17
17
  "Subscribe to get updates about new interpretations.": "",
18
18
  "Subscribe": "",
19
+ "This app could not retrieve required data.": "",
20
+ "Network error": "",
19
21
  "Data Type": "",
20
22
  "All types": "",
21
23
  "Totals only": "",
@@ -115,6 +117,13 @@
115
117
  "No event reports found. Click New event report to get started.": "",
116
118
  "No event reports found. Try adjusting your search or filter options to find what you're looking for.": "",
117
119
  "New event report": "",
120
+ "Open an event visualization": "",
121
+ "Loading event visualizations": "",
122
+ "Couldn't load event visualizations": "",
123
+ "There was a problem loading event visualizations. Try again or contact your system administrator.": "",
124
+ "No event visualizations found. Click New event visualization to get started.": "",
125
+ "No event visualizations found. Try adjusting your search or filter options to find what you're looking for.": "",
126
+ "New event visualization": "",
118
127
  "Options": "Opções",
119
128
  "Hide": "",
120
129
  "Update": "Actualizar",
@@ -18,6 +18,8 @@
18
18
  "Unsubscribe": "",
19
19
  "Subscribe to get updates about new interpretations.": "",
20
20
  "Subscribe": "",
21
+ "This app could not retrieve required data.": "",
22
+ "Network error": "",
21
23
  "Data Type": "Тип данных",
22
24
  "All types": "Все типы",
23
25
  "Totals only": "",
@@ -117,6 +119,13 @@
117
119
  "No event reports found. Click New event report to get started.": "",
118
120
  "No event reports found. Try adjusting your search or filter options to find what you're looking for.": "",
119
121
  "New event report": "",
122
+ "Open an event visualization": "",
123
+ "Loading event visualizations": "",
124
+ "Couldn't load event visualizations": "",
125
+ "There was a problem loading event visualizations. Try again or contact your system administrator.": "",
126
+ "No event visualizations found. Click New event visualization to get started.": "",
127
+ "No event visualizations found. Try adjusting your search or filter options to find what you're looking for.": "",
128
+ "New event visualization": "",
120
129
  "Options": "Параметры",
121
130
  "Hide": "Скрыть",
122
131
  "Update": "Обновить",
@@ -16,6 +16,8 @@
16
16
  "Unsubscribe": "",
17
17
  "Subscribe to get updates about new interpretations.": "",
18
18
  "Subscribe": "",
19
+ "This app could not retrieve required data.": "",
20
+ "Network error": "",
19
21
  "Data Type": "",
20
22
  "All types": "",
21
23
  "Totals only": "",
@@ -115,6 +117,13 @@
115
117
  "No event reports found. Click New event report to get started.": "",
116
118
  "No event reports found. Try adjusting your search or filter options to find what you're looking for.": "",
117
119
  "New event report": "",
120
+ "Open an event visualization": "",
121
+ "Loading event visualizations": "",
122
+ "Couldn't load event visualizations": "",
123
+ "There was a problem loading event visualizations. Try again or contact your system administrator.": "",
124
+ "No event visualizations found. Click New event visualization to get started.": "",
125
+ "No event visualizations found. Try adjusting your search or filter options to find what you're looking for.": "",
126
+ "New event visualization": "",
118
127
  "Options": "Alternativ",
119
128
  "Hide": "",
120
129
  "Update": "Uppdatera",
@@ -15,6 +15,8 @@
15
15
  "Unsubscribe": "",
16
16
  "Subscribe to get updates about new interpretations.": "",
17
17
  "Subscribe": "",
18
+ "This app could not retrieve required data.": "",
19
+ "Network error": "",
18
20
  "Data Type": "",
19
21
  "All types": "",
20
22
  "Totals only": "",
@@ -114,6 +116,13 @@
114
116
  "No event reports found. Click New event report to get started.": "",
115
117
  "No event reports found. Try adjusting your search or filter options to find what you're looking for.": "",
116
118
  "New event report": "",
119
+ "Open an event visualization": "",
120
+ "Loading event visualizations": "",
121
+ "Couldn't load event visualizations": "",
122
+ "There was a problem loading event visualizations. Try again or contact your system administrator.": "",
123
+ "No event visualizations found. Click New event visualization to get started.": "",
124
+ "No event visualizations found. Try adjusting your search or filter options to find what you're looking for.": "",
125
+ "New event visualization": "",
117
126
  "Options": "Opsoens",
118
127
  "Hide": "Subar",
119
128
  "Update": "Atualiza",
@@ -16,6 +16,8 @@
16
16
  "Unsubscribe": "",
17
17
  "Subscribe to get updates about new interpretations.": "",
18
18
  "Subscribe": "",
19
+ "This app could not retrieve required data.": "",
20
+ "Network error": "",
19
21
  "Data Type": "",
20
22
  "All types": "",
21
23
  "Totals only": "",
@@ -115,6 +117,13 @@
115
117
  "No event reports found. Click New event report to get started.": "",
116
118
  "No event reports found. Try adjusting your search or filter options to find what you're looking for.": "",
117
119
  "New event report": "",
120
+ "Open an event visualization": "",
121
+ "Loading event visualizations": "",
122
+ "Couldn't load event visualizations": "",
123
+ "There was a problem loading event visualizations. Try again or contact your system administrator.": "",
124
+ "No event visualizations found. Click New event visualization to get started.": "",
125
+ "No event visualizations found. Try adjusting your search or filter options to find what you're looking for.": "",
126
+ "New event visualization": "",
118
127
  "Options": "Имконот",
119
128
  "Hide": "Пинҳон кардан",
120
129
  "Update": "Навсозӣ",
@@ -18,6 +18,8 @@
18
18
  "Unsubscribe": "",
19
19
  "Subscribe to get updates about new interpretations.": "",
20
20
  "Subscribe": "",
21
+ "This app could not retrieve required data.": "",
22
+ "Network error": "",
21
23
  "Data Type": "",
22
24
  "All types": "",
23
25
  "Totals only": "",
@@ -117,6 +119,13 @@
117
119
  "No event reports found. Click New event report to get started.": "",
118
120
  "No event reports found. Try adjusting your search or filter options to find what you're looking for.": "",
119
121
  "New event report": "",
122
+ "Open an event visualization": "",
123
+ "Loading event visualizations": "",
124
+ "Couldn't load event visualizations": "",
125
+ "There was a problem loading event visualizations. Try again or contact your system administrator.": "",
126
+ "No event visualizations found. Click New event visualization to get started.": "",
127
+ "No event visualizations found. Try adjusting your search or filter options to find what you're looking for.": "",
128
+ "New event visualization": "",
120
129
  "Options": "Опції",
121
130
  "Hide": "Сховати",
122
131
  "Update": "Оновити",
@@ -16,6 +16,8 @@
16
16
  "Unsubscribe": "",
17
17
  "Subscribe to get updates about new interpretations.": "",
18
18
  "Subscribe": "",
19
+ "This app could not retrieve required data.": "",
20
+ "Network error": "",
19
21
  "Data Type": "",
20
22
  "All types": "",
21
23
  "Totals only": "",
@@ -115,6 +117,13 @@
115
117
  "No event reports found. Click New event report to get started.": "",
116
118
  "No event reports found. Try adjusting your search or filter options to find what you're looking for.": "",
117
119
  "New event report": "",
120
+ "Open an event visualization": "",
121
+ "Loading event visualizations": "",
122
+ "Couldn't load event visualizations": "",
123
+ "There was a problem loading event visualizations. Try again or contact your system administrator.": "",
124
+ "No event visualizations found. Click New event visualization to get started.": "",
125
+ "No event visualizations found. Try adjusting your search or filter options to find what you're looking for.": "",
126
+ "New event visualization": "",
118
127
  "Options": "اختیارات",
119
128
  "Hide": "چھپائیں",
120
129
  "Update": "اپڈیٹ",
@@ -15,6 +15,8 @@
15
15
  "Unsubscribe": "",
16
16
  "Subscribe to get updates about new interpretations.": "",
17
17
  "Subscribe": "",
18
+ "This app could not retrieve required data.": "",
19
+ "Network error": "",
18
20
  "Data Type": "Маълумот тури",
19
21
  "All types": "Барча турлари",
20
22
  "Totals only": "",
@@ -114,6 +116,13 @@
114
116
  "No event reports found. Click New event report to get started.": "",
115
117
  "No event reports found. Try adjusting your search or filter options to find what you're looking for.": "",
116
118
  "New event report": "",
119
+ "Open an event visualization": "",
120
+ "Loading event visualizations": "",
121
+ "Couldn't load event visualizations": "",
122
+ "There was a problem loading event visualizations. Try again or contact your system administrator.": "",
123
+ "No event visualizations found. Click New event visualization to get started.": "",
124
+ "No event visualizations found. Try adjusting your search or filter options to find what you're looking for.": "",
125
+ "New event visualization": "",
117
126
  "Options": "Вариант",
118
127
  "Hide": "Беркитиш",
119
128
  "Update": "Янгилаш",
@@ -15,6 +15,8 @@
15
15
  "Unsubscribe": "",
16
16
  "Subscribe to get updates about new interpretations.": "",
17
17
  "Subscribe": "",
18
+ "This app could not retrieve required data.": "",
19
+ "Network error": "",
18
20
  "Data Type": "Maʼlumot turi",
19
21
  "All types": "Barcha turlari",
20
22
  "Totals only": "",
@@ -114,6 +116,13 @@
114
116
  "No event reports found. Click New event report to get started.": "",
115
117
  "No event reports found. Try adjusting your search or filter options to find what you're looking for.": "",
116
118
  "New event report": "",
119
+ "Open an event visualization": "",
120
+ "Loading event visualizations": "",
121
+ "Couldn't load event visualizations": "",
122
+ "There was a problem loading event visualizations. Try again or contact your system administrator.": "",
123
+ "No event visualizations found. Click New event visualization to get started.": "",
124
+ "No event visualizations found. Try adjusting your search or filter options to find what you're looking for.": "",
125
+ "New event visualization": "",
117
126
  "Options": "Вариант",
118
127
  "Hide": "Berkitish",
119
128
  "Update": "Янгилаш",
@@ -15,6 +15,8 @@
15
15
  "Unsubscribe": "",
16
16
  "Subscribe to get updates about new interpretations.": "",
17
17
  "Subscribe": "",
18
+ "This app could not retrieve required data.": "",
19
+ "Network error": "",
18
20
  "Data Type": "Loại dữ liệu",
19
21
  "All types": "Các loại",
20
22
  "Totals only": "",
@@ -114,6 +116,13 @@
114
116
  "No event reports found. Click New event report to get started.": "",
115
117
  "No event reports found. Try adjusting your search or filter options to find what you're looking for.": "",
116
118
  "New event report": "",
119
+ "Open an event visualization": "",
120
+ "Loading event visualizations": "",
121
+ "Couldn't load event visualizations": "",
122
+ "There was a problem loading event visualizations. Try again or contact your system administrator.": "",
123
+ "No event visualizations found. Click New event visualization to get started.": "",
124
+ "No event visualizations found. Try adjusting your search or filter options to find what you're looking for.": "",
125
+ "New event visualization": "",
117
126
  "Options": "Tùy chọn",
118
127
  "Hide": "Ẩn",
119
128
  "Update": "Cập nhật",
@@ -15,6 +15,8 @@
15
15
  "Unsubscribe": "退订",
16
16
  "Subscribe to get updates about new interpretations.": "订阅以获取有关新解释的更新。",
17
17
  "Subscribe": "订阅",
18
+ "This app could not retrieve required data.": "",
19
+ "Network error": "",
18
20
  "Data Type": "数据类型",
19
21
  "All types": "所有类型",
20
22
  "Totals only": "总计",
@@ -114,6 +116,13 @@
114
116
  "No event reports found. Click New event report to get started.": "未找到事件报告。单击新建事件报告开始。",
115
117
  "No event reports found. Try adjusting your search or filter options to find what you're looking for.": "未找到事件报告。尝试调整您的搜索或过滤选项以找到您要查找的内容。",
116
118
  "New event report": "新建事件报告",
119
+ "Open an event visualization": "打开事件可视化",
120
+ "Loading event visualizations": "加载事件可视化",
121
+ "Couldn't load event visualizations": "无法加载事件可视化应用",
122
+ "There was a problem loading event visualizations. Try again or contact your system administrator.": "加载事件可视化时出现问题。重试或联系您的系统管理员。",
123
+ "No event visualizations found. Click New event visualization to get started.": "未找到事件可视化。单击新建事件可视化开始。",
124
+ "No event visualizations found. Try adjusting your search or filter options to find what you're looking for.": "未找到事件可视化。尝试调整您的搜索或过滤选项以找到您要查找的内容。",
125
+ "New event visualization": "新的事件可视化",
117
126
  "Options": "选项",
118
127
  "Hide": "隐藏",
119
128
  "Update": "更新",
@@ -224,7 +233,7 @@
224
233
  "Choose a locale to translate from the menu above": "从上面的菜单中选择要翻译的语言环境",
225
234
  "Translate: {{objectName}}": "翻译:{{objectName}}",
226
235
  "Save translations": "保存翻译",
227
- "Could not load translations": "",
236
+ "Could not load translations": "无法加载翻译",
228
237
  "Retry": "重试",
229
238
  "Series": "系列",
230
239
  "Category": "分类",
@@ -15,6 +15,8 @@
15
15
  "Unsubscribe": "",
16
16
  "Subscribe to get updates about new interpretations.": "",
17
17
  "Subscribe": "",
18
+ "This app could not retrieve required data.": "",
19
+ "Network error": "",
18
20
  "Data Type": "",
19
21
  "All types": "",
20
22
  "Totals only": "",
@@ -114,6 +116,13 @@
114
116
  "No event reports found. Click New event report to get started.": "",
115
117
  "No event reports found. Try adjusting your search or filter options to find what you're looking for.": "",
116
118
  "New event report": "",
119
+ "Open an event visualization": "",
120
+ "Loading event visualizations": "",
121
+ "Couldn't load event visualizations": "",
122
+ "There was a problem loading event visualizations. Try again or contact your system administrator.": "",
123
+ "No event visualizations found. Click New event visualization to get started.": "",
124
+ "No event visualizations found. Try adjusting your search or filter options to find what you're looking for.": "",
125
+ "New event visualization": "",
117
126
  "Options": "选项",
118
127
  "Hide": "隐藏",
119
128
  "Update": "更新",
@@ -89,6 +89,9 @@ const scatterRules = {
89
89
  [_predefinedDimensions.DIMENSION_ID_ORGUNIT]: _axis.AXIS_ID_ROWS
90
90
  }
91
91
  };
92
+ const lineListRules = {
93
+ [RULE_PROP_AVAILABLE_AXES]: [_axis.AXIS_ID_COLUMNS, _axis.AXIS_ID_FILTERS]
94
+ };
92
95
  const visTypeToRules = {
93
96
  [_visTypes.VIS_TYPE_COLUMN]: defaultRules,
94
97
  [_visTypes.VIS_TYPE_STACKED_COLUMN]: defaultRules,
@@ -104,7 +107,8 @@ const visTypeToRules = {
104
107
  [_visTypes.VIS_TYPE_YEAR_OVER_YEAR_LINE]: yearOverYearRules,
105
108
  [_visTypes.VIS_TYPE_YEAR_OVER_YEAR_COLUMN]: yearOverYearRules,
106
109
  [_visTypes.VIS_TYPE_PIVOT_TABLE]: pivotTableRules,
107
- [_visTypes.VIS_TYPE_SCATTER]: scatterRules
110
+ [_visTypes.VIS_TYPE_SCATTER]: scatterRules,
111
+ [_visTypes.VIS_TYPE_LINE_LIST]: lineListRules
108
112
  };
109
113
 
110
114
  const getRulesByVisType = visType => {
@@ -6,10 +6,10 @@ const configMock = {
6
6
  baseUrl: 'http://localhost:8080',
7
7
  apiVersion: 33
8
8
  };
9
- const d2Mock = {
10
- i18n: {
11
- getTranslation: string => string
12
- }
9
+ const user = {
10
+ displayName: 'John Traore',
11
+ id: 'xE7jOejl9FI',
12
+ username: 'admin'
13
13
  };
14
14
  const visObject = {
15
15
  lastUpdated: '2020-10-12T09:44:46.194',
@@ -30,16 +30,8 @@ const visObject = {
30
30
  write: true,
31
31
  manage: true
32
32
  },
33
- lastUpdatedBy: {
34
- displayName: 'John Traore',
35
- id: 'xE7jOejl9FI',
36
- username: 'admin'
37
- },
38
- user: {
39
- displayName: 'John Traore',
40
- id: 'xE7jOejl9FI',
41
- username: 'admin'
42
- },
33
+ lastUpdatedBy: user,
34
+ user,
43
35
  translations: [],
44
36
  userAccesses: [{
45
37
  access: 'rw------',
@@ -59,18 +51,18 @@ const visReadonlyObject = { ...visObject,
59
51
  }
60
52
  };
61
53
  storiesOf('FileMenu', module).add('Simple', () => /*#__PURE__*/React.createElement(FileMenu, {
62
- d2: d2Mock,
54
+ currentUser: user,
63
55
  fileType: "visualization"
64
56
  })).add('With AO', () => /*#__PURE__*/React.createElement(Provider, {
65
57
  config: configMock
66
58
  }, /*#__PURE__*/React.createElement(FileMenu, {
67
- d2: d2Mock,
59
+ currentUser: user,
68
60
  fileType: "visualization",
69
61
  fileObject: visObject
70
62
  }))).add('With readonly AO', () => /*#__PURE__*/React.createElement(Provider, {
71
63
  config: configMock
72
64
  }, /*#__PURE__*/React.createElement(FileMenu, {
73
- d2: d2Mock,
65
+ currentUser: user,
74
66
  fileType: "visualization",
75
67
  fileObject: visReadonlyObject
76
68
  })));
@@ -2,6 +2,7 @@ import { Provider } from '@dhis2/app-runtime';
2
2
  import { storiesOf } from '@storybook/react';
3
3
  import React from 'react';
4
4
  import { OpenFileDialog } from '../components/OpenFileDialog/OpenFileDialog.js';
5
+ import { VIS_TYPE_GROUP_ALL, VIS_TYPE_GROUP_CHARTS, VIS_TYPE_PIVOT_TABLE, VIS_TYPE_COLUMN, VIS_TYPE_BAR, VIS_TYPE_LINE_LIST } from '../modules/visTypes.js';
5
6
  const configMock = {
6
7
  baseUrl: 'https://debug.dhis2.org/dev',
7
8
  apiVersion: 37
@@ -14,17 +15,30 @@ const user = {
14
15
 
15
16
  const onFileSelect = id => alert("Opening ".concat(id));
16
17
 
17
- storiesOf('OpenFileDialog', module).add('List of visualizations', () => /*#__PURE__*/React.createElement(Provider, {
18
+ const filterVisTypesWithGroupsAndDivider = [{
19
+ type: VIS_TYPE_GROUP_ALL
20
+ }, {
21
+ type: VIS_TYPE_GROUP_CHARTS,
22
+ insertDivider: true
23
+ }, {
24
+ type: VIS_TYPE_PIVOT_TABLE
25
+ }, {
26
+ type: VIS_TYPE_COLUMN
27
+ }, {
28
+ type: VIS_TYPE_BAR
29
+ }];
30
+ storiesOf('OpenFileDialog', module).add('List of visualizations with vis type filter and divider (no default vis type)', () => /*#__PURE__*/React.createElement(Provider, {
18
31
  config: configMock
19
32
  }, /*#__PURE__*/React.createElement(OpenFileDialog, {
20
33
  type: "visualization",
34
+ filterVisTypes: filterVisTypesWithGroupsAndDivider,
21
35
  onClose: Function.prototype,
22
36
  onFileSelect: onFileSelect,
23
37
  onNew: Function.prototype,
24
38
  open: true,
25
39
  currentUser: user
26
40
  })));
27
- storiesOf('OpenFileDialog', module).add('List of maps', () => /*#__PURE__*/React.createElement(Provider, {
41
+ storiesOf('OpenFileDialog', module).add('List of maps (no vis type filter)', () => /*#__PURE__*/React.createElement(Provider, {
28
42
  config: configMock
29
43
  }, /*#__PURE__*/React.createElement(OpenFileDialog, {
30
44
  type: "map",
@@ -34,20 +48,38 @@ storiesOf('OpenFileDialog', module).add('List of maps', () => /*#__PURE__*/React
34
48
  open: true,
35
49
  currentUser: user
36
50
  })));
37
- storiesOf('OpenFileDialog', module).add('List of event reports (Line list only)', () => /*#__PURE__*/React.createElement(Provider, {
51
+ const filterVisTypesWithDisabled = [{
52
+ type: VIS_TYPE_PIVOT_TABLE,
53
+ disabled: true
54
+ }, {
55
+ type: VIS_TYPE_LINE_LIST
56
+ }];
57
+ storiesOf('OpenFileDialog', module).add('List of event visualizations with vis type filter, disabled type and default vis type', () => /*#__PURE__*/React.createElement(Provider, {
38
58
  config: configMock
39
59
  }, /*#__PURE__*/React.createElement(OpenFileDialog, {
40
- type: "eventReport",
60
+ type: "eventVisualization",
61
+ filterVisTypes: filterVisTypesWithDisabled,
62
+ defaultFilterVisType: VIS_TYPE_LINE_LIST,
41
63
  onClose: Function.prototype,
42
64
  onFileSelect: onFileSelect,
43
65
  onNew: Function.prototype,
44
66
  open: true,
45
67
  currentUser: user
46
68
  })));
47
- storiesOf('OpenFileDialog', module).add('List of a supported type without custom titles/texts', () => /*#__PURE__*/React.createElement(Provider, {
69
+ const filterVisTypesWithGroupDividerAndDisabled = [{
70
+ type: VIS_TYPE_GROUP_ALL
71
+ }, {
72
+ type: VIS_TYPE_BAR,
73
+ insertDivider: true
74
+ }, {
75
+ type: VIS_TYPE_COLUMN,
76
+ disabled: true
77
+ }];
78
+ storiesOf('OpenFileDialog', module).add('List of visualizations with vis type filter with group type, divider and disabled option (no default vis type)', () => /*#__PURE__*/React.createElement(Provider, {
48
79
  config: configMock
49
80
  }, /*#__PURE__*/React.createElement(OpenFileDialog, {
50
- type: "eventChart",
81
+ type: "visualization",
82
+ filterVisTypes: filterVisTypesWithGroupDividerAndDisabled,
51
83
  onClose: Function.prototype,
52
84
  onFileSelect: onFileSelect,
53
85
  onNew: Function.prototype,
@@ -91,6 +91,7 @@ export default (function x() {
91
91
  addFixture('/api/analytics/query', require('./json/api/analytics/query.json'));
92
92
  addFixture('/api/analytics/cluster', require('./json/api/analytics/cluster.json'));
93
93
  addFixture('/api/analytics/response', require('./json/api/analytics/response.json'));
94
+ addFixture('/api/analytics/enrollments', require('./json/api/analytics/enrollments.json'));
94
95
  return {
95
96
  get: getFixture,
96
97
  add: addFixture