Skip to content

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

Add "INFO", "CRITICAL" style to BBAttention and make UI use it.

天舟2bf89cc1e73c
diff --git a/frontend/src/bbkit/BBAttention.vue b/frontend/src/bbkit/BBAttention.vue
index 6c296b47d1..a2a9454da6 100644
--- a/frontend/src/bbkit/BBAttention.vue
+++ b/frontend/src/bbkit/BBAttention.vue
@@ -1,10 +1,26 @@
<template>
- <div class="rounded-md bg-yellow-50 p-4">
+ <div class="rounded-md p-4" :class="`bg-${color}-50`">
<div class="flex">
<div class="flex-shrink-0">
<!-- Heroicon name: solid/exclamation -->
<svg
- class="h-5 w-5 text-yellow-400"
+ v-if="style == 'INFO'"
+ class="w-5 h-5"
+ :class="`text-${color}-400`"
+ fill="currentColor"
+ viewBox="0 0 20 20"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ fill-rule="evenodd"
+ d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z"
+ clip-rule="evenodd"
+ ></path>
+ </svg>
+ <svg
+ v-else-if="style == 'WARN'"
+ class="h-5 w-5"
+ :class="`text-${color}-400`"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
fill="currentColor"
@@ -16,10 +32,30 @@
clip-rule="evenodd"
/>
</svg>
+ <svg
+ v-else-if="style == 'CRITICAL'"
+ class="w-5 h-5"
+ :class="`text-${color}-400`"
+ fill="currentColor"
+ viewBox="0 0 20 20"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ fill-rule="evenodd"
+ d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z"
+ clip-rule="evenodd"
+ ></path>
+ </svg>
</div>
<div class="ml-3">
- <h3 class="text-sm font-medium text-yellow-800">{{ title }}</h3>
- <div v-if="description" class="mt-2 text-sm text-yellow-700">
+ <h3 class="text-sm font-medium" :class="`text-${color}-800`">
+ {{ title }}
+ </h3>
+ <div
+ v-if="description"
+ class="mt-2 text-sm"
+ :class="`text-${color}-700`"
+ >
<p>
{{ description }}
</p>
@@ -39,10 +75,16 @@
</template>
<script lang="ts">
+import { computed, PropType } from "@vue/runtime-core";
+import { BBAttentionStyle } from "./types";
export default {
name: "BBAttention",
emits: ["click-action"],
props: {
+ style: {
+ type: String as PropType<BBAttentionStyle>,
+ default: "INFO",
+ },
title: {
default: "Attention needed",
type: String,
@@ -56,6 +98,19 @@ export default {
type: String,
},
},
- setup(props, ctx) {},
+ setup(props, ctx) {
+ const color = computed(() => {
+ switch (props.style) {
+ case "INFO":
+ return "blue";
+ case "WARN":
+ return "yellow";
+ case "CRITICAL":
+ return "red";
+ }
+ });
+
+ return { color };
+ },
};
</script>
diff --git a/frontend/src/bbkit/types.ts b/frontend/src/bbkit/types.ts
index 7b85abfb4b..d050f757ed 100644
--- a/frontend/src/bbkit/types.ts
+++ b/frontend/src/bbkit/types.ts
@@ -69,4 +69,6 @@ export type BBNotificationItem = {
export type BBAlertStyle = "INFO" | "SUCCESS" | "WARN" | "CRITICAL";
+export type BBAttentionStyle = "INFO" | "WARN" | "CRITICAL";
+
export type BBAvatarSizeType = "SMALL" | "NORMAL" | "LARGE" | "HUGE";
diff --git a/frontend/src/components/DatabaseMigrationHistoryPanel.vue b/frontend/src/components/DatabaseMigrationHistoryPanel.vue
index 5dd53f6cd0..40ed5096c8 100644
--- a/frontend/src/components/DatabaseMigrationHistoryPanel.vue
+++ b/frontend/src/components/DatabaseMigrationHistoryPanel.vue
@@ -8,6 +8,7 @@
/>
<BBAttention
v-else
+ :style="`WARN`"
:title="attentionTitle"
:actionText="allowConfigInstance ? 'Config instance' : ''"
@click-action="configInstance"
diff --git a/frontend/src/components/ProjectOverviewPanel.vue b/frontend/src/components/ProjectOverviewPanel.vue
index 9152d55974..2c2ed75ae0 100644
--- a/frontend/src/components/ProjectOverviewPanel.vue
+++ b/frontend/src/components/ProjectOverviewPanel.vue
@@ -16,6 +16,7 @@
<p class="text-lg font-medium leading-7 text-main">Databases</p>
<BBAttention
v-if="project.id == DEFAULT_PROJECT_ID"
+ :style="`INFO`"
:title="'Bytebase periodically syncs the instance schema. Newly synced databases are first placed in this default project. User should transfer them to the proper application project.'"
/>
<DatabaseTable :mode="'PROJECT'" :databaseList="databaseList" />
diff --git a/frontend/src/components/RepositorySelectionPanel.vue b/frontend/src/components/RepositorySelectionPanel.vue
index 2f8ae7e280..01c4f58e30 100644
--- a/frontend/src/components/RepositorySelectionPanel.vue
+++ b/frontend/src/components/RepositorySelectionPanel.vue
@@ -1,5 +1,5 @@
<template>
- <BBAttention :description="attentionText" />
+ <BBAttention :style="'WARN'" :description="attentionText" />
<div class="mt-4 space-y-2">
<div class="flex justify-between items-center">
<button class="btn-icon" @click.prevent="prepareRepositoryList">
diff --git a/frontend/src/components/VCSSetupWizard.vue b/frontend/src/components/VCSSetupWizard.vue
index befb619470..ae4d9e7156 100644
--- a/frontend/src/components/VCSSetupWizard.vue
+++ b/frontend/src/components/VCSSetupWizard.vue
@@ -1,5 +1,9 @@
<template>
- <BBAttention v-if="showAttention" :description="attentionText" />
+ <BBAttention
+ v-if="showAttention"
+ :style="'WARN'"
+ :description="attentionText"
+ />
<BBStepTab
class="mt-4"
:stepItemList="stepList"
diff --git a/frontend/src/views/InstanceDetail.vue b/frontend/src/views/InstanceDetail.vue
index 54ecbfc148..7b595d4f25 100644
--- a/frontend/src/views/InstanceDetail.vue
+++ b/frontend/src/views/InstanceDetail.vue
@@ -3,6 +3,7 @@
<ArchiveBanner v-if="instance.rowStatus == 'ARCHIVED'" />
<BBAttention
v-else-if="state.migrationSetupStatus != 'OK'"
+ :style="'WARN'"
:title="attentionTitle"
:description="attentionText"
:actionText="attentionActionText"
diff --git a/frontend/tailwind.config.js b/frontend/tailwind.config.js
index 842de031ad..87239784ac 100644
--- a/frontend/tailwind.config.js
+++ b/frontend/tailwind.config.js
@@ -10,7 +10,17 @@ module.exports = {
content: ["./index.html", "./src/**/*.{vue,js,ts,jsx,tsx}"],
// "w-xxx" is used by BBTab
// "pl-xxx" is used by BBOutline
- safelist: [/^w-/, /^pl-/],
+ // "bg-xxx", "text-xxx" is used by BBAttention
+ safelist: [
+ /^w-/,
+ /^pl-/,
+ /^bg-blue-/,
+ /^text-blue-/,
+ /^bg-yellow-/,
+ /^text-yellow-/,
+ /^bg-red-/,
+ /^text-red-/,
+ ],
},
theme: {
extend: {