From f551f2b8387f9e838d7d0b5bfd20c65f36f99203 Mon Sep 17 00:00:00 2001 From: Dora <103416234+doracretu3pillar@users.noreply.github.com> Date: Mon, 30 Sep 2024 16:38:58 +0300 Subject: [PATCH] Pmm-12710: Api fixes (#763) * Fix scheduled backups deletion * Fixed restores:start * Fixed edit scheduled backup page * Added the type to the locationService * Fixed the wrong settings payload * PMM Dump fix * PMM-12710 Fix updates check * Fixed the interval for Security Advisors * Replace restoreId with artefactId * Fixed prettier * Fixed PMMDump.tsx prettier * PMM-12710 Fix backup editing * PMM-12710 Fix AddBackupPage unit tests --------- Co-authored-by: Matej Kubinec --- .../AddBackupPage/AddBackupPage.test.tsx | 15 +- .../AddBackupPage/AddBackupPage.tsx | 343 +++++++++--------- .../BackupInventory.service.ts | 2 +- .../BackupInventory/BackupInventory.tsx | 2 +- .../RestoreHistory/RestoreHistory.service.ts | 4 +- .../RestoreHistory/RestoreHistory.tsx | 2 +- .../ScheduledBackups.service.ts | 2 +- .../ScheduledBackups/ScheduledBackups.tsx | 3 +- 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 | 10 +- .../app/percona/settings/Settings.service.ts | 2 +- public/app/percona/settings/Settings.types.ts | 2 +- .../services/updates/Updates.service.ts | 6 +- .../shared/services/updates/Updates.types.ts | 2 +- 18 files changed, 226 insertions(+), 211 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', () => { 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 && } +
-
- -
- - )} - /> - + +
+ + )} + /> + + ); }; 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, 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/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] ); 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}`); }, }; diff --git a/public/app/percona/backup/components/ScheduledBackups/ScheduledBackups.tsx b/public/app/percona/backup/components/ScheduledBackups/ScheduledBackups.tsx index 9348dfe5f5335..78a6e40a797c9 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.id}/edit`); + locationService.push(`/backup/${BackupType.SCHEDULED}/${backup.id}/edit`); }; const getCellProps = useCallback( 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 54e29106ffeab..2929a53a348c0 100644 --- a/public/app/percona/pmm-dump/PMMDump.tsx +++ b/public/app/percona/pmm-dump/PMMDump.tsx @@ -12,7 +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 { usePerconaNavModel } from 'app/percona/shared/components/hooks/perconaNavModel'; +import { PMM_DUMP_PAGE } from 'app/percona/shared/components/PerconaBootstrapper/PerconaNavigation'; import { deletePmmDumpAction, downloadPmmDumpAction, @@ -44,7 +44,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 +279,12 @@ export const PMMDump = () => { ); return ( - +
{selectedRows.length > 0 ? ( 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; 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; }