datajunction-ui 0.0.41 → 0.0.43

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datajunction-ui",
3
- "version": "0.0.41",
3
+ "version": "0.0.43",
4
4
  "description": "DataJunction UI",
5
5
  "module": "src/index.tsx",
6
6
  "repository": {
@@ -66,10 +66,13 @@ export default function NodeInfoTab({ node }) {
66
66
  useEffect(() => {
67
67
  const fetchData = async () => {
68
68
  const metric = await djClient.getMetric(node.name);
69
+ // For derived metrics (multiple parents), upstream_node is null
70
+ const parents = metric.current.parents || [];
71
+ const upstreamNode = parents.length === 1 ? parents[0]?.name : null;
69
72
  setMetricInfo({
70
73
  metric_metadata: metric.current.metricMetadata,
71
74
  required_dimensions: metric.current.requiredDimensions,
72
- upstream_node: metric.current.parents[0]?.name,
75
+ upstream_node: upstreamNode,
73
76
  expression: metric.current.metricMetadata?.expression,
74
77
  incompatible_druid_functions:
75
78
  metric.current.metricMetadata?.incompatibleDruidFunctions || [],
@@ -134,14 +137,16 @@ export default function NodeInfoTab({ node }) {
134
137
  node?.type === 'metric' ? (
135
138
  <div className="list-group-item d-flex">
136
139
  <div className="gap-2 w-100 justify-content-between py-3">
137
- <div style={{ marginBottom: '30px' }}>
138
- <h6 className="mb-0 w-100">Upstream Node</h6>
139
- <p>
140
- <a href={`/nodes/${metricInfo?.upstream_node}`}>
141
- {metricInfo?.upstream_node}
142
- </a>
143
- </p>
144
- </div>
140
+ {metricInfo?.upstream_node && (
141
+ <div style={{ marginBottom: '30px' }}>
142
+ <h6 className="mb-0 w-100">Upstream Node</h6>
143
+ <p>
144
+ <a href={`/nodes/${metricInfo?.upstream_node}`}>
145
+ {metricInfo?.upstream_node}
146
+ </a>
147
+ </p>
148
+ </div>
149
+ )}
145
150
  <div>
146
151
  <h6 className="mb-0 w-100">Aggregate Expression</h6>
147
152
  <SyntaxHighlighter language="sql" style={foundation}>