mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Revert "Uptime Monitor Management - Adjust monitor details page href for browser monitors" (#124082)
This commit is contained in:
parent
5310c647aa
commit
1af949c0b1
2 changed files with 5 additions and 70 deletions
|
@ -9,11 +9,11 @@ import React from 'react';
|
|||
import { screen } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { render } from '../../../lib/helper/rtl_helpers';
|
||||
import { ConfigKey, DataStream, HTTPFields, ScheduleUnit } from '../../../../common/runtime_types';
|
||||
import { DataStream, HTTPFields, ScheduleUnit } from '../../../../common/runtime_types';
|
||||
import { MonitorManagementList } from './monitor_list';
|
||||
import { MonitorManagementList as MonitorManagementListState } from '../../../state/reducers/monitor_management';
|
||||
|
||||
describe('<MonitorManagementList />', () => {
|
||||
describe('<ActionBar />', () => {
|
||||
const setRefresh = jest.fn();
|
||||
const setPageSize = jest.fn();
|
||||
const setPageIndex = jest.fn();
|
||||
|
@ -110,64 +110,4 @@ describe('<MonitorManagementList />', () => {
|
|||
expect(setPageIndex).toBeCalledWith(2);
|
||||
expect(setRefresh).toBeCalledWith(true);
|
||||
});
|
||||
|
||||
it.each([
|
||||
[DataStream.BROWSER, ConfigKey.SOURCE_INLINE],
|
||||
[DataStream.HTTP, ConfigKey.URLS],
|
||||
[DataStream.TCP, ConfigKey.HOSTS],
|
||||
[DataStream.ICMP, ConfigKey.HOSTS],
|
||||
])(
|
||||
'appends inline to the monitor id for browser monitors and omits for lightweight checks',
|
||||
(type, configKey) => {
|
||||
const id = '123456';
|
||||
const name = 'sample monitor';
|
||||
const browserState = {
|
||||
monitorManagementList: {
|
||||
...state.monitorManagementList,
|
||||
list: {
|
||||
...state.monitorManagementList.list,
|
||||
monitors: [
|
||||
{
|
||||
id,
|
||||
attributes: {
|
||||
name,
|
||||
schedule: {
|
||||
unit: ScheduleUnit.MINUTES,
|
||||
number: '1',
|
||||
},
|
||||
[configKey]: 'test',
|
||||
type,
|
||||
tags: [`tag-1`],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
render(
|
||||
<MonitorManagementList
|
||||
setRefresh={setRefresh}
|
||||
setPageSize={setPageSize}
|
||||
setPageIndex={setPageIndex}
|
||||
monitorList={browserState.monitorManagementList as unknown as MonitorManagementListState}
|
||||
/>,
|
||||
{ state: browserState }
|
||||
);
|
||||
|
||||
const link = screen.getByText(name) as HTMLAnchorElement;
|
||||
|
||||
expect(link.href).toEqual(
|
||||
expect.stringContaining(
|
||||
`/app/uptime/monitor/${Buffer.from(
|
||||
`${id}${type === DataStream.BROWSER ? `-inline` : ''}`,
|
||||
'utf8'
|
||||
).toString('base64')}`
|
||||
)
|
||||
);
|
||||
|
||||
expect(setPageIndex).toBeCalledWith(2);
|
||||
expect(setRefresh).toBeCalledWith(true);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
|
|
@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n';
|
|||
import { EuiBasicTable, EuiPanel, EuiSpacer, EuiLink } from '@elastic/eui';
|
||||
import { SyntheticsMonitorSavedObject } from '../../../../common/types';
|
||||
import { MonitorManagementList as MonitorManagementListState } from '../../../state/reducers/monitor_management';
|
||||
import { DataStream, MonitorFields, SyntheticsMonitor } from '../../../../common/runtime_types';
|
||||
import { MonitorFields, SyntheticsMonitor } from '../../../../common/runtime_types';
|
||||
import { UptimeSettingsContext } from '../../../contexts';
|
||||
import { Actions } from './actions';
|
||||
import { MonitorLocations } from './monitor_locations';
|
||||
|
@ -69,19 +69,14 @@ export const MonitorManagementList = ({
|
|||
defaultMessage: 'Monitor name',
|
||||
}),
|
||||
render: ({
|
||||
attributes: { name, type },
|
||||
attributes: { name },
|
||||
id,
|
||||
}: {
|
||||
attributes: Partial<MonitorFields>;
|
||||
id: string;
|
||||
}) => (
|
||||
<EuiLink
|
||||
href={`${basePath}/app/uptime/monitor/${Buffer.from(
|
||||
/* Monitor Management currently only supports inline browser monitors.
|
||||
* Inline browser monitors append `inline` to the monitor id */
|
||||
`${id}${type === DataStream.BROWSER ? `-inline` : ''}`,
|
||||
'utf8'
|
||||
).toString('base64')}`}
|
||||
href={`${basePath}/app/uptime/monitor/${Buffer.from(id, 'utf8').toString('base64')}`}
|
||||
>
|
||||
{name}
|
||||
</EuiLink>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue