Skip to content

Commit c908e02

Browse files
committed
wip
1 parent 8380676 commit c908e02

File tree

2 files changed

+51
-50
lines changed

2 files changed

+51
-50
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const EditSchema = z.discriminatedUnion('type', [
3636
type: z.literal('SetModel'),
3737
id: z.string(),
3838
timestamp: z.string(),
39-
model: StaticModelSchema,
39+
model: z.unknown(), // TODO: StaticModelSchema,
4040
}),
4141
z.object({
4242
type: z.literal('AddRelationship'),

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

Lines changed: 50 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export type RenameDiagramAction = {
4747

4848
export type ApplyEditAction = {
4949
type: DiagramActionTypes.APPLY_EDIT;
50+
// TODO
5051
edit: unknown;
5152
};
5253

@@ -85,27 +86,27 @@ export const diagramReducer: Reducer<DiagramState> = (
8586
};
8687
}
8788

88-
if (isAction(action, AnalysisProcessActionTypes.ANALYSIS_FINISHED)) {
89-
return {
90-
id: new UUID().toString(),
91-
name: action.name,
92-
connectionId: action.connectionId,
93-
edits: {
94-
prev: [],
95-
current: [
96-
{
97-
// TODO
98-
type: 'SetModel',
99-
model: {
100-
schema: action.schema,
101-
relations: action.relations,
102-
},
103-
},
104-
],
105-
next: [],
106-
},
107-
};
108-
}
89+
// if (isAction(action, AnalysisProcessActionTypes.ANALYSIS_FINISHED)) {
90+
// return {
91+
// id: new UUID().toString(),
92+
// name: action.name,
93+
// connectionId: action.connectionId,
94+
// edits: {
95+
// prev: [],
96+
// current: [
97+
// {
98+
// // TODO
99+
// type: 'SetModel',
100+
// model: {
101+
// schema: action.schema,
102+
// relations: action.relations,
103+
// },
104+
// },
105+
// ],
106+
// next: [],
107+
// },
108+
// };
109+
// }
109110

110111
// All actions below are only applicable when diagram is open
111112
if (!state) {
@@ -128,34 +129,34 @@ export const diagramReducer: Reducer<DiagramState> = (
128129
},
129130
};
130131
}
131-
if (isAction(action, DiagramActionTypes.UNDO_EDIT)) {
132-
const newCurrent = state.edits.prev.pop();
133-
if (!newCurrent) {
134-
return state;
135-
}
136-
return {
137-
...state,
138-
edits: {
139-
prev: [...state.edits.prev],
140-
current: newCurrent,
141-
next: [...state.edits.next, state.edits.current],
142-
},
143-
};
144-
}
145-
if (isAction(action, DiagramActionTypes.REDO_EDIT)) {
146-
const newCurrent = state.edits.next.pop();
147-
if (!newCurrent) {
148-
return state;
149-
}
150-
return {
151-
...state,
152-
edits: {
153-
prev: [...state.edits.prev, state.edits.current],
154-
current: newCurrent,
155-
next: [...state.edits.next],
156-
},
157-
};
158-
}
132+
// if (isAction(action, DiagramActionTypes.UNDO_EDIT)) {
133+
// const newCurrent = state.edits.prev.pop();
134+
// if (!newCurrent) {
135+
// return state;
136+
// }
137+
// return {
138+
// ...state,
139+
// edits: {
140+
// prev: [...state.edits.prev],
141+
// current: newCurrent,
142+
// next: [...state.edits.next, state.edits.current],
143+
// },
144+
// };
145+
// }
146+
// if (isAction(action, DiagramActionTypes.REDO_EDIT)) {
147+
// const newCurrent = state.edits.next.pop();
148+
// if (!newCurrent) {
149+
// return state;
150+
// }
151+
// return {
152+
// ...state,
153+
// edits: {
154+
// prev: [...state.edits.prev, state.edits.current],
155+
// current: newCurrent,
156+
// next: [...state.edits.next],
157+
// },
158+
// };
159+
// }
159160
return state;
160161
};
161162

0 commit comments

Comments
 (0)