Skip to content

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

chore: unify the button style (#18240)

ecmadao56eb3f552e45
diff --git a/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue b/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue
index 023e4aafb3..d6e8114b9d 100644
--- a/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue
+++ b/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue
@@ -1,46 +1,48 @@
<template>
- <div>
- <div class="w-full">
- <p class="font-medium text-main mb-2">{{ $t("common.name") }}</p>
- <NInput
- v-model:value="state.placeholder"
- :disabled="readonly"
- :maxlength="200"
- />
- <div class="mt-2">
- <ResourceIdField
- ref="resourceIdField"
- editing-class="mt-4"
- resource-type="database-group"
- :readonly="!isCreating"
- :value="state.resourceId"
- :resource-title="state.placeholder"
- :fetch-resource="
- (id) =>
- dbGroupStore.getOrFetchDBGroupByName(
- `${props.project.name}/${databaseGroupNamePrefix}${id}`,
- { silent: true, view: DatabaseGroupView.FULL }
- )
- "
- />
- </div>
- </div>
- <NDivider />
- <div class="w-full grid grid-cols-5 gap-x-6">
- <div class="col-span-3">
- <p class="pl-1 font-medium text-main mb-2">
- {{ $t("database-group.condition.self") }}
- </p>
- <ExprEditor
- :expr="state.expr"
- :allow-admin="!readonly"
- :enable-raw-expression="true"
- :factor-list="FactorList"
- :option-config-map="getDatabaseGroupOptionConfigMap(project.name)"
+ <div class="flex flex-col">
+ <div class="flex-1">
+ <div class="w-full">
+ <p class="font-medium text-main mb-2">{{ $t("common.name") }}</p>
+ <NInput
+ v-model:value="state.placeholder"
+ :disabled="readonly"
+ :maxlength="200"
/>
+ <div class="mt-2">
+ <ResourceIdField
+ ref="resourceIdField"
+ editing-class="mt-4"
+ resource-type="database-group"
+ :readonly="!isCreating"
+ :value="state.resourceId"
+ :resource-title="state.placeholder"
+ :fetch-resource="
+ (id) =>
+ dbGroupStore.getOrFetchDBGroupByName(
+ `${props.project.name}/${databaseGroupNamePrefix}${id}`,
+ { silent: true, view: DatabaseGroupView.FULL }
+ )
+ "
+ />
+ </div>
</div>
- <div class="col-span-2">
- <MatchedDatabaseView :project="project.name" :expr="state.expr" />
+ <NDivider />
+ <div class="w-full grid grid-cols-5 gap-x-6">
+ <div class="col-span-3">
+ <p class="pl-1 font-medium text-main mb-2">
+ {{ $t("database-group.condition.self") }}
+ </p>
+ <ExprEditor
+ :expr="state.expr"
+ :allow-admin="!readonly"
+ :enable-raw-expression="true"
+ :factor-list="FactorList"
+ :option-config-map="getDatabaseGroupOptionConfigMap(project.name)"
+ />
+ </div>
+ <div class="col-span-2">
+ <MatchedDatabaseView :project="project.name" :expr="state.expr" />
+ </div>
</div>
</div>
@@ -54,7 +56,7 @@
</template>
{{ $t("common.delete") }}
</NButton>
- <div class="flex-1 flex flex-row justify-end items-center gap-x-2">
+ <div class="flex-1 flex flex-row justify-end items-center gap-x-3">
<NButton @click="$emit('dismiss')">{{ $t("common.cancel") }}</NButton>
<NButton type="primary" :disabled="!allowConfirm" @click="doConfirm">
{{ isCreating ? $t("common.save") : $t("common.confirm") }}
diff --git a/frontend/src/components/Label/LabelEditorRow.vue b/frontend/src/components/Label/LabelEditorRow.vue
index 6ce80a4592..54627dda72 100644
--- a/frontend/src/components/Label/LabelEditorRow.vue
+++ b/frontend/src/components/Label/LabelEditorRow.vue
@@ -30,17 +30,12 @@
:status="errors.value.length > 0 ? 'error' : undefined"
@update:value="$emit('update-value', $event)"
/>
- <NButton
- quaternary
- size="tiny"
- style="--n-padding: 0 6px"
+ <MiniActionButton
:class="['ml-1', readonly ? 'invisible' : 'visible']"
@click="$emit('remove')"
>
- <template #icon>
- <heroicons:trash />
- </template>
- </NButton>
+ <Trash2Icon />
+ </MiniActionButton>
</div>
<div v-if="kv.message" class="textinfolabel">{{ kv.message }}</div>
</div>
@@ -53,8 +48,10 @@
</template>
<script setup lang="ts">
-import { NButton, NInput } from "naive-ui";
+import { Trash2Icon } from "lucide-vue-next";
+import { NInput } from "naive-ui";
import { computed } from "vue";
+import { MiniActionButton } from "@/components/v2";
import ErrorList from "../misc/ErrorList.vue";
import type { Label } from "./types";
diff --git a/frontend/src/components/Member/MemberDataTable/cells/UserOperationsCell.vue b/frontend/src/components/Member/MemberDataTable/cells/UserOperationsCell.vue
index 81fa5ad258..612b16c8e4 100644
--- a/frontend/src/components/Member/MemberDataTable/cells/UserOperationsCell.vue
+++ b/frontend/src/components/Member/MemberDataTable/cells/UserOperationsCell.vue
@@ -1,5 +1,5 @@
<template>
- <div v-if="allowEdit" class="flex justify-end">
+ <div v-if="allowEdit" class="flex justify-end gap-x-2">
<NPopconfirm
v-if="
allowRevoke &&
@@ -11,11 +11,9 @@
@positive-click="$emit('revoke-binding')"
>
<template #trigger>
- <NButton quaternary circle @click.stop type="error">
- <template #icon>
- <Trash2Icon class="w-4 h-auto" />
- </template>
- </NButton>
+ <MiniActionButton @click.stop type="error">
+ <Trash2Icon />
+ </MiniActionButton>
</template>
<template #default>
@@ -25,23 +23,20 @@
</template>
</NPopconfirm>
- <NButton
+ <MiniActionButton
v-if="allowUpdate"
- quaternary
- circle
@click="$emit('update-binding')"
>
- <template #icon>
- <PencilIcon class="w-4 h-auto" />
- </template>
- </NButton>
+ <PencilIcon />
+ </MiniActionButton>
</div>
</template>
<script lang="ts" setup>
import { PencilIcon, Trash2Icon } from "lucide-vue-next";
-import { NButton, NPopconfirm } from "naive-ui";
+import { NPopconfirm } from "naive-ui";
import { computed } from "vue";
+import { MiniActionButton } from "@/components/v2";
import { SYSTEM_BOT_USER_NAME, unknownUser } from "@/types";
import { State } from "@/types/proto-es/v1/common_pb";
import type { MemberBinding } from "../../types";
diff --git a/frontend/src/components/Role/Setting/components/RoleDataTable/cells/RoleOperationsCell.vue b/frontend/src/components/Role/Setting/components/RoleDataTable/cells/RoleOperationsCell.vue
index d7b095a461..1df6608bbe 100644
--- a/frontend/src/components/Role/Setting/components/RoleDataTable/cells/RoleOperationsCell.vue
+++ b/frontend/src/components/Role/Setting/components/RoleDataTable/cells/RoleOperationsCell.vue
@@ -1,17 +1,15 @@
<template>
<div v-if="isCustomRole(role.name)" class="w-full flex justify-end gap-x-2">
- <NButton size="tiny" :disabled="!allowUpdate" @click="$emit('edit', role)">
- {{ $t("common.edit") }}
- </NButton>
-
- <NButton
+ <MiniActionButton
v-if="allowDelete"
- size="tiny"
type="error"
@click="handleDeleteRole"
>
- {{ $t("common.delete") }}
- </NButton>
+ <Trash2Icon />
+ </MiniActionButton>
+ <MiniActionButton :disabled="!allowUpdate" @click="$emit('edit', role)">
+ <PencilIcon />
+ </MiniActionButton>
</div>
<ResourceOccupiedModal
ref="resourceOccupiedModalRef"
@@ -25,9 +23,10 @@
<script lang="tsx" setup>
import { Code } from "@connectrpc/connect";
-import { NButton } from "naive-ui";
+import { PencilIcon, Trash2Icon } from "lucide-vue-next";
import { computed, ref } from "vue";
import { useI18n } from "vue-i18n";
+import { MiniActionButton } from "@/components/v2";
import ResourceOccupiedModal from "@/components/v2/ResourceOccupiedModal/ResourceOccupiedModal.vue";
import { pushNotification, useRoleStore, useWorkspaceV1Store } from "@/store";
import type { Role } from "@/types/proto-es/v1/role_service_pb";
diff --git a/frontend/src/components/SQLReview/components/SQLReviewPolicyDataTable.vue b/frontend/src/components/SQLReview/components/SQLReviewPolicyDataTable.vue
index 3e423f13b7..951bd3f48b 100644
--- a/frontend/src/components/SQLReview/components/SQLReviewPolicyDataTable.vue
+++ b/frontend/src/components/SQLReview/components/SQLReviewPolicyDataTable.vue
@@ -11,12 +11,12 @@
</template>
<script setup lang="tsx">
-import { CheckIcon, XIcon } from "lucide-vue-next";
+import { CheckIcon, PencilIcon, Trash2Icon, XIcon } from "lucide-vue-next";
import type { DataTableColumn } from "naive-ui";
-import { NButton, NCheckbox, NDataTable } from "naive-ui";
+import { NCheckbox, NDataTable, NPopconfirm } from "naive-ui";
import { computed } from "vue";
import { useI18n } from "vue-i18n";
-import { BBButtonConfirm } from "@/bbkit";
+import { MiniActionButton } from "@/components/v2";
import Resource from "@/components/v2/ResourceOccupiedModal/Resource.vue";
import { pushNotification, useSQLReviewStore } from "@/store";
import type { SQLReviewPolicy } from "@/types";
@@ -114,24 +114,24 @@ const columns = computed(
render: (review: SQLReviewPolicy) => {
return (
<div class="flex items-center gap-x-2">
- <NButton size="small" onClick={() => emit("edit", review)}>
- {hasUpdatePolicyPermission.value
- ? t("common.edit")
- : t("common.view")}
- </NButton>
{hasDeletePolicyPermission.value && (
- <BBButtonConfirm
- text={false}
- size={"small"}
- type={"DELETE"}
- hideIcon={true}
- buttonText={t("common.delete")}
- okText={t("common.delete")}
- confirmTitle={t("common.delete") + ` '${review.name}'?`}
- requireConfirm={true}
- onConfirm={() => emit("delete", review)}
- />
+ <NPopconfirm
+ positiveButtonProps={{ type: "error" }}
+ onPositiveClick={() => emit("delete", review)}
+ >
+ {{
+ trigger: () => (
+ <MiniActionButton type="error">
+ <Trash2Icon />
+ </MiniActionButton>
+ ),
+ default: () => t("common.delete") + ` '${review.name}'?`,
+ }}
+ </NPopconfirm>
)}
+ <MiniActionButton onClick={() => emit("edit", review)}>
+ <PencilIcon />
+ </MiniActionButton>
</div>
);
},
diff --git a/frontend/src/components/SQLReview/components/SQLReviewPolicySelectPanel.vue b/frontend/src/components/SQLReview/components/SQLReviewPolicySelectPanel.vue
index 437fbb373a..d085eb1b2a 100644
--- a/frontend/src/components/SQLReview/components/SQLReviewPolicySelectPanel.vue
+++ b/frontend/src/components/SQLReview/components/SQLReviewPolicySelectPanel.vue
@@ -5,7 +5,7 @@
class="w-240 max-w-[100vw] relative"
>
<template #default>
- <div class="gap-y-4">
+ <div class="flex flex-col gap-y-4">
<i18n-t
keypath="sql-review.select-review-label"
tag="p"
diff --git a/frontend/src/components/SensitiveData/GrantAccessForm.vue b/frontend/src/components/SensitiveData/GrantAccessForm.vue
index 91bb515bf4..8f6d56b548 100644
--- a/frontend/src/components/SensitiveData/GrantAccessForm.vue
+++ b/frontend/src/components/SensitiveData/GrantAccessForm.vue
@@ -79,7 +79,7 @@
</template>
<template #footer>
<div class="flex justify-end items-center">
- <div class="flex items-center gap-x-2">
+ <div class="flex items-center gap-x-3">
<NButton @click.prevent="onDismiss">
{{ $t("common.cancel") }}
</NButton>
diff --git a/frontend/src/components/User/Settings/CreateGroupDrawer.vue b/frontend/src/components/User/Settings/CreateGroupDrawer.vue
index 245d7b1b65..1273deb724 100644
--- a/frontend/src/components/User/Settings/CreateGroupDrawer.vue
+++ b/frontend/src/components/User/Settings/CreateGroupDrawer.vue
@@ -108,6 +108,8 @@
<div class="w-full flex justify-between items-center">
<RemoveGroupButton
v-if="!isCreating && allowDelete"
+ quaternary
+ size="small"
:group="group!"
@removed="$emit('close')"
>
diff --git a/frontend/src/components/User/Settings/RemoveGroupButton.vue b/frontend/src/components/User/Settings/RemoveGroupButton.vue
index a93a47f3df..deb7e632a9 100644
--- a/frontend/src/components/User/Settings/RemoveGroupButton.vue
+++ b/frontend/src/components/User/Settings/RemoveGroupButton.vue
@@ -1,18 +1,17 @@
<template>
- <NButton
+ <MiniActionButton
v-if="allowDelete"
- quaternary
- size="small"
type="error"
+ v-bind="$attrs"
@click="handleDeleteGroup"
>
- <template #icon>
+ <template #default>
<slot name="icon" />
</template>
- <template #default>
+ <template #text>
<slot name="default" />
</template>
- </NButton>
+ </MiniActionButton>
<ResourceOccupiedModal
ref="resourceOccupiedModalRef"
@@ -25,9 +24,9 @@
<script lang="tsx" setup>
import { computedAsync } from "@vueuse/core";
-import { NButton } from "naive-ui";
import { computed, ref } from "vue";
import { useI18n } from "vue-i18n";
+import { MiniActionButton } from "@/components/v2";
import ResourceOccupiedModal from "@/components/v2/ResourceOccupiedModal/ResourceOccupiedModal.vue";
import {
extractGroupEmail,
diff --git a/frontend/src/components/User/Settings/UserDataTable/cells/UserOperationsCell.vue b/frontend/src/components/User/Settings/UserDataTable/cells/UserOperationsCell.vue
index 166d4ec98c..0059a34a7c 100644
--- a/frontend/src/components/User/Settings/UserDataTable/cells/UserOperationsCell.vue
+++ b/frontend/src/components/User/Settings/UserDataTable/cells/UserOperationsCell.vue
@@ -1,5 +1,5 @@
<template>
- <div class="flex justify-end">
+ <div class="flex justify-end gap-x-2">
<template v-if="allowEdit">
<NPopconfirm
v-if="allowDeleteUser"
@@ -9,11 +9,9 @@
@positive-click="() => changeRowStatus(State.DELETED)"
>
<template #trigger>
- <NButton quaternary circle @click.stop type="error">
- <template #icon>
- <Trash2Icon class="w-4 h-auto" />
- </template>
- </NButton>
+ <MiniActionButton @click.stop type="error">
+ <Trash2Icon />
+ </MiniActionButton>
</template>
<template #default>
@@ -23,27 +21,21 @@
</template>
</NPopconfirm>
- <NButton
+ <MiniActionButton
v-if="allowUpdateUser"
- quaternary
- circle
@click="(e) => $emit('click-user', user, e)"
>
- <template #icon>
- <PencilIcon class="w-4 h-auto" />
- </template>
- </NButton>
+ <PencilIcon />
+ </MiniActionButton>
<NPopconfirm
v-if="allowReactiveUser"
@positive-click="() => changeRowStatus(State.ACTIVE)"
>
<template #trigger>
- <NButton quaternary circle @click.stop>
- <template #icon>
- <Undo2Icon class="w-4 h-auto" />
- </template>
- </NButton>
+ <MiniActionButton @click.stop>
+ <Undo2Icon />
+ </MiniActionButton>
</template>
<template #default>
@@ -58,9 +50,10 @@
<script lang="ts" setup>
import { PencilIcon, Trash2Icon, Undo2Icon } from "lucide-vue-next";
-import { NButton, NPopconfirm } from "naive-ui";
+import { NPopconfirm } from "naive-ui";
import { computed } from "vue";
import { useI18n } from "vue-i18n";
+import { MiniActionButton } from "@/components/v2";
import { pushNotification, useCurrentUserV1, useUserStore } from "@/store";
import { State } from "@/types/proto-es/v1/common_pb";
import { type User, UserType } from "@/types/proto-es/v1/user_service_pb";
diff --git a/frontend/src/components/User/Settings/UserDataTableByGroup/cells/GroupOperationsCell.vue b/frontend/src/components/User/Settings/UserDataTableByGroup/cells/GroupOperationsCell.vue
index 02b36e4554..bad17f8d8c 100644
--- a/frontend/src/components/User/Settings/UserDataTableByGroup/cells/GroupOperationsCell.vue
+++ b/frontend/src/components/User/Settings/UserDataTableByGroup/cells/GroupOperationsCell.vue
@@ -1,28 +1,22 @@
<template>
- <div class="flex justify-end">
+ <div class="flex justify-end gap-x-2">
<RemoveGroupButton v-if="allowDeleteGroup" :group="group!">
- <template #icon>
- <Trash2Icon class="w-4 h-auto" />
- </template>
+ <Trash2Icon class="w-4 h-auto" />
</RemoveGroupButton>
- <NButton
+ <MiniActionButton
v-if="allowEditGroup"
- quaternary
- size="small"
@click="$emit('update-group')"
>
- <template #icon>
- <PencilIcon class="w-4 h-auto" />
- </template>
- </NButton>
+ <PencilIcon />
+ </MiniActionButton>
</div>
</template>
<script lang="ts" setup>
import { PencilIcon, Trash2Icon } from "lucide-vue-next";
-import { NButton } from "naive-ui";
import { computed } from "vue";
+import { MiniActionButton } from "@/components/v2";
import { useCurrentUserV1 } from "@/store";
import { extractUserId } from "@/store/modules/v1/common";
import type { Group } from "@/types/proto-es/v1/group_service_pb";
diff --git a/frontend/src/views/SettingWorkspaceSQLReview.vue b/frontend/src/views/SettingWorkspaceSQLReview.vue
index 2d0be332d7..abc8f9e8c0 100644
--- a/frontend/src/views/SettingWorkspaceSQLReview.vue
+++ b/frontend/src/views/SettingWorkspaceSQLReview.vue
@@ -34,11 +34,14 @@
<NEmpty v-else class="py-12 border rounded-sm">
<template #extra>
<NButton
+ v-if="hasCreatePolicyPermission"
:size="'small'"
type="primary"
- :disabled="!hasCreatePolicyPermission"
@click="createSQLReview"
>
+ <template #icon>
+ <PlusIcon class="h-4 w-4" />
+ </template>
{{ $t("sql-review.create-policy") }}
</NButton>
</template>
diff --git a/frontend/src/views/project/ProjectDatabaseGroupCreate.vue b/frontend/src/views/project/ProjectDatabaseGroupCreate.vue
index b1dc5b4ccd..85d501697d 100644
--- a/frontend/src/views/project/ProjectDatabaseGroupCreate.vue
+++ b/frontend/src/views/project/ProjectDatabaseGroupCreate.vue
@@ -1,6 +1,6 @@
<template>
<DatabaseGroupForm
- class="flex-1"
+ class="h-full"
:readonly="false"
:project="project"
@dismiss="() => router.back()"