@erd-studio/renderer 0.1.3 → 0.1.4
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.
|
@@ -207,6 +207,7 @@ function transformDomain(domain, options) {
|
|
|
207
207
|
// untouched. Never derive it inside an overlay pass.
|
|
208
208
|
...model.provenance ? { provenance: model.provenance } : {},
|
|
209
209
|
...model.loadError ? { loadError: model.loadError } : {},
|
|
210
|
+
...model.loadWarning ? { loadWarning: model.loadWarning } : {},
|
|
210
211
|
...disc ? { discrepancy: disc } : {},
|
|
211
212
|
...disc && options?.discrepancyReport ? {
|
|
212
213
|
discrepancySourceStage: options.discrepancyReport.sourceStage,
|
|
@@ -1743,8 +1744,12 @@ function describeLoadError(error) {
|
|
|
1743
1744
|
}
|
|
1744
1745
|
return error.line !== void 0 ? `YAML error on line ${error.line} \u2014 ERD Studio can't read this file.` : "YAML error \u2014 ERD Studio can't read this file.";
|
|
1745
1746
|
}
|
|
1747
|
+
function describeLoadWarning(warning) {
|
|
1748
|
+
const key = warning.key ? `"${warning.key}"` : "A key";
|
|
1749
|
+
return `${key} is written twice (line ${warning.line}) \u2014 the last one is shown. Remove the other copy to edit this model.`;
|
|
1750
|
+
}
|
|
1746
1751
|
function ModelNodeComponent({ data, selected }) {
|
|
1747
|
-
const { modelName, label, stage, layer, layerConfig, schema, columns, grain, meta, dimmed, readOnly, isGhost, ghostReason, provenance, loadError, isStub, isExpanded = false, onToggleExpansion, discrepancy, discrepancySourceStage, discrepancyTargetStage } = data;
|
|
1752
|
+
const { modelName, label, stage, layer, layerConfig, schema, columns, grain, meta, dimmed, readOnly, isGhost, ghostReason, provenance, loadError, loadWarning, isStub, isExpanded = false, onToggleExpansion, discrepancy, discrepancySourceStage, discrepancyTargetStage } = data;
|
|
1748
1753
|
const openNodeContextMenu = useEditorStore((s) => s.openNodeContextMenu);
|
|
1749
1754
|
const send = useSend();
|
|
1750
1755
|
const viewer = useIsViewer();
|
|
@@ -1853,6 +1858,21 @@ function ModelNodeComponent({ data, selected }) {
|
|
|
1853
1858
|
badgeTip.tip
|
|
1854
1859
|
] }),
|
|
1855
1860
|
grain && /* @__PURE__ */ jsx7("div", { className: "model-node__grain", title: grain, children: grain }),
|
|
1861
|
+
loadWarning && /* @__PURE__ */ jsxs5("div", { className: "model-node__load-warning", role: "status", children: [
|
|
1862
|
+
/* @__PURE__ */ jsx7("span", { className: "model-node__load-warning-text", children: describeLoadWarning(loadWarning) }),
|
|
1863
|
+
viewer ? null : /* @__PURE__ */ jsx7(
|
|
1864
|
+
"button",
|
|
1865
|
+
{
|
|
1866
|
+
type: "button",
|
|
1867
|
+
className: "model-node__load-error-open nodrag",
|
|
1868
|
+
onClick: (e) => {
|
|
1869
|
+
e.stopPropagation();
|
|
1870
|
+
send({ type: "openModelFile", payload: { modelName } });
|
|
1871
|
+
},
|
|
1872
|
+
children: "Open file"
|
|
1873
|
+
}
|
|
1874
|
+
)
|
|
1875
|
+
] }),
|
|
1856
1876
|
/* @__PURE__ */ jsxs5("div", { className: "model-node__columns", children: [
|
|
1857
1877
|
displayColumns.map((col, idx) => /* @__PURE__ */ jsx7(
|
|
1858
1878
|
ColumnRow,
|
package/dist/editor.js
CHANGED
package/dist/index.js
CHANGED
package/dist/styles.css
CHANGED
|
@@ -693,6 +693,20 @@
|
|
|
693
693
|
color: var(--warning-fg);
|
|
694
694
|
text-align: center;
|
|
695
695
|
}
|
|
696
|
+
.model-node__load-warning {
|
|
697
|
+
display: flex;
|
|
698
|
+
align-items: center;
|
|
699
|
+
gap: 8px;
|
|
700
|
+
padding: 4px 10px;
|
|
701
|
+
background: var(--warning-bg);
|
|
702
|
+
color: var(--warning-fg);
|
|
703
|
+
border-bottom: 1px solid var(--warning-fg);
|
|
704
|
+
}
|
|
705
|
+
.model-node__load-warning-text {
|
|
706
|
+
flex: 1;
|
|
707
|
+
font-size: 11px;
|
|
708
|
+
line-height: 1.4;
|
|
709
|
+
}
|
|
696
710
|
.model-node__load-error-text {
|
|
697
711
|
font-size: 11px;
|
|
698
712
|
line-height: 1.4;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* these shapes.
|
|
7
7
|
*/
|
|
8
8
|
import type { Node, Edge } from '@xyflow/react';
|
|
9
|
-
import type { AnnotationColor, Cardinality, ColumnPair, DbtKeyHint, Layer, Meta, ModelLoadError, ModelRole, Stage } from '@erd-studio/core';
|
|
9
|
+
import type { AnnotationColor, Cardinality, ColumnPair, DbtKeyHint, Layer, Meta, ModelLoadError, ModelLoadWarning, ModelRole, Stage } from '@erd-studio/core';
|
|
10
10
|
import type { LayerConfig } from '@erd-studio/core';
|
|
11
11
|
import type { ModelDiscrepancy } from '@erd-studio/core';
|
|
12
12
|
import type { PhysicalProvenance } from '@erd-studio/core';
|
|
@@ -94,6 +94,11 @@ export type ModelNodeData = {
|
|
|
94
94
|
* node shows the error and an "Open file" button instead of "No columns".
|
|
95
95
|
*/
|
|
96
96
|
loadError?: ModelLoadError;
|
|
97
|
+
/**
|
|
98
|
+
* The model's file was read but needs fixing (logical stage only): a key
|
|
99
|
+
* written twice, whose last value is shown (#164). Absent from an older core.
|
|
100
|
+
*/
|
|
101
|
+
loadWarning?: ModelLoadWarning;
|
|
97
102
|
/** Whether this model is in stub display mode (PK/NK columns only). */
|
|
98
103
|
isStub: boolean;
|
|
99
104
|
/** Per-model discrepancy data when a cross-stage comparison report is active. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@erd-studio/renderer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "ERD Studio's React Flow canvas: the entity-relationship diagram renderer shared by the VS Code extension, with a read-only viewer mode.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"prepack": "npm run build"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@erd-studio/core": "0.1.
|
|
49
|
+
"@erd-studio/core": "0.1.4",
|
|
50
50
|
"zustand": "^5.0.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|