From 84d5aff73fb5aaf501fba425f9464202d2346e16 Mon Sep 17 00:00:00 2001 From: Yume <2839681263@qq.com> Date: Sun, 10 Aug 2025 18:36:53 +0800 Subject: [PATCH 1/3] feat(UI): add SSH_keys setting --- moon/apps/web/components/Setting/SSHKeys.tsx | 180 +++++++++++++++++++ moon/apps/web/hooks/useDeleteSSHKeyById.ts | 9 + moon/apps/web/hooks/useGetSSHList.ts | 32 ++++ moon/apps/web/hooks/usePostSSHKey.ts | 9 + moon/apps/web/pages/me/settings/index.tsx | 45 +++-- 5 files changed, 250 insertions(+), 25 deletions(-) create mode 100644 moon/apps/web/components/Setting/SSHKeys.tsx create mode 100644 moon/apps/web/hooks/useDeleteSSHKeyById.ts create mode 100644 moon/apps/web/hooks/useGetSSHList.ts create mode 100644 moon/apps/web/hooks/usePostSSHKey.ts diff --git a/moon/apps/web/components/Setting/SSHKeys.tsx b/moon/apps/web/components/Setting/SSHKeys.tsx new file mode 100644 index 000000000..0f28eda44 --- /dev/null +++ b/moon/apps/web/components/Setting/SSHKeys.tsx @@ -0,0 +1,180 @@ +import React, {useState} from 'react'; +import {LoadingSpinner, LockIcon, Button, TextField, PlusIcon} from '@gitmono/ui' +import * as Dialog from '@gitmono/ui/src/Dialog' +import {ListSSHKey} from "@gitmono/types"; +import {useGetSSHList} from '@/hooks/useGetSSHList' +import {usePostSSHKey} from '@/hooks/usePostSSHKey' +import {useDeleteSSHKeyById} from '@/hooks/useDeleteSSHKeyById' +import {legacyApiClient} from "@/utils/queryClient"; +import {useQueryClient} from "@tanstack/react-query"; +import HandleTime from "@/components/MrView/components/HandleTime"; + +const SshKeyItem = ({keyData}: { keyData: ListSSHKey }) => { + const {mutate: deleteSSHKey} = useDeleteSSHKeyById() + const fetchSSHList = legacyApiClient.v1.getApiUserSshList() + const queryClient = useQueryClient() + + return ( +
{keyData.title}
+{keyData.finger}
+
+
+ This is a list of SSH keys associated with your account. Remove any keys that you do not recognize. +
+ +Token #{item.id}
+{item.token}
+
+
+ This is a list of personal access tokens associated with your account. Remove any tokens that you do not + recognize. +
+ + {generated && ( +Your new token has been generated.
+{generated}
+
+ Make sure to copy your new token now. You won’t be able to see it + again.
+