From a0ce41d67ec64000ae4aeb9aeb541ebc5172265a Mon Sep 17 00:00:00 2001
From: Matej Kubinec <32638572+matejkubinec@users.noreply.github.com>
Date: Wed, 4 Dec 2024 15:23:50 +0100
Subject: [PATCH 1/8] PMM-13419 Fix tour (#777)
* PMM-13419 Fix tour
* PMM-13419 Run prettier
---
public/app/core/components/AppChrome/AppChromeMenu.tsx | 7 ++++++-
public/app/percona/shared/core/hooks/tour.ts | 4 ++++
.../app/percona/tour/steps/alerting/alerting.messages.ts | 4 ++--
public/app/percona/tour/steps/alerting/alerting.steps.tsx | 6 +++---
4 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/public/app/core/components/AppChrome/AppChromeMenu.tsx b/public/app/core/components/AppChrome/AppChromeMenu.tsx
index ee58fb39bc640..54676cd7c0aaf 100644
--- a/public/app/core/components/AppChrome/AppChromeMenu.tsx
+++ b/public/app/core/components/AppChrome/AppChromeMenu.tsx
@@ -2,6 +2,7 @@ import { css } from '@emotion/css';
import { useDialog } from '@react-aria/dialog';
import { FocusScope } from '@react-aria/focus';
import { OverlayContainer, useOverlay } from '@react-aria/overlays';
+import { useTour } from '@reactour/tour';
import React, { useRef } from 'react';
import CSSTransition from 'react-transition-group/CSSTransition';
@@ -30,11 +31,15 @@ export function AppChromeMenu({}: Props) {
const isOpen = state.megaMenuOpen && !state.megaMenuDocked;
const onClose = () => chrome.setMegaMenuOpen(false);
+ // @PERCONA
+ const { isOpen: isTourOpen } = useTour();
+
const { overlayProps, underlayProps } = useOverlay(
{
- isDismissable: true,
+ isDismissable: !isTourOpen,
isOpen: true,
onClose,
+ isKeyboardDismissDisabled: !!isTourOpen,
shouldCloseOnInteractOutside: (element) => {
// don't close when clicking on the menu toggle, let the toggle button handle that
// this prevents some nasty flickering when the menu is open and the toggle button is clicked
diff --git a/public/app/percona/shared/core/hooks/tour.ts b/public/app/percona/shared/core/hooks/tour.ts
index 4ebe487a14f34..84229d61a9262 100644
--- a/public/app/percona/shared/core/hooks/tour.ts
+++ b/public/app/percona/shared/core/hooks/tour.ts
@@ -1,6 +1,7 @@
import { useTour } from '@reactour/tour';
import { useCallback, useEffect, useMemo } from 'react';
+import { useGrafana } from 'app/core/context/GrafanaContext';
import * as TourActions from 'app/percona/shared/core/reducers/tour';
import { TourStep, TourType } from 'app/percona/shared/core/reducers/tour';
import { useAppDispatch } from 'app/store/store';
@@ -14,6 +15,7 @@ const usePerconaTour = () => {
const { steps, tour } = useSelector(getTour);
const reactTour = useTour();
const tourSteps = useMemo(() => (tour ? steps[tour] : []), [tour, steps]);
+ const { chrome } = useGrafana();
useEffect(() => {
if (reactTour.setSteps) {
@@ -31,6 +33,8 @@ const usePerconaTour = () => {
const startTour = useCallback(
async (tour: TourType) => {
+ chrome.setMegaMenuOpen(true);
+
const firstStep = steps[tour][0];
// wait for the first step element to visible
diff --git a/public/app/percona/tour/steps/alerting/alerting.messages.ts b/public/app/percona/tour/steps/alerting/alerting.messages.ts
index 2e4ce165d7c75..f6b6d8bea9b85 100644
--- a/public/app/percona/tour/steps/alerting/alerting.messages.ts
+++ b/public/app/percona/tour/steps/alerting/alerting.messages.ts
@@ -39,8 +39,8 @@ export const Messages = {
alert: 'Alert Groups show grouped alerts.',
grouping: "Group common alerts into a single alert group to ensure that PMM doesn't fire duplicate alerts.",
},
- admin: {
- title: 'Admin',
+ settings: {
+ title: 'Settings',
configure: 'Use this to configure Alertmanagers in raw JSON format.',
},
};
diff --git a/public/app/percona/tour/steps/alerting/alerting.steps.tsx b/public/app/percona/tour/steps/alerting/alerting.steps.tsx
index af1560eb39d53..5fa37778b76eb 100644
--- a/public/app/percona/tour/steps/alerting/alerting.steps.tsx
+++ b/public/app/percona/tour/steps/alerting/alerting.steps.tsx
@@ -79,10 +79,10 @@ export const getAlertingTourSteps = (isAdmin = false): TourStep[] => [
...(isAdmin
? [
{
- selector: '[aria-label="Admin"]',
+ selector: '[aria-label="Settings"]',
content: (
-
- {Messages.admin.configure}
+
+ {Messages.settings.configure}
),
},
From ddd77e01c6acb0f3e0e4d394c45d95533f6f78e7 Mon Sep 17 00:00:00 2001
From: Matej Kubinec <32638572+matejkubinec@users.noreply.github.com>
Date: Mon, 16 Dec 2024 08:05:23 +0100
Subject: [PATCH 2/8] PMM-7 Check target branch when checking out UI tests
(#791)
* PMM-7 Check target branch when checking out UI tests
* PMM-7 Skip target branch if head_ref one available
---
.github/workflows/ui-tests.yml | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml
index 33797c40914fd..78ff5d8a65245 100644
--- a/.github/workflows/ui-tests.yml
+++ b/.github/workflows/ui-tests.yml
@@ -55,9 +55,20 @@ jobs:
repository: percona/pmm-ui-tests
path: ./pmm-ui-tests
- - name: Checkout UI tests in main branch
+ - name: Checkout UI tests in ${{ github.base_ref }} branch
uses: percona-platform/checkout@v2
if: ${{ steps.branch_checkout.outcome != 'success' }}
+ continue-on-error: true
+ id: target_branch_checkout
+ with:
+ token: ${{ secrets.ROBOT_TOKEN }}
+ ref: ${{ github.base_ref }}
+ repository: percona/pmm-ui-tests
+ path: ./pmm-ui-tests
+
+ - name: Checkout UI tests in main branch
+ uses: percona-platform/checkout@v2
+ if: ${{ steps.branch_checkout.outcome != 'success' && steps.target_branch_checkout.outcome != 'success' }}
with:
token: ${{ secrets.ROBOT_TOKEN }}
ref: main
From f75050d4245a575d4f8c57acdf6a6d97db36a9f2 Mon Sep 17 00:00:00 2001
From: Matej Kubinec <32638572+matejkubinec@users.noreply.github.com>
Date: Wed, 18 Dec 2024 14:57:06 +0100
Subject: [PATCH 3/8] PMM-13548 Add service node selection fixes (#787)
* PMM-13548 Use FinalForm to store selected node & preselect pmm-server
* PMM-13548 Fix warnings in unit tests related to nodes fetching
---
.../FormParts/FormParts.test.tsx | 8 ++++---
.../MongoDBConnectionDetails.test.tsx | 8 ++++---
.../MySQLConnectionDetails.test.tsx | 8 ++++---
.../NodesAgents/NodesAgents.constants.tsx | 1 +
.../NodesAgents/NodesAgents.test.tsx | 10 ++++++++
.../FormParts/NodesAgents/NodesAgents.tsx | 24 +++++++++++++++----
.../PostgreSQLConnectionDetails.test.tsx | 12 ++++++----
7 files changed, 52 insertions(+), 19 deletions(-)
diff --git a/public/app/percona/add-instance/components/AddRemoteInstance/FormParts/FormParts.test.tsx b/public/app/percona/add-instance/components/AddRemoteInstance/FormParts/FormParts.test.tsx
index f7050cf756c07..129effdf898a1 100644
--- a/public/app/percona/add-instance/components/AddRemoteInstance/FormParts/FormParts.test.tsx
+++ b/public/app/percona/add-instance/components/AddRemoteInstance/FormParts/FormParts.test.tsx
@@ -1,4 +1,4 @@
-import { render, screen } from '@testing-library/react';
+import { render, screen, waitFor } from '@testing-library/react';
import { FormApi, FormState } from 'final-form';
import React from 'react';
import { Form } from 'react-final-form';
@@ -13,6 +13,8 @@ import { trackingOptions, rdsTrackingOptions } from './FormParts.constants';
import { LabelsFormPart } from './Labels/Labels';
import { MainDetailsFormPart } from './MainDetails/MainDetails';
+jest.mock('app/percona/inventory/Inventory.service');
+
const form: Partial = {
change: jest.fn(),
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
@@ -31,7 +33,7 @@ describe('MainDetailsFormPart ::', () => {
);
const fields = container.querySelectorAll('input');
- expect(fields.length).toBe(8);
+ await waitFor(() => expect(fields.length).toBe(8));
expect(screen.getByTestId('address-text-input')).toBeDisabled();
expect(screen.getByTestId('serviceName-text-input')).not.toBeDisabled();
@@ -51,7 +53,7 @@ describe('MainDetailsFormPart ::', () => {
);
const fields = container.querySelectorAll('input');
- expect(fields.length).toBe(8);
+ await waitFor(() => expect(fields.length).toBe(8));
expect(screen.getByTestId('address-text-input')).not.toBeDisabled();
expect(screen.getByTestId('serviceName-text-input')).not.toBeDisabled();
diff --git a/public/app/percona/add-instance/components/AddRemoteInstance/FormParts/MongoDBConnectionDetails/MongoDBConnectionDetails.test.tsx b/public/app/percona/add-instance/components/AddRemoteInstance/FormParts/MongoDBConnectionDetails/MongoDBConnectionDetails.test.tsx
index 8057d857b0813..6839e2b38ac5b 100644
--- a/public/app/percona/add-instance/components/AddRemoteInstance/FormParts/MongoDBConnectionDetails/MongoDBConnectionDetails.test.tsx
+++ b/public/app/percona/add-instance/components/AddRemoteInstance/FormParts/MongoDBConnectionDetails/MongoDBConnectionDetails.test.tsx
@@ -1,4 +1,4 @@
-import { render, screen, fireEvent } from '@testing-library/react';
+import { render, screen, fireEvent, waitFor } from '@testing-library/react';
import React from 'react';
import { Form } from 'react-final-form';
import { Provider } from 'react-redux';
@@ -7,8 +7,10 @@ import { configureStore } from 'app/store/configureStore';
import { MongoDBConnectionDetails } from './MongoDBConnectionDetails';
+jest.mock('app/percona/inventory/Inventory.service');
+
describe('MongoDB connection details:: ', () => {
- it('should have max query length attribute', () => {
+ it('should have max query length attribute', async () => {
render(
- {Messages.howToUpdate}
- {Messages.howToUpdateDescription}
+ {Messages.readyForAnUpdate}
+ {Messages.updateDescription}