如何使用 JIRA Issue 更新事件侦听器功能更新 Forge UI Issue Panel?

How to update Forge UI Issue Panel with JIRA Issue update event listener function?

我们在 JIRA 问题视图屏幕上创建了一个问题面板。我们需要呈现的是问题键列表(通过 API 调用获取)。

这就是我们定义 Forge 库的方式 manifest.yml 文件:

modules:
jira:issuePanel:
- key: dylan-hello-world-app-hello-world-panel
function: main
title: Forge App by Dylan
icon: https://developer.atlassian.com/platform/forge/images/icons/issue-panel-icon.svg
trigger:
- key: issue-updated-trigger
events:
- avi:jira:updated:issue
function: issue-trigger-func
function:
- key: main
handler: index.run
- key: issue-trigger-func
handler: index.issueUpdatedTrigger
app:
id: our cloud app id
name: dylan-hello-world-app
permissions:
scopes:
- read:jira-work

我的 运行() 函数执行面板的渲染部分(初始渲染)。

issueUpdateTrigger(event, context) 函数将在问题更新事件发生时被触发。默认情况下,此函数将自动从 JIRA 接收事件和上下文参数。

在 issueUpdateTrigger 中,我们想通过传递上下文来再次调用 API 以检索新问题键列表并更新我们现有面板的上下文。我可以知道我们如何执行相关操作吗?

(我认为必须在索引文件中公开 运行() 和 issueUpdatedTrigger() 函数,因为这是 Forge 读取函数的方式,因此这两个函数可能无法共享一个共同的祖先函数。)

感谢您的帮助,如果需要更多信息请告诉我 :D

根据您的 jira:issuePanel 模块具有 function 键和值,我的回答假设您使用的是 Forge 的 UI 套件而不是自定义 UI。

使用 UI 套件,无法在用户不点击的情况下强制刷新 UI 组件。解决方法是添加一个“刷新”按钮,单击该按钮会刷新组件。

您可以使用自定义 UI 来处理这种情况,但这是一个复杂得多的解决方案,因为您需要负责构建 UI(而不是使用由锻造)。

您还可以在专门针对 Forge 的 Atlassian 开发者社区类别中找到其他反馈和建议:https://community.developer.atlassian.com/c/forge/45