diff --git a/docs/de/user/repo/assets/repository-tag-detailView.png b/docs/de/user/repo/assets/repository-tag-detailView.png index 3bfd6bdcc9..ded2594a88 100644 Binary files a/docs/de/user/repo/assets/repository-tag-detailView.png and b/docs/de/user/repo/assets/repository-tag-detailView.png differ diff --git a/docs/de/user/repo/tags.md b/docs/de/user/repo/tags.md index c5c2bb1bd1..377ee28b4d 100644 --- a/docs/de/user/repo/tags.md +++ b/docs/de/user/repo/tags.md @@ -7,16 +7,13 @@ Auf der Tags-Übersicht sind die existierenden Tags nach Erstelldatum absteigend ![Tags Übersicht](assets/repository-tags-overview.png) -#### Tags löschen -Tags können direkt von der Übersicht aus gelöscht werden. - ### Tag Detailseite Hier wird ein Befehl zum Arbeiten mit dem Tag auf einer Kommandozeile aufgeführt. ![Tag Detailseite](assets/repository-tag-detailView.png) #### Tag-Signaturen -Der Verifizierungsstatus eines Tags wird als Schlüsselsymbol hinter dessen Namen in der Detailansicht dargestellt. +Wenn mindestens eine Signatur für einen Tag existiert, wird der Verifizierungsstatus des Tags als Schlüsselsymbol hinter dessen Namen in der Detailansicht dargestellt. Ein Tag kann mehrere Signaturen haben. @@ -28,3 +25,6 @@ Abhängig vom Status der einzelnen Signaturen, wird das Symbol entsprechend eing Wird der Mauszeiger über das Symbol bewegt, erscheint eine Liste aller Signaturen des Tags. ![Tag Signatures](assets/repository-tag-signatures.png) + +### Tags löschen +Tags können direkt von der Übersicht aus oder auf der Detailseite gelöscht werden. diff --git a/docs/en/user/repo/assets/repository-tag-delete.png b/docs/en/user/repo/assets/repository-tag-delete.png deleted file mode 100644 index daa8d0b5ec..0000000000 Binary files a/docs/en/user/repo/assets/repository-tag-delete.png and /dev/null differ diff --git a/docs/en/user/repo/assets/repository-tag-detailView.png b/docs/en/user/repo/assets/repository-tag-detailView.png index a55d1ef587..1516ac6ff4 100644 Binary files a/docs/en/user/repo/assets/repository-tag-detailView.png and b/docs/en/user/repo/assets/repository-tag-detailView.png differ diff --git a/docs/en/user/repo/tags.md b/docs/en/user/repo/tags.md index 8fa9ffd16d..1d96b58b0a 100644 --- a/docs/en/user/repo/tags.md +++ b/docs/en/user/repo/tags.md @@ -7,20 +7,15 @@ The tag overview shows the tags that exist for this repository. By clicking on a ![Tags Overview](assets/repository-tags-overview.png) -### Deleting Tags -Tags can be deleted directly on the tags overview page. - -![Tag Delete](assets/repository-tag-delete.png) - ### Tag Details Page This page shows a command to work with the tag on the command line. ![Tag Details Page](assets/repository-tag-detailView.png) #### Tag Signatures -The signature status of a tag is displayed as a key after its name on its details page. +If there is at least one signature on the tag, the verification status is displayed as a key icon after its name on its details page. -There can be more than one signature on a tag. +A tag can have multiple signatures. Depending on the status of the individual signatures, the key will have a distinct color indicator: - if at least one signature on the tag is invalid, the key will be `red` OTHERWISE @@ -30,3 +25,6 @@ Depending on the status of the individual signatures, the key will have a distin If you hover the key icon, a list of all signatures on the tag will pop up. ![Tag Signatures](assets/repository-tag-signatures.png) + +### Deleting Tags +Tags can be deleted directly on the tags overview page or on the details page of the tag. diff --git a/scm-ui/ui-webapp/public/locales/de/repos.json b/scm-ui/ui-webapp/public/locales/de/repos.json index 911d6a4bb4..318e7494fd 100644 --- a/scm-ui/ui-webapp/public/locales/de/repos.json +++ b/scm-ui/ui-webapp/public/locales/de/repos.json @@ -126,6 +126,7 @@ "name": "Name", "commit": "Commit", "sources": "Sources", + "dangerZone": "Tag löschen", "delete": { "button": "Tag löschen", "subtitle": "Tag löschen", diff --git a/scm-ui/ui-webapp/public/locales/en/repos.json b/scm-ui/ui-webapp/public/locales/en/repos.json index b1d87edb6b..b02759112f 100644 --- a/scm-ui/ui-webapp/public/locales/en/repos.json +++ b/scm-ui/ui-webapp/public/locales/en/repos.json @@ -126,6 +126,7 @@ "name": "Name", "commit": "Commit", "sources": "Sources", + "dangerZone": "Delete tag", "delete": { "button": "Delete tag", "subtitle": "Delete tag", diff --git a/scm-ui/ui-webapp/src/repos/branches/components/BranchView.tsx b/scm-ui/ui-webapp/src/repos/branches/components/BranchView.tsx index 32ff0d8f7a..d7d13e43e3 100644 --- a/scm-ui/ui-webapp/src/repos/branches/components/BranchView.tsx +++ b/scm-ui/ui-webapp/src/repos/branches/components/BranchView.tsx @@ -36,7 +36,7 @@ class BranchView extends React.Component { render() { const { repository, branch } = this.props; return ( -
+ <>
@@ -50,7 +50,7 @@ class BranchView extends React.Component { />
-
+ ); } } diff --git a/scm-ui/ui-webapp/src/repos/tags/components/TagView.tsx b/scm-ui/ui-webapp/src/repos/tags/components/TagView.tsx index a9df4b289a..6c94fb72e7 100644 --- a/scm-ui/ui-webapp/src/repos/tags/components/TagView.tsx +++ b/scm-ui/ui-webapp/src/repos/tags/components/TagView.tsx @@ -26,6 +26,7 @@ import React, { FC } from "react"; import { Repository, Tag } from "@scm-manager/ui-types"; import { ExtensionPoint } from "@scm-manager/ui-extensions"; import TagDetail from "./TagDetail"; +import TagDangerZone from "../container/TagDangerZone"; type Props = { repository: Repository; @@ -47,6 +48,7 @@ const TagView: FC = ({ repository, tag }) => { }} /> + ); }; diff --git a/scm-ui/ui-webapp/src/repos/tags/container/DeleteTag.tsx b/scm-ui/ui-webapp/src/repos/tags/container/DeleteTag.tsx new file mode 100644 index 0000000000..83cd2d0db3 --- /dev/null +++ b/scm-ui/ui-webapp/src/repos/tags/container/DeleteTag.tsx @@ -0,0 +1,93 @@ +/* + * 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 { useTranslation } from "react-i18next"; +import { useHistory } from "react-router-dom"; +import { apiClient, ConfirmAlert, DeleteButton, ErrorNotification, Level } from "@scm-manager/ui-components"; +import { Link, Repository, Tag } from "@scm-manager/ui-types"; + +type Props = { + repository: Repository; + tag: Tag; +}; + +const DeleteTag: FC = ({ tag, repository }) => { + const [showConfirmAlert, setShowConfirmAlert] = useState(false); + const [error, setError] = useState(); + const [t] = useTranslation("repos"); + const history = useHistory(); + + const deleteBranch = () => { + apiClient + .delete((tag._links.delete as Link).href) + .then(() => history.push(`/repo/${repository.namespace}/${repository.name}/tags/`)) + .catch(setError); + }; + + if (!tag._links.delete) { + return null; + } + + let confirmAlert = null; + if (showConfirmAlert) { + confirmAlert = ( + deleteBranch() + }, + { + label: t("tag.delete.confirmAlert.cancel"), + onClick: () => null + } + ]} + close={() => setShowConfirmAlert(false)} + /> + ); + } + + return ( + <> + + {showConfirmAlert && confirmAlert} + + {t("tag.delete.subtitle")} +
+ {t("tag.delete.description")} +

+ } + right={ setShowConfirmAlert(true)} />} + /> + + ); +}; + +export default DeleteTag; diff --git a/scm-ui/ui-webapp/src/repos/tags/container/TagDangerZone.tsx b/scm-ui/ui-webapp/src/repos/tags/container/TagDangerZone.tsx new file mode 100644 index 0000000000..6e3b421939 --- /dev/null +++ b/scm-ui/ui-webapp/src/repos/tags/container/TagDangerZone.tsx @@ -0,0 +1,59 @@ +/* + * 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 } from "react"; +import { Repository, Tag } from "@scm-manager/ui-types"; +import { Subtitle } from "@scm-manager/ui-components"; +import { useTranslation } from "react-i18next"; +import { DangerZoneContainer } from "../../containers/RepositoryDangerZone"; +import DeleteTag from "./DeleteTag"; + +type Props = { + repository: Repository; + tag: Tag; +}; + +const TagDangerZone: FC = ({ repository, tag }) => { + const [t] = useTranslation("repos"); + + const dangerZone = []; + + if (tag?._links?.delete) { + dangerZone.push(); + } + + if (dangerZone.length === 0) { + return null; + } + + return ( + <> +
+ + {dangerZone} + + ); +}; + +export default TagDangerZone;