mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
# Backport This will backport the following commits from `main` to `8.7`: - [[Synthetics] Fix test now for private location - remaining cases (#153426)](https://github.com/elastic/kibana/pull/153426) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Shahzad","email":"shahzad31comp@gmail.com"},"sourceCommit":{"committedDate":"2023-03-22T14:52:54Z","message":"[Synthetics] Fix test now for private location - remaining cases (#153426)","sha":"365dd2b931dc7142a55886c5bb3db9dc17076ada","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:uptime","release_note:skip","v8.7.0","v8.8.0"],"number":153426,"url":"https://github.com/elastic/kibana/pull/153426","mergeCommit":{"message":"[Synthetics] Fix test now for private location - remaining cases (#153426)","sha":"365dd2b931dc7142a55886c5bb3db9dc17076ada"}},"sourceBranch":"main","suggestedTargetBranches":["8.7"],"targetPullRequestStates":[{"branch":"8.7","label":"v8.7.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/153426","number":153426,"mergeCommit":{"message":"[Synthetics] Fix test now for private location - remaining cases (#153426)","sha":"365dd2b931dc7142a55886c5bb3db9dc17076ada"}}]}] BACKPORT--> Co-authored-by: Shahzad <shahzad31comp@gmail.com>
This commit is contained in:
parent
a19d14255d
commit
3075dc5bfd
4 changed files with 24 additions and 8 deletions
|
@ -19,6 +19,7 @@ import {
|
|||
manualTestMonitorAction,
|
||||
manualTestRunInProgressSelector,
|
||||
} from '../../state/manual_test_runs';
|
||||
import { useGetUrlParams } from '../../hooks/use_url_params';
|
||||
|
||||
export const RunTestManually = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
@ -27,20 +28,27 @@ export const RunTestManually = () => {
|
|||
|
||||
const hasPublicLocation = monitor?.locations.some((loc) => loc.isServiceManaged);
|
||||
|
||||
const { locationId } = useGetUrlParams();
|
||||
|
||||
const isSelectedLocationPrivate = monitor?.locations.some(
|
||||
(loc) => loc.isServiceManaged === false && loc.id === locationId
|
||||
);
|
||||
|
||||
const testInProgress = useSelector(manualTestRunInProgressSelector(monitor?.config_id));
|
||||
|
||||
const content = !hasPublicLocation
|
||||
? PRIVATE_AVAILABLE_LABEL
|
||||
: testInProgress
|
||||
? TEST_SCHEDULED_LABEL
|
||||
: TEST_NOW_ARIA_LABEL;
|
||||
const content =
|
||||
!hasPublicLocation || isSelectedLocationPrivate
|
||||
? PRIVATE_AVAILABLE_LABEL
|
||||
: testInProgress
|
||||
? TEST_SCHEDULED_LABEL
|
||||
: TEST_NOW_ARIA_LABEL;
|
||||
|
||||
return (
|
||||
<EuiToolTip content={content} key={content}>
|
||||
<EuiButton
|
||||
color="success"
|
||||
iconType="beaker"
|
||||
isDisabled={!hasPublicLocation}
|
||||
isDisabled={!hasPublicLocation || isSelectedLocationPrivate}
|
||||
isLoading={!Boolean(monitor) || testInProgress}
|
||||
onClick={() => {
|
||||
if (monitor) {
|
||||
|
|
|
@ -45,6 +45,7 @@ describe('ActionsPopover', () => {
|
|||
isPopoverOpen={false}
|
||||
setIsPopoverOpen={jest.fn()}
|
||||
monitor={testMonitor}
|
||||
locationId={testMonitor.location.id}
|
||||
/>
|
||||
);
|
||||
expect(getByLabelText('Open actions menu'));
|
||||
|
@ -60,6 +61,7 @@ describe('ActionsPopover', () => {
|
|||
isPopoverOpen={isPopoverOpen}
|
||||
setIsPopoverOpen={setIsPopoverOpen}
|
||||
monitor={testMonitor}
|
||||
locationId={testMonitor.location.id}
|
||||
/>
|
||||
);
|
||||
const popoverButton = getByLabelText('Open actions menu');
|
||||
|
@ -79,6 +81,7 @@ describe('ActionsPopover', () => {
|
|||
isPopoverOpen={isPopoverOpen}
|
||||
setIsPopoverOpen={setIsPopoverOpen}
|
||||
monitor={testMonitor}
|
||||
locationId={testMonitor.location.id}
|
||||
/>
|
||||
);
|
||||
const popoverButton = getByLabelText('Open actions menu');
|
||||
|
@ -99,6 +102,7 @@ describe('ActionsPopover', () => {
|
|||
isPopoverOpen={true}
|
||||
setIsPopoverOpen={jest.fn()}
|
||||
monitor={testMonitor}
|
||||
locationId={testMonitor.location.id}
|
||||
/>
|
||||
);
|
||||
expect(getByRole('link')?.getAttribute('href')).toBe('/a/test/edit/url');
|
||||
|
@ -114,6 +118,7 @@ describe('ActionsPopover', () => {
|
|||
isPopoverOpen={true}
|
||||
setIsPopoverOpen={jest.fn()}
|
||||
monitor={testMonitor}
|
||||
locationId={testMonitor.location.id}
|
||||
/>
|
||||
);
|
||||
expect(getByRole('link')?.getAttribute('href')).toBe('/a/test/detail/url');
|
||||
|
@ -132,6 +137,7 @@ describe('ActionsPopover', () => {
|
|||
position="relative"
|
||||
setIsPopoverOpen={jest.fn()}
|
||||
monitor={testMonitor}
|
||||
locationId={testMonitor.location.id}
|
||||
/>
|
||||
);
|
||||
const enableButton = getByText('Disable monitor');
|
||||
|
@ -153,6 +159,7 @@ describe('ActionsPopover', () => {
|
|||
setIsPopoverOpen={jest.fn()}
|
||||
monitor={{ ...testMonitor, isEnabled: false }}
|
||||
position="relative"
|
||||
locationId={testMonitor.location.id}
|
||||
/>
|
||||
);
|
||||
const enableButton = getByText('Enable monitor');
|
||||
|
|
|
@ -76,7 +76,7 @@ interface Props {
|
|||
position: PopoverPosition;
|
||||
iconHasPanel?: boolean;
|
||||
iconSize?: 's' | 'xs';
|
||||
locationId?: string;
|
||||
locationId: string;
|
||||
}
|
||||
|
||||
const CustomShadowPanel = styled(EuiPanel)<{ shadow: string }>`
|
||||
|
@ -112,7 +112,7 @@ export function ActionsPopover({
|
|||
}: Props) {
|
||||
const euiShadow = useEuiShadow('l');
|
||||
const dispatch = useDispatch();
|
||||
const location = useLocationName({ locationId: monitor.location.id });
|
||||
const location = useLocationName({ locationId });
|
||||
const locationName = location?.label || monitor.location.id;
|
||||
|
||||
const isPrivateLocation = !Boolean(location?.isServiceManaged);
|
||||
|
|
|
@ -142,6 +142,7 @@ export const MetricItem = ({
|
|||
isPopoverOpen={isPopoverOpen}
|
||||
setIsPopoverOpen={setIsPopoverOpen}
|
||||
position="relative"
|
||||
locationId={monitor.location.id}
|
||||
/>
|
||||
)}
|
||||
{configIdByLocation && (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue