Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Link to key under each secret row

Joshen Lim32a4233296e8
diff --git a/studio/components/interfaces/Settings/Vault/Keys/EncryptionKeysManagement.tsx b/studio/components/interfaces/Settings/Vault/Keys/EncryptionKeysManagement.tsx
index 8a79567a470..bec164a442a 100644
--- a/studio/components/interfaces/Settings/Vault/Keys/EncryptionKeysManagement.tsx
+++ b/studio/components/interfaces/Settings/Vault/Keys/EncryptionKeysManagement.tsx
@@ -1,7 +1,7 @@
import dayjs from 'dayjs'
import { observer } from 'mobx-react-lite'
import * as Tooltip from '@radix-ui/react-tooltip'
-import { FC, Fragment, useState } from 'react'
+import { FC, Fragment, useEffect, useState } from 'react'
import {
Alert,
Input,
@@ -14,9 +14,11 @@ import {
Badge,
IconKey,
IconLoader,
+ IconX,
} from 'ui'
import { useStore } from 'hooks'
import Divider from 'components/ui/Divider'
+import { useRouter } from 'next/router'
const DEFAULT_KEY_NAME = 'No description provided'
@@ -24,14 +26,19 @@ interface Props {}
const EncryptionKeysManagement: FC<Props> = ({}) => {
const { vault, ui } = useStore()
+ const router = useRouter()
+ const { id } = router.query
const [searchValue, setSearchValue] = useState<string>('')
const [selectedSort, setSelectedSort] = useState<'name' | 'created'>('created')
const [showAddKeyModal, setShowAddKeyModal] = useState(false)
const [selectedKeyToRemove, setSelectedKeyToRemove] = useState<any>()
-
const [isDeletingKey, setIsDeletingKey] = useState(false)
+ useEffect(() => {
+ if (id !== undefined) setSearchValue(id as string)
+ }, [id])
+
const keys = (
searchValue
? vault.listKeys(
@@ -88,12 +95,25 @@ const EncryptionKeysManagement: FC<Props> = ({}) => {
<div className="flex items-center justify-between">
<div className="flex items-center space-x-2">
<Input
- className="w-64"
+ className="w-64 input-clear"
size="small"
placeholder="Search by name or ID"
value={searchValue}
onChange={(event) => setSearchValue(event.target.value)}
icon={<IconSearch strokeWidth={2} size={16} />}
+ actions={
+ searchValue.length > 0
+ ? [
+ <Button
+ size="tiny"
+ type="text"
+ icon={<IconX />}
+ className="px-1"
+ onClick={() => setSearchValue('')}
+ />,
+ ]
+ : []
+ }
/>
<div className="w-32">
<Listbox size="small" value={selectedSort} onChange={setSelectedSort}>
diff --git a/studio/components/interfaces/Settings/Vault/Secrets/SecretRow.tsx b/studio/components/interfaces/Settings/Vault/Secrets/SecretRow.tsx
index 2d4d0865b2a..940c2aa3146 100644
--- a/studio/components/interfaces/Settings/Vault/Secrets/SecretRow.tsx
+++ b/studio/components/interfaces/Settings/Vault/Secrets/SecretRow.tsx
@@ -13,7 +13,8 @@ import {
IconLoader,
} from 'ui'
import { VaultSecret } from 'types'
-import { useStore } from 'hooks'
+import { useParams, useStore } from 'hooks'
+import Link from 'next/link'
interface Props {
secret: VaultSecret
@@ -23,6 +24,8 @@ interface Props {
const SecretRow: FC<Props> = ({ secret, onSelectEdit, onSelectRemove }) => {
const { vault } = useStore()
+ const { ref } = useParams()
+
const [isLoading, setIsLoading] = useState(false)
const [revealedValue, setRevealedValue] = useState<string>()
const name = secret?.name ?? 'No name provided'
@@ -60,12 +63,14 @@ const SecretRow: FC<Props> = ({ secret, onSelectEdit, onSelectRemove }) => {
strokeWidth={2}
className="text-scale-1000 transition group-hover:text-brand-900"
/>
- <p
- className="text-scale-1100 font-mono text-xs cursor-pointer transition group-hover:text-brand-900"
- title={secret.key_id}
- >
- {secret.key_id}
- </p>
+ <Link href={`/project/${ref}/settings/vault/keys?id=${secret.key_id}`}>
+ <a
+ className="text-scale-1100 font-mono text-xs cursor-pointer transition group-hover:text-brand-900"
+ title={secret.key_id}
+ >
+ {secret.key_id}
+ </a>
+ </Link>
</div>
</div>
<div className="flex items-center space-x-2 w-[40%]">
diff --git a/studio/styles/main.scss b/studio/styles/main.scss
index fff104ca410..b1ba9f4d06d 100644
--- a/studio/styles/main.scss
+++ b/studio/styles/main.scss
@@ -218,4 +218,10 @@ div.fixed.inset-0 {
.capitalize-sentence:first-letter {
text-transform: capitalize;
+}
+
+.input-clear {
+ input {
+ @apply pr-7;
+ }
}
\ No newline at end of file