Skip to content

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

fix: reset selected value (#18534)

ecmadao90b54dd70550
diff --git a/frontend/src/components/Plan/components/StatementSection/SchemaEditorDrawer.vue b/frontend/src/components/Plan/components/StatementSection/SchemaEditorDrawer.vue
index bafa20896c..da74e0c18f 100644
--- a/frontend/src/components/Plan/components/StatementSection/SchemaEditorDrawer.vue
+++ b/frontend/src/components/Plan/components/StatementSection/SchemaEditorDrawer.vue
@@ -11,6 +11,7 @@
{{ $t("schema-editor.template-database") }}:
</span>
<NSelect
+ v-model:show="showSelect"
:value="state.selectedDatabaseName"
:options="databaseOptions"
:disabled="state.isPreparingMetadata"
@@ -19,6 +20,7 @@
>
<template #action>
<NButton
+ v-if="DEFAULT_VISIBLE_TARGETS * (state.databaseSelectorPageIndex + 1) < databaseNames.length"
class="w-full!"
quaternary
:loading="state.isLoadingNextPage"
@@ -60,7 +62,7 @@
import { watchDebounced } from "@vueuse/core";
import { cloneDeep } from "lodash-es";
import { NButton, NSelect } from "naive-ui";
-import { computed, reactive, ref, watch } from "vue";
+import { computed, nextTick, reactive, ref, watch } from "vue";
import SchemaEditorLite, {
type EditTarget,
generateDiffDDL,
@@ -95,6 +97,7 @@ const show = computed({
const schemaEditorRef = ref<InstanceType<typeof SchemaEditorLite>>();
const dbSchemaStore = useDBSchemaV1Store();
const databaseStore = useDatabaseV1Store();
+const showSelect = ref(false);
const state = reactive({
isPreparingMetadata: false,
@@ -107,6 +110,7 @@ const state = reactive({
const onNextPage = () => {
state.isLoadingNextPage = true;
state.databaseSelectorPageIndex++;
+ nextTick(() => (showSelect.value = true));
};
watchDebounced(
@@ -119,9 +123,6 @@ watchDebounced(
DEFAULT_VISIBLE_TARGETS * (index + 1)
)
);
- } catch {
- // fallback to previous page.
- state.databaseSelectorPageIndex = Math.max(0, index - 1);
} finally {
state.isLoadingNextPage = false;
}
diff --git a/frontend/src/components/SyncDatabaseSchemaV1/DatabaseSchemaSelector.vue b/frontend/src/components/SyncDatabaseSchemaV1/DatabaseSchemaSelector.vue
index 4d81ef6979..0a4e34068b 100644
--- a/frontend/src/components/SyncDatabaseSchemaV1/DatabaseSchemaSelector.vue
+++ b/frontend/src/components/SyncDatabaseSchemaV1/DatabaseSchemaSelector.vue
@@ -116,7 +116,7 @@ const isPreparingSchemaVersionOptions = ref(false);
const handleEnvironmentSelect = async (name: string | undefined) => {
if (name !== state.environmentName) {
- state.databaseName = undefined;
+ state.databaseName = "";
}
state.environmentName = name;
};
diff --git a/frontend/src/components/TransferDatabaseForm/TransferSourceSelector.vue b/frontend/src/components/TransferDatabaseForm/TransferSourceSelector.vue
index dd4cf874fb..4ba9d09c3d 100644
--- a/frontend/src/components/TransferDatabaseForm/TransferSourceSelector.vue
+++ b/frontend/src/components/TransferDatabaseForm/TransferSourceSelector.vue
@@ -29,7 +29,7 @@
<InstanceSelect
class="w-40!"
:project-name="sourceProjectName"
- :instance="instance?.name"
+ :instance="instance?.name ?? ''"
@update:instance-name="changeInstanceFilter"
/>
<SearchBox
@@ -91,6 +91,7 @@ const changeEnvironmentFilter = (name: string | undefined) => {
"update:environment",
useEnvironmentV1Store().getEnvironmentByName(name)
);
+ emit("update:instance", undefined);
};
const changeInstanceFilter = (name: string | undefined) => {
diff --git a/frontend/src/store/modules/v1/instance.ts b/frontend/src/store/modules/v1/instance.ts
index e36f5c69ca..d9f24089e4 100644
--- a/frontend/src/store/modules/v1/instance.ts
+++ b/frontend/src/store/modules/v1/instance.ts
@@ -9,6 +9,7 @@ import {
isValidEnvironmentName,
isValidInstanceName,
isValidProjectName,
+ unknownEnvironment,
unknownInstance,
} from "@/types";
import { Engine, State } from "@/types/proto-es/v1/common_pb";
@@ -58,7 +59,9 @@ const getListInstanceFilter = (params: InstanceFilter) => {
if (isValidProjectName(params.project)) {
list.push(`project == "${params.project}"`);
}
- if (isValidEnvironmentName(params.environment)) {
+ if (params.environment === unknownEnvironment().name) {
+ list.push(`environment == ""`);
+ } else if (isValidEnvironmentName(params.environment)) {
list.push(`environment == "${params.environment}"`);
}
if (params.host) {