Skip to content

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

Extract BBButtonAdd

天舟bd9a6ff0da27
diff --git a/frontend/src/bbkit/BBButtonAdd.vue b/frontend/src/bbkit/BBButtonAdd.vue
new file mode 100644
index 0000000000..e46dd12a3a
--- /dev/null
+++ b/frontend/src/bbkit/BBButtonAdd.vue
@@ -0,0 +1,30 @@
+<template>
+ <button
+ class="items-center flex justify-center btn-icon-primary"
+ @click.prevent="$emit('add')"
+ >
+ <svg
+ class="w-6 h-6"
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M12 6v6m0 0v6m0-6h6m-6 0H6"
+ ></path>
+ </svg>
+ </button>
+</template>
+
+<script lang="ts">
+export default {
+ name: "BBButtonAdd",
+ emits: ["add"],
+ props: {},
+ setup(props, ctx) {},
+};
+</script>
diff --git a/frontend/src/bbkit/index.ts b/frontend/src/bbkit/index.ts
index 7e75bb0bf4..c6cd83f7a8 100644
--- a/frontend/src/bbkit/index.ts
+++ b/frontend/src/bbkit/index.ts
@@ -1,5 +1,6 @@
import BBAlert from "./BBAlert.vue";
import BBAvatar from "./BBAvatar.vue";
+import BBButtonAdd from "./BBButtonAdd.vue";
import BBButtonTrash from "./BBButtonTrash.vue";
import BBContextMenu from "./BBContextMenu.vue";
import BBModal from "./BBModal.vue";
@@ -21,6 +22,7 @@ import {
export {
BBAlert,
BBAvatar,
+ BBButtonAdd,
BBButtonTrash,
BBContextMenu,
BBModal,
diff --git a/frontend/src/components/DataSourceTable.vue b/frontend/src/components/DataSourceTable.vue
index 693dfd649e..ec36174e41 100644
--- a/frontend/src/components/DataSourceTable.vue
+++ b/frontend/src/components/DataSourceTable.vue
@@ -5,25 +5,7 @@
<h3 class="text-lg leading-6 font-medium text-gray-900">
All Data Source
</h3>
- <button
- class="items-center flex justify-center btn-icon-primary"
- @click.prevent="state.showCreateModal = true"
- >
- <svg
- class="w-6 h-6"
- fill="none"
- stroke="currentColor"
- viewBox="0 0 24 24"
- xmlns="http://www.w3.org/2000/svg"
- >
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M12 6v6m0 0v6m0-6h6m-6 0H6"
- ></path>
- </svg>
- </button>
+ <BBButtonAdd @add="state.showCreateModal = true" />
</div>
<div class="flex flex-row items-center space-x-2">
<button
diff --git a/frontend/src/main.js b/frontend/src/main.js
index d936350ce5..245316c964 100644
--- a/frontend/src/main.js
+++ b/frontend/src/main.js
@@ -11,6 +11,7 @@ import { makeServer } from "./miragejs/server";
import {
BBAlert,
BBAvatar,
+ BBButtonAdd,
BBButtonTrash,
BBContextMenu,
BBModal,
@@ -57,6 +58,7 @@ app
.use(VueClipboard)
.component("BBAlert", BBAlert)
.component("BBAvatar", BBAvatar)
+ .component("BBButtonAdd", BBButtonAdd)
.component("BBButtonTrash", BBButtonTrash)
.component("BBContextMenu", BBContextMenu)
.component("BBModal", BBModal)