Tec*_*chi 5 jenkins jenkins-plugins jenkins-groovy
我正在尝试使用Active Choice Reactive Reference Parameter插件在我的参数化 Jenkins 作业中有一个“更新按钮”。它将调用 API 并获取值,但现在我有一个简单的 js,它使用新值更新 html 表中的单元格。我已经在 Jenkins 之外测试了按钮和 javascript,它工作正常。但是当我将它添加到 Jenkins 并单击按钮时,它会启动 Jenkins 作业而不是更新单元格。
使用的示例 Groovy:
upHTML=
'''
<!DOCTYPE html>
function update(){
// Get all the rows of the table
var rows = document.getElementById("tb1").rows;
var r= "0"
var c= "1"
var col = rows[r].cells;
// Target row with the target col (target cell) changed with the new value
col[c].innerHTML = "New Value";
}
</script>
'''
return upHTML
Run Code Online (Sandbox Code Playgroud)
该按钮是可见的,但它会在单击后立即启动 Jenkins 作业。
我敢打赌该按钮与下面的“构建”按钮位于同一表单内,因此当单击它时,它会触发表单提交。如果按钮的类型为空,则认为与提交相同(请参阅: https: //developer.mozilla.org/en-US/docs/Web/HTML/Element/button)。尝试将按钮 HTML 更改为:
<button type="button" class="button" onclick="update()">Update</button>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
347 次 |
| 最近记录: |