Skip to content

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

fix: remove title input for draft plans (#16956)

boojackd97e950f3f9a
diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueCreationActionPanel.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueCreationActionPanel.vue
index 83391c58a4..82896ae1dc 100644
--- a/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueCreationActionPanel.vue
+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueCreationActionPanel.vue
@@ -43,23 +43,12 @@
</div>
</div>
- <div class="flex flex-col gap-y-1">
- <div class="text-control">
- {{ $t("common.title") }}
- <span class="text-red-600">*</span>
- </div>
- <NInput
- v-model:value="state.title"
- :placeholder="$t('common.title')"
- />
- </div>
-
<div class="flex flex-col gap-y-1">
<div class="text-control">
{{ $t("common.description") }}
</div>
<NInput
- v-model:value="state.description"
+ v-model:value="description"
type="textarea"
:placeholder="$t('issue.add-some-description')"
:autosize="{
@@ -76,10 +65,10 @@
</div>
<IssueLabelSelector
:disabled="false"
- :selected="state.labels"
+ :selected="labels"
:project="project"
:size="'medium'"
- @update:selected="state.labels = $event"
+ @update:selected="labels = $event"
/>
</div>
@@ -123,7 +112,7 @@
import { create } from "@bufbuild/protobuf";
import { CheckCircleIcon, XCircleIcon, AlertCircleIcon } from "lucide-vue-next";
import { NButton, NInput, NTooltip } from "naive-ui";
-import { computed, nextTick, reactive, ref, watchEffect } from "vue";
+import { computed, nextTick, ref, watchEffect } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import IssueLabelSelector from "@/components/IssueV1/components/IssueLabelSelector.vue";
@@ -132,32 +121,30 @@ import { ErrorList } from "@/components/Plan/components/common";
import { usePlanContext } from "@/components/Plan/logic";
import {
issueServiceClientConnect,
+ planServiceClientConnect,
rolloutServiceClientConnect,
} from "@/grpcweb";
-import {
- PROJECT_V1_ROUTE_ISSUE_DETAIL,
- PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
-} from "@/router/dashboard/projectV1";
+import { PROJECT_V1_ROUTE_ISSUE_DETAIL_V1 } from "@/router/dashboard/projectV1";
import {
useCurrentProjectV1,
useCurrentUserV1,
usePolicyV1Store,
} from "@/store";
-import { CreateIssueRequestSchema } from "@/types/proto-es/v1/issue_service_pb";
import {
- IssueStatus,
- Issue_Type,
- type Issue,
+ CreateIssueRequestSchema,
+ IssueSchema,
} from "@/types/proto-es/v1/issue_service_pb";
+import { IssueStatus, Issue_Type } from "@/types/proto-es/v1/issue_service_pb";
import { PolicyType } from "@/types/proto-es/v1/org_policy_service_pb";
-import { PlanCheckRun_Result_Status } from "@/types/proto-es/v1/plan_service_pb";
+import {
+ PlanCheckRun_Result_Status,
+ UpdatePlanRequestSchema,
+} from "@/types/proto-es/v1/plan_service_pb";
import { CreateRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";
import {
extractProjectResourceName,
hasProjectPermissionV2,
extractIssueUID,
- isDev,
- issueV1Slug,
} from "@/utils";
const props = defineProps<{
@@ -171,23 +158,14 @@ const emit = defineEmits<{
const { t } = useI18n();
const router = useRouter();
const loading = ref(false);
-const state = reactive<Pick<Issue, "title" | "description" | "labels">>({
- title: "",
- description: "",
- labels: [],
-});
+const description = ref("");
+const labels = ref<string[]>([]);
const { project } = useCurrentProjectV1();
const currentUser = useCurrentUserV1();
const policyV1Store = usePolicyV1Store();
const { plan, events } = usePlanContext();
const restrictIssueCreationForSqlReviewPolicy = ref(false);
-// Initialize issue title and description from plan
-watchEffect(() => {
- state.title = plan.value.title;
- state.description = plan.value.description;
-});
-
const title = computed(() => {
return t("plan.ready-for-review");
});
@@ -245,10 +223,6 @@ const confirmErrors = computed(() => {
errors.push(t("common.missing-required-permission"));
}
- if (!state.title.trim()) {
- errors.push("Missing issue title");
- }
-
if (
planCheckSummaryStatus.value === PlanCheckRun_Result_Status.ERROR &&
restrictIssueCreationForSqlReviewPolicy.value
@@ -260,7 +234,7 @@ const confirmErrors = computed(() => {
);
}
- if (project.value.forceIssueLabels && state.labels.length === 0) {
+ if (project.value.forceIssueLabels && labels.value.length === 0) {
errors.push(
t("project.settings.issue-related.labels.force-issue-labels.warning")
);
@@ -310,22 +284,29 @@ const doCreateIssue = async () => {
loading.value = true;
try {
- const issueToCreate = {
- creator: `users/${currentUser.value.email}`,
- title: state.title,
- description: state.description,
- labels: state.labels,
- plan: plan.value.name,
- status: IssueStatus.OPEN,
- type: Issue_Type.DATABASE_CHANGE,
- rollout: "",
- };
const request = create(CreateIssueRequestSchema, {
parent: project.value.name,
- issue: issueToCreate,
+ issue: create(IssueSchema, {
+ creator: `users/${currentUser.value.email}`,
+ labels: labels.value,
+ plan: plan.value.name,
+ status: IssueStatus.OPEN,
+ type: Issue_Type.DATABASE_CHANGE,
+ rollout: "",
+ }),
});
const createdIssue = await issueServiceClientConnect.createIssue(request);
+ await planServiceClientConnect.updatePlan(
+ create(UpdatePlanRequestSchema, {
+ plan: {
+ name: plan.value.name,
+ description: description.value,
+ },
+ updateMask: { paths: ["description"] },
+ })
+ );
+
// Then create the rollout from the plan
const rolloutRequest = create(CreateRolloutRequestSchema, {
parent: project.value.name,
@@ -339,24 +320,13 @@ const doCreateIssue = async () => {
events.emit("status-changed", { eager: true });
nextTick(() => {
- if (isDev()) {
- router.push({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
- params: {
- projectId: extractProjectResourceName(plan.value.name),
- issueId: extractIssueUID(createdIssue.name),
- },
- });
- } else {
- // TODO(steven): remove me please.
- router.push({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(plan.value.name),
- issueSlug: issueV1Slug(createdIssue.name, createdIssue.title),
- },
- });
- }
+ router.push({
+ name: PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
+ params: {
+ projectId: extractProjectResourceName(plan.value.name),
+ issueId: extractIssueUID(createdIssue.name),
+ },
+ });
});
} finally {
loading.value = false;