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:
zzj3720
2025-05-28 11:10:33 +00:00
parent 9a651a5b53
commit 9f0d4536c7
2 changed files with 13 additions and 4 deletions
@@ -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) => {
popFilterableSimpleMenu(
popupTargetFromElement(event.currentTarget as HTMLElement),
@@ -82,8 +90,7 @@ export class DataViewHeaderViews extends WidgetBase {
name: v.model.defaultName,
prefix: html`<uni-lit .uni=${v.renderer.icon}></uni-lit>`,
select: () => {
const id = this.viewManager.viewAdd(v.type);
this.viewManager.setCurrentView(id);
this.addView(v.type);
},
});
})
@@ -135,8 +142,7 @@ export class DataViewHeaderViews extends WidgetBase {
hide: () => this.readonly,
prefix: PlusIcon(),
select: () => {
const id = this.viewManager.viewAdd(v.type);
this.viewManager.setCurrentView(id);
this.addView(v.type);
},
});
}),
@@ -45,6 +45,9 @@ export type DatabaseGroupEvents = {
export type DatabaseEvents = {
AddDatabase: {};
AddDatabaseView: {
type: string;
};
};
export interface DatabaseAllSortEvents {