From 9cbd597ebb2a3912eb3897142c61b22ab3a5ae3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Marcondes?= <55978943+cauemarcondes@users.noreply.github.com> Date: Mon, 25 Sep 2023 10:51:03 +0100 Subject: [PATCH 1/4] [Profiling] Fix set up process (#167067) So clients reported that they got stuck in the set up screen In the Universal Profling UI. And when the set up button was clicked an error happened: ``` An integration policy with the name elastic-universal-profiling-collector already exists. Please rename it or choose a different name. ``` This happens because when we were checking if the Collector and Symbolizer integrations were installed we weren't taking into consideration that the Fleet API is paginated. So if neither integration was available on the first page we just assumed the Profiling wasn't set up. This PR fixes it by adding a kuery filter in the Fleet API call to only look for out integrations. So we don't need to worry about paginating. --- .../profiling_data_access/common/fleet_policies.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/profiling_data_access/common/fleet_policies.ts b/x-pack/plugins/profiling_data_access/common/fleet_policies.ts index c3c489563b8ac..d3a9b51dd55d5 100644 --- a/x-pack/plugins/profiling_data_access/common/fleet_policies.ts +++ b/x-pack/plugins/profiling_data_access/common/fleet_policies.ts @@ -7,6 +7,7 @@ import { SavedObjectsClientContract } from '@kbn/core/server'; import type { PackagePolicyClient } from '@kbn/fleet-plugin/server'; +import { PACKAGE_POLICY_SAVED_OBJECT_TYPE, PackagePolicy } from '@kbn/fleet-plugin/common'; import { getApmPolicy } from './get_apm_policy'; import { PartialSetupState, ProfilingSetupOptions } from './setup'; @@ -21,9 +22,11 @@ async function getPackagePolicy({ packagePolicyClient: PackagePolicyClient; soClient: SavedObjectsClientContract; packageName: string; -}) { - const packagePolicies = await packagePolicyClient.list(soClient, {}); - return packagePolicies.items.find((pkg) => pkg.name === packageName); +}): Promise { + const packagePolicies = await packagePolicyClient.list(soClient, { + kuery: `${PACKAGE_POLICY_SAVED_OBJECT_TYPE}.name:${packageName}`, + }); + return packagePolicies.items[0]; } export async function getCollectorPolicy({ From e44362feae21d8a3e7d8090cabc7fed682d6956d Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Mon, 25 Sep 2023 06:24:07 -0400 Subject: [PATCH 2/4] skip failing test suite (#151854) --- .../test/security_solution_endpoint_api_int/apis/metadata.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/test/security_solution_endpoint_api_int/apis/metadata.ts b/x-pack/test/security_solution_endpoint_api_int/apis/metadata.ts index b92a26e785127..c4778f7039a91 100644 --- a/x-pack/test/security_solution_endpoint_api_int/apis/metadata.ts +++ b/x-pack/test/security_solution_endpoint_api_int/apis/metadata.ts @@ -43,7 +43,8 @@ export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); const endpointTestResources = getService('endpointTestResources'); - describe('test metadata apis', () => { + // Failing: See https://github.com/elastic/kibana/issues/151854 + describe.skip('test metadata apis', () => { describe('list endpoints GET route', () => { const numberOfHostsInFixture = 2; let agent1Timestamp: number; From 62e087a8a8c7507cd0ead1e54d2db36654c58e60 Mon Sep 17 00:00:00 2001 From: natasha-moore-elastic <137783811+natasha-moore-elastic@users.noreply.github.com> Date: Mon, 25 Sep 2023 11:38:41 +0100 Subject: [PATCH 3/4] [DOCS] Makes shards optional in Create pack API (#166639) ## Summary * Resolves https://github.com/elastic/security-docs/issues/3822. * Updates the `shards` object in Create pack API to optional for 8.10.1 and 8.11.0 onwards, per https://github.com/elastic/kibana/pull/166178 * Related to changes made in https://github.com/elastic/kibana/pull/166363. --- docs/api/osquery-manager/packs/create.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/osquery-manager/packs/create.asciidoc b/docs/api/osquery-manager/packs/create.asciidoc index 2fcfc58d43dba..280f6a1d9fe75 100644 --- a/docs/api/osquery-manager/packs/create.asciidoc +++ b/docs/api/osquery-manager/packs/create.asciidoc @@ -33,7 +33,7 @@ experimental[] Create packs. `policy_ids`:: (Optional, array) A list of agents policy IDs. -`shards`:: (Required, object) An object with shard configuration for policies included in the pack. For each policy, set the shard configuration to a percentage (1–100) of target hosts. +`shards`:: (Optional, object) An object with shard configuration for policies included in the pack. For each policy, set the shard configuration to a percentage (1–100) of target hosts. `queries`:: (Required, object) An object of queries. From d8b80901d7ea1b2f3ca333c9452f4962de720f3d Mon Sep 17 00:00:00 2001 From: Shahzad Date: Mon, 25 Sep 2023 12:50:57 +0200 Subject: [PATCH 4/4] [Uptime] Fixes monitor details overview (#166736) --- .../components/monitor/monitor_title.test.tsx | 33 +------- .../components/monitor/monitor_title.tsx | 83 ------------------- .../monitor_status.bar.test.tsx.snap | 75 ++++++++++++----- .../ssl_certificate.test.tsx.snap | 42 ++-------- .../status_bar/ssl_certificate.tsx | 13 ++- .../status_details/status_bar/status_bar.tsx | 68 ++++++++------- .../monitor/status_details/status_details.tsx | 25 +----- .../columns/define_connectors.test.tsx | 12 +-- .../columns/define_connectors.tsx | 44 ++-------- .../monitor_list/columns/enable_alert.tsx | 8 +- .../uptime/public/legacy_uptime/routes.tsx | 3 +- 11 files changed, 122 insertions(+), 284 deletions(-) diff --git a/x-pack/plugins/uptime/public/legacy_uptime/components/monitor/monitor_title.test.tsx b/x-pack/plugins/uptime/public/legacy_uptime/components/monitor/monitor_title.test.tsx index 3c98245760fcb..45b3c182084f6 100644 --- a/x-pack/plugins/uptime/public/legacy_uptime/components/monitor/monitor_title.test.tsx +++ b/x-pack/plugins/uptime/public/legacy_uptime/components/monitor/monitor_title.test.tsx @@ -13,7 +13,7 @@ import { render } from '../../lib/helper/rtl_helpers'; import * as reactRouterDom from 'react-router-dom'; import { Ping } from '../../../../common/runtime_types'; -import { MonitorPageTitle, MonitorPageTitleContent } from './monitor_title'; +import { MonitorPageTitle } from './monitor_title'; jest.mock('react-router-dom', () => { const originalModule = jest.requireActual('react-router-dom'); @@ -51,23 +51,6 @@ describe('MonitorTitle component', () => { }, }; - const defaultBrowserMonitorStatus: Ping = { - docId: 'few213kl', - timestamp: moment(new Date()).subtract(15, 'm').toString(), - monitor: { - duration: { - us: 1234567, - }, - id: 'browser', - status: 'up', - type: 'browser', - check_group: 'test-group', - }, - url: { - full: 'https://www.elastic.co/', - }, - }; - const monitorStatusWithName: Ping = { ...defaultMonitorStatus, monitor: { @@ -84,14 +67,12 @@ describe('MonitorTitle component', () => { render( <> - , { state: { monitorStatus: { status: monitorStatusWithName, loading: false } }, } ); expect(screen.getByText(monitorName)); - expect(screen.getByRole('switch')).toBeInTheDocument(); }); it('renders the user provided monitorId when the name is not present', () => { @@ -114,16 +95,4 @@ describe('MonitorTitle component', () => { ); expect(screen.getByText(defaultMonitorStatus!.url!.full!)); }); - - it('renders beta disclaimer for synthetics monitors', () => { - render(, { - state: { monitorStatus: { status: defaultBrowserMonitorStatus, loading: false } }, - }); - const betaLink = screen.getByRole('link', { - name: 'See more External link (opens in a new tab or window)', - }) as HTMLAnchorElement; - expect(betaLink).toBeInTheDocument(); - expect(betaLink.href).toBe('https://www.elastic.co/what-is/synthetic-monitoring'); - expect(screen.getByText('Browser (BETA)')).toBeInTheDocument(); - }); }); diff --git a/x-pack/plugins/uptime/public/legacy_uptime/components/monitor/monitor_title.tsx b/x-pack/plugins/uptime/public/legacy_uptime/components/monitor/monitor_title.tsx index a15b941e4e935..2a84d3acbf4ad 100644 --- a/x-pack/plugins/uptime/public/legacy_uptime/components/monitor/monitor_title.tsx +++ b/x-pack/plugins/uptime/public/legacy_uptime/components/monitor/monitor_title.tsx @@ -5,13 +5,10 @@ * 2.0. */ -import { EuiBadge, EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiLink, EuiText } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n-react'; import React from 'react'; import { useSelector } from 'react-redux'; import { useMonitorId } from '../../hooks'; import { monitorStatusSelector } from '../../state/selectors'; -import { EnableMonitorAlert } from '../overview/monitor_list/columns/enable_alert'; import { Ping } from '../../../../common/runtime_types/ping'; import { useBreadcrumbs } from '../../hooks/use_breadcrumbs'; @@ -32,86 +29,6 @@ const getPageTitle = (monitorId: string, selectedMonitor: Ping | null) => { return monitorId; }; -export const MonitorPageTitleContent: React.FC = () => { - const monitorId = useMonitorId(); - const selectedMonitor = useSelector(monitorStatusSelector); - const type = selectedMonitor?.monitor?.type; - const isBrowser = type === 'browser'; - const renderMonitorType = (monitorType: string) => { - switch (monitorType) { - case 'http': - return ( - - ); - case 'tcp': - return ( - - ); - case 'icmp': - return ( - - ); - case 'browser': - return ( - - ); - default: - return ''; - } - }; - return ( - <> - - - - - - - - - {isBrowser && type && ( - - {renderMonitorType(type)}{' '} - - - )} - - {isBrowser && ( - - - - - - - - )} - - - ); -}; - export const MonitorPageTitle: React.FC = () => { const monitorId = useMonitorId(); diff --git a/x-pack/plugins/uptime/public/legacy_uptime/components/monitor/status_details/__snapshots__/monitor_status.bar.test.tsx.snap b/x-pack/plugins/uptime/public/legacy_uptime/components/monitor/status_details/__snapshots__/monitor_status.bar.test.tsx.snap index 5ebde1d72dd0d..77345c95164a6 100644 --- a/x-pack/plugins/uptime/public/legacy_uptime/components/monitor/status_details/__snapshots__/monitor_status.bar.test.tsx.snap +++ b/x-pack/plugins/uptime/public/legacy_uptime/components/monitor/status_details/__snapshots__/monitor_status.bar.test.tsx.snap @@ -12,58 +12,49 @@ Array [
, - .c0.c0.c0 { - width: 30%; - max-width: 250px; -} - -.c1.c1.c1 { - width: 70%; - overflow-wrap: anywhere; -} - -
Overall availability
0.00 %
Url
--
Monitor ID
Tags
+
+ Enable status alerts +
+
+
+
+
+
+ +
+
+
+
+
, ] `; diff --git a/x-pack/plugins/uptime/public/legacy_uptime/components/monitor/status_details/__snapshots__/ssl_certificate.test.tsx.snap b/x-pack/plugins/uptime/public/legacy_uptime/components/monitor/status_details/__snapshots__/ssl_certificate.test.tsx.snap index d80ca3bb00376..1e50379a09553 100644 --- a/x-pack/plugins/uptime/public/legacy_uptime/components/monitor/status_details/__snapshots__/ssl_certificate.test.tsx.snap +++ b/x-pack/plugins/uptime/public/legacy_uptime/components/monitor/status_details/__snapshots__/ssl_certificate.test.tsx.snap @@ -2,32 +2,19 @@ exports[`SSL Certificate component renders 1`] = ` Array [ - .c0.c0.c0 { - width: 30%; - max-width: 250px; -} - -
TLS Certificate
, -
, .c0.c0.c0 { - width: 70%; - overflow-wrap: anywhere; -} - -.c1.c1.c1 { margin: 0 0 0 4px; display: inline-block; color: inherit; }

Expires in 2 months

@@ -57,26 +44,13 @@ Array [ exports[`SSL Certificate component renders null if invalid date 1`] = ` Array [ - .c0.c0.c0 { - width: 30%; - max-width: 250px; -} - -
TLS Certificate
, -
, - .c0.c0.c0 { - width: 70%; - overflow-wrap: anywhere; -} - -
{ return ( <> - + - - - - + + - + ); }; diff --git a/x-pack/plugins/uptime/public/legacy_uptime/components/monitor/status_details/status_bar/status_bar.tsx b/x-pack/plugins/uptime/public/legacy_uptime/components/monitor/status_details/status_bar/status_bar.tsx index 50e4ca36dabc5..f122415d725c0 100644 --- a/x-pack/plugins/uptime/public/legacy_uptime/components/monitor/status_details/status_bar/status_bar.tsx +++ b/x-pack/plugins/uptime/public/legacy_uptime/components/monitor/status_details/status_bar/status_bar.tsx @@ -6,7 +6,6 @@ */ import React from 'react'; -import styled from 'styled-components'; import { EuiLink, EuiSpacer, @@ -16,6 +15,10 @@ import { } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; +import { useSelector } from 'react-redux'; +import { ENABLE_STATUS_ALERT } from '../../../overview/monitor_list/columns/translations'; +import { monitorStatusSelector } from '../../../../state/selectors'; +import { EnableMonitorAlert } from '../../../overview/monitor_list/columns/enable_alert'; import { MonitorSSLCertificate } from './ssl_certificate'; import * as labels from '../translations'; import { StatusByLocations } from './status_by_location'; @@ -31,20 +34,6 @@ import { formatAvailabilityValue } from '../availability_reporting/availability_ import { MonitorRedirects } from './monitor_redirects'; import { MonitorTags } from '../../../common/monitor_tags'; -export const MonListTitle = styled(EuiDescriptionListTitle)` - &&& { - width: 30%; - max-width: 250px; - } -`; - -export const MonListDescription = styled(EuiDescriptionListDescription)` - &&& { - width: 70%; - overflow-wrap: anywhere; - } -`; - export const renderMonitorType = (type: string | undefined) => { switch (type) { case 'http': @@ -77,24 +66,29 @@ export const MonitorStatusBar: React.FC = () => { const availability = (ups === 0 && downs === 0) || !ups ? 0 : (ups / (ups + downs)) * 100; + const selectedMonitor = useSelector(monitorStatusSelector); + return ( <>
- - {OverallAvailability} - + + {OverallAvailability} + - - {URL_LABEL} - + + {URL_LABEL} + {full ? ( { ) : ( '--' )} - - {MonitorIDLabel} - {monitorId} + + {MonitorIDLabel} + + {monitorId} + {monitorStatus?.monitor?.type && ( <> - {labels.typeLabel} - + + {labels.typeLabel} + + {renderMonitorType(monitorStatus?.monitor?.type)} - + )} - {TAGS_LABEL} - + {TAGS_LABEL} + - + {monitorStatus?.monitor?.project?.id && ( <> - {PROJECT_LABEL} - {monitorStatus?.monitor?.project.id} + {PROJECT_LABEL} + + {monitorStatus?.monitor?.project.id} + )} + {ENABLE_STATUS_ALERT} + {selectedMonitor && ( + + )} ); diff --git a/x-pack/plugins/uptime/public/legacy_uptime/components/monitor/status_details/status_details.tsx b/x-pack/plugins/uptime/public/legacy_uptime/components/monitor/status_details/status_details.tsx index 0c9c347fc8c80..48196a75f37b5 100644 --- a/x-pack/plugins/uptime/public/legacy_uptime/components/monitor/status_details/status_details.tsx +++ b/x-pack/plugins/uptime/public/legacy_uptime/components/monitor/status_details/status_details.tsx @@ -5,11 +5,10 @@ * 2.0. */ -import React, { useContext, useEffect, useState } from 'react'; +import React from 'react'; import { EuiFlexGroup, EuiFlexItem, EuiPanel } from '@elastic/eui'; import styled from 'styled-components'; import { LocationAvailability } from './location_availability/location_availability'; -import { UptimeRefreshContext } from '../../../contexts'; import { MonitorLocations } from '../../../../../common/runtime_types'; import { MonitorStatusBar } from './status_bar'; @@ -26,28 +25,6 @@ const WrapFlexItem = styled(EuiFlexItem)` `; export const MonitorStatusDetailsComponent = ({ monitorLocations }: MonitorStatusDetailsProps) => { - const { refreshApp } = useContext(UptimeRefreshContext); - - const [isTabActive] = useState(document.visibilityState); - const onTabActive = () => { - if (document.visibilityState === 'visible' && isTabActive === 'hidden') { - refreshApp(); - } - }; - - // Refreshing application state after Tab becomes active to render latest map state - // If application renders in when tab is not in focus it gives some unexpected behaviors - // Where map is not visible on change - useEffect(() => { - document.addEventListener('visibilitychange', onTabActive); - return () => { - document.removeEventListener('visibilitychange', onTabActive); - }; - - // we want this effect to execute exactly once after the component mounts - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - return ( diff --git a/x-pack/plugins/uptime/public/legacy_uptime/components/overview/monitor_list/columns/define_connectors.test.tsx b/x-pack/plugins/uptime/public/legacy_uptime/components/overview/monitor_list/columns/define_connectors.test.tsx index aa257177970a1..29f0dd189594c 100644 --- a/x-pack/plugins/uptime/public/legacy_uptime/components/overview/monitor_list/columns/define_connectors.test.tsx +++ b/x-pack/plugins/uptime/public/legacy_uptime/components/overview/monitor_list/columns/define_connectors.test.tsx @@ -21,21 +21,23 @@ describe('EnableAlertComponent', () => { fireEvent.click(screen.getByTestId('uptimeDisplayDefineConnector')); - expect(screen.queryByTestId('uptimeSettingsDefineConnector')).not.toBeInTheDocument(); + expect(screen.queryByTestId('uptimeSettingsDefineConnector')).toBeInTheDocument(); }); it('shows label when showLabel is true', () => { - render(); - expect(screen.getByText(ENABLE_STATUS_ALERT)).toBeInTheDocument(); + render(); + expect(screen.getByLabelText(ENABLE_STATUS_ALERT)).toBeInTheDocument(); }); it('shows helpText when showHelpText is true', () => { - render(); + render(); + fireEvent.click(screen.getByTestId('uptimeDisplayDefineConnector')); + expect(screen.getByText(/Define a default connector/)).toBeInTheDocument(); }); it('renders popover on click when showPopover is true', () => { - render(); + render(); fireEvent.click(screen.getByTestId('uptimeDisplayDefineConnector')); diff --git a/x-pack/plugins/uptime/public/legacy_uptime/components/overview/monitor_list/columns/define_connectors.tsx b/x-pack/plugins/uptime/public/legacy_uptime/components/overview/monitor_list/columns/define_connectors.tsx index 0a6040249a663..4ee8cb1c67d89 100644 --- a/x-pack/plugins/uptime/public/legacy_uptime/components/overview/monitor_list/columns/define_connectors.tsx +++ b/x-pack/plugins/uptime/public/legacy_uptime/components/overview/monitor_list/columns/define_connectors.tsx @@ -12,17 +12,7 @@ import { ReactRouterEuiLink } from '../../../common/react_router_helpers'; import { SETTINGS_ROUTE } from '../../../../../../common/constants'; import { ENABLE_STATUS_ALERT } from './translations'; -interface Props { - showPopover?: boolean; - showHelpText?: boolean; - showLabel?: boolean; -} - -export const DefineAlertConnectors = ({ - showPopover = false, - showHelpText = false, - showLabel = false, -}: Props) => { +export const DefineAlertConnectors = () => { const [isPopoverOpen, setIsPopoverOpen] = useState(false); const onButtonClick = () => setIsPopoverOpen((val) => !val); @@ -32,46 +22,22 @@ export const DefineAlertConnectors = ({ - - - - ), - }} - /> - ) : undefined - } - > + {}} + onChange={onButtonClick} checked={false} compressed={true} - disabled={!showPopover} data-test-subj={'uptimeDisplayDefineConnector'} /> } - isOpen={showPopover ? isPopoverOpen : false} + isOpen={isPopoverOpen} closePopover={closePopover} > diff --git a/x-pack/plugins/uptime/public/legacy_uptime/components/overview/monitor_list/columns/enable_alert.tsx b/x-pack/plugins/uptime/public/legacy_uptime/components/overview/monitor_list/columns/enable_alert.tsx index b52aacd5abb6e..e7ff83f5ebae1 100644 --- a/x-pack/plugins/uptime/public/legacy_uptime/components/overview/monitor_list/columns/enable_alert.tsx +++ b/x-pack/plugins/uptime/public/legacy_uptime/components/overview/monitor_list/columns/enable_alert.tsx @@ -111,7 +111,7 @@ export const EnableMonitorAlert = ({ monitorId, selectedMonitor }: Props) => { compressed={!isMonitorPage} disabled={showSpinner} label={btnLabel} - showLabel={!!isMonitorPage} + showLabel={false} aria-label={btnLabel} onChange={onAlertClick} checked={!!hasAlert} @@ -126,10 +126,6 @@ export const EnableMonitorAlert = ({ monitorId, selectedMonitor }: Props) => {
) : ( - + ); }; diff --git a/x-pack/plugins/uptime/public/legacy_uptime/routes.tsx b/x-pack/plugins/uptime/public/legacy_uptime/routes.tsx index 43194e10735d6..269624a0c6dc0 100644 --- a/x-pack/plugins/uptime/public/legacy_uptime/routes.tsx +++ b/x-pack/plugins/uptime/public/legacy_uptime/routes.tsx @@ -30,7 +30,7 @@ import { SyntheticsCheckStepsPageHeader, SyntheticsCheckStepsPageRightSideItem, } from './pages/synthetics/synthetics_checks'; -import { MonitorPageTitle, MonitorPageTitleContent } from './components/monitor/monitor_title'; +import { MonitorPageTitle } from './components/monitor/monitor_title'; import { UptimeDatePicker } from './components/common/uptime_date_picker'; import { CertRefreshBtn } from './components/certificates/cert_refresh_btn'; import { CertificateTitle } from './components/certificates/certificate_title'; @@ -69,7 +69,6 @@ const getRoutes = (): RouteProps[] => { component: MonitorPage, dataTestSubj: 'uptimeMonitorPage', pageHeader: { - children: , pageTitle: , rightSideItems: [], },