Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: issue activities in review section (#16632)
boojack75a367ee25fa
diff --git a/frontend/src/components/Plan/components/HeaderSection/TitleInput.vue b/frontend/src/components/Plan/components/HeaderSection/TitleInput.vueindex 04bb043e60..d0d8ec21d0 100644--- a/frontend/src/components/Plan/components/HeaderSection/TitleInput.vue+++ b/frontend/src/components/Plan/components/HeaderSection/TitleInput.vue@@ -19,15 +19,16 @@<script setup lang="ts">import { NInput } from "naive-ui";import type { CSSProperties } from "vue";-import { computed, reactive } from "vue";+import { computed, reactive, watch } from "vue";import { useI18n } from "vue-i18n";-import { planServiceClient } from "@/grpcweb";+import { planServiceClient, issueServiceClient } from "@/grpcweb";import {pushNotification,useCurrentUserV1,extractUserId,useCurrentProjectV1,} from "@/store";+import { Issue } from "@/types/proto/v1/issue_service";import { Plan } from "@/types/proto/v1/plan_service";import { hasProjectPermissionV2 } from "@/utils";import { usePlanContext } from "../../logic";@@ -37,14 +38,23 @@ type ViewMode = "EDIT" | "VIEW";const { t } = useI18n();const currentUser = useCurrentUserV1();const { project } = useCurrentProjectV1();-const { isCreating, plan } = usePlanContext();+const { isCreating, plan, issue } = usePlanContext();const state = reactive({isEditing: false,isUpdating: false,- title: plan.value.title,+ title: issue?.value ? issue?.value.title : plan.value.title,});+// Watch for changes in issue/plan to update the title+watch(+ () => [issue?.value, plan.value],+ () => {+ state.title = issue?.value ? issue?.value.title : plan.value.title;+ },+ { immediate: true }+);+const viewMode = computed((): ViewMode => {if (isCreating.value) return "EDIT";return state.isEditing ? "EDIT" : "VIEW";@@ -92,28 +102,58 @@ const onBlur = async () => {cleanup();return;}- if (state.title === plan.value.title) {- cleanup();- return;- }- try {- state.isUpdating = true;- const planPatch = Plan.fromPartial({- ...plan.value,- title: state.title,- });- const updated = await planServiceClient.updatePlan({- plan: planPatch,- updateMask: ["title"],- });- Object.assign(plan.value, updated);- pushNotification({- module: "bytebase",- style: "SUCCESS",- title: t("common.updated"),- });- } finally {- cleanup();++ // Check if we're updating issue or plan+ if (issue?.value) {+ // Update issue title+ if (state.title === issue.value.title) {+ cleanup();+ return;+ }+ try {+ state.isUpdating = true;+ const issuePatch = Issue.fromPartial({+ ...issue.value,+ title: state.title,+ });+ const updated = await issueServiceClient.updateIssue({+ issue: issuePatch,+ updateMask: ["title"],+ });+ Object.assign(issue.value, updated);+ pushNotification({+ module: "bytebase",+ style: "SUCCESS",+ title: t("common.updated"),+ });+ } finally {+ cleanup();+ }+ } else {+ // Update plan title+ if (state.title === plan.value.title) {+ cleanup();+ return;+ }+ try {+ state.isUpdating = true;+ const planPatch = Plan.fromPartial({+ ...plan.value,+ title: state.title,+ });+ const updated = await planServiceClient.updatePlan({+ plan: planPatch,+ updateMask: ["title"],+ });+ Object.assign(plan.value, updated);+ pushNotification({+ module: "bytebase",+ style: "SUCCESS",+ title: t("common.updated"),+ });+ } finally {+ cleanup();+ }}};@@ -126,6 +166,7 @@ const onUpdateValue = (value: string) => {if (!isCreating.value) {return;}+ // When creating, we only update plan titleplan.value.title = value;};</script>diff --git a/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/ActivitySection.vue b/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/ActivitySection.vuenew file mode 100644index 0000000000..bd63ea254e--- /dev/null+++ b/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/ActivitySection.vue@@ -0,0 +1,14 @@+<template>+ <div class="px-4 py-4 space-y-6">+ <div class="flex items-center justify-between">+ <h3 class="text-base font-medium">+ {{ $t("common.activity") }}+ </h3>+ </div>+ <IssueCommentList />+ </div>+</template>++<script setup lang="ts">+import IssueCommentList from "@/components/IssueV1/components/IssueCommentSection/IssueCommentList.vue";+</script>diff --git a/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/index.ts b/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/index.tsnew file mode 100644index 0000000000..70500baac7--- /dev/null+++ b/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/index.ts@@ -0,0 +1 @@+export { default as ActivitySection } from "./ActivitySection.vue";\ No newline at end of filediff --git a/frontend/src/components/Plan/components/IssueReviewView/IssueReviewView.vue b/frontend/src/components/Plan/components/IssueReviewView/IssueReviewView.vueindex b966528c91..1e78c9a2e0 100644--- a/frontend/src/components/Plan/components/IssueReviewView/IssueReviewView.vue+++ b/frontend/src/components/Plan/components/IssueReviewView/IssueReviewView.vue@@ -1,8 +1,8 @@<template><div class="flex-1 flex">- <!-- Left Panel - Activity (placeholder for future implementation) -->+ <!-- Left Panel - Activity --><div class="flex-1">- <!-- This will be implemented later -->+ <ActivitySection /></div><div class="w-80 flex border-l">@@ -12,5 +12,48 @@</template><script setup lang="ts">+import { computed, unref } from "vue";+import { provideIssueContext, useBaseIssueContext } from "@/components/IssueV1";+import { extractUserId, useCurrentProjectV1, useCurrentUserV1 } from "@/store";+import type { ComposedIssue } from "@/types";+import { IssueStatus } from "@/types/proto/v1/issue_service";+import { hasProjectPermissionV2 } from "@/utils";+import { usePlanContextWithIssue } from "../..";+import { ActivitySection } from "./ActivitySection";import { Sidebar } from "./Sidebar";++const { project, ready } = useCurrentProjectV1();+const { issue } = usePlanContextWithIssue();+const currentUser = useCurrentUserV1();++const issueBaseContext = useBaseIssueContext({+ // Always set to false.+ isCreating: computed(() => false),+ ready,+ issue: computed(() => issue.value as ComposedIssue),+});++const allowChange = computed(() => {+ // Disallow changes if the issue is not open.+ if (issue.value.status !== IssueStatus.OPEN) {+ return false;+ }++ // Allow changes if the current user is the creator of the issue or has the necessary permissions.+ return (+ extractUserId(issue.value.creator) === currentUser.value.email ||+ hasProjectPermissionV2(unref(project), "bb.issues.update")+ );+});++provideIssueContext(+ {+ isCreating: computed(() => false),+ ready,+ allowChange,+ issue: computed(() => issue.value as ComposedIssue),+ ...issueBaseContext,+ },+ true /* root */+);</script>diff --git a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/Sidebar.vue b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/Sidebar.vueindex 121016aff4..bb79ceaaa7 100644--- a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/Sidebar.vue+++ b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/Sidebar.vue@@ -10,7 +10,7 @@/><!-- Description Section -->- <div class="flex-1 overflow-hidden">+ <div class="w-full flex flex-col"><h3 class="textlabel mb-1">{{ $t("common.description") }}</h3>@@ -28,6 +28,7 @@</template><script setup lang="ts">+import { isEqual } from "lodash-es";import { NInput } from "naive-ui";import { computed } from "vue";import { useI18n } from "vue-i18n";@@ -63,6 +64,10 @@ const allowChange = computed(() => {});const onIssueLabelsUpdate = async (labels: string[]) => {+ if (isEqual(labels, issue.value.labels)) {+ return; // No change, do nothing.+ }+const issuePatch = Issue.fromPartial({...issue.value,labels,@@ -80,6 +85,10 @@ const onIssueLabelsUpdate = async (labels: string[]) => {};const onIssueDescriptionUpdate = async (description: string) => {+ if (issue.value.description === description) {+ return; // No change, do nothing.+ }+const issuePatch = Issue.fromPartial({...issue.value,description,