-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fixes to service map single node banner * Make the banner 95% width so it takes up the full width * Check the actual count of cytoscape nodes to determine whether or not to show the banner * Make the Cytoscape component able to take a function as children so we can access the cytoscape instance directly * Update the .NET icon * rework * Update x-pack/legacy/plugins/apm/public/components/app/ServiceMap/EmptyBanner.tsx Co-Authored-By: Oliver Gupte <[email protected]> Co-authored-by: Oliver Gupte <[email protected]> Co-authored-by: Oliver Gupte <[email protected]>
- Loading branch information
Showing
4 changed files
with
116 additions
and
147 deletions.
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
x-pack/legacy/plugins/apm/public/components/app/ServiceMap/EmptyBanner.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { act, render, wait } from '@testing-library/react'; | ||
import cytoscape from 'cytoscape'; | ||
import React, { FunctionComponent } from 'react'; | ||
import { MockApmPluginContextWrapper } from '../../../utils/testHelpers'; | ||
import { CytoscapeContext } from './Cytoscape'; | ||
import { EmptyBanner } from './EmptyBanner'; | ||
|
||
const cy = cytoscape({}); | ||
|
||
const wrapper: FunctionComponent = ({ children }) => ( | ||
<MockApmPluginContextWrapper> | ||
<CytoscapeContext.Provider value={cy}>{children}</CytoscapeContext.Provider> | ||
</MockApmPluginContextWrapper> | ||
); | ||
|
||
describe('EmptyBanner', () => { | ||
describe('when cy is undefined', () => { | ||
it('renders null', () => { | ||
const noCytoscapeWrapper: FunctionComponent = ({ children }) => ( | ||
<MockApmPluginContextWrapper> | ||
<CytoscapeContext.Provider value={undefined}> | ||
{children} | ||
</CytoscapeContext.Provider> | ||
</MockApmPluginContextWrapper> | ||
); | ||
const component = render(<EmptyBanner />, { | ||
wrapper: noCytoscapeWrapper | ||
}); | ||
|
||
expect(component.container.children).toHaveLength(0); | ||
}); | ||
}); | ||
|
||
describe('with no nodes', () => { | ||
it('renders null', () => { | ||
const component = render(<EmptyBanner />, { | ||
wrapper | ||
}); | ||
|
||
expect(component.container.children).toHaveLength(0); | ||
}); | ||
}); | ||
|
||
describe('with one node', () => { | ||
it('does not render null', async () => { | ||
const component = render(<EmptyBanner />, { wrapper }); | ||
|
||
await act(async () => { | ||
cy.add({ data: { id: 'test id' } }); | ||
await wait(() => { | ||
expect(component.container.children.length).toBeGreaterThan(0); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
126 changes: 1 addition & 125 deletions
126
x-pack/legacy/plugins/apm/public/components/app/ServiceMap/icons/dot-net.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters