diff options
author | Jeremy Davis <jeremy.davis@sonarsource.com> | 2024-12-03 11:51:55 +0100 |
---|---|---|
committer | Steve Marion <steve.marion@sonarsource.com> | 2024-12-18 11:13:22 +0100 |
commit | fb8c7e82be68bebdf4473a3020c91699e8021467 (patch) | |
tree | b8bbd8f4d8f48e3fed206382131c7a1a76ac512b /server/sonar-web/src/main/js/apps/projectDump | |
parent | 150964c272076babccd1d1fdd837d0324cdbd4ad (diff) | |
download | sonarqube-fb8c7e82be68bebdf4473a3020c91699e8021467.tar.gz sonarqube-fb8c7e82be68bebdf4473a3020c91699e8021467.zip |
SONAR-23605 Cleanup legacy sonar-web
Diffstat (limited to 'server/sonar-web/src/main/js/apps/projectDump')
7 files changed, 0 insertions, 783 deletions
diff --git a/server/sonar-web/src/main/js/apps/projectDump/ProjectDumpApp.tsx b/server/sonar-web/src/main/js/apps/projectDump/ProjectDumpApp.tsx deleted file mode 100644 index dda0b1da9fb..00000000000 --- a/server/sonar-web/src/main/js/apps/projectDump/ProjectDumpApp.tsx +++ /dev/null @@ -1,75 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2024 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import { Helmet } from 'react-helmet-async'; -import { BasicSeparator, LargeCenteredLayout, PageContentFontWrapper, Title } from '~design-system'; -import withAvailableFeatures, { - WithAvailableFeaturesProps, -} from '../../app/components/available-features/withAvailableFeatures'; -import withComponentContext from '../../app/components/componentContext/withComponentContext'; -import { translate } from '../../helpers/l10n'; -import { Feature } from '../../types/features'; -import { Component } from '../../types/types'; -import Export from './components/Export'; -import Import from './components/Import'; -import './styles.css'; - -interface Props extends WithAvailableFeaturesProps { - component: Component; -} - -export function ProjectDumpApp({ component, hasFeature }: Readonly<Props>) { - const projectImportFeatureEnabled = hasFeature(Feature.ProjectImport); - - return ( - <LargeCenteredLayout id="project-dump"> - <PageContentFontWrapper className="sw-my-8 sw-typo-default"> - <header className="sw-mb-5"> - <Helmet defer={false} title={translate('project_dump.page')} /> - <Title className="sw-mb-4">{translate('project_dump.page')}</Title> - <div> - {projectImportFeatureEnabled ? ( - <> - <p>{translate('project_dump.page.description1')}</p> - <p>{translate('project_dump.page.description2')}</p> - </> - ) : ( - <> - <p>{translate('project_dump.page.description_without_import1')}</p> - <p>{translate('project_dump.page.description_without_import2')}</p> - </> - )} - </div> - </header> - - <> - <div className="sw-mb-4"> - <h2 className="sw-heading-lg">{translate('project_dump.export')}</h2> - </div> - <Export componentKey={component.key} /> - <BasicSeparator className="sw-my-8" /> - <Import importEnabled={!!projectImportFeatureEnabled} componentKey={component.key} /> - </> - </PageContentFontWrapper> - </LargeCenteredLayout> - ); -} - -export default withComponentContext(withAvailableFeatures(ProjectDumpApp)); diff --git a/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-it.tsx b/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-it.tsx deleted file mode 100644 index 8c1875ffaab..00000000000 --- a/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-it.tsx +++ /dev/null @@ -1,207 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2024 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import { act, screen } from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; -import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; -import ComputeEngineServiceMock from '../../../api/mocks/ComputeEngineServiceMock'; -import { ProjectDumpServiceMock } from '../../../api/mocks/ProjectDumpServiceMock'; -import { mockComponent } from '../../../helpers/mocks/component'; -import { renderAppWithComponentContext } from '../../../helpers/testReactTestingUtils'; -import { Feature } from '../../../types/features'; -import { TaskStatuses, TaskTypes } from '../../../types/tasks'; -import routes from '../routes'; - -const computeEngineHandler = new ComputeEngineServiceMock(); -const handler = new ProjectDumpServiceMock(computeEngineHandler); - -const COMPONENT_KEY = 'test'; - -const ui = { - pageDescriptionWithImport: byText('project_dump.page.description1'), - pageDescriptionWithoutImport: byText('project_dump.page.description_without_import1'), - - disabledImportFeatureMsg: byText('project_dump.import_form_description_disabled'), - - exportBtn: byRole('button', { name: 'project_dump.do_export' }), - importBtn: byRole('button', { name: 'project_dump.do_import' }), - - successExport: byText('project_dump.latest_export_available.June 8, 2023', { exact: false }), - pendingExport: byText('project_dump.pending_export.June 8, 2023', { exact: false }), - inProgressExport: byText('project_dump.in_progress_export.1 hour ago'), - failedExport: byText('project_dump.failed_export'), - cantExportMsg: byText('project_dump.can_not_export'), - - successImport: byText('project_dump.import_success.June 8, 2023', { exact: false }), - pendingImport: byText('project_dump.pending_import.June 8, 2023', { exact: false }), - inProgressImport: byText('project_dump.in_progress_import.1 hour ago'), - failedImport: byText('project_dump.failed_import'), - cantImportMsg: byText('project_dump.can_not_import'), - noDumpImportMsg: byText('project_dump.no_file_to_import'), -}; - -beforeEach(() => { - computeEngineHandler.reset(); - handler.reset(); - jest.useFakeTimers({ - advanceTimers: true, - now: new Date('2023-06-08T13:00:00Z'), - }); -}); - -afterEach(() => { - jest.runOnlyPendingTimers(); - jest.useRealTimers(); -}); - -it('can export project, but can not import', async () => { - renderProjectKeyApp([Feature.ProjectImport]); - expect(await ui.exportBtn.find()).toBeInTheDocument(); - expect(ui.importBtn.query()).not.toBeInTheDocument(); - expect(ui.pageDescriptionWithImport.get()).toBeInTheDocument(); - expect(ui.pageDescriptionWithoutImport.query()).not.toBeInTheDocument(); - expect(ui.cantImportMsg.get()).toBeInTheDocument(); - await userEvent.click(ui.exportBtn.get()); - expect(await ui.successExport.find()).toBeInTheDocument(); - expect(screen.getByText(`/tmp/${COMPONENT_KEY}.zip`)).toBeInTheDocument(); -}); - -it('can export project without import feature', async () => { - renderProjectKeyApp([]); - expect(await ui.exportBtn.find()).toBeInTheDocument(); - expect(ui.importBtn.query()).not.toBeInTheDocument(); - expect(ui.pageDescriptionWithoutImport.get()).toBeInTheDocument(); - expect(ui.pageDescriptionWithImport.query()).not.toBeInTheDocument(); - expect(ui.disabledImportFeatureMsg.get()).toBeInTheDocument(); - await userEvent.click(ui.exportBtn.get()); - expect(await ui.successExport.find()).toBeInTheDocument(); - expect(screen.getByText(`/tmp/${COMPONENT_KEY}.zip`)).toBeInTheDocument(); -}); - -it('should show pending->in progress->failed export', async () => { - handler.useCustomTasks(); - renderProjectKeyApp([]); - computeEngineHandler.addTask({ - componentKey: COMPONENT_KEY, - type: TaskTypes.ProjectExport, - status: TaskStatuses.Pending, - submittedAt: '2023-06-08T11:55:00Z', - }); - - await userEvent.click(await ui.exportBtn.find()); - expect(await ui.pendingExport.find()).toBeInTheDocument(); - expect(ui.exportBtn.query()).not.toBeInTheDocument(); - - computeEngineHandler.addTask({ - componentKey: COMPONENT_KEY, - type: TaskTypes.ProjectExport, - status: TaskStatuses.InProgress, - startedAt: '2023-06-08T12:00:00Z', - }); - jest.runOnlyPendingTimers(); - expect(await ui.inProgressExport.find()).toBeInTheDocument(); - expect(ui.exportBtn.query()).not.toBeInTheDocument(); - - computeEngineHandler.addTask({ - componentKey: COMPONENT_KEY, - type: TaskTypes.ProjectExport, - status: TaskStatuses.Failed, - executedAt: '2023-06-08T12:05:00Z', - }); - act(() => { - jest.runOnlyPendingTimers(); - }); - expect(await ui.failedExport.find()).toBeInTheDocument(); - expect(ui.exportBtn.get()).toBeInTheDocument(); -}); - -it('can import project once, and can not export', async () => { - handler.setImportState(); - renderProjectKeyApp([Feature.ProjectImport]); - expect(await ui.importBtn.find()).toBeInTheDocument(); - expect(ui.exportBtn.query()).not.toBeInTheDocument(); - expect(ui.cantExportMsg.get()).toBeInTheDocument(); - await userEvent.click(ui.importBtn.get()); - expect(await ui.successImport.find()).toBeInTheDocument(); - expect(ui.importBtn.query()).not.toBeInTheDocument(); -}); - -it('should show pending->in progress->failed import', async () => { - handler.useCustomTasks(); - handler.setImportState(); - renderProjectKeyApp([Feature.ProjectImport]); - computeEngineHandler.addTask({ - componentKey: COMPONENT_KEY, - type: TaskTypes.ProjectImport, - status: TaskStatuses.Pending, - submittedAt: '2023-06-08T11:55:00Z', - }); - await userEvent.click(await ui.importBtn.find()); - expect(await ui.pendingImport.find()).toBeInTheDocument(); - expect(ui.importBtn.query()).not.toBeInTheDocument(); - - computeEngineHandler.addTask({ - componentKey: COMPONENT_KEY, - type: TaskTypes.ProjectImport, - status: TaskStatuses.InProgress, - startedAt: '2023-06-08T12:00:00Z', - }); - jest.runOnlyPendingTimers(); - expect(await ui.inProgressImport.find()).toBeInTheDocument(); - expect(ui.importBtn.query()).not.toBeInTheDocument(); - - computeEngineHandler.addTask({ - componentKey: COMPONENT_KEY, - type: TaskTypes.ProjectImport, - status: TaskStatuses.Failed, - executedAt: '2023-06-08T12:05:00Z', - }); - act(() => { - jest.runOnlyPendingTimers(); - }); - expect(await ui.failedImport.find()).toBeInTheDocument(); - expect(ui.importBtn.get()).toBeInTheDocument(); -}); - -it(`can't import if no dump file`, async () => { - handler.setImportState(); - handler.dumpToImport = undefined; - renderProjectKeyApp([Feature.ProjectImport]); - expect(await ui.noDumpImportMsg.find()).toBeInTheDocument(); - expect(ui.importBtn.query()).not.toBeInTheDocument(); -}); - -it('can do nothing', async () => { - handler.setImportState(); - renderProjectKeyApp([]); - expect(await ui.cantExportMsg.find()).toBeInTheDocument(); - expect(ui.importBtn.query()).not.toBeInTheDocument(); - expect(ui.exportBtn.query()).not.toBeInTheDocument(); - expect(ui.disabledImportFeatureMsg.get()).toBeInTheDocument(); -}); - -function renderProjectKeyApp(featureList: Feature[] = []) { - return renderAppWithComponentContext( - 'import_export', - routes, - { featureList }, - { component: mockComponent({ key: COMPONENT_KEY }) }, - ); -} diff --git a/server/sonar-web/src/main/js/apps/projectDump/components/Export.tsx b/server/sonar-web/src/main/js/apps/projectDump/components/Export.tsx deleted file mode 100644 index 9876c968640..00000000000 --- a/server/sonar-web/src/main/js/apps/projectDump/components/Export.tsx +++ /dev/null @@ -1,186 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2024 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import { Button, Spinner } from '@sonarsource/echoes-react'; -import { noop } from 'lodash'; -import { FlagMessage, Link } from '~design-system'; -import DateFromNow from '../../../components/intl/DateFromNow'; -import DateTimeFormatter from '../../../components/intl/DateTimeFormatter'; -import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { useLastActivityQuery } from '../../../queries/ce'; -import { useProjectDumpStatusQuery, useProjectExportMutation } from '../../../queries/project-dump'; -import { DumpTask } from '../../../types/project-dump'; -import { TaskStatuses, TaskTypes } from '../../../types/tasks'; -import { getImportExportActivityParams } from '../utils'; - -interface Props { - componentKey: string; -} -const PROGRESS_STATUS = [TaskStatuses.Pending, TaskStatuses.InProgress]; -const REFRESH_INTERVAL = 5000; - -export default function Export({ componentKey }: Readonly<Props>) { - const { data: task, refetch: refetchLastActivity } = useLastActivityQuery( - getImportExportActivityParams(componentKey, TaskTypes.ProjectExport), - { - refetchInterval: ({ state: { data } }) => { - return data && PROGRESS_STATUS.includes(data.status) ? REFRESH_INTERVAL : undefined; - }, - }, - ); - const { data: status, refetch: refetchDumpStatus } = useProjectDumpStatusQuery(componentKey, { - refetchInterval: () => { - return task && PROGRESS_STATUS.includes(task.status) ? REFRESH_INTERVAL : undefined; - }, - }); - const { mutateAsync: doExport } = useProjectExportMutation(); - - const isDumpAvailable = Boolean(status?.exportedDump); - - const handleExport = async () => { - try { - await doExport(componentKey); - refetchLastActivity(); - refetchDumpStatus(); - } catch (_) { - noop(); - } - }; - - function renderWhenCanNotExport() { - return ( - <FlagMessage className="sw-mb-4" variant="warning"> - {translate('project_dump.can_not_export')} - </FlagMessage> - ); - } - - function renderWhenExportPending(task: DumpTask) { - return ( - <div className="sw-flex sw-gap-2"> - <Spinner /> - <DateTimeFormatter date={task.submittedAt}> - {(formatted) => ( - <output>{translateWithParameters('project_dump.pending_export', formatted)}</output> - )} - </DateTimeFormatter> - </div> - ); - } - - function renderWhenExportInProgress(task: DumpTask) { - return ( - <div className="sw-flex sw-gap-2"> - <Spinner /> - {task.startedAt && ( - <DateFromNow date={task.startedAt}> - {(fromNow) => ( - <output>{translateWithParameters('project_dump.in_progress_export', fromNow)}</output> - )} - </DateFromNow> - )} - </div> - ); - } - - function renderWhenExportFailed() { - const detailsUrl = `/project/background_tasks?id=${encodeURIComponent( - componentKey, - )}&status=FAILED&taskType=PROJECT_EXPORT`; - - return ( - <div> - <FlagMessage className="sw-mb-4" variant="error"> - {translate('project_dump.failed_export')} - <Link className="sw-ml-1" to={detailsUrl}> - {translate('project_dump.see_details')} - </Link> - </FlagMessage> - - {renderExport()} - </div> - ); - } - - function renderDump(task?: DumpTask | null) { - return ( - <FlagMessage className="sw-mb-4" variant="success"> - <div> - {task?.executedAt && ( - <DateTimeFormatter date={task.executedAt}> - {(formatted) => ( - <div> - {translateWithParameters('project_dump.latest_export_available', formatted)} - </div> - )} - </DateTimeFormatter> - )} - <div> - {!task && <div>{translate('project_dump.export_available')}</div>} - - <p className="sw-mt-2">{status?.exportedDump}</p> - </div> - </div> - </FlagMessage> - ); - } - - function renderExport() { - return ( - <> - <div>{translate('project_dump.export_form_description')}</div> - <Button - aria-label={translate('project_dump.do_export')} - className="sw-mt-4" - onClick={handleExport} - > - {translate('project_dump.do_export')} - </Button> - </> - ); - } - - if (status === undefined || task === undefined) { - return <Spinner />; - } - - if (!status.canBeExported) { - return renderWhenCanNotExport(); - } - - if (task?.status === TaskStatuses.Pending) { - return renderWhenExportPending(task); - } - - if (task?.status === TaskStatuses.InProgress) { - return renderWhenExportInProgress(task); - } - - if (task?.status === TaskStatuses.Failed) { - return renderWhenExportFailed(); - } - - return ( - <div> - {isDumpAvailable && renderDump(task)} - {renderExport()} - </div> - ); -} diff --git a/server/sonar-web/src/main/js/apps/projectDump/components/Import.tsx b/server/sonar-web/src/main/js/apps/projectDump/components/Import.tsx deleted file mode 100644 index 267602f0c4f..00000000000 --- a/server/sonar-web/src/main/js/apps/projectDump/components/Import.tsx +++ /dev/null @@ -1,212 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2024 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import { Button, Spinner } from '@sonarsource/echoes-react'; -import { noop } from 'lodash'; -import * as React from 'react'; -import { FlagMessage, Link } from '~design-system'; -import DateFromNow from '../../../components/intl/DateFromNow'; -import DateTimeFormatter from '../../../components/intl/DateTimeFormatter'; -import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { getComponentBackgroundTaskUrl } from '../../../helpers/urls'; -import { useLastActivityQuery } from '../../../queries/ce'; -import { StaleTime } from '../../../queries/common'; -import { useProjectDumpStatusQuery, useProjectImportMutation } from '../../../queries/project-dump'; -import { DumpTask } from '../../../types/project-dump'; -import { TaskStatuses, TaskTypes } from '../../../types/tasks'; -import { getImportExportActivityParams } from '../utils'; - -interface Props { - componentKey: string; - importEnabled: boolean; -} -const PROGRESS_STATUS = [TaskStatuses.Pending, TaskStatuses.InProgress]; -const REFRESH_INTERVAL = 5000; - -export default function Import(props: Readonly<Props>) { - const { componentKey, importEnabled } = props; - - const { - data: task, - refetch: refetchImportActivity, - isLoading: isTaskLoading, - } = useLastActivityQuery(getImportExportActivityParams(componentKey, TaskTypes.ProjectImport), { - refetchInterval: ({ state: { data } }) => { - return data && PROGRESS_STATUS.includes(data.status) ? REFRESH_INTERVAL : undefined; - }, - }); - const { data: analysis, isLoading: isAnalysisActivityLoading } = useLastActivityQuery( - getImportExportActivityParams(componentKey, TaskTypes.Report), - { - staleTime: StaleTime.SHORT, - }, - ); - const { - data: status, - isLoading: isStatusLoading, - refetch: refetchDumpStatus, - } = useProjectDumpStatusQuery(componentKey, { - refetchInterval: () => { - return task && PROGRESS_STATUS.includes(task.status) ? REFRESH_INTERVAL : undefined; - }, - }); - const { mutateAsync: doImport } = useProjectImportMutation(); - const isLoading = isTaskLoading || isAnalysisActivityLoading || isStatusLoading; - - const handleImport = async () => { - try { - await doImport(componentKey); - refetchImportActivity(); - refetchDumpStatus(); - } catch (_) { - noop(); - } - }; - - function renderWhenCanNotImport() { - return <span>{translate('project_dump.can_not_import')}</span>; - } - - function renderWhenNoDump() { - return ( - <FlagMessage variant="warning">{translate('project_dump.no_file_to_import')}</FlagMessage> - ); - } - - function renderImportForm() { - return ( - <> - <div className="sw-mt-4">{translate('project_dump.import_form_description')}</div> - <Button - aria-label={translate('project_dump.do_import')} - className="sw-mt-4" - onClick={handleImport} - > - {translate('project_dump.do_import')} - </Button> - </> - ); - } - - function renderWhenImportSuccess(task: DumpTask) { - return ( - <> - {task.executedAt && ( - <DateTimeFormatter date={task.executedAt}> - {(formatted) => ( - <FlagMessage variant="success"> - {translateWithParameters('project_dump.import_success', formatted)} - </FlagMessage> - )} - </DateTimeFormatter> - )} - </> - ); - } - - function renderWhenImportPending(task: DumpTask) { - return ( - <> - <Spinner /> - <DateTimeFormatter date={task.submittedAt}> - {(formatted) => ( - <span>{translateWithParameters('project_dump.pending_import', formatted)}</span> - )} - </DateTimeFormatter> - </> - ); - } - - function renderWhenImportInProgress(task: DumpTask) { - return ( - <> - <Spinner /> - {task.startedAt && ( - <DateFromNow date={task.startedAt}> - {(fromNow) => ( - <span>{translateWithParameters('project_dump.in_progress_import', fromNow)}</span> - )} - </DateFromNow> - )} - </> - ); - } - - function renderWhenImportFailed() { - const { componentKey } = props; - const detailsUrl = getComponentBackgroundTaskUrl( - componentKey, - TaskStatuses.Failed, - TaskTypes.ProjectImport, - ); - - return ( - <div> - <FlagMessage variant="error"> - {translate('project_dump.failed_import')} - <Link className="sw-ml-1" to={detailsUrl}> - {translate('project_dump.see_details')} - </Link> - </FlagMessage> - - {renderImportForm()} - </div> - ); - } - - function renderContent(): React.ReactNode { - switch (task?.status) { - case TaskStatuses.Success: - if (!analysis) { - return renderWhenImportSuccess(task); - } - break; - case TaskStatuses.Pending: - return renderWhenImportPending(task); - case TaskStatuses.InProgress: - return renderWhenImportInProgress(task); - case TaskStatuses.Failed: - return renderWhenImportFailed(); - default: - if (status && !status.canBeImported) { - return renderWhenCanNotImport(); - } else if (status && status.dumpToImport === undefined) { - return renderWhenNoDump(); - } - return <div>{renderImportForm()}</div>; - } - } - - return ( - <> - <div className="sw-my-4"> - <h2 className="sw-heading-lg">{translate('project_dump.import')}</h2> - </div> - - <Spinner isLoading={isLoading}> - {importEnabled ? ( - renderContent() - ) : ( - <div>{translate('project_dump.import_form_description_disabled')}</div> - )} - </Spinner> - </> - ); -} diff --git a/server/sonar-web/src/main/js/apps/projectDump/routes.tsx b/server/sonar-web/src/main/js/apps/projectDump/routes.tsx deleted file mode 100644 index b0f806cafd8..00000000000 --- a/server/sonar-web/src/main/js/apps/projectDump/routes.tsx +++ /dev/null @@ -1,28 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2024 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import { Route } from 'react-router-dom'; -import { lazyLoadComponent } from '~sonar-aligned/helpers/lazyLoadComponent'; - -const ProjectDumpApp = lazyLoadComponent(() => import('./ProjectDumpApp')); - -const routes = () => <Route path="import_export" element={<ProjectDumpApp />} />; - -export default routes; diff --git a/server/sonar-web/src/main/js/apps/projectDump/styles.css b/server/sonar-web/src/main/js/apps/projectDump/styles.css deleted file mode 100644 index 580911e8e15..00000000000 --- a/server/sonar-web/src/main/js/apps/projectDump/styles.css +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2024 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -.export-dump { - margin-bottom: 20px; -} - -.export-dump-path { - padding: 5px 10px 5px 0; - overflow: auto; - white-space: nowrap; -} - -.project-dump-check { - float: right; - width: 60px; - height: 60px; - margin-left: 15px; -} - -#project-dump .import-disabled { - background-color: transparent; -} diff --git a/server/sonar-web/src/main/js/apps/projectDump/utils.ts b/server/sonar-web/src/main/js/apps/projectDump/utils.ts deleted file mode 100644 index 73e85452acd..00000000000 --- a/server/sonar-web/src/main/js/apps/projectDump/utils.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2024 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import { TaskStatuses, TaskTypes } from '../../types/tasks'; - -export const getImportExportActivityParams = (componentKey: string, taskType: TaskTypes) => { - return { - component: componentKey, - type: taskType, - ps: 1, - status: [ - TaskStatuses.Pending, - TaskStatuses.InProgress, - TaskStatuses.Success, - TaskStatuses.Failed, - TaskStatuses.Canceled, - ].join(','), - }; -}; |