Skip to content

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

chore: update create database onboarding guide (#2513)

boojack55228e8b5b41
diff --git a/frontend/src/bbkit/BBContextMenuButton.vue b/frontend/src/bbkit/BBContextMenuButton.vue
index 2091ac7187..02f990fe46 100644
--- a/frontend/src/bbkit/BBContextMenuButton.vue
+++ b/frontend/src/bbkit/BBContextMenuButton.vue
@@ -1,6 +1,6 @@
<template>
<button
- class="select-none inline-flex items-center border rounded-md disabled:opacity-50 disabled:cursor-not-allowed text-sm leading-5 font-medium overflow-hidden focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-2"
+ class="select-none inline-flex items-center border border-accent rounded-md disabled:opacity-50 disabled:cursor-not-allowed text-sm leading-5 font-medium overflow-hidden focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-2"
:data-button-type="state.currentAction.type"
:class="actionButtonClass.wrapper"
:disabled="disabled"
diff --git a/frontend/src/components/CreateInstanceForm.vue b/frontend/src/components/CreateInstanceForm.vue
index 44c0e968a1..c9f77ceda5 100644
--- a/frontend/src/components/CreateInstanceForm.vue
+++ b/frontend/src/components/CreateInstanceForm.vue
@@ -340,7 +340,7 @@ const isInOnboaringCreateDatabaseGuide = computed(() => {
const warningModalOkText = computed(() => {
if (isInOnboaringCreateDatabaseGuide.value) {
- return t("instance.create-an-onboarding-postgresql-instance");
+ return t("instance.add-a-postgresql-sample-instance");
} else {
return t("instance.ignore-and-create");
}
diff --git a/frontend/src/components/Issue/IssueStatusTransitionButtonGroup.vue b/frontend/src/components/Issue/IssueStatusTransitionButtonGroup.vue
index c8b02e0156..46e1786492 100644
--- a/frontend/src/components/Issue/IssueStatusTransitionButtonGroup.vue
+++ b/frontend/src/components/Issue/IssueStatusTransitionButtonGroup.vue
@@ -21,6 +21,7 @@
>
<BBContextMenuButton
preference-key="task-status-transition"
+ data-label="bb-issue-status-transition-button"
:action-list="getButtonActionList(transition)"
@click="(action) => onClickTaskStatusTransitionActionButton(action as TaskStatusTransitionButtonAction)"
/>
diff --git a/frontend/src/components/OnboardingGuide.vue b/frontend/src/components/OnboardingGuide.vue
index 0af92fd7ee..5edc95e3f3 100644
--- a/frontend/src/components/OnboardingGuide.vue
+++ b/frontend/src/components/OnboardingGuide.vue
@@ -31,7 +31,8 @@ const checkShouldShowCreateDatabaseGuide = async () => {
if (
instanceList.length === 0 &&
- projectList.length === 0 &&
+ // We have a default project so the length should be 1 not 0.
+ projectList.length === 1 &&
databaseList.length === 0
) {
return true;
@@ -57,4 +58,16 @@ watch(
immediate: true,
}
);
+
+watch(
+ guideStore,
+ async () => {
+ if (!guideStore.guideName) {
+ shouldShowCreateDatabaseGuide.value = false;
+ }
+ },
+ {
+ immediate: true,
+ }
+);
</script>
diff --git a/frontend/src/components/OnboardingGuides/CreateDatabaseGuide.vue b/frontend/src/components/OnboardingGuides/CreateDatabaseGuide.vue
index 955cd745b0..4be7cd96cf 100644
--- a/frontend/src/components/OnboardingGuides/CreateDatabaseGuide.vue
+++ b/frontend/src/components/OnboardingGuides/CreateDatabaseGuide.vue
@@ -1 +1,187 @@
-<template>// eslint-disable-next-line vue/valid-template-root</template>
+<template>
+ <template v-if="guideIndex >= 0 && guideIndex < guideStepList.length">
+ <GuideDialog
+ v-for="guide in shownGuideList"
+ :key="guide.title"
+ :title="guide.title"
+ :position="guide.position"
+ :target-element-selector="guide.targetElementSelector"
+ ></GuideDialog>
+ </template>
+ <Transition>
+ <CreateDatabaseGuideFinished v-if="guideIndex === guideStepList.length" />
+ </Transition>
+</template>
+
+<script lang="ts" setup>
+import { computed, onMounted, ref, watch } from "vue";
+import { useRoute, useRouter } from "vue-router";
+import { lastTask } from "@/utils";
+import {
+ useDatabaseStore,
+ useInstanceList,
+ useIssueStore,
+ useProjectStore,
+} from "@/store";
+import GuideDialog from "@/plugins/demo/components/GuideDialog.vue";
+import CreateDatabaseGuideFinished from "./CreateDatabaseGuideFinished.vue";
+import { useI18n } from "vue-i18n";
+
+const { t } = useI18n();
+const route = useRoute();
+const router = useRouter();
+
+const guideStepList = computed(() => {
+ return [
+ // guides for `add instance`
+ [
+ {
+ title: t("onboarding-guide.create-database-guide.let-add-a-instance"),
+ description: "",
+ position: "bottom-center",
+ targetElementSelector: "[data-label='bb-quick-action-add-instance']",
+ route: "/",
+ expectedUrl: /.*/,
+ },
+ ],
+ // guides for `add project`
+ [
+ {
+ title: t(
+ "onboarding-guide.create-database-guide.go-to-project-list-page"
+ ),
+ description: "",
+ position: "bottom-center",
+ targetElementSelector: "[data-label='bb-header-project-button']",
+ expectedUrl: /^(?!\/project)/,
+ },
+ {
+ title: t("onboarding-guide.create-database-guide.click-new-project"),
+ description: "",
+ position: "bottom-center",
+ targetElementSelector: "[data-label='bb-quick-action-new-project']",
+ expectedUrl: /^\/project/,
+ },
+ ],
+ // guides for `add issue`
+ [
+ {
+ title: t("onboarding-guide.create-database-guide.click-new-database"),
+ description: "",
+ position: "bottom-center",
+ targetElementSelector: "[data-label='bb-quick-action-new-db']",
+ expectedUrl: /.*/,
+ },
+ ],
+ // guides for `approve issue`
+ [
+ {
+ title: t("onboarding-guide.create-database-guide.click-approve"),
+ description: "",
+ position: "bottom-right",
+ targetElementSelector:
+ "[data-label='bb-issue-status-transition-button']",
+ expectedUrl: /.*/,
+ },
+ ],
+ // guides for `loading`
+ [
+ {
+ title: t("onboarding-guide.create-database-guide.wait-issue-finished"),
+ description: "",
+ position: "center",
+ targetElementSelector: "#app",
+ expectedUrl: /.*/,
+ },
+ ],
+ // guides for `back to home`
+ [
+ {
+ title: t("onboarding-guide.create-database-guide.back-to-home"),
+ description: "",
+ position: "bottom",
+ targetElementSelector:
+ "[data-label='bb-dashboard-sidebar-home-button']",
+ expectedUrl: /^\/.+/,
+ },
+ ],
+ ];
+});
+
+const instanceList = useInstanceList();
+const projectList = computed(() => useProjectStore().projectList);
+const issueList = computed(() => useIssueStore().issueList);
+
+const shownGuideList = computed(() => {
+ const guideList = guideStepList.value[guideIndex.value];
+
+ return guideList.filter((guide) => {
+ if (guide.expectedUrl) {
+ return route.path.match(guide.expectedUrl);
+ }
+ return true;
+ });
+});
+
+const guideIndex = ref(-1);
+
+onMounted(() => {
+ if (route.name !== "workspace.home") {
+ router.push({
+ name: "workspace.home",
+ });
+ }
+});
+
+watch(
+ [route, instanceList, projectList, issueList],
+ async () => {
+ let tempGuideIndex = 0;
+ if (instanceList.value.length > 0) {
+ tempGuideIndex = 1;
+ }
+ if (projectList.value.length > 1) {
+ tempGuideIndex = 2;
+ }
+ if (issueList.value.length > 0) {
+ const issue = issueList.value[0];
+ const task = lastTask(issue.pipeline);
+ if (task.status === "PENDING_APPROVAL") {
+ tempGuideIndex = 3;
+ } else if (task.status === "PENDING" || task.status === "RUNNING") {
+ tempGuideIndex = 4;
+ } else {
+ tempGuideIndex = 5;
+ }
+ }
+
+ const databaseList = await useDatabaseStore().fetchDatabaseList();
+ if (databaseList.length > 0 && route.name === "workspace.home") {
+ tempGuideIndex = 6;
+ }
+
+ guideIndex.value = tempGuideIndex;
+ },
+ {
+ immediate: true,
+ }
+);
+
+watch(guideIndex, () => {
+ document.body
+ .querySelectorAll(".bb-guide-target-element")
+ .forEach((el) => el.classList.remove("bb-guide-target-element"));
+});
+</script>
+
+<style scoped>
+.v-enter-active,
+.v-leave-active {
+ transition: opacity 0.3s ease-in;
+}
+
+.v-enter-from,
+.v-leave-to {
+ opacity: 0;
+}
+</style>
diff --git a/frontend/src/components/OnboardingGuides/CreateDatabaseGuideFinished.vue b/frontend/src/components/OnboardingGuides/CreateDatabaseGuideFinished.vue
new file mode 100644
index 0000000000..94192a5646
--- /dev/null
+++ b/frontend/src/components/OnboardingGuides/CreateDatabaseGuideFinished.vue
@@ -0,0 +1,135 @@
+<template>
+ <teleport to="body">
+ <div class="dialog-wrapper fixed top-0 left-0 w-full h-full">
+ <div
+ class="dialog-container relative top-1/2 -translate-y-1/2 -mt-8 mx-auto w-128 bg-white shadow-2xl rounded-lg p-4 flex flex-col justify-start items-start"
+ >
+ <span
+ class="absolute right-3 top-3 p-px rounded cursor-pointer hover:bg-gray-100 hover:shadow"
+ @click="handleCloseButtonClick"
+ >
+ <heroicons-outline:x class="w-6 h-auto" />
+ </span>
+ <p class="text-9xl w-full text-center mt-6">🎉</p>
+ <div
+ class="showup w-1/2 mx-auto flex flex-col justify-start items-start mt-6 text-lg leading-9"
+ >
+ <p>
+ {{
+ $t(
+ "onboarding-guide.create-database-guide.finished-dialog.you-have-done"
+ )
+ }}
+ </p>
+ <p>
+ ✅
+ {{
+ $t(
+ "onboarding-guide.create-database-guide.finished-dialog.add-an-instance"
+ )
+ }}
+ </p>
+ <p>
+ ✅
+ {{
+ $t(
+ "onboarding-guide.create-database-guide.finished-dialog.create-a-project"
+ )
+ }}
+ </p>
+ <p>
+ ✅
+ {{
+ $t(
+ "onboarding-guide.create-database-guide.finished-dialog.create-an-issue"
+ )
+ }}
+ </p>
+ <p>
+ ✅
+ {{
+ $t(
+ "onboarding-guide.create-database-guide.finished-dialog.create-a-new-database"
+ )
+ }}
+ </p>
+ </div>
+ <button
+ class="showup self-center mt-6 mb-4 shadow text-lg px-6 py-3 rounded-md text-white bg-green-600 hover:bg-green-700"
+ @click="handleCloseButtonClick"
+ >
+ {{
+ $t(
+ "onboarding-guide.create-database-guide.finished-dialog.keep-going-with-bytebase"
+ )
+ }}
+ </button>
+ </div>
+ </div>
+ </teleport>
+</template>
+
+<script lang="ts" setup>
+import { useOnboardingGuideStore } from "@/store";
+import { onMounted } from "vue";
+
+onMounted(() => {
+ const colors = ["#ffffff", "#00bb00", "#0000bb"];
+
+ import("canvas-confetti").then(({ default: confetti }) => {
+ const end = Date.now() + 3 * 1000;
+
+ const framework = () => {
+ confetti({
+ particleCount: 3,
+ angle: 60,
+ spread: 60,
+ origin: { x: 0 },
+ zIndex: 10000,
+ colors,
+ });
+ confetti({
+ particleCount: 3,
+ angle: 120,
+ spread: 60,
+ origin: { x: 1 },
+ zIndex: 10000,
+ colors,
+ });
+
+ if (Date.now() < end) {
+ requestAnimationFrame(framework);
+ }
+ };
+
+ framework();
+ });
+});
+
+const handleCloseButtonClick = () => {
+ useOnboardingGuideStore().removeGuide();
+};
+</script>
+
+<style scoped>
+.dialog-wrapper {
+ z-index: 1000;
+ background-color: rgb(33 33 33 / 50%);
+}
+
+.showup {
+ animation: moveup 1s ease;
+}
+
+@keyframes moveup {
+ from {
+ @apply opacity-0;
+ transform: translateY(24px);
+ }
+
+ to {
+ @apply opacity-100;
+ transform: translateY(0);
+ }
+}
+</style>
diff --git a/frontend/src/components/QuickActionPanel.vue b/frontend/src/components/QuickActionPanel.vue
index cfd832f3a6..dc05d680e7 100644
--- a/frontend/src/components/QuickActionPanel.vue
+++ b/frontend/src/components/QuickActionPanel.vue
@@ -5,7 +5,7 @@
<template v-for="(quickAction, index) in quickActionList" :key="index">
<div
v-if="quickAction === 'quickaction.bb.instance.create'"
- class="flex flex-col items-center w-28"
+ class="flex flex-col items-center w-28 py-1"
data-label="bb-quick-action-add-instance"
>
<button class="btn-icon-primary p-3" @click.prevent="createInstance">
@@ -18,7 +18,7 @@
<div
v-if="quickAction === 'quickaction.bb.user.manage'"
- class="flex flex-col items-center w-28"
+ class="flex flex-col items-center w-28 py-1"
>
<router-link to="/setting/member" class="btn-icon-primary p-3">
<heroicons-outline:users class="w-6 h-6" />
@@ -32,7 +32,7 @@
<div
v-if="quickAction === 'quickaction.bb.database.create'"
- class="flex flex-col items-center w-28"
+ class="flex flex-col items-center w-28 py-1"
data-label="bb-quick-action-new-db"
>
<button class="btn-icon-primary p-3" @click.prevent="createDatabase">
@@ -47,7 +47,7 @@
<div
v-if="quickAction === 'quickaction.bb.database.request'"
- class="flex flex-col items-center w-28"
+ class="flex flex-col items-center w-28 py-1"
>
<button class="btn-icon-primary p-3" @click.prevent="requestDatabase">
<heroicons-outline:database class="w-6 h-6" />
@@ -61,7 +61,7 @@
<div
v-if="quickAction === 'quickaction.bb.database.schema.update'"
- class="flex flex-col items-center w-28"
+ class="flex flex-col items-center w-28 py-1"
>
<button
class="btn-icon-primary p-3"
@@ -77,7 +77,7 @@
<div
v-if="quickAction === 'quickaction.bb.database.data.update'"
- class="flex flex-col items-center w-28"
+ class="flex flex-col items-center w-28 py-1"
>
<button class="btn-icon-primary p-3" @click.prevent="changeData">
<heroicons-outline:pencil class="w-6 h-6" />
@@ -89,7 +89,7 @@
<div
v-if="quickAction === 'quickaction.bb.database.troubleshoot'"
- class="flex flex-col items-center w-28"
+ class="flex flex-col items-center w-28 py-1"
>
<router-link to="/issue/new" class="btn-icon-primary p-3">
<heroicons-outline:hand class="w-6 h-6" />
@@ -113,7 +113,7 @@
<div
v-if="quickAction === 'quickaction.bb.environment.reorder'"
- class="flex flex-col items-center w-28"
+ class="flex flex-col items-center w-28 py-1"
>
<button
class="btn-icon-primary p-3"
@@ -128,7 +128,7 @@
<div
v-if="quickAction === 'quickaction.bb.project.create'"
- class="flex flex-col items-center w-28"
+ class="flex flex-col items-center w-28 py-1"
data-label="bb-quick-action-new-project"
>
<button class="btn-icon-primary p-3" @click.prevent="createProject">
@@ -141,7 +141,7 @@
<div
v-if="quickAction === 'quickaction.bb.project.database.transfer'"
- class="flex flex-col items-center w-28"
+ class="flex flex-col items-center w-28 py-1"
>
<button class="btn-icon-primary p-3" @click.prevent="transferDatabase">
<heroicons-outline:chevron-double-down class="w-6 h-6" />
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index f9e98d4387..a8a7b8b63c 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -644,7 +644,7 @@
"password-write-only": "YOUR_DB_PWD - write only",
"test-connection": "Test Connection",
"ignore-and-create": "Ignore and create",
- "create-an-onboarding-postgresql-instance": "Create an onboarding PostgreSQL instance",
+ "add-a-postgresql-sample-instance": "Add a PostgreSQL sample instance",
"successfully-created-postgresql-instance": "Successfully created onboarding PostgreSQL instance and automatically filled into the form.",
"connection-info-seems-to-be-incorrect": "Connection info seems to be incorrect",
"new-instance": "New Instance",
@@ -1565,7 +1565,26 @@
"copy-all": "Copy All",
"copied": "Copied!",
"export": "Export"
- }
+ }
+ }
+ },
+ "onboarding-guide": {
+ "create-database-guide": {
+ "let-add-a-instance": "Let's add an instance",
+ "go-to-project-list-page": "Go to project list page",
+ "click-new-project": "Click \"New Project\" to create a project",
+ "click-new-database": "Click \"New Database\" to create a database",
+ "click-approve": "Click \"Approve\" to perform the issue",
+ "wait-issue-finished": "Wait the issue finished",
+ "back-to-home": "Back to home",
+ "finished-dialog": {
+ "you-have-done": "You have done:",
+ "add-an-instance": "Add an instance",
+ "create-a-project": "Create a project",
+ "create-an-issue": "Create an issue",
+ "create-a-new-database": "Create a new database",
+ "keep-going-with-bytebase": "Keep going with Bytebase"
+ }
}
}
}
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 4f9ccca4dc..e281144444 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -644,7 +644,7 @@
"password-write-only": "YOUR_DB_PWD - 仅写入",
"test-connection": "测试连接",
"ignore-and-create": "忽略并创建",
- "create-an-onboarding-postgresql-instance": "创建一个临时的 PostgreSQL 数据库实例",
+ "add-a-postgresql-sample-instance": "创建一个 PostgreSQL 样式实例",
"successfully-created-postgresql-instance": "成功创建临时的 PostgreSQL 数据库实例,并已经自动填充至表单。",
"connection-info-seems-to-be-incorrect": "连接信息似乎错误",
"new-instance": "新实例",
@@ -1565,7 +1565,26 @@
"copy-all": "拷贝全部",
"copied": "已拷贝",
"export": "导出"
- }
+ }
+ }
+ },
+ "onboarding-guide": {
+ "create-database-guide": {
+ "let-add-a-instance": "让我们先添加一个实例吧",
+ "go-to-project-list-page": "前往项目页面",
+ "click-new-project": "点击\"创建项目\"按钮",
+ "click-new-database": "点击\"创建数据库\"按钮",
+ "click-approve": "点击\"批准\"按钮来执行这个工单",
+ "wait-issue-finished": "等待工单完成中",
+ "back-to-home": "回到主页",
+ "finished-dialog": {
+ "you-have-done": "你已经完成了:",
+ "add-an-instance": "添加了一个实例",
+ "create-a-project": "创建了一个项目",
+ "create-an-issue": "创建了一个工单",
+ "create-a-new-database": "创建了一个数据库",
+ "keep-going-with-bytebase": "继续使用 Bytebase!"
+ }
}
}
}
diff --git a/frontend/src/plugins/demo/components/GuideDialog.vue b/frontend/src/plugins/demo/components/GuideDialog.vue
new file mode 100644
index 0000000000..301cfe603f
--- /dev/null
+++ b/frontend/src/plugins/demo/components/GuideDialog.vue
@@ -0,0 +1,309 @@
+<template>
+ <teleport to="body">
+ <div v-if="shouldShow" ref="coverWrapperRef" class="cover-wrapper"></div>
+ <Transition>
+ <div
+ v-if="shouldShow"
+ ref="dialogWrapperRef"
+ class="guide-wrapper"
+ :class="position"
+ >
+ <p class="title">{{ props.title }}</p>
+ </div>
+ </Transition>
+ <Transition>
+ <div
+ v-if="shouldShow"
+ ref="highlightWrapperRef"
+ class="highlight-wrapper"
+ ></div>
+ </Transition>
+ </teleport>
+</template>
+
+<script lang="ts" setup>
+import { cloneDeep } from "lodash-es";
+import { nextTick, onMounted, onUnmounted, ref, watch } from "vue";
+import {
+ getElementBounding,
+ getElementMaxZIndex,
+ getScrollParent,
+ getStylePropertyValue,
+ waitForTargetElement,
+} from "../utils";
+
+const props = defineProps({
+ title: {
+ type: String,
+ default: "",
+ },
+ description: {
+ type: String,
+ default: "",
+ },
+ position: {
+ type: String,
+ default: "bottom",
+ },
+ targetElementSelector: {
+ type: String,
+ default: "",
+ },
+});
+
+const shouldShow = ref(false);
+const targetElementRef = ref<HTMLElement>();
+const dialogWrapperRef = ref<HTMLElement>();
+const highlightWrapperRef = ref<HTMLElement>();
+const coverWrapperRef = ref<HTMLElement>();
+
+const initialElements = async () => {
+ const clonedProps = cloneDeep(props);
+ const targetElement = await waitForTargetElement(
+ clonedProps.targetElementSelector
+ );
+ if (!targetElement) {
+ return;
+ }
+
+ targetElementRef.value = targetElement;
+ targetElement.classList.add("bb-guide-target-element");
+
+ const parentEl = getScrollParent(targetElementRef.value);
+ parentEl.addEventListener("scroll", handleScrollableParentScroll);
+
+ shouldShow.value = true;
+ await updateDialogPosition();
+};
+
+onMounted(() => {
+ nextTick(async () => {
+ await initialElements();
+ });
+});
+
+onUnmounted(() => {
+ targetElementRef.value?.classList.remove("bb-guide-target-element");
+ const parentEl = getScrollParent(targetElementRef.value);
+ parentEl.removeEventListener("scroll", handleScrollableParentScroll);
+});
+
+watch([props], () => {
+ nextTick(async () => {
+ await initialElements();
+ });
+});
+
+const handleScrollableParentScroll = () => {
+ if (!targetElementRef.value) {
+ return;
+ }
+ const parentEl = getScrollParent(targetElementRef.value);
+ if (
+ targetElementRef.value.offsetTop + 8 <
+ parentEl.scrollTop + parentEl.offsetTop
+ ) {
+ shouldShow.value = false;
+ } else {
+ shouldShow.value = true;
+ }
+};
+
+const updateDialogPosition = async () => {
+ if (
+ !coverWrapperRef.value ||
+ !dialogWrapperRef.value ||
+ !highlightWrapperRef.value
+ ) {
+ requestAnimationFrame(() => updateDialogPosition());
+ return;
+ }
+
+ const targetElement = document.body.querySelector(
+ props.targetElementSelector
+ ) as HTMLElement;
+ if (!targetElement) {
+ shouldShow.value = false;
+ return;
+ }
+
+ if (getStylePropertyValue(targetElement, "border-radius") !== "0px") {
+ highlightWrapperRef.value.style.borderRadius = getStylePropertyValue(
+ targetElement,
+ "border-radius"
+ );
+ }
+
+ targetElement.classList.add("bb-guide-target-element");
+ const maxZIndex = getElementMaxZIndex(targetElement);
+ coverWrapperRef.value.style.zIndex = `${Math.max(maxZIndex - 1, 0)}`;
+ highlightWrapperRef.value.style.zIndex = `${maxZIndex}`;
+ dialogWrapperRef.value.style.zIndex = `${maxZIndex + 1}`;
+
+ const bounding = getElementBounding(targetElement);
+ if (bounding.width === 0 || bounding.height === 0) {
+ shouldShow.value = false;
+ return;
+ }
+
+ if (props.position !== "center") {
+ highlightWrapperRef.value.style.top = `${bounding.top}px`;
+ highlightWrapperRef.value.style.left = `${bounding.left}px`;
+ highlightWrapperRef.value.style.width = `${bounding.width}px`;
+ highlightWrapperRef.value.style.height = `${bounding.height}px`;
+ }
+
+ const dialogBounding = getElementBounding(dialogWrapperRef.value);
+ if (props.position === "bottom") {
+ dialogWrapperRef.value.style.top = `${bounding.top + bounding.height}px`;
+ dialogWrapperRef.value.style.left = `${bounding.left - 4}px`;
+ } else if (props.position === "top") {
+ dialogWrapperRef.value.style.top = `${
+ bounding.top - dialogBounding.height - 8
+ }px`;
+ dialogWrapperRef.value.style.left = `${bounding.left - 4}px`;
+ } else if (props.position === "left") {
+ dialogWrapperRef.value.style.top = `${bounding.top - 8}px`;
+ dialogWrapperRef.value.style.left = `${
+ bounding.left - dialogBounding.width - 12
+ }px`;
+ } else if (props.position === "right") {
+ dialogWrapperRef.value.style.top = `${bounding.top - 4}px`;
+ dialogWrapperRef.value.style.left = `${bounding.left + bounding.width}px`;
+ } else if (props.position === "bottom-right") {
+ dialogWrapperRef.value.style.top = `${bounding.top + bounding.height}px`;
+ dialogWrapperRef.value.style.left = `${
+ bounding.left + bounding.width - dialogBounding.width
+ }px`;
+ } else if (props.position === "bottom-center") {
+ dialogWrapperRef.value.style.top = `${bounding.top + bounding.height}px`;
+ dialogWrapperRef.value.style.left = `${
+ bounding.left + (bounding.width - dialogBounding.width) / 2
+ }px`;
+ }
+ requestAnimationFrame(() => updateDialogPosition());
+};
+</script>
+
+<style>
+.bb-guide-target-element {
+ z-index: 1;
+}
+</style>
+
+<style scoped>
+.guide-wrapper {
+ @apply fixed -top-full -left-full bg-white w-64 m-1 my-2 p-3 px-5 text-base text-slate-900 rounded-lg text-left;
+ z-index: 10000;
+ box-shadow: 0 4px 36px rgb(33 33 33 / 40%);
+}
+
+.highlight-wrapper {
+ @apply fixed pointer-events-none rounded-lg;
+ box-shadow: 0 4px 36px rgb(33 33 33 / 40%),
+ rgb(33 33 33 / 50%) 0px 0px 0px 100vw;
+ z-index: 9999;
+}
+
+.cover-wrapper {
+ @apply fixed inset-0 overflow-hidden;
+ pointer-events: auto !important;
+}
+
+.v-enter-active,
+.v-leave-active {
+ transition: opacity 0.3s ease-in;
+}
+
+.v-enter-from,
+.v-leave-to {
+ opacity: 0;
+}
+
+.guide-wrapper.top {
+ margin-top: -4px;
+}
+.guide-wrapper.top::before {
+ content: "";
+ position: absolute;
+ bottom: -8px;
+ left: 24px;
+ border-left: 8px solid transparent;
+ border-right: 8px solid transparent;
+ border-top: 8px solid white;
+}
+
+.guide-wrapper.bottom {
+ margin-top: 16px;
+}
+.guide-wrapper.bottom::before {
+ content: "";
+ position: absolute;
+ top: -8px;
+ left: 24px;
+ border-left: 8px solid transparent;
+ border-right: 8px solid transparent;
+ border-bottom: 8px solid white;
+}
+
+.guide-wrapper.bottom-center {
+ @apply w-auto text-base;
+ margin-top: 12px;
+}
+
+.guide-wrapper.bottom-center::before {
+ content: "";
+ position: absolute;
+ top: -8px;
+ left: 50%;
+ margin-left: -12px;
+ border-left: 8px solid transparent;
+ border-right: 8px solid transparent;
+ border-bottom: 8px solid white;
+}
+
+.guide-wrapper.bottom-right {
+ margin-top: 12px;
+}
+
+.guide-wrapper.bottom-right::before {
+ content: "";
+ position: absolute;
+ top: -8px;
+ right: 24px;
+ border-left: 8px solid transparent;
+ border-right: 8px solid transparent;
+ border-bottom: 8px solid white;
+}
+
+.guide-wrapper.left {
+ margin: 0;
+ margin-top: -6px;
+}
+.guide-wrapper.left::before {
+ content: "";
+ position: absolute;
+ top: 8px;
+ right: -10px;
+ border-top: 10px solid transparent;
+ border-bottom: 10px solid transparent;
+ border-left: 10px solid white;
+}
+
+.guide-wrapper.right {
+ margin-top: -10px;
+}
+.guide-wrapper.right::before {
+ content: "";
+ position: absolute;
+ top: 16px;
+ left: -10px;
+ border-top: 10px solid transparent;
+ border-bottom: 10px solid transparent;
+ border-right: 10px solid white;
+}
+
+.guide-wrapper.center {
+ @apply w-64 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 -mt-16;
+}
+</style>
diff --git a/frontend/src/plugins/demo/style.css b/frontend/src/plugins/demo/style.css
index 02ff3be2e3..8954371285 100644
--- a/frontend/src/plugins/demo/style.css
+++ b/frontend/src/plugins/demo/style.css
@@ -7,7 +7,6 @@
.bb-guide-target-element,
.bb-hint-target-element {
z-index: 1;
- background-color: white;
}
.bb-guide-highlight-wrapper {
diff --git a/frontend/src/plugins/demo/utils.ts b/frontend/src/plugins/demo/utils.ts
index f49035a8d9..93e0130f4b 100644
--- a/frontend/src/plugins/demo/utils.ts
+++ b/frontend/src/plugins/demo/utils.ts
@@ -158,3 +158,17 @@ export const checkUrlMatched = (url: string) => {
export const isNullOrUndefined = (value: any) => {
return value === null || value === undefined;
};
+
+export const getScrollParent = (
+ element: HTMLElement | null | undefined
+): HTMLElement => {
+ if (!element) {
+ return document.body;
+ }
+
+ if (element.scrollHeight > element.clientHeight) {
+ return element;
+ } else {
+ return getScrollParent(element.parentElement);
+ }
+};
diff --git a/frontend/src/store/modules/help.ts b/frontend/src/store/modules/help.ts
index e27c312dbe..610ba9ca9c 100644
--- a/frontend/src/store/modules/help.ts
+++ b/frontend/src/store/modules/help.ts
@@ -1,5 +1,5 @@
import { defineStore } from "pinia";
-import { useActuatorStore } from "@/store";
+import { useActuatorStore, useOnboardingGuideStore } from "@/store";
export const useHelpStore = defineStore("help", {
state: (): {
@@ -14,12 +14,15 @@ export const useHelpStore = defineStore("help", {
actions: {
showHelp(id: string, openByDefault: boolean): void {
const actuatorStore = useActuatorStore();
+ const onboardingGuideName = useOnboardingGuideStore().guideName;
+
const demoName = actuatorStore.serverInfo?.demoName;
const invalidFeatureDemoNameList = ["dev", "prod"];
const isFeatureDemo =
demoName && !invalidFeatureDemoNameList.includes(demoName);
- if (!isFeatureDemo) {
- // only show help when not in live demo
+
+ // Do not show help in live demo and onboarding guide
+ if (!isFeatureDemo && !onboardingGuideName) {
this.currHelpId = id;
this.openByDefault = openByDefault;
}
diff --git a/frontend/src/store/modules/onboardingGuide.ts b/frontend/src/store/modules/onboardingGuide.ts
index b1e3fb69e7..80a08ecc28 100644
--- a/frontend/src/store/modules/onboardingGuide.ts
+++ b/frontend/src/store/modules/onboardingGuide.ts
@@ -9,5 +9,8 @@ export const useOnboardingGuideStore = defineStore("onboarding_guide", {
setGuideName(guideName: OnboardingGuideType) {
this.guideName = guideName;
},
+ removeGuide() {
+ this.guideName = undefined;
+ },
},
});
diff --git a/frontend/src/views/DashboardSidebar.vue b/frontend/src/views/DashboardSidebar.vue
index 0620a020e5..64c774e560 100644
--- a/frontend/src/views/DashboardSidebar.vue
+++ b/frontend/src/views/DashboardSidebar.vue
@@ -17,9 +17,14 @@
</span>
</button>
- <router-link to="/" class="outline-item group flex items-center px-2 py-2">
- <heroicons-outline:home class="w-5 h-5 mr-2" />
- {{ $t("common.home") }}
+ <router-link to="/" class="outline-item group flex items-center">
+ <div
+ class="outline-item group flex items-center px-2 py-2"
+ data-label="bb-dashboard-sidebar-home-button"
+ >
+ <heroicons-outline:home class="w-5 h-5 mr-2" />
+ {{ $t("common.home") }}
+ </div>
</router-link>
<router-link
to="/sql-editor"