Jira: Switching to info template! No HTML needed yey!
This commit is contained in:
parent
0d73da25b2
commit
9709d66f62
@ -29,34 +29,27 @@ handle query => sub {
|
|||||||
my $ticket_number = $+{ticket_number};
|
my $ticket_number = $+{ticket_number};
|
||||||
my $ticket_id = $ticket_key . '-' . $ticket_number;
|
my $ticket_id = $ticket_key . '-' . $ticket_number;
|
||||||
|
|
||||||
my $html_return = '';
|
my $return_value = {};
|
||||||
|
|
||||||
foreach my $project_key (@all_project_keys) {
|
foreach my $project_key (@all_project_keys) {
|
||||||
my $this_project = $projects->{$project_key};
|
my $this_project = $projects->{$project_key};
|
||||||
if (my $ticket_project = $this_project->{ticket_keys}{$ticket_key}) {
|
if (my $ticket_project = $this_project->{ticket_keys}{$ticket_key}) {
|
||||||
$html_return .= '<br>' if ($html_return); # We're not first, add a line.
|
$return_value->{description} = $this_project->{description};
|
||||||
$html_return .=
|
$return_value->{url} = $this_project->{browse_url};
|
||||||
$ticket_project . ' ('
|
$return_value->{id} = $ticket_id;
|
||||||
. $this_project->{description}
|
$return_value->{project} = $ticket_project;
|
||||||
. '): see ticket <a href="'
|
|
||||||
. $this_project->{browse_url}
|
|
||||||
. $ticket_id . '">'
|
|
||||||
. $ticket_id . '</a>.';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return unless $html_return;
|
return unless $return_value;
|
||||||
|
|
||||||
return undef, structured_answer => {
|
return undef, structured_answer => {
|
||||||
data => {
|
data => {
|
||||||
link => $html_return,
|
title => "$return_value->{project} ($return_value->{description})",
|
||||||
input => $ticket_id
|
subtitle => "JIRA Ticket Lookup: $return_value->{id}",
|
||||||
|
url => "$return_value->{url}$return_value->{id}",
|
||||||
},
|
},
|
||||||
templates => {
|
templates => {
|
||||||
group => 'text',
|
group => 'info'
|
||||||
options => {
|
|
||||||
content => 'DDH.jira.content'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
<div class='zci__jira'>
|
|
||||||
<h3 class='zci__caption zci__result'>{{{link}}}</h3>
|
|
||||||
<h4 class='zci__subheader'>
|
|
||||||
JIRA ticket lookup: {{input}}
|
|
||||||
</h4>
|
|
||||||
</div>
|
|
43
t/Jira.t
43
t/Jira.t
@ -10,48 +10,27 @@ zci is_cached => 1;
|
|||||||
|
|
||||||
sub build_test
|
sub build_test
|
||||||
{
|
{
|
||||||
my ($html, $ticket_id) = @_;
|
my ($title, $subtitle, $url) = @_;
|
||||||
return test_zci(undef, structured_answer => {
|
return test_zci(undef, structured_answer => {
|
||||||
data => {
|
data => {
|
||||||
link => $html,
|
title => $title,
|
||||||
input => $ticket_id
|
subtitle => "JIRA Ticket Lookup: $subtitle",
|
||||||
|
url => $url
|
||||||
},
|
},
|
||||||
templates => {
|
templates => {
|
||||||
group => 'text',
|
group => 'info',
|
||||||
options => {
|
|
||||||
content => 'DDH.jira.content'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ddg_goodie_test(
|
ddg_goodie_test(
|
||||||
|
|
||||||
[qw( DDG::Goodie::Jira)],
|
[qw( DDG::Goodie::Jira)],
|
||||||
'ACE-230' => build_test(
|
'ACE-230' => build_test("ACE (Apache JIRA Bugtracker)", 'ACE-230', "https://issues.apache.org/jira/browse/ACE-230"),
|
||||||
qq(ACE (Apache JIRA Bugtracker): see ticket <a href="https://issues.apache.org/jira/browse/ACE-230">ACE-230</a>.),
|
'ace-230' => build_test("ACE (Apache JIRA Bugtracker)", 'ACE-230', "https://issues.apache.org/jira/browse/ACE-230"),
|
||||||
'ACE-230'
|
'jira random AJLIB-230 bug random' => build_test("ajlib incubator (Codehaus JIRA Bugtracker)", 'AJLIB-230', "https://jira.codehaus.org/browse/AJLIB-230"),
|
||||||
),
|
'jira random ajlib-230 bug random' => build_test("ajlib incubator (Codehaus JIRA Bugtracker)", 'AJLIB-230', "https://jira.codehaus.org/browse/AJLIB-230"),
|
||||||
'ace-230' => build_test(
|
'SOLR-4530' => build_test("Solr (Apache JIRA Bugtracker)", 'SOLR-4530', "https://issues.apache.org/jira/browse/SOLR-4530"),
|
||||||
qq(ACE (Apache JIRA Bugtracker): see ticket <a href="https://issues.apache.org/jira/browse/ACE-230">ACE-230</a>.),
|
'IdentityHtmlMapper solr-4530' => build_test('Solr (Apache JIRA Bugtracker)', 'SOLR-4530', "https://issues.apache.org/jira/browse/SOLR-4530"),
|
||||||
'ACE-230'
|
|
||||||
),
|
|
||||||
'jira random AJLIB-230 bug random' => build_test(
|
|
||||||
qq(ajlib incubator (Codehaus JIRA Bugtracker): see ticket <a href="https://jira.codehaus.org/browse/AJLIB-230">AJLIB-230</a>.),
|
|
||||||
'AJLIB-230'
|
|
||||||
),
|
|
||||||
'jira random ajlib-230 bug random' => build_test(
|
|
||||||
qq(ajlib incubator (Codehaus JIRA Bugtracker): see ticket <a href="https://jira.codehaus.org/browse/AJLIB-230">AJLIB-230</a>.),
|
|
||||||
'AJLIB-230'
|
|
||||||
),
|
|
||||||
'SOLR-4530' => build_test(
|
|
||||||
'Solr (Apache JIRA Bugtracker): see ticket <a href="https://issues.apache.org/jira/browse/SOLR-4530">SOLR-4530</a>.',
|
|
||||||
'SOLR-4530'
|
|
||||||
),
|
|
||||||
'IdentityHtmlMapper solr-4530' => build_test(
|
|
||||||
'Solr (Apache JIRA Bugtracker): see ticket <a href="https://issues.apache.org/jira/browse/SOLR-4530">SOLR-4530</a>.',
|
|
||||||
'SOLR-4530'
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
done_testing;
|
done_testing;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user