Skip to content

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

feat: add user profile link (#6457)

Liu Ji2f80d0c62649
diff --git a/frontend/src/components/AuditLog/AuditLogTable.vue b/frontend/src/components/AuditLog/AuditLogTable.vue
index f0e461030e..2addd1f0fd 100644
--- a/frontend/src/components/AuditLog/AuditLogTable.vue
+++ b/frontend/src/components/AuditLog/AuditLogTable.vue
@@ -6,7 +6,7 @@
:show-header="true"
:row-clickable="false"
>
- <template #body="{ rowData: auditLog }">
+ <template #body="{ rowData: auditLog }: { rowData: AuditLog }">
<BBTableCell :left-padding="4" class="table-cell w-56">
<div>
{{ dayjs.unix(auditLog.createdTs).format("YYYY-MM-DD HH:mm:ss Z") }}
@@ -26,7 +26,7 @@
}}
</BBTableCell>
<BBTableCell class="table-cell w-20">
- {{ auditLog.creator }}
+ <UserByEmail :email="auditLog.creator" :plain="true" />
</BBTableCell>
<BBTableCell class="table-cell w-36">
<div v-if="auditLog.comment">
@@ -69,6 +69,7 @@ import {
AuditActivityType,
AuditActivityLevel,
} from "@/types";
+import { UserByEmail } from "../v2";
defineProps({
auditLogList: {
diff --git a/frontend/src/components/v2/Model/User/UserByEmail.vue b/frontend/src/components/v2/Model/User/UserByEmail.vue
new file mode 100644
index 0000000000..849eb5c2ad
--- /dev/null
+++ b/frontend/src/components/v2/Model/User/UserByEmail.vue
@@ -0,0 +1,50 @@
+<template>
+ <component
+ :is="link ? 'router-link' : tag"
+ v-bind="bindings"
+ :class="link && !plain && 'normal-link'"
+ >
+ {{ email }}
+ </component>
+</template>
+
+<script setup lang="ts">
+import { computed } from "vue";
+import { useUserStore } from "@/store";
+import { extractUserUID } from "@/utils";
+
+const props = withDefaults(
+ defineProps<{
+ email: string;
+ tag?: string;
+ link?: boolean;
+ plain?: boolean;
+ }>(),
+ {
+ tag: "span",
+ link: true,
+ plain: false,
+ }
+);
+
+const store = useUserStore();
+
+const user = computed(() => {
+ return store.getUserByEmail(props.email);
+});
+
+const bindings = computed(() => {
+ if (props.link) {
+ const to = user.value ? `/u/${extractUserUID(user.value.name)}` : "/404";
+ return {
+ to,
+ activeClass: "",
+ exactActiveClass: "",
+ onClick: (e: MouseEvent) => {
+ e.stopPropagation();
+ },
+ };
+ }
+ return {};
+});
+</script>
diff --git a/frontend/src/components/v2/Model/User/index.ts b/frontend/src/components/v2/Model/User/index.ts
new file mode 100644
index 0000000000..540fdc5933
--- /dev/null
+++ b/frontend/src/components/v2/Model/User/index.ts
@@ -0,0 +1,3 @@
+import UserByEmail from "./UserByEmail.vue";
+
+export { UserByEmail };
diff --git a/frontend/src/components/v2/Model/index.ts b/frontend/src/components/v2/Model/index.ts
index bbd58984bf..8de47dace7 100644
--- a/frontend/src/components/v2/Model/index.ts
+++ b/frontend/src/components/v2/Model/index.ts
@@ -11,6 +11,7 @@ import ProjectV1Table from "./ProjectV1Table.vue";
import DatabaseView from "./DatabaseView.vue";
export * from "./Instance";
+export * from "./User";
export {
DatabaseName,
DatabaseV1Name,