-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Uptime] Fix uptime amsterdam UI issues (#103683)
* Uptime - update monitor type format in StatusBar and update UI for define connectors switch * update define_connectors * Resolve type error. * Add tests for `renderMonitorType`. * remove unnecessary async specifier * update i18n * remove unused imports * update i18n Co-authored-by: Justin Kambic <justin.kambic@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
9e60da5
commit b7dc2c1
Showing
11 changed files
with
231 additions
and
83 deletions.
There are no files selected for viewing
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
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
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
32 changes: 32 additions & 0 deletions
32
x-pack/plugins/uptime/public/components/monitor/status_details/status_bar/status_bar.test.ts
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,32 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { renderMonitorType } from './status_bar'; | ||
|
||
describe('StatusBar component', () => { | ||
describe('renderMonitorType', () => { | ||
it('handles http type', () => { | ||
expect(renderMonitorType('http')).toBe('HTTP'); | ||
}); | ||
|
||
it('handles tcp type', () => { | ||
expect(renderMonitorType('tcp')).toBe('TCP'); | ||
}); | ||
|
||
it('handles icmp type', () => { | ||
expect(renderMonitorType('icmp')).toBe('ICMP'); | ||
}); | ||
|
||
it('handles browser type', () => { | ||
expect(renderMonitorType('browser')).toBe('Browser'); | ||
}); | ||
|
||
it('returns empty string for `undefined`', () => { | ||
expect(renderMonitorType(undefined)).toBe(''); | ||
}); | ||
}); | ||
}); |
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
94 changes: 56 additions & 38 deletions
94
...s/uptime/public/components/overview/monitor_list/__snapshots__/monitor_list.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
...plugins/uptime/public/components/overview/monitor_list/columns/define_connectors.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,44 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { DefineAlertConnectors } from './define_connectors'; | ||
import { screen } from '@testing-library/react'; | ||
import { fireEvent } from '@testing-library/dom'; | ||
import { ENABLE_STATUS_ALERT } from './translations'; | ||
import { render } from '../../../../lib/helper/rtl_helpers'; | ||
|
||
describe('EnableAlertComponent', () => { | ||
it('does not showHelpText or render popover when showHelpText and renderPopOver are false', () => { | ||
render(<DefineAlertConnectors />); | ||
expect(screen.getByTestId('uptimeDisplayDefineConnector')).toBeInTheDocument(); | ||
expect(screen.queryByText(ENABLE_STATUS_ALERT)).not.toBeInTheDocument(); | ||
expect(screen.queryByText(/Define a default connector/)).not.toBeInTheDocument(); | ||
|
||
fireEvent.click(screen.getByTestId('uptimeDisplayDefineConnector')); | ||
|
||
expect(screen.queryByTestId('uptimeSettingsDefineConnector')).not.toBeInTheDocument(); | ||
}); | ||
|
||
it('shows label when showLabel is true', () => { | ||
render(<DefineAlertConnectors showLabel />); | ||
expect(screen.getByText(ENABLE_STATUS_ALERT)).toBeInTheDocument(); | ||
}); | ||
|
||
it('shows helpText when showHelpText is true', () => { | ||
render(<DefineAlertConnectors showHelpText />); | ||
expect(screen.getByText(/Define a default connector/)).toBeInTheDocument(); | ||
}); | ||
|
||
it('renders popover on click when showPopover is true', () => { | ||
render(<DefineAlertConnectors showPopover />); | ||
|
||
fireEvent.click(screen.getByTestId('uptimeDisplayDefineConnector')); | ||
|
||
expect(screen.getByTestId('uptimeSettingsDefineConnector')).toBeInTheDocument(); | ||
}); | ||
}); |
Oops, something went wrong.