Skip to content

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

chore: sort databases (#8983)

Liu Jia45888a0159e
diff --git a/frontend/src/components/Issue/panel/RequestExportPanel/ExportResourceForm/DatabaseResourceSelector.vue b/frontend/src/components/Issue/panel/RequestExportPanel/ExportResourceForm/DatabaseResourceSelector.vue
index 6f30d7473e..069d3121d7 100644
--- a/frontend/src/components/Issue/panel/RequestExportPanel/ExportResourceForm/DatabaseResourceSelector.vue
+++ b/frontend/src/components/Issue/panel/RequestExportPanel/ExportResourceForm/DatabaseResourceSelector.vue
@@ -14,6 +14,7 @@
</template>
<script setup lang="ts">
+import { orderBy } from "lodash-es";
import {
NTransfer,
TransferRenderSourceList,
@@ -101,7 +102,16 @@ onMounted(async () => {
const databaseList = computed(() => {
const project = useProjectV1Store().getProjectByUID(props.projectId);
- const list = databaseStore.databaseListByProject(project.name);
+ const list = orderBy(
+ databaseStore.databaseListByProject(project.name),
+ [
+ (db) => db.effectiveEnvironmentEntity.order,
+ (db) => db.effectiveEnvironmentEntity.title,
+ (db) => db.databaseName,
+ (db) => db.instanceEntity.title,
+ ],
+ ["desc", "asc", "asc", "asc"]
+ );
return props.databaseId
? list.filter((item) => item.uid === props.databaseId)
: list;
@@ -124,6 +134,7 @@ const renderSourceList: TransferRenderSourceList = ({ onCheck, pattern }) => {
virtualScroll: true,
data: sourceTreeOptions.value,
defaultExpandAll: true,
+ blockLine: true,
renderLabel: ({ option }: { option: TreeOption }) => {
return h(Label, {
option: option as DatabaseTreeOption,
@@ -152,6 +163,7 @@ const renderTargetList: TransferRenderSourceList = ({ onCheck }) => {
virtualScroll: true,
defaultExpandAll: true,
data: targetTreeOptions.value,
+ blockLine: true,
renderLabel: ({ option }: { option: TreeOption }) => {
return h(Label, {
option: option as DatabaseTreeOption,
diff --git a/frontend/src/components/Issue/panel/RequestExportPanel/ExportResourceForm/Label.vue b/frontend/src/components/Issue/panel/RequestExportPanel/ExportResourceForm/Label.vue
index c43e44cedc..d74e7190ed 100644
--- a/frontend/src/components/Issue/panel/RequestExportPanel/ExportResourceForm/Label.vue
+++ b/frontend/src/components/Issue/panel/RequestExportPanel/ExportResourceForm/Label.vue
@@ -50,15 +50,15 @@ const environment = computed(() => {
const Prefix = () => {
if (option.value.level === "database") {
return h(DatabaseIcon, {
- class: "w-4 h-auto text-gray-400",
+ class: "w-4 h-auto text-gray-400 shrink-0",
});
} else if (option.value.level === "schema") {
return h(SchemaIcon, {
- class: "w-4 h-auto text-gray-400",
+ class: "w-4 h-auto text-gray-400 shrink-0",
});
} else if (option.value.level === "table") {
return h(TableIcon, {
- class: "w-4 h-auto text-gray-400",
+ class: "w-4 h-auto text-gray-400 shrink-0",
});
}
return null;
diff --git a/frontend/src/components/Issue/panel/RequestQueryPanel/DatabaseResourceForm/DatabaseResourceSelector.vue b/frontend/src/components/Issue/panel/RequestQueryPanel/DatabaseResourceForm/DatabaseResourceSelector.vue
index 41b703d2d6..0c78c7adbf 100644
--- a/frontend/src/components/Issue/panel/RequestQueryPanel/DatabaseResourceForm/DatabaseResourceSelector.vue
+++ b/frontend/src/components/Issue/panel/RequestQueryPanel/DatabaseResourceForm/DatabaseResourceSelector.vue
@@ -14,6 +14,7 @@
</template>
<script setup lang="ts">
+import { orderBy } from "lodash-es";
import {
NTransfer,
TransferRenderSourceList,
@@ -133,7 +134,16 @@ watch(
const databaseList = computed(() => {
const project = useProjectV1Store().getProjectByUID(props.projectId);
- const list = databaseStore.databaseListByProject(project.name);
+ const list = orderBy(
+ databaseStore.databaseListByProject(project.name),
+ [
+ (db) => db.effectiveEnvironmentEntity.order,
+ (db) => db.effectiveEnvironmentEntity.title,
+ (db) => db.databaseName,
+ (db) => db.instanceEntity.title,
+ ],
+ ["desc", "asc", "asc", "asc"]
+ );
return props.databaseId
? list.filter((item) => item.uid === props.databaseId)
: list;
@@ -156,6 +166,7 @@ const renderSourceList: TransferRenderSourceList = ({ onCheck, pattern }) => {
checkOnClick: true,
virtualScroll: true,
data: sourceTreeOptions.value,
+ blockLine: true,
renderLabel: ({ option }: { option: TreeOption }) => {
return h(Label, {
option: option as DatabaseTreeOption,
@@ -185,6 +196,7 @@ const renderTargetList: TransferRenderSourceList = ({ onCheck }) => {
virtualScroll: true,
defaultExpandAll: true,
data: targetTreeOptions.value,
+ blockLine: true,
renderLabel: ({ option }: { option: TreeOption }) => {
return h(Label, {
option: option as DatabaseTreeOption,
diff --git a/frontend/src/components/Issue/panel/RequestQueryPanel/DatabaseResourceForm/Label.vue b/frontend/src/components/Issue/panel/RequestQueryPanel/DatabaseResourceForm/Label.vue
index c43e44cedc..d74e7190ed 100644
--- a/frontend/src/components/Issue/panel/RequestQueryPanel/DatabaseResourceForm/Label.vue
+++ b/frontend/src/components/Issue/panel/RequestQueryPanel/DatabaseResourceForm/Label.vue
@@ -50,15 +50,15 @@ const environment = computed(() => {
const Prefix = () => {
if (option.value.level === "database") {
return h(DatabaseIcon, {
- class: "w-4 h-auto text-gray-400",
+ class: "w-4 h-auto text-gray-400 shrink-0",
});
} else if (option.value.level === "schema") {
return h(SchemaIcon, {
- class: "w-4 h-auto text-gray-400",
+ class: "w-4 h-auto text-gray-400 shrink-0",
});
} else if (option.value.level === "table") {
return h(TableIcon, {
- class: "w-4 h-auto text-gray-400",
+ class: "w-4 h-auto text-gray-400 shrink-0",
});
}
return null;