Skip to content

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

Add BBNotification

Tianzhou Chen0de10fe4db9c
diff --git a/frontend/src/bbkit/BBNotification.vue b/frontend/src/bbkit/BBNotification.vue
new file mode 100644
index 0000000000..b504e3f9b9
--- /dev/null
+++ b/frontend/src/bbkit/BBNotification.vue
@@ -0,0 +1,136 @@
+<template>
+ <!-- This example requires Tailwind CSS v2.0+ -->
+ <div
+ class="fixed inset-0 flex items-end justify-center px-4 py-6 pointer-events-none sm:p-6 sm:items-start sm:justify-end"
+ >
+ <!--
+ Notification panel, show/hide based on alert state.
+
+ Entering: "transform ease-out duration-300 transition"
+ From: "translate-y-2 opacity-0 sm:translate-y-0 sm:translate-x-2"
+ To: "translate-y-0 opacity-100 sm:translate-x-0"
+ Leaving: "transition ease-in duration-100"
+ From: "opacity-100"
+ To: "opacity-0"
+ -->
+ <transition
+ enter-active-class="transform ease-out duration-300 transition"
+ enter-from-class="translate-y-2 opacity-0 sm:translate-y-0 sm:translate-x-2"
+ enter-to-class="translate-y-0 opacity-100 sm:translate-x-0"
+ leave-active-class="transition ease-in duration-100"
+ leave-from-class="opacity-100"
+ leave-to-class="opacity-0"
+ >
+ <div
+ v-if="showing"
+ class="max-w-sm w-full bg-white shadow-lg rounded-lg pointer-events-auto ring-1 ring-black ring-opacity-5 overflow-hidden"
+ >
+ <div class="p-4">
+ <div class="flex items-start">
+ <div v-if="style == 'SUCCESS'" class="flex-shrink-0">
+ <svg
+ class="h-6 w-6 text-green-600"
+ xmlns="http://www.w3.org/2000/svg"
+ fill="none"
+ viewBox="0 0 24 24"
+ stroke="currentColor"
+ aria-hidden="true"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
+ />
+ </svg>
+ </div>
+ <div v-else-if="style == 'WARN'" class="flex-shrink-0">
+ <svg
+ class="w-6 h-6 text-yellow-600"
+ 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 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
+ ></path>
+ </svg>
+ </div>
+ <div v-else-if="style == 'CRITICAL'" class="flex-shrink-0">
+ <svg
+ class="w-6 h-6 text-red-600"
+ 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 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
+ ></path>
+ </svg>
+ </div>
+ <div v-else class="flex-shrink-0">
+ <svg
+ class="w-6 h-6 text-blue-600"
+ 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="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
+ ></path>
+ </svg>
+ </div>
+ <div class="ml-3 w-0 flex-1 pt-0.5">
+ <p class="text-sm font-medium text-gray-900">{{ title }}</p>
+ <p class="mt-1 text-sm text-gray-500">
+ {{ description }}
+ </p>
+ </div>
+ </div>
+ </div>
+ </div>
+ </transition>
+ </div>
+</template>
+
+<script lang="ts">
+import { PropType } from "vue";
+import { BBNotificationStyle } from "./types";
+
+export default {
+ name: "BBNotification",
+ props: {
+ showing: {
+ type: Boolean,
+ default: false,
+ },
+ style: {
+ type: String as PropType<BBNotificationStyle>,
+ default: "INFO",
+ },
+ title: {
+ type: String,
+ default: "",
+ },
+ description: {
+ type: String,
+ default: "",
+ },
+ },
+ setup(props, { emit }) {
+ return {};
+ },
+};
+</script>
diff --git a/frontend/src/bbkit/index.ts b/frontend/src/bbkit/index.ts
index 8193c78143..17cf1f0361 100644
--- a/frontend/src/bbkit/index.ts
+++ b/frontend/src/bbkit/index.ts
@@ -2,6 +2,7 @@ import BBAlert from "./BBAlert.vue";
import BBAvatar from "./BBAvatar.vue";
import BBContextMenu from "./BBContextMenu.vue";
import BBModal from "./BBModal.vue";
+import BBNotification from "./BBNotification.vue";
import BBStepBar from "./BBStepBar.vue";
import BBTab from "./BBTab.vue";
import BBTabPanel from "./BBTabPanel.vue";
@@ -12,6 +13,7 @@ export {
BBAvatar,
BBContextMenu,
BBModal,
+ BBNotification,
BBStepBar,
BBTab,
BBTabPanel,
diff --git a/frontend/src/bbkit/types.ts b/frontend/src/bbkit/types.ts
index 867555e332..5ccd6b548d 100644
--- a/frontend/src/bbkit/types.ts
+++ b/frontend/src/bbkit/types.ts
@@ -21,3 +21,5 @@ export type BBStep = {
status: BBStepStatus;
link(): string;
};
+
+export type BBNotificationStyle = "INFO" | "SUCCESS" | "WARN" | "CRITICAL";