Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(backend): pipeline todo终止取消单据终止 #8404 #8405

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from django.utils.translation import ugettext as _

from backend.flow.engine.bamboo.scene.common.builder import Builder
from backend.flow.plugins.components.collections.common.pause import PauseComponent
from backend.flow.plugins.components.collections.mysql.fake_semantic_check import FakeSemanticCheckComponent

logger = logging.getLogger("flow")
Expand Down Expand Up @@ -46,17 +47,17 @@ def fake_semantic_check(self):
parallel_acts = [
{
"act_name": _("并行1"),
"act_component_code": FakeSemanticCheckComponent.code,
"act_component_code": PauseComponent.code,
"kwargs": {"parallel_acts": "1"},
},
{
"act_name": _("并行2"),
"act_component_code": FakeSemanticCheckComponent.code,
"act_component_code": PauseComponent.code,
"kwargs": {"parallel_acts": "2"},
},
{
"act_name": _("错误并行3"),
"act_component_code": FakeSemanticCheckComponent.code,
"act_component_code": PauseComponent.code,
"kwargs": {"is_error": True},
},
]
Expand Down
1 change: 0 additions & 1 deletion dbm-ui/backend/ticket/todos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ class ActionType(str, StructuredEnum):

APPROVE = EnumField("APPROVE", _("确认执行"))
TERMINATE = EnumField("TERMINATE", _("终止单据"))
RESOURCE_REAPPLY = EnumField("RESOURCE_REAPPLY", _("资源重新申请"))


@dataclass
Expand Down
4 changes: 2 additions & 2 deletions dbm-ui/backend/ticket/todos/pipeline_todo.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from backend.constants import DEFAULT_SYSTEM_USER
from backend.flow.engine.bamboo.engine import BambooEngine
from backend.ticket import todos
from backend.ticket.constants import TodoType
from backend.ticket.constants import TodoStatus, TodoType
from backend.ticket.exceptions import TodoWrongOperatorException
from backend.ticket.models import TodoHistory
from backend.ticket.todos import ActionType, BaseTodoContext
Expand Down Expand Up @@ -44,7 +44,7 @@ def process(self, username, action, params):
engine = BambooEngine(root_id=root_id)

if action == ActionType.TERMINATE:
self.todo.set_terminated(username, action)
self.todo.set_status(username, TodoStatus.DONE_FAILED)
# 终止时,直接将流程设置为失败
engine.force_fail_pipeline(node_id)
return
Expand Down
Loading