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: move plan description from sidebar for main view (#17239)
boojackd30b7b98a58d
diff --git a/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/ActivitySection.vue b/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/ActivitySection.vueindex 056ef10511..7b8d33318f 100644--- a/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/ActivitySection.vue+++ b/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/ActivitySection.vue@@ -1,5 +1,5 @@<template>- <div class="space-y-3 py-4">+ <div class="space-y-2"><div class="flex items-center justify-between gap-2"><h3 class="text-base font-medium">{{ $t("common.activity") }}diff --git a/frontend/src/components/Plan/components/IssueReviewView/DescriptionSection/DescriptionSection.vue b/frontend/src/components/Plan/components/IssueReviewView/DescriptionSection/DescriptionSection.vuenew file mode 100644index 0000000000..3f7d1ca6d8--- /dev/null+++ b/frontend/src/components/Plan/components/IssueReviewView/DescriptionSection/DescriptionSection.vue@@ -0,0 +1,98 @@+<template>+ <div class="space-y-2">+ <div class="flex items-center justify-between gap-2">+ <h3 class="text-base font-medium">+ {{ $t("common.description") }}+ </h3>+ </div>+ <NInput+ v-model:value="state.description"+ type="textarea"+ :placeholder="$t('issue.add-some-description')"+ :disabled="!allowEdit"+ :autosize="false"+ :resizable="false"+ @blur="onPlanDescriptionUpdate"+ />+ </div>+</template>++<script setup lang="ts">+import { create } from "@bufbuild/protobuf";+import { NInput } from "naive-ui";+import { computed, reactive, watch } from "vue";+import { useI18n } from "vue-i18n";+import { useResourcePoller } from "@/components/Plan/logic/poller";+import { planServiceClientConnect } from "@/grpcweb";+import {+ extractUserId,+ pushNotification,+ useCurrentProjectV1,+ useCurrentUserV1,+} from "@/store";+import {+ PlanSchema,+ UpdatePlanRequestSchema,+} from "@/types/proto-es/v1/plan_service_pb";+import { hasProjectPermissionV2 } from "@/utils";+import { usePlanContextWithIssue } from "../../..";++const { t } = useI18n();+const currentUser = useCurrentUserV1();+const { project } = useCurrentProjectV1();+const { plan, readonly, isCreating } = usePlanContextWithIssue();+const { refreshResources } = useResourcePoller();++const state = reactive({+ description: plan.value.description,+});++// Watch for changes in plan to update the description+watch(+ () => [plan.value],+ () => {+ state.description = plan.value.description;+ },+ { immediate: true }+);++const allowEdit = computed(() => {+ if (readonly.value) {+ return false;+ }+ if (isCreating.value) {+ return true;+ }+ // Allowed if current user is the creator.+ if (extractUserId(plan.value.creator) === currentUser.value.email) {+ return true;+ }+ // Allowed if current user has related permission.+ if (hasProjectPermissionV2(project.value, "bb.plans.update")) {+ return true;+ }+ return false;+});++const onPlanDescriptionUpdate = async () => {+ // Only update if description actually changed+ if (state.description === plan.value.description) {+ return;+ }++ const request = create(UpdatePlanRequestSchema, {+ plan: create(PlanSchema, {+ name: plan.value.name,+ description: state.description,+ }),+ updateMask: { paths: ["description"] },+ });+ await planServiceClientConnect.updatePlan(request);+ refreshResources(["plan"], true /** force */);+ pushNotification({+ module: "bytebase",+ style: "SUCCESS",+ title: t("common.updated"),+ });+};+</script>diff --git a/frontend/src/components/Plan/components/IssueReviewView/DescriptionSection/index.ts b/frontend/src/components/Plan/components/IssueReviewView/DescriptionSection/index.tsnew file mode 100644index 0000000000..ba70462a80--- /dev/null+++ b/frontend/src/components/Plan/components/IssueReviewView/DescriptionSection/index.ts@@ -0,0 +1 @@+export { default as DescriptionSection } from "./DescriptionSection.vue";diff --git a/frontend/src/components/Plan/components/IssueReviewView/IssueReviewView.vue b/frontend/src/components/Plan/components/IssueReviewView/IssueReviewView.vueindex 649b431e80..fca23b75b7 100644--- a/frontend/src/components/Plan/components/IssueReviewView/IssueReviewView.vue+++ b/frontend/src/components/Plan/components/IssueReviewView/IssueReviewView.vue@@ -1,8 +1,11 @@<template><div class="flex-1 flex w-full"><!-- Left Panel - Activity -->- <div class="flex-1 shrink px-4 divide-y">+ <div class="flex-1 shrink px-4 py-4 space-y-4"><OverviewSection v-if="shouldShowOverview" />++ <DescriptionSection />+<ActivitySection /></div>@@ -21,6 +24,7 @@ import { Issue_Type, IssueStatus } from "@/types/proto-es/v1/issue_service_pb";import { hasProjectPermissionV2 } from "@/utils";import { usePlanContextWithIssue } from "../..";import { ActivitySection } from "./ActivitySection";+import { DescriptionSection } from "./DescriptionSection";import OverviewSection from "./OverviewSection.vue";import { Sidebar } from "./Sidebar";@@ -51,7 +55,6 @@ const allowChange = computed(() => {const shouldShowOverview = computed(() => {return issue.value.type === Issue_Type.DATABASE_CHANGE || rollout?.value;});-// TODO(steven): remove ComposedIssue.const composedIssue = computed(() => {const composedIssue = issue.value as ComposedIssue;diff --git a/frontend/src/components/Plan/components/IssueReviewView/OverviewSection.vue b/frontend/src/components/Plan/components/IssueReviewView/OverviewSection.vueindex 7878649bb2..61df4e8938 100644--- a/frontend/src/components/Plan/components/IssueReviewView/OverviewSection.vue+++ b/frontend/src/components/Plan/components/IssueReviewView/OverviewSection.vue@@ -1,5 +1,5 @@<template>- <div class="w-full py-4 overflow-y-auto">+ <div class="w-full overflow-y-auto"><div class="grid grid-cols-[auto_1fr] gap-y-4 gap-x-8"><!-- SQL Checks --><h3 class="text-base text-control">diff --git a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/Sidebar.vue b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/Sidebar.vueindex a1dc63771c..c8bded5088 100644--- a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/Sidebar.vue+++ b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/Sidebar.vue@@ -13,32 +13,16 @@:disabled="!allowChange"@update:value="onIssueLabelsUpdate"/>-- <div class="w-full flex flex-col">- <h3 class="textlabel mb-1">- {{ $t("common.description") }}- </h3>- <NInput- v-model:value="plan.description"- type="textarea"- :placeholder="$t('issue.add-some-description')"- :disabled="!allowChange"- :autosize="false"- :resizable="false"- @blur="onPlanDescriptionUpdate(plan.description)"- />- </div></div></template><script setup lang="ts">import { create } from "@bufbuild/protobuf";-import { NInput } from "naive-ui";import { computed } from "vue";import { useI18n } from "vue-i18n";import IssueLabels from "@/components/IssueV1/components/Sidebar/IssueLabels.vue";import { useResourcePoller } from "@/components/Plan/logic/poller";-import { issueServiceClientConnect, planServiceClientConnect } from "@/grpcweb";+import { issueServiceClientConnect } from "@/grpcweb";import {extractUserId,pushNotification,@@ -49,17 +33,13 @@ import {UpdateIssueRequestSchema,IssueStatus,} from "@/types/proto-es/v1/issue_service_pb";-import {- PlanSchema,- UpdatePlanRequestSchema,-} from "@/types/proto-es/v1/plan_service_pb";import { hasProjectPermissionV2 } from "@/utils";import { usePlanContextWithIssue } from "../../../logic/context";import ApprovalFlowSection from "./ApprovalFlowSection/ApprovalFlowSection.vue";import IssueStatusSection from "./IssueStatusSection.vue";const { t } = useI18n();-const { plan, issue } = usePlanContextWithIssue();+const { issue } = usePlanContextWithIssue();const currentUser = useCurrentUserV1();const { project } = useCurrentProjectV1();const { refreshResources } = useResourcePoller();@@ -94,21 +74,4 @@ const onIssueLabelsUpdate = async (labels: string[]) => {title: t("common.updated"),});};--const onPlanDescriptionUpdate = async (description: string) => {- const request = create(UpdatePlanRequestSchema, {- plan: create(PlanSchema, {- name: plan.value.name,- description,- }),- updateMask: { paths: ["description"] },- });- await planServiceClientConnect.updatePlan(request);- refreshResources(["plan"], true /** force */);- pushNotification({- module: "bytebase",- style: "SUCCESS",- title: t("common.updated"),- });-};</script>