Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix(ui): layout, translations, and empty states (#19889)

Danny Xuaccbbea1ce9b
diff --git a/frontend/src/react/components/ExprEditor.tsx b/frontend/src/react/components/ExprEditor.tsx
index aeee429249..c6f0a71f9e 100644
--- a/frontend/src/react/components/ExprEditor.tsx
+++ b/frontend/src/react/components/ExprEditor.tsx
@@ -1399,7 +1399,9 @@ function ConditionGroup({
>
<div className="w-14 shrink-0">
{i === 0 ? (
- <div className="pl-1.5 pt-1 text-control text-sm">Where</div>
+ <div className="pl-1.5 h-8 flex items-center text-control text-sm">
+ Where
+ </div>
) : i === 1 ? (
<Select
value={operator}
@@ -1410,7 +1412,7 @@ function ConditionGroup({
});
}}
>
- <SelectTrigger className="h-7 px-1.5">
+ <SelectTrigger className="shrink-0 px-2">
<SelectValue>
{(value: string | null) =>
value ? logicalLabel(value) : null
@@ -1423,7 +1425,7 @@ function ConditionGroup({
</SelectContent>
</Select>
) : (
- <div className="pl-2 pt-1 text-control text-sm lowercase">
+ <div className="pl-2 h-8 flex items-center text-control text-sm lowercase">
{logicalLabel(operator)}
</div>
)}
diff --git a/frontend/src/react/pages/project/ProjectWebhooksPage.tsx b/frontend/src/react/pages/project/ProjectWebhooksPage.tsx
index 7bde33adc1..ee9d2cf7d3 100644
--- a/frontend/src/react/pages/project/ProjectWebhooksPage.tsx
+++ b/frontend/src/react/pages/project/ProjectWebhooksPage.tsx
@@ -150,14 +150,6 @@ function WebhookTable({
}) {
const { t } = useTranslation();
- if (webhooks.length === 0) {
- return (
- <div className="flex justify-center py-8 text-control-light">
- {t("common.no-data")}
- </div>
- );
- }
-
const activityItemList = projectWebhookV1ActivityItemList();
return (
@@ -174,51 +166,67 @@ function WebhookTable({
</tr>
</thead>
<tbody>
- {webhooks.map((webhook) => {
- const activityTitles = webhook.notificationTypes.map((activity) => {
- const item = activityItemList.find(
- (item) => item.activity === activity
+ {webhooks.length === 0 ? (
+ <tr>
+ <td
+ colSpan={allowEdit ? 4 : 3}
+ className="py-8 text-center text-control-light"
+ >
+ {t("common.no-data")}
+ </td>
+ </tr>
+ ) : (
+ webhooks.map((webhook) => {
+ const activityTitles = webhook.notificationTypes.map(
+ (activity) => {
+ const item = activityItemList.find(
+ (item) => item.activity === activity
+ );
+ return item
+ ? item.title
+ : Activity_Type[activity] || `ACTIVITY_${activity}`;
+ }
);
- return item
- ? item.title
- : Activity_Type[activity] || `ACTIVITY_${activity}`;
- });
- return (
- <tr
- key={webhook.name}
- className="border-b cursor-pointer hover:bg-gray-50"
- onClick={(e) => onRowClick(e, webhook)}
- >
- <td className="py-2 pr-4">
- <div className="flex items-center gap-x-2">
- <WebhookTypeIcon type={webhook.type} className="w-5 h-5" />
- {webhook.title}
- </div>
- </td>
- <td className="py-2 pr-4 truncate max-w-xs text-control-light">
- {webhook.url}
- </td>
- <td className="py-2 pr-4">
- <div className="flex flex-wrap gap-2">
- {activityTitles.map((title) => (
- <span
- key={title}
- className="inline-block px-2 py-0.5 text-xs rounded-xs bg-gray-100 text-gray-700"
- >
- {title}
- </span>
- ))}
- </div>
- </td>
- {allowEdit && (
- <td className="py-2">
- <ActionDropdown webhook={webhook} onDelete={onDelete} />
+ return (
+ <tr
+ key={webhook.name}
+ className="border-b cursor-pointer hover:bg-gray-50"
+ onClick={(e) => onRowClick(e, webhook)}
+ >
+ <td className="py-2 pr-4">
+ <div className="flex items-center gap-x-2">
+ <WebhookTypeIcon
+ type={webhook.type}
+ className="w-5 h-5"
+ />
+ {webhook.title}
+ </div>
</td>
- )}
- </tr>
- );
- })}
+ <td className="py-2 pr-4 truncate max-w-xs text-control-light">
+ {webhook.url}
+ </td>
+ <td className="py-2 pr-4">
+ <div className="flex flex-wrap gap-2">
+ {activityTitles.map((title) => (
+ <span
+ key={title}
+ className="inline-block px-2 py-0.5 text-xs rounded-xs bg-gray-100 text-gray-700"
+ >
+ {title}
+ </span>
+ ))}
+ </div>
+ </td>
+ {allowEdit && (
+ <td className="py-2">
+ <ActionDropdown webhook={webhook} onDelete={onDelete} />
+ </td>
+ )}
+ </tr>
+ );
+ })
+ )}
</tbody>
</table>
</div>
diff --git a/frontend/src/react/pages/settings/MembersPage.tsx b/frontend/src/react/pages/settings/MembersPage.tsx
index ae00282aeb..ae0d174a29 100644
--- a/frontend/src/react/pages/settings/MembersPage.tsx
+++ b/frontend/src/react/pages/settings/MembersPage.tsx
@@ -1708,7 +1708,7 @@ export function MembersPage({ projectId }: { projectId?: string }) {
</Alert>
)}
{projectName && (
- <div className="textinfolabel px-4 pt-4">
+ <div className="textinfolabel mb-4">
{t("project.members.description")}{" "}
<a
href="https://docs.bytebase.com/administration/roles/?source=console#project-roles"
diff --git a/frontend/src/react/pages/settings/ServiceAccountsPage.tsx b/frontend/src/react/pages/settings/ServiceAccountsPage.tsx
index d9ad7a5e24..9d3a6694c3 100644
--- a/frontend/src/react/pages/settings/ServiceAccountsPage.tsx
+++ b/frontend/src/react/pages/settings/ServiceAccountsPage.tsx
@@ -135,14 +135,6 @@ function ServiceAccountTable({
});
};
- if (users.length === 0) {
- return (
- <div className="py-8 text-center text-control-light text-sm">
- {t("common.no-data")}
- </div>
- );
- }
-
return (
<div className="border rounded-sm overflow-hidden">
<table className="w-full text-sm">
@@ -157,177 +149,188 @@ function ServiceAccountTable({
</tr>
</thead>
<tbody>
- {users.map((user, i) => {
- const isDeleted = user.state === State.DELETED;
-
- return (
- <tr
- key={user.name}
- className={`border-b last:border-b-0 ${i % 2 === 1 ? "bg-gray-50" : ""}`}
+ {users.length === 0 ? (
+ <tr>
+ <td
+ colSpan={2}
+ className="py-8 text-center text-control-light text-sm"
>
- {/* Account column */}
- <td className="px-4 py-2">
- <div className="flex items-center gap-x-3">
- <UserAvatar title={user.title || user.email} />
- <div className="flex flex-col min-w-0">
- <div className="flex items-center gap-x-1.5">
- <span
- className={
- isDeleted
- ? "line-through text-control-light"
- : "font-medium text-accent"
- }
- >
- {user.title}
+ {t("common.no-data")}
+ </td>
+ </tr>
+ ) : (
+ users.map((user, i) => {
+ const isDeleted = user.state === State.DELETED;
+
+ return (
+ <tr
+ key={user.name}
+ className={`border-b last:border-b-0 ${i % 2 === 1 ? "bg-gray-50" : ""}`}
+ >
+ {/* Account column */}
+ <td className="px-4 py-2">
+ <div className="flex items-center gap-x-3">
+ <UserAvatar title={user.title || user.email} />
+ <div className="flex flex-col min-w-0">
+ <div className="flex items-center gap-x-1.5">
+ <span
+ className={
+ isDeleted
+ ? "line-through text-control-light"
+ : "font-medium text-accent"
+ }
+ >
+ {user.title}
+ </span>
+ <Badge className="text-xs px-1.5 py-0">
+ {t("settings.members.service-account")}
+ </Badge>
+ </div>
+ <span className="textinfolabel text-xs">
+ {user.email}
</span>
- <Badge className="text-xs px-1.5 py-0">
- {t("settings.members.service-account")}
- </Badge>
</div>
- <span className="textinfolabel text-xs">
- {user.email}
- </span>
- </div>
- {!isDeleted && (
- <div className="ml-auto text-xs shrink-0">
- {user.serviceKey && !copiedKeys.has(user.name) ? (
- <Button
- variant="outline"
- size="sm"
- className="h-6 text-xs"
- onClick={(e) => {
- e.stopPropagation();
- handleCopyKey(user);
- }}
- >
- <Copy className="h-3 w-3 mr-1" />
- {t("settings.members.copy-service-key")}
- </Button>
- ) : resetConfirmUser?.name === user.name ? (
- <div className="flex items-center gap-x-1">
- <span className="text-xs text-error">
- {t("settings.members.reset-service-key-alert")}
- </span>
+ {!isDeleted && (
+ <div className="ml-auto text-xs shrink-0">
+ {user.serviceKey && !copiedKeys.has(user.name) ? (
<Button
- variant="destructive"
+ variant="outline"
size="sm"
className="h-6 text-xs"
onClick={(e) => {
e.stopPropagation();
- handleResetKey(user);
+ handleCopyKey(user);
}}
>
- {t("common.confirm")}
+ <Copy className="h-3 w-3 mr-1" />
+ {t("settings.members.copy-service-key")}
</Button>
+ ) : resetConfirmUser?.name === user.name ? (
+ <div className="flex items-center gap-x-1">
+ <span className="text-xs text-error">
+ {t("settings.members.reset-service-key-alert")}
+ </span>
+ <Button
+ variant="destructive"
+ size="sm"
+ className="h-6 text-xs"
+ onClick={(e) => {
+ e.stopPropagation();
+ handleResetKey(user);
+ }}
+ >
+ {t("common.confirm")}
+ </Button>
+ <Button
+ variant="outline"
+ size="sm"
+ className="h-6 text-xs"
+ onClick={(e) => {
+ e.stopPropagation();
+ setResetConfirmUser(undefined);
+ }}
+ >
+ {t("common.cancel")}
+ </Button>
+ </div>
+ ) : (
<Button
variant="outline"
size="sm"
className="h-6 text-xs"
onClick={(e) => {
e.stopPropagation();
- setResetConfirmUser(undefined);
+ setResetConfirmUser(user);
}}
>
- {t("common.cancel")}
+ <KeyRound className="h-3 w-3 mr-1" />
+ {t("settings.members.reset-service-key")}
</Button>
- </div>
- ) : (
- <Button
- variant="outline"
- size="sm"
- className="h-6 text-xs"
- onClick={(e) => {
- e.stopPropagation();
- setResetConfirmUser(user);
- }}
- >
- <KeyRound className="h-3 w-3 mr-1" />
- {t("settings.members.reset-service-key")}
- </Button>
- )}
- </div>
- )}
- </div>
- </td>
-
- {/* Operations column */}
- <td className="px-4 py-2">
- <div className="flex justify-end gap-x-1">
- {!isDeleted && (
- <>
- {(project
+ )}
+ </div>
+ )}
+ </div>
+ </td>
+
+ {/* Operations column */}
+ <td className="px-4 py-2">
+ <div className="flex justify-end gap-x-1">
+ {!isDeleted && (
+ <>
+ {(project
+ ? hasProjectPermissionV2(
+ project,
+ "bb.serviceAccounts.delete"
+ )
+ : hasWorkspacePermissionV2(
+ "bb.serviceAccounts.delete"
+ )) && (
+ <Tooltip
+ content={t(
+ "settings.members.action.deactivate-confirm-title"
+ )}
+ >
+ <Button
+ variant="ghost"
+ size="icon"
+ className="h-7 w-7 text-error hover:text-error"
+ onClick={() => handleDeactivate(user)}
+ >
+ <Trash2 className="h-4 w-4" />
+ </Button>
+ </Tooltip>
+ )}
+ {(project
+ ? hasProjectPermissionV2(
+ project,
+ "bb.serviceAccounts.get"
+ )
+ : hasWorkspacePermissionV2(
+ "bb.serviceAccounts.get"
+ )) && (
+ <Tooltip content={t("common.edit")}>
+ <Button
+ variant="ghost"
+ size="icon"
+ className="h-7 w-7"
+ onClick={() => onUserSelected?.(user)}
+ >
+ <Pencil className="h-4 w-4" />
+ </Button>
+ </Tooltip>
+ )}
+ </>
+ )}
+ {isDeleted &&
+ (project
? hasProjectPermissionV2(
project,
- "bb.serviceAccounts.delete"
+ "bb.serviceAccounts.undelete"
)
: hasWorkspacePermissionV2(
- "bb.serviceAccounts.delete"
+ "bb.serviceAccounts.undelete"
)) && (
<Tooltip
content={t(
- "settings.members.action.deactivate-confirm-title"
+ "settings.members.action.reactivate-confirm-title"
)}
>
- <Button
- variant="ghost"
- size="icon"
- className="h-7 w-7 text-error hover:text-error"
- onClick={() => handleDeactivate(user)}
- >
- <Trash2 className="h-4 w-4" />
- </Button>
- </Tooltip>
- )}
- {(project
- ? hasProjectPermissionV2(
- project,
- "bb.serviceAccounts.get"
- )
- : hasWorkspacePermissionV2(
- "bb.serviceAccounts.get"
- )) && (
- <Tooltip content={t("common.edit")}>
<Button
variant="ghost"
size="icon"
className="h-7 w-7"
- onClick={() => onUserSelected?.(user)}
+ onClick={() => handleRestore(user)}
>
- <Pencil className="h-4 w-4" />
+ <Undo2 className="h-4 w-4" />
</Button>
</Tooltip>
)}
- </>
- )}
- {isDeleted &&
- (project
- ? hasProjectPermissionV2(
- project,
- "bb.serviceAccounts.undelete"
- )
- : hasWorkspacePermissionV2(
- "bb.serviceAccounts.undelete"
- )) && (
- <Tooltip
- content={t(
- "settings.members.action.reactivate-confirm-title"
- )}
- >
- <Button
- variant="ghost"
- size="icon"
- className="h-7 w-7"
- onClick={() => handleRestore(user)}
- >
- <Undo2 className="h-4 w-4" />
- </Button>
- </Tooltip>
- )}
- </div>
- </td>
- </tr>
- );
- })}
+ </div>
+ </td>
+ </tr>
+ );
+ })
+ )}
</tbody>
</table>
</div>
diff --git a/frontend/src/react/pages/settings/UsersPage.tsx b/frontend/src/react/pages/settings/UsersPage.tsx
index eb54532493..a044116f4a 100644
--- a/frontend/src/react/pages/settings/UsersPage.tsx
+++ b/frontend/src/react/pages/settings/UsersPage.tsx
@@ -1000,7 +1000,7 @@ export function UsersPage() {
{showInactiveUsers && (
<div className="flex flex-col gap-y-4">
- <div className="flex items-center justify-between">
+ <div className="flex items-center justify-between gap-x-4">
<h3 className="text-base font-medium">
{t("settings.members.inactive-users")}
</h3>
diff --git a/frontend/src/react/pages/settings/WorkloadIdentitiesPage.tsx b/frontend/src/react/pages/settings/WorkloadIdentitiesPage.tsx
index cc86208212..77f12215e6 100644
--- a/frontend/src/react/pages/settings/WorkloadIdentitiesPage.tsx
+++ b/frontend/src/react/pages/settings/WorkloadIdentitiesPage.tsx
@@ -79,14 +79,6 @@ function WorkloadIdentityTable({
}
};
- if (users.length === 0) {
- return (
- <div className="py-8 text-center text-control-light text-sm">
- {t("common.no-data")}
- </div>
- );
- }
-
return (
<div className="border rounded-sm overflow-hidden">
<table className="w-full text-sm">
@@ -101,114 +93,125 @@ function WorkloadIdentityTable({
</tr>
</thead>
<tbody>
- {users.map((user, i) => {
- const isDeleted = user.state === State.DELETED;
-
- return (
- <tr
- key={user.name}
- className={`border-b last:border-b-0 ${i % 2 === 1 ? "bg-gray-50" : ""}`}
+ {users.length === 0 ? (
+ <tr>
+ <td
+ colSpan={2}
+ className="py-8 text-center text-control-light text-sm"
>
- {/* Account column */}
- <td className="px-4 py-2">
- <div className="flex items-center gap-x-3">
- <UserAvatar title={user.title || user.email} />
- <div className="flex flex-col">
- <span
- className={
- isDeleted
- ? "line-through text-control-light font-medium"
- : "font-medium text-accent"
- }
- >
- {user.title || user.email}
- </span>
- <span className="textinfolabel text-xs">
- {user.email}
- </span>
+ {t("common.no-data")}
+ </td>
+ </tr>
+ ) : (
+ users.map((user, i) => {
+ const isDeleted = user.state === State.DELETED;
+
+ return (
+ <tr
+ key={user.name}
+ className={`border-b last:border-b-0 ${i % 2 === 1 ? "bg-gray-50" : ""}`}
+ >
+ {/* Account column */}
+ <td className="px-4 py-2">
+ <div className="flex items-center gap-x-3">
+ <UserAvatar title={user.title || user.email} />
+ <div className="flex flex-col">
+ <span
+ className={
+ isDeleted
+ ? "line-through text-control-light font-medium"
+ : "font-medium text-accent"
+ }
+ >
+ {user.title || user.email}
+ </span>
+ <span className="textinfolabel text-xs">
+ {user.email}
+ </span>
+ </div>
</div>
- </div>
- </td>
+ </td>
- {/* Operations column */}
- <td className="px-4 py-2">
- <div className="flex justify-end gap-x-1">
- {!isDeleted && (
- <>
- {(project
+ {/* Operations column */}
+ <td className="px-4 py-2">
+ <div className="flex justify-end gap-x-1">
+ {!isDeleted && (
+ <>
+ {(project
+ ? hasProjectPermissionV2(
+ project,
+ "bb.workloadIdentities.delete"
+ )
+ : hasWorkspacePermissionV2(
+ "bb.workloadIdentities.delete"
+ )) && (
+ <Tooltip
+ content={t(
+ "settings.members.action.deactivate-confirm-title"
+ )}
+ >
+ <Button
+ variant="ghost"
+ size="icon"
+ className="h-7 w-7 text-error hover:text-error"
+ onClick={() => handleDeactivate(user)}
+ >
+ <Trash2 className="h-4 w-4" />
+ </Button>
+ </Tooltip>
+ )}
+ {(project
+ ? hasProjectPermissionV2(
+ project,
+ "bb.workloadIdentities.get"
+ )
+ : hasWorkspacePermissionV2(
+ "bb.workloadIdentities.get"
+ )) &&
+ onUserSelected && (
+ <Tooltip content={t("common.edit")}>
+ <Button
+ variant="ghost"
+ size="icon"
+ className="h-7 w-7"
+ onClick={() => onUserSelected(user)}
+ >
+ <Pencil className="h-4 w-4" />
+ </Button>
+ </Tooltip>
+ )}
+ </>
+ )}
+ {isDeleted &&
+ (project
? hasProjectPermissionV2(
project,
- "bb.workloadIdentities.delete"
+ "bb.workloadIdentities.undelete"
)
: hasWorkspacePermissionV2(
- "bb.workloadIdentities.delete"
+ "bb.workloadIdentities.undelete"
)) && (
<Tooltip
content={t(
- "settings.members.action.deactivate-confirm-title"
+ "settings.members.action.reactivate-confirm-title"
)}
>
<Button
variant="ghost"
size="icon"
- className="h-7 w-7 text-error hover:text-error"
- onClick={() => handleDeactivate(user)}
+ className="h-7 w-7"
+ onClick={() => handleRestore(user)}
>
- <Trash2 className="h-4 w-4" />
+ <Undo2 className="h-4 w-4" />
</Button>
</Tooltip>
)}
- {(project
- ? hasProjectPermissionV2(
- project,
- "bb.workloadIdentities.get"
- )
- : hasWorkspacePermissionV2(
- "bb.workloadIdentities.get"
- )) &&
- onUserSelected && (
- <Tooltip content={t("common.edit")}>
- <Button
- variant="ghost"
- size="icon"
- className="h-7 w-7"
- onClick={() => onUserSelected(user)}
- >
- <Pencil className="h-4 w-4" />
- </Button>
- </Tooltip>
- )}
- </>
- )}
- {isDeleted &&
- (project
- ? hasProjectPermissionV2(
- project,
- "bb.workloadIdentities.undelete"
- )
- : hasWorkspacePermissionV2(
- "bb.workloadIdentities.undelete"
- )) && (
- <Tooltip
- content={t(
- "settings.members.action.reactivate-confirm-title"
- )}
- >
- <Button
- variant="ghost"
- size="icon"
- className="h-7 w-7"
- onClick={() => handleRestore(user)}
- >
- <Undo2 className="h-4 w-4" />
- </Button>
- </Tooltip>
- )}
- </div>
- </td>
- </tr>
- );
- })}
+ </div>
+ </td>
+ </tr>
+ );
+ })
+ )}
</tbody>
</table>
</div>
diff --git a/frontend/src/react/pages/settings/general/AccountSection.tsx b/frontend/src/react/pages/settings/general/AccountSection.tsx
index db99024b7a..41fad1add3 100644
--- a/frontend/src/react/pages/settings/general/AccountSection.tsx
+++ b/frontend/src/react/pages/settings/general/AccountSection.tsx
@@ -541,7 +541,7 @@ export const AccountSection = forwardRef<SectionHandle, AccountSectionProps>(
{
t(
"settings.general.workspace.password-restriction.password-rotation"
- ).split("{day}")[0]
+ ).split("{{day}}")[0]
}
{passwordState.passwordRotation ? (
<Input
@@ -572,7 +572,7 @@ export const AccountSection = forwardRef<SectionHandle, AccountSectionProps>(
{
t(
"settings.general.workspace.password-restriction.password-rotation"
- ).split("{day}")[1]
+ ).split("{{day}}")[1]
}
</span>
</label>
diff --git a/frontend/src/react/pages/settings/general/BrandingSection.tsx b/frontend/src/react/pages/settings/general/BrandingSection.tsx
index 054bc46b14..5833e15026 100644
--- a/frontend/src/react/pages/settings/general/BrandingSection.tsx
+++ b/frontend/src/react/pages/settings/general/BrandingSection.tsx
@@ -244,11 +244,6 @@ export const BrandingSection = forwardRef<SectionHandle, BrandingSectionProps>(
: ""
}`}
>
- {!logoUrl && (
- <div className="py-4 text-gray-500">
- {t("common.no-data")}
- </div>
- )}
<div className="text-sm text-gray-600 inline-flex pointer-events-none">
<span className="relative cursor-pointer rounded-xs font-medium text-indigo-600 hover:text-indigo-500">
{t("settings.general.workspace.select-logo")}