Skip to content

Commit

Permalink
📈 add appEnv parameter to logging events for environment tracking.
Browse files Browse the repository at this point in the history
  • Loading branch information
FunamaYukina committed Dec 20, 2024
1 parent 5060068 commit 6392dc5
Show file tree
Hide file tree
Showing 18 changed files with 49 additions and 13 deletions.
6 changes: 6 additions & 0 deletions frontend/.changeset/mean-eels-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@liam-hq/erd-core": patch
"@liam-hq/cli": patch
---

📈 Add appEnv parameter to logging events for environment tracking
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ export const CopyLinkButton: FC = () => {
clickLogEvent({
element: 'copyLinkButton',
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
}, [toast, cliVersion.version])
}, [toast, cliVersion.version, cliVersion.envName])

return (
<TooltipProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ export const ERDContentInner: FC<Props> = ({
ref: 'mainArea',
tableId,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
},
[cliVersion.version],
[cliVersion.version, cliVersion.envName],
)

const handlePaneClick = useCallback(() => {
Expand Down Expand Up @@ -137,10 +138,11 @@ export const ERDContentInner: FC<Props> = ({
tableId,
operationId,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
}
},
[cliVersion.version],
[cliVersion.version, cliVersion.envName],
)

const panOnDrag = [1, 2]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ export const RelatedTables: FC<Props> = ({ table }) => {
openRelatedTablesLogEvent({
tableId: table.name,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
}, [nodes, getNodes, table.name, cliVersion.version])
}, [nodes, getNodes, table.name, cliVersion.version, cliVersion.envName])

return (
<div className={styles.wrapper}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const TableDetail: FC<Props> = ({ table }) => {
clickLogEvent({
element: 'closeTableDetailButton',
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ export const FitviewButton: FC = () => {
element: 'fitview',
showMode,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
fitView()
}, [fitView, showMode, cliVersion.version])
}, [fitView, showMode, cliVersion.version, cliVersion.envName])

return (
<ToolbarButton asChild onClick={handleClick}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ export const ShowModeMenu: FC = () => {
element: 'changeShowMode',
showMode: value,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
}
},
[cliVersion.version],
[cliVersion.version, cliVersion.envName],
)

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ export const TidyUpButton: FC = () => {
element: 'tidyUp',
showMode,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
handleLayout(getNodes())
}, [handleLayout, showMode, getNodes, cliVersion.version])
}, [handleLayout, showMode, getNodes, cliVersion.version, cliVersion.envName])

return (
<ToolbarButton asChild>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,21 @@ export const ZoomControls: FC = () => {
zoomLevel: zoomLevel.toFixed(2),
showMode,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
zoomOut()
}, [zoomOut, zoomLevel, showMode, cliVersion.version])
}, [zoomOut, zoomLevel, showMode, cliVersion.version, cliVersion.envName])

const handleClickZoomIn = useCallback(() => {
toolbarActionLogEvent({
element: 'zoom',
zoomLevel: zoomLevel.toFixed(2),
showMode: showMode,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
zoomIn()
}, [zoomIn, zoomLevel, showMode, cliVersion.version])
}, [zoomIn, zoomLevel, showMode, cliVersion.version, cliVersion.envName])

return (
<div className={styles.wrapper}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ export const ERDRenderer: FC = () => {
element: 'leftPane',
isShow: open,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
},
[cliVersion.version],
[cliVersion.version, cliVersion.envName],
)

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const TableNameMenuButton: FC<Props> = ({ node }) => {
ref: 'leftPane',
tableId,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ export const VisibilityButton: FC<Props> = ({ tableName, hidden }) => {
isShow: !!hidden,
tableId: tableName,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
},
[tableName, hidden, cliVersion.version],
[tableName, hidden, cliVersion.version, cliVersion.envName],
)

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import { pushToDataLayer } from './pushToDataLayer'
type ClickLogEvent = {
element: string
cliVer: string
appEnv: string
}

export const clickLogEvent = ({ element, cliVer }: ClickLogEvent) => {
export const clickLogEvent = ({ element, cliVer, appEnv }: ClickLogEvent) => {
pushToDataLayer({
event: 'click',
element,
cliVer,
appEnv,
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ import { pushToDataLayer } from './pushToDataLayer'
type OpenRelatedTablesLogEvent = {
tableId: string
cliVer: string
appEnv: string
}

export const openRelatedTablesLogEvent = ({
tableId,
cliVer,
appEnv,
}: OpenRelatedTablesLogEvent) => {
pushToDataLayer({
event: 'openRelatedTables',
tableId,
cliVer,
appEnv,
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@ type RepositionTable = {
tableId: string
operationId: string
cliVer: string
appEnv: string
}

export const repositionTableLogEvent = ({
tableId,
operationId,
cliVer,
appEnv,
}: RepositionTable) => {
pushToDataLayer({
event: 'repositionTable',
tableId,
operationId,
cliVer,
appEnv,
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@ type SelectTable = {
ref: 'leftPane' | 'mainArea'
tableId: string
cliVer: string
appEnv: string
}

export const selectTableLogEvent = ({ ref, tableId, cliVer }: SelectTable) => {
export const selectTableLogEvent = ({
ref,
tableId,
cliVer,
appEnv,
}: SelectTable) => {
pushToDataLayer({
event: 'selectTable',
ref,
tableId,
cliVer,
appEnv,
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ type ToggleLogEvent = {
isShow: boolean
tableId?: string
cliVer: string
appEnv: string
}

export const toggleLogEvent = (params: ToggleLogEvent) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ type ToolbarActionLogEvent = {
zoomLevel?: string
showMode?: string
cliVer: string
appEnv: string
}

export const toolbarActionLogEvent = ({
Expand Down

0 comments on commit 6392dc5

Please sign in to comment.