mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 23:45:44 +01:00
public gpg key download on management screen
This commit is contained in:
@@ -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>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user