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

View File

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

View File

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

View File

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

View File

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