Skip to content

[portal] action 完成后导航策略(onComplete + portal 级默认)(GAP-8 of #1294) #1338

@xuyushun441-sys

Description

@xuyushun441-sys

现象

#1294 spec 的 PortalNavItem 包含 action 类型(点导航直接执行 action,如 Submit),但没声明 action 完成后跳哪

复现

  1. 匿名用户点 "Submit a Ticket" → 填表 → 提交成功
  2. 框架要不要跳详情页?跳成功页?跳 KB?跳"原页面"?
  3. spec 没规定 → 不同 portal 行为不一致

Workaround

模板作者把跳转逻辑硬塞到 action 的 success hook 或 view 的 onAction 里 — 违反「零业务代码」+ 与 portal 主题/路由耦合。

分阶段建议

M2(与 GAP-1/#1331 一起):在两处可声明,由具体到一般覆盖。

action nav item 上

{
  id: 'nav_submit',
  type: 'action',
  actionRef: 'helpdesk_ticket.create',
  onComplete?: {
    goto: { viewRef?: string; actionRef?: string; path?: string; back?: boolean; recordCreated?: boolean };
    toast?: { message: I18nLabel; severity: 'success'|'info' };
  }
}

portal 级默认(fallback)

actionDefaults?: {
  onComplete?: { goto: ... };
};

匿名 route 上(参见 GAP-1/#1331 的 onSuccess):与上面 onComplete 合并为同一字段,保持一致。

验收

  • 模板声明 onComplete.goto.recordCreated: true → 提交后自动跳新工单详情
  • 没声明 → 默认行为:toast "Submitted" + 留在当前页

关联

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions