Merge modeling store events together
This commit is contained in:
Родитель
7d3071812e
Коммит
6850efa2ca
|
@ -159,15 +159,17 @@ export class MethodModelingViewProvider extends AbstractWebviewViewProvider<
|
|||
|
||||
private registerToModelingEvents(): void {
|
||||
this.push(
|
||||
this.modelingEvents.onModeledMethodsChanged(async (e) => {
|
||||
this.modelingEvents.onModelingStateChanged(async (e) => {
|
||||
if (this.webviewView && e.isActiveDb && this.method) {
|
||||
const modeledMethods = e.modeledMethods[this.method.signature];
|
||||
if (modeledMethods) {
|
||||
await this.postMessage({
|
||||
t: "setMultipleModeledMethods",
|
||||
methodSignature: this.method.signature,
|
||||
modeledMethods,
|
||||
});
|
||||
if (e.modeledMethods !== undefined) {
|
||||
const modeledMethods = e.modeledMethods[this.method.signature];
|
||||
if (modeledMethods) {
|
||||
await this.postMessage({
|
||||
t: "setMultipleModeledMethods",
|
||||
methodSignature: this.method.signature,
|
||||
modeledMethods,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (e.modifiedMethodSignatures !== undefined) {
|
||||
|
@ -176,18 +178,25 @@ export class MethodModelingViewProvider extends AbstractWebviewViewProvider<
|
|||
isModified: e.modifiedMethodSignatures.has(this.method.signature),
|
||||
});
|
||||
}
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
this.push(
|
||||
this.modelingEvents.onModifiedMethodsChanged(async (e) => {
|
||||
if (this.webviewView && e.isActiveDb && this.method) {
|
||||
const isModified = e.modifiedMethods.has(this.method.signature);
|
||||
await this.postMessage({
|
||||
t: "setMethodModified",
|
||||
isModified,
|
||||
});
|
||||
if (e.inProgressMethodSignatures !== undefined) {
|
||||
const inProgress = e.inProgressMethodSignatures.has(
|
||||
this.method.signature,
|
||||
);
|
||||
await this.postMessage({
|
||||
t: "setInProgress",
|
||||
inProgress,
|
||||
});
|
||||
}
|
||||
|
||||
if (e.processedByAutoModelMethodSignatures !== undefined) {
|
||||
const processedByAutoModel =
|
||||
e.processedByAutoModelMethodSignatures.has(this.method.signature);
|
||||
await this.postMessage({
|
||||
t: "setProcessedByAutoModel",
|
||||
processedByAutoModel,
|
||||
});
|
||||
}
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
@ -239,36 +248,6 @@ export class MethodModelingViewProvider extends AbstractWebviewViewProvider<
|
|||
}
|
||||
}),
|
||||
);
|
||||
|
||||
this.push(
|
||||
this.modelingEvents.onInProgressMethodsChanged(async (e) => {
|
||||
if (this.method && this.databaseItem) {
|
||||
const dbUri = this.databaseItem.databaseUri.toString();
|
||||
if (e.dbUri === dbUri) {
|
||||
const inProgress = e.methods.has(this.method.signature);
|
||||
await this.postMessage({
|
||||
t: "setInProgress",
|
||||
inProgress,
|
||||
});
|
||||
}
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
this.push(
|
||||
this.modelingEvents.onProcessedByAutoModelMethodsChanged(async (e) => {
|
||||
if (this.method && this.databaseItem) {
|
||||
const dbUri = this.databaseItem.databaseUri.toString();
|
||||
if (e.dbUri === dbUri) {
|
||||
const processedByAutoModel = e.methods.has(this.method.signature);
|
||||
await this.postMessage({
|
||||
t: "setProcessedByAutoModel",
|
||||
processedByAutoModel,
|
||||
});
|
||||
}
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
private registerToModelConfigEvents(): void {
|
||||
|
|
|
@ -80,7 +80,7 @@ export class MethodsUsagePanel extends DisposableObject {
|
|||
);
|
||||
|
||||
this.push(
|
||||
this.modelingEvents.onMethodsChanged(async (event) => {
|
||||
this.modelingEvents.onModelingStateChanged(async (event) => {
|
||||
if (event.isActiveDb) {
|
||||
await this.handleStateChangeEvent();
|
||||
}
|
||||
|
@ -102,14 +102,6 @@ export class MethodsUsagePanel extends DisposableObject {
|
|||
}
|
||||
}),
|
||||
);
|
||||
|
||||
this.push(
|
||||
this.modelingEvents.onModifiedMethodsChanged(async (event) => {
|
||||
if (event.isActiveDb) {
|
||||
await this.handleStateChangeEvent();
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
private async handleStateChangeEvent(): Promise<void> {
|
||||
|
|
|
@ -108,16 +108,18 @@ export class ModelEditorModule extends DisposableObject {
|
|||
);
|
||||
|
||||
this.push(
|
||||
this.modelingEvents.onMethodsChanged((event) => {
|
||||
const modeledMethods = this.modelingStore.getModeledMethods(
|
||||
event.databaseItem,
|
||||
);
|
||||
this.modelingEvents.onModelingStateChanged((event) => {
|
||||
if (event.methods !== undefined) {
|
||||
const modeledMethods = this.modelingStore.getModeledMethods(
|
||||
event.databaseItem,
|
||||
);
|
||||
|
||||
checkConsistency(
|
||||
event.methods,
|
||||
modeledMethods,
|
||||
new DefaultNotifier(this.app.logger),
|
||||
);
|
||||
checkConsistency(
|
||||
event.methods,
|
||||
modeledMethods,
|
||||
new DefaultNotifier(this.app.logger),
|
||||
);
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -807,63 +807,29 @@ export class ModelEditorView extends AbstractWebview<
|
|||
|
||||
private registerToModelingEvents() {
|
||||
this.push(
|
||||
this.modelingEvents.onMethodsChanged(async (event) => {
|
||||
this.modelingEvents.onModelingStateChanged(async (event) => {
|
||||
if (event.dbUri === this.databaseItem.databaseUri.toString()) {
|
||||
await this.postMessage({
|
||||
t: "setModelEditorState",
|
||||
methods: event.methods,
|
||||
});
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
this.push(
|
||||
this.modelingEvents.onModeledMethodsChanged(async (event) => {
|
||||
if (event.dbUri === this.databaseItem.databaseUri.toString()) {
|
||||
await this.postMessage({
|
||||
t: "setModelEditorState",
|
||||
modeledMethods: event.modeledMethods,
|
||||
modifiedMethodSignatures: [...event.modifiedMethodSignatures],
|
||||
modifiedMethodSignatures:
|
||||
event.modifiedMethodSignatures === undefined
|
||||
? undefined
|
||||
: [...event.modifiedMethodSignatures],
|
||||
inProgressMethodSignatures:
|
||||
event.inProgressMethodSignatures === undefined
|
||||
? undefined
|
||||
: [...event.inProgressMethodSignatures],
|
||||
processedByAutoModelMethodSignatures:
|
||||
event.processedByAutoModelMethodSignatures === undefined
|
||||
? undefined
|
||||
: [...event.processedByAutoModelMethodSignatures],
|
||||
});
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
this.push(
|
||||
this.modelingEvents.onModifiedMethodsChanged(async (event) => {
|
||||
if (event.dbUri === this.databaseItem.databaseUri.toString()) {
|
||||
await this.postMessage({
|
||||
t: "setModelEditorState",
|
||||
modifiedMethodSignatures: [...event.modifiedMethods],
|
||||
});
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
this.push(
|
||||
this.modelingEvents.onInProgressMethodsChanged(async (event) => {
|
||||
if (event.dbUri === this.databaseItem.databaseUri.toString()) {
|
||||
await this.postMessage({
|
||||
t: "setModelEditorState",
|
||||
inProgressMethodSignatures: Array.from(event.methods),
|
||||
});
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
this.push(
|
||||
this.modelingEvents.onProcessedByAutoModelMethodsChanged(
|
||||
async (event) => {
|
||||
if (event.dbUri === this.databaseItem.databaseUri.toString()) {
|
||||
await this.postMessage({
|
||||
t: "setModelEditorState",
|
||||
processedByAutoModelMethodSignatures: Array.from(event.methods),
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
this.push(
|
||||
this.modelingEvents.onRevealInModelEditor(async (event) => {
|
||||
if (event.dbUri === this.databaseItem.databaseUri.toString()) {
|
||||
|
|
|
@ -6,11 +6,15 @@ import type { Method, Usage } from "./method";
|
|||
import type { ModeledMethod } from "./modeled-method";
|
||||
import type { Mode } from "./shared/mode";
|
||||
|
||||
interface MethodsChangedEvent {
|
||||
readonly methods: readonly Method[];
|
||||
interface ModelingStateChangedEvent {
|
||||
readonly dbUri: string;
|
||||
readonly databaseItem: DatabaseItem;
|
||||
readonly isActiveDb: boolean;
|
||||
readonly methods?: readonly Method[];
|
||||
readonly modeledMethods?: Readonly<Record<string, ModeledMethod[]>>;
|
||||
readonly modifiedMethodSignatures?: ReadonlySet<string>;
|
||||
readonly inProgressMethodSignatures?: ReadonlySet<string>;
|
||||
readonly processedByAutoModelMethodSignatures?: ReadonlySet<string>;
|
||||
}
|
||||
|
||||
interface HideModeledMethodsChangedEvent {
|
||||
|
@ -23,19 +27,6 @@ interface ModeChangedEvent {
|
|||
readonly isActiveDb: boolean;
|
||||
}
|
||||
|
||||
interface ModeledMethodsChangedEvent {
|
||||
readonly modeledMethods: Readonly<Record<string, ModeledMethod[]>>;
|
||||
readonly modifiedMethodSignatures: ReadonlySet<string>;
|
||||
readonly dbUri: string;
|
||||
readonly isActiveDb: boolean;
|
||||
}
|
||||
|
||||
interface ModifiedMethodsChangedEvent {
|
||||
readonly modifiedMethods: ReadonlySet<string>;
|
||||
readonly dbUri: string;
|
||||
readonly isActiveDb: boolean;
|
||||
}
|
||||
|
||||
interface SelectedMethodChangedEvent {
|
||||
readonly databaseItem: DatabaseItem;
|
||||
readonly method: Method;
|
||||
|
@ -46,16 +37,6 @@ interface SelectedMethodChangedEvent {
|
|||
readonly processedByAutoModel: boolean;
|
||||
}
|
||||
|
||||
interface InProgressMethodsChangedEvent {
|
||||
readonly dbUri: string;
|
||||
readonly methods: ReadonlySet<string>;
|
||||
}
|
||||
|
||||
interface ProcessedByAutoModelMethodsChangedEvent {
|
||||
readonly dbUri: string;
|
||||
readonly methods: ReadonlySet<string>;
|
||||
}
|
||||
|
||||
interface RevealInModelEditorEvent {
|
||||
dbUri: string;
|
||||
method: Method;
|
||||
|
@ -69,28 +50,20 @@ export class ModelingEvents extends DisposableObject {
|
|||
public readonly onActiveDbChanged: AppEvent<void>;
|
||||
public readonly onDbOpened: AppEvent<DatabaseItem>;
|
||||
public readonly onDbClosed: AppEvent<string>;
|
||||
public readonly onMethodsChanged: AppEvent<MethodsChangedEvent>;
|
||||
public readonly onModelingStateChanged: AppEvent<ModelingStateChangedEvent>;
|
||||
public readonly onHideModeledMethodsChanged: AppEvent<HideModeledMethodsChangedEvent>;
|
||||
public readonly onModeChanged: AppEvent<ModeChangedEvent>;
|
||||
public readonly onModeledMethodsChanged: AppEvent<ModeledMethodsChangedEvent>;
|
||||
public readonly onModifiedMethodsChanged: AppEvent<ModifiedMethodsChangedEvent>;
|
||||
public readonly onSelectedMethodChanged: AppEvent<SelectedMethodChangedEvent>;
|
||||
public readonly onInProgressMethodsChanged: AppEvent<InProgressMethodsChangedEvent>;
|
||||
public readonly onProcessedByAutoModelMethodsChanged: AppEvent<ProcessedByAutoModelMethodsChangedEvent>;
|
||||
public readonly onRevealInModelEditor: AppEvent<RevealInModelEditorEvent>;
|
||||
public readonly onFocusModelEditor: AppEvent<FocusModelEditorEvent>;
|
||||
|
||||
private readonly onActiveDbChangedEventEmitter: AppEventEmitter<void>;
|
||||
private readonly onDbOpenedEventEmitter: AppEventEmitter<DatabaseItem>;
|
||||
private readonly onDbClosedEventEmitter: AppEventEmitter<string>;
|
||||
private readonly onMethodsChangedEventEmitter: AppEventEmitter<MethodsChangedEvent>;
|
||||
private readonly onModelingStateChangedEventEmitter: AppEventEmitter<ModelingStateChangedEvent>;
|
||||
private readonly onHideModeledMethodsChangedEventEmitter: AppEventEmitter<HideModeledMethodsChangedEvent>;
|
||||
private readonly onModeChangedEventEmitter: AppEventEmitter<ModeChangedEvent>;
|
||||
private readonly onModeledMethodsChangedEventEmitter: AppEventEmitter<ModeledMethodsChangedEvent>;
|
||||
private readonly onModifiedMethodsChangedEventEmitter: AppEventEmitter<ModifiedMethodsChangedEvent>;
|
||||
private readonly onSelectedMethodChangedEventEmitter: AppEventEmitter<SelectedMethodChangedEvent>;
|
||||
private readonly onInProgressMethodsChangedEventEmitter: AppEventEmitter<InProgressMethodsChangedEvent>;
|
||||
private readonly onProcessedByAutoModelMethodsChangedEventEmitter: AppEventEmitter<ProcessedByAutoModelMethodsChangedEvent>;
|
||||
private readonly onRevealInModelEditorEventEmitter: AppEventEmitter<RevealInModelEditorEvent>;
|
||||
private readonly onFocusModelEditorEventEmitter: AppEventEmitter<FocusModelEditorEvent>;
|
||||
|
||||
|
@ -110,10 +83,10 @@ export class ModelingEvents extends DisposableObject {
|
|||
this.onDbClosedEventEmitter = this.push(app.createEventEmitter<string>());
|
||||
this.onDbClosed = this.onDbClosedEventEmitter.event;
|
||||
|
||||
this.onMethodsChangedEventEmitter = this.push(
|
||||
app.createEventEmitter<MethodsChangedEvent>(),
|
||||
this.onModelingStateChangedEventEmitter = this.push(
|
||||
app.createEventEmitter<ModelingStateChangedEvent>(),
|
||||
);
|
||||
this.onMethodsChanged = this.onMethodsChangedEventEmitter.event;
|
||||
this.onModelingStateChanged = this.onModelingStateChangedEventEmitter.event;
|
||||
|
||||
this.onHideModeledMethodsChangedEventEmitter = this.push(
|
||||
app.createEventEmitter<HideModeledMethodsChangedEvent>(),
|
||||
|
@ -126,36 +99,12 @@ export class ModelingEvents extends DisposableObject {
|
|||
);
|
||||
this.onModeChanged = this.onModeChangedEventEmitter.event;
|
||||
|
||||
this.onModeledMethodsChangedEventEmitter = this.push(
|
||||
app.createEventEmitter<ModeledMethodsChangedEvent>(),
|
||||
);
|
||||
this.onModeledMethodsChanged =
|
||||
this.onModeledMethodsChangedEventEmitter.event;
|
||||
|
||||
this.onModifiedMethodsChangedEventEmitter = this.push(
|
||||
app.createEventEmitter<ModifiedMethodsChangedEvent>(),
|
||||
);
|
||||
this.onModifiedMethodsChanged =
|
||||
this.onModifiedMethodsChangedEventEmitter.event;
|
||||
|
||||
this.onSelectedMethodChangedEventEmitter = this.push(
|
||||
app.createEventEmitter<SelectedMethodChangedEvent>(),
|
||||
);
|
||||
this.onSelectedMethodChanged =
|
||||
this.onSelectedMethodChangedEventEmitter.event;
|
||||
|
||||
this.onInProgressMethodsChangedEventEmitter = this.push(
|
||||
app.createEventEmitter<InProgressMethodsChangedEvent>(),
|
||||
);
|
||||
this.onInProgressMethodsChanged =
|
||||
this.onInProgressMethodsChangedEventEmitter.event;
|
||||
|
||||
this.onProcessedByAutoModelMethodsChangedEventEmitter = this.push(
|
||||
app.createEventEmitter<ProcessedByAutoModelMethodsChangedEvent>(),
|
||||
);
|
||||
this.onProcessedByAutoModelMethodsChanged =
|
||||
this.onProcessedByAutoModelMethodsChangedEventEmitter.event;
|
||||
|
||||
this.onRevealInModelEditorEventEmitter = this.push(
|
||||
app.createEventEmitter<RevealInModelEditorEvent>(),
|
||||
);
|
||||
|
@ -179,18 +128,8 @@ export class ModelingEvents extends DisposableObject {
|
|||
this.onDbClosedEventEmitter.fire(dbUri);
|
||||
}
|
||||
|
||||
public fireMethodsChangedEvent(
|
||||
methods: Method[],
|
||||
dbUri: string,
|
||||
databaseItem: DatabaseItem,
|
||||
isActiveDb: boolean,
|
||||
) {
|
||||
this.onMethodsChangedEventEmitter.fire({
|
||||
methods,
|
||||
databaseItem,
|
||||
dbUri,
|
||||
isActiveDb,
|
||||
});
|
||||
public fireModelingStateChangedEvent(event: ModelingStateChangedEvent) {
|
||||
this.onModelingStateChangedEventEmitter.fire(event);
|
||||
}
|
||||
|
||||
public fireHideModeledMethodsChangedEvent(
|
||||
|
@ -210,32 +149,6 @@ 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,
|
||||
});
|
||||
}
|
||||
|
||||
public fireModifiedMethodsChangedEvent(
|
||||
modifiedMethods: ReadonlySet<string>,
|
||||
dbUri: string,
|
||||
isActiveDb: boolean,
|
||||
) {
|
||||
this.onModifiedMethodsChangedEventEmitter.fire({
|
||||
modifiedMethods,
|
||||
dbUri,
|
||||
isActiveDb,
|
||||
});
|
||||
}
|
||||
|
||||
public fireSelectedMethodChangedEvent(
|
||||
databaseItem: DatabaseItem,
|
||||
method: Method,
|
||||
|
@ -256,26 +169,6 @@ export class ModelingEvents extends DisposableObject {
|
|||
});
|
||||
}
|
||||
|
||||
public fireInProgressMethodsChangedEvent(
|
||||
dbUri: string,
|
||||
methods: ReadonlySet<string>,
|
||||
) {
|
||||
this.onInProgressMethodsChangedEventEmitter.fire({
|
||||
dbUri,
|
||||
methods,
|
||||
});
|
||||
}
|
||||
|
||||
public fireProcessedByAutoModelMethodsChangedEvent(
|
||||
dbUri: string,
|
||||
methods: ReadonlySet<string>,
|
||||
) {
|
||||
this.onProcessedByAutoModelMethodsChangedEventEmitter.fire({
|
||||
dbUri,
|
||||
methods,
|
||||
});
|
||||
}
|
||||
|
||||
public fireRevealInModelEditorEvent(dbUri: string, method: Method) {
|
||||
this.onRevealInModelEditorEventEmitter.fire({
|
||||
dbUri,
|
||||
|
|
|
@ -156,12 +156,12 @@ export class ModelingStore extends DisposableObject {
|
|||
|
||||
dbState.methods = [...methods];
|
||||
|
||||
this.modelingEvents.fireMethodsChangedEvent(
|
||||
methods,
|
||||
this.modelingEvents.fireModelingStateChangedEvent({
|
||||
dbUri,
|
||||
dbItem,
|
||||
dbUri === this.activeDb,
|
||||
);
|
||||
databaseItem: dbItem,
|
||||
isActiveDb: dbUri === this.activeDb,
|
||||
methods,
|
||||
});
|
||||
}
|
||||
|
||||
public setHideModeledMethods(
|
||||
|
@ -408,11 +408,12 @@ export class ModelingStore extends DisposableObject {
|
|||
|
||||
updateState(state);
|
||||
|
||||
this.modelingEvents.fireModifiedMethodsChangedEvent(
|
||||
state.modifiedMethodSignatures,
|
||||
dbItem.databaseUri.toString(),
|
||||
dbItem.databaseUri.toString() === this.activeDb,
|
||||
);
|
||||
this.modelingEvents.fireModelingStateChangedEvent({
|
||||
dbUri: dbItem.databaseUri.toString(),
|
||||
databaseItem: dbItem,
|
||||
isActiveDb: dbItem.databaseUri.toString() === this.activeDb,
|
||||
modifiedMethodSignatures: state.modifiedMethodSignatures,
|
||||
});
|
||||
}
|
||||
|
||||
private changeModeledMethods(
|
||||
|
@ -423,12 +424,13 @@ export class ModelingStore extends DisposableObject {
|
|||
|
||||
updateState(state);
|
||||
|
||||
this.modelingEvents.fireModeledMethodsChangedEvent(
|
||||
state.modeledMethods,
|
||||
state.modifiedMethodSignatures,
|
||||
dbItem.databaseUri.toString(),
|
||||
dbItem.databaseUri.toString() === this.activeDb,
|
||||
);
|
||||
this.modelingEvents.fireModelingStateChangedEvent({
|
||||
dbUri: dbItem.databaseUri.toString(),
|
||||
databaseItem: dbItem,
|
||||
isActiveDb: dbItem.databaseUri.toString() === this.activeDb,
|
||||
modeledMethods: state.modeledMethods,
|
||||
modifiedMethodSignatures: state.modifiedMethodSignatures,
|
||||
});
|
||||
}
|
||||
|
||||
private changeInProgressMethods(
|
||||
|
@ -439,10 +441,12 @@ export class ModelingStore extends DisposableObject {
|
|||
|
||||
updateState(state);
|
||||
|
||||
this.modelingEvents.fireInProgressMethodsChangedEvent(
|
||||
dbItem.databaseUri.toString(),
|
||||
state.inProgressMethods,
|
||||
);
|
||||
this.modelingEvents.fireModelingStateChangedEvent({
|
||||
dbUri: dbItem.databaseUri.toString(),
|
||||
databaseItem: dbItem,
|
||||
isActiveDb: dbItem.databaseUri.toString() === this.activeDb,
|
||||
inProgressMethodSignatures: state.inProgressMethods,
|
||||
});
|
||||
}
|
||||
|
||||
private changeProcessedByAutoModelMethods(
|
||||
|
@ -453,9 +457,11 @@ export class ModelingStore extends DisposableObject {
|
|||
|
||||
updateState(state);
|
||||
|
||||
this.modelingEvents.fireProcessedByAutoModelMethodsChangedEvent(
|
||||
dbItem.databaseUri.toString(),
|
||||
state.processedByAutoModelMethods,
|
||||
);
|
||||
this.modelingEvents.fireModelingStateChangedEvent({
|
||||
dbUri: dbItem.databaseUri.toString(),
|
||||
databaseItem: dbItem,
|
||||
isActiveDb: dbItem.databaseUri.toString() === this.activeDb,
|
||||
processedByAutoModelMethodSignatures: state.processedByAutoModelMethods,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,38 +4,26 @@ import type { ModelingEvents } from "../../../src/model-editor/modeling-events";
|
|||
export function createMockModelingEvents({
|
||||
onActiveDbChanged = jest.fn(),
|
||||
onDbClosed = jest.fn(),
|
||||
onMethodsChanged = jest.fn(),
|
||||
onModelingStateChanged = jest.fn(),
|
||||
onHideModeledMethodsChanged = jest.fn(),
|
||||
onModeChanged = jest.fn(),
|
||||
onModeledMethodsChanged = jest.fn(),
|
||||
onModifiedMethodsChanged = jest.fn(),
|
||||
onInProgressMethodsChanged = jest.fn(),
|
||||
onProcessedByAutoModelMethodsChanged = jest.fn(),
|
||||
onRevealInModelEditor = jest.fn(),
|
||||
onFocusModelEditor = jest.fn(),
|
||||
}: {
|
||||
onActiveDbChanged?: ModelingEvents["onActiveDbChanged"];
|
||||
onDbClosed?: ModelingEvents["onDbClosed"];
|
||||
onMethodsChanged?: ModelingEvents["onMethodsChanged"];
|
||||
onModelingStateChanged?: ModelingEvents["onModelingStateChanged"];
|
||||
onHideModeledMethodsChanged?: ModelingEvents["onHideModeledMethodsChanged"];
|
||||
onModeChanged?: ModelingEvents["onModeChanged"];
|
||||
onModeledMethodsChanged?: ModelingEvents["onModeledMethodsChanged"];
|
||||
onModifiedMethodsChanged?: ModelingEvents["onModifiedMethodsChanged"];
|
||||
onInProgressMethodsChanged?: ModelingEvents["onInProgressMethodsChanged"];
|
||||
onProcessedByAutoModelMethodsChanged?: ModelingEvents["onProcessedByAutoModelMethodsChanged"];
|
||||
onRevealInModelEditor?: ModelingEvents["onRevealInModelEditor"];
|
||||
onFocusModelEditor?: ModelingEvents["onFocusModelEditor"];
|
||||
} = {}): ModelingEvents {
|
||||
return mockedObject<ModelingEvents>({
|
||||
onActiveDbChanged,
|
||||
onDbClosed,
|
||||
onMethodsChanged,
|
||||
onModelingStateChanged,
|
||||
onHideModeledMethodsChanged,
|
||||
onModeChanged,
|
||||
onModeledMethodsChanged,
|
||||
onModifiedMethodsChanged,
|
||||
onInProgressMethodsChanged,
|
||||
onProcessedByAutoModelMethodsChanged,
|
||||
onRevealInModelEditor,
|
||||
onFocusModelEditor,
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче