Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: update column select (#9755)
ecmadao050af5866ca8
diff --git a/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/components/DataTypeCell.vue b/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/components/DataTypeCell.vueindex d277c2dcaf..df465c4996 100644--- a/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/components/DataTypeCell.vue+++ b/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/components/DataTypeCell.vue@@ -3,7 +3,8 @@:value="column.type || null":allow-input-value="allowInputValue":options="columnTypeOptions"- :consistent-menu-width="false"+ :consistent-menu-width="true"+ :allow-filter="allowFilter":style="style"suffix-style="right: 3px"placeholder="column type"@@ -16,7 +17,7 @@<script lang="ts" setup>import { SelectOption } from "naive-ui";-import { CSSProperties, computed, ref } from "vue";+import { CSSProperties, computed, ref, onMounted } from "vue";import { DropdownInput } from "@/components/v2";import { Engine } from "@/types/proto/v1/common";import { ColumnMetadata } from "@/types/proto/v1/database_service";@@ -33,6 +34,13 @@ defineEmits<{}>();const focused = ref(false);+const originalType = ref("");++onMounted(() => (originalType.value = props.column.type));++const allowFilter = computed(() => {+ return !props.column.type || originalType.value !== props.column.type;+});const allowInputValue = computed(() => {return props.schemaTemplateColumnTypes.length === 0;diff --git a/frontend/src/components/SchemaEditorV1/Panels/TableColumnEditor/components/DataTypeCell.vue b/frontend/src/components/SchemaEditorV1/Panels/TableColumnEditor/components/DataTypeCell.vueindex a064a499a9..0f166672de 100644--- a/frontend/src/components/SchemaEditorV1/Panels/TableColumnEditor/components/DataTypeCell.vue+++ b/frontend/src/components/SchemaEditorV1/Panels/TableColumnEditor/components/DataTypeCell.vue@@ -3,7 +3,8 @@:value="column.type || null":allow-input-value="allowInputValue":options="columnTypeOptions"- :consistent-menu-width="false"+ :consistent-menu-width="true"+ :allow-filter="allowFilter":style="style"suffix-style="right: 3px"placeholder="column type"@@ -16,7 +17,7 @@<script lang="ts" setup>import { SelectOption } from "naive-ui";-import { CSSProperties, computed, ref } from "vue";+import { CSSProperties, computed, ref, onMounted } from "vue";import { DropdownInput } from "@/components/v2";import { Engine } from "@/types/proto/v1/common";import { Column } from "@/types/v1/schemaEditor";@@ -33,6 +34,13 @@ defineEmits<{}>();const focused = ref(false);+const originalType = ref("");++onMounted(() => (originalType.value = props.column.type));++const allowFilter = computed(() => {+ return !props.column.type || originalType.value !== props.column.type;+});const allowInputValue = computed(() => {return props.schemaTemplateColumnTypes.length === 0;diff --git a/frontend/src/components/v2/Form/DropdownInput.vue b/frontend/src/components/v2/Form/DropdownInput.vueindex 761343803e..c3b21100a2 100644--- a/frontend/src/components/v2/Form/DropdownInput.vue+++ b/frontend/src/components/v2/Form/DropdownInput.vue@@ -1,10 +1,12 @@<template><NDropdownv-if="allowInputValue"+ ref="dropdownRef"trigger="click"placement="bottom-start":options="dropdownOptions":width="consistentMenuWidth ? 'trigger' : undefined"+ style="max-height: 20rem; overflow-y: auto; overflow-x: hidden"v-bind="dropdownProps"@select="$emit('update:value', $event as string)">@@ -57,13 +59,14 @@ import {NSelect,SelectOption,} from "naive-ui";-import { computed } from "vue";+import { computed, h, ref } from "vue";import { VueClass, VueStyle } from "@/utils";const props = withDefaults(defineProps<{value?: string | undefined | null;allowInputValue?: boolean;+ allowFilter?: boolean;options: SelectOption[];dropdownProps?: DropdownProps;suffixClass?: VueClass;@@ -73,20 +76,48 @@ const props = withDefaults({value: undefined,allowInputValue: true,+ allowFilter: false,dropdownProps: undefined,suffixClass: undefined,suffixStyle: undefined,consistentMenuWidth: true,});-defineEmits<{+const emit = defineEmits<{(event: "update:value", value: string): void;}>();+const dropdownRef = ref();+const dropdownOptions = computed(() => {- return props.options.map<DropdownOption>((opt) => ({- key: opt.value,- ...opt,- }));+ return props.options+ .map<DropdownOption>((opt) => ({+ key: opt.value,+ ...opt,+ type: "render",+ render: () =>+ h(+ "div",+ {+ class:+ "px-3 py-2 textinfo text-sm hover:bg-gray-100 cursor-pointer",+ },+ opt.value+ ),+ props: {+ onClick: () => {+ emit("update:value", opt.value as string);+ if (dropdownRef.value) {+ dropdownRef.value.doUpdateShow(false);+ }+ },+ },+ }))+ .filter((opt: DropdownOption) => {+ if (!props.value || !props.allowFilter) {+ return true;+ }+ return (opt.key as string).startsWith(props.value);+ });});</script>