From c7a77c3ee290a8d4df262836b87d1c81a798ab6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cdorac-ext=E2=80=9D?= <103416234+doracretu3pillar@users.noreply.github.com> Date: Thu, 18 Jul 2024 15:29:19 +0300 Subject: [PATCH 01/13] Fix scheduled backups deletion --- .../components/ScheduledBackups/ScheduledBackups.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/percona/backup/components/ScheduledBackups/ScheduledBackups.service.ts b/public/app/percona/backup/components/ScheduledBackups/ScheduledBackups.service.ts index 524db1b65f409..37c270f25781f 100644 --- a/public/app/percona/backup/components/ScheduledBackups/ScheduledBackups.service.ts +++ b/public/app/percona/backup/components/ScheduledBackups/ScheduledBackups.service.ts @@ -87,6 +87,6 @@ export const ScheduledBackupsService = { return api.put(`${BASE_URL}:changeScheduled`, { scheduled_backup_id: id, enabled }); }, async delete(id: string) { - return api.delete(`${BASE_URL}/scheduled/${id}`); + return api.delete(`${BASE_URL}/${id}`); }, }; From 7046c799a9bba982e4ccf31b18dd8271d5eea202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cdorac-ext=E2=80=9D?= <103416234+doracretu3pillar@users.noreply.github.com> Date: Thu, 18 Jul 2024 17:17:05 +0300 Subject: [PATCH 02/13] Fixed restores:start --- .../components/BackupInventory/BackupInventory.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/percona/backup/components/BackupInventory/BackupInventory.service.ts b/public/app/percona/backup/components/BackupInventory/BackupInventory.service.ts index 75554bf597a6c..29c4de04f9ad0 100644 --- a/public/app/percona/backup/components/BackupInventory/BackupInventory.service.ts +++ b/public/app/percona/backup/components/BackupInventory/BackupInventory.service.ts @@ -55,7 +55,7 @@ export const BackupInventoryService = { }, async restore(serviceId: string, artifactId: string, pitrTimestamp?: string, token?: CancelToken) { return api.post( - `${BASE_URL}/restore:start`, + `${BASE_URL}/restores:start`, { service_id: serviceId, artifact_id: artifactId, From 70aa94719ccd1552ef8260c10be39e00becfd826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cdorac-ext=E2=80=9D?= <103416234+doracretu3pillar@users.noreply.github.com> Date: Tue, 23 Jul 2024 14:32:14 +0300 Subject: [PATCH 03/13] Fixed edit scheduled backup page --- .../backup/components/ScheduledBackups/ScheduledBackups.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/percona/backup/components/ScheduledBackups/ScheduledBackups.tsx b/public/app/percona/backup/components/ScheduledBackups/ScheduledBackups.tsx index 9348dfe5f5335..8850a1228aa8d 100644 --- a/public/app/percona/backup/components/ScheduledBackups/ScheduledBackups.tsx +++ b/public/app/percona/backup/components/ScheduledBackups/ScheduledBackups.tsx @@ -241,7 +241,7 @@ export const ScheduledBackups: FC = () => { }; const onEditClick = (backup: ScheduledBackup) => { - locationService.push(`/backup${backup.id}/edit`); + locationService.push(`/backup/${backup.id}/edit`); }; const getCellProps = useCallback( From 465baf02ea6389222cd7fb908b465c11eea732c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cdorac-ext=E2=80=9D?= <103416234+doracretu3pillar@users.noreply.github.com> Date: Wed, 24 Jul 2024 12:56:16 +0300 Subject: [PATCH 04/13] Added the type to the locationService --- .../backup/components/BackupInventory/BackupInventory.tsx | 2 +- .../backup/components/ScheduledBackups/ScheduledBackups.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/percona/backup/components/BackupInventory/BackupInventory.tsx b/public/app/percona/backup/components/BackupInventory/BackupInventory.tsx index a30f612d96366..962debb5fb6e2 100644 --- a/public/app/percona/backup/components/BackupInventory/BackupInventory.tsx +++ b/public/app/percona/backup/components/BackupInventory/BackupInventory.tsx @@ -287,7 +287,7 @@ export const BackupInventory: FC = () => { const onBackupClick = (backup: BackupRow | null) => { if (backup) { - locationService.push(`/backup/${backup.id}/edit`); + locationService.push(`/backup/${backup.type}/${backup.id}/edit`); } else { locationService.push(NEW_BACKUP_URL); } diff --git a/public/app/percona/backup/components/ScheduledBackups/ScheduledBackups.tsx b/public/app/percona/backup/components/ScheduledBackups/ScheduledBackups.tsx index 8850a1228aa8d..c269e8b88c130 100644 --- a/public/app/percona/backup/components/ScheduledBackups/ScheduledBackups.tsx +++ b/public/app/percona/backup/components/ScheduledBackups/ScheduledBackups.tsx @@ -241,7 +241,7 @@ export const ScheduledBackups: FC = () => { }; const onEditClick = (backup: ScheduledBackup) => { - locationService.push(`/backup/${backup.id}/edit`); + locationService.push(`/backup/${backup.type}/${backup.id}/edit`); }; const getCellProps = useCallback( From 5f55a8fa0ce6c760022bb324628430da56170b59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cdorac-ext=E2=80=9D?= <103416234+doracretu3pillar@users.noreply.github.com> Date: Tue, 30 Jul 2024 10:02:22 +0300 Subject: [PATCH 05/13] Fixed the wrong settings payload --- public/app/percona/settings/Settings.service.ts | 2 +- public/app/percona/settings/Settings.types.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/percona/settings/Settings.service.ts b/public/app/percona/settings/Settings.service.ts index c17d21479b1a8..2247a39c631df 100644 --- a/public/app/percona/settings/Settings.service.ts +++ b/public/app/percona/settings/Settings.service.ts @@ -35,7 +35,7 @@ export const SettingsService = { const toModel = (response: SettingsPayload): Settings => ({ awsPartitions: response.aws_partitions.values, - updatesEnabled: response.enable_updates, + updatesEnabled: response.updates_enabled, telemetryEnabled: response.telemetry_enabled, telemetrySummaries: response.telemetry_summaries || [], metricsResolutions: response.metrics_resolutions, diff --git a/public/app/percona/settings/Settings.types.ts b/public/app/percona/settings/Settings.types.ts index 49c066196a94d..28662dc7626ce 100644 --- a/public/app/percona/settings/Settings.types.ts +++ b/public/app/percona/settings/Settings.types.ts @@ -96,7 +96,7 @@ export interface SettingsPayload values: string[]; }; platform_email: string; - enable_updates: boolean; + updates_enabled: boolean; telemetry_enabled: boolean; advisor_enabled: boolean; alerting_enabled: boolean; From 5c5769372c0c9107ed06ec20f93ab862fca169da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cdorac-ext=E2=80=9D?= <103416234+doracretu3pillar@users.noreply.github.com> Date: Tue, 30 Jul 2024 11:35:04 +0300 Subject: [PATCH 06/13] PMM Dump fix --- .../components/ScheduledBackups/ScheduledBackups.tsx | 3 ++- public/app/percona/pmm-dump/PMMDump.tsx | 9 +++++++-- .../pmm-dump/components/ExportDataset/ExportDataset.tsx | 1 - 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/public/app/percona/backup/components/ScheduledBackups/ScheduledBackups.tsx b/public/app/percona/backup/components/ScheduledBackups/ScheduledBackups.tsx index c269e8b88c130..400f77f8fb264 100644 --- a/public/app/percona/backup/components/ScheduledBackups/ScheduledBackups.tsx +++ b/public/app/percona/backup/components/ScheduledBackups/ScheduledBackups.tsx @@ -8,6 +8,7 @@ import { locationService } from '@grafana/runtime'; import { LinkButton, useStyles } from '@grafana/ui'; import { appEvents } from 'app/core/app_events'; import { Page } from 'app/core/components/Page/Page'; +import { BackupType } from "app/percona/backup/Backup.types"; import { DeleteModal } from 'app/percona/shared/components/Elements/DeleteModal'; import { FeatureLoader } from 'app/percona/shared/components/Elements/FeatureLoader'; import { ExtendedColumn, FilterFieldTypes, Table } from 'app/percona/shared/components/Elements/Table'; @@ -241,7 +242,7 @@ export const ScheduledBackups: FC = () => { }; const onEditClick = (backup: ScheduledBackup) => { - locationService.push(`/backup/${backup.type}/${backup.id}/edit`); + locationService.push(`/backup/${BackupType.SCHEDULED}/${backup.id}/edit`); }; const getCellProps = useCallback( diff --git a/public/app/percona/pmm-dump/PMMDump.tsx b/public/app/percona/pmm-dump/PMMDump.tsx index 54e29106ffeab..5c6d874c1754c 100644 --- a/public/app/percona/pmm-dump/PMMDump.tsx +++ b/public/app/percona/pmm-dump/PMMDump.tsx @@ -12,6 +12,9 @@ import { DumpStatus, DumpStatusColor, DumpStatusText, PMMDumpServices } from 'ap import { DetailsRow } from 'app/percona/shared/components/Elements/DetailsRow/DetailsRow'; import { Action } from 'app/percona/shared/components/Elements/MultipleActions'; import { ExtendedColumn, FilterFieldTypes, Table } from 'app/percona/shared/components/Elements/Table'; +import { + PMM_DUMP_PAGE, +} from "app/percona/shared/components/PerconaBootstrapper/PerconaNavigation"; import { usePerconaNavModel } from 'app/percona/shared/components/hooks/perconaNavModel'; import { deletePmmDumpAction, @@ -44,7 +47,6 @@ export const PMMDump = () => { const [selectedDump, setSelectedDump] = useState(null); const [isSendToSupportModalOpened, setIsSendToSupportModalOpened] = useState(false); const [logsModalVisible, setLogsModalVisible] = useState(false); - const navModel = usePerconaNavModel('pmm-dump'); const loadData = useCallback(async () => { try { @@ -280,7 +282,10 @@ export const PMMDump = () => { ); return ( - +
{selectedRows.length > 0 ? ( diff --git a/public/app/percona/pmm-dump/components/ExportDataset/ExportDataset.tsx b/public/app/percona/pmm-dump/components/ExportDataset/ExportDataset.tsx index 7dce2eca667d9..346e20cf2d0c8 100644 --- a/public/app/percona/pmm-dump/components/ExportDataset/ExportDataset.tsx +++ b/public/app/percona/pmm-dump/components/ExportDataset/ExportDataset.tsx @@ -91,7 +91,6 @@ const ExportDataset: FC serviceList = []; } - console.log(data); await dispatch( triggerDumpAction({ serviceNames: serviceList, From 75b8b55f9c39ce6e9dfcfaa207007a9d2a54bb88 Mon Sep 17 00:00:00 2001 From: Matej Kubinec Date: Tue, 30 Jul 2024 10:39:00 +0200 Subject: [PATCH 07/13] PMM-12710 Fix updates check --- .../app/percona/shared/services/updates/Updates.service.ts | 6 +++--- public/app/percona/shared/services/updates/Updates.types.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/app/percona/shared/services/updates/Updates.service.ts b/public/app/percona/shared/services/updates/Updates.service.ts index 6fedae0592772..b4ef6cb681ef5 100644 --- a/public/app/percona/shared/services/updates/Updates.service.ts +++ b/public/app/percona/shared/services/updates/Updates.service.ts @@ -1,8 +1,8 @@ import { api } from '../../helpers/api'; -import { CheckUpdatesBody, CheckUpdatesResponse } from './Updates.types'; +import { CheckUpdatesParams, CheckUpdatesResponse } from './Updates.types'; export const UpdatesService = { - getCurrentVersion: (body: CheckUpdatesBody = { force: false }) => - api.post('/v1/Updates/Check', body, true), + getCurrentVersion: (params: CheckUpdatesParams = { force: false }) => + api.get('/v1/server/updates', true, { params }), }; diff --git a/public/app/percona/shared/services/updates/Updates.types.ts b/public/app/percona/shared/services/updates/Updates.types.ts index 3fcbdf80a7867..7bf07a89eac87 100644 --- a/public/app/percona/shared/services/updates/Updates.types.ts +++ b/public/app/percona/shared/services/updates/Updates.types.ts @@ -1,4 +1,4 @@ -export interface CheckUpdatesBody { +export interface CheckUpdatesParams { force: boolean; only_installed_version?: boolean; } From b4da5fe2f0caf992db3c4b4e45edf497809cb09c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cdorac-ext=E2=80=9D?= <103416234+doracretu3pillar@users.noreply.github.com> Date: Tue, 30 Jul 2024 12:33:10 +0300 Subject: [PATCH 08/13] Fixed the interval for Security Advisors --- public/app/percona/check/__mocks__/stubs.ts | 10 +++++----- .../AllChecksTab/AllChecksTab.constants.ts | 7 ++++--- .../components/AllChecksTab/AllChecksTab.tsx | 16 ++++++++++------ .../ChangeCheckIntervalModal.test.tsx | 2 +- public/app/percona/check/types.ts | 7 ++++--- public/app/percona/pmm-dump/PMMDump.tsx | 1 - 6 files changed, 24 insertions(+), 19 deletions(-) diff --git a/public/app/percona/check/__mocks__/stubs.ts b/public/app/percona/check/__mocks__/stubs.ts index 69cf46c93524c..c24a2bdfdd6f6 100644 --- a/public/app/percona/check/__mocks__/stubs.ts +++ b/public/app/percona/check/__mocks__/stubs.ts @@ -168,7 +168,7 @@ export const allChecksStub: CheckDetails[] = [ name: 'test1', summary: 'Test 1', description: 'Test number 1', - interval: 'STANDARD', + interval: 'ADVISOR_CHECK_INTERVAL_STANDARD', readMoreUrl: 'https://example.com', category: '', family: 'ADVISOR_CHECK_FAMILY_MONGODB', @@ -177,7 +177,7 @@ export const allChecksStub: CheckDetails[] = [ name: 'test2', summary: 'Test 2', description: 'Test number 2', - interval: 'RARE', + interval: 'ADVISOR_CHECK_INTERVAL_RARE', category: '', family: 'ADVISOR_CHECK_FAMILY_MONGODB', }, @@ -185,7 +185,7 @@ export const allChecksStub: CheckDetails[] = [ name: 'test3', summary: 'Test 3', description: 'Test number 3', - interval: 'STANDARD', + interval: 'ADVISOR_CHECK_INTERVAL_STANDARD', disabled: true, readMoreUrl: 'https://example.com', category: '', @@ -194,7 +194,7 @@ export const allChecksStub: CheckDetails[] = [ { name: 'test4', summary: 'Test 4', - interval: 'FREQUENT', + interval: 'ADVISOR_CHECK_INTERVAL_FREQUENT', category: '', family: 'ADVISOR_CHECK_FAMILY_MONGODB', }, @@ -202,7 +202,7 @@ export const allChecksStub: CheckDetails[] = [ name: 'test5', summary: 'Test 5', disabled: true, - interval: 'STANDARD', + interval: 'ADVISOR_CHECK_INTERVAL_STANDARD', category: '', family: 'ADVISOR_CHECK_FAMILY_MONGODB', }, diff --git a/public/app/percona/check/components/AllChecksTab/AllChecksTab.constants.ts b/public/app/percona/check/components/AllChecksTab/AllChecksTab.constants.ts index 645567244f451..28aae77abf9f1 100644 --- a/public/app/percona/check/components/AllChecksTab/AllChecksTab.constants.ts +++ b/public/app/percona/check/components/AllChecksTab/AllChecksTab.constants.ts @@ -11,7 +11,8 @@ export const STATUS_OPTIONS: Array> = [ ]; export const INTERVAL_OPTIONS: Array> = [ { value: 'all', label: 'All' }, - { value: Interval.FREQUENT, label: Interval.FREQUENT }, - { value: Interval.STANDARD, label: Interval.STANDARD }, - { value: Interval.RARE, label: Interval.RARE }, + { value: Interval.ADVISOR_CHECK_INTERVAL_FREQUENT, label: Interval.ADVISOR_CHECK_INTERVAL_FREQUENT }, + { value: Interval.ADVISOR_CHECK_INTERVAL_STANDARD, label: Interval.ADVISOR_CHECK_INTERVAL_STANDARD }, + { value: Interval.ADVISOR_CHECK_INTERVAL_RARE, label: Interval.ADVISOR_CHECK_INTERVAL_RARE }, + { value: Interval.ADVISOR_CHECK_INTERVAL_UNSPECIFIED, label: Interval.ADVISOR_CHECK_INTERVAL_UNSPECIFIED }, ]; diff --git a/public/app/percona/check/components/AllChecksTab/AllChecksTab.tsx b/public/app/percona/check/components/AllChecksTab/AllChecksTab.tsx index 7a9dac1661451..6abd87ea95e37 100644 --- a/public/app/percona/check/components/AllChecksTab/AllChecksTab.tsx +++ b/public/app/percona/check/components/AllChecksTab/AllChecksTab.tsx @@ -143,16 +143,20 @@ export const AllChecksTab: FC> type: FilterFieldTypes.DROPDOWN, options: [ { - label: Interval.STANDARD, - value: Interval.STANDARD, + label: Interval.ADVISOR_CHECK_INTERVAL_STANDARD, + value: Interval.ADVISOR_CHECK_INTERVAL_STANDARD, }, { - label: Interval.RARE, - value: Interval.RARE, + label: Interval.ADVISOR_CHECK_INTERVAL_RARE, + value: Interval.ADVISOR_CHECK_INTERVAL_RARE, }, { - label: Interval.FREQUENT, - value: Interval.FREQUENT, + label: Interval.ADVISOR_CHECK_INTERVAL_FREQUENT, + value: Interval.ADVISOR_CHECK_INTERVAL_FREQUENT, + }, + { + label: Interval.ADVISOR_CHECK_INTERVAL_UNSPECIFIED, + value: Interval.ADVISOR_CHECK_INTERVAL_UNSPECIFIED, }, ], }, diff --git a/public/app/percona/check/components/AllChecksTab/ChangeCheckIntervalModal/ChangeCheckIntervalModal.test.tsx b/public/app/percona/check/components/AllChecksTab/ChangeCheckIntervalModal/ChangeCheckIntervalModal.test.tsx index 3b0f848fc83bb..c718061267a0a 100644 --- a/public/app/percona/check/components/AllChecksTab/ChangeCheckIntervalModal/ChangeCheckIntervalModal.test.tsx +++ b/public/app/percona/check/components/AllChecksTab/ChangeCheckIntervalModal/ChangeCheckIntervalModal.test.tsx @@ -17,7 +17,7 @@ jest.mock('app/core/app_events', () => { const TEST_CHECK: CheckDetails = { summary: 'Test', name: 'test', - interval: 'STANDARD', + interval: 'ADVISOR_CHECK_INTERVAL_STANDARD', description: 'test description', disabled: false, category: '', diff --git a/public/app/percona/check/types.ts b/public/app/percona/check/types.ts index 0b60d1ccd8589..f065c845c4188 100644 --- a/public/app/percona/check/types.ts +++ b/public/app/percona/check/types.ts @@ -77,9 +77,10 @@ export enum AlertState { } export enum Interval { - STANDARD = 'Standard', - RARE = 'Rare', - FREQUENT = 'Frequent', + ADVISOR_CHECK_INTERVAL_STANDARD = 'Standard', + ADVISOR_CHECK_INTERVAL_RARE = 'Rare', + ADVISOR_CHECK_INTERVAL_FREQUENT = 'Frequent', + ADVISOR_CHECK_INTERVAL_UNSPECIFIED = 'Unspecified', } export interface CheckDetails { diff --git a/public/app/percona/pmm-dump/PMMDump.tsx b/public/app/percona/pmm-dump/PMMDump.tsx index 5c6d874c1754c..49bebc41bbed8 100644 --- a/public/app/percona/pmm-dump/PMMDump.tsx +++ b/public/app/percona/pmm-dump/PMMDump.tsx @@ -15,7 +15,6 @@ import { ExtendedColumn, FilterFieldTypes, Table } from 'app/percona/shared/comp import { PMM_DUMP_PAGE, } from "app/percona/shared/components/PerconaBootstrapper/PerconaNavigation"; -import { usePerconaNavModel } from 'app/percona/shared/components/hooks/perconaNavModel'; import { deletePmmDumpAction, downloadPmmDumpAction, From 79773a294b1f1fa875ee2230682c7521f8831b12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cdorac-ext=E2=80=9D?= <103416234+doracretu3pillar@users.noreply.github.com> Date: Mon, 5 Aug 2024 18:14:53 +0300 Subject: [PATCH 09/13] Replace restoreId with artefactId --- .../components/RestoreHistory/RestoreHistory.service.ts | 4 ++-- .../backup/components/RestoreHistory/RestoreHistory.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/app/percona/backup/components/RestoreHistory/RestoreHistory.service.ts b/public/app/percona/backup/components/RestoreHistory/RestoreHistory.service.ts index 000bca1d25a98..b923ae6cc40f4 100644 --- a/public/app/percona/backup/components/RestoreHistory/RestoreHistory.service.ts +++ b/public/app/percona/backup/components/RestoreHistory/RestoreHistory.service.ts @@ -43,9 +43,9 @@ export const RestoreHistoryService = { }) ); }, - async getLogs(restoreId: string, offset: number, limit: number, cancelToken?: CancelToken): Promise { + async getLogs(artefactId: string, offset: number, limit: number, cancelToken?: CancelToken): Promise { const { logs = [], end } = await api.get( - `${BASE_URL}/${restoreId}/logs`, + `${BASE_URL}/${artefactId}/logs`, false, { cancelToken, params: { offset, limit } } ); diff --git a/public/app/percona/backup/components/RestoreHistory/RestoreHistory.tsx b/public/app/percona/backup/components/RestoreHistory/RestoreHistory.tsx index 8abebab5c03d7..6bbe01f609a90 100644 --- a/public/app/percona/backup/components/RestoreHistory/RestoreHistory.tsx +++ b/public/app/percona/backup/components/RestoreHistory/RestoreHistory.tsx @@ -200,7 +200,7 @@ export const RestoreHistory: FC = () => { const getLogs = useCallback( async (startingChunk: number, offset: number, token?: CancelToken) => - RestoreHistoryService.getLogs(selectedRestore!.id, startingChunk, offset, token), + RestoreHistoryService.getLogs(selectedRestore!.artifactId, startingChunk, offset, token), [selectedRestore] ); From 6500d700439b23ffbb69486db1e7bfca4a9b54b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cdorac-ext=E2=80=9D?= <103416234+doracretu3pillar@users.noreply.github.com> Date: Wed, 7 Aug 2024 12:36:34 +0300 Subject: [PATCH 10/13] Fixed prettier --- .../backup/components/ScheduledBackups/ScheduledBackups.tsx | 2 +- public/app/percona/pmm-dump/PMMDump.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/percona/backup/components/ScheduledBackups/ScheduledBackups.tsx b/public/app/percona/backup/components/ScheduledBackups/ScheduledBackups.tsx index 400f77f8fb264..78a6e40a797c9 100644 --- a/public/app/percona/backup/components/ScheduledBackups/ScheduledBackups.tsx +++ b/public/app/percona/backup/components/ScheduledBackups/ScheduledBackups.tsx @@ -8,7 +8,7 @@ import { locationService } from '@grafana/runtime'; import { LinkButton, useStyles } from '@grafana/ui'; import { appEvents } from 'app/core/app_events'; import { Page } from 'app/core/components/Page/Page'; -import { BackupType } from "app/percona/backup/Backup.types"; +import { BackupType } from 'app/percona/backup/Backup.types'; import { DeleteModal } from 'app/percona/shared/components/Elements/DeleteModal'; import { FeatureLoader } from 'app/percona/shared/components/Elements/FeatureLoader'; import { ExtendedColumn, FilterFieldTypes, Table } from 'app/percona/shared/components/Elements/Table'; diff --git a/public/app/percona/pmm-dump/PMMDump.tsx b/public/app/percona/pmm-dump/PMMDump.tsx index 49bebc41bbed8..01f4d794e2451 100644 --- a/public/app/percona/pmm-dump/PMMDump.tsx +++ b/public/app/percona/pmm-dump/PMMDump.tsx @@ -14,7 +14,7 @@ import { Action } from 'app/percona/shared/components/Elements/MultipleActions'; import { ExtendedColumn, FilterFieldTypes, Table } from 'app/percona/shared/components/Elements/Table'; import { PMM_DUMP_PAGE, -} from "app/percona/shared/components/PerconaBootstrapper/PerconaNavigation"; +} from 'app/percona/shared/components/PerconaBootstrapper/PerconaNavigation'; import { deletePmmDumpAction, downloadPmmDumpAction, From b83d3ec56f705a951b6ace4a15822794a8af03e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cdorac-ext=E2=80=9D?= <103416234+doracretu3pillar@users.noreply.github.com> Date: Wed, 7 Aug 2024 12:50:52 +0300 Subject: [PATCH 11/13] Fixed PMMDump.tsx prettier --- public/app/percona/pmm-dump/PMMDump.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/public/app/percona/pmm-dump/PMMDump.tsx b/public/app/percona/pmm-dump/PMMDump.tsx index 01f4d794e2451..2929a53a348c0 100644 --- a/public/app/percona/pmm-dump/PMMDump.tsx +++ b/public/app/percona/pmm-dump/PMMDump.tsx @@ -12,9 +12,7 @@ import { DumpStatus, DumpStatusColor, DumpStatusText, PMMDumpServices } from 'ap import { DetailsRow } from 'app/percona/shared/components/Elements/DetailsRow/DetailsRow'; import { Action } from 'app/percona/shared/components/Elements/MultipleActions'; import { ExtendedColumn, FilterFieldTypes, Table } from 'app/percona/shared/components/Elements/Table'; -import { - PMM_DUMP_PAGE, -} from 'app/percona/shared/components/PerconaBootstrapper/PerconaNavigation'; +import { PMM_DUMP_PAGE } from 'app/percona/shared/components/PerconaBootstrapper/PerconaNavigation'; import { deletePmmDumpAction, downloadPmmDumpAction, @@ -281,10 +279,12 @@ export const PMMDump = () => { ); return ( - +
{selectedRows.length > 0 ? ( From a21297d673400e2a2d26cd2ed9a538d44ae12e0d Mon Sep 17 00:00:00 2001 From: Matej Kubinec Date: Thu, 19 Sep 2024 11:09:08 +0200 Subject: [PATCH 12/13] PMM-12710 Fix backup editing --- .../AddBackupPage/AddBackupPage.tsx | 343 +++++++++--------- 1 file changed, 173 insertions(+), 170 deletions(-) diff --git a/public/app/percona/backup/components/AddBackupPage/AddBackupPage.tsx b/public/app/percona/backup/components/AddBackupPage/AddBackupPage.tsx index fa80f383d2927..7261056f6fc86 100644 --- a/public/app/percona/backup/components/AddBackupPage/AddBackupPage.tsx +++ b/public/app/percona/backup/components/AddBackupPage/AddBackupPage.tsx @@ -3,10 +3,11 @@ import { cx } from '@emotion/css'; import React, { FC, useCallback, useEffect, useMemo, useState } from 'react'; import { Field, withTypes } from 'react-final-form'; -import { AppEvents, SelectableValue } from '@grafana/data'; +import { AppEvents, PageLayoutType, SelectableValue } from '@grafana/data'; import { locationService } from '@grafana/runtime'; import { CollapsableSection, CustomScrollbar, LinkButton, PageToolbar, useStyles2 } from '@grafana/ui'; import appEvents from 'app/core/app_events'; +import { Page } from 'app/core/components/Page/Page'; import { useQueryParams } from 'app/core/hooks/useQueryParams'; import { GrafanaRouteComponentProps } from 'app/core/navigation/types'; import { LoaderButton } from 'app/percona/shared/components/Elements/LoaderButton'; @@ -41,7 +42,7 @@ import { ScheduledBackupsService } from '../ScheduledBackups/ScheduledBackups.se import { ScheduledBackup } from '../ScheduledBackups/ScheduledBackups.types'; import { LocationType } from '../StorageLocations/StorageLocations.types'; -import { DATA_MODEL_OPTIONS, MAX_BACKUP_NAME, SCHEDULED_TYPE } from './AddBackupPage.constants'; +import { DATA_MODEL_OPTIONS, MAX_BACKUP_NAME } from './AddBackupPage.constants'; import { Messages } from './AddBackupPage.messages'; import { AddBackupPageService } from './AddBackupPage.service'; import { getStyles } from './AddBackupPage.styles'; @@ -58,7 +59,7 @@ import { ScheduleSection } from './ScheduleSection/ScheduleSection'; const AddBackupPage: FC> = ({ match }) => { const [queryParams, setQueryParams] = useQueryParams(); - const scheduleMode: boolean = (queryParams['scheduled'] as boolean) || match.params.type === SCHEDULED_TYPE; + const scheduleMode: boolean = (queryParams['scheduled'] as boolean) || match.params.type === BackupType.SCHEDULED; const [backup, setBackup] = useState(null); const [pending, setPending] = useState(false); const [advancedSectionOpen, setAdvancedSectionOpen] = useState(false); @@ -95,7 +96,7 @@ const AddBackupPage: FC backups = await BackupInventoryService.list(generateToken(LIST_ARTIFACTS_CANCEL_TOKEN)); } for (const value of backups) { - if (value.id === `/${match.params.type}/${match.params.id}`) { + if (value.id === match.params.id) { backup = value; break; } @@ -190,189 +191,191 @@ const AddBackupPage: FC ); return ( - -
{ - tools.changeValue(state, 'vendor', () => vendor); - tools.changeValue(state, 'dataModel', () => getDataModelFromVendor(vendor)); - //TODO remove this when we support incremental backups for MySQL - if (vendor === Databases.mysql) { - tools.changeValue(state, 'mode', () => BackupMode.SNAPSHOT); - } - }, - changeDataModel: ([labels]: [NodeListOf | null], state, tools) => { - if (labels?.length) { - const label = labels[0].textContent; - - if (label === BackupMode.PITR) { - tools.changeValue(state, 'dataModel', () => DataModel.LOGICAL); + + + { + tools.changeValue(state, 'vendor', () => vendor); + tools.changeValue(state, 'dataModel', () => getDataModelFromVendor(vendor)); + //TODO remove this when we support incremental backups for MySQL + if (vendor === Databases.mysql) { + tools.changeValue(state, 'mode', () => BackupMode.SNAPSHOT); } - } - }, - changeFolder: ([cluster]: [string], state, tools) => { - if (!cluster) { - setAdvancedSectionOpen(true); - } + }, + changeDataModel: ([labels]: [NodeListOf | null], state, tools) => { + if (labels?.length) { + const label = labels[0].textContent; - tools.changeValue(state, 'folder', () => cluster); - }, - }} - render={({ handleSubmit, valid, pristine, submitting, values, form }) => ( - - - - {Messages.cancelAction} - - DataModel.LOGICAL); } - loading={submitting} - > - {Messages.getSubmitButtonText(values.type === BackupType.SCHEDULED, editing)} - - -
- -
-
- {!editing && } -

{Messages.backupInfo}

-
- - - - - - {({ input }) => ( - ) => { - input.onChange(service); - form.mutators.changeVendor(service.value!.vendor); - form.mutators.changeFolder(service.value!.cluster); - }} - className={styles.selectField} - data-testid="service-select-input" - /> - )} - - - - - - - DATABASE_LABELS[vendor as Databases] || ''} - /> - - - - {({ input }) => ( -
- { + if (!cluster) { + setAdvancedSectionOpen(true); + } + + tools.changeValue(state, 'folder', () => cluster); + }, + }} + render={({ handleSubmit, valid, pristine, submitting, values, form }) => ( + + + + {Messages.cancelAction} + + + {Messages.getSubmitButtonText(values.type === BackupType.SCHEDULED, editing)} + + +
+ +
+
+ {!editing && } +

{Messages.backupInfo}

+
+ + + + + + {({ input }) => ( + ) => { + input.onChange(service); + form.mutators.changeVendor(service.value!.vendor); + form.mutators.changeFolder(service.value!.cluster); + }} className={styles.selectField} - data-testid="location-select-input" + data-testid="service-select-input" /> -
- )} - - - {scheduleMode && ( - - + )} + - )} - {values.type === BackupType.SCHEDULED && ( - + ) => - form.mutators.changeDataModel(e.target.labels), - }} /> - )} -
-
- {values.type === BackupType.SCHEDULED && } -
- - + DATABASE_LABELS[vendor as Databases] || ''} /> - - {!!backupErrors.length && } + + + + {({ input }) => ( +
+ +
+ )} +
+
+ {scheduleMode && ( + + + + )} + {values.type === BackupType.SCHEDULED && ( + + ) => + form.mutators.changeDataModel(e.target.labels), + }} + /> + + )} +
+
+ {values.type === BackupType.SCHEDULED && } +
+ + + + + {!!backupErrors.length && } +
-
- -
- - )} - /> - + +
+ + )} + /> + + ); }; From 4cca1a616d4b2a08e4dc97ea42d0f03dac1dbc08 Mon Sep 17 00:00:00 2001 From: Matej Kubinec Date: Mon, 30 Sep 2024 15:04:33 +0200 Subject: [PATCH 13/13] PMM-12710 Fix AddBackupPage unit tests --- .../AddBackupPage/AddBackupPage.test.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/public/app/percona/backup/components/AddBackupPage/AddBackupPage.test.tsx b/public/app/percona/backup/components/AddBackupPage/AddBackupPage.test.tsx index 15add3acf2df2..6705e3f88a05d 100644 --- a/public/app/percona/backup/components/AddBackupPage/AddBackupPage.test.tsx +++ b/public/app/percona/backup/components/AddBackupPage/AddBackupPage.test.tsx @@ -5,9 +5,11 @@ import { Router } from 'react-router-dom'; import { locationService } from '@grafana/runtime'; import { getRouteComponentProps } from 'app/core/navigation/__mocks__/routeProps'; +import { wrapWithGrafanaContextMock } from 'app/percona/shared/helpers/testUtils'; import { configureStore } from 'app/store/configureStore'; import { StoreState } from 'app/types'; +import { BackupType } from '../../Backup.types'; import { LocationType } from '../StorageLocations/StorageLocations.types'; import AddBackupPage from './AddBackupPage'; @@ -18,8 +20,8 @@ jest.mock('../BackupInventory/BackupInventory.service'); jest.mock('./AddBackupPage.service'); jest.mock('app/percona/backup/components/StorageLocations/StorageLocations.service'); -const AddBackupPageWrapper: FC = ({ children }) => { - return ( +const AddBackupPageWrapper: FC = ({ children }) => + wrapWithGrafanaContextMock( = ({ children }) => { {children} ); -}; describe('AddBackupPage', () => { it('should render fields', async () => { @@ -77,7 +78,7 @@ describe('AddBackupPage', () => { @@ -94,7 +95,7 @@ describe('AddBackupPage', () => { @@ -124,7 +125,7 @@ describe('AddBackupPage', () => { @@ -157,7 +158,7 @@ describe('AddBackupPage', () => {