Skip to content

Commit

Permalink
♻️ : Disable GMT Logging on Web
Browse files Browse the repository at this point in the history
  • Loading branch information
sasamuku committed Dec 26, 2024
1 parent aae03f0 commit ccc2004
Show file tree
Hide file tree
Showing 11 changed files with 102 additions and 96 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ export const CopyLinkButton: FC = () => {
})
})

clickLogEvent({
element: 'copyLinkButton',
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
}, [toast, cliVersion.version, cliVersion.envName])
cliVersion.displayedOn === 'cli' &&
clickLogEvent({
element: 'copyLinkButton',
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
}, [toast, cliVersion])

return (
<TooltipProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,15 @@ export const ERDContentInner: FC<Props> = ({
const handleNodeClick = useCallback(
(tableId: string) => {
updateActiveTableName(tableId)
selectTableLogEvent({
ref: 'mainArea',
tableId,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
cliVersion.displayedOn === 'cli' &&
selectTableLogEvent({
ref: 'mainArea',
tableId,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
},
[cliVersion.version, cliVersion.envName],
[cliVersion],
)

const handlePaneClick = useCallback(() => {
Expand Down Expand Up @@ -115,15 +116,16 @@ export const ERDContentInner: FC<Props> = ({
const operationId = `id_${new Date().getTime()}`
for (const node of nodes) {
const tableId = node.id
repositionTableLogEvent({
tableId,
operationId,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
cliVersion.displayedOn === 'cli' &&
repositionTableLogEvent({
tableId,
operationId,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
}
},
[cliVersion.version, cliVersion.envName],
[cliVersion],
)

const panOnDrag = [1, 2]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ export const RelatedTables: FC<Props> = ({ table }) => {

replaceHiddenNodeIds(hiddenNodeIds)
updateActiveTableName(undefined)
openRelatedTablesLogEvent({
tableId: table.name,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
}, [nodes, getNodes, table.name, cliVersion.version, cliVersion.envName])
cliVersion.displayedOn === 'cli' &&
openRelatedTablesLogEvent({
tableId: table.name,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
}, [nodes, getNodes, table.name, cliVersion])

return (
<div className={styles.wrapper}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ type Props = {
export const TableDetail: FC<Props> = ({ table }) => {
const { cliVersion } = useCliVersion()
const handleDrawerClose = () => {
clickLogEvent({
element: 'closeTableDetailButton',
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
cliVersion.displayedOn === 'cli' &&
clickLogEvent({
element: 'closeTableDetailButton',
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ export const FitviewButton: FC = () => {
const { cliVersion } = useCliVersion()

const handleClick = useCallback(() => {
toolbarActionLogEvent({
element: 'fitview',
showMode,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
cliVersion.displayedOn === 'cli' &&
toolbarActionLogEvent({
element: 'fitview',
showMode,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
fitView()
}, [fitView, showMode, cliVersion.version, cliVersion.envName])
}, [fitView, showMode, cliVersion])

return (
<ToolbarButton asChild onClick={handleClick}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,16 @@ export const ShowModeMenu: FC = () => {
if (parsed.success) {
updateShowMode(parsed.output)

toolbarActionLogEvent({
element: 'changeShowMode',
showMode: value,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
cliVersion.displayedOn === 'cli' &&
toolbarActionLogEvent({
element: 'changeShowMode',
showMode: value,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
}
},
[cliVersion.version, cliVersion.envName],
[cliVersion],
)

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,15 @@ export const TidyUpButton: FC = () => {
const { showMode } = useUserEditingStore()
const { cliVersion } = useCliVersion()
const handleClick = useCallback(() => {
toolbarActionLogEvent({
element: 'tidyUp',
showMode,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
cliVersion.displayedOn === 'cli' &&
toolbarActionLogEvent({
element: 'tidyUp',
showMode,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
handleLayout(getNodes(), getEdges())
}, [
handleLayout,
showMode,
getNodes,
getEdges,
cliVersion.version,
cliVersion.envName,
])
}, [handleLayout, showMode, getNodes, getEdges, cliVersion])

return (
<ToolbarButton asChild>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,28 @@ export const ZoomControls: FC = () => {
const { cliVersion } = useCliVersion()

const handleClickZoomOut = useCallback(() => {
toolbarActionLogEvent({
element: 'zoom',
zoomLevel: zoomLevel.toFixed(2),
showMode,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
cliVersion.displayedOn === 'cli' &&
toolbarActionLogEvent({
element: 'zoom',
zoomLevel: zoomLevel.toFixed(2),
showMode,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
zoomOut()
}, [zoomOut, zoomLevel, showMode, cliVersion.version, cliVersion.envName])
}, [zoomOut, zoomLevel, showMode, cliVersion])

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

return (
<div className={styles.wrapper}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ export const ERDRenderer: FC<Props> = ({ defaultSidebarOpen = false }) => {
const handleChangeOpen = useCallback(
(open: boolean) => {
setOpen(open)
toggleLogEvent({
element: 'leftPane',
isShow: open,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
cliVersion.displayedOn === 'cli' &&
toggleLogEvent({
element: 'leftPane',
isShow: open,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
},
[cliVersion.version, cliVersion.envName],
[cliVersion],
)

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ export const TableNameMenuButton: FC<Props> = ({ node }) => {
const { cliVersion } = useCliVersion()
const handleClickMenuButton = (tableId: string) => () => {
updateActiveTableName(tableId)
selectTableLogEvent({
ref: 'leftPane',
tableId,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
cliVersion.displayedOn === 'cli' &&
selectTableLogEvent({
ref: 'leftPane',
tableId,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ export const VisibilityButton: FC<Props> = ({ tableName, hidden }) => {
(event: MouseEvent) => {
event.stopPropagation()
toggleHiddenNodeId(tableName)
toggleLogEvent({
element: 'tableNameMenuButton',
isShow: !!hidden,
tableId: tableName,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
cliVersion.displayedOn === 'cli' &&
toggleLogEvent({
element: 'tableNameMenuButton',
isShow: !!hidden,
tableId: tableName,
cliVer: cliVersion.version,
appEnv: cliVersion.envName,
})
},
[tableName, hidden, cliVersion.version, cliVersion.envName],
[tableName, hidden, cliVersion],
)

return (
Expand Down

0 comments on commit ccc2004

Please sign in to comment.