tags can now be deleted from the details page & documentation is updated accordingly

This commit is contained in:
Konstantin Schaper
2020-12-01 10:46:33 +01:00
parent a4d0acd7e2
commit 51981dbece
11 changed files with 167 additions and 13 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 KiB

After

Width:  |  Height:  |  Size: 201 KiB

View File

@@ -7,16 +7,13 @@ Auf der Tags-Übersicht sind die existierenden Tags nach Erstelldatum absteigend
![Tags Übersicht](assets/repository-tags-overview.png) ![Tags Übersicht](assets/repository-tags-overview.png)
#### Tags löschen
Tags können direkt von der Übersicht aus gelöscht werden.
### Tag Detailseite ### Tag Detailseite
Hier wird ein Befehl zum Arbeiten mit dem Tag auf einer Kommandozeile aufgeführt. Hier wird ein Befehl zum Arbeiten mit dem Tag auf einer Kommandozeile aufgeführt.
![Tag Detailseite](assets/repository-tag-detailView.png) ![Tag Detailseite](assets/repository-tag-detailView.png)
#### Tag-Signaturen #### 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. 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. Wird der Mauszeiger über das Symbol bewegt, erscheint eine Liste aller Signaturen des Tags.
![Tag Signatures](assets/repository-tag-signatures.png) ![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.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 KiB

After

Width:  |  Height:  |  Size: 201 KiB

View File

@@ -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) ![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 ### Tag Details Page
This page shows a command to work with the tag on the command line. This page shows a command to work with the tag on the command line.
![Tag Details Page](assets/repository-tag-detailView.png) ![Tag Details Page](assets/repository-tag-detailView.png)
#### Tag Signatures #### 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: 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 - 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. If you hover the key icon, a list of all signatures on the tag will pop up.
![Tag Signatures](assets/repository-tag-signatures.png) ![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.

View File

@@ -126,6 +126,7 @@
"name": "Name", "name": "Name",
"commit": "Commit", "commit": "Commit",
"sources": "Sources", "sources": "Sources",
"dangerZone": "Tag löschen",
"delete": { "delete": {
"button": "Tag löschen", "button": "Tag löschen",
"subtitle": "Tag löschen", "subtitle": "Tag löschen",

View File

@@ -126,6 +126,7 @@
"name": "Name", "name": "Name",
"commit": "Commit", "commit": "Commit",
"sources": "Sources", "sources": "Sources",
"dangerZone": "Delete tag",
"delete": { "delete": {
"button": "Delete tag", "button": "Delete tag",
"subtitle": "Delete tag", "subtitle": "Delete tag",

View File

@@ -36,7 +36,7 @@ class BranchView extends React.Component<Props> {
render() { render() {
const { repository, branch } = this.props; const { repository, branch } = this.props;
return ( return (
<div> <>
<BranchDetail repository={repository} branch={branch} /> <BranchDetail repository={repository} branch={branch} />
<hr /> <hr />
<div className="content"> <div className="content">
@@ -50,7 +50,7 @@ class BranchView extends React.Component<Props> {
/> />
</div> </div>
<BranchDangerZone repository={repository} branch={branch} /> <BranchDangerZone repository={repository} branch={branch} />
</div> </>
); );
} }
} }

View File

@@ -26,6 +26,7 @@ import React, { FC } from "react";
import { Repository, Tag } from "@scm-manager/ui-types"; import { Repository, Tag } from "@scm-manager/ui-types";
import { ExtensionPoint } from "@scm-manager/ui-extensions"; import { ExtensionPoint } from "@scm-manager/ui-extensions";
import TagDetail from "./TagDetail"; import TagDetail from "./TagDetail";
import TagDangerZone from "../container/TagDangerZone";
type Props = { type Props = {
repository: Repository; repository: Repository;
@@ -47,6 +48,7 @@ const TagView: FC<Props> = ({ repository, tag }) => {
}} }}
/> />
</div> </div>
<TagDangerZone repository={repository} tag={tag} />
</> </>
); );
}; };

View File

@@ -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<Props> = ({ tag, repository }) => {
const [showConfirmAlert, setShowConfirmAlert] = useState(false);
const [error, setError] = useState<Error | undefined>();
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 = (
<ConfirmAlert
title={t("tag.delete.confirmAlert.title")}
message={t("tag.delete.confirmAlert.message", { tag: tag.name })}
buttons={[
{
className: "is-outlined",
label: t("tag.delete.confirmAlert.submit"),
onClick: () => deleteBranch()
},
{
label: t("tag.delete.confirmAlert.cancel"),
onClick: () => null
}
]}
close={() => setShowConfirmAlert(false)}
/>
);
}
return (
<>
<ErrorNotification error={error} />
{showConfirmAlert && confirmAlert}
<Level
left={
<p>
<strong>{t("tag.delete.subtitle")}</strong>
<br />
{t("tag.delete.description")}
</p>
}
right={<DeleteButton label={t("tag.delete.button")} action={() => setShowConfirmAlert(true)} />}
/>
</>
);
};
export default DeleteTag;

View File

@@ -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<Props> = ({ repository, tag }) => {
const [t] = useTranslation("repos");
const dangerZone = [];
if (tag?._links?.delete) {
dangerZone.push(<DeleteTag repository={repository} tag={tag} key={dangerZone.length} />);
}
if (dangerZone.length === 0) {
return null;
}
return (
<>
<hr />
<Subtitle subtitle={t("tag.dangerZone")} />
<DangerZoneContainer>{dangerZone}</DangerZoneContainer>
</>
);
};
export default TagDangerZone;