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: update action message for issue status buttons (#12845)
boojack92db3a3aa45a
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/ExtraActionDropdownItem.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/ExtraActionDropdownItem.vueindex 476dfb4b94..46353007a9 100644--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/ExtraActionDropdownItem.vue+++ b/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/ExtraActionDropdownItem.vue@@ -32,14 +32,13 @@ const errors = computed(() => {const errors: string[] = [];const { type, action } = props.option;if (type === "ISSUE") {- if (- !allowUserToApplyIssueStatusAction(- issue.value,- currentUser.value,- action as IssueStatusAction- )- ) {- errors.push("You are not allowed to perform this action");+ const [ok, reason] = allowUserToApplyIssueStatusAction(+ issue.value,+ currentUser.value,+ action as IssueStatusAction+ );+ if (!ok) {+ errors.push(reason);}}return errors;diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/IssueStatusActionButton.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/IssueStatusActionButton.vueindex 78b083db38..deb82a37b0 100644--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/IssueStatusActionButton.vue+++ b/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/IssueStatusActionButton.vue@@ -44,14 +44,13 @@ const currentUser = useCurrentUserV1();const errors = computed(() => {const errors: string[] = [];- if (- !allowUserToApplyIssueStatusAction(- issue.value,- currentUser.value,- props.action- )- ) {- errors.push("You are not allowed to perform this action.");+ const [ok, reason] = allowUserToApplyIssueStatusAction(+ issue.value,+ currentUser.value,+ props.action+ );+ if (!ok) {+ errors.push(reason);}return errors;});diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/IssueStatusActionButtonGroup.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/IssueStatusActionButtonGroup.vueindex 6be24060b5..80a25b5ef3 100644--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/IssueStatusActionButtonGroup.vue+++ b/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/IssueStatusActionButtonGroup.vue@@ -38,10 +38,10 @@</template><script setup lang="ts">-import type { DropdownOption } from "naive-ui";-import { NButton, NDropdown } from "naive-ui";+import { NButton, NDropdown, type DropdownOption } from "naive-ui";import type { VNode } from "vue";import { computed, h } from "vue";+import { useI18n } from "vue-i18n";import { DropdownItemWithErrorList } from "@/components/IssueV1/components/common";import type {IssueStatusAction,@@ -57,30 +57,39 @@ import type { Task } from "@/types/proto/v1/rollout_service";import type { ExtraActionOption } from "../types";import IssueStatusActionButton from "./IssueStatusActionButton.vue";+type IssueActionDropdownOption = ExtraActionOption & {+ description?: string;+};+const props = defineProps<{displayMode: "BUTTON" | "DROPDOWN";issueStatusActionList: IssueStatusAction[];extraActionList: ExtraActionOption[];}>();+const { t } = useI18n();const { issue, events } = useIssueContext();const currentUser = useCurrentUserV1();const issueStatusActionDropdownOptions = computed(() => {- return props.issueStatusActionList.map<ExtraActionOption>((action) => {- return {- key: action,- label: issueStatusActionDisplayName(action),- type: "ISSUE",- action: action,- target: issue.value,- disabled: !allowUserToApplyIssueStatusAction(+ return props.issueStatusActionList.map<IssueActionDropdownOption>(+ (action) => {+ const [ok, reason] = allowUserToApplyIssueStatusAction(issue.value,currentUser.value,action- ),- };- });+ );+ return {+ key: action,+ label: issueStatusActionDisplayName(action),+ type: "ISSUE",+ action: action,+ target: issue.value,+ disabled: !ok,+ description: reason,+ };+ }+ );});const mergedDropdownActionList = computed(() => {@@ -94,8 +103,12 @@ const renderDropdownOption = ({node: VNode;option: DropdownOption;}) => {- const errors = option.disabled- ? ["You are not allowed to perform this action"]+ const { disabled, description } = option as IssueActionDropdownOption;+ const errors = disabled+ ? [+ description ||+ t("issue.error.you-are-not-allowed-to-perform-this-action"),+ ]: [];return h(DropdownItemWithErrorList,diff --git a/frontend/src/components/IssueV1/components/TaskListSection/TaskExtraActionsButton.vue b/frontend/src/components/IssueV1/components/TaskListSection/TaskExtraActionsButton.vueindex 43ef9fcabb..1668fc7c88 100644--- a/frontend/src/components/IssueV1/components/TaskListSection/TaskExtraActionsButton.vue+++ b/frontend/src/components/IssueV1/components/TaskListSection/TaskExtraActionsButton.vue@@ -99,7 +99,7 @@ const renderOption = ({option: DropdownOption;}) => {const errors = option.disabled- ? ["You are not allowed to perform this action"]+ ? [t("issue.error.you-are-not-allowed-to-perform-this-action")]: [];return h(DropdownItemWithErrorList,diff --git a/frontend/src/components/IssueV1/logic/action/issue.ts b/frontend/src/components/IssueV1/logic/action/issue.tsindex 2dbc97fa58..6eb17b4001 100644--- a/frontend/src/components/IssueV1/logic/action/issue.ts+++ b/frontend/src/components/IssueV1/logic/action/issue.ts@@ -6,6 +6,7 @@ import {IssueStatus,Issue_Approver_Status,} from "@/types/proto/v1/issue_service";+import { Task_Status } from "@/types/proto/v1/rollout_service";import {extractUserResourceName,flattenTaskV1List,@@ -47,7 +48,7 @@ export const getApplicableIssueStatusActionList = (const list = PossibleIssueStatusActionMap[issue.status];return list.filter((action) => {if (isGrantRequestIssue(issue) || isDatabaseDataExportIssue(issue)) {- // Don't show RESOLVE or REOPEN for request granting issues.+ // Don't show RESOLVE or REOPEN for grantRequest/dataExport issues.if (action === "RESOLVE" || action === "REOPEN") {return false;}@@ -59,15 +60,6 @@ export const getApplicableIssueStatusActionList = (return false;}}- // For SQL review issues, only allow RESOLVE when the review is approved.- if (!issue.rollout) {- if (- action === "RESOLVE" &&- reviewStatus !== Issue_Approver_Status.APPROVED- ) {- return false;- }- }return true;});};@@ -101,20 +93,25 @@ export const issueStatusActionButtonProps = (};}};+export const allowUserToApplyIssueStatusAction = (issue: ComposedIssue,user: User,action: IssueStatusAction-) => {- // Allowed if the user has issues.update permission in the project- if (hasProjectPermissionV2(issue.projectEntity, user, "bb.issues.update")) {- return true;+): [boolean /** ok */, string /** reason */] => {+ // User does not have permission to update the issue and is not the creator of the issue.+ if (+ !hasProjectPermissionV2(issue.projectEntity, user, "bb.issues.update") &&+ extractUserResourceName(issue.creator) !== user.email+ ) {+ return [false, t("issue.error.you-don-have-privilege-to-edit-this-issue")];}-- // The creator is allowed.- if (extractUserResourceName(issue.creator) === user.email) {- return true;+ if (action === "CLOSE") {+ const tasks = flattenTaskV1List(issue.rolloutEntity);+ // The issue cannot be closed if some tasks are running.+ if (tasks.some((task) => task.status === Task_Status.RUNNING)) {+ return [false, t("issue.error.cannot-close-issue-with-running-tasks")];+ }}-- return false;+ return [true, ""];};diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex e639642347..330f234ded 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -1221,7 +1221,8 @@"error": {"issue-is-not-open": "The issue is not open","you-don-have-privilege-to-edit-this-issue": "You don't have privilege to edit this issue",- "you-are-not-allowed-to-perform-this-action": "You are not allowed to perform this action"+ "you-are-not-allowed-to-perform-this-action": "You are not allowed to perform this action",+ "cannot-close-issue-with-running-tasks": "Cannot close issue with running tasks"},"approval-requested": "Approval Requested","unfinished-resolved-issue-tips": "This issue is marked as \"Done\" but some of its tasks are not executed successfully.",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 0470015bf4..d7ad76cca7 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -1221,7 +1221,8 @@"error": {"issue-is-not-open": "El tema no está abierto.","you-don-have-privilege-to-edit-this-issue": "No tienes privilegios para editar este número.",- "you-are-not-allowed-to-perform-this-action": "No tienes permiso para realizar esta acción."+ "you-are-not-allowed-to-perform-this-action": "No tienes permiso para realizar esta acción.",+ "cannot-close-issue-with-running-tasks": "No se puede cerrar el problema con las tareas en ejecución"},"approval-requested": "Aprobación solicitada","unfinished-resolved-issue-tips": "Este problema está marcado como \"Listo\", pero algunas de sus tareas no se ejecutan correctamente.",@@ -3630,4 +3631,4 @@"self": "Última actualización"}}-}+}\ No newline at end of filediff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 5e343eebff..a3c266b32a 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -1221,7 +1221,8 @@"error": {"issue-is-not-open": "作業指示はオープンされていません","you-don-have-privilege-to-edit-this-issue": "このチケットを編集する権限がありません",- "you-are-not-allowed-to-perform-this-action": "このアクションを実行する権限がありません"+ "you-are-not-allowed-to-perform-this-action": "このアクションを実行する権限がありません",+ "cannot-close-issue-with-running-tasks": "実行中のタスクに関する問題を解決できません"},"approval-requested": "承認リクエスト","unfinished-resolved-issue-tips": "作業指示書は「完了」とマークされましたが、一部のタスクは正常に実行されませんでした。",@@ -3630,4 +3631,4 @@"self": "最後の更新"}}-}+}\ No newline at end of filediff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 7ed2aa6f84..525bafdf31 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -1221,7 +1221,8 @@"error": {"issue-is-not-open": "工单不是开启状态","you-don-have-privilege-to-edit-this-issue": "您没有权限编辑此工单",- "you-are-not-allowed-to-perform-this-action": "您无权执行此操作"+ "you-are-not-allowed-to-perform-this-action": "您无权执行此操作",+ "cannot-close-issue-with-running-tasks": "无法关闭还存在运行中任务的工单"},"approval-requested": "审批请求","unfinished-resolved-issue-tips": "该工单被标记为「已完成」,但其中某些任务并未成功执行。",@@ -3630,4 +3631,4 @@"self": "最后更新"}}-}\ No newline at end of file+}