Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Introduce PrincipalAvatar to wrap around BBAvatar so we can customize the apperance globally
天舟1d7195a9d6ba
diff --git a/frontend/src/bbkit/BBAvatar.vue b/frontend/src/bbkit/BBAvatar.vueindex 5cc76e6957..a417f32784 100644--- a/frontend/src/bbkit/BBAvatar.vue+++ b/frontend/src/bbkit/BBAvatar.vue@@ -15,6 +15,7 @@import { computed, PropType } from "vue";import { hashCode } from "./BBUtil";+import { BBAvatarSizeType } from "./types";const BACKGROUND_COLOR_LIST: string[] = ["#64748B",@@ -35,20 +36,18 @@ const BACKGROUND_COLOR_LIST: string[] = ["#F43F5E",];-type SizeType = "small" | "normal" | "large" | "huge";--const sizeClassMap: Map<SizeType, string> = new Map([- ["small", "w-6 h-6 font-medium"],- ["normal", "w-8 h-8 font-medium"],- ["large", "w-24 h-24 font-medium"],- ["huge", "w-36 h-36 font-medium"],+const sizeClassMap: Map<BBAvatarSizeType, string> = new Map([+ ["SMALL", "w-6 h-6 font-medium"],+ ["NORMAL", "w-8 h-8 font-medium"],+ ["LARGE", "w-24 h-24 font-medium"],+ ["HUGE", "w-36 h-36 font-medium"],]);-const fontStyleClassMap: Map<SizeType, string> = new Map([- ["small", "0.675rem"], // customized font size- ["normal", "0.875rem"], // text-sm- ["large", "2.25rem"], // text-4xl- ["huge", "3rem"], // text-5xl+const fontStyleClassMap: Map<BBAvatarSizeType, string> = new Map([+ ["SMALL", "0.675rem"], // customized font size+ ["NORMAL", "0.875rem"], // text-sm+ ["LARGE", "2.25rem"], // text-4xl+ ["HUGE", "3rem"], // text-5xl]);export default {@@ -59,8 +58,8 @@ export default {default: "",},size: {- type: String as PropType<SizeType>,- default: "normal",+ type: String as PropType<BBAvatarSizeType>,+ default: "NORMAL",},rounded: {type: Boolean,diff --git a/frontend/src/bbkit/types.ts b/frontend/src/bbkit/types.tsindex 4a49c1fed4..83e0c8a4e0 100644--- a/frontend/src/bbkit/types.ts+++ b/frontend/src/bbkit/types.ts@@ -62,3 +62,5 @@ export type BBNotificationItem = {};export type BBAlertStyle = "INFO" | "SUCCESS" | "WARN" | "CRITICAL";++export type BBAvatarSizeType = "SMALL" | "NORMAL" | "LARGE" | "HUGE";diff --git a/frontend/src/components/DataSourceMemberTable.vue b/frontend/src/components/DataSourceMemberTable.vueindex 313eb07b6d..608cf63397 100644--- a/frontend/src/components/DataSourceMemberTable.vue+++ b/frontend/src/components/DataSourceMemberTable.vue@@ -41,7 +41,7 @@<template v-slot:body="{ rowData: member }"><BBTableCell :leftPadding="4" class="table-cell"><div class="flex flex-row items-center space-x-2">- <BBAvatar :username="member.principal.name" />+ <PrincipalAvatar :principal="member.principal" /><div class="flex flex-col"><div class="flex flex-row items-center space-x-2"><router-link@@ -112,6 +112,7 @@import { computed, reactive, PropType } from "vue";import { useStore } from "vuex";import DataSourceMemberForm from "../components/DataSourceMemberForm.vue";+import PrincipalAvatar from "../components/PrincipalAvatar.vue";import { DataSource, DataSourceMember } from "../types";const columnList = [@@ -134,7 +135,7 @@ interface LocalState {export default {name: "DataSourceMemberTable",- components: { DataSourceMemberForm },+ components: { DataSourceMemberForm, PrincipalAvatar },props: {dataSource: {required: true,diff --git a/frontend/src/components/IssueTable.vue b/frontend/src/components/IssueTable.vueindex 9994a58816..02f93694af 100644--- a/frontend/src/components/IssueTable.vue+++ b/frontend/src/components/IssueTable.vue@@ -96,7 +96,7 @@<BBTableCell class="hidden sm:table-cell"><div class="flex flex-row items-center"><BBAvatar- :size="'small'"+ :size="'SMALL'":username="issue.assignee ? issue.assignee.name : 'Unassigned'"/><span class="ml-2">{{diff --git a/frontend/src/components/MemberTable.vue b/frontend/src/components/MemberTable.vueindex ede66538a7..5119a8e83a 100644--- a/frontend/src/components/MemberTable.vue+++ b/frontend/src/components/MemberTable.vue@@ -63,7 +63,7 @@</span></template><template v-else>- <BBAvatar :username="memberUI.principal.name" />+ <PrincipalAvatar :principal="memberUI.principal" /><div class="flex flex-col"><div class="flex flex-row items-center space-x-2"><router-link@@ -154,6 +154,7 @@import { computed, reactive, watchEffect } from "vue";import { useStore } from "vuex";import RoleSelect from "../components/RoleSelect.vue";+import PrincipalAvatar from "../components/PrincipalAvatar.vue";import { MemberId, RoleType, MemberPatch, Member } from "../types";import { BBTableColumn, BBTableSectionDataSource } from "../bbkit/types";import { isOwner } from "../utils";@@ -162,7 +163,7 @@ interface LocalState {}export default {name: "MemberTable",- components: { RoleSelect },+ components: { RoleSelect, PrincipalAvatar },props: {},setup(props, ctx) {const store = useStore();diff --git a/frontend/src/components/PrincipalAvatar.vue b/frontend/src/components/PrincipalAvatar.vuenew file mode 100644index 0000000000..7c59e7752b--- /dev/null+++ b/frontend/src/components/PrincipalAvatar.vue@@ -0,0 +1,25 @@+<template>+ <BBAvatar :username="principal.name" :size="size" />+</template>++<script lang="ts">+import { PropType } from "@vue/runtime-core";+import { BBAvatarSizeType } from "../bbkit/types";+import { Principal } from "../types";+export default {+ name: "PrincipalAvatar",+ props: {+ principal: {+ type: Object as PropType<Principal>,+ default: "",+ },+ size: {+ type: String as PropType<BBAvatarSizeType>,+ default: "NORMAL",+ },+ },+ setup(props, ctx) {+ return {};+ },+};+</script>diff --git a/frontend/src/components/PrincipalSelect.vue b/frontend/src/components/PrincipalSelect.vueindex 3119c2968e..25144cc718 100644--- a/frontend/src/components/PrincipalSelect.vue+++ b/frontend/src/components/PrincipalSelect.vue@@ -17,7 +17,7 @@The specific value and breakpoint is to make it align with other select in the issue sidebar.--><span class="flex lg:40 xl:w-44 items-center space-x-2">- <BBAvatar :size="'small'" :username="item.name" />+ <PrincipalAvatar :principal="item" :size="'SMALL'" /><span class="truncate">{{ item.name }}</span></span></template>@@ -39,6 +39,7 @@<script lang="ts">import { reactive, computed, watch, PropType } from "vue";import { useStore } from "vuex";+import PrincipalAvatar from "./PrincipalAvatar.vue";import {Member,Principal,@@ -56,6 +57,7 @@ interface LocalState {export default {name: "PrincipalSelect",emits: ["select-principal-id"],+ components: { PrincipalAvatar },props: {selectedId: {type: Number,diff --git a/frontend/src/components/ProfileDropdown.vue b/frontend/src/components/ProfileDropdown.vueindex 16b1f51531..829d128761 100644--- a/frontend/src/components/ProfileDropdown.vue+++ b/frontend/src/components/ProfileDropdown.vue@@ -9,7 +9,7 @@aria-label="User menu"aria-haspopup="true">- <BBAvatar :username="currentUser.name"> </BBAvatar>+ <PrincipalAvatar :principal="currentUser" /></button><BBContextMenuref="menu"@@ -89,9 +89,11 @@import { computed } from "vue";import { useStore } from "vuex";import { useRouter } from "vue-router";+import PrincipalAvatar from "./PrincipalAvatar.vue";export default {name: "ProfileDropdown",+ components: { PrincipalAvatar },props: {},setup(props, ctx) {const store = useStore();diff --git a/frontend/src/components/ProjectMemberTable.vue b/frontend/src/components/ProjectMemberTable.vueindex 97c80d300c..1c69bae67c 100644--- a/frontend/src/components/ProjectMemberTable.vue+++ b/frontend/src/components/ProjectMemberTable.vue@@ -62,7 +62,7 @@</span></template><template v-else>- <BBAvatar :username="member.principal.name" />+ <PrincipalAvatar :principal="member.principal" /><div class="flex flex-col"><div class="flex flex-row items-center space-x-2"><router-link@@ -133,12 +133,12 @@import { computed, PropType, reactive } from "vue";import { useStore } from "vuex";import ProjectRoleSelect from "../components/ProjectRoleSelect.vue";+import PrincipalAvatar from "../components/PrincipalAvatar.vue";import {Project,ProjectMember,ProjectRoleType,MemberId,- RoleType,ProjectMemberPatch,} from "../types";import { BBTableColumn, BBTableSectionDataSource } from "../bbkit/types";@@ -148,7 +148,7 @@ interface LocalState {}export default {name: "ProjectMemberTable",- components: { ProjectRoleSelect },+ components: { ProjectRoleSelect, PrincipalAvatar },props: {project: {required: true,diff --git a/frontend/src/components/RepositoryTable.vue b/frontend/src/components/RepositoryTable.vueindex 6cccf1f526..6604c8e986 100644--- a/frontend/src/components/RepositoryTable.vue+++ b/frontend/src/components/RepositoryTable.vue@@ -16,7 +16,7 @@</BBTableCell><BBTableCell class="w-16"><div class="flex flex-row items-center">- <BBAvatar :size="'small'" :username="repository.creator.name" />+ <PrincipalAvatar :principal="repository.creator" :size="'SMALL'" /><span class="ml-2">{{ repository.creator.name }}</span></div></BBTableCell>@@ -30,6 +30,7 @@<script lang="ts">import { PropType } from "vue";import { useRouter } from "vue-router";+import PrincipalAvatar from "./PrincipalAvatar.vue";import { BBTableColumn } from "../bbkit/types";import { projectSlug } from "../utils";import { Repository } from "../types";@@ -51,7 +52,7 @@ const columnList: BBTableColumn[] = [export default {name: "RepositoryTable",- components: {},+ components: { PrincipalAvatar },props: {repositoryList: {required: true,diff --git a/frontend/src/components/TaskRunTable.vue b/frontend/src/components/TaskRunTable.vueindex c6b0a5cd93..34eaa29109 100644--- a/frontend/src/components/TaskRunTable.vue+++ b/frontend/src/components/TaskRunTable.vue@@ -78,7 +78,7 @@</BBTableCell><BBTableCell class="table-cell w-12"><div class="flex flex-row items-center space-x-2">- <BBAvatar :username="taskRun.creator.name" :size="'small'" />+ <PrincipalAvatar :principal="taskRun.creator" :size="'SMALL'" /><div class="flex flex-col"><div class="flex flex-row items-center space-x-2"><router-link :to="`/u/${taskRun.creator.id}`"@@ -100,6 +100,7 @@<script lang="ts">import { PropType } from "vue";+import PrincipalAvatar from "./PrincipalAvatar.vue";import { BBTableColumn } from "../bbkit/types";import { TaskRun, TaskRunStatus } from "../types";@@ -123,7 +124,7 @@ const columnList: BBTableColumn[] = [export default {name: "TaskRunTable",- components: {},+ components: { PrincipalAvatar },props: {taskRunList: {required: true,diff --git a/frontend/src/views/Inbox.vue b/frontend/src/views/Inbox.vueindex 937ae69f43..eb858cfc1c 100644--- a/frontend/src/views/Inbox.vue+++ b/frontend/src/views/Inbox.vue@@ -46,7 +46,7 @@@click.prevent="clickMessage(message)"><div class="flex space-x-3">- <BBAvatar :size="'small'" :username="message.creator.name" />+ <PrincipalAvatar :principal="message.creator" :size="'SMALL'" /><div class="flex-1 space-y-1"><div class="flex w-full items-center justify-between space-x-2"><h3@@ -165,6 +165,7 @@<script lang="ts">import { computed, onMounted, reactive, watchEffect } from "vue";import { useStore } from "vuex";+import PrincipalAvatar from "../components/PrincipalAvatar.vue";import {MemberMessagePayload,Message,@@ -192,7 +193,7 @@ interface LocalState {export default {name: "Inbox",- components: {},+ components: { PrincipalAvatar },setup(props, ctx) {const store = useStore();diff --git a/frontend/src/views/IssueActivityPanel.vue b/frontend/src/views/IssueActivityPanel.vueindex 44188e9c84..8bf7b9b46e 100644--- a/frontend/src/views/IssueActivityPanel.vue+++ b/frontend/src/views/IssueActivityPanel.vue@@ -55,11 +55,10 @@justify-center">- <BBAvatar- :username="activity.creator.name"- :size="'small'"- >- </BBAvatar>+ <PrincipalAvatar+ :principal="activity.creator"+ :size="'SMALL'"+ /></div></div></template>@@ -463,7 +462,7 @@<div class="flex"><div class="flex-shrink-0"><div class="relative">- <BBAvatar :username="currentUser.name"> </BBAvatar>+ <PrincipalAvatar :principal="currentUser" /><spanclass="absolute@@ -553,6 +552,7 @@ import {} from "vue";import { useStore } from "vuex";import { useRouter } from "vue-router";+import PrincipalAvatar from "../components/PrincipalAvatar.vue";import {Issue,Activity,@@ -603,7 +603,7 @@ export default {type: Object as PropType<IssueTemplate>,},},- components: {},+ components: { PrincipalAvatar },setup(props, { emit }) {const store = useStore();const router = useRouter();diff --git a/frontend/src/views/IssueSidebar.vue b/frontend/src/views/IssueSidebar.vueindex b60367ea05..259521969a 100644--- a/frontend/src/views/IssueSidebar.vue+++ b/frontend/src/views/IssueSidebar.vue@@ -145,7 +145,7 @@<ul class="col-span-2"><li class="flex justify-start items-center space-x-2"><div class="flex-shrink-0">- <BBAvatar :size="'small'" :username="issue.creator.name" />+ <PrincipalAvatar :principal="issue.creator" :size="'SMALL'" /></div><router-link:to="`/u/${issue.creator.id}`"@@ -186,7 +186,7 @@<div class="flex space-x-1"><template v-for="(subscriber, index) in subscriberList" :key="index"><router-link :to="`/u/${subscriber.id}`" class="hover:opacity-75">- <BBAvatar :size="'small'" :username="subscriber.name" />+ <PrincipalAvatar :principal="subscriber" :size="'SMALL'" /></router-link></template></div>@@ -228,6 +228,7 @@ import isEqual from "lodash-es/isEqual";import DatabaseSelect from "../components/DatabaseSelect.vue";import EnvironmentSelect from "../components/EnvironmentSelect.vue";import ProjectSelect from "../components/ProjectSelect.vue";+import PrincipalAvatar from "../components/PrincipalAvatar.vue";import PrincipalSelect from "../components/PrincipalSelect.vue";import StageSelect from "../components/StageSelect.vue";import IssueStatusIcon from "../components/IssueStatusIcon.vue";@@ -282,6 +283,7 @@ export default {DatabaseSelect,ProjectSelect,EnvironmentSelect,+ PrincipalAvatar,PrincipalSelect,StageSelect,IssueStatusIcon,diff --git a/frontend/src/views/ProfileDashboard.vue b/frontend/src/views/ProfileDashboard.vueindex eab4656d4a..71d69160cd 100644--- a/frontend/src/views/ProfileDashboard.vue+++ b/frontend/src/views/ProfileDashboard.vue@@ -9,7 +9,7 @@<div class="h-32 w-full bg-accent lg:h-48"></div><div class="max-w-5xl mx-auto px-4 sm:px-6 lg:px-8"><div class="-mt-20 sm:flex sm:items-end sm:space-x-5">- <BBAvatar :size="'huge'" :username="principal.name" />+ <PrincipalAvatar :principal="principal" :size="'HUGE'" /><divclass="mt-6@@ -154,6 +154,7 @@<script lang="ts">import { nextTick, computed, onMounted, onUnmounted, reactive, ref } from "vue";import { useStore } from "vuex";+import PrincipalAvatar from "../components/PrincipalAvatar.vue";import cloneDeep from "lodash-es/cloneDeep";import isEqual from "lodash-es/isEqual";import { Principal, PrincipalPatch } from "../types";@@ -170,7 +171,7 @@ export default {type: Number,},},- components: {},+ components: { PrincipalAvatar },setup(props, ctx) {const editNameTextField = ref();