Fix old properties

This commit is contained in:
Joshen Lim committed 2022-11-28 16:25:51 +08:00
1 parent 295771da0b
commit 217da28c28
4 files changed
+47 -15

No files matched your search

@@ -52,7 +52,7 @@ const EncryptionKeySelector: FC<Props> = ({
value={key.id}
>
<div className="space-y-1">
<p>{key.comment || 'No description provided'}</p>
<p>{key.name || 'No name provided'}</p>
<p className="text-xs">
ID: <span className="font-mono">{key.id}</span>
</p>
@@ -90,17 +90,27 @@ const EncryptionKeysManagement: FC<Props> = ({}) => {
<Input
className="w-64"
size="small"
placeholder="Search by description or ID"
placeholder="Search by name or ID"
value={searchValue}
onChange={(event) => setSearchValue(event.target.value)}
icon={<IconSearch strokeWidth={2} size={16} />}
/>
<div className="w-32">
<Listbox size="small" value={selectedSort} onChange={setSelectedSort}>
<Listbox.Option id="created" value="created" label="Sort by created at">
<Listbox.Option
id="created"
className="max-w-[180px]"
value="created"
label="Sort by created at"
>
Created at
</Listbox.Option>
<Listbox.Option id="name" value="name" label="Sort by name">
<Listbox.Option
id="name"
className="max-w-[180px]"
value="name"
label="Sort by name"
>
Name
</Listbox.Option>
</Listbox>
@@ -25,7 +25,7 @@ const SecretRow: FC<Props> = ({ secret, onSelectEdit, onSelectRemove }) => {
const { vault } = useStore()
const [isLoading, setIsLoading] = useState(false)
const [revealedValue, setRevealedValue] = useState<string>()
const description = secret?.description ?? 'No description provided'
const name = secret?.name ?? 'No name provided'
const revealSecret = async () => {
setIsLoading(true)
@@ -44,9 +44,16 @@ const SecretRow: FC<Props> = ({ secret, onSelectEdit, onSelectRemove }) => {
return (
<div className="px-6 py-4 flex items-center space-x-4">
<div className="space-y-1 min-w-[35%] max-w-[35%]">
<p className="text-sm text-scale-1200" title={description}>
{description}
</p>
<div>
<p className="text-sm text-scale-1200" title={name}>
{name}
</p>
{secret.description !== undefined && (
<p className="text-sm text-scale-1100" title={secret.description}>
{secret.description}
</p>
)}
</div>
<div className="flex items-center space-x-2">
<IconKey size={14} strokeWidth={2} />
<p className="text-scale-1100 font-mono text-xs" title={secret.key_id}>
@@ -14,7 +14,7 @@ interface Props {}
const SecretsManagement: FC<Props> = ({}) => {
const { vault } = useStore()
const [searchValue, setSearchValue] = useState<string>('')
const [selectedSort, setSelectedSort] = useState<'created_at' | 'description'>('created_at')
const [selectedSort, setSelectedSort] = useState<'created_at' | 'name'>('created_at')
const [showAddSecretModal, setShowAddSecretModal] = useState(false)
const [selectedSecretToEdit, setSelectedSecretToEdit] = useState<any>()
const [selectedSecretToRemove, setSelectedSecretToRemove] = useState<any>()
@@ -23,7 +23,7 @@ const SecretsManagement: FC<Props> = ({}) => {
searchValue.length > 0
? vault.listSecrets(
(secret: any) =>
(secret?.description ?? '').toLowerCase().includes(searchValue.toLowerCase()) ||
(secret?.name ?? '').toLowerCase().includes(searchValue.toLowerCase()) ||
secret.key_id.toLowerCase().includes(searchValue.toLowerCase())
)
: vault.listSecrets()
@@ -47,20 +47,35 @@ const SecretsManagement: FC<Props> = ({}) => {
<Input
className="w-64"
size="small"
placeholder="Search by description or key ID"
placeholder="Search by name or key ID"
value={searchValue}
onChange={(event) => setSearchValue(event.target.value)}
icon={<IconSearch strokeWidth={2} size={16} />}
/>
<div className="w-32">
<Listbox size="small" value={selectedSort} onChange={setSelectedSort}>
<Listbox.Option id="created_at" value="created_at" label="Sort by created at">
<Listbox.Option
id="created_at"
className="max-w-[180px]"
value="created_at"
label="Sort by created at"
>
Created at
</Listbox.Option>
<Listbox.Option id="description" value="description" label="Sort by description">
Description
<Listbox.Option
id="name"
className="max-w-[180px]"
value="name"
label="Sort by name"
>
Name
</Listbox.Option>
<Listbox.Option id="key_id" value="key_id" label="Sort by key ID">
<Listbox.Option
id="key_id"
className="max-w-[180px]"
value="key_id"
label="Sort by key ID"
>
Key ID
</Listbox.Option>
</Listbox>