Skip to content

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

chore: external link in database group table (#16571)

boojack92bd035ed04f
diff --git a/frontend/src/components/DatabaseAndGroupSelector/DatabaseAndGroupSelector.vue b/frontend/src/components/DatabaseAndGroupSelector/DatabaseAndGroupSelector.vue
index 591f50bf49..26703aab69 100644
--- a/frontend/src/components/DatabaseAndGroupSelector/DatabaseAndGroupSelector.vue
+++ b/frontend/src/components/DatabaseAndGroupSelector/DatabaseAndGroupSelector.vue
@@ -29,6 +29,7 @@
:database-group-list="dbGroupList"
:show-selection="true"
:single-selection="true"
+ :show-external-link="true"
:selected-database-group-names="
databaseSelectState.selectedDatabaseGroup
? [databaseSelectState.selectedDatabaseGroup]
diff --git a/frontend/src/components/DatabaseGroup/DatabaseGroupDataTable.vue b/frontend/src/components/DatabaseGroup/DatabaseGroupDataTable.vue
index cc98051bb7..2ff32fb324 100644
--- a/frontend/src/components/DatabaseGroup/DatabaseGroupDataTable.vue
+++ b/frontend/src/components/DatabaseGroup/DatabaseGroupDataTable.vue
@@ -19,9 +19,13 @@
</template>
<script lang="tsx" setup>
+import { ExternalLinkIcon } from "lucide-vue-next";
import { NDataTable, NEllipsis, type DataTableColumn } from "naive-ui";
import { computed } from "vue";
import { useI18n } from "vue-i18n";
+import { useRouter } from "vue-router";
+import { PROJECT_V1_ROUTE_DATABASE_GROUP_DETAIL } from "@/router/dashboard/projectV1";
+import { getProjectNameAndDatabaseGroupName } from "@/store";
import type { ComposedDatabaseGroup } from "@/types";
type DatabaseGroupDataTableColumn = DataTableColumn<ComposedDatabaseGroup> & {
@@ -33,10 +37,9 @@ const props = withDefaults(
databaseGroupList: ComposedDatabaseGroup[];
bordered?: boolean;
loading?: boolean;
- showProject?: boolean;
customClick?: boolean;
showSelection?: boolean;
- showActions?: boolean;
+ showExternalLink?: boolean;
singleSelection?: boolean;
selectedDatabaseGroupNames?: string[];
}>(),
@@ -56,6 +59,7 @@ const emit = defineEmits<{
}>();
const { t } = useI18n();
+const router = useRouter();
const columnList = computed((): DatabaseGroupDataTableColumn[] => {
const rawColumnList: DatabaseGroupDataTableColumn[] = [
@@ -74,7 +78,9 @@ const columnList = computed((): DatabaseGroupDataTableColumn[] => {
{
key: "title",
title: t("common.name"),
- minWidth: 128,
+ width: 256,
+ ellipsis: true,
+ resizable: true,
render: (data) => {
return (
<div class="space-x-2">
@@ -83,15 +89,6 @@ const columnList = computed((): DatabaseGroupDataTableColumn[] => {
);
},
},
- {
- key: "project",
- title: t("common.project"),
- minWidth: 128,
- hide: !props.showProject,
- render: (data) => {
- return <span>{data.projectEntity.title}</span>;
- },
- },
{
key: "expression",
title: t("database.expression"),
@@ -103,6 +100,36 @@ const columnList = computed((): DatabaseGroupDataTableColumn[] => {
return <NEllipsis>{data.databaseExpr.expression}</NEllipsis>;
},
},
+ {
+ key: "externalLink",
+ title: "",
+ width: 48,
+ hide: !props.showExternalLink,
+ render: (data) => {
+ const openExternalLink = (e: MouseEvent) => {
+ e.stopPropagation();
+ const [projectId, databaseGroupName] =
+ getProjectNameAndDatabaseGroupName(data.name);
+ const url = router.resolve({
+ name: PROJECT_V1_ROUTE_DATABASE_GROUP_DETAIL,
+ params: {
+ projectId,
+ databaseGroupName,
+ },
+ }).fullPath;
+ window.open(url, "_blank");
+ };
+
+ return (
+ <div
+ class="flex items-center justify-end cursor-pointer w-6 h-6 p-1 opacity-60 hover:opacity-100 hover:bg-white hover:shadow rounded"
+ onClick={openExternalLink}
+ >
+ <ExternalLinkIcon class="w-4 h-auto" />
+ </div>
+ );
+ },
+ },
];
return rawColumnList.filter((column) => !column.hide);
diff --git a/frontend/src/views/sql-editor/ConnectionPanel/ConnectionPane/BatchQueryDatabaseGroupSelector.vue b/frontend/src/views/sql-editor/ConnectionPanel/ConnectionPane/BatchQueryDatabaseGroupSelector.vue
index b40b8d3273..abccdf772d 100644
--- a/frontend/src/views/sql-editor/ConnectionPanel/ConnectionPane/BatchQueryDatabaseGroupSelector.vue
+++ b/frontend/src/views/sql-editor/ConnectionPanel/ConnectionPane/BatchQueryDatabaseGroupSelector.vue
@@ -38,6 +38,7 @@
:database-group-list="filteredDbGroupList"
:single-selection="false"
:show-selection="true"
+ :show-external-link="true"
:loading="!ready"
v-model:selected-database-group-names="state.selectedDatabaseGroupNames"
/>