Skip to content

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

chore: add demo data about `migration history` (#1840)

boojack4062e282c7fc
diff --git a/frontend/public/demo/schema-migration-history/hint.json b/frontend/public/demo/schema-migration-history/hint.json
index 2608dc811c..9775f922d3 100644
--- a/frontend/public/demo/schema-migration-history/hint.json
+++ b/frontend/public/demo/schema-migration-history/hint.json
@@ -1,13 +1,188 @@
[
{
- "selector": "[data-label='bb-alter-schema-button']",
- "title": "",
- "description": {
- "en-US": "Alter schema is a main feature of Bytebase",
- "zh-CN": "修改数据库 Schema 是 Bytebase 的核心功能之一"
+ "selector": "[data-label='bb-dashboard-static-sidebar']",
+ "type": "shield",
+ "url": ".+/db/"
+ },
+ {
+ "selector": "[data-label='bb-database-detail-action-buttons-container']",
+ "type": "shield",
+ "url": ".+/db/"
+ },
+ {
+ "selector": "[data-label='bb-dashboard-header']",
+ "type": "shield",
+ "url": ".+/db/"
+ },
+ {
+ "selector": "[data-label='bb-dashboard-header-database-entry']",
+ "type": "hint",
+ "url": "^(?!.+/db)",
+ "cover": true,
+ "dialog": {
+ "title": "",
+ "description": {
+ "en-US": "Let's focus on the Database",
+ "zh-CN": "我们来查看数据库模块"
+ },
+ "alwaysShow": true
},
+ "additionStyle": {
+ "z-index": "10"
+ }
+ },
+ {
+ "selector": "[data-label='bb-database-table']",
"type": "hint",
- "url": "http://localhost:3000",
+ "url": ".+?/db",
+ "cover": true,
+ "dialog": {
+ "title": "",
+ "description": {
+ "en-US": "Let's focus on the target database",
+ "zh-CN": "让我们专注在目标数据库"
+ },
+ "alwaysShow": true,
+ "position": "top"
+ },
+ "additionStyle": {
+ "z-index": "10"
+ }
+ },
+ {
+ "selector": "[data-label='bb-database-detail-tab'] button:nth-child(2)",
+ "type": "hint",
+ "url": ".+?/db/.+?(?<!#migration-history)$",
+ "highlight": true,
+ "dialog": {
+ "title": "",
+ "description": {
+ "en-US": "Let's focus on the database schema change management",
+ "zh-CN": "让我们专注在数据库变更管理场景"
+ },
+ "alwaysShow": true,
+ "position": "right"
+ },
+ "additionStyle": {
+ "z-index": "10"
+ }
+ },
+ {
+ "selector": "[data-label='bb-establish-baseline-button']",
+ "type": "hint",
+ "url": ".+?/db/.+?#migration-history$",
+ "highlight": true,
+ "dialog": {
+ "title": "",
+ "description": {
+ "en-US": "Creating a new BASELINE can start a new Schema life cycle, but since this is a read-only DEMO, you can contact [email protected] to request a full DEMO to try.",
+ "zh-CN": "新建一个 BASELINE 可以开始一个新的 Schema 生命周期,但由于这是个只读 DEMO,您可以联系 [email protected] 来申请完整的 DEMO 进行尝试。"
+ },
+ "position": "right"
+ },
+ "additionStyle": {
+ "z-index": "10"
+ }
+ },
+ {
+ "selector": "[data-label='bb-database-overview-description-list']",
+ "type": "hint",
+ "url": ".+?/db/.+?#overview$",
+ "dialog": {
+ "title": "",
+ "description": {
+ "en-US": "The basic information of the database is shown here",
+ "zh-CN": "这里展示了数据库的基本信息"
+ },
+ "alwaysShow": true,
+ "position": "topright"
+ },
+ "additionStyle": {
+ "z-index": "10"
+ }
+ },
+ {
+ "selector": "[data-label='bb-migration-history-table']",
+ "type": "hint",
+ "url": ".+?/db/.+?#migration-history$",
+ "dialog": {
+ "title": "",
+ "description": {
+ "en-US": "Here are all the migration records, where BASELINE records the initial state of the database schema, and every other change will generate a new schema version.",
+ "zh-CN": "这里是所有的迁移记录,其中 BASELINE 记录了数据库 Schema 的初始状态,其余每一次变更都将产生一个新的 Schema 版本。"
+ },
+ "alwaysShow": true,
+ "position": "bottom"
+ },
+ "additionStyle": {
+ "z-index": "10"
+ }
+ },
+ {
+ "selector": "[data-label='bb-migration-history-diff-switch']",
+ "type": "hint",
+ "url": ".+?/db/.+?/history/.+",
+ "dialog": {
+ "title": "",
+ "description": {
+ "en-US": "Let's focus on the Database",
+ "zh-CN": "也可以查看变更后的完整 Schema 快照"
+ },
+ "position": "right",
+ "showOnce": true
+ },
+ "additionStyle": {
+ "z-index": "10"
+ }
+ },
+ {
+ "selector": "[data-label='bb-migration-history-view-drift-button']",
+ "type": "hint",
+ "url": ".+?/db/.+?/history/.+",
+ "highlight": true,
+ "dialog": {
+ "title": "",
+ "description": {
+ "en-US": "A schema drift was detected in this change, indicating that a change beyond the control of the Bytebase platform occurred prior to this change.",
+ "zh-CN": "这次变更检查到了 Schema 偏差,说明这次变更之前发生了脱离 Bytebase 平台管控的变更"
+ },
+ "position": "right",
+ "showOnce": true
+ },
+ "additionStyle": {
+ "z-index": "10"
+ }
+ },
+ {
+ "selector": "[data-label='bb-migration-history-code-diff-block']",
+ "type": "hint",
+ "url": ".+?/db/.+?/history/.+",
+ "dialog": {
+ "title": "",
+ "description": {
+ "en-US": "This is the different codes between the two versions",
+ "zh-CN": "这是两个数据库 Schema 版本之间的差异"
+ },
+ "alwaysShow": true,
+ "position": "topright"
+ },
+ "additionStyle": {
+ "z-index": "10"
+ }
+ },
+ {
+ "selector": "[data-label='bb-migration-history-code-block']",
+ "type": "hint",
+ "url": ".+?/db/.+?/history/.+",
+ "dialog": {
+ "title": "",
+ "description": {
+ "en-US": "This is the current full schema of the database",
+ "zh-CN": "这是现在数据库的完整 Schema"
+ },
+ "alwaysShow": true,
+ "position": "topright"
+ },
"additionStyle": {
"z-index": "10"
}
diff --git a/frontend/src/components/DatabaseMigrationHistoryPanel.vue b/frontend/src/components/DatabaseMigrationHistoryPanel.vue
index f19df7514b..7c8ebadc63 100644
--- a/frontend/src/components/DatabaseMigrationHistoryPanel.vue
+++ b/frontend/src/components/DatabaseMigrationHistoryPanel.vue
@@ -9,10 +9,10 @@
type="primary"
:disabled="!allowMigrate"
tooltip-mode="DISABLED-ONLY"
+ data-label="bb-establish-baseline-button"
@click="state.showBaselineModal = true"
>
{{ $t("migration-history.establish-baseline") }}
-
<template v-if="isTenantProject" #tooltip>
<div class="w-52 whitespace-pre-wrap">
{{
diff --git a/frontend/src/components/DatabaseOverviewPanel.vue b/frontend/src/components/DatabaseOverviewPanel.vue
index a8a8be8097..2f55db92cf 100644
--- a/frontend/src/components/DatabaseOverviewPanel.vue
+++ b/frontend/src/components/DatabaseOverviewPanel.vue
@@ -22,7 +22,10 @@
</div>
<!-- Description list -->
- <dl class="grid grid-cols-1 gap-x-4 gap-y-4 sm:grid-cols-2 pt-4">
+ <dl
+ class="grid grid-cols-1 gap-x-4 gap-y-4 sm:grid-cols-2 pt-4"
+ data-label="bb-database-overview-description-list"
+ >
<template
v-if="
database.instance.engine != 'CLICKHOUSE' &&
diff --git a/frontend/src/components/MigrationHistoryTable.vue b/frontend/src/components/MigrationHistoryTable.vue
index ff12d0277c..d382c6cd09 100644
--- a/frontend/src/components/MigrationHistoryTable.vue
+++ b/frontend/src/components/MigrationHistoryTable.vue
@@ -6,6 +6,7 @@
:show-header="true"
:left-bordered="true"
:right-bordered="true"
+ data-label="bb-migration-history-table"
@click-row="clickHistory"
>
<template #header>
diff --git a/frontend/src/layouts/BodyLayout.vue b/frontend/src/layouts/BodyLayout.vue
index cb23cbcbcf..9a96a0a119 100644
--- a/frontend/src/layouts/BodyLayout.vue
+++ b/frontend/src/layouts/BodyLayout.vue
@@ -59,7 +59,10 @@
</div>
<!-- Static sidebar for desktop -->
- <aside class="hidden md:flex md:flex-shrink-0">
+ <aside
+ class="hidden md:flex md:flex-shrink-0"
+ data-label="bb-dashboard-static-sidebar"
+ >
<div class="flex flex-col w-52">
<!-- Sidebar component, swap this element with another sidebar if you like -->
<div class="flex-1 flex flex-col py-2 overflow-y-auto">
diff --git a/frontend/src/layouts/DashboardLayout.vue b/frontend/src/layouts/DashboardLayout.vue
index 17ddc12c57..9cf9668598 100644
--- a/frontend/src/layouts/DashboardLayout.vue
+++ b/frontend/src/layouts/DashboardLayout.vue
@@ -17,7 +17,10 @@
change attempt will fail.
</div>
</template>
- <nav class="bg-white border-b border-block-border">
+ <nav
+ class="bg-white border-b border-block-border"
+ data-label="bb-dashboard-header"
+ >
<div class="max-w-full mx-auto px-4">
<DashboardHeader />
</div>
diff --git a/frontend/src/plugins/demo/hint.ts b/frontend/src/plugins/demo/hint.ts
index 1ad8a8a5eb..82c20b198a 100644
--- a/frontend/src/plugins/demo/hint.ts
+++ b/frontend/src/plugins/demo/hint.ts
@@ -2,7 +2,7 @@ import { indexOf, isUndefined } from "lodash-es";
import { getStringFromI18NText } from "./i18n";
import { DialogPosition, HintData } from "./types";
import {
- checkUrlPathnameMatched,
+ checkUrlMatched,
getElementBounding,
getElementMaxZIndex,
waitForTargetElement,
@@ -12,63 +12,88 @@ const closedHintIndexSet = new Set<number>();
export const showHints = async (hintDataList: HintData[]) => {
removeHint();
- for (const hintData of hintDataList) {
+ const findTargetPromiseList = hintDataList.map(async (hintData) => {
const index = indexOf(hintDataList, hintData);
- if (
- closedHintIndexSet.has(index) ||
- (hintData.url && !checkUrlPathnameMatched(hintData.url))
- ) {
- continue;
+ if (closedHintIndexSet.has(index) || !checkUrlMatched(hintData.url)) {
+ return;
}
const targetElement = await waitForTargetElement([[hintData.selector]]);
if (targetElement) {
removeHint(index);
- renderHighlight(targetElement, hintData, index);
+ renderHint(targetElement, hintData, index);
updateHintPosition(targetElement, hintData, index);
}
- }
+ });
+
+ Promise.all(findTargetPromiseList);
};
-const renderHighlight = (
+const renderHint = (
targetElement: HTMLElement,
hintData: HintData,
hintIndex: number
) => {
- const highlightWrapper = document.createElement("div");
- highlightWrapper.className = `bb-hint-highlight-wrapper bb-hint-${hintIndex}`;
- document.body.appendChild(highlightWrapper);
+ const hintWrapper = document.createElement("div");
+ hintWrapper.className = `bb-hint-wrapper bb-hint-${hintIndex}`;
+ if (hintData.highlight) {
+ hintWrapper.classList.add("highlight");
+ }
+ if (hintData.type === "shield") {
+ hintWrapper.classList.add("shield");
+ }
+ document.body.appendChild(hintWrapper);
const maxZIndex = getElementMaxZIndex(targetElement);
- highlightWrapper.style.zIndex = `${maxZIndex}`;
+ hintWrapper.style.zIndex = `${maxZIndex}`;
if (hintData.additionStyle) {
for (const key in hintData.additionStyle) {
- highlightWrapper.style[key] = hintData.additionStyle[key];
+ hintWrapper.style[key] = hintData.additionStyle[key];
}
}
- if (!checkShouldShowDialog(hintData)) {
- highlightWrapper.style.pointerEvents = "none";
- }
-
const bounding = getElementBounding(targetElement);
- highlightWrapper.style.top = `${bounding.top}px`;
- highlightWrapper.style.left = `${bounding.left}px`;
- highlightWrapper.style.width = `${bounding.width}px`;
- highlightWrapper.style.height = `${bounding.height}px`;
-
- highlightWrapper.addEventListener(
- "click",
- (e) => {
- e.stopPropagation();
- highlightWrapper.style.pointerEvents = "none";
+ hintWrapper.style.top = `${bounding.top}px`;
+ hintWrapper.style.left = `${bounding.left}px`;
+ hintWrapper.style.width = `${bounding.width}px`;
+ hintWrapper.style.height = `${bounding.height}px`;
+
+ if (isUndefined(hintData.dialog)) {
+ hintWrapper.style.pointerEvents = "none";
+ } else {
+ if (hintData.dialog.alwaysShow) {
renderHintDialog(targetElement, hintData, hintIndex);
- },
- {
- once: true,
+ hintWrapper.style.pointerEvents = "none";
+ } else {
+ hintWrapper.addEventListener(
+ "click",
+ (e) => {
+ e.stopPropagation();
+ hintWrapper.style.pointerEvents = "none";
+ if (!isUndefined(hintData.dialog)) {
+ if (hintData.dialog.showOnce) {
+ closedHintIndexSet.add(hintIndex);
+ }
+ renderHintDialog(targetElement, hintData, hintIndex);
+ }
+ },
+ {
+ once: true,
+ }
+ );
}
- );
+ }
+
+ if (hintData.cover) {
+ const maxZIndex = getElementMaxZIndex(targetElement);
+ hintWrapper.classList.add("covered");
+ const coverElement = document.createElement("div");
+ coverElement.className = `bb-hint-cover-wrapper bb-hint-${hintIndex}`;
+ coverElement.style.zIndex = `${Math.max(maxZIndex - 1, 0)}`;
+ document.body.appendChild(coverElement);
+ targetElement.classList.add("bb-hint-target-element");
+ }
};
const renderHintDialog = (
@@ -76,7 +101,13 @@ const renderHintDialog = (
hintData: HintData,
hintIndex: number
) => {
- const { title, description } = hintData;
+ if (isUndefined(hintData.dialog)) {
+ return;
+ }
+
+ const {
+ dialog: { title, description, position, alwaysShow },
+ } = hintData;
const hintDialogDiv = document.createElement("div");
hintDialogDiv.className = `bb-hint-dialog bb-hint-dialog-${hintIndex}`;
@@ -89,14 +120,16 @@ const renderHintDialog = (
}
}
- const closeButton = document.createElement("button");
- closeButton.className = "bb-hint-close-button";
- closeButton.innerHTML = "&times;";
- closeButton.addEventListener("click", () => {
- removeHint(hintIndex);
- closedHintIndexSet.add(hintIndex);
- });
- hintDialogDiv.appendChild(closeButton);
+ if (!alwaysShow) {
+ const closeButton = document.createElement("button");
+ closeButton.className = "bb-hint-close-button";
+ closeButton.innerHTML = "&times;";
+ closeButton.addEventListener("click", () => {
+ removeHint(hintIndex);
+ closedHintIndexSet.add(hintIndex);
+ });
+ hintDialogDiv.appendChild(closeButton);
+ }
if (getStringFromI18NText(title)) {
const titleElement = document.createElement("p");
@@ -112,7 +145,7 @@ const renderHintDialog = (
}
document.body.appendChild(hintDialogDiv);
- adjustHintDialogPosition(targetElement, hintDialogDiv, hintData.position);
+ adjustHintDialogPosition(targetElement, hintDialogDiv, position);
};
const adjustHintDialogPosition = (
@@ -121,24 +154,31 @@ const adjustHintDialogPosition = (
position: DialogPosition = "bottom"
) => {
const bounding = getElementBounding(targetElement);
- const guideDialogBounding = getElementBounding(hintDialogDiv);
+ const hintDialogBounding = getElementBounding(hintDialogDiv);
if (position === "bottom") {
hintDialogDiv.style.top = `${bounding.top + bounding.height}px`;
hintDialogDiv.style.left = `${bounding.left - 4}px`;
} else if (position === "top") {
hintDialogDiv.style.top = `${
- bounding.top - guideDialogBounding.height - 8
+ bounding.top - hintDialogBounding.height - 8
}px`;
hintDialogDiv.style.left = `${bounding.left - 4}px`;
} else if (position === "left") {
hintDialogDiv.style.top = `${bounding.top - 4}px`;
hintDialogDiv.style.left = `${
- bounding.left - guideDialogBounding.width - 8
+ bounding.left - hintDialogBounding.width - 8
}px`;
} else if (position === "right") {
hintDialogDiv.style.top = `${bounding.top - 4}px`;
hintDialogDiv.style.left = `${bounding.left + bounding.width}px`;
+ } else if (position === "topright") {
+ hintDialogDiv.style.top = `${
+ bounding.top - hintDialogBounding.height - 8
+ }px`;
+ hintDialogDiv.style.left = `${
+ bounding.left + bounding.width - hintDialogBounding.width
+ }px`;
}
};
@@ -147,21 +187,21 @@ const updateHintPosition = (
hintData: HintData,
hintIndex: number
) => {
- const highlightWrapper = document.body.querySelector(
- `.bb-hint-highlight-wrapper.bb-hint-${hintIndex}`
+ const hintWrapper = document.body.querySelector(
+ `.bb-hint-wrapper.bb-hint-${hintIndex}`
) as HTMLElement;
- if (!targetElement || !highlightWrapper) {
+ if (!targetElement || !hintWrapper) {
removeHint(hintIndex);
return;
}
const bounding = getElementBounding(targetElement);
- highlightWrapper.style.top = `${bounding.top}px`;
- highlightWrapper.style.left = `${bounding.left}px`;
- highlightWrapper.style.width = `${bounding.width}px`;
- highlightWrapper.style.height = `${bounding.height}px`;
+ hintWrapper.style.top = `${bounding.top}px`;
+ hintWrapper.style.left = `${bounding.left}px`;
+ hintWrapper.style.width = `${bounding.width}px`;
+ hintWrapper.style.height = `${bounding.height}px`;
requestAnimationFrame(() =>
updateHintPosition(targetElement, hintData, hintIndex)
@@ -170,9 +210,7 @@ const updateHintPosition = (
export const removeHint = (hintIndex?: number) => {
if (isUndefined(hintIndex)) {
- const hintWrappers = document.querySelectorAll(
- ".bb-hint-highlight-wrapper"
- );
+ const hintWrappers = document.querySelectorAll(".bb-hint-wrapper");
if (hintWrappers) {
hintWrappers.forEach((hintWrapper) => {
hintWrapper.remove();
@@ -184,26 +222,32 @@ export const removeHint = (hintIndex?: number) => {
hintDialog.remove();
});
}
+ const hintCovers = document.querySelectorAll(".bb-hint-cover-wrapper");
+ if (hintCovers) {
+ hintCovers.forEach((item) => {
+ item.remove();
+ });
+ }
} else {
const hintWrapper = document.querySelector(
- `.bb-hint-highlight-wrapper.bb-hint-${hintIndex}`
+ `.bb-hint-wrapper.bb-hint-${hintIndex}`
);
if (hintWrapper) {
hintWrapper.remove();
}
+
const hintDialog = document.querySelector(
`.bb-hint-dialog.bb-hint-dialog-${hintIndex}`
);
if (hintDialog) {
hintDialog.remove();
}
- }
-};
-const checkShouldShowDialog = (hintData: HintData): boolean => {
- if (!isUndefined(hintData.title)) {
- return true;
+ const hintCover = document.querySelector(
+ `.bb-hint-cover-wrapper.bb-hint-${hintIndex}`
+ );
+ if (hintCover) {
+ hintCover.remove();
+ }
}
-
- return false;
};
diff --git a/frontend/src/plugins/demo/listener.ts b/frontend/src/plugins/demo/listener.ts
index a6f6b15f76..8aa9066724 100644
--- a/frontend/src/plugins/demo/listener.ts
+++ b/frontend/src/plugins/demo/listener.ts
@@ -91,7 +91,8 @@ const initMutationListenerForHint = () => {
for (const changedNode of changedNodes) {
if (
changedNode instanceof HTMLElement &&
- !changedNode.matches(".bb-hint-highlight-wrapper") &&
+ !changedNode.matches(".bb-hint-wrapper") &&
+ !changedNode.matches(".bb-hint-cover-wrapper") &&
!changedNode.matches(".bb-hint-dialog")
) {
tryToShowHints();
diff --git a/frontend/src/plugins/demo/style.css b/frontend/src/plugins/demo/style.css
index 99f6dbba7a..db902e2ff8 100644
--- a/frontend/src/plugins/demo/style.css
+++ b/frontend/src/plugins/demo/style.css
@@ -1,9 +1,11 @@
-.bb-guide-cover-wrapper {
+.bb-guide-cover-wrapper,
+.bb-hint-cover-wrapper {
@apply fixed inset-0;
z-index: 999998;
}
-.bb-guide-target-element {
+.bb-guide-target-element,
+.bb-hint-target-element {
z-index: 999999;
}
@@ -20,7 +22,7 @@
.bb-guide-dialog,
.bb-hint-dialog {
- @apply absolute bg-white w-72 m-1 text-black p-2 px-3 rounded-lg text-left -top-full -left-full;
+ @apply absolute bg-white w-72 m-1 text-black p-2 py-3 px-3 rounded-lg text-left -top-full -left-full;
box-shadow: 0 3px 30px rgb(33 33 33 / 30%);
z-index: 1000000;
}
@@ -38,7 +40,7 @@
.bb-guide-description-text,
.bb-hint-description-text {
- @apply text-base text-gray-700 break-words;
+ @apply text-base py-1 text-gray-700 break-words;
}
.bb-guide-btns-container {
@@ -49,13 +51,30 @@
@apply px-2 py-1 border text-sm rounded hover:opacity-80 hover:border-gray-400;
}
-.bb-hint-highlight-wrapper {
+.bb-hint-wrapper {
@apply absolute rounded transition-all cursor-pointer;
z-index: 999999;
+ box-shadow: rgb(33 33 33 / 80%) 0px 0px 1px 2px;
+}
+
+.bb-hint-wrapper.covered {
+ box-shadow: rgb(33 33 33 / 80%) 0px 0px 1px 2px,
+ rgb(33 33 33 / 60%) 0px 0px 0px 5000px !important;
+}
+
+.bb-hint-wrapper.highlight {
box-shadow: rgb(78 70 211 / 80%) 0px 0px 1px 2px;
animation: 0.5s linear 0.5s infinite alternate breathing;
}
+.bb-hint-wrapper.shield {
+ @apply border-none rounded-none;
+ background: rgb(33 33 33 / 50%);
+ box-shadow: none;
+ cursor: not-allowed;
+ pointer-events: auto !important;
+}
+
@keyframes breathing {
0% {
box-shadow: rgb(78 70 211) 0px 0px 1px 2px;
diff --git a/frontend/src/plugins/demo/types.ts b/frontend/src/plugins/demo/types.ts
index e52f8db180..6437287d9a 100644
--- a/frontend/src/plugins/demo/types.ts
+++ b/frontend/src/plugins/demo/types.ts
@@ -1,6 +1,6 @@
type StepType = "click" | "change";
-export type DialogPosition = "bottom" | "top" | "left" | "right";
+export type DialogPosition = "bottom" | "top" | "left" | "right" | "topright";
export type I18NText = {
[key: string]: string;
@@ -28,17 +28,28 @@ export interface GuideData {
steps: StepData[];
}
+export type HintType = "hint" | "shield";
+
// Hint is a special guide that has no Next button and is always shown.
export interface HintData {
selector: string;
- title: string | I18NText;
- description: string | I18NText;
+ type: HintType;
+ // pathname is the wanted pathname of the url, cound be a regex-like string
+ pathname: string;
// url is using for validate url in change step
- url?: string;
- // position is the position of the guide dialog (default is bottom)
- position?: DialogPosition;
+ url: string;
+ highlight?: boolean;
// cover is the flag that cover should be shown
cover?: boolean;
+ // dialog is a data of dialog info. If it's undefined, then the dialog will not be shown.
+ dialog?: {
+ title: string | I18NText;
+ description: string | I18NText;
+ // position is the position of the guide dialog (default is bottom)
+ position?: DialogPosition;
+ alwaysShow?: boolean;
+ showOnce?: boolean;
+ };
// addtionClass is the class name that should be added to the hint element
additionStyle?: CSSStyleDeclaration;
}
diff --git a/frontend/src/plugins/demo/utils.ts b/frontend/src/plugins/demo/utils.ts
index 6ec290858c..329761f0b8 100644
--- a/frontend/src/plugins/demo/utils.ts
+++ b/frontend/src/plugins/demo/utils.ts
@@ -142,6 +142,11 @@ export const checkUrlPathnameMatched = (url: string) => {
return urlObject.pathname === window.location.pathname;
};
+export const checkUrlMatched = (url: string) => {
+ const regex = new RegExp(url);
+ return regex.test(window.location.href);
+};
+
export const isNullOrUndefined = (value: any) => {
return value === null || value === undefined;
};
diff --git a/frontend/src/views/DashboardHeader.vue b/frontend/src/views/DashboardHeader.vue
index c3d1b1f1eb..9138461be1 100644
--- a/frontend/src/views/DashboardHeader.vue
+++ b/frontend/src/views/DashboardHeader.vue
@@ -32,6 +32,7 @@
to="/db"
class="bar-link px-2 py-2 rounded-md"
:class="getRouteLinkClass('/db')"
+ data-label="bb-dashboard-header-database-entry"
>{{ $t("common.databases") }}</router-link
>
diff --git a/frontend/src/views/DatabaseDetail.vue b/frontend/src/views/DatabaseDetail.vue
index 2ab507b0cb..c13f7737e4 100644
--- a/frontend/src/views/DatabaseDetail.vue
+++ b/frontend/src/views/DatabaseDetail.vue
@@ -102,7 +102,10 @@
</DatabaseLabelProps>
</dl>
</div>
- <div class="flex items-center gap-x-2">
+ <div
+ class="flex items-center gap-x-2"
+ data-label="bb-database-detail-action-buttons-container"
+ >
<button
v-if="allowChangeProject"
type="button"
@@ -157,6 +160,7 @@
:responsive="false"
:tab-item-list="tabItemList"
:selected-index="state.selectedIndex"
+ data-label="bb-database-detail-tab"
@select-index="
(index: number) => {
selectTab(index);
diff --git a/frontend/src/views/MigrationHistoryDetail.vue b/frontend/src/views/MigrationHistoryDetail.vue
index 3b7dd6a667..0a75b9cf79 100644
--- a/frontend/src/views/MigrationHistoryDetail.vue
+++ b/frontend/src/views/MigrationHistoryDetail.vue
@@ -131,7 +131,11 @@
/>
<span>{{ $t("migration-history.schema-drift-detected") }}</span>
</div>
- <div class="normal-link text-sm" @click="state.viewDrift = true">
+ <div
+ class="normal-link text-sm"
+ data-label="bb-migration-history-view-drift-button"
+ @click="state.viewDrift = true"
+ >
{{ $t("migration-history.view-drift") }}
</div>
</div>
@@ -141,6 +145,7 @@
v-if="allowShowDiff"
:label="$t('migration-history.show-diff')"
:value="state.showDiff"
+ data-label="bb-migration-history-diff-switch"
@toggle="state.showDiff = $event"
/>
<div class="textinfolabel">
@@ -174,12 +179,14 @@
:old-string="migrationHistory.schemaPrev"
:new-string="migrationHistory.schema"
output-format="side-by-side"
+ data-label="bb-migration-history-code-diff-block"
/>
<template v-else>
<highlight-code-block
v-if="migrationHistory.schema"
class="border mt-2 px-2 whitespace-pre-wrap w-full"
:code="migrationHistory.schema"
+ data-label="bb-migration-history-code-block"
/>
<div v-else class="mt-2">
{{ $t("migration-history.current-schema-empty") }}