Add modifiedMethodSignatures to ModeledMethodsChangedEvent
This commit is contained in:
@@ -169,6 +169,13 @@ export class MethodModelingViewProvider extends AbstractWebviewViewProvider<
|
||||
modeledMethods,
|
||||
});
|
||||
}
|
||||
|
||||
if (e.modifiedMethodSignatures !== undefined) {
|
||||
await this.postMessage({
|
||||
t: "setMethodModified",
|
||||
isModified: e.modifiedMethodSignatures.has(this.method.signature),
|
||||
});
|
||||
}
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -824,6 +824,13 @@ export class ModelEditorView extends AbstractWebview<
|
||||
t: "setModeledMethods",
|
||||
methods: event.modeledMethods,
|
||||
});
|
||||
|
||||
if (event.modifiedMethodSignatures !== undefined) {
|
||||
await this.postMessage({
|
||||
t: "setModifiedMethods",
|
||||
methodSignatures: [...event.modifiedMethodSignatures],
|
||||
});
|
||||
}
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -25,6 +25,7 @@ interface ModeChangedEvent {
|
||||
|
||||
interface ModeledMethodsChangedEvent {
|
||||
readonly modeledMethods: Readonly<Record<string, ModeledMethod[]>>;
|
||||
readonly modifiedMethodSignatures: ReadonlySet<string>;
|
||||
readonly dbUri: string;
|
||||
readonly isActiveDb: boolean;
|
||||
}
|
||||
@@ -211,11 +212,13 @@ export class ModelingEvents extends DisposableObject {
|
||||
|
||||
public fireModeledMethodsChangedEvent(
|
||||
modeledMethods: Record<string, ModeledMethod[]>,
|
||||
modifiedMethodSignatures: ReadonlySet<string>,
|
||||
dbUri: string,
|
||||
isActiveDb: boolean,
|
||||
) {
|
||||
this.onModeledMethodsChangedEventEmitter.fire({
|
||||
modeledMethods,
|
||||
modifiedMethodSignatures,
|
||||
dbUri,
|
||||
isActiveDb,
|
||||
});
|
||||
|
||||
@@ -216,7 +216,7 @@ export class ModelingStore extends DisposableObject {
|
||||
methods: Record<string, ModeledMethod[]>,
|
||||
setModified: boolean,
|
||||
) {
|
||||
this.changeModeledMethods(dbItem, setModified, (state) => {
|
||||
this.changeModeledMethods(dbItem, (state) => {
|
||||
const newModeledMethods = {
|
||||
...methods,
|
||||
// Keep all methods that are already modeled in some form in the state
|
||||
@@ -242,7 +242,7 @@ export class ModelingStore extends DisposableObject {
|
||||
dbItem: DatabaseItem,
|
||||
methods: Record<string, ModeledMethod[]>,
|
||||
) {
|
||||
this.changeModeledMethods(dbItem, false, (state) => {
|
||||
this.changeModeledMethods(dbItem, (state) => {
|
||||
state.modeledMethods = { ...methods };
|
||||
});
|
||||
}
|
||||
@@ -253,7 +253,7 @@ export class ModelingStore extends DisposableObject {
|
||||
modeledMethods: ModeledMethod[],
|
||||
setModified: boolean,
|
||||
) {
|
||||
this.changeModeledMethods(dbItem, setModified, (state) => {
|
||||
this.changeModeledMethods(dbItem, (state) => {
|
||||
const newModeledMethods = { ...state.modeledMethods };
|
||||
newModeledMethods[signature] = modeledMethods;
|
||||
state.modeledMethods = newModeledMethods;
|
||||
@@ -417,7 +417,6 @@ export class ModelingStore extends DisposableObject {
|
||||
|
||||
private changeModeledMethods(
|
||||
dbItem: DatabaseItem,
|
||||
modifiedMethodsChanged: boolean,
|
||||
updateState: (state: InternalDbModelingState) => void,
|
||||
) {
|
||||
const state = this.getState(dbItem);
|
||||
@@ -426,17 +425,10 @@ export class ModelingStore extends DisposableObject {
|
||||
|
||||
this.modelingEvents.fireModeledMethodsChangedEvent(
|
||||
state.modeledMethods,
|
||||
state.modifiedMethodSignatures,
|
||||
dbItem.databaseUri.toString(),
|
||||
dbItem.databaseUri.toString() === this.activeDb,
|
||||
);
|
||||
|
||||
if (modifiedMethodsChanged) {
|
||||
this.modelingEvents.fireModifiedMethodsChangedEvent(
|
||||
state.modifiedMethodSignatures,
|
||||
dbItem.databaseUri.toString(),
|
||||
dbItem.databaseUri.toString() === this.activeDb,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private changeInProgressMethods(
|
||||
|
||||
Reference in New Issue
Block a user