Skip to content

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

chore(frontend): minor improvements and bug fixes (#6525)

Liu Jic1700ec36bdb
diff --git a/frontend/package.json b/frontend/package.json
index 4a0a060728..4d1dc262b1 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -61,6 +61,7 @@
"sql-formatter": "11.0.2",
"uuid": "9.0.0",
"v-code-diff": "0.3.12",
+ "vdirs": "^0.1.8",
"vscode-languageserver": "8.0.2",
"vscode-languageserver-protocol": "3.17.3",
"vscode-languageserver-textdocument": "1.0.8",
diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml
index 9fe5c7b9a4..4d15821449 100644
--- a/frontend/pnpm-lock.yaml
+++ b/frontend/pnpm-lock.yaml
@@ -146,6 +146,9 @@ dependencies:
v-code-diff:
specifier: 0.3.12
version: 0.3.12([email protected])
+ vdirs:
+ specifier: ^0.1.8
+ version: 0.1.8([email protected])
vscode-languageserver:
specifier: 8.0.2
version: 8.0.2
diff --git a/frontend/src/bbkit/BBAlert.vue b/frontend/src/bbkit/BBAlert.vue
index 2ea6e1a4c4..936859171b 100644
--- a/frontend/src/bbkit/BBAlert.vue
+++ b/frontend/src/bbkit/BBAlert.vue
@@ -1,5 +1,5 @@
<template>
- <div class="fixed z-10 inset-0 overflow-y-auto">
+ <div v-zindexable="{ enabled: true }" class="fixed inset-0 overflow-y-auto">
<div
class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0"
>
@@ -121,6 +121,7 @@
<script lang="ts" setup>
import { useEventListener } from "@vueuse/core";
import { withDefaults, computed } from "vue";
+import { zindexable as vZindexable } from "vdirs";
import { BBAlertStyle } from "./types";
type Payload = string | number | boolean | any;
diff --git a/frontend/src/bbkit/BBAlertDialog.vue b/frontend/src/bbkit/BBAlertDialog.vue
index 509ef8712f..fc094a3a32 100644
--- a/frontend/src/bbkit/BBAlertDialog.vue
+++ b/frontend/src/bbkit/BBAlertDialog.vue
@@ -1,5 +1,9 @@
<template>
- <div v-if="state.visible" class="fixed z-10 inset-0 overflow-y-auto">
+ <div
+ v-if="state.visible"
+ v-zindexable="{ enabled: true }"
+ class="fixed inset-0 overflow-y-auto"
+ >
<div
class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0"
>
@@ -121,6 +125,7 @@
<script lang="ts" setup>
import { useEventListener } from "@vueuse/core";
import { withDefaults, computed, reactive } from "vue";
+import { zindexable as vZindexable } from "vdirs";
import { BBAlertStyle } from "./types";
import { Defer, defer } from "@/utils";
diff --git a/frontend/src/bbkit/BBModal.vue b/frontend/src/bbkit/BBModal.vue
index a0f7f31354..77d7ac95fc 100644
--- a/frontend/src/bbkit/BBModal.vue
+++ b/frontend/src/bbkit/BBModal.vue
@@ -1,32 +1,41 @@
<template>
- <teleport to="#bb-modal-stack">
- <div class="fixed inset-0 bg-transparent" :style="style" />
+ <teleport to="body">
<div
- v-bind="$attrs"
- class="bb-modal"
- :style="style"
- :data-bb-modal-id="id"
- :data-bb-modal-index="index"
- :data-bb-modal-active="active"
+ v-zindexable="{ enabled: true }"
+ class="fixed inset-0 w-full h-screen flex items-center justify-center bg-transparent"
>
- <div class="modal-header" :class="headerClass">
- <div class="text-xl text-main mr-2 flex-1 overflow-hidden">
- <slot name="title"><component :is="renderTitle" /></slot>
- <component :is="renderSubtitle" />
+ <div
+ v-bind="$attrs"
+ class="absolute m-auto w-full max-w-max max-h-[calc(100vh-80px)] bg-white shadow-lg rounded-lg pt-4 pb-4 flex pointer-events-auto flex-col"
+ :data-bb-modal-id="id"
+ :data-bb-modal-index="index"
+ :data-bb-modal-active="active"
+ >
+ <div
+ class="relative mx-8 pb-2 flex items-center justify-between border-b border-block-border"
+ :class="headerClass"
+ >
+ <div class="text-xl text-main mr-2 flex-1 overflow-hidden">
+ <slot name="title"><component :is="renderTitle" /></slot>
+ <component :is="renderSubtitle" />
+ </div>
+ <button
+ v-if="showClose"
+ class="text-control-light"
+ aria-label="close"
+ @click.prevent="close"
+ >
+ <span class="sr-only">Close</span>
+ <!-- Heroicons name: x -->
+ <heroicons-solid:x class="w-6 h-6" />
+ </button>
</div>
- <button
- v-if="showClose"
- class="text-control-light"
- aria-label="close"
- @click.prevent="close"
+ <div
+ class="px-8 pt-2 max-h-screen overflow-auto w-full"
+ :class="containerClass"
>
- <span class="sr-only">Close</span>
- <!-- Heroicons name: x -->
- <heroicons-solid:x class="w-6 h-6" />
- </button>
- </div>
- <div class="modal-container" :class="containerClass">
- <slot />
+ <slot />
+ </div>
</div>
</div>
</teleport>
@@ -34,7 +43,6 @@
<script lang="ts">
import {
- computed,
defineComponent,
h,
inject,
@@ -47,6 +55,7 @@ import {
Ref,
RenderFunction,
} from "vue";
+import { zindexable } from "vdirs";
import type { VueClass } from "@/utils";
import { useModalStack } from "./BBModalStack.vue";
@@ -61,6 +70,9 @@ const BB_MODAL_CONTEXT = "bb.modal.context";
export default defineComponent({
name: "BBModal",
+ directives: {
+ zindexable,
+ },
props: {
title: {
default: "",
@@ -95,10 +107,6 @@ export default defineComponent({
setup(props, { emit }) {
const { stack, id, index, active } = useModalStack();
- const style = computed(() => ({
- "z-index": 4000 + index.value, // "4000 + " because the container in BBModalStack is z-4000
- }));
-
const overrides = ref<Overrides>({
title: undefined,
subtitle: undefined,
@@ -171,7 +179,6 @@ export default defineComponent({
};
return {
- style,
close,
stack,
id,
@@ -222,20 +229,3 @@ export const useOverrideSubtitle = (
});
};
</script>
-
-<style scoped>
-.bb-modal {
- @apply absolute m-auto w-full max-w-max bg-white shadow-lg rounded-lg pt-4 pb-4 flex pointer-events-auto;
- @apply flex-col;
-
- max-height: calc(100vh - 80px);
-}
-
-.modal-header {
- @apply relative mx-8 pb-2 flex items-center justify-between border-b border-block-border;
-}
-
-.modal-container {
- @apply px-8 pt-2 max-h-screen overflow-auto w-full;
-}
-</style>
diff --git a/frontend/src/bbkit/BBModalStack.vue b/frontend/src/bbkit/BBModalStack.vue
index d41ad1fe73..2ca1c4c84c 100644
--- a/frontend/src/bbkit/BBModalStack.vue
+++ b/frontend/src/bbkit/BBModalStack.vue
@@ -6,7 +6,8 @@
<div
v-show="stack.length > 0"
id="bb-modal-stack"
- class="bb-modal-mask"
+ v-zindexable="{ enabled: true }"
+ class="fixed inset-0 w-full h-screen flex items-center justify-center bg-gray-300/80"
:data-bb-modal-stack="stack.join('|')"
/>
</teleport>
@@ -23,6 +24,7 @@ import {
Ref,
ref,
} from "vue";
+import { zindexable } from "vdirs";
export type ModalStackContext = {
stack: Ref<number[]>;
@@ -57,6 +59,9 @@ export function useModalStackStatus() {
export default defineComponent({
name: "BBModalStack",
+ directives: {
+ zindexable,
+ },
setup() {
const stack = ref<number[]>([]);
@@ -71,10 +76,3 @@ export default defineComponent({
},
});
</script>
-
-<style scope>
-.bb-modal-mask {
- @apply fixed inset-0 w-full h-screen flex items-center justify-center z-[4000];
- background-color: rgba(209, 213, 219, 0.8); /* bg-gray-300 */
-}
-</style>
diff --git a/frontend/src/components/CustomApproval/Settings/components/common/ExprEditor/factor.ts b/frontend/src/components/CustomApproval/Settings/components/common/ExprEditor/factor.ts
index 86634dc5e8..c57c0d705a 100644
--- a/frontend/src/components/CustomApproval/Settings/components/common/ExprEditor/factor.ts
+++ b/frontend/src/components/CustomApproval/Settings/components/common/ExprEditor/factor.ts
@@ -1,6 +1,13 @@
-import { HighLevelFactorList, NumberFactorList } from "@/plugins/cel";
+import { HighLevelFactorList } from "@/plugins/cel";
import { uniq, without } from "lodash-es";
+export const NumberFactorList = [
+ // Risk related factors
+ "affected_rows",
+ "level",
+ "source",
+] as const;
+
export const StringFactorList = [
"environment_id", // using `environment.resource_id`
"project_id", // using `project.resource_id`
diff --git a/frontend/src/plugins/ai/components/AIChatToSQL.vue b/frontend/src/plugins/ai/components/AIChatToSQL.vue
index 11d86f4afd..85199ec722 100644
--- a/frontend/src/plugins/ai/components/AIChatToSQL.vue
+++ b/frontend/src/plugins/ai/components/AIChatToSQL.vue
@@ -51,7 +51,7 @@ const openAIEndpoint = computed(
const tab = useCurrentTab();
const { instance } = useInstanceV1ByUID(
- computed(() => tab.value.connection.databaseId)
+ computed(() => tab.value.connection.instanceId)
);
const databaseMetadata = useMetadataByDatabaseId(
computed(() => Number(tab.value.connection.databaseId)),
diff --git a/frontend/src/plugins/sql-lsp/client/useLanguageClient.ts b/frontend/src/plugins/sql-lsp/client/useLanguageClient.ts
index eeaacc6efa..60e68eb57c 100644
--- a/frontend/src/plugins/sql-lsp/client/useLanguageClient.ts
+++ b/frontend/src/plugins/sql-lsp/client/useLanguageClient.ts
@@ -135,7 +135,7 @@ const stop = () => {
state.client.then((client) => {
state.pendingCommands.clear();
- client.stop();
+ client.isRunning() && client.stop();
});
};