Skip to content

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

chore(frontend): minor updates (#12032)

Liu Jiaf5ebe344480
diff --git a/frontend/src/components/Changelist/ChangelistDashboard/ChangelistDataTable.vue b/frontend/src/components/Changelist/ChangelistDashboard/ChangelistDataTable.vue
index cf3e6223d1..c060e66238 100644
--- a/frontend/src/components/Changelist/ChangelistDashboard/ChangelistDataTable.vue
+++ b/frontend/src/components/Changelist/ChangelistDashboard/ChangelistDataTable.vue
@@ -112,13 +112,13 @@ const rowProps = (changelist: Changelist) => {
return {
style: "cursor: pointer;",
onClick: (e: MouseEvent) => {
- const url = router.resolve({
+ const route = router.resolve({
path: `changelists/${extractChangelistResourceName(changelist.name)}`,
- }).fullPath;
+ });
if (e.ctrlKey || e.metaKey) {
- window.open(url, "_blank");
+ window.open(route.fullPath, "_blank");
} else {
- window.location.href = url;
+ router.push(route);
}
},
};
diff --git a/frontend/src/components/Changelist/ChangelistDashboard/ChangelistTable.vue b/frontend/src/components/Changelist/ChangelistDashboard/ChangelistTable.vue
deleted file mode 100644
index e47ae86a45..0000000000
--- a/frontend/src/components/Changelist/ChangelistDashboard/ChangelistTable.vue
+++ /dev/null
@@ -1,107 +0,0 @@
-<template>
- <BBGrid
- :column-list="columns"
- :ready="!isFetching"
- :data-source="changelists"
- :show-placeholder="true"
- class="border"
- @click-row="handleClickRow"
- >
- <template #item="{ item: changelist }: BBGridRow<Changelist>">
- <!-- eslint-disable-next-line vue/no-v-html -->
- <div class="bb-grid-cell" v-html="renderDescription(changelist)"></div>
- <div v-if="!hideProjectColumn" class="bb-grid-cell">
- {{ projectForChangelist(changelist).title }}
- </div>
- <div class="bb-grid-cell">
- <i18n-t keypath="common.updated-at-by">
- <template #time>
- <HumanizeDate :date="changelist.updateTime" />
- </template>
- <template #user>{{ getUser(changelist.updater)?.title }}</template>
- </i18n-t>
- </div>
- <div class="bb-grid-cell">
- <i18n-t keypath="common.created-at-by">
- <template #time>
- <HumanizeDate :date="changelist.createTime" />
- </template>
- <template #user>{{ getUser(changelist.creator)?.title }}</template>
- </i18n-t>
- </div>
- </template>
- </BBGrid>
-</template>
-
-<script setup lang="ts">
-import { escape } from "lodash-es";
-import { computed } from "vue";
-import { useI18n } from "vue-i18n";
-import { useRouter } from "vue-router";
-import type { BBGridRow, BBGridColumn } from "@/bbkit";
-import { BBGrid } from "@/bbkit";
-import { useUserStore } from "@/store";
-import type { Changelist } from "@/types/proto/v1/changelist_service";
-import {
- extractUserResourceName,
- getHighlightHTMLByRegExp,
- extractChangelistResourceName,
-} from "@/utils";
-import { projectForChangelist } from "../ChangelistDetail/common";
-
-const props = defineProps<{
- changelists: Changelist[];
- isFetching: boolean;
- keyword?: string;
- hideProjectColumn: boolean;
-}>();
-
-const { t } = useI18n();
-const router = useRouter();
-
-const columns = computed((): BBGridColumn[] => {
- return [
- { title: t("changelist.self"), width: "3fr" },
- { title: t("common.project"), width: "1fr", hide: props.hideProjectColumn },
- { title: t("common.updated-at"), width: "minmax(8rem, auto)" },
- { title: t("common.created-at"), width: "minmax(8rem, auto)" },
- ].filter((item) => !item.hide);
-});
-
-const getUser = (name: string) => {
- const email = extractUserResourceName(name);
- return useUserStore().getUserByEmail(email);
-};
-
-const handleClickRow = (
- item: Changelist,
- section: number,
- row: number,
- e: MouseEvent
-) => {
- const url = router.resolve({
- path: `changelists/${extractChangelistResourceName(item.name)}`,
- }).fullPath;
- if (e.ctrlKey || e.metaKey) {
- window.open(url, "_blank");
- } else {
- router.push(url);
- }
-};
-
-const renderDescription = (item: Changelist) => {
- const keyword = (props.keyword ?? "").trim().toLowerCase();
-
- const { description } = item;
-
- if (!keyword) {
- return escape(description);
- }
-
- return getHighlightHTMLByRegExp(
- escape(description),
- escape(keyword),
- false /* !caseSensitive */
- );
-};
-</script>
diff --git a/frontend/src/components/v2/Model/ProjectV1Table.vue b/frontend/src/components/v2/Model/ProjectV1Table.vue
index b2aa37dcad..73e4db5a2a 100644
--- a/frontend/src/components/v2/Model/ProjectV1Table.vue
+++ b/frontend/src/components/v2/Model/ProjectV1Table.vue
@@ -114,7 +114,7 @@ const rowProps = (project: ComposedProject) => {
if (e.ctrlKey || e.metaKey) {
window.open(route.fullPath, "_blank");
} else {
- window.location.href = route.fullPath;
+ router.push(route);
}
emit("row-click");
},