Skip to content

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

Small upadtes

Joshen Lim152600ca2ed8
diff --git a/studio/components/interfaces/Settings/Vault/EncryptionKeysManagement.tsx b/studio/components/interfaces/Settings/Vault/EncryptionKeysManagement.tsx
index 7abc6f1276e..a702aaaa809 100644
--- a/studio/components/interfaces/Settings/Vault/EncryptionKeysManagement.tsx
+++ b/studio/components/interfaces/Settings/Vault/EncryptionKeysManagement.tsx
@@ -3,6 +3,7 @@ import { observer } from 'mobx-react-lite'
import * as Tooltip from '@radix-ui/react-tooltip'
import { FC, Fragment, useState } from 'react'
import {
+ Alert,
Input,
IconSearch,
Listbox,
@@ -135,10 +136,10 @@ const EncryptionKeysManagement: FC<Props> = ({}) => {
ID: <span className="font-mono">{key.id}</span>
</p>
</div>
- <div className="flex items-center space-x-2 w-[38%]">
+ <div className="flex items-center space-x-2 w-[33%]">
{key.status === 'default' && <Badge color="green">Default</Badge>}
</div>
- <div className="flex items-center justify-end w-[25%] space-x-4">
+ <div className="flex items-center justify-end w-[30%] space-x-4">
<p className="text-sm text-scale-1100">
Added on {dayjs(key.created).format('MMM D, YYYY')}
</p>
@@ -201,20 +202,26 @@ const EncryptionKeysManagement: FC<Props> = ({}) => {
<Modal
closable
- size="small"
+ size="medium"
alignFooter="right"
visible={selectedKeyToRemove !== undefined}
onCancel={() => setSelectedKeyToRemove(undefined)}
onConfirm={confirmDeleteKey}
loading={isDeletingKey}
- header={<h5 className="text-sm text-scale-1200">Confirm to delete encryption key</h5>}
+ header={<h5 className="text-sm text-scale-1200">Confirm to delete key</h5>}
>
<div className="py-4">
<Modal.Content>
<div className="space-y-4">
+ <Alert
+ withIcon
+ variant="warning"
+ title="Deleting a key that's in use will cause any secret or column which depends on it to be unusable."
+ >
+ Do ensure that the key is not currently in use to prevent any issues.
+ </Alert>
<p className="text-sm">
- The following encryption key will be permanently removed and cannot be recovered.
- Are you sure?
+ The following key will be permanently removed and cannot be recovered.
</p>
<div className="space-y-2">
<p className="text-sm text-scale-1200">
@@ -235,19 +242,29 @@ const EncryptionKeysManagement: FC<Props> = ({}) => {
size="medium"
visible={showAddKeyModal}
onCancel={() => setShowAddKeyModal(false)}
- header={<h5 className="text-sm text-scale-1200">Add new encryption key</h5>}
+ header={<h5 className="text-sm text-scale-1200">Add a new key</h5>}
>
- <Form id="add-new-key-form" initialValues={{ description: '' }} onSubmit={addKey}>
+ <Form
+ id="add-new-key-form"
+ validateOnBlur={false}
+ initialValues={{ name: '' }}
+ validate={(values: any) => {
+ const errors: any = {}
+ if (values.name.length === 0) errors.name = 'Please provide a name for your key'
+ return errors
+ }}
+ onSubmit={addKey}
+ >
{({ isSubmitting }: any) => {
return (
<div className="py-4">
<Modal.Content>
<p className="text-sm mb-4">
- Keys are of standard UUID types - you can provide an optional description to
- your key for better identification.
+ Keys are of standard UUID types - you can provide a description to your key for
+ better identification.
</p>
<div className="space-y-4 pb-4">
- <Input id="description" label="Description" labelOptional="Optional" />
+ <Input id="name" label="Key Name" />
</div>
</Modal.Content>
<Modal.Separator />
diff --git a/studio/components/interfaces/Settings/Vault/Secrets/EditSecretModal.tsx b/studio/components/interfaces/Settings/Vault/Secrets/EditSecretModal.tsx
index 5dc0264d6ac..c839bc7b0a7 100644
--- a/studio/components/interfaces/Settings/Vault/Secrets/EditSecretModal.tsx
+++ b/studio/components/interfaces/Settings/Vault/Secrets/EditSecretModal.tsx
@@ -1,7 +1,8 @@
-import { FC, useState } from 'react'
+import { FC, useState, useEffect } from 'react'
import { Modal, Form, Input, Button, IconEyeOff, IconEye } from 'ui'
import { useStore } from 'hooks'
+import EncryptionKeySelector from '../EncryptionKeySelector'
interface Props {
selectedSecret: any
@@ -9,8 +10,12 @@ interface Props {
}
const EditSecretModal: FC<Props> = ({ selectedSecret, onClose }) => {
- const { ui } = useStore()
const [showSecretValue, setShowSecretValue] = useState(false)
+ const [selectedKeyId, setSelectedKeyId] = useState<string>()
+
+ useEffect(() => {
+ setSelectedKeyId(selectedSecret?.key_id)
+ }, [selectedSecret])
const validate = (values: any) => {
const errors: any = {}
@@ -68,6 +73,19 @@ const EditSecretModal: FC<Props> = ({ selectedSecret, onClose }) => {
</div>
</Modal.Content>
<Modal.Separator />
+ <Modal.Content>
+ <div className="py-4">
+ <EncryptionKeySelector
+ id="keyId"
+ descriptionId="keyDescription"
+ label="Select a key to encrypt your secret with"
+ labelOptional="Optional"
+ selectedKeyId={selectedKeyId}
+ onSelectKey={setSelectedKeyId}
+ />
+ </div>
+ </Modal.Content>
+ <Modal.Separator />
<Modal.Content>
<div className="flex items-center justify-end space-x-2">
<Button type="default" disabled={isSubmitting} onClick={onClose}>
diff --git a/studio/pages/project/[ref]/settings/vault.tsx b/studio/pages/project/[ref]/settings/vault.tsx
index db050a8a04e..b5283da14df 100644
--- a/studio/pages/project/[ref]/settings/vault.tsx
+++ b/studio/pages/project/[ref]/settings/vault.tsx
@@ -22,7 +22,7 @@ const VaultSettings: NextPageWithLayout = () => {
<VaultToggle />
{/* [Joshen] Consider splitting into separate pages */}
- <Tabs size="medium" type="underlined">
+ <Tabs size="small" type="underlined">
<Tabs.Panel id="secrets" label="Secrets Management">
<SecretsManagement />
</Tabs.Panel>
diff --git a/studio/stores/project/VaultStore.ts b/studio/stores/project/VaultStore.ts
index 6a7ed2a7c2e..d13d2862bfa 100644
--- a/studio/stores/project/VaultStore.ts
+++ b/studio/stores/project/VaultStore.ts
@@ -4,31 +4,31 @@ import { IRootStore } from '../RootStore'
const MOCK_SECRETS = [
{
- key_id: 'e8bcc97c-6caf-4ae4-bd75-ef61928ca66d',
+ key_id: '095f4bfe-f63c-420b-8849-f1e455ee3a02',
description: 'Client access key for dashboard',
created_at: '2022-11-01 06:43:48.492465',
secret: '74d97ba2-f9e3-4a64-a032-8427cd6bd686', // encrypted secret value
},
{
- key_id: 'e8bcc97c-6caf-4ae4-bd75-ef61928ca66d',
+ key_id: '095f4bfe-f63c-420b-8849-f1e455ee3a02',
description: 'Secret key for server',
created_at: '2022-11-20 06:43:48.492465',
secret: '74d97ba2-f9e3-4a64-a032-8427cd6bd686',
},
{
- key_id: 'a968f3ab-de05-42d3-aa64-43838b9e56b5',
+ key_id: '57bfa919-e81b-4afc-a3b4-372981b2a39a',
description: 'This is a bit more of a secret key',
created_at: '2022-11-18 06:43:48.492465',
secret: '74d97ba2-f9e3-4a64-a032-8427cd6bd686',
},
{
- key_id: 'a968f3ab-de05-42d3-aa64-43838b9e56b5',
+ key_id: '57bfa919-e81b-4afc-a3b4-372981b2a39a',
description: undefined,
created_at: '2022-11-05 06:43:48.492465',
secret: '74d97ba2-f9e3-4a64-a032-8427cd6bd686',
},
{
- key_id: 'a968f3ab-de05-42d3-aa64-43838b9e56b5',
+ key_id: '57bfa919-e81b-4afc-a3b4-372981b2a39a',
description: 'This is a pretty long description that Im testing if it should wrap or not',
created_at: '2022-11-3 06:43:48.492465',
secret: '74d97ba2-f9e3-4a64-a032-8427cd6bd686',