Skip to content

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

chore: update demo style (#2237)

boojack712ded4154c6
diff --git a/frontend/public/demo/schema-migration-history/demo.json b/frontend/public/demo/schema-migration-history/demo.json
index ae17ba4cd8..dc3c247988 100644
--- a/frontend/public/demo/schema-migration-history/demo.json
+++ b/frontend/public/demo/schema-migration-history/demo.json
@@ -15,5 +15,93 @@
"title": "issue detail",
"description": "This is another issue detail page"
}
+ ],
+ "hint": [
+ {
+ "selector": "[data-label='bb-database-detail-action-buttons-container']",
+ "type": "shield",
+ "url": ".*",
+ "additionStyle": {
+ "backdropFilter": "unset",
+ "background": "transparent"
+ }
+ },
+ {
+ "selector": "[data-label='bb-dashboard-header']",
+ "url": ".*",
+ "type": "shield",
+ "additionStyle": {
+ "backdropFilter": "unset",
+ "background": "transparent"
+ }
+ },
+ {
+ "selector": "[data-label='bb-dashboard-static-sidebar']",
+ "url": ".*",
+ "type": "shield",
+ "additionStyle": {
+ "backdropFilter": "unset",
+ "background": "transparent"
+ }
+ },
+ {
+ "selector": "[data-label='bb-migration-history-establish-baseline-alert'] [data-label='bb-alert-ok-button']",
+ "type": "shield",
+ "url": "/db/.+?#migration-history$",
+ "dialog": {
+ "title": "",
+ "description": {
+ "en-US": "Since this is a read-only DEMO, you can contact [email protected] to request a full DEMO.",
+ "zh-CN": "但由于这是个只读 DEMO,您可以联系 [email protected] 来申请完整的 DEMO 进行尝试"
+ },
+ "alwaysShow": true
+ },
+ "additionStyle": {
+ "backdropFilter": "unset"
+ }
+ },
+ {
+ "selector": "[data-label='bb-database-detail-tab'] button:nth-child(3)",
+ "url": ".*",
+ "type": "shield",
+ "additionStyle": {
+ "backdropFilter": "unset",
+ "background": "transparent"
+ }
+ },
+ {
+ "selector": "[data-label='bb-migration-history-table'] tr:nth-child(2) > td:nth-child(4) > a",
+ "url": "/db/.+?#migration-history$",
+ "type": "tooltip",
+ "position": "center",
+ "dialog": {
+ "title": "",
+ "description": {
+ "en-US": "Let's take a closer look at the issue it generates.",
+ "zh-CN": "让我们来详细看看它产生的工单"
+ },
+ "alwaysShow": true,
+ "position": "right"
+ }
+ },
+ {
+ "selector": "[data-label='bb-migration-history-view-drift-button']",
+ "url": "/db/.+?/history/.+",
+ "type": "tooltip",
+ "position": "center",
+ "dialog": {
+ "title": "",
+ "description": {
+ "en-US": "This migration task also detected schema drift. It means another client performed some schema changes which were out of version control.",
+ "zh-CN": "本次变更还检测到了 Schema 偏差,说明有数据库变更通过其他客户端发起,脱离了版本管控"
+ },
+ "alwaysShow": true,
+ "position": "bottom"
+ },
+ "additionStyle": {
+ "marginLeft": "2px",
+ "marginTop": "10px"
+ }
+ }
]
}
diff --git a/frontend/public/demo/schema-migration-history/hint.json b/frontend/public/demo/schema-migration-history/hint.json
deleted file mode 100644
index cffcca9252..0000000000
--- a/frontend/public/demo/schema-migration-history/hint.json
+++ /dev/null
@@ -1,88 +0,0 @@
-[
- {
- "selector": "[data-label='bb-database-detail-action-buttons-container']",
- "type": "shield",
- "url": ".*",
- "additionStyle": {
- "backdropFilter": "unset",
- "background": "transparent"
- }
- },
- {
- "selector": "[data-label='bb-dashboard-header']",
- "url": ".*",
- "type": "shield",
- "additionStyle": {
- "backdropFilter": "unset",
- "background": "transparent"
- }
- },
- {
- "selector": "[data-label='bb-dashboard-static-sidebar']",
- "url": ".*",
- "type": "shield",
- "additionStyle": {
- "backdropFilter": "unset",
- "background": "transparent"
- }
- },
- {
- "selector": "[data-label='bb-migration-history-establish-baseline-alert'] [data-label='bb-alert-ok-button']",
- "type": "shield",
- "url": ".+?/db/.+?#migration-history$",
- "dialog": {
- "title": "",
- "description": {
- "en-US": "Since this is a read-only DEMO, you can contact [email protected] to request a full DEMO.",
- "zh-CN": "但由于这是个只读 DEMO,您可以联系 [email protected] 来申请完整的 DEMO 进行尝试"
- },
- "alwaysShow": true
- },
- "additionStyle": {
- "backdropFilter": "unset"
- }
- },
- {
- "selector": "[data-label='bb-database-detail-tab'] button:nth-child(3)",
- "url": ".*",
- "type": "shield",
- "additionStyle": {
- "backdropFilter": "unset",
- "background": "transparent"
- }
- },
- {
- "selector": "[data-label='bb-migration-history-table'] tr:nth-child(2) > td:nth-child(4) > a",
- "url": ".+?/db/.+?#migration-history$",
- "type": "tooltip",
- "position": "center",
- "dialog": {
- "title": "",
- "description": {
- "en-US": "Let's take a closer look at the issue it generates.",
- "zh-CN": "让我们来详细看看它产生的工单"
- },
- "alwaysShow": true,
- "position": "right"
- }
- },
- {
- "selector": "[data-label='bb-migration-history-view-drift-button']",
- "url": ".+?/db/.+?/history/.+",
- "type": "tooltip",
- "position": "center",
- "dialog": {
- "title": "",
- "description": {
- "en-US": "This migration task also detected schema drift. It means another client performed some schema changes which were out of version control.",
- "zh-CN": "本次变更还检测到了 Schema 偏差,说明有数据库变更通过其他客户端发起,脱离了版本管控"
- },
- "alwaysShow": true,
- "position": "right"
- },
- "additionStyle": {
- "marginLeft": "2px",
- "marginTop": "10px"
- }
- }
-]
diff --git a/frontend/src/assets/deploy.svg b/frontend/src/assets/deploy.svg
new file mode 100644
index 0000000000..72bc3c185b
--- /dev/null
+++ b/frontend/src/assets/deploy.svg
@@ -0,0 +1 @@
+<svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="ml-2 w-8 h-8"><path d="M9 17a2 2 0 11-4 0 2 2 0 014 0zM19 17a2 2 0 11-4 0 2 2 0 014 0z"></path> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16V6a1 1 0 00-1-1H4a1 1 0 00-1 1v10a1 1 0 001 1h1m8-1a1 1 0 01-1 1H9m4-1V8a1 1 0 011-1h2.586a1 1 0 01.707.293l3.414 3.414a1 1 0 01.293.707V16a1 1 0 01-1 1h-1m-6-1a1 1 0 001 1h1M5 17a2 2 0 104 0m-4 0a2 2 0 114 0m6 0a2 2 0 104 0m-4 0a2 2 0 114 0"></path></svg>
\ No newline at end of file
diff --git a/frontend/src/plugins/demo/components/DemoWrapper.vue b/frontend/src/plugins/demo/components/DemoWrapper.vue
index 4cf057fee5..11e5e04ce8 100644
--- a/frontend/src/plugins/demo/components/DemoWrapper.vue
+++ b/frontend/src/plugins/demo/components/DemoWrapper.vue
@@ -1,5 +1,7 @@
<template>
- <ProcessBar v-if="state.showProcessBar" @close.once="handleProcessClose" />
+ <template v-if="!state.isDemoCompleted && state.showDemo">
+ <ProcessBar @close.once="handleProcessClose" />
+ </template>
</template>
<script lang="ts" setup>
@@ -11,8 +13,8 @@ import useAppStore from "../store";
import ProcessBar from "./ProcessBar.vue";
interface LocalState {
- completed: boolean;
- showProcessBar: boolean;
+ isDemoCompleted: boolean;
+ showDemo: boolean;
}
const props = defineProps<{
@@ -20,8 +22,8 @@ const props = defineProps<{
}>();
const state = reactive<LocalState>({
- completed: false,
- showProcessBar: false,
+ isDemoCompleted: false,
+ showDemo: false,
});
const route = useRoute();
@@ -34,32 +36,30 @@ onMounted(async () => {
store.setState({
demoName: props.demoName,
processDataList: demoData.process,
+ hintDataList: demoData.hint,
});
-
- if (demoData.process.length > 0) {
- state.showProcessBar = true;
- }
+ state.showDemo = true;
}
} catch (error) {
// do nth
}
watchEffect(() => {
- if (state.completed) {
+ if (state.isDemoCompleted) {
return;
}
if (String(route.name).startsWith("auth")) {
- state.showProcessBar = false;
+ state.showDemo = false;
} else {
- state.showProcessBar = true;
+ state.showDemo = true;
}
});
});
const handleProcessClose = () => {
- state.showProcessBar = false;
- state.completed = true;
+ state.showDemo = false;
+ state.isDemoCompleted = true;
removeDemo();
};
</script>
diff --git a/frontend/src/plugins/demo/components/ProcessBar.vue b/frontend/src/plugins/demo/components/ProcessBar.vue
index dcc4b2e7c2..6f7bee507e 100644
--- a/frontend/src/plugins/demo/components/ProcessBar.vue
+++ b/frontend/src/plugins/demo/components/ProcessBar.vue
@@ -43,7 +43,7 @@
class="my-4 bg-gray-200 w-full flex flex-row justify-start items-center rounded-full overflow-hidden"
>
<div
- class="h-1 bg-indigo-600 rounded-full transition-all"
+ class="h-1 bg-indigo-600 rounded-full transition-all duration-500"
:style="{
width: processBarWidth,
}"
@@ -86,8 +86,10 @@
</button>
<button
class="w-auto flex flex-row justify-center items-center border px-3 leading-10 select-none rounded-md hover:opacity-60"
+ @click="handleDeployNowButtonClick"
>
- <heroicons-outline:book-open class="w-5 h-auto mr-2" /> Deploy now
+ <img src="../../../assets/deploy.svg" class="w-5 h-auto mr-2" />
+ Deploy now
</button>
<button
class="w-auto flex flex-row justify-center items-center px-3 leading-10 select-none rounded-md font-medium bg-indigo-600 text-white shadow hover:opacity-80"
@@ -100,7 +102,7 @@
<hr class="w-full bg-gray-50 mt-6" />
<div class="mt-6 w-full grid grid-cols-3 leading-9">
- <p class="col-span-1">More quickly demos:</p>
+ <p class="col-span-1">More quick demos:</p>
<div class="w-full col-span-2 grid grid-cols-2 leading-9">
<a
class="text-indigo-600 w-full flex flex-row justify-start items-center hover:underline"
@@ -257,6 +259,13 @@ const handleRestartButtonClick = async () => {
}
};
+const handleDeployNowButtonClick = () => {
+ window.open(
+ "https://www.bytebase.com/docs/get-started/install/overview",
+ "_blank"
+ );
+};
+
const handleBackToDemoButtonClick = async () => {
const process = first(processDataList.value);
if (process) {
@@ -280,7 +289,7 @@ watch(currentProcessIndex, () => {
<style scoped>
.process-bar-container {
- @apply max-w-full fixed bottom-6 left-1/2 -translate-x-1/2 translate-y-0 flex flex-col justify-start items-center bg-white px-8 py-6 rounded-lg;
+ @apply max-w-full fixed bottom-4 left-1/2 -translate-x-1/2 translate-y-0 flex flex-col justify-start items-center bg-white px-8 py-6 rounded-lg;
min-width: 600px;
z-index: 10001;
box-shadow: 0 0 24px 8px rgb(0 0 0 / 20%);
diff --git a/frontend/src/plugins/demo/data.ts b/frontend/src/plugins/demo/data.ts
index 426a68bbef..826760c2fe 100644
--- a/frontend/src/plugins/demo/data.ts
+++ b/frontend/src/plugins/demo/data.ts
@@ -1,8 +1,8 @@
import { merge } from "lodash-es";
-import { DemoData, GuideData, HintData } from "./types";
+import { DemoData, GuideData } from "./types";
import { validateStepData } from "./guide";
-const hintCache = new Map<string, HintData[]>();
+const demoDataCache = new Map<string, DemoData>();
const fetchJSONData = async (path: string) => {
const res = await fetch("/demo" + path);
@@ -18,20 +18,13 @@ export const fetchGuideDataWithName = async (guideName: string) => {
return guideData;
};
-export const fetchHintDataWithName = async (hintName: string) => {
- if (hintCache.has(hintName)) {
- return hintCache.get(hintName) as HintData[];
+export const fetchDemoDataWithName = async (demoName: string) => {
+ if (demoDataCache.has(demoName)) {
+ return demoDataCache.get(demoName) as DemoData;
}
- const hintData = (await fetchJSONData(
- `/${hintName}/hint.json`
- )) as HintData[];
- hintCache.set(hintName, hintData);
-
- return hintData;
-};
-
-export const fetchDemoDataWithName = async (demoName: string) => {
const demoData = (await fetchJSONData(`/${demoName}/demo.json`)) as DemoData;
+ demoDataCache.set(demoName, demoData);
+
return demoData;
};
diff --git a/frontend/src/plugins/demo/listener.ts b/frontend/src/plugins/demo/listener.ts
index bec7feee39..ec0b598b12 100644
--- a/frontend/src/plugins/demo/listener.ts
+++ b/frontend/src/plugins/demo/listener.ts
@@ -1,9 +1,5 @@
import { isEqual } from "lodash-es";
-import {
- fetchDemoDataWithName,
- fetchGuideDataWithName,
- fetchHintDataWithName,
-} from "./data";
+import { fetchDemoDataWithName, fetchGuideDataWithName } from "./data";
import { removeGuideDialog, showGuideDialog } from "./guide";
import { removeHint, showHints } from "./hint";
import * as storage from "./storage";
@@ -23,8 +19,8 @@ const tryToShowHints = async () => {
const { demo } = storage.get(["demo"]);
if (demo) {
- const hintData = await fetchHintDataWithName(demo.name);
- showHints(hintData);
+ const demoData = await fetchDemoDataWithName(demo.name);
+ showHints(demoData.hint);
} else {
removeHint();
}
@@ -104,8 +100,8 @@ const initDemoListeners = async () => {
}
try {
- const hintData = await fetchHintDataWithName(demo.name);
- if (hintData) {
+ const demoData = await fetchDemoDataWithName(demo.name);
+ if (demoData.hint) {
await tryToShowHints();
initHintListeners();
}
diff --git a/frontend/src/plugins/demo/store/index.ts b/frontend/src/plugins/demo/store/index.ts
index e5e1906e11..5cca8a32b9 100644
--- a/frontend/src/plugins/demo/store/index.ts
+++ b/frontend/src/plugins/demo/store/index.ts
@@ -1,11 +1,12 @@
import { createPinia, defineStore } from "pinia";
-import { ProcessData } from "../types";
+import { HintData, ProcessData } from "../types";
export const piniaInstance = createPinia();
interface State {
demoName: string;
processDataList: ProcessData[];
+ hintDataList: HintData[];
}
const useAppStore = defineStore("appStore", {
@@ -13,12 +14,14 @@ const useAppStore = defineStore("appStore", {
return {
demoName: "",
processDataList: [],
+ hintDataList: [],
};
},
actions: {
setState(state: State) {
this.demoName = state.demoName;
this.processDataList = state.processDataList;
+ this.hintDataList = state.hintDataList;
},
},
});
diff --git a/frontend/src/plugins/demo/style.css b/frontend/src/plugins/demo/style.css
index dcfda2ad57..02ff3be2e3 100644
--- a/frontend/src/plugins/demo/style.css
+++ b/frontend/src/plugins/demo/style.css
@@ -59,6 +59,7 @@
.bb-hint-dialog.bottom {
margin-top: 12px;
+ margin-left: -17px;
}
.bb-hint-dialog.bottom::before {
content: "";
diff --git a/frontend/src/plugins/demo/types.ts b/frontend/src/plugins/demo/types.ts
index bf0c32c998..8e83a8d0bb 100644
--- a/frontend/src/plugins/demo/types.ts
+++ b/frontend/src/plugins/demo/types.ts
@@ -6,6 +6,7 @@ export interface ProcessData {
export interface DemoData {
process: ProcessData[];
+ hint: HintData[];
}
type StepType = "click" | "change";