Skip to content

Commit 1c7a57f

Browse files
committed
fix after rebase
1 parent ebb4b7f commit 1c7a57f

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

packages/compass-data-modeling/src/components/diagram-editor.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ const DiagramContent: React.FunctionComponent<{
174174
!!selectedItems &&
175175
selectedItems.type === 'collection' &&
176176
selectedItems.id === coll.ns;
177-
return collectionToDiagramNode(coll, {
177+
return collectionToDiagramNode({
178+
...coll,
178179
highlightedFields,
179180
selectedField:
180181
selectedItems?.type === 'field' && selectedItems.namespace === coll.ns

packages/compass-data-modeling/src/services/data-model-storage.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,6 @@ const EditSchemaVariants = z.discriminatedUnion('type', [
5757
type: z.literal('SetModel'),
5858
model: StaticModelSchema,
5959
}),
60-
z.object({
61-
type: z.literal('AddField'),
62-
ns: z.string(),
63-
field: z.array(z.string()),
64-
jsonSchema: z.custom<MongoDBJSONSchema>(),
65-
}),
6660
z.object({
6761
type: z.literal('AddRelationship'),
6862
relationship: RelationshipSchema,

packages/compass-data-modeling/src/store/diagram.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ import {
2727
} from '../services/open-and-download-diagram';
2828
import type { MongoDBJSONSchema } from 'mongodb-schema';
2929
import { getCoordinatesForNewNode } from '@mongodb-js/diagramming';
30-
import { collectionToDiagramNode } from '../utils/nodes-and-edges';
30+
import {
31+
collectionToBaseNodeForLayout,
32+
collectionToDiagramNode,
33+
} from '../utils/nodes-and-edges';
3134
import toNS from 'mongodb-ns';
3235
import { traverseSchema } from '../utils/schema-traversal';
3336
import { addFieldToJSONSchema, getNewUnusedFieldName } from '../utils/schema';
@@ -690,9 +693,9 @@ function getPositionForNewCollection(
690693
newCollection: Omit<DataModelCollection, 'displayPosition'>
691694
): [number, number] {
692695
const existingNodes = existingCollections.map((collection) =>
693-
collectionToDiagramNode(collection)
696+
collectionToBaseNodeForLayout(collection)
694697
);
695-
const newNode = collectionToDiagramNode({
698+
const newNode = collectionToBaseNodeForLayout({
696699
ns: newCollection.ns,
697700
jsonSchema: newCollection.jsonSchema,
698701
displayPosition: [0, 0],

0 commit comments

Comments
 (0)