Skip to content

Commit

Permalink
chore: Update activeIndex value in RunDetailsGraph to setActiveIndex(…
Browse files Browse the repository at this point in the history
…RunDetailsTab.Logs)
  • Loading branch information
atardadi committed Jun 3, 2024
1 parent 5cb8326 commit 4bbb8d1
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 23 deletions.
2 changes: 1 addition & 1 deletion web/src/RunDetails/RunDetailsGraph/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function RunDetailsGraph({
emptyMessage="No lineage data available. Please refresh the page to try again."
onNodeMenuClick={(p) => {
p.menuId === NodeMenuId.ShowError &&
setActiveIndex(RunDetailsTab.Issues);
setActiveIndex(RunDetailsTab.Logs);
}}
isFilterByPipelineEnabled={false}
/>
Expand Down
7 changes: 0 additions & 7 deletions web/src/RunDetails/RunDetailsModels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { LARGE_FONT_SIZE } from "../constants/style-units";
import { useContext, useEffect, useState } from "react";
import { MainContext } from "../Main";
import { MainActionType } from "../main.redux";
import { AnalyticsEvent, trackEvent } from "../services/analytics";

const StyledRunDetailsModels = styled.div``;

Expand All @@ -32,12 +31,6 @@ function RunDetailsModels({
const [runningModels, setRunningModels] = useState<string[]>([]);
const [, mainDispatch] = useContext(MainContext);

useEffect(() => {
trackEvent({
eventName: AnalyticsEvent.UserViewedRunDetailsModels,
});
}, []);

useEffect(() => {
const allRunningModels = (runData?.getRunById?.modelRunsDetails ?? []).map(
(m) => m.name
Expand Down
7 changes: 0 additions & 7 deletions web/src/RunDetails/RunLog/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import styled from "styled-components";
import LogViewer from "../../stories/LogViewer";
import { AnalyticsEvent, trackEvent } from "../../services/analytics";
import { useEffect } from "react";

type RunLogProps = {
dbtLog: string;
Expand All @@ -14,11 +12,6 @@ const StyledRunLog = styled.div`
`;

function RunLog({ dbtLog }: Readonly<RunLogProps>) {
useEffect(() => {
trackEvent({
eventName: AnalyticsEvent.UserViewedRunLogs,
});
}, []);
return (
<StyledRunLog>
<LogViewer log={dbtLog ?? ""} />
Expand Down
3 changes: 1 addition & 2 deletions web/src/RunDetails/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,7 @@ export function getModelRunStatusMap(
export enum RunDetailsTab {
Pipeline,
Models,
Validations,
Issues,
Logs,
}

export const ValidationNameToLabelMap: Record<DbtRunTestErrorType, string> = {
Expand Down
17 changes: 11 additions & 6 deletions web/src/RunDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ function RunDetails() {
!runData?.getRunById?.status ||
runData?.getRunById?.status === GenericStatus.in_progress;

useEffect(() => {
trackEvent({
eventName:
activeIndex === RunDetailsTab.Pipeline
? AnalyticsEvent.UserViewedRunDetailsGraph
: activeIndex === RunDetailsTab.Logs
? AnalyticsEvent.UserViewedRunLogs
: AnalyticsEvent.UserViewedRunDetailsModels,
});
}, [activeIndex]);

useEffect(() => {
async function getRunResultsJson() {
if (isInProgressRun) {
Expand Down Expand Up @@ -90,12 +101,6 @@ function RunDetails() {
getRunResultsJson();
}, [isInProgressRun, runData]);

useEffect(() => {
trackEvent({
eventName: AnalyticsEvent.UserViewedRunDetailsGraph,
});
}, []);

useEffect(() => {
const interval = setInterval(async () => {
if (!isInProgressRun) return;
Expand Down

0 comments on commit 4bbb8d1

Please sign in to comment.