feat(editor): add view event tracking (#12602)
close: BS-3567 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Improved the process for adding new views by centralizing related logic, resulting in a more streamlined and consistent user experience. - **Chores** - Enhanced event tracking for database views to support better analytics. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -74,6 +74,14 @@ export class DataViewHeaderViews extends WidgetBase {
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
private addView(type: string) {
|
||||||
|
const id = this.viewManager.viewAdd(type);
|
||||||
|
this.viewManager.setCurrentView(id);
|
||||||
|
this.dataViewLogic.root.config.eventTrace('AddDatabaseView', {
|
||||||
|
type: type,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
_addViewMenu = (event: MouseEvent) => {
|
_addViewMenu = (event: MouseEvent) => {
|
||||||
popFilterableSimpleMenu(
|
popFilterableSimpleMenu(
|
||||||
popupTargetFromElement(event.currentTarget as HTMLElement),
|
popupTargetFromElement(event.currentTarget as HTMLElement),
|
||||||
@@ -82,8 +90,7 @@ export class DataViewHeaderViews extends WidgetBase {
|
|||||||
name: v.model.defaultName,
|
name: v.model.defaultName,
|
||||||
prefix: html`<uni-lit .uni=${v.renderer.icon}></uni-lit>`,
|
prefix: html`<uni-lit .uni=${v.renderer.icon}></uni-lit>`,
|
||||||
select: () => {
|
select: () => {
|
||||||
const id = this.viewManager.viewAdd(v.type);
|
this.addView(v.type);
|
||||||
this.viewManager.setCurrentView(id);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
@@ -135,8 +142,7 @@ export class DataViewHeaderViews extends WidgetBase {
|
|||||||
hide: () => this.readonly,
|
hide: () => this.readonly,
|
||||||
prefix: PlusIcon(),
|
prefix: PlusIcon(),
|
||||||
select: () => {
|
select: () => {
|
||||||
const id = this.viewManager.viewAdd(v.type);
|
this.addView(v.type);
|
||||||
this.viewManager.setCurrentView(id);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ export type DatabaseGroupEvents = {
|
|||||||
|
|
||||||
export type DatabaseEvents = {
|
export type DatabaseEvents = {
|
||||||
AddDatabase: {};
|
AddDatabase: {};
|
||||||
|
AddDatabaseView: {
|
||||||
|
type: string;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface DatabaseAllSortEvents {
|
export interface DatabaseAllSortEvents {
|
||||||
|
|||||||
Reference in New Issue
Block a user