datajunction-ui 0.0.1-a93 → 0.0.1-a94
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 +1 -1
- package/src/app/pages/AddEditNodePage/MetricMetadataFields.jsx +25 -10
- package/src/app/pages/AddEditNodePage/__tests__/AddEditNodePageFormSuccess.test.jsx +2 -0
- package/src/app/pages/AddEditNodePage/index.jsx +7 -0
- package/src/app/pages/NodePage/NodeInfoTab.jsx +12 -0
- package/src/app/services/DJService.js +3 -0
- package/src/app/services/__tests__/DJService.test.jsx +1 -0
- package/src/mocks/mockNodes.jsx +3 -0
package/package.json
CHANGED
|
@@ -24,11 +24,17 @@ export const MetricMetadataFields = () => {
|
|
|
24
24
|
}, [djClient]);
|
|
25
25
|
|
|
26
26
|
return (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
<div
|
|
28
|
+
style={{
|
|
29
|
+
borderRadius: '8px',
|
|
30
|
+
padding: '10px 10px 20px 10px',
|
|
31
|
+
margin: '32px 0',
|
|
32
|
+
background: '#f9f9f9',
|
|
33
|
+
width: 'max-content',
|
|
34
|
+
display: 'flex',
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
<div style={{ margin: '15px 25px' }}>
|
|
32
38
|
<ErrorMessage name="metric_direction" component="span" />
|
|
33
39
|
<label htmlFor="MetricDirection">Metric Direction</label>
|
|
34
40
|
<Field as="select" name="metric_direction" id="MetricDirection">
|
|
@@ -40,10 +46,7 @@ export const MetricMetadataFields = () => {
|
|
|
40
46
|
))}
|
|
41
47
|
</Field>
|
|
42
48
|
</div>
|
|
43
|
-
<div
|
|
44
|
-
className="MetricUnitInput NodeCreationInput"
|
|
45
|
-
style={{ width: '25%' }}
|
|
46
|
-
>
|
|
49
|
+
<div style={{ margin: '15px 25px' }}>
|
|
47
50
|
<ErrorMessage name="metric_unit" component="span" />
|
|
48
51
|
<label htmlFor="MetricUnit">Metric Unit</label>
|
|
49
52
|
<Field as="select" name="metric_unit" id="MetricUnit">
|
|
@@ -55,6 +58,18 @@ export const MetricMetadataFields = () => {
|
|
|
55
58
|
))}
|
|
56
59
|
</Field>
|
|
57
60
|
</div>
|
|
58
|
-
|
|
61
|
+
<div style={{ margin: '15px 25px' }}>
|
|
62
|
+
<ErrorMessage name="significant_digits" component="span" />
|
|
63
|
+
<label htmlFor="SignificantDigits">Significant Digits</label>
|
|
64
|
+
<Field as="select" name="significant_digits" id="SignificantDigits">
|
|
65
|
+
<option value=""></option>
|
|
66
|
+
{[1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(val => (
|
|
67
|
+
<option value={val} key={val}>
|
|
68
|
+
{val}
|
|
69
|
+
</option>
|
|
70
|
+
))}
|
|
71
|
+
</Field>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
59
74
|
);
|
|
60
75
|
};
|
|
@@ -192,6 +192,7 @@ describe('AddEditNodePage submission succeeded', () => {
|
|
|
192
192
|
undefined,
|
|
193
193
|
undefined,
|
|
194
194
|
undefined,
|
|
195
|
+
undefined,
|
|
195
196
|
);
|
|
196
197
|
expect(mockDjClient.DataJunctionAPI.tagsNode).toBeCalledTimes(1);
|
|
197
198
|
expect(mockDjClient.DataJunctionAPI.tagsNode).toBeCalledWith(
|
|
@@ -251,6 +252,7 @@ describe('AddEditNodePage submission succeeded', () => {
|
|
|
251
252
|
[],
|
|
252
253
|
'neutral',
|
|
253
254
|
'unitless',
|
|
255
|
+
4,
|
|
254
256
|
undefined,
|
|
255
257
|
);
|
|
256
258
|
expect(mockDjClient.DataJunctionAPI.tagsNode).toBeCalledTimes(1);
|
|
@@ -152,6 +152,7 @@ export function AddEditNodePage({ extensions = {} }) {
|
|
|
152
152
|
values.primary_key ? primaryKeyToList(values.primary_key) : null,
|
|
153
153
|
values.metric_direction,
|
|
154
154
|
values.metric_unit,
|
|
155
|
+
values.significant_digits,
|
|
155
156
|
values.required_dimensions,
|
|
156
157
|
);
|
|
157
158
|
const tagsResponse = await djClient.tagsNode(
|
|
@@ -270,6 +271,12 @@ export function AddEditNodePage({ extensions = {} }) {
|
|
|
270
271
|
data.metric_metadata.unit.name.toLowerCase(),
|
|
271
272
|
);
|
|
272
273
|
}
|
|
274
|
+
if (data.metric_metadata?.significant_digits) {
|
|
275
|
+
setFieldValue(
|
|
276
|
+
'significant_digits',
|
|
277
|
+
data.metric_metadata.significant_digits,
|
|
278
|
+
);
|
|
279
|
+
}
|
|
273
280
|
if (data.expression) {
|
|
274
281
|
setFieldValue('aggregate_expression', data.expression);
|
|
275
282
|
}
|
|
@@ -181,6 +181,18 @@ export default function NodeInfoTab({ node }) {
|
|
|
181
181
|
: 'None'}
|
|
182
182
|
</p>
|
|
183
183
|
</div>
|
|
184
|
+
{console.log('node?.metric_metadata', node?.metric_metadata)}
|
|
185
|
+
<div style={{ marginRight: '2rem' }}>
|
|
186
|
+
<h6 className="mb-0 w-100">Significant Digits</h6>
|
|
187
|
+
<p
|
|
188
|
+
className="mb-0 opacity-75"
|
|
189
|
+
role="dialog"
|
|
190
|
+
aria-hidden="false"
|
|
191
|
+
aria-label="SignificantDigits"
|
|
192
|
+
>
|
|
193
|
+
{node?.metric_metadata?.significantDigits || 'None'}
|
|
194
|
+
</p>
|
|
195
|
+
</div>
|
|
184
196
|
</div>
|
|
185
197
|
</div>
|
|
186
198
|
) : (
|
|
@@ -139,6 +139,7 @@ export const DataJunctionAPI = {
|
|
|
139
139
|
direction
|
|
140
140
|
unit { name }
|
|
141
141
|
expression
|
|
142
|
+
significantDigits
|
|
142
143
|
incompatibleDruidFunctions
|
|
143
144
|
}
|
|
144
145
|
requiredDimensions {
|
|
@@ -267,6 +268,7 @@ export const DataJunctionAPI = {
|
|
|
267
268
|
primary_key,
|
|
268
269
|
metric_direction,
|
|
269
270
|
metric_unit,
|
|
271
|
+
significant_digits,
|
|
270
272
|
required_dimensions,
|
|
271
273
|
) {
|
|
272
274
|
try {
|
|
@@ -275,6 +277,7 @@ export const DataJunctionAPI = {
|
|
|
275
277
|
? {
|
|
276
278
|
direction: metric_direction,
|
|
277
279
|
unit: metric_unit,
|
|
280
|
+
significant_digits: significant_digits || null,
|
|
278
281
|
}
|
|
279
282
|
: null;
|
|
280
283
|
const response = await fetch(`${DJ_URL}/nodes/${name}`, {
|
package/src/mocks/mockNodes.jsx
CHANGED
|
@@ -278,6 +278,9 @@ export const mocks = {
|
|
|
278
278
|
label: 'Unitless',
|
|
279
279
|
},
|
|
280
280
|
direction: 'neutral',
|
|
281
|
+
max_decimal_exponent: null,
|
|
282
|
+
min_decimal_exponent: null,
|
|
283
|
+
significant_digits: 4,
|
|
281
284
|
},
|
|
282
285
|
upstream_node: 'default.repair_orders',
|
|
283
286
|
expression: 'count(repair_order_id)',
|