feat: Show updated_at time for edge secrets (#33716)

This commit is contained in:
Kamil Ogórek authored and GitHub committed 2025-02-27 19:55:21 +08:00
1 parent 904d8e4482
commit bcaf5d4f19
2 files changed
+61 -46

No files matched your search

@@ -5,6 +5,7 @@ import Table from 'components/to-be-cleaned/Table'
import { ButtonTooltip } from 'components/ui/ButtonTooltip'
import type { ProjectSecret } from 'data/secrets/secrets-query'
import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'
import { TimestampInfo } from 'ui-patterns'
interface EdgeFunctionSecretProps {
secret: ProjectSecret
@@ -23,11 +24,21 @@ const EdgeFunctionSecret = ({ secret, onSelectDelete }: EdgeFunctionSecretProps)
<p className="truncate py-2">{secret.name}</p>
</Table.td>
<Table.td>
<div className="flex items-center space-x-2">
<p className="font-mono text-sm truncate" title={secret.value}>
{secret.value}
</p>
</div>
<p className="font-mono text-sm max-w-96 truncate" title={secret.value}>
{secret.value}
</p>
</Table.td>
<Table.td>
{!!secret.updated_at ? (
<TimestampInfo
displayAs="utc"
utcTimestamp={secret.updated_at}
labelFormat="DD MMM YYYY HH:mm:ss (ZZ)"
className="!text-sm"
/>
) : (
'-'
)}
</Table.td>
<Table.td>
<div className="flex items-center justify-end">
@@ -68,47 +68,51 @@ const EdgeFunctionSecrets = () => {
icon={<Search size={14} />}
/>
</div>
<Table
head={[
<Table.th key="secret-name">Name</Table.th>,
<Table.th key="secret-value" className="flex items-center gap-x-2">
Digest{' '}
<Badge color="scale" className="font-mono">
SHA256
</Badge>
</Table.th>,
<Table.th key="actions" />,
]}
body={
secrets.length > 0 ? (
secrets.map((secret) => (
<EdgeFunctionSecret
key={secret.name}
secret={secret}
onSelectDelete={() => setSelectedSecret(secret)}
/>
))
) : secrets.length === 0 && searchString.length > 0 ? (
<Table.tr>
<Table.td colSpan={3}>
<p className="text-sm text-foreground">No results found</p>
<p className="text-sm text-foreground-light">
Your search for "{searchString}" did not return any results
</p>
</Table.td>
</Table.tr>
) : (
<Table.tr>
<Table.td colSpan={3}>
<p className="text-sm text-foreground">No secrets created</p>
<p className="text-sm text-foreground-light">
There are no secrets associated with your project yet
</p>
</Table.td>
</Table.tr>
)
}
/>
<div className="w-full overflow-hidden overflow-x-auto">
<Table
head={[
<Table.th key="secret-name">Name</Table.th>,
<Table.th key="secret-value" className="flex items-center gap-x-2">
Digest{' '}
<Badge color="scale" className="font-mono">
SHA256
</Badge>
</Table.th>,
<Table.th key="secret-updated-at">Updated at</Table.th>,
<Table.th key="actions" />,
]}
body={
secrets.length > 0 ? (
secrets.map((secret) => (
<EdgeFunctionSecret
key={secret.name}
secret={secret}
onSelectDelete={() => setSelectedSecret(secret)}
/>
))
) : secrets.length === 0 && searchString.length > 0 ? (
<Table.tr>
<Table.td colSpan={3}>
<p className="text-sm text-foreground">No results found</p>
<p className="text-sm text-foreground-light">
Your search for "{searchString}" did not return any results
</p>
</Table.td>
</Table.tr>
) : (
<Table.tr>
<Table.td colSpan={3}>
<p className="text-sm text-foreground">No secrets created</p>
<p className="text-sm text-foreground-light">
There are no secrets associated with your project yet
</p>
</Table.td>
</Table.tr>
)
}
/>
</div>
</>
)}
</div>