Skip to content

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

feat(frontend): changelist improvements (#8642)

Liu Ji1dae729391c6
diff --git a/frontend/src/components/Breadcrumb.vue b/frontend/src/components/Breadcrumb.vue
index 6364551d43..7a5216d934 100644
--- a/frontend/src/components/Breadcrumb.vue
+++ b/frontend/src/components/Breadcrumb.vue
@@ -223,9 +223,16 @@ export default defineComponent({
});
}
if (route.name === "workspace.changelist.detail") {
+ const project = useProjectV1Store().getProjectByName(
+ `projects/${route.params.projectName}`
+ );
+ list.push({
+ name: project.title,
+ path: `/project/${projectV1Slug(project)}`,
+ });
list.push({
name: t("changelist.self"),
- path: `/changelists`,
+ path: `/changelists?project=${project.name}`,
});
}
if (route.name === "workspace.branch.detail") {
diff --git a/frontend/src/views/Changelist/ChangelistDashboard/context.ts b/frontend/src/views/Changelist/ChangelistDashboard/context.ts
index 5326923c0c..6eaac36940 100644
--- a/frontend/src/views/Changelist/ChangelistDashboard/context.ts
+++ b/frontend/src/views/Changelist/ChangelistDashboard/context.ts
@@ -1,5 +1,6 @@
import Emittery from "emittery";
-import { InjectionKey, Ref, inject, provide, ref } from "vue";
+import { InjectionKey, Ref, inject, provide, ref, watch } from "vue";
+import { useRoute, useRouter } from "vue-router";
export type ChangelistDashboardFilter = {
project: string;
@@ -25,6 +26,9 @@ export const useChangelistDashboardContext = () => {
};
export const provideChangelistDashboardContext = () => {
+ const route = useRoute();
+ const router = useRouter();
+
const context: ChangelistDashboardContext = {
filter: ref({
project: "projects/-",
@@ -34,6 +38,40 @@ export const provideChangelistDashboardContext = () => {
events: new Emittery(),
};
+ watch(
+ () => route.query.project as string,
+ (project) => {
+ if (project) {
+ context.filter.value.project = project;
+ } else {
+ context.filter.value.project = "projects/-";
+ }
+ },
+ { immediate: true }
+ );
+
+ watch(
+ () => context.filter.value.project,
+ (project) => {
+ const projectInQuery = (route.query.project as string) ?? "";
+ const projectParam = project === "projects/-" ? "" : project;
+ const query = {
+ ...route.query,
+ project: projectParam,
+ };
+ if (query.project === "") {
+ delete (query as any)["project"];
+ }
+ if (projectInQuery !== projectParam) {
+ router.replace({
+ ...route,
+ query,
+ });
+ }
+ },
+ { immediate: true }
+ );
+
provide(KEY, context);
return context;
diff --git a/frontend/src/views/Changelist/ChangelistDetail/AddChangePanel/AddChangePanel.vue b/frontend/src/views/Changelist/ChangelistDetail/AddChangePanel/AddChangePanel.vue
index 1ff1f03826..e2efa8e8b4 100644
--- a/frontend/src/views/Changelist/ChangelistDetail/AddChangePanel/AddChangePanel.vue
+++ b/frontend/src/views/Changelist/ChangelistDetail/AddChangePanel/AddChangePanel.vue
@@ -6,7 +6,7 @@
>
<DrawerContent
:title="$t('changelist.add-change.self')"
- class="w-[75vw] relative"
+ class="w-[80vw] relative"
style="max-width: calc(100vw - 8rem)"
>
<template #default>
diff --git a/frontend/src/views/Changelist/ChangelistDetail/BranchDetailPanel/BranchDetailPanel.vue b/frontend/src/views/Changelist/ChangelistDetail/BranchDetailPanel/BranchDetailPanel.vue
index 3e89938b06..2cf803bcbd 100644
--- a/frontend/src/views/Changelist/ChangelistDetail/BranchDetailPanel/BranchDetailPanel.vue
+++ b/frontend/src/views/Changelist/ChangelistDetail/BranchDetailPanel/BranchDetailPanel.vue
@@ -2,7 +2,7 @@
<Drawer :show="show" :close-on-esc="true" @close="$emit('close')">
<DrawerContent
:title="title"
- style="width: 60vw; max-width: calc(100vw - 8rem)"
+ style="width: 75vw; max-width: calc(100vw - 8rem)"
>
<SchemaEditorV1
v-if="editorBindings"
diff --git a/frontend/src/views/Changelist/ChangelistDetail/ChangeHistoryDetailPanel/ChangeHistoryDetailPanel.vue b/frontend/src/views/Changelist/ChangelistDetail/ChangeHistoryDetailPanel/ChangeHistoryDetailPanel.vue
index 2d35ff9754..a6d2e0a188 100644
--- a/frontend/src/views/Changelist/ChangelistDetail/ChangeHistoryDetailPanel/ChangeHistoryDetailPanel.vue
+++ b/frontend/src/views/Changelist/ChangelistDetail/ChangeHistoryDetailPanel/ChangeHistoryDetailPanel.vue
@@ -1,7 +1,7 @@
<template>
<Drawer :show="show" :close-on-esc="true" @close="$emit('close')">
<DrawerContent
- style="width: 60vw; max-width: calc(100vw - 8rem)"
+ style="width: 75vw; max-width: calc(100vw - 8rem)"
:title="$t('common.change-history')"
>
<ChangeHistoryDetail v-if="detailBindings" v-bind="detailBindings" />
diff --git a/frontend/src/views/Changelist/ChangelistDetail/ChangeTable/Source.vue b/frontend/src/views/Changelist/ChangelistDetail/ChangeTable/Source.vue
index a54786d8c1..df07b17700 100644
--- a/frontend/src/views/Changelist/ChangelistDetail/ChangeTable/Source.vue
+++ b/frontend/src/views/Changelist/ChangelistDetail/ChangeTable/Source.vue
@@ -1,20 +1,27 @@
<template>
<div>
<template v-if="type === 'CHANGE_HISTORY'">
- <div class="flex items-center">
- <History :size="16" class="mr-1" />
- {{ $t("common.change-history") }}
+ <div class="flex items-center gap-x-1">
+ <History :size="16" />
+ <span>{{ $t("common.change-history") }}</span>
+ <span v-if="changeHistory" class="textinfolabel">
+ {{ changeHistory.version }}
+ </span>
</div>
</template>
<template v-if="type === 'BRANCH'">
- <div class="flex items-center">
- <GitBranch :size="16" class="mr-1" />{{ $t("common.branch") }}
+ <div class="flex items-center gap-x-1">
+ <GitBranch :size="16" />
+ <span>{{ $t("common.branch") }}</span>
+ <span v-if="branch" class="textinfolabel">
+ {{ branch.title }}
+ </span>
</div>
</template>
<template v-if="type === 'RAW_SQL'">
- <div class="flex items-center">
- <File :size="16" class="mr-1" />
- {{ $t("changelist.change-source.raw-sql") }}
+ <div class="flex items-center gap-x-1">
+ <File :size="16" />
+ <span>{{ $t("changelist.change-source.raw-sql") }}</span>
</div>
</template>
</div>
@@ -23,6 +30,7 @@
<script setup lang="ts">
import { File, GitBranch, History } from "lucide-vue-next";
import { computed } from "vue";
+import { useChangeHistoryStore, useSchemaDesignStore } from "@/store";
import { Changelist_Change as Change } from "@/types/proto/v1/changelist_service";
import { getChangelistChangeSourceType } from "@/utils";
@@ -33,4 +41,14 @@ const props = defineProps<{
const type = computed(() => {
return getChangelistChangeSourceType(props.change);
});
+
+const changeHistory = computed(() => {
+ if (type.value !== "CHANGE_HISTORY") return undefined;
+ return useChangeHistoryStore().getChangeHistoryByName(props.change.source);
+});
+
+const branch = computed(() => {
+ if (type.value !== "BRANCH") return undefined;
+ return useSchemaDesignStore().getSchemaDesignByName(props.change.source);
+});
</script>
diff --git a/frontend/src/views/Changelist/ChangelistDetail/RawSQLPanel/RawSQLPanel.vue b/frontend/src/views/Changelist/ChangelistDetail/RawSQLPanel/RawSQLPanel.vue
index 00d60ca5ff..0b1e14e5b3 100644
--- a/frontend/src/views/Changelist/ChangelistDetail/RawSQLPanel/RawSQLPanel.vue
+++ b/frontend/src/views/Changelist/ChangelistDetail/RawSQLPanel/RawSQLPanel.vue
@@ -3,7 +3,7 @@
<DrawerContent
:title="title"
class="relative"
- style="width: 60vw; max-width: calc(100vw - 8rem)"
+ style="width: 75vw; max-width: calc(100vw - 8rem)"
>
<template #default>
<div class="h-full flex flex-col gap-y-4 flex-1 overflow-hidden">