[Rt-commit] rtir branch, 4.0-trunk, updated. 4.0.0-41-g7102d7e
Shawn Moore
shawn at bestpractical.com
Thu May 18 13:46:40 EDT 2017
The branch, 4.0-trunk has been updated
via 7102d7e3defa9f9a250c773b79f1c0870355f517 (commit)
via 8bf35fdd89ecc05f978d4d0ad722ad7236bac19e (commit)
from f2c2d9de0ac610afc4e17f1f4e204613afb2b429 (commit)
Summary of changes:
html/RTIR/Tools/Elements/ToolResultsWhois | 20 +++++++++++++++++++-
html/RTIR/Tools/Lookup.html | 11 ++++++++++-
html/RTIR/Tools/Traceroute.html | 18 ++++++++++++++++++
3 files changed, 47 insertions(+), 2 deletions(-)
- Log -----------------------------------------------------------------
commit 8bf35fdd89ecc05f978d4d0ad722ad7236bac19e
Author: Aaron Kondziela <aaron at bestpractical.com>
Date: Thu Apr 13 21:06:27 2017 -0400
Add button to save Whois and Traceroute results to a ticket
Fixes: I#31257
diff --git a/html/RTIR/Tools/Elements/ToolResultsWhois b/html/RTIR/Tools/Elements/ToolResultsWhois
index b9d570f..2e7dc96 100644
--- a/html/RTIR/Tools/Elements/ToolResultsWhois
+++ b/html/RTIR/Tools/Elements/ToolResultsWhois
@@ -60,6 +60,7 @@
my $DoInvestigate = 0;
if ($WhoisIterator) {
while (my $obj = $WhoisIterator->next) {
+ $SavedContent .= $obj->content . "\n";
my @lines_starting_with_space = grep /^(\s+)(\w+)/, $obj->content;
if ($handparse || $#lines_starting_with_space >= 4) { #we couldn't parse that. suck
my $content = join "", $obj->content;
@@ -72,7 +73,7 @@ if ($WhoisIterator) {
<pre><% $content |n %></pre><br />
% } else {
Structured RIPE whois data returned.
-lick <a href="Lookup.html?q=<% $q |u %>&server=<% $WhoisServer |u %>&handparse=1">here</a> to manually parse this data.
+Click <a href="Lookup.html?q=<% $q |u %>&server=<% $WhoisServer |u %>&handparse=1">here</a> to manually parse this data.
<br />Warnings <% $obj->warnings %>
<br />errors <% $obj->errors %>
<hr />
@@ -108,6 +109,22 @@ foreach my $attribute ( $obj->attributes ) {
&>
% }
</form>
+
+% if ($TicketObj and $WhoisIterator and $SavedContent) {
+% my $url = RT::IR->HREFTo(
+% "Tools/Lookup.html?"
+% . $m->comp(
+% '/Elements/QueryString',
+% ticket => $TicketObj->id,
+% q => $q,
+% )
+% );
+ <form method="post" action="<% $url %>">
+ <input type="hidden" name="LookupResults" value="<% $SavedContent %>" />
+ <input type="submit" value="<% loc('Save these results to the ticket') %>" id="save-results-to-ticket" />
+ </form>
+% }
+
<%args>
$q => undef
$handparse => 1
@@ -131,4 +148,5 @@ my ($WhoisIterator, $WhoisError) = RT::IR->WhoisLookup(
CurrentUser => $session{'CurrentUser'},
);
+my $SavedContent = '';
</%init>
diff --git a/html/RTIR/Tools/Lookup.html b/html/RTIR/Tools/Lookup.html
index c0899ef..aad82e7 100644
--- a/html/RTIR/Tools/Lookup.html
+++ b/html/RTIR/Tools/Lookup.html
@@ -47,6 +47,7 @@
%# END BPS TAGGED BLOCK }}}
<& /RTIR/Elements/Header, Title => $title &>
<& /Elements/Tabs &>
+<& /Elements/ListActions, actions => \@results &>
% $m->callback(CallbackName => 'BeforeCurrent', %ARGS, ARGSRef => \%ARGS, Ticket => $TicketObj, LookupType => $type, q => $q);
@@ -80,7 +81,7 @@
% $m->callback(CallbackName => 'AfterTools', %ARGS, ARGSRef => \%ARGS, Ticket => $TicketObj, LookupType => $type, q => $q);
<%INIT>
-
+my @results;
# Redirect when necessary
if ( $ARGS{'InvestigateTo'} ) {
my $requestors = join ', ', map /^Requestorbox-(.*)/, keys %ARGS;
@@ -108,10 +109,18 @@ if ( $ticket ) {
$TicketType = RT::IR::TicketType( Ticket => $TicketObj );
}
+if ($TicketObj and $LookupResults) {
+ my ($val, $msg) = $TicketObj->Comment(
+ Content => $LookupResults,
+ );
+ push @results, loc("Lookup results for Ticket [_1]: [_2]", $TicketObj->id, $msg);
+}
+
</%INIT>
<%ARGS>
$q => ''
$type => undef
$ticket => undef
+$LookupResults => undef
$HideResults => 0
</%ARGS>
diff --git a/html/RTIR/Tools/Traceroute.html b/html/RTIR/Tools/Traceroute.html
index 8ea29e3..15df85b 100644
--- a/html/RTIR/Tools/Traceroute.html
+++ b/html/RTIR/Tools/Traceroute.html
@@ -57,6 +57,7 @@
<pre>
<%PERL>
while (my $content = <$tr>) {
+ $SavedContent .= $content . "\n";
$m->comp('/Elements/MakeClicky', content => \$content, ($TicketObj? (object => $TicketObj):()) );
$m->out( $content );
$m->out('<br />');
@@ -66,6 +67,21 @@ while (my $content = <$tr>) {
</pre>
</&>
+% if ($TicketObj and $SavedContent) {
+% my $url = RT::IR->HREFTo(
+% "Tools/Lookup.html?"
+% . $m->comp(
+% '/Elements/QueryString',
+% ticket => $ticket,
+% q => $q,
+% )
+% );
+ <form method="post" action="<% $url %>">
+ <input type="hidden" name="LookupResults" value="<% $SavedContent %>" />
+ <input type="submit" value="<% loc('Save these results to the ticket') %>" id="save-results-to-ticket" />
+ </form>
+% }
+
</div>
<%INIT>
unless ( $q =~ /^[A-Z0-9.:]+$/i ) {
@@ -87,6 +103,8 @@ if ($ticket) {
$TicketObj = LoadTicket($ticket);
}
+my $SavedContent = '';
+
tied(%session)->release_all_locks;
open(my $tr, "-|", $cmd, $q) or Abort("Couldn't run '$cmd': $!");
</%INIT>
commit 7102d7e3defa9f9a250c773b79f1c0870355f517
Merge: f2c2d9d 8bf35fd
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Thu May 18 17:45:40 2017 +0000
Merge branch '4.0/save-lookup-results' into 4.0-trunk
-----------------------------------------------------------------------
More information about the rt-commit
mailing list