datajunction-ui 0.0.31 → 0.0.41
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.
- package/package.json +3 -3
- package/src/app/components/ListGroupItem.jsx +2 -2
- package/src/app/components/QueryInfo.jsx +2 -1
- package/src/app/components/__tests__/__snapshots__/ListGroupItem.test.tsx.snap +2 -2
- package/src/app/components/djgraph/__tests__/Collapse.test.jsx +6 -3
- package/src/app/pages/AddEditNodePage/index.jsx +1 -1
- package/src/app/pages/AddEditTagPage/index.jsx +1 -1
- package/src/app/pages/CubeBuilderPage/__tests__/index.test.jsx +55 -21
- package/src/app/pages/NodePage/NodeInfoTab.jsx +17 -6
- package/src/app/pages/NodePage/NodeMaterializationTab.jsx +5 -0
- package/src/app/pages/NodePage/NodePreAggregationsTab.jsx +656 -0
- package/src/app/pages/NodePage/NodeValidateTab.jsx +4 -2
- package/src/app/pages/NodePage/__tests__/NodePage.test.jsx +58 -45
- package/src/app/pages/NodePage/__tests__/NodePreAggregationsTab.test.jsx +654 -0
- package/src/app/pages/NodePage/index.jsx +9 -1
- package/src/app/pages/NotificationsPage/__tests__/index.test.jsx +19 -4
- package/src/app/pages/SQLBuilderPage/__tests__/index.test.jsx +47 -9
- package/src/app/pages/SQLBuilderPage/index.jsx +2 -2
- package/src/app/services/DJService.js +26 -0
- package/src/styles/preaggregations.css +547 -0
|
@@ -6,6 +6,14 @@ import { NodePage } from '../Loadable';
|
|
|
6
6
|
import { MemoryRouter, Route, Routes } from 'react-router-dom';
|
|
7
7
|
import userEvent from '@testing-library/user-event';
|
|
8
8
|
|
|
9
|
+
// Mock cronstrue for NodePreAggregationsTab
|
|
10
|
+
jest.mock('cronstrue', () => ({
|
|
11
|
+
toString: () => 'Every day at midnight',
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
// Mock CSS imports
|
|
15
|
+
jest.mock('../../../../styles/preaggregations.css', () => ({}));
|
|
16
|
+
|
|
9
17
|
describe('<NodePage />', () => {
|
|
10
18
|
const domTestingLib = require('@testing-library/dom');
|
|
11
19
|
const { queryHelpers } = domTestingLib;
|
|
@@ -61,6 +69,8 @@ describe('<NodePage />', () => {
|
|
|
61
69
|
removeComplexDimensionLink: jest
|
|
62
70
|
.fn()
|
|
63
71
|
.mockResolvedValue({ status: 200 }),
|
|
72
|
+
listPreaggs: jest.fn().mockResolvedValue({ items: [] }),
|
|
73
|
+
deactivatePreaggWorkflow: jest.fn().mockResolvedValue({ status: 200 }),
|
|
64
74
|
},
|
|
65
75
|
};
|
|
66
76
|
};
|
|
@@ -609,13 +619,13 @@ describe('<NodePage />', () => {
|
|
|
609
619
|
|
|
610
620
|
it('renders an empty NodeMaterialization tab correctly', async () => {
|
|
611
621
|
const djClient = mockDJClient();
|
|
612
|
-
djClient.DataJunctionAPI.node.
|
|
622
|
+
djClient.DataJunctionAPI.node.mockResolvedValue(mocks.mockMetricNode);
|
|
613
623
|
djClient.DataJunctionAPI.getMetric.mockResolvedValue(
|
|
614
624
|
mocks.mockMetricNodeJson,
|
|
615
625
|
);
|
|
616
|
-
djClient.DataJunctionAPI.columns.
|
|
617
|
-
|
|
618
|
-
djClient.DataJunctionAPI.
|
|
626
|
+
djClient.DataJunctionAPI.columns.mockResolvedValue(mocks.metricNodeColumns);
|
|
627
|
+
// For metric nodes, listPreaggs is called, not materializations
|
|
628
|
+
djClient.DataJunctionAPI.listPreaggs.mockResolvedValue({ items: [] });
|
|
619
629
|
|
|
620
630
|
const element = (
|
|
621
631
|
<DJClientContext.Provider value={djClient}>
|
|
@@ -631,35 +641,40 @@ describe('<NodePage />', () => {
|
|
|
631
641
|
</Routes>
|
|
632
642
|
</MemoryRouter>,
|
|
633
643
|
);
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
);
|
|
644
|
+
|
|
645
|
+
// For metric nodes, NodePreAggregationsTab is used, which calls listPreaggs
|
|
646
|
+
await waitFor(() => {
|
|
647
|
+
expect(djClient.DataJunctionAPI.listPreaggs).toHaveBeenCalledWith({
|
|
648
|
+
node_name: mocks.mockMetricNode.name,
|
|
649
|
+
include_stale: true,
|
|
650
|
+
});
|
|
651
|
+
});
|
|
652
|
+
|
|
653
|
+
// Check for the empty state text (for NodePreAggregationsTab)
|
|
654
|
+
expect(
|
|
655
|
+
screen.getByText('No pre-aggregations found for this node.'),
|
|
656
|
+
).toBeInTheDocument();
|
|
648
657
|
});
|
|
649
658
|
|
|
650
659
|
it('renders the NodeMaterialization tab with materializations correctly', async () => {
|
|
651
660
|
const djClient = mockDJClient();
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
661
|
+
// Use cube node - only cubes use NodeMaterializationTab
|
|
662
|
+
// Override columns with explicit partition: null to avoid undefined.type_ error
|
|
663
|
+
const cubeNodeWithPartitions = {
|
|
664
|
+
...mocks.mockCubeNode,
|
|
665
|
+
columns: mocks.mockCubeNode.columns.map(col => ({
|
|
666
|
+
...col,
|
|
667
|
+
partition: null,
|
|
668
|
+
})),
|
|
669
|
+
};
|
|
670
|
+
djClient.DataJunctionAPI.node.mockResolvedValue(cubeNodeWithPartitions);
|
|
671
|
+
djClient.DataJunctionAPI.cube.mockResolvedValue(mocks.mockCubesCube);
|
|
672
|
+
djClient.DataJunctionAPI.columns.mockResolvedValue([]);
|
|
673
|
+
djClient.DataJunctionAPI.materializations.mockResolvedValue(
|
|
658
674
|
mocks.nodeMaterializations,
|
|
659
675
|
);
|
|
660
|
-
djClient.DataJunctionAPI.availabilityStates.
|
|
661
|
-
|
|
662
|
-
djClient.DataJunctionAPI.materializationInfo.mockReturnValue(
|
|
676
|
+
djClient.DataJunctionAPI.availabilityStates.mockResolvedValue([]);
|
|
677
|
+
djClient.DataJunctionAPI.materializationInfo.mockResolvedValue(
|
|
663
678
|
mocks.materializationInfo,
|
|
664
679
|
);
|
|
665
680
|
|
|
@@ -670,30 +685,28 @@ describe('<NodePage />', () => {
|
|
|
670
685
|
);
|
|
671
686
|
render(
|
|
672
687
|
<MemoryRouter
|
|
673
|
-
initialEntries={[
|
|
674
|
-
'/nodes/default.repair_order_transform/materializations',
|
|
675
|
-
]}
|
|
688
|
+
initialEntries={['/nodes/default.repair_orders_cube/materializations']}
|
|
676
689
|
>
|
|
677
690
|
<Routes>
|
|
678
691
|
<Route path="nodes/:name/:tab" element={element} />
|
|
679
692
|
</Routes>
|
|
680
693
|
</MemoryRouter>,
|
|
681
694
|
);
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
);
|
|
696
|
-
}
|
|
695
|
+
|
|
696
|
+
// Wait for the node to load first
|
|
697
|
+
await waitFor(() => {
|
|
698
|
+
expect(djClient.DataJunctionAPI.node).toHaveBeenCalledWith(
|
|
699
|
+
'default.repair_orders_cube',
|
|
700
|
+
);
|
|
701
|
+
});
|
|
702
|
+
|
|
703
|
+
// Then wait for materializations to be fetched
|
|
704
|
+
await waitFor(() => {
|
|
705
|
+
expect(djClient.DataJunctionAPI.materializations).toHaveBeenCalledWith(
|
|
706
|
+
mocks.mockCubeNode.name,
|
|
707
|
+
);
|
|
708
|
+
});
|
|
709
|
+
});
|
|
697
710
|
|
|
698
711
|
it('renders the NodeValidate tab', async () => {
|
|
699
712
|
const djClient = mockDJClient();
|