datajunction-ui 0.0.30 → 0.0.34

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 (25) hide show
  1. package/TODO.md +265 -0
  2. package/package.json +1 -1
  3. package/src/app/components/ListGroupItem.jsx +2 -2
  4. package/src/app/components/NamespaceHeader.jsx +423 -65
  5. package/src/app/components/QueryInfo.jsx +2 -1
  6. package/src/app/components/__tests__/NamespaceHeader.test.jsx +14 -9
  7. package/src/app/components/__tests__/__snapshots__/ListGroupItem.test.tsx.snap +2 -2
  8. package/src/app/components/__tests__/__snapshots__/NamespaceHeader.test.jsx.snap +139 -34
  9. package/src/app/components/djgraph/__tests__/Collapse.test.jsx +6 -3
  10. package/src/app/pages/AddEditNodePage/index.jsx +1 -1
  11. package/src/app/pages/AddEditTagPage/index.jsx +1 -1
  12. package/src/app/pages/CubeBuilderPage/__tests__/index.test.jsx +55 -21
  13. package/src/app/pages/NamespacePage/index.jsx +44 -511
  14. package/src/app/pages/NodePage/NodeInfoTab.jsx +17 -6
  15. package/src/app/pages/NodePage/NodeMaterializationTab.jsx +5 -0
  16. package/src/app/pages/NodePage/NodePreAggregationsTab.jsx +656 -0
  17. package/src/app/pages/NodePage/NodeValidateTab.jsx +4 -2
  18. package/src/app/pages/NodePage/__tests__/NodePage.test.jsx +58 -45
  19. package/src/app/pages/NodePage/__tests__/NodePreAggregationsTab.test.jsx +654 -0
  20. package/src/app/pages/NodePage/index.jsx +9 -1
  21. package/src/app/pages/NotificationsPage/__tests__/index.test.jsx +19 -4
  22. package/src/app/pages/SQLBuilderPage/__tests__/index.test.jsx +47 -9
  23. package/src/app/pages/SQLBuilderPage/index.jsx +2 -2
  24. package/src/app/services/DJService.js +26 -0
  25. package/src/styles/preaggregations.css +547 -0
@@ -1,47 +1,152 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`<NamespaceHeader /> should render and match the snapshot 1`] = `
4
- <ol
5
- className="breadcrumb breadcrumb-chevron p-3 bg-body-tertiary rounded-3"
4
+ <div
5
+ style={
6
+ Object {
7
+ "alignItems": "center",
8
+ "background": "#ffffff",
9
+ "borderBottom": "1px solid #e2e8f0",
10
+ "borderTop": "1px solid #e2e8f0",
11
+ "display": "flex",
12
+ "justifyContent": "space-between",
13
+ "marginBottom": "16px",
14
+ "padding": "12px 12px 12px 20px",
15
+ }
16
+ }
6
17
  >
7
- <li
8
- className="breadcrumb-item"
18
+ <div
19
+ style={
20
+ Object {
21
+ "alignItems": "center",
22
+ "display": "flex",
23
+ "gap": "8px",
24
+ }
25
+ }
9
26
  >
10
27
  <a
11
28
  href="/"
29
+ style={
30
+ Object {
31
+ "alignItems": "center",
32
+ "display": "flex",
33
+ }
34
+ }
12
35
  >
13
- <HorizontalHierarchyIcon />
36
+ <svg
37
+ fill="currentColor"
38
+ height="16"
39
+ viewBox="0 0 16 16"
40
+ width="16"
41
+ xmlns="http://www.w3.org/2000/svg"
42
+ >
43
+ <path
44
+ d="M8.186 1.113a.5.5 0 0 0-.372 0L1.846 3.5 8 5.961 14.154 3.5 8.186 1.113zM15 4.239l-6.5 2.6v7.922l6.5-2.6V4.24zM7.5 14.762V6.838L1 4.239v7.923l6.5 2.6zM7.443.184a1.5 1.5 0 0 1 1.114 0l7.129 2.852A.5.5 0 0 1 16 3.5v8.662a1 1 0 0 1-.629.928l-7.185 2.874a.5.5 0 0 1-.372 0L.63 13.09a1 1 0 0 1-.63-.928V3.5a.5.5 0 0 1 .314-.464L7.443.184z"
45
+ />
46
+ </svg>
14
47
  </a>
15
- </li>
16
- <li
17
- className="breadcrumb-item"
18
- >
19
- <a
20
- className="link-body-emphasis"
21
- href="/namespaces/shared"
48
+ <svg
49
+ fill="#6c757d"
50
+ height="12"
51
+ viewBox="0 0 16 16"
52
+ width="12"
53
+ xmlns="http://www.w3.org/2000/svg"
22
54
  >
23
- shared
24
- </a>
25
- </li>
26
- <li
27
- className="breadcrumb-item"
28
- >
29
- <a
30
- className="link-body-emphasis"
31
- href="/namespaces/shared.dimensions"
55
+ <path
56
+ d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"
57
+ fillRule="evenodd"
58
+ />
59
+ </svg>
60
+ <span
61
+ style={
62
+ Object {
63
+ "alignItems": "center",
64
+ "display": "flex",
65
+ "gap": "8px",
66
+ }
67
+ }
32
68
  >
33
- dimensions
34
- </a>
35
- </li>
36
- <li
37
- className="breadcrumb-item"
38
- >
39
- <a
40
- className="link-body-emphasis"
41
- href="/namespaces/shared.dimensions.accounts"
69
+ <a
70
+ href="/namespaces/shared"
71
+ style={
72
+ Object {
73
+ "color": "#1e293b",
74
+ "fontWeight": "400",
75
+ "textDecoration": "none",
76
+ }
77
+ }
78
+ >
79
+ shared
80
+ </a>
81
+ <svg
82
+ fill="#94a3b8"
83
+ height="12"
84
+ viewBox="0 0 16 16"
85
+ width="12"
86
+ xmlns="http://www.w3.org/2000/svg"
87
+ >
88
+ <path
89
+ d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"
90
+ fillRule="evenodd"
91
+ />
92
+ </svg>
93
+ </span>
94
+ <span
95
+ style={
96
+ Object {
97
+ "alignItems": "center",
98
+ "display": "flex",
99
+ "gap": "8px",
100
+ }
101
+ }
42
102
  >
43
- accounts
44
- </a>
45
- </li>
46
- </ol>
103
+ <a
104
+ href="/namespaces/shared.dimensions"
105
+ style={
106
+ Object {
107
+ "color": "#1e293b",
108
+ "fontWeight": "400",
109
+ "textDecoration": "none",
110
+ }
111
+ }
112
+ >
113
+ dimensions
114
+ </a>
115
+ <svg
116
+ fill="#94a3b8"
117
+ height="12"
118
+ viewBox="0 0 16 16"
119
+ width="12"
120
+ xmlns="http://www.w3.org/2000/svg"
121
+ >
122
+ <path
123
+ d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"
124
+ fillRule="evenodd"
125
+ />
126
+ </svg>
127
+ </span>
128
+ <span
129
+ style={
130
+ Object {
131
+ "alignItems": "center",
132
+ "display": "flex",
133
+ "gap": "8px",
134
+ }
135
+ }
136
+ >
137
+ <a
138
+ href="/namespaces/shared.dimensions.accounts"
139
+ style={
140
+ Object {
141
+ "color": "#1e293b",
142
+ "fontWeight": "400",
143
+ "textDecoration": "none",
144
+ }
145
+ }
146
+ >
147
+ accounts
148
+ </a>
149
+ </span>
150
+ </div>
151
+ </div>
47
152
  `;
@@ -35,10 +35,13 @@ describe('<Collapse />', () => {
35
35
  <Collapse
36
36
  {...defaultProps}
37
37
  data={{
38
+ name: 'test.transform',
38
39
  type: 'transform',
39
- column_names: Array(11).fill(idx => {
40
- return `column-${idx}`;
41
- }),
40
+ column_names: Array.from({ length: 11 }, (_, idx) => ({
41
+ name: `column_${idx}`,
42
+ type: 'string',
43
+ order: idx,
44
+ })),
42
45
  primary_key: [],
43
46
  }}
44
47
  />
@@ -53,7 +53,7 @@ export function AddEditNodePage({ extensions = {} }) {
53
53
  primary_key: '',
54
54
  mode: 'published',
55
55
  owners: [],
56
- custom_metadata: null,
56
+ custom_metadata: '',
57
57
  };
58
58
 
59
59
  const validator = values => {
@@ -90,7 +90,7 @@ export function AddEditTagPage() {
90
90
  name="display_name"
91
91
  id="display_name"
92
92
  placeholder="Display Name"
93
- class="FullNameField"
93
+ className="FullNameField"
94
94
  />
95
95
  </div>
96
96
  <br />
@@ -185,30 +185,48 @@ describe('CubeBuilderPage', () => {
185
185
  jest.clearAllMocks();
186
186
  });
187
187
 
188
- it('renders without crashing', () => {
188
+ it('renders without crashing', async () => {
189
189
  render(
190
190
  <DJClientContext.Provider value={{ DataJunctionAPI: mockDjClient }}>
191
191
  <CubeBuilderPage />
192
192
  </DJClientContext.Provider>,
193
193
  );
194
+
195
+ // Wait for async effects to complete
196
+ await waitFor(() => {
197
+ expect(mockDjClient.metrics).toHaveBeenCalled();
198
+ });
199
+
194
200
  expect(screen.getByText('Cube')).toBeInTheDocument();
195
201
  });
196
202
 
197
- it('renders the Metrics section', () => {
203
+ it('renders the Metrics section', async () => {
198
204
  render(
199
205
  <DJClientContext.Provider value={{ DataJunctionAPI: mockDjClient }}>
200
206
  <CubeBuilderPage />
201
207
  </DJClientContext.Provider>,
202
208
  );
209
+
210
+ // Wait for async effects to complete
211
+ await waitFor(() => {
212
+ expect(mockDjClient.metrics).toHaveBeenCalled();
213
+ });
214
+
203
215
  expect(screen.getByText('Metrics *')).toBeInTheDocument();
204
216
  });
205
217
 
206
- it('renders the Dimensions section', () => {
218
+ it('renders the Dimensions section', async () => {
207
219
  render(
208
220
  <DJClientContext.Provider value={{ DataJunctionAPI: mockDjClient }}>
209
221
  <CubeBuilderPage />
210
222
  </DJClientContext.Provider>,
211
223
  );
224
+
225
+ // Wait for async effects to complete
226
+ await waitFor(() => {
227
+ expect(mockDjClient.metrics).toHaveBeenCalled();
228
+ });
229
+
212
230
  expect(screen.getByText('Dimensions *')).toBeInTheDocument();
213
231
  });
214
232
 
@@ -237,22 +255,31 @@ describe('CubeBuilderPage', () => {
237
255
  }
238
256
  fireEvent.click(screen.getAllByText('Dimensions *')[0]);
239
257
 
240
- expect(mockDjClient.commonDimensions).toHaveBeenCalled();
258
+ // Wait for commonDimensions to be called and state to update
259
+ await waitFor(() => {
260
+ expect(mockDjClient.commonDimensions).toHaveBeenCalled();
261
+ });
241
262
 
242
263
  const selectDimensions = screen.getAllByTestId('select-dimensions')[0];
243
264
  expect(selectDimensions).toBeDefined();
244
265
  expect(selectDimensions).not.toBeNull();
245
- expect(
246
- screen.getByText(
247
- 'default.repair_order_details.repair_order_id → default.repair_order.hard_hat_id → default.hard_hat.birth_date',
248
- ),
249
- ).toBeInTheDocument();
266
+
267
+ await waitFor(() => {
268
+ expect(
269
+ screen.getByText(
270
+ 'default.repair_order_details.repair_order_id → default.repair_order.hard_hat_id → default.hard_hat.birth_date',
271
+ ),
272
+ ).toBeInTheDocument();
273
+ });
250
274
 
251
275
  const selectDimensionsDate = screen.getAllByTestId(
252
276
  'dimensions-default.date_dim',
253
277
  )[0];
254
278
 
255
279
  fireEvent.keyDown(selectDimensionsDate.firstChild, { key: 'ArrowDown' });
280
+ await waitFor(() => {
281
+ expect(screen.getByText('Day')).toBeInTheDocument();
282
+ });
256
283
  fireEvent.click(screen.getByText('Day'));
257
284
  fireEvent.click(screen.getByText('Month'));
258
285
  fireEvent.click(screen.getByText('Year'));
@@ -264,9 +291,8 @@ describe('CubeBuilderPage', () => {
264
291
  })[0];
265
292
  expect(createCube).toBeInTheDocument();
266
293
 
267
- await waitFor(() => {
268
- fireEvent.click(createCube);
269
- });
294
+ fireEvent.click(createCube);
295
+
270
296
  await waitFor(() => {
271
297
  expect(mockDjClient.createCube).toHaveBeenCalledWith(
272
298
  '',
@@ -322,22 +348,31 @@ describe('CubeBuilderPage', () => {
322
348
 
323
349
  fireEvent.click(screen.getAllByText('Dimensions *')[0]);
324
350
 
325
- expect(mockDjClient.commonDimensions).toHaveBeenCalled();
351
+ // Wait for commonDimensions to be called and state to update
352
+ await waitFor(() => {
353
+ expect(mockDjClient.commonDimensions).toHaveBeenCalled();
354
+ });
326
355
 
327
356
  const selectDimensions = screen.getAllByTestId('select-dimensions')[0];
328
357
  expect(selectDimensions).toBeDefined();
329
358
  expect(selectDimensions).not.toBeNull();
330
- expect(
331
- screen.getByText(
332
- 'default.repair_order_details.repair_order_id → default.repair_order.hard_hat_id → default.hard_hat.birth_date',
333
- ),
334
- ).toBeInTheDocument();
359
+
360
+ await waitFor(() => {
361
+ expect(
362
+ screen.getByText(
363
+ 'default.repair_order_details.repair_order_id → default.repair_order.hard_hat_id → default.hard_hat.birth_date',
364
+ ),
365
+ ).toBeInTheDocument();
366
+ });
335
367
 
336
368
  const selectDimensionsDate = screen.getAllByTestId(
337
369
  'dimensions-default.date_dim',
338
370
  )[0];
339
371
 
340
372
  fireEvent.keyDown(selectDimensionsDate.firstChild, { key: 'ArrowDown' });
373
+ await waitFor(() => {
374
+ expect(screen.getByText('Day')).toBeInTheDocument();
375
+ });
341
376
  fireEvent.click(screen.getByText('Day'));
342
377
  fireEvent.click(screen.getByText('Month'));
343
378
  fireEvent.click(screen.getByText('Year'));
@@ -349,9 +384,8 @@ describe('CubeBuilderPage', () => {
349
384
  })[0];
350
385
  expect(createCube).toBeInTheDocument();
351
386
 
352
- await waitFor(() => {
353
- fireEvent.click(createCube);
354
- });
387
+ fireEvent.click(createCube);
388
+
355
389
  await waitFor(() => {
356
390
  expect(mockDjClient.patchCube).toHaveBeenCalledWith(
357
391
  'default.repair_orders_cube',