mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-15 09:46:16 +01:00
Repository export read-only lock (#1519)
* Lock repository for read-only access only while exporting * Create read-only check api Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com>
This commit is contained in:
@@ -7,7 +7,8 @@
|
||||
"description": "Beschreibung",
|
||||
"creationDate": "Erstellt",
|
||||
"lastModified": "Zuletzt bearbeitet",
|
||||
"archived": "archiviert"
|
||||
"archived": "archiviert",
|
||||
"exporting": "Wird exportiert"
|
||||
},
|
||||
"validation": {
|
||||
"namespace-invalid": "Der Namespace des Repository ist ungültig",
|
||||
@@ -252,6 +253,7 @@
|
||||
},
|
||||
"export": {
|
||||
"subtitle": "Repository exportieren",
|
||||
"notification": "Achtung: Während eines laufenden Exports kann auf das Repository nur lesend zugegriffen werden.",
|
||||
"compressed": {
|
||||
"label": "Komprimieren",
|
||||
"helpText": "Export Datei vor dem Download komprimieren. Reduziert die Downloadgröße."
|
||||
@@ -399,6 +401,9 @@
|
||||
"archive": {
|
||||
"tooltip": "Nur lesender Zugriff möglich. Das Archiv kann nicht verändert werden."
|
||||
},
|
||||
"exporting": {
|
||||
"tooltip": "Nur lesender Zugriff möglich. Das Repository wird derzeit exportiert."
|
||||
},
|
||||
"diff": {
|
||||
"jumpToSource": "Zur Quelldatei springen",
|
||||
"jumpToTarget": "Zur vorherigen Version der Datei springen",
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
"description": "Description",
|
||||
"creationDate": "Creation Date",
|
||||
"lastModified": "Last Modified",
|
||||
"archived": "archived"
|
||||
"archived": "archived",
|
||||
"exporting": "exporting"
|
||||
},
|
||||
"validation": {
|
||||
"namespace-invalid": "The repository namespace is invalid",
|
||||
@@ -252,6 +253,7 @@
|
||||
},
|
||||
"export": {
|
||||
"subtitle": "Repository Export",
|
||||
"notification": "Attention: During the export the repository cannot be modified.",
|
||||
"compressed": {
|
||||
"label": "Compress",
|
||||
"helpText": "Compress the export dump size to reduce the download size."
|
||||
@@ -399,6 +401,9 @@
|
||||
"archive": {
|
||||
"tooltip": "Read only. The archive cannot be changed."
|
||||
},
|
||||
"exporting": {
|
||||
"tooltip": "Read only. The repository is currently being exported."
|
||||
},
|
||||
"diff": {
|
||||
"changes": {
|
||||
"add": "added",
|
||||
|
||||
@@ -56,6 +56,9 @@ const ExportRepository: FC<Props> = ({ repository }) => {
|
||||
<>
|
||||
<hr />
|
||||
<Subtitle subtitle={t("export.subtitle")} />
|
||||
<Notification type="inherit">
|
||||
{t("export.notification")}
|
||||
</Notification>
|
||||
<>
|
||||
<Checkbox
|
||||
checked={fullExport || compressed}
|
||||
|
||||
@@ -41,7 +41,7 @@ import {
|
||||
StateMenuContextProvider,
|
||||
SubNavigation,
|
||||
Tooltip,
|
||||
urls,
|
||||
urls
|
||||
} from "@scm-manager/ui-components";
|
||||
import { fetchRepoByName, getFetchRepoFailure, getRepository, isFetchRepoPending } from "../modules/repos";
|
||||
import RepositoryDetails from "../components/RepositoryDetails";
|
||||
@@ -75,7 +75,7 @@ type Props = RouteComponentProps &
|
||||
fetchRepoByName: (link: string, namespace: string, name: string) => void;
|
||||
};
|
||||
|
||||
const ArchiveTag = styled.span`
|
||||
const RepositoryTag = styled.span`
|
||||
margin-left: 0.2rem;
|
||||
background-color: #9a9a9a;
|
||||
padding: 0.4rem;
|
||||
@@ -153,7 +153,7 @@ class RepositoryRoot extends React.Component<Props> {
|
||||
const extensionProps = {
|
||||
repository,
|
||||
url,
|
||||
indexLinks,
|
||||
indexLinks
|
||||
};
|
||||
|
||||
const redirectUrlFactory = binder.getExtension("repository.redirect", this.props);
|
||||
@@ -164,16 +164,16 @@ class RepositoryRoot extends React.Component<Props> {
|
||||
redirectedUrl = url + "/info";
|
||||
}
|
||||
|
||||
const fileControlFactoryFactory: (changeset: Changeset) => FileControlFactory = (changeset) => (file) => {
|
||||
const fileControlFactoryFactory: (changeset: Changeset) => FileControlFactory = changeset => file => {
|
||||
const baseUrl = `${url}/code/sources`;
|
||||
const sourceLink = file.newPath && {
|
||||
url: `${baseUrl}/${changeset.id}/${file.newPath}/`,
|
||||
label: t("diff.jumpToSource"),
|
||||
label: t("diff.jumpToSource")
|
||||
};
|
||||
const targetLink = file.oldPath &&
|
||||
changeset._embedded?.parents?.length === 1 && {
|
||||
url: `${baseUrl}/${changeset._embedded.parents[0].id}/${file.oldPath}`,
|
||||
label: t("diff.jumpToTarget"),
|
||||
label: t("diff.jumpToTarget")
|
||||
};
|
||||
|
||||
const links = [];
|
||||
@@ -199,11 +199,22 @@ class RepositoryRoot extends React.Component<Props> {
|
||||
return links ? links.map(({ url, label }) => <JumpToFileButton tooltip={label} link={url} />) : null;
|
||||
};
|
||||
|
||||
const archivedFlag = repository.archived && (
|
||||
<Tooltip message={t("archive.tooltip")}>
|
||||
<ArchiveTag className="is-size-6">{t("repository.archived")}</ArchiveTag>
|
||||
</Tooltip>
|
||||
);
|
||||
const repositoryFlags = [];
|
||||
if (repository.archived) {
|
||||
repositoryFlags.push(
|
||||
<Tooltip message={t("archive.tooltip")}>
|
||||
<RepositoryTag className="is-size-6">{t("repository.archived")}</RepositoryTag>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
|
||||
if (repository.exporting) {
|
||||
repositoryFlags.push(
|
||||
<Tooltip message={t("exporting.tooltip")}>
|
||||
<RepositoryTag className="is-size-6">{t("repository.exporting")}</RepositoryTag>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
|
||||
const titleComponent = (
|
||||
<>
|
||||
@@ -222,7 +233,7 @@ class RepositoryRoot extends React.Component<Props> {
|
||||
afterTitle={
|
||||
<>
|
||||
<ExtensionPoint name={"repository.afterTitle"} props={{ repository }} />
|
||||
{archivedFlag}
|
||||
{repositoryFlags.map(flag => flag)}
|
||||
</>
|
||||
}
|
||||
>
|
||||
@@ -360,7 +371,7 @@ const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
loading,
|
||||
error,
|
||||
repoLink,
|
||||
indexLinks,
|
||||
indexLinks
|
||||
};
|
||||
};
|
||||
|
||||
@@ -368,7 +379,7 @@ const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
fetchRepoByName: (link: string, namespace: string, name: string) => {
|
||||
dispatch(fetchRepoByName(link, namespace, name));
|
||||
},
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user