【发布时间】:2019-11-28 17:57:52
【问题描述】:
我正在开发一个简单的 JIRA 服务器插件,如果没有设置某个自定义字段,它将防止发生转换。我使用atlas-create-jira-plugin-module 创建了一个新的工作流验证器,并定制了验证功能以满足我的需求。奇怪的是,当我通过工作流编辑器将这个新验证器添加到转换时,它会出现在验证列表中,并且描述错误。它显示了默认条件中的描述,“只有具有解决问题权限的用户才能执行此转换”。
我一直在关注本教程:https://developer.atlassian.com/server/jira/platform/creating-workflow-extensions/ 我也遇到过这个类似的教程:https://www.j-tricks.com/tutorials/workflow-validator
在我的 atlassian-plugin.xml 中,我确保定义了一个“视图”速度资源:
<workflow-validator key="custom-field-is-set-validator" name="Custom Field Is Set Validator" i18n-name-key="custom-field-is-set-validator.name" class="com.ngc.jira.plugins.workflow.CustomFieldIsSetValidatorFactory">
<description key="custom-field-is-set-validator.description">Validation to require that a custom field be given a value.</description>
<validator-class>com.ngc.jira.plugins.workflow.CustomFieldIsSetValidator</validator-class>
<resource type="velocity" name="view" location="templates/validators/custom-field-is-set-validator.vm"/>
<resource type="velocity" name="input-parameters" location="templates/validators/custom-field-is-set-validator-input.vm"/>
<resource type="velocity" name="edit-parameters" location="templates/validators/custom-field-is-set-validator-input.vm"/>
</workflow-validator>
而custom-field-is-set-validator.vm的内容如下:
Only if the custom field <strong>$field</strong> has be set.
作为健全性检查,我创建了一个工作流条件并将我的速度 (vm) 资源应用为它的视图模板。它在此上下文中正确显示!
但是,当我尝试为我的工作流验证器使用相同的速度资源时,管理页面仍将验证器显示为“只有具有解决问题权限的用户才能执行此转换”,而不是使用我的描述。
我错过了什么?谢谢!
Screenshot showing the built-in condition
Screenshot showing my validator that is wrongly appearing as the same condition
【问题讨论】:
标签: jira jira-plugin atlassian-plugin-sdk