Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Extract trash icon to BBButtonTrash component
天舟c3603ebb962d
diff --git a/frontend/src/bbkit/BBButtonTrash.vue b/frontend/src/bbkit/BBButtonTrash.vuenew file mode 100644index 0000000000..8ea71f3cfb--- /dev/null+++ b/frontend/src/bbkit/BBButtonTrash.vue@@ -0,0 +1,80 @@+<template>+ <button+ class="btn-icon"+ @click.prevent="+ () => {+ if (requireConfirm) {+ state.showDeleteModal = true;+ } else {+ $emit('confirm');+ }+ }+ "+ >+ <svg+ class="w-4 h-4"+ 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="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"+ ></path>+ </svg>+ </button>+ <BBAlert+ v-if="state.showDeleteModal"+ :style="'CRITICAL'"+ :okText="okText"+ :title="confirmTitle"+ :description="confirmDescription"+ @ok="+ () => {+ state.showDeleteModal = false;+ $emit('confirm');+ }+ "+ @cancel="state.showDeleteModal = false"+ >+ </BBAlert>+</template>++<script lang="ts">+import { reactive } from "vue";++export default {+ name: "BBButtonTrash",+ emits: ["confirm"],+ props: {+ requireConfirm: {+ default: false,+ type: Boolean,+ },+ okText: {+ default: "Delete",+ type: String,+ },+ confirmTitle: {+ default: "Are you sure to delete?",+ type: String,+ },+ confirmDescription: {+ default: "You cannot undo this action",+ type: String,+ },+ },+ setup(props, ctx) {+ const state = reactive({+ showDeleteModal: false,+ });++ return {+ state,+ };+ },+};+</script>diff --git a/frontend/src/bbkit/index.ts b/frontend/src/bbkit/index.tsindex 574a1dff55..bf6fa26f08 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 BBButtonTrash from "./BBButtonTrash.vue";import BBContextMenu from "./BBContextMenu.vue";import BBModal from "./BBModal.vue";import BBNotification from "./BBNotification.vue";@@ -19,6 +20,7 @@ import {export {BBAlert,BBAvatar,+ BBButtonTrash,BBContextMenu,BBModal,BBNotification,diff --git a/frontend/src/components/MemberTable.vue b/frontend/src/components/MemberTable.vueindex 178d468a22..316936be3a 100644--- a/frontend/src/components/MemberTable.vue+++ b/frontend/src/components/MemberTable.vue@@ -79,26 +79,13 @@</div></BBTableCell><BBTableCell>- <button+ <BBButtonTrashv-if="allowEdit"- class="btn-icon"- @click.prevent="deleteRole(roleMapping.id)"- >- <svg- class="w-4 h-4"- 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="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"- ></path>- </svg>- </button>+ :requireConfirm="true"+ :okText="'Revoke'"+ :confirmTitle="`Are you sure to revoke '${roleMapping.role}' from '${roleMapping.principal.name}'`"+ @confirm="deleteRole(roleMapping.id)"+ /></BBTableCell></template></BBTable>diff --git a/frontend/src/main.js b/frontend/src/main.jsindex b605a91241..db31401b84 100644--- a/frontend/src/main.js+++ b/frontend/src/main.js@@ -10,6 +10,7 @@ import { makeServer } from "./miragejs/server";import {BBAlert,BBAvatar,+ BBButtonTrash,BBContextMenu,BBModal,BBNotification,@@ -52,6 +53,7 @@ app.use(router).component("BBAlert", BBAlert).component("BBAvatar", BBAvatar)+ .component("BBButtonTrash", BBButtonTrash).component("BBContextMenu", BBContextMenu).component("BBModal", BBModal).component("BBNotification", BBNotification)