datajunction-ui 0.0.1-a35.dev0 → 0.0.1-a37

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/package.json +1 -1
  2. package/src/app/components/forms/Action.jsx +8 -0
  3. package/src/app/components/forms/NodeNameField.jsx +64 -0
  4. package/src/app/components/forms/NodeTagsInput.jsx +61 -0
  5. package/src/app/index.tsx +18 -0
  6. package/src/app/pages/AddEditNodePage/__tests__/AddEditNodePageFormFailed.test.jsx +1 -1
  7. package/src/app/pages/AddEditNodePage/__tests__/AddEditNodePageFormSuccess.test.jsx +2 -5
  8. package/src/app/pages/AddEditNodePage/index.jsx +16 -7
  9. package/src/app/pages/CubeBuilderPage/DimensionsSelect.jsx +154 -0
  10. package/src/app/pages/CubeBuilderPage/Loadable.jsx +16 -0
  11. package/src/app/pages/CubeBuilderPage/MetricsSelect.jsx +79 -0
  12. package/src/app/pages/CubeBuilderPage/__tests__/index.test.jsx +405 -0
  13. package/src/app/pages/CubeBuilderPage/index.jsx +254 -0
  14. package/src/app/pages/NamespacePage/index.jsx +5 -0
  15. package/src/app/pages/NodePage/AddBackfillPopover.jsx +13 -6
  16. package/src/app/pages/NodePage/AddMaterializationPopover.jsx +47 -24
  17. package/src/app/pages/NodePage/NodeInfoTab.jsx +6 -1
  18. package/src/app/pages/NodePage/NodeMaterializationTab.jsx +44 -32
  19. package/src/app/pages/NodePage/__tests__/AddBackfillPopover.test.jsx +0 -1
  20. package/src/app/pages/NodePage/__tests__/AddMaterializationPopover.test.jsx +84 -0
  21. package/src/app/pages/NodePage/__tests__/__snapshots__/NodePage.test.jsx.snap +78 -174
  22. package/src/app/services/DJService.js +66 -12
  23. package/src/app/services/__tests__/DJService.test.jsx +72 -7
  24. package/src/styles/index.css +4 -0
  25. package/src/styles/node-creation.scss +12 -0
@@ -146,6 +146,61 @@ export const DataJunctionAPI = {
146
146
  }
147
147
  },
148
148
 
149
+ createCube: async function (
150
+ name,
151
+ display_name,
152
+ description,
153
+ mode,
154
+ metrics,
155
+ dimensions,
156
+ filters,
157
+ ) {
158
+ const response = await fetch(`${DJ_URL}/nodes/cube`, {
159
+ method: 'POST',
160
+ headers: {
161
+ 'Content-Type': 'application/json',
162
+ },
163
+ body: JSON.stringify({
164
+ name: name,
165
+ display_name: display_name,
166
+ description: description,
167
+ metrics: metrics,
168
+ dimensions: dimensions,
169
+ filters: filters,
170
+ mode: mode,
171
+ }),
172
+ credentials: 'include',
173
+ });
174
+ return { status: response.status, json: await response.json() };
175
+ },
176
+
177
+ patchCube: async function (
178
+ name,
179
+ display_name,
180
+ description,
181
+ mode,
182
+ metrics,
183
+ dimensions,
184
+ filters,
185
+ ) {
186
+ const response = await fetch(`${DJ_URL}/nodes/${name}`, {
187
+ method: 'PATCH',
188
+ headers: {
189
+ 'Content-Type': 'application/json',
190
+ },
191
+ body: JSON.stringify({
192
+ display_name: display_name,
193
+ description: description,
194
+ metrics: metrics,
195
+ dimensions: dimensions,
196
+ filters: filters || [],
197
+ mode: mode,
198
+ }),
199
+ credentials: 'include',
200
+ });
201
+ return { status: response.status, json: await response.json() };
202
+ },
203
+
149
204
  registerTable: async function (catalog, schema, table) {
150
205
  const response = await fetch(
151
206
  `${DJ_URL}/register/table/${catalog}/${schema}/${table}`,
@@ -641,13 +696,7 @@ export const DataJunctionAPI = {
641
696
  );
642
697
  return { status: response.status, json: await response.json() };
643
698
  },
644
- materialize: async function (
645
- nodeName,
646
- engineName,
647
- engineVersion,
648
- schedule,
649
- config,
650
- ) {
699
+ materialize: async function (nodeName, jobType, strategy, schedule, config) {
651
700
  const response = await fetch(
652
701
  `${DJ_URL}/nodes/${nodeName}/materialization`,
653
702
  {
@@ -656,12 +705,10 @@ export const DataJunctionAPI = {
656
705
  'Content-Type': 'application/json',
657
706
  },
658
707
  body: JSON.stringify({
659
- engine: {
660
- name: engineName,
661
- version: engineVersion,
662
- },
708
+ job: jobType,
709
+ strategy: strategy,
663
710
  schedule: schedule,
664
- config: JSON.parse(config),
711
+ config: config,
665
712
  }),
666
713
  credentials: 'include',
667
714
  },
@@ -701,4 +748,11 @@ export const DataJunctionAPI = {
701
748
  });
702
749
  return await response.json();
703
750
  },
751
+ materializationInfo: async function () {
752
+ return await (
753
+ await fetch(`${DJ_URL}/materialization/info`, {
754
+ credentials: 'include',
755
+ })
756
+ ).json();
757
+ },
704
758
  };
@@ -140,6 +140,73 @@ describe('DataJunctionAPI', () => {
140
140
  });
141
141
  });
142
142
 
143
+ it('calls createCube correctly', async () => {
144
+ const sampleArgs = [
145
+ 'default.node_name',
146
+ 'Node Display Name',
147
+ 'Some readable description',
148
+ 'draft',
149
+ ['default.num_repair_orders'],
150
+ [
151
+ 'default.date_dim.year',
152
+ 'default.date_dim.month',
153
+ 'default.date_dim.day',
154
+ ],
155
+ [],
156
+ ];
157
+ fetch.mockResponseOnce(JSON.stringify({}));
158
+ await DataJunctionAPI.createCube(...sampleArgs);
159
+ expect(fetch).toHaveBeenCalledWith(`${DJ_URL}/nodes/cube`, {
160
+ method: 'POST',
161
+ headers: {
162
+ 'Content-Type': 'application/json',
163
+ },
164
+ body: JSON.stringify({
165
+ name: sampleArgs[0],
166
+ display_name: sampleArgs[1],
167
+ description: sampleArgs[2],
168
+ metrics: sampleArgs[4],
169
+ dimensions: sampleArgs[5],
170
+ filters: sampleArgs[6],
171
+ mode: sampleArgs[3],
172
+ }),
173
+ credentials: 'include',
174
+ });
175
+ });
176
+
177
+ it('calls patchCube correctly', async () => {
178
+ const sampleArgs = [
179
+ 'default.node_name',
180
+ 'Node Display Name',
181
+ 'Some readable description',
182
+ 'draft',
183
+ ['default.num_repair_orders'],
184
+ [
185
+ 'default.date_dim.year',
186
+ 'default.date_dim.month',
187
+ 'default.date_dim.day',
188
+ ],
189
+ [],
190
+ ];
191
+ fetch.mockResponseOnce(JSON.stringify({}));
192
+ await DataJunctionAPI.patchCube(...sampleArgs);
193
+ expect(fetch).toHaveBeenCalledWith(`${DJ_URL}/nodes/default.node_name`, {
194
+ method: 'PATCH',
195
+ headers: {
196
+ 'Content-Type': 'application/json',
197
+ },
198
+ body: JSON.stringify({
199
+ display_name: sampleArgs[1],
200
+ description: sampleArgs[2],
201
+ metrics: sampleArgs[4],
202
+ dimensions: sampleArgs[5],
203
+ filters: sampleArgs[6],
204
+ mode: sampleArgs[3],
205
+ }),
206
+ credentials: 'include',
207
+ });
208
+ });
209
+
143
210
  it('calls upstreams correctly', async () => {
144
211
  const nodeName = 'sampleNode';
145
212
  fetch.mockResponseOnce(JSON.stringify({}));
@@ -759,10 +826,10 @@ describe('DataJunctionAPI', () => {
759
826
  fetch.mockResponseOnce(JSON.stringify({}));
760
827
  await DataJunctionAPI.materialize(
761
828
  'default.hard_hat',
762
- 'spark',
763
- '3.3',
829
+ 'spark_sql',
830
+ 'full',
764
831
  '@daily',
765
- '{}',
832
+ {},
766
833
  );
767
834
  expect(fetch).toHaveBeenCalledWith(
768
835
  `${DJ_URL}/nodes/default.hard_hat/materialization`,
@@ -772,10 +839,8 @@ describe('DataJunctionAPI', () => {
772
839
  'Content-Type': 'application/json',
773
840
  },
774
841
  body: JSON.stringify({
775
- engine: {
776
- name: 'spark',
777
- version: '3.3',
778
- },
842
+ job: 'spark_sql',
843
+ strategy: 'full',
779
844
  schedule: '@daily',
780
845
  config: {},
781
846
  }),
@@ -543,6 +543,10 @@ tbody th {
543
543
  font-size: 12px;
544
544
  }
545
545
 
546
+ .dimension_option_subheading:empty {
547
+ display: none;
548
+ }
549
+
546
550
  .upstreams {
547
551
  width: 260px;
548
552
  display: flex;
@@ -39,6 +39,13 @@ form {
39
39
  padding: 0 20px;
40
40
  }
41
41
 
42
+ .CubeCreationInput {
43
+ margin: 0.5rem 0;
44
+ display: inline-grid;
45
+ width: 75%;
46
+ padding: 0 20px;
47
+ }
48
+
42
49
  .DisplayNameInput,
43
50
  .FullNameInput,
44
51
  .NamespaceInput {
@@ -195,3 +202,8 @@ form {
195
202
  width: 20%;
196
203
  padding: 0 20px;
197
204
  }
205
+
206
+ .HighlightPath {
207
+ background: #f5efff;
208
+ padding: 5px;
209
+ }