diff --git a/packages/jaeger-ui/src/components/DeepDependencies/Graph/DdgNodeContent/__snapshots__/index.test.js.snap b/packages/jaeger-ui/src/components/DeepDependencies/Graph/DdgNodeContent/__snapshots__/index.test.js.snap index 2f367b384e..e09fde8198 100644 --- a/packages/jaeger-ui/src/components/DeepDependencies/Graph/DdgNodeContent/__snapshots__/index.test.js.snap +++ b/packages/jaeger-ui/src/components/DeepDependencies/Graph/DdgNodeContent/__snapshots__/index.test.js.snap @@ -3,8 +3,8 @@ exports[` DdgNodeContent.getNodeRenderer() returns a 1`] = `
DdgNodeContent.getNodeRenderer() returns a DdgNodeContent.getNodeRenderer() returns a focal 1`] = `
DdgNodeContent.getNodeRenderer() returns a focal omits the operation if it is null 1`] = `
omits the operation if it is null 1`] = ` exports[` omits the operation if it is null 2`] = `
omits the operation if it is null 2`] = ` exports[` renders correctly when isFocalNode = true and focalNodeUrl = null 1`] = `
renders correctly when isFocalNode = true and focalNod exports[` renders correctly when isFocalNode = true and focalNodeUrl = null 2`] = `
renders correctly when isFocalNode = true and focalNod exports[` renders the number of operations if there are multiple 1`] = `
renders the number of operations if there are multiple exports[` renders the number of operations if there are multiple 2`] = `
.DdgNodeContent--actionsWrapper { opacity: 1; pointer-events: all; transition-delay: 0s; diff --git a/packages/jaeger-ui/src/components/DeepDependencies/Graph/DdgNodeContent/index.test.js b/packages/jaeger-ui/src/components/DeepDependencies/Graph/DdgNodeContent/index.test.js index 9573ac5449..494d6b1438 100644 --- a/packages/jaeger-ui/src/components/DeepDependencies/Graph/DdgNodeContent/index.test.js +++ b/packages/jaeger-ui/src/components/DeepDependencies/Graph/DdgNodeContent/index.test.js @@ -97,26 +97,26 @@ describe('', () => { props.getVisiblePathElems.mockReturnValue(testElems); }); - it('calls setViewModifier on mouse enter', () => { - wrapper.simulate('mouseenter', { type: 'mouseenter' }); + it('calls setViewModifier on mouse over', () => { + wrapper.simulate('mouseover', { type: 'mouseover' }); expect(props.setViewModifier).toHaveBeenCalledTimes(1); expect(props.setViewModifier).toHaveBeenCalledWith(testIndices, EViewModifier.Hovered, true); }); - it('calls setViewModifier with all modified indices on mouse leave', () => { - wrapper.simulate('mouseenter', { type: 'mouseenter' }); - wrapper.simulate('mouseleave', { type: 'mouseleave' }); + it('calls setViewModifier with all modified indices on mouse out', () => { + wrapper.simulate('mouseover', { type: 'mouseover' }); + wrapper.simulate('mouseout', { type: 'mouseout' }); expect(props.setViewModifier).toHaveBeenCalledTimes(2); expect(props.setViewModifier).toHaveBeenCalledWith(testIndices, EViewModifier.Hovered, false); - wrapper.simulate('mouseenter', { type: 'mouseenter' }); + wrapper.simulate('mouseover', { type: 'mouseover' }); const moreIndices = [108]; const moreElems = moreIndices.map(visibilityIdx => ({ visibilityIdx })); props.getVisiblePathElems.mockReturnValue(moreElems); - wrapper.simulate('mouseenter', { type: 'mouseenter' }); - wrapper.simulate('mouseleave', { type: 'mouseleave' }); + wrapper.simulate('mouseover', { type: 'mouseover' }); + wrapper.simulate('mouseout', { type: 'mouseout' }); expect(props.setViewModifier).toHaveBeenCalledTimes(5); expect(props.setViewModifier).toHaveBeenCalledWith( @@ -131,27 +131,27 @@ describe('', () => { expect(props.setViewModifier).toHaveBeenCalledTimes(0); wrapper = shallow(); - wrapper.simulate('mouseenter', { type: 'mouseenter' }); - wrapper.simulate('mouseleave', { type: 'mouseleave' }); + wrapper.simulate('mouseover', { type: 'mouseover' }); + wrapper.simulate('mouseout', { type: 'mouseout' }); expect(props.setViewModifier).toHaveBeenCalledTimes(2); wrapper.unmount(); expect(props.setViewModifier).toHaveBeenCalledTimes(2); wrapper = shallow(); - wrapper.simulate('mouseenter', { type: 'mouseenter' }); + wrapper.simulate('mouseover', { type: 'mouseover' }); + expect(props.setViewModifier).toHaveBeenCalledTimes(3); wrapper.unmount(); - expect(props.setViewModifier).toHaveBeenCalledTimes(4); expect(props.setViewModifier).toHaveBeenCalledWith(testIndices, EViewModifier.Hovered, false); }); - it('calculates state.childrenVisibility and state.parentVisibility on mouse enter', () => { + it('calculates state.childrenVisibility and state.parentVisibility on mouse over', () => { const childrenVisibility = ECheckedStatus.Partial; const parentVisibility = ECheckedStatus.Full; props.getGenerationVisibility.mockImplementation((_key, direction) => direction === EDirection.Upstream ? parentVisibility : childrenVisibility ); - wrapper.simulate('mouseenter', { type: 'mouseenter' }); + wrapper.simulate('mouseover', { type: 'mouseover' }); expect(wrapper.state()).toEqual({ childrenVisibility, diff --git a/packages/jaeger-ui/src/components/DeepDependencies/Graph/DdgNodeContent/index.tsx b/packages/jaeger-ui/src/components/DeepDependencies/Graph/DdgNodeContent/index.tsx index a6b23450bb..d90c092538 100644 --- a/packages/jaeger-ui/src/components/DeepDependencies/Graph/DdgNodeContent/index.tsx +++ b/packages/jaeger-ui/src/components/DeepDependencies/Graph/DdgNodeContent/index.tsx @@ -190,7 +190,7 @@ export default class DdgNodeContent extends React.PureComponent private onMouseUx = (event: React.MouseEvent) => { const { getGenerationVisibility, getVisiblePathElems, setViewModifier, vertexKey } = this.props; - const hovered = event.type === 'mouseenter'; + const hovered = event.type === 'mouseover'; const visIndices = hovered ? (getVisiblePathElems(vertexKey) || []).map(({ visibilityIdx }) => { this.hoveredIndices.add(visibilityIdx); @@ -216,7 +216,7 @@ export default class DdgNodeContent extends React.PureComponent const transform = `translate(${RADIUS - radius}px, ${RADIUS - radius}px) scale(${scaleFactor})`; return ( -
+
', () => { wrapper.find(Icon).simulate('click', { stopPropagation }); expect(clearValue).toHaveBeenCalled(); - expect(stopPropagation).toHaveBeenCalled(); expect(wrapper.state('popoverVisible')).toBe(false); + expect(stopPropagation).toHaveBeenCalled(); }); it('throws Error when attempting to clear when required', () => { diff --git a/packages/jaeger-ui/src/components/DeepDependencies/Header/__snapshots__/index.test.js.snap b/packages/jaeger-ui/src/components/DeepDependencies/Header/__snapshots__/index.test.js.snap index 85484f1cea..08285a3477 100644 --- a/packages/jaeger-ui/src/components/DeepDependencies/Header/__snapshots__/index.test.js.snap +++ b/packages/jaeger-ui/src/components/DeepDependencies/Header/__snapshots__/index.test.js.snap @@ -77,6 +77,7 @@ exports[`
renders the operation selector if a service is selected 1`] = value="testService" /> renders the operation selector if a service is selected 2`] = value="testService" /> ', () => { const minProps = { + clearOperation: () => {}, setDistance: () => {}, setOperation: () => {}, setService: () => {}, @@ -116,6 +117,7 @@ describe('
', () => { it('renders both visible and hidden counts if both are provided', () => { wrapper.setProps({ hiddenUiFindMatches, uiFindCount }); + expect(getMatchesInfo().text()).toEqual(expectedFindCount); expect(getMatchesInfo().text()).toEqual(expectedHiddenCount); expect(getTooltip().prop('title')).toBe(expectedHiddenTitle); @@ -124,17 +126,21 @@ describe('
', () => { expect(wrapper.find(MdVisibilityOff)).toHaveLength(1); }); - it('renders 0 with correct tooltip if there are no matches', () => { + it('renders 0 with correct tooltip if there are no visible nor hidden matches', () => { const expectedTitle = 'No matches'; - wrapper.setProps({ uiFindCount: 0 }); + expect(getMatchesInfo().text()).toBe('0'); expect(getTooltip().prop('title')).toBe(expectedTitle); expect(getBtn().prop('disabled')).toBe(true); expect(wrapper.find(MdVisibility)).toHaveLength(0); expect(wrapper.find(MdVisibilityOff)).toHaveLength(0); + }); + it('renders 0 with correct tooltip if there are no matches but there are hidden matches', () => { + wrapper.setProps({ uiFindCount: 0 }); wrapper.setProps({ hiddenUiFindMatches }); + expect(getMatchesInfo().text()).toEqual(expect.stringContaining('0')); expect(getMatchesInfo().text()).toEqual(expectedHiddenCount); expect(getTooltip().prop('title')).toBe(expectedHiddenTitle); @@ -144,9 +150,9 @@ describe('
', () => { }); it('renders correct plurality in tooltip', () => { - const expectedTitle = `Click to view 1 hidden match`; - + const expectedTitle = 'Click to view 1 hidden match'; wrapper.setProps({ hiddenUiFindMatches: new Set([Array.from(hiddenUiFindMatches)[0]]), uiFindCount }); + expect(getTooltip().prop('title')).toBe(expectedTitle); }); diff --git a/packages/jaeger-ui/src/components/SearchTracePage/SearchForm.test.js b/packages/jaeger-ui/src/components/SearchTracePage/SearchForm.test.js index 867cb22f7d..ecb8fea1f6 100644 --- a/packages/jaeger-ui/src/components/SearchTracePage/SearchForm.test.js +++ b/packages/jaeger-ui/src/components/SearchTracePage/SearchForm.test.js @@ -154,7 +154,7 @@ describe('lookback utils', () => { }); }); - // DST/not-DST means this test will fail four 14 out of 52 weeks of the year! + // DST/not-DST means this test will fail for 14 out of 52 weeks of the year! xit('creates timestamp for weeks ago', () => { [1, 2, 4, 7].forEach(lookbackNum => { expect(nowInMicroseconds - lookbackToTimestamp(`${lookbackNum}w`, now)).toBe( diff --git a/packages/jaeger-ui/src/components/common/FilteredList/index.test.js b/packages/jaeger-ui/src/components/common/FilteredList/index.test.js index fe34680d25..218a4561ea 100644 --- a/packages/jaeger-ui/src/components/common/FilteredList/index.test.js +++ b/packages/jaeger-ui/src/components/common/FilteredList/index.test.js @@ -140,8 +140,8 @@ describe('', () => { it('enter selects the filteredOption if there is only one option', () => { const value = words[1]; - expect(props.setValue.mock.calls.length).toBe(0); wrapper.find('input').simulate('change', { target: { value } }); + expect(props.setValue.mock.calls.length).toBe(0); keyDown(EKey.Enter); expect(props.setValue.mock.calls).toEqual([[value]]); }); diff --git a/packages/jaeger-ui/src/model/ddg/GraphModel/index.test.js b/packages/jaeger-ui/src/model/ddg/GraphModel/index.test.js index 4651f25246..d3bfba15e4 100644 --- a/packages/jaeger-ui/src/model/ddg/GraphModel/index.test.js +++ b/packages/jaeger-ui/src/model/ddg/GraphModel/index.test.js @@ -255,7 +255,7 @@ describe('GraphModel', () => { ...downstreamTargets.map(getIdx), ...upstreamTargets.map(getIdx), ]; - const allButSomeExternalVisible = encode([ + const allButSomeExternalVisEncoding = encode([ ...twoHopIndices, ...subsetOfTargetExternalNeighborsVisibilityIndices, ]); @@ -360,6 +360,7 @@ describe('GraphModel', () => { partialTargetWithRespectiveExternalVisEncoding ) ).toEqual(ECheckedStatus.Full); + expect(generationGraph.getGenerationVisibility(targetKey, EDirection.Upstream, allVisible)).toEqual( ECheckedStatus.Full ); @@ -374,11 +375,19 @@ describe('GraphModel', () => { it('returns ECheckedStatus.Partial if only some neighbors are visible', () => { expect( - generationGraph.getGenerationVisibility(targetKey, EDirection.Downstream, allButSomeExternalVisible) + generationGraph.getGenerationVisibility( + targetKey, + EDirection.Downstream, + allButSomeExternalVisEncoding + ) ).toEqual(ECheckedStatus.Partial); expect( - generationGraph.getGenerationVisibility(targetKey, EDirection.Upstream, allButSomeExternalVisible) + generationGraph.getGenerationVisibility( + targetKey, + EDirection.Upstream, + allButSomeExternalVisEncoding + ) ).toEqual(ECheckedStatus.Partial); }); }); @@ -448,7 +457,7 @@ describe('GraphModel', () => { generationGraph.getVisWithUpdatedGeneration( targetKey, EDirection.Downstream, - allButSomeExternalVisible + allButSomeExternalVisEncoding ) ).toEqual({ visEncoding: encode([ @@ -462,7 +471,7 @@ describe('GraphModel', () => { generationGraph.getVisWithUpdatedGeneration( targetKey, EDirection.Upstream, - allButSomeExternalVisible + allButSomeExternalVisEncoding ) ).toEqual({ visEncoding: encode([...upstreamFullIndices, ...subsetOfTargetExternalNeighborsVisibilityIndices]), @@ -531,7 +540,7 @@ describe('GraphModel', () => { }); it('returns focal vertex with multiple operations', () => { - const { vertices } = withoutFocalOpGraph.getVisible(); + const { vertices } = withoutFocalOpGraph.getVisible(encode([0, 1])); const focalOps = vertices[vertices.length - 1].operation; expect(focalOps).toEqual(expect.any(Array)); diff --git a/packages/jaeger-ui/src/model/ddg/GraphModel/index.tsx b/packages/jaeger-ui/src/model/ddg/GraphModel/index.tsx index ca6ff4f549..d4236886f3 100644 --- a/packages/jaeger-ui/src/model/ddg/GraphModel/index.tsx +++ b/packages/jaeger-ui/src/model/ddg/GraphModel/index.tsx @@ -156,16 +156,10 @@ export default class GraphModel { if (!generation.length) return null; const visibleIndices = this.getVisibleIndices(visEncoding); - let partial = false; - let full = true; - generation.forEach(elem => { - const isVis = visibleIndices.has(elem.visibilityIdx); - partial = partial || isVis; - full = full && isVis; - }); + const visibleGeneration = generation.filter(({ visibilityIdx }) => visibleIndices.has(visibilityIdx)); - if (full) return ECheckedStatus.Full; - if (partial) return ECheckedStatus.Partial; + if (visibleGeneration.length === generation.length) return ECheckedStatus.Full; + if (visibleGeneration.length) return ECheckedStatus.Partial; return ECheckedStatus.Empty; }; @@ -189,7 +183,7 @@ export default class GraphModel { const edge = this.pathElemToEdge.get(pathElem); if (edge) edges.add(edge); const vertex = this.pathElemToVertex.get(pathElem); - if (vertex && vertex.key !== FOCAL_KEY) vertices.add(vertex); + if (vertex && !vertex.isFocalNode) vertices.add(vertex); }); if (this.visIdxToPathElem.length) { diff --git a/packages/jaeger-ui/src/model/ddg/PathElem.test.js b/packages/jaeger-ui/src/model/ddg/PathElem.test.js index 198916b046..e7eba0d49e 100644 --- a/packages/jaeger-ui/src/model/ddg/PathElem.test.js +++ b/packages/jaeger-ui/src/model/ddg/PathElem.test.js @@ -132,13 +132,13 @@ describe('PathElem', () => { expect(targetPathElem.externalPath).toEqual([targetPathElem]); }); - it('returns path to focal elem in correct order for upstream elem', () => { + it('returns path away from focal elem in correct order for upstream elem', () => { const idx = path.focalIdx - 1; const targetPathElem = path.members[idx]; expect(targetPathElem.externalPath).toEqual(path.members.slice(0, idx + 1)); }); - it('returns path to focal elem in correct order for downstream elem', () => { + it('returns path away from focal elem in correct order for downstream elem', () => { const idx = path.focalIdx + 1; const targetPathElem = path.members[idx]; expect(targetPathElem.externalPath).toEqual(path.members.slice(idx)); diff --git a/packages/jaeger-ui/src/model/ddg/types.tsx b/packages/jaeger-ui/src/model/ddg/types.tsx index 083f07c624..8ea7311ec0 100644 --- a/packages/jaeger-ui/src/model/ddg/types.tsx +++ b/packages/jaeger-ui/src/model/ddg/types.tsx @@ -92,24 +92,6 @@ export type TDdgModel = { visIdxToPathElem: PathElem[]; }; -/* -type TDdgVertexCommon = { - key: string; - operation: string | null; -} - -type TDdgVertexFocal = { - isFocalNode: true; - service: string | string[]; -} - -type TDdgVertexNonFocal = { - isFocalNode: false; - service: string; -} - -export type TDdgVertex = TVertex; -*/ export type TDdgVertex = TVertex<{ isFocalNode: boolean; key: string;