[Bps-public-commit] rt-extension-travisci branch, master, updated. 2784666d4051c8dd127eb20913e510bd44b44fa6
? sunnavy
sunnavy at bestpractical.com
Wed Aug 26 20:44:07 EDT 2020
The branch, master has been updated
via 2784666d4051c8dd127eb20913e510bd44b44fa6 (commit)
from bfdd2c1d01e5dd90482c9babb5fd95878c8482d7 (commit)
Summary of changes:
html/Callbacks/TravisCI/Elements/RT__Ticket/ColumnMap/Once | 11 +++++++++++
static/js/travisci.js | 14 +++++++++++---
2 files changed, 22 insertions(+), 3 deletions(-)
create mode 100644 html/Callbacks/TravisCI/Elements/RT__Ticket/ColumnMap/Once
- Log -----------------------------------------------------------------
commit 2784666d4051c8dd127eb20913e510bd44b44fa6
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Aug 27 06:09:31 2020 +0800
Add TestStatus column for search results
diff --git a/html/Callbacks/TravisCI/Elements/RT__Ticket/ColumnMap/Once b/html/Callbacks/TravisCI/Elements/RT__Ticket/ColumnMap/Once
new file mode 100644
index 0000000..d0cc61d
--- /dev/null
+++ b/html/Callbacks/TravisCI/Elements/RT__Ticket/ColumnMap/Once
@@ -0,0 +1,11 @@
+<%args>
+$COLUMN_MAP
+</%args>
+<%init>
+$COLUMN_MAP->{TestStatus} = {
+ title => 'Test status',
+ value => sub {
+ return \(qq{<div class="travisci" data-travisci-ticketid="@{[$_[0]->Id]}"></div>});
+ },
+};
+</%init>
diff --git a/static/js/travisci.js b/static/js/travisci.js
index 85b5b70..e74cc58 100644
--- a/static/js/travisci.js
+++ b/static/js/travisci.js
@@ -20,6 +20,10 @@ jQuery(function(){
+ '<div class="form-row"><div class="label col-3">Build ended: </div><div class="value col-9">{{ build_end }}</div></div>'
;
+ var template_short =
+ '<div><a href="{{ title_url }}""><span class="travis-status-{{ last_build_state }}">{{ pretty_build_state }}</span></a></div>'
+ ;
+
var travisci_fetch = function(template) {
var _ = this;
var ticket_id = jQuery(this).attr("data-travisci-ticketid");
@@ -28,7 +32,7 @@ jQuery(function(){
function(data) {
if (data == null) return;
if (!data.success) {
- jQuery(".travisci").html(escapeHTML(data.error));
+ jQuery(_).html(escapeHTML(data.error));
return;
}
data = data.result;
@@ -37,7 +41,7 @@ jQuery(function(){
var pretty_build_state = data.last_build.pretty_build_state;
var build_start = data.last_build.started_at;
var build_end = data.last_build.finished_at;
- jQuery(".travisci").html(template.replace(
+ jQuery(_).html(template.replace(
/{{\s*(.+?)\s*}}/g,
function(m,code){
return escapeHTML(eval(code));
@@ -47,8 +51,12 @@ jQuery(function(){
);
};
- jQuery(".travisci").each(function(){
+ jQuery(".ticket-summary .travisci").each(function(){
travisci_fetch.call(this, template);
});
+ jQuery(".ticket-list .travisci").each(function(){
+ travisci_fetch.call(this, template_short);
+ });
+
});
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list