Skip to content

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

feat(issue): extend ForceIssueLabels to all issue types (#18868)

boojack029020095749
diff --git a/backend/api/v1/issue_service.go b/backend/api/v1/issue_service.go
index b6e020f8ee..22f27758af 100644
--- a/backend/api/v1/issue_service.go
+++ b/backend/api/v1/issue_service.go
@@ -377,7 +377,7 @@ func (s *IssueService) CreateIssue(ctx context.Context, req *connect.Request[v1p
return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to create issue"))
}
- if project.Setting.ForceIssueLabels && len(req.Msg.Issue.Labels) == 0 && issue.Type == storepb.Issue_DATABASE_CHANGE {
+ if project.Setting.ForceIssueLabels && len(req.Msg.Issue.Labels) == 0 {
return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("require issue labels"))
}
diff --git a/frontend/src/components/GrantRequestPanel/GrantRequestPanel.vue b/frontend/src/components/GrantRequestPanel/GrantRequestPanel.vue
index 4c171a4eed..ffcf207ee6 100644
--- a/frontend/src/components/GrantRequestPanel/GrantRequestPanel.vue
+++ b/frontend/src/components/GrantRequestPanel/GrantRequestPanel.vue
@@ -22,6 +22,7 @@
:support-roles="supportRoles"
:database-resources="databaseResources"
/>
+ <IssueLabels :project="project" v-model:value="labels" />
</div>
<template #footer>
<div class="flex items-center justify-end gap-x-2">
@@ -50,6 +51,7 @@ import { NButton } from "naive-ui";
import { computed, ref } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
+import IssueLabels from "@/components/IssueV1/components/Sidebar/IssueLabels.vue";
import AddProjectMemberForm from "@/components/ProjectMember/AddProjectMember/AddProjectMemberForm.vue";
import { Drawer, DrawerContent } from "@/components/v2";
import { issueServiceClientConnect } from "@/connect";
@@ -103,13 +105,20 @@ const binding = computed(() => {
});
const formRef = ref<InstanceType<typeof AddProjectMemberForm>>();
+const labels = ref<string[]>([]);
const project = computed(() =>
projectStore.getProjectByName(props.projectName)
);
const allowCreate = computed(() => {
- return formRef.value?.allowConfirm;
+ if (!formRef.value?.allowConfirm) {
+ return false;
+ }
+ if (project.value.forceIssueLabels && labels.value.length === 0) {
+ return false;
+ }
+ return true;
});
const doCreateIssue = async () => {
@@ -154,6 +163,7 @@ const doCreateIssue = async () => {
description: binding.condition?.description,
type: NewIssue_Type.GRANT_REQUEST,
grantRequest,
+ labels: labels.value,
});
const request = create(CreateIssueRequestSchema, {
diff --git a/frontend/src/components/Plan/logic/useRolloutReadyLink.ts b/frontend/src/components/Plan/logic/useRolloutReadyLink.ts
index 4184fa93f5..a90a27dc3b 100644
--- a/frontend/src/components/Plan/logic/useRolloutReadyLink.ts
+++ b/frontend/src/components/Plan/logic/useRolloutReadyLink.ts
@@ -13,12 +13,6 @@ import {
import { Task_Status, Task_Type } from "@/types/proto-es/v1/rollout_service_pb";
import { usePlanContext } from "./context";
-const ROLLOUT_ROUTES = new Set([
- PROJECT_V1_ROUTE_PLAN_ROLLOUT,
- PROJECT_V1_ROUTE_PLAN_ROLLOUT_STAGE,
- PROJECT_V1_ROUTE_PLAN_ROLLOUT_TASK,
-]);
-
const ACTIONABLE_TASK_STATUSES = new Set([
Task_Status.NOT_STARTED,
Task_Status.PENDING,
@@ -40,6 +34,14 @@ export const useRolloutReadyLink = () => {
const route = useRoute();
const { plan, issue, rollout } = usePlanContext();
+ // Defined inside the function to avoid circular dependency issues
+ // when the module is imported before the router is initialized
+ const ROLLOUT_ROUTES = new Set([
+ PROJECT_V1_ROUTE_PLAN_ROLLOUT,
+ PROJECT_V1_ROUTE_PLAN_ROLLOUT_STAGE,
+ PROJECT_V1_ROUTE_PLAN_ROLLOUT_TASK,
+ ]);
+
const isOnRolloutTab = computed(() => {
return ROLLOUT_ROUTES.has(route.name as string);
});