Skip to content

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

chore: optimize change history table (#12247)

ecmadaodbc7e6237f8e
diff --git a/frontend/src/components/ChangeHistory/ChangeHistoryDetail.vue b/frontend/src/components/ChangeHistory/ChangeHistoryDetail.vue
index c0ff355fa4..89f396fd86 100644
--- a/frontend/src/components/ChangeHistory/ChangeHistoryDetail.vue
+++ b/frontend/src/components/ChangeHistory/ChangeHistoryDetail.vue
@@ -29,15 +29,11 @@
>
<router-link
:to="{
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(changeHistory.issue),
- issueSlug: extractIssueUID(changeHistory.issue),
- },
+ path: `/${changeHistory.issue}`,
}"
class="normal-link"
>
- {{ extractIssueUID(changeHistory.issue) }}
+ #{{ extractIssueUID(changeHistory.issue) }}
</router-link>
</dd>
<dt class="sr-only">{{ $t("common.duration") }}</dt>
@@ -296,7 +292,6 @@ import { BBSpin } from "@/bbkit";
import ChangeHistoryStatusIcon from "@/components/ChangeHistory/ChangeHistoryStatusIcon.vue";
import { DiffEditor, MonacoEditor } from "@/components/MonacoEditor";
import TableDetailDrawer from "@/components/TableDetailDrawer.vue";
-import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import {
pushNotification,
useChangeHistoryStore,
@@ -324,7 +319,6 @@ import {
toClipboard,
getStatementSize,
hasProjectPermissionV2,
- extractProjectResourceName,
} from "@/utils";
interface LocalState {
diff --git a/frontend/src/components/ChangeHistory/ChangeHistoryTable.vue b/frontend/src/components/ChangeHistory/ChangeHistoryTable.vue
index a0cf031769..9e7c6bb9e4 100644
--- a/frontend/src/components/ChangeHistory/ChangeHistoryTable.vue
+++ b/frontend/src/components/ChangeHistory/ChangeHistoryTable.vue
@@ -44,7 +44,6 @@ import { useRouter } from "vue-router";
import { RouterLink } from "vue-router";
import type { BBTableSectionDataSource } from "@/bbkit/types";
import TextOverflowPopover from "@/components/misc/TextOverflowPopover.vue";
-import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import { useUserStore } from "@/store";
import type { ComposedDatabase } from "@/types";
import type { ChangeHistory } from "@/types/proto/v1/database_service";
@@ -59,9 +58,7 @@ import {
changeHistoryLink,
getAffectedTablesOfChangeHistory,
getHistoryChangeType,
- extractProjectResourceName,
humanizeDurationV1,
- isDescendantOf,
getAffectedTableDisplayName,
} from "@/utils";
import HumanizeDate from "../misc/HumanizeDate.vue";
@@ -96,6 +93,13 @@ const columnList = computed(() => {
disabled: (history) => {
return !allowToSelectChangeHistory(history);
},
+ cellProps: () => {
+ return {
+ onClick: (e: MouseEvent) => {
+ e.stopPropagation();
+ },
+ };
+ },
},
{
key: "status",
@@ -151,11 +155,7 @@ const columnList = computed(() => {
return (
<RouterLink
to={{
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(history.issue),
- issueSlug: extractIssueUID(history.issue),
- },
+ path: `/${history.issue}`,
}}
custom={true}
>
@@ -166,7 +166,7 @@ const columnList = computed(() => {
class="normal-link"
onClick={(e: MouseEvent) => e.stopPropagation()}
>
- {uid}
+ #{uid}
</a>
),
}}
@@ -248,9 +248,6 @@ const columnList = computed(() => {
const rowProps = (history: ChangeHistory) => {
return {
onClick: (e: MouseEvent) => {
- if (isDescendantOf(e.target as HTMLElement, ".n-checkbox, a")) {
- return;
- }
if (props.customClick) {
emit("row-click", history.uid);
return;
diff --git a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryChangeItem.vue b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryChangeItem.vue
index 596e81236d..0fab352fd0 100644
--- a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryChangeItem.vue
+++ b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryChangeItem.vue
@@ -21,11 +21,7 @@
<span class="text-sm">{{ changeHistory.version }}</span>
<router-link
:to="{
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(changeHistory.issue),
- issueSlug: extractIssueUID(changeHistory.issue),
- },
+ path: `/${changeHistory.issue}`,
}"
class="normal-link text-sm hover:!no-underline"
target="_blank"
@@ -56,15 +52,10 @@
import { NButton, NTag } from "naive-ui";
import { computed } from "vue";
import { RichDatabaseName } from "@/components/v2";
-import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import { useChangeHistoryStore, useDatabaseV1Store } from "@/store";
import type { Changelist_Change as Change } from "@/types/proto/v1/changelist_service";
import { ChangeHistory } from "@/types/proto/v1/database_service";
-import {
- extractDatabaseResourceName,
- extractIssueUID,
- extractProjectResourceName,
-} from "@/utils";
+import { extractDatabaseResourceName, extractIssueUID } from "@/utils";
import { displaySemanticType } from "./utils";
const props = defineProps<{
diff --git a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryForm.vue b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryForm.vue
index 1bebf26ea4..2cacd030bd 100644
--- a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryForm.vue
+++ b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryForm.vue
@@ -38,7 +38,7 @@
<div class="flex flex-row items-center justify-end gap-x-2">
<SearchBox
v-model:value="state.keyword"
- :placeholder="$t('common.filter-by-name')"
+ :placeholder="$t('changelist.change-source.filter')"
/>
</div>
</div>
@@ -63,20 +63,22 @@ import { NCheckbox, NCheckboxGroup } from "naive-ui";
import { computed, reactive, watch } from "vue";
import { AffectedTableSelect } from "@/components/ChangeHistory";
import { DatabaseSelect, SearchBox } from "@/components/v2";
+import { issueServiceClient } from "@/grpcweb";
import {
useChangeHistoryStore,
useDBSchemaV1Store,
useDatabaseV1Store,
} from "@/store";
import { UNKNOWN_ID } from "@/types";
+import { type ComposedChangeHistory } from "@/types";
import type { AffectedTable } from "@/types/changeHistory";
import { EmptyAffectedTable } from "@/types/changeHistory";
import type { Changelist_Change as Change } from "@/types/proto/v1/changelist_service";
-import type { ChangeHistory } from "@/types/proto/v1/database_service";
import {
ChangeHistory_Status,
ChangeHistory_Type,
} from "@/types/proto/v1/database_service";
+import type { Issue } from "@/types/proto/v1/issue_service";
import {
extractDatabaseResourceName,
extractIssueUID,
@@ -93,12 +95,13 @@ type LocalState = {
isLoading: boolean;
keyword: string;
databaseUID: string | undefined;
- changeHistoryList: ChangeHistory[];
+ changeHistoryList: ComposedChangeHistory[];
affectedTable: AffectedTable;
changeHistoryTypes: ChangeHistory_Type[];
detailChangeHistoryName: string | undefined;
};
+const changeHistoryStore = useChangeHistoryStore();
const { project } = useChangelistDetailContext();
const { changesFromChangeHistory: changes } = useAddChangeContext();
@@ -119,9 +122,8 @@ const database = computed(() => {
});
const filteredChangeHistoryList = computed(() => {
- let list = [...state.changeHistoryList];
const types = state.changeHistoryTypes;
- list = list.filter((changeHistory) => {
+ let list = state.changeHistoryList.filter((changeHistory) => {
const semanticType = semanticChangeHistoryType(changeHistory.type);
return (
types.includes(semanticType) &&
@@ -131,9 +133,12 @@ const filteredChangeHistoryList = computed(() => {
const kw = state.keyword.trim().toLowerCase();
if (kw) {
- list = list.filter((changeHistory) =>
- changeHistory.version.toLowerCase().includes(kw)
- );
+ list = list.filter((changeHistory) => {
+ return (
+ changeHistory.version.toLowerCase().includes(kw) ||
+ changeHistory.issueEntity?.title?.toLowerCase()?.includes(kw)
+ );
+ });
}
const { affectedTable: table } = state;
if (!isEqual(table, EmptyAffectedTable)) {
@@ -153,10 +158,9 @@ const selectedChangeHistoryList = computed<string[]>({
});
},
set(selected) {
- const changeHistories: ChangeHistory[] = [];
+ const changeHistories: ComposedChangeHistory[] = [];
for (let i = 0; i < selected.length; i++) {
const name = selected[i];
- const changeHistoryStore = useChangeHistoryStore();
const changeHistory = changeHistoryStore.getChangeHistoryByName(name);
if (changeHistory) {
changeHistories.push(changeHistory);
@@ -176,6 +180,24 @@ const selectedChangeHistoryList = computed<string[]>({
},
});
+const composeChangeHistory = async (
+ history: ComposedChangeHistory
+): Promise<ComposedChangeHistory> => {
+ let issue: Issue | undefined = history.issueEntity;
+ if (!issue && history.issue) {
+ issue = await issueServiceClient.getIssue(
+ {
+ name: history.issue,
+ },
+ { silent: true }
+ );
+ }
+ return {
+ ...history,
+ issueEntity: issue,
+ };
+};
+
const fetchChangeHistoryList = async () => {
const db = database.value;
if (!db) {
@@ -191,10 +213,13 @@ const fetchChangeHistoryList = async () => {
silent: true,
});
const changeHistoryList =
- await useChangeHistoryStore().getOrFetchChangeHistoryListOfDatabase(name);
+ await changeHistoryStore.getOrFetchChangeHistoryListOfDatabase(name);
+ const composedHistories = await Promise.all(
+ changeHistoryList.map((history) => composeChangeHistory(history))
+ );
// Check if the state is still valid
if (name === database.value?.name) {
- state.changeHistoryList = changeHistoryList;
+ state.changeHistoryList = composedHistories;
}
state.isLoading = false;
};
diff --git a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryTable/ChangeHistoryTable.vue b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryTable/ChangeHistoryTable.vue
index b01013bc68..4e9b835f1b 100644
--- a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryTable/ChangeHistoryTable.vue
+++ b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryTable/ChangeHistoryTable.vue
@@ -1,68 +1,23 @@
<template>
- <BBGrid
- :column-list="columns"
- :ready="!isFetching"
- :data-source="changeHistoryList"
- :show-placeholder="true"
- :custom-header="true"
- class="border"
- @click-row="handleClickRow"
- >
- <template #header>
- <div role="table-row" class="bb-grid-row bb-grid-header-row group">
- <div
- v-for="(column, index) in columns"
- :key="index"
- role="table-cell"
- class="bb-grid-header-cell capitalize whitespace-nowrap"
- :class="[column.class]"
- >
- <template v-if="index === 0">
- <NCheckbox
- v-bind="allSelectionState"
- @update:checked="toggleSelectAll"
- />
- </template>
- <template v-else>{{ column.title }}</template>
- </div>
- </div>
- </template>
- <template #item="{ item: changeHistory }: BBGridRow<ChangeHistory>">
- <div class="bb-grid-cell !pr-4" @click.stop.prevent="tryClickCheckbox">
- <NCheckbox
- :checked="isSelected(changeHistory)"
- @update:checked="toggleSelect(changeHistory, $event)"
- />
- </div>
-
- <div class="bb-grid-cell !pl-0">
- {{ displaySemanticType(changeHistory.type) }}
- </div>
- <div class="bb-grid-cell">
- <!-- eslint-disable-next-line vue/no-v-html -->
- <span class="whitespace-nowrap" v-html="renderVersion(changeHistory)" />
- </div>
- <div class="bb-grid-cell whitespace-nowrap">
- <IssueUID :change-history="changeHistory" />
- </div>
- <div class="bb-grid-cell">
- <Tables :change-history="changeHistory" />
- </div>
- <div class="bb-grid-cell overflow-hidden">
- <SQL :change-history="changeHistory" />
- </div>
- </template>
- </BBGrid>
+ <NDataTable
+ :columns="dataTableColumns"
+ :data="changeHistoryList"
+ :row-key="(history: ComposedChangeHistory) => history.name"
+ :bordered="true"
+ :checked-row-keys="props.selected"
+ :loading="isFetching"
+ :row-props="rowProps"
+ @update:checked-row-keys="handleSelection"
+ />
</template>
-<script setup lang="ts">
+<script setup lang="tsx">
import { escape } from "lodash-es";
-import { NCheckbox } from "naive-ui";
+import type { DataTableColumn, DataTableRowKey } from "naive-ui";
+import { NDataTable } from "naive-ui";
import { computed } from "vue";
import { useI18n } from "vue-i18n";
-import type { BBGridRow, BBGridColumn } from "@/bbkit";
-import { BBGrid } from "@/bbkit";
-import type { ChangeHistory } from "@/types/proto/v1/database_service";
+import { type ComposedChangeHistory } from "@/types";
import { getHighlightHTMLByRegExp } from "@/utils";
import { displaySemanticType } from "../utils";
import IssueUID from "./IssueUID.vue";
@@ -71,82 +26,95 @@ import Tables from "./Tables.vue";
const props = defineProps<{
selected: string[];
- changeHistoryList: ChangeHistory[];
+ changeHistoryList: ComposedChangeHistory[];
isFetching: boolean;
keyword: string;
}>();
const emit = defineEmits<{
(event: "update:selected", selected: string[]): void;
- (event: "click-item", change: ChangeHistory): void;
+ (event: "click-item", change: ComposedChangeHistory): void;
}>();
const { t } = useI18n();
-const columns = computed((): BBGridColumn[] => {
+const dataTableColumns = computed(() => {
return [
- { title: "", width: "auto", class: "!pr-4" },
- { title: t("common.type"), width: "auto", class: "!pl-0" },
- { title: t("common.version"), width: "1fr" },
- { title: t("common.issue"), width: "auto" },
{
+ type: "selection",
+ cellProps: () => {
+ return {
+ onClick: (e: MouseEvent) => {
+ e.stopPropagation();
+ },
+ };
+ },
+ },
+ {
+ key: "type",
+ title: t("common.type"),
+ width: "5rem",
+ render: (changeHistory) => displaySemanticType(changeHistory.type),
+ },
+ {
+ key: "version",
+ title: t("common.version"),
+ width: "20rem",
+ resizable: true,
+ render: (changeHistory) => {
+ return (
+ <span
+ class="whitespace-nowrap"
+ innerHTML={renderVersion(changeHistory)}
+ />
+ );
+ },
+ },
+ {
+ key: "issueId",
+ title: t("common.issue"),
+ resizable: true,
+ render: (changeHistory) => {
+ return (
+ <IssueUID changeHistory={changeHistory} keyword={props.keyword} />
+ );
+ },
+ },
+ {
+ key: "tables",
title: t("changelist.change-source.change-history.tables"),
width: "minmax(auto, 1fr)",
+ resizable: true,
+ render: (changeHistory) => {
+ return <Tables changeHistory={changeHistory} />;
+ },
},
{
+ key: "sql",
title: t("common.sql"),
width: "3fr",
+ resizable: true,
+ render: (changeHistory) => {
+ return <SQL changeHistory={changeHistory} />;
+ },
},
- ];
+ ] as DataTableColumn<ComposedChangeHistory>[];
});
-const allSelectionState = computed(() => {
- const { changeHistoryList: list, selected } = props;
- const set = new Set(selected);
-
- const checked =
- selected.length > 0 &&
- list.every((changeHistory) => set.has(changeHistory.name));
- const indeterminate = !checked && selected.some((name) => set.has(name));
+const handleSelection = (rowKeys: DataTableRowKey[]) => {
+ const keys = rowKeys as string[];
+ emit("update:selected", Array.from(keys));
+};
+const rowProps = (history: ComposedChangeHistory) => {
return {
- checked,
- indeterminate,
+ onClick: (e: MouseEvent) => {
+ emit("click-item", history);
+ },
};
-});
-
-const toggleSelectAll = (on: boolean) => {
- if (on) {
- emit(
- "update:selected",
- props.changeHistoryList.map((changeHistory) => changeHistory.name)
- );
- } else {
- emit("update:selected", []);
- }
-};
-
-const isSelected = (changeHistory: ChangeHistory) => {
- return props.selected.includes(changeHistory.name);
-};
-
-const toggleSelect = (changeHistory: ChangeHistory, on: boolean) => {
- const set = new Set(props.selected);
- const key = changeHistory.name;
- if (on) {
- if (!set.has(key)) {
- set.add(key);
- emit("update:selected", Array.from(set));
- }
- } else {
- if (set.has(key)) {
- set.delete(key);
- emit("update:selected", Array.from(set));
- }
- }
};
-const renderVersion = (item: ChangeHistory) => {
+const renderVersion = (item: ComposedChangeHistory) => {
const keyword = props.keyword.trim().toLowerCase();
const { version } = item;
@@ -161,16 +129,4 @@ const renderVersion = (item: ChangeHistory) => {
false /* !caseSensitive */
);
};
-
-const handleClickRow = (item: ChangeHistory) => {
- emit("click-item", item);
-};
-
-const tryClickCheckbox = (e: MouseEvent) => {
- const div = e.target as HTMLElement;
- const checkbox = div.querySelector(".n-checkbox");
- if (!checkbox) return;
- const e2 = new MouseEvent("click");
- checkbox.dispatchEvent(e2);
-};
</script>
diff --git a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryTable/IssueUID.vue b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryTable/IssueUID.vue
index f6e5638223..43faf9eb28 100644
--- a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryTable/IssueUID.vue
+++ b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryTable/IssueUID.vue
@@ -1,35 +1,44 @@
<template>
- <router-link
- v-if="project && issueUID"
- :to="{
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: project,
- issueSlug: issueUID,
- },
- }"
- class="normal-link"
- target="_blank"
- @click.stop
- >#{{ issueUID }}</router-link
- >
+ <div v-if="changeHistory.issueEntity" class="flex items-center space-x-1">
+ <router-link
+ :to="{
+ path: `/${changeHistory.issueEntity.name}`,
+ }"
+ class="normal-link"
+ target="_blank"
+ @click.stop
+ >
+ #{{ changeHistory.issueEntity.uid }}
+ </router-link>
+ <!-- eslint-disable-next-line vue/no-v-html -->
+ <span class="textinfo" v-html="issueTitle" />
+ </div>
<span v-else>-</span>
</template>
<script setup lang="ts">
+import { escape } from "lodash-es";
import { computed } from "vue";
-import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
-import type { ChangeHistory } from "@/types/proto/v1/database_service";
-import { extractIssueUID, extractProjectResourceName } from "@/utils";
+import { type ComposedChangeHistory } from "@/types";
+import { getHighlightHTMLByRegExp } from "@/utils";
const props = defineProps<{
- changeHistory: ChangeHistory;
+ changeHistory: ComposedChangeHistory;
+ keyword: string;
}>();
-const project = computed(() => {
- return extractProjectResourceName(props.changeHistory.issue);
-});
-const issueUID = computed(() => {
- return extractIssueUID(props.changeHistory.issue);
+const issueTitle = computed(() => {
+ const keyword = props.keyword.trim().toLowerCase();
+ const title = props.changeHistory.issueEntity?.title ?? "";
+
+ if (!keyword) {
+ return title;
+ }
+
+ return getHighlightHTMLByRegExp(
+ title,
+ escape(keyword),
+ false /* !caseSensitive */
+ );
});
</script>
diff --git a/frontend/src/components/Changelist/ChangelistDetail/ChangeTable/Source.vue b/frontend/src/components/Changelist/ChangelistDetail/ChangeTable/Source.vue
index 54ea626311..87c84d43e8 100644
--- a/frontend/src/components/Changelist/ChangelistDetail/ChangeTable/Source.vue
+++ b/frontend/src/components/Changelist/ChangelistDetail/ChangeTable/Source.vue
@@ -10,11 +10,7 @@
<router-link
v-if="changeHistory"
:to="{
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(changeHistory.issue),
- issueSlug: extractIssueUID(changeHistory.issue),
- },
+ path: `/${changeHistory.issue}`,
}"
class="normal-link text-sm hover:!no-underline"
target="_blank"
@@ -46,14 +42,9 @@
import { asyncComputed } from "@vueuse/core";
import { File, GitBranch, History } from "lucide-vue-next";
import { computed } from "vue";
-import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import { useChangeHistoryStore, useBranchStore } from "@/store";
import type { Changelist_Change as Change } from "@/types/proto/v1/changelist_service";
-import {
- extractIssueUID,
- extractProjectResourceName,
- getChangelistChangeSourceType,
-} from "@/utils";
+import { extractIssueUID, getChangelistChangeSourceType } from "@/utils";
const props = defineProps<{
change: Change;
diff --git a/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepForm.vue b/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepForm.vue
index 5e47a9bd9f..4dd6da1997 100644
--- a/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepForm.vue
+++ b/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepForm.vue
@@ -176,7 +176,6 @@ import {
InstanceSelect,
InstanceV1EngineIcon,
} from "@/components/v2";
-import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import {
experimentalCreateIssueByPlan,
hasFeature,
@@ -198,10 +197,8 @@ import type { Plan_CreateDatabaseConfig } from "@/types/proto/v1/plan_service";
import { Plan, Plan_Spec } from "@/types/proto/v1/plan_service";
import { TenantMode } from "@/types/proto/v1/project_service";
import {
- extractProjectResourceName,
instanceV1HasCollationAndCharacterSet,
instanceV1HasCreateDatabase,
- issueSlug,
} from "@/utils";
interface LocalState {
@@ -407,11 +404,7 @@ const createV1 = async () => {
planCreate
);
router.push({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(project.value.name),
- issueSlug: issueSlug(createdIssue.title, createdIssue.uid),
- },
+ path: `/${createdIssue.name}`,
});
} finally {
state.creating = false;
diff --git a/frontend/src/components/DatabaseDetail/ChangeHistoryBrief.vue b/frontend/src/components/DatabaseDetail/ChangeHistoryBrief.vue
index 58b9dcd6d7..683832f242 100644
--- a/frontend/src/components/DatabaseDetail/ChangeHistoryBrief.vue
+++ b/frontend/src/components/DatabaseDetail/ChangeHistoryBrief.vue
@@ -22,16 +22,12 @@
<div class="flex-1">
<router-link
:to="{
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(changeHistory.issue),
- issueSlug: extractIssueUID(changeHistory.issue),
- },
+ path: `/${changeHistory.issue}`,
}"
target="_blank"
class="normal-link flex items-center gap-x-1"
>
- {{ extractIssueUID(changeHistory.issue) }}
+ #{{ extractIssueUID(changeHistory.issue) }}
</router-link>
</div>
</div>
@@ -88,7 +84,6 @@
import dayjs from "dayjs";
import type { PropType } from "vue";
import { computed } from "vue";
-import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import { useUserStore } from "@/store";
import type { ComposedDatabase } from "@/types";
import type { ChangeHistory } from "@/types/proto/v1/database_service";
@@ -96,7 +91,6 @@ import {
extractUserResourceName,
extractIssueUID,
changeHistoryLink as makeChangeHistoryLink,
- extractProjectResourceName,
} from "@/utils";
const props = defineProps({
diff --git a/frontend/src/components/Issue/panel/RequestExportPanel/index.vue b/frontend/src/components/Issue/panel/RequestExportPanel/index.vue
index e549201de7..a47a36e381 100644
--- a/frontend/src/components/Issue/panel/RequestExportPanel/index.vue
+++ b/frontend/src/components/Issue/panel/RequestExportPanel/index.vue
@@ -99,7 +99,6 @@ import ExpirationSelector from "@/components/ExpirationSelector.vue";
import RequiredStar from "@/components/RequiredStar.vue";
import { ProjectSelect, DrawerContent, Drawer } from "@/components/v2";
import { issueServiceClient } from "@/grpcweb";
-import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import {
useCurrentUserV1,
useDatabaseV1Store,
@@ -111,11 +110,7 @@ import { UNKNOWN_ID, PresetRoleType } from "@/types";
import { Duration } from "@/types/proto/google/protobuf/duration";
import { Expr } from "@/types/proto/google/type/expr";
import { Issue, Issue_Type } from "@/types/proto/v1/issue_service";
-import {
- extractProjectResourceName,
- hasProjectPermissionV2,
- issueSlug,
-} from "@/utils";
+import { hasProjectPermissionV2 } from "@/utils";
import DatabaseResourceForm from "../RequestQueryPanel/DatabaseResourceForm/index.vue";
interface LocalState {
@@ -258,11 +253,7 @@ const doCreateIssue = async () => {
if (props.redirectToIssuePage) {
const route = router.resolve({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(project.name),
- issueSlug: issueSlug(createdIssue.title, createdIssue.uid),
- },
+ path: `/${createdIssue.name}`,
});
window.open(route.href, "_blank");
}
diff --git a/frontend/src/components/Issue/panel/RequestQueryPanel/index.vue b/frontend/src/components/Issue/panel/RequestQueryPanel/index.vue
index cb7f372b65..c4f65d686f 100644
--- a/frontend/src/components/Issue/panel/RequestQueryPanel/index.vue
+++ b/frontend/src/components/Issue/panel/RequestQueryPanel/index.vue
@@ -87,7 +87,6 @@ import ExpirationSelector from "@/components/ExpirationSelector.vue";
import RequiredStar from "@/components/RequiredStar.vue";
import { Drawer, DrawerContent, ProjectSelect } from "@/components/v2";
import { issueServiceClient } from "@/grpcweb";
-import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import {
useCurrentUserV1,
useDatabaseV1Store,
@@ -98,7 +97,6 @@ import { UNKNOWN_ID, PresetRoleType } from "@/types";
import { Duration } from "@/types/proto/google/protobuf/duration";
import { Expr } from "@/types/proto/google/type/expr";
import { Issue, Issue_Type } from "@/types/proto/v1/issue_service";
-import { extractProjectResourceName, issueSlug } from "@/utils";
import DatabaseResourceForm from "./DatabaseResourceForm/index.vue";
interface LocalState {
@@ -214,11 +212,7 @@ const doCreateIssue = async () => {
});
router.push({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(project.name),
- issueSlug: issueSlug(createdIssue.title, createdIssue.uid),
- },
+ path: `/${createdIssue.name}`,
});
};
diff --git a/frontend/src/components/ProjectMember/ProjectMemberRolePanel/RoleDescription.vue b/frontend/src/components/ProjectMember/ProjectMemberRolePanel/RoleDescription.vue
index e54d8aabc2..bdab2739a7 100644
--- a/frontend/src/components/ProjectMember/ProjectMemberRolePanel/RoleDescription.vue
+++ b/frontend/src/components/ProjectMember/ProjectMemberRolePanel/RoleDescription.vue
@@ -15,10 +15,8 @@
import { computed, onMounted, ref } from "vue";
import { useRouter } from "vue-router";
import { issueServiceClient } from "@/grpcweb";
-import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import { pushNotification } from "@/store";
import { UNKNOWN_ID } from "@/types";
-import { extractProjectResourceName, issueSlug } from "@/utils";
type DescriptionType = "TEXT" | "ISSUE";
@@ -52,11 +50,7 @@ const gotoIssuePage = async () => {
}
const route = router.resolve({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(issue.name),
- issueSlug: issueSlug(issue.title, issue.uid),
- },
+ path: `/${issue.name}`,
});
window.open(route.href, "_blank");
};
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 1470a44235..ee2dfdae08 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -3442,7 +3442,8 @@
"change-history": {
"tables": "Tables"
},
- "source": "Source"
+ "source": "Source",
+ "filter": "Filter by issue or version"
},
"confirm-remove-change": "Remove this change?",
"delete-this-changelist": "Delete this changelist",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 2745eb4755..11e226df6a 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -3442,7 +3442,8 @@
"change-history": {
"tables": "Mesas"
},
- "source": "Fuente"
+ "source": "Fuente",
+ "filter": "Filtrar por problema o versión"
},
"confirm-remove-change": "¿Eliminar este cambio?",
"delete-this-changelist": "Eliminar esta lista de cambios",
@@ -3529,4 +3530,4 @@
"self": "Última actualización"
}
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 0d24fb9c8f..fdcadcf41c 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -3442,7 +3442,8 @@
"change-history": {
"tables": "表面"
},
- "source": "ソース"
+ "source": "ソース",
+ "filter": "チケットまたはバージョンでフィルタリングする"
},
"confirm-remove-change": "この変更を削除しますか?",
"delete-this-changelist": "この変更リストを削除します",
@@ -3529,4 +3530,4 @@
"self": "最後の更新"
}
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 4d5c7a089a..159c167b26 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -3442,7 +3442,8 @@
"change-history": {
"tables": "表"
},
- "source": "来源"
+ "source": "来源",
+ "filter": "按工单或版本过滤"
},
"confirm-remove-change": "移除这项变更?",
"delete-this-changelist": "删除这个变更列表",
diff --git a/frontend/src/store/modules/v1/changeHistory.ts b/frontend/src/store/modules/v1/changeHistory.ts
index ac95d5b6ca..88dd5fa54f 100644
--- a/frontend/src/store/modules/v1/changeHistory.ts
+++ b/frontend/src/store/modules/v1/changeHistory.ts
@@ -62,6 +62,13 @@ export const useChangeHistoryStore = defineStore("changeHistory_v1", () => {
params: Partial<GetChangeHistoryRequest>
) => {
const changeHistory = await databaseServiceClient.getChangeHistory(params);
+ cache.setEntity(
+ [
+ changeHistory.name,
+ params.view ?? ChangeHistoryView.CHANGE_HISTORY_VIEW_BASIC,
+ ],
+ changeHistory
+ );
return changeHistory;
};
const getOrFetchChangeHistoryByName = async (
diff --git a/frontend/src/types/changeHistory.ts b/frontend/src/types/changeHistory.ts
index 42e4da5a90..17804527f8 100644
--- a/frontend/src/types/changeHistory.ts
+++ b/frontend/src/types/changeHistory.ts
@@ -1,3 +1,6 @@
+import { ChangeHistory } from "@/types/proto/v1/database_service";
+import { Issue } from "@/types/proto/v1/issue_service";
+
export interface AffectedTable {
schema: string;
table: string;
@@ -9,3 +12,7 @@ export const EmptyAffectedTable: AffectedTable = {
table: "",
dropped: false,
};
+
+export interface ComposedChangeHistory extends ChangeHistory {
+ issueEntity?: Issue;
+}
diff --git a/frontend/src/views/ReviewCenter/SQLReviewIssueDataTable/SQLReviewIssueDataTable.vue b/frontend/src/views/ReviewCenter/SQLReviewIssueDataTable/SQLReviewIssueDataTable.vue
index 2a1b456734..13dedd58ca 100644
--- a/frontend/src/views/ReviewCenter/SQLReviewIssueDataTable/SQLReviewIssueDataTable.vue
+++ b/frontend/src/views/ReviewCenter/SQLReviewIssueDataTable/SQLReviewIssueDataTable.vue
@@ -29,15 +29,9 @@ import IssueLabelSelector, {
import IssueStatusIconWithTaskSummary from "@/components/IssueV1/components/IssueStatusIconWithTaskSummary.vue";
import { ProjectNameCell } from "@/components/v2/Model/DatabaseV1Table/cells";
import { emitWindowEvent } from "@/plugins";
-import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import { useSheetV1Store } from "@/store";
import { type ComposedIssue } from "@/types";
-import {
- issueSlug,
- extractProjectResourceName,
- humanizeTs,
- flattenSpecList,
-} from "@/utils";
+import { humanizeTs, flattenSpecList } from "@/utils";
const { t } = useI18n();
@@ -168,11 +162,7 @@ const rowProps = (issue: ComposedIssue) => {
uid: issue.uid,
});
const route = router.resolve({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(issue.project),
- issueSlug: issueSlug(issue.title, issue.uid),
- },
+ path: `/${issue.name}`,
});
const url = route.fullPath;
if (e.ctrlKey || e.metaKey) {