diff --git a/CHANGELOG.md b/CHANGELOG.md index 70988a7e6d..f70c7d8efa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased ### Added +- Add repository export for Subversion ([#1488](https://github.com/scm-manager/scm-manager/pull/1488)) - Provide more options for Helm chart ([#1485](https://github.com/scm-manager/scm-manager/pull/1485)) - Option to create a permanent link to a source file ([#1489](https://github.com/scm-manager/scm-manager/pull/1489)) - add markdown codeblock renderer extension point ([#1492](https://github.com/scm-manager/scm-manager/pull/1492)) diff --git a/docs/de/user/repo/assets/repository-settings-general-svn.png b/docs/de/user/repo/assets/repository-settings-general-svn.png new file mode 100644 index 0000000000..8428eeaa25 Binary files /dev/null and b/docs/de/user/repo/assets/repository-settings-general-svn.png differ diff --git a/docs/de/user/repo/settings.md b/docs/de/user/repo/settings.md index ac1625b530..241db759c2 100644 --- a/docs/de/user/repo/settings.md +++ b/docs/de/user/repo/settings.md @@ -19,6 +19,12 @@ Ein archiviertes Repository kann nicht mehr verändert werden. ![Repository-Settings-General-Git](assets/repository-settings-general-git.png) +In dem Bereich "Repository exportieren" kann das Repository als Dump exportiert werden. +Für den Download kann zwischen einem komprimierten Archiv oder dem einfachen Dump-Format gewählt werden. +Diese Export-Funktion wird derzeit nur von Subversion Repositories unterstützt. + +![Repository-Settings-General-Svn](assets/repository-settings-general-svn.png) + ### Berechtigungen Dank des fein granularen Berechtigungskonzepts des SCM-Managers können Nutzern und Gruppen, basierend auf definierbaren diff --git a/docs/en/user/repo/assets/repository-settings-general-svn.png b/docs/en/user/repo/assets/repository-settings-general-svn.png new file mode 100644 index 0000000000..cb9b59ba70 Binary files /dev/null and b/docs/en/user/repo/assets/repository-settings-general-svn.png differ diff --git a/docs/en/user/repo/settings.md b/docs/en/user/repo/settings.md index b28dcb6b77..7c1596e7a9 100644 --- a/docs/en/user/repo/settings.md +++ b/docs/en/user/repo/settings.md @@ -17,6 +17,12 @@ repository is marked as archived, it can no longer be modified. ![Repository-Settings-General-Git](assets/repository-settings-general-git.png) +In the area "Repository Export" you may export this repository as dump file. +You can choose between compressed and uncompressed download format. +This export function is currently only supported by Subversion repositories. + +![Repository-Settings-General-Svn](assets/repository-settings-general-svn.png) + ### Permissions Thanks to the finely granular permission concept of SCM-Manager, users and groups can be authorized based on definable diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommandRequest.java index accda81f21..f35958938d 100644 --- a/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommandRequest.java +++ b/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommandRequest.java @@ -89,7 +89,7 @@ public final class BundleCommandRequest * * @return {@link ByteSink} archive. */ - ByteSink getArchive() + public ByteSink getArchive() { return archive; } diff --git a/scm-ui/ui-webapp/public/locales/de/repos.json b/scm-ui/ui-webapp/public/locales/de/repos.json index 7234d52c40..289ca66d30 100644 --- a/scm-ui/ui-webapp/public/locales/de/repos.json +++ b/scm-ui/ui-webapp/public/locales/de/repos.json @@ -242,6 +242,15 @@ "createButton": "Neues Repository erstellen", "importButton": "Repository importieren" }, + "export": { + "subtitle": "Repository exportieren", + "compressed": { + "label": "Komprimieren", + "helpText": "Export Datei vor dem Download komprimieren. Reduziert die Downloadgröße." + }, + "exportButton": "Repository exportieren", + "exportStarted": "Der Repository Export wurde gestartet. Abhängig von der Größe des Repository kann dies einige Momente dauern." + }, "sources": { "fileTree": { "name": "Name", diff --git a/scm-ui/ui-webapp/public/locales/en/repos.json b/scm-ui/ui-webapp/public/locales/en/repos.json index 6946c1b832..b7b6f1b797 100644 --- a/scm-ui/ui-webapp/public/locales/en/repos.json +++ b/scm-ui/ui-webapp/public/locales/en/repos.json @@ -242,6 +242,15 @@ "createButton": "Create Repository", "importButton": "Import Repository" }, + "export": { + "subtitle": "Repository Export", + "compressed": { + "label": "Compress", + "helpText": "Compress the export dump size to reduce the download size." + }, + "exportButton": "Export Repository", + "exportStarted": "The repository export was started. Depending on the repository size this may take a while." + }, "sources": { "fileTree": { "name": "Name", diff --git a/scm-ui/ui-webapp/src/repos/containers/EditRepo.tsx b/scm-ui/ui-webapp/src/repos/containers/EditRepo.tsx index 4928ee8703..9e4ab6ead6 100644 --- a/scm-ui/ui-webapp/src/repos/containers/EditRepo.tsx +++ b/scm-ui/ui-webapp/src/repos/containers/EditRepo.tsx @@ -35,6 +35,7 @@ import RepositoryDangerZone from "./RepositoryDangerZone"; import { getLinks } from "../../modules/indexResource"; import { urls } from "@scm-manager/ui-components"; import { TranslationProps, withTranslation } from "react-i18next"; +import ExportRepository from "./ExportRepository"; type Props = TranslationProps & RouteComponentProps & { @@ -82,6 +83,7 @@ class EditRepo extends React.Component { this.props.modifyRepo(repo, this.repoModified); }} /> + diff --git a/scm-ui/ui-webapp/src/repos/containers/ExportRepository.tsx b/scm-ui/ui-webapp/src/repos/containers/ExportRepository.tsx new file mode 100644 index 0000000000..9ec42e3748 --- /dev/null +++ b/scm-ui/ui-webapp/src/repos/containers/ExportRepository.tsx @@ -0,0 +1,73 @@ +/* + * MIT License + * + * Copyright (c) 2020-present Cloudogu GmbH and Contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +import React, { FC, useState } from "react"; +import { Button, Checkbox, Level, Notification, Subtitle } from "@scm-manager/ui-components"; +import { useTranslation } from "react-i18next"; +import { Link, Repository } from "@scm-manager/ui-types"; + +type Props = { + repository: Repository; +}; + +const ExportRepository: FC = ({ repository }) => { + const [t] = useTranslation("repos"); + const [compressed, setCompressed] = useState(true); + const [loading, setLoading] = useState(false); + + const createExportLink = () => { + let exportLink = (repository?._links.export as Link).href; + if (compressed) { + exportLink += "?compressed=true"; + } + return exportLink; + }; + + if (!repository?._links?.export) { + return null; + } + + return ( + <> +
+ + <> + + setLoading(true)}> +