public gpg key download on management screen

This commit is contained in:
Konstantin Schaper
2020-08-05 21:23:55 +02:00
parent 0ac8b90c2f
commit acaf70feab
10 changed files with 30 additions and 12 deletions

View File

@@ -69,7 +69,6 @@ const SignatureIcon: FC<Props> = ({ signatures, className }) => {
"changeset.signatureStatus"
)}: ${status}`;
console.log(signature.contacts)
if (signature.contacts?.length > 0) {
message += `\n${t("changeset.keyContacts")}:`;
signature.contacts.forEach((contact) => {

View File

@@ -68,6 +68,7 @@
"raw": "Schlüssel",
"created": "Eingetragen an",
"addKey": "Schlüssel hinzufügen",
"delete": "Löschen"
"delete": "Löschen",
"download": "Herunterladen"
}
}

View File

@@ -68,6 +68,7 @@
"raw": "Key",
"created": "Created on",
"addKey": "Add key",
"delete": "Delete"
"delete": "Delete",
"download": "Download"
}
}

View File

@@ -23,11 +23,10 @@
*/
import React, { FC } from "react";
import { DateFromNow, DeleteButton } from "@scm-manager/ui-components/src";
import {DateFromNow, DeleteButton, DownloadButton} from "@scm-manager/ui-components/src";
import { PublicKey } from "./SetPublicKeys";
import { useTranslation } from "react-i18next";
import { Link } from "@scm-manager/ui-types";
import { formatPublicKey } from "./formatPublicKey";
type Props = {
publicKey: PublicKey;
@@ -43,6 +42,12 @@ export const PublicKeyEntry: FC<Props> = ({ publicKey, onDelete }) => {
<DeleteButton label={t("publicKey.delete")} action={() => onDelete((publicKey._links.delete as Link).href)} />
);
}
let downloadButton;
if (publicKey?._links?.raw) {
downloadButton = (
<DownloadButton displayName={t("publicKey.download")} url={(publicKey?._links?.raw as Link).href} />
);
}
return (
<>
@@ -53,6 +58,7 @@ export const PublicKeyEntry: FC<Props> = ({ publicKey, onDelete }) => {
</td>
<td className="is-hidden-mobile">{publicKey.id}</td>
<td>{deleteButton}</td>
<td>{downloadButton}</td>
</tr>
</>
);

View File

@@ -33,7 +33,7 @@ type Props = {
onDelete: (link: string) => void;
};
const PublicKeyTable: FC<Props> = ({ publicKeys, onDelete }) => {
const PublicKeyTable: FC<Props> = ({ publicKeys, onDelete, onDownload }) => {
const [t] = useTranslation("users");
if (publicKeys?._embedded?.keys?.length === 0) {