Traces: Remove noop functions (#70392)

Remove unused functions
This commit is contained in:
Joey 2023-06-21 14:49:04 +01:00 committed by GitHub
parent ee73d41d24
commit 8f7e1f36ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 1 additions and 27 deletions

View File

@ -121,7 +121,6 @@ export function TraceView(props: Props) {
childrenHiddenIDs, childrenHiddenIDs,
detailStates, detailStates,
hoverIndentGuideIds, hoverIndentGuideIds,
shouldScrollToFirstUiFindMatch: false,
spanNameColumnWidth, spanNameColumnWidth,
traceID: props.traceProp?.traceID, traceID: props.traceProp?.traceID,
}), }),
@ -191,7 +190,6 @@ export function TraceView(props: Props) {
)} )}
<TraceTimelineViewer <TraceTimelineViewer
registerAccessors={noop} registerAccessors={noop}
scrollToFirstVisibleSpan={noop}
findMatchesIDs={config.featureToggles.newTraceViewHeader ? spanFilterMatches : spanFindMatches} findMatchesIDs={config.featureToggles.newTraceViewHeader ? spanFilterMatches : spanFindMatches}
trace={traceProp} trace={traceProp}
datasourceType={datasourceType} datasourceType={datasourceType}
@ -207,7 +205,6 @@ export function TraceView(props: Props) {
expandAll={expandAll} expandAll={expandAll}
expandOne={expandOne} expandOne={expandOne}
childrenToggle={childrenToggle} childrenToggle={childrenToggle}
clearShouldScrollToFirstUiFindMatch={noop}
detailLogItemToggle={detailLogItemToggle} detailLogItemToggle={detailLogItemToggle}
detailLogsToggle={detailLogsToggle} detailLogsToggle={detailLogsToggle}
detailWarningsToggle={detailWarningsToggle} detailWarningsToggle={detailWarningsToggle}

View File

@ -29,7 +29,6 @@ const topOfExploreViewRef = jest.fn();
let props = { let props = {
childrenHiddenIDs: new Set(), childrenHiddenIDs: new Set(),
childrenToggle: jest.fn(), childrenToggle: jest.fn(),
clearShouldScrollToFirstUiFindMatch: jest.fn(),
currentViewRangeTime: [0.25, 0.75], currentViewRangeTime: [0.25, 0.75],
detailLogItemToggle: jest.fn(), detailLogItemToggle: jest.fn(),
detailLogsToggle: jest.fn(), detailLogsToggle: jest.fn(),
@ -39,10 +38,8 @@ let props = {
detailToggle: jest.fn(), detailToggle: jest.fn(),
findMatchesIDs: null, findMatchesIDs: null,
registerAccessors: jest.fn(), registerAccessors: jest.fn(),
scrollToFirstVisibleSpan: jest.fn(),
setSpanNameColumnWidth: jest.fn(), setSpanNameColumnWidth: jest.fn(),
setTrace: jest.fn(), setTrace: jest.fn(),
shouldScrollToFirstUiFindMatch: false,
spanNameColumnWidth: 0.5, spanNameColumnWidth: 0.5,
trace, trace,
uiFind: 'uiFind', uiFind: 'uiFind',

View File

@ -87,13 +87,11 @@ type TVirtualizedTraceViewOwnProps = {
currentViewRangeTime: [number, number]; currentViewRangeTime: [number, number];
timeZone: TimeZone; timeZone: TimeZone;
findMatchesIDs: Set<string> | TNil; findMatchesIDs: Set<string> | TNil;
scrollToFirstVisibleSpan: () => void;
registerAccessors: (accesors: Accessors) => void; registerAccessors: (accesors: Accessors) => void;
trace: Trace; trace: Trace;
spanBarOptions: SpanBarOptions | undefined; spanBarOptions: SpanBarOptions | undefined;
linksGetter: (span: TraceSpan, items: TraceKeyValuePair[], itemIndex: number) => TraceLink[]; linksGetter: (span: TraceSpan, items: TraceKeyValuePair[], itemIndex: number) => TraceLink[];
childrenToggle: (spanID: string) => void; childrenToggle: (spanID: string) => void;
clearShouldScrollToFirstUiFindMatch: () => void;
detailLogItemToggle: (spanID: string, log: TraceLog) => void; detailLogItemToggle: (spanID: string, log: TraceLog) => void;
detailLogsToggle: (spanID: string) => void; detailLogsToggle: (spanID: string) => void;
detailWarningsToggle: (spanID: string) => void; detailWarningsToggle: (spanID: string) => void;
@ -224,14 +222,7 @@ export class UnthemedVirtualizedTraceView extends React.Component<VirtualizedTra
let key: keyof VirtualizedTraceViewProps; let key: keyof VirtualizedTraceViewProps;
for (key in nextProps) { for (key in nextProps) {
if (nextProps[key] !== this.props[key]) { if (nextProps[key] !== this.props[key]) {
// Unless the only change was props.shouldScrollToFirstUiFindMatch changing to false. return true;
if (key === 'shouldScrollToFirstUiFindMatch') {
if (nextProps[key]) {
return true;
}
} else {
return true;
}
} }
} }
return false; return false;
@ -240,9 +231,6 @@ export class UnthemedVirtualizedTraceView extends React.Component<VirtualizedTra
componentDidUpdate(prevProps: Readonly<VirtualizedTraceViewProps>) { componentDidUpdate(prevProps: Readonly<VirtualizedTraceViewProps>) {
const { registerAccessors, trace, headerHeight } = prevProps; const { registerAccessors, trace, headerHeight } = prevProps;
const { const {
shouldScrollToFirstUiFindMatch,
clearShouldScrollToFirstUiFindMatch,
scrollToFirstVisibleSpan,
registerAccessors: nextRegisterAccessors, registerAccessors: nextRegisterAccessors,
setTrace, setTrace,
trace: nextTrace, trace: nextTrace,
@ -259,11 +247,6 @@ export class UnthemedVirtualizedTraceView extends React.Component<VirtualizedTra
nextRegisterAccessors(this.getAccessors()); nextRegisterAccessors(this.getAccessors());
} }
if (shouldScrollToFirstUiFindMatch) {
scrollToFirstVisibleSpan();
clearShouldScrollToFirstUiFindMatch();
}
if (focusedSpanId !== prevProps.focusedSpanId) { if (focusedSpanId !== prevProps.focusedSpanId) {
this.scrollToSpan(headerHeight, focusedSpanId); this.scrollToSpan(headerHeight, focusedSpanId);
} }

View File

@ -74,7 +74,6 @@ const getStyles = stylesFactory((theme: GrafanaTheme2) => {
export type TProps = TExtractUiFindFromStateReturn & { export type TProps = TExtractUiFindFromStateReturn & {
registerAccessors: (accessors: Accessors) => void; registerAccessors: (accessors: Accessors) => void;
findMatchesIDs: Set<string> | TNil; findMatchesIDs: Set<string> | TNil;
scrollToFirstVisibleSpan: () => void;
traceTimeline: TTraceTimeline; traceTimeline: TTraceTimeline;
trace: Trace; trace: Trace;
datasourceType: string; datasourceType: string;
@ -91,7 +90,6 @@ export type TProps = TExtractUiFindFromStateReturn & {
expandOne: (spans: TraceSpan[]) => void; expandOne: (spans: TraceSpan[]) => void;
childrenToggle: (spanID: string) => void; childrenToggle: (spanID: string) => void;
clearShouldScrollToFirstUiFindMatch: () => void;
detailLogItemToggle: (spanID: string, log: TraceLog) => void; detailLogItemToggle: (spanID: string, log: TraceLog) => void;
detailLogsToggle: (spanID: string) => void; detailLogsToggle: (spanID: string) => void;
detailWarningsToggle: (spanID: string) => void; detailWarningsToggle: (spanID: string) => void;

View File

@ -20,7 +20,6 @@ type TTraceTimeline = {
childrenHiddenIDs: Set<string>; childrenHiddenIDs: Set<string>;
detailStates: Map<string, DetailState>; detailStates: Map<string, DetailState>;
hoverIndentGuideIds: Set<string>; hoverIndentGuideIds: Set<string>;
shouldScrollToFirstUiFindMatch: boolean;
spanNameColumnWidth: number; spanNameColumnWidth: number;
traceID: string | TNil; traceID: string | TNil;
}; };