Skip to content

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

feat(frontend): add demo account picker and fix LSP WebSocket in dev mode (#19447)

zchpetere1c43b08efd2
diff --git a/CLAUDE.md b/CLAUDE.md
index 8cc7c333c9..30ca0acce9 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -154,7 +154,7 @@ psql -U bbdev bbdev
### Breaking Change Check (MANDATORY before `gh pr create`)
-**Before every `gh pr create`, you MUST review the diff against the base branch and check for:**
+**This is a required step in the PR creation workflow. Run `git diff main...HEAD` and check every item below BEFORE writing the `gh pr create` command. This step comes after pushing the branch and before creating the PR.**
1. **API breaking changes** — removed/renamed endpoints, changed request/response formats, removed/renamed query parameters
2. **Database schema breaking changes** — dropped columns/tables, non-backward-compatible migrations
diff --git a/frontend/src/components/DemoSigninForm.vue b/frontend/src/components/DemoSigninForm.vue
new file mode 100644
index 0000000000..ec7053373d
--- /dev/null
+++ b/frontend/src/components/DemoSigninForm.vue
@@ -0,0 +1,70 @@
+<template>
+ <form class="flex flex-col gap-y-6 px-1" @submit.prevent="trySignin()">
+ <div>
+ <label
+ for="demo-account"
+ class="block text-sm font-medium leading-5 text-control"
+ >
+ {{ $t("auth.sign-in.demo-account") }}
+ </label>
+ <div class="mt-1">
+ <NSelect
+ id="demo-account"
+ v-model:value="selectedEmail"
+ :options="accountOptions"
+ size="large"
+ />
+ </div>
+ </div>
+
+ <div class="w-full">
+ <NButton
+ attr-type="submit"
+ type="primary"
+ :loading="loading"
+ size="large"
+ style="width: 100%"
+ >
+ {{ $t("common.sign-in") }}
+ </NButton>
+ </div>
+ </form>
+</template>
+
+<script setup lang="ts">
+import { create } from "@bufbuild/protobuf";
+import { NButton, NSelect } from "naive-ui";
+import { ref } from "vue";
+import {
+ type LoginRequest,
+ LoginRequestSchema,
+} from "@/types/proto-es/v1/auth_service_pb";
+
+defineProps<{
+ loading: boolean;
+}>();
+
+const emit = defineEmits<(event: "signin", payload: LoginRequest) => void>();
+
+// NOSONAR: Not a real credential — fixed demo account password, only used in demo mode.
+const DEMO_PASSWORD = "12345678"; // NOSONAR
+
+const accountOptions = [
+ { label: "Demo (Workspace Admin)", value: "[email protected]" },
+ { label: "Dev1 (Developer)", value: "[email protected]" },
+ { label: "DBA1 (DBA)", value: "[email protected]" },
+ { label: "QA1 (QA)", value: "[email protected]" },
+];
+
+const selectedEmail = ref("[email protected]");
+
+const trySignin = () => {
+ emit(
+ "signin",
+ create(LoginRequestSchema, {
+ email: selectedEmail.value,
+ password: DEMO_PASSWORD,
+ })
+ );
+};
+</script>
diff --git a/frontend/src/components/MonacoEditor/lsp-client.ts b/frontend/src/components/MonacoEditor/lsp-client.ts
index ec64a06fd5..7a319bd1fd 100644
--- a/frontend/src/components/MonacoEditor/lsp-client.ts
+++ b/frontend/src/components/MonacoEditor/lsp-client.ts
@@ -33,8 +33,23 @@ export type ConnectionState = {
};
};
+// In dev mode, BB_GRPC_LOCAL points directly to the backend (e.g. http://localhost:8080).
+// Use it for the WebSocket URL to bypass the Vite proxy which doesn't reliably forward
+// WebSocket upgrades in Vite 7.
+const lspHost = (() => {
+ const grpcLocal = import.meta.env.BB_GRPC_LOCAL;
+ if (grpcLocal) {
+ try {
+ return new URL(grpcLocal).host;
+ } catch {
+ // ignore
+ }
+ }
+ return location.host;
+})();
+
const conn = shallowReactive<ConnectionState>({
- url: createUrl(location.host, "/lsp").toString(),
+ url: createUrl(lspHost, "/lsp").toString(),
state: "initial",
ws: undefined,
lastCommand: undefined,
diff --git a/frontend/src/components/PasswordSigninForm.vue b/frontend/src/components/PasswordSigninForm.vue
index 6af64812f6..04a69e6338 100644
--- a/frontend/src/components/PasswordSigninForm.vue
+++ b/frontend/src/components/PasswordSigninForm.vue
@@ -87,13 +87,11 @@
import { create } from "@bufbuild/protobuf";
import { EyeIcon, EyeOffIcon } from "lucide-vue-next";
import { NButton } from "naive-ui";
-import { storeToRefs } from "pinia";
import { computed, onMounted, reactive } from "vue";
import { useRoute } from "vue-router";
import { BBTextField } from "@/bbkit";
import RequiredStar from "@/components/RequiredStar.vue";
import { AUTH_PASSWORD_FORGOT_MODULE } from "@/router/auth";
-import { useActuatorV1Store } from "@/store";
import {
type LoginRequest,
LoginRequestSchema,
@@ -120,7 +118,6 @@ const emit = defineEmits<{
}>();
const route = useRoute();
-const { isDemo } = storeToRefs(useActuatorV1Store());
const state = reactive<LocalState>({
email: "",
@@ -128,23 +125,11 @@ const state = reactive<LocalState>({
showPassword: false,
});
-onMounted(async () => {
+onMounted(() => {
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
- state.email = params.get("email") ?? (isDemo.value ? "[email protected]" : "");
- state.password = params.get("password") ?? (isDemo.value ? "12345678" : "");
- state.showPassword = !!isDemo.value;
-
- // Try to signin with example account in demo site.
- if (
- (window.location.href.startsWith("https://demo.bytebase.com") ||
- window.location.href.startsWith("https://demo.sql-editor.com")) &&
- isDemo.value &&
- state.email &&
- state.password
- ) {
- await trySignin();
- }
+ state.email = params.get("email") ?? "";
+ state.password = params.get("password") ?? "";
});
const allowSignin = computed(() => {
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 282729cb9c..14eed0d271 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -1566,7 +1566,7 @@
"sign-in": {
"forget-password": "Forgot your password?",
"new-user": "New to Bytebase?",
- "demo-note": "Email:{username} Password:{password}",
+ "demo-account": "Demo Account",
"sign-in-with-idp": "Sign in with {idp}"
},
"password-forget": {
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 0afadf072f..8227d10ebc 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -1566,7 +1566,7 @@
"sign-in": {
"forget-password": "¿Olvidaste tu contraseña?",
"new-user": "¿Nuevo en Bytebase?",
- "demo-note": "Correo electrónico:{username} Contraseña:{password}",
+ "demo-account": "Demo Account",
"sign-in-with-idp": "Iniciar sesión con {idp}"
},
"password-forget": {
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 8b2fe580d2..9be2e81c04 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -1566,7 +1566,7 @@
"sign-in": {
"forget-password": "パスワードを忘れましたか?",
"new-user": "Bytebase を初めて使用しますか?",
- "demo-note": "メールアドレス: {username} パスワード: {password}",
+ "demo-account": "Demo Account",
"sign-in-with-idp": "{idp} 経由でログイン"
},
"password-forget": {
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 8810c0a30a..69f9f61f42 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -1566,7 +1566,7 @@
"sign-in": {
"forget-password": "Quên mật khẩu?",
"new-user": "Mới sử dụng Bytebase?",
- "demo-note": "Email:{username} Mật khẩu:{password}",
+ "demo-account": "Demo Account",
"sign-in-with-idp": "Đăng nhập bằng {idp}"
},
"password-forget": {
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 4328d9dd83..43f5346329 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -1566,7 +1566,7 @@
"sign-in": {
"forget-password": "忘记密码?",
"new-user": "第一次使用 Bytebase?",
- "demo-note": "邮箱:{username} 密码:{password}",
+ "demo-account": "Demo Account",
"sign-in-with-idp": "通过 {idp} 登录"
},
"password-forget": {
diff --git a/frontend/src/views/auth/Signin.vue b/frontend/src/views/auth/Signin.vue
index 826038e133..6b545fb2f8 100644
--- a/frontend/src/views/auth/Signin.vue
+++ b/frontend/src/views/auth/Signin.vue
@@ -17,38 +17,35 @@
name="standard"
tab="Standard"
>
- <PasswordSigninForm
+ <DemoSigninForm
+ v-if="isDemo"
:loading="state.isLoading"
@signin="trySignin"
/>
+ <template v-else>
+ <PasswordSigninForm
+ :loading="state.isLoading"
+ @signin="trySignin"
+ />
- <div class="mt-3">
- <div
- class="flex justify-center items-center text-sm text-control"
- >
- <template v-if="isDemo">
- <span class="text-accent">
- {{
- $t("auth.sign-in.demo-note", {
- username: "[email protected]",
- password: "12345678",
- })
- }}
- </span>
- </template>
- <template v-else-if="!disallowSignup">
- <span>
- {{ $t("auth.sign-in.new-user") }}
- </span>
- <router-link
- :to="{ name: AUTH_SIGNUP_MODULE, query: route.query }"
- class="accent-link px-2"
- >
- {{ $t("common.sign-up") }}
- </router-link>
- </template>
+ <div class="mt-3">
+ <div
+ class="flex justify-center items-center text-sm text-control"
+ >
+ <template v-if="!disallowSignup">
+ <span>
+ {{ $t("auth.sign-in.new-user") }}
+ </span>
+ <router-link
+ :to="{ name: AUTH_SIGNUP_MODULE, query: route.query }"
+ class="accent-link px-2"
+ >
+ {{ $t("common.sign-up") }}
+ </router-link>
+ </template>
+ </div>
</div>
- </div>
+ </template>
</NTabPane>
<template
@@ -186,6 +183,7 @@ import { computed, onMounted, reactive, ref, watchEffect } from "vue";
import { useRoute, useRouter } from "vue-router";
import { BBSpin, BBTextField } from "@/bbkit";
import BytebaseLogo from "@/components/BytebaseLogo.vue";
+import DemoSigninForm from "@/components/DemoSigninForm.vue";
import PasswordSigninForm from "@/components/PasswordSigninForm.vue";
import RequiredStar from "@/components/RequiredStar.vue";
import { AUTH_SIGNUP_MODULE } from "@/router/auth";