From a6ce2bcf8c18df64d82de66775008a968a74f5c2 Mon Sep 17 00:00:00 2001 From: sunnavy Date: Thu, 16 Jan 2025 14:58:40 -0500 Subject: [PATCH] Convert inline edit in search results to htmx Now all rows of the updated ticket will be updated on the page, which is especially useful for dashboards where the same ticket might occur in multiple components. --- share/html/Elements/CollectionAsTable/Row | 2 +- share/html/Helpers/AssetUpdate | 2 +- share/html/Helpers/EditTicketDescription | 2 +- share/html/Helpers/TicketUpdate | 2 +- share/static/js/util.js | 157 +++++++++------------- 5 files changed, 64 insertions(+), 101 deletions(-) diff --git a/share/html/Elements/CollectionAsTable/Row b/share/html/Elements/CollectionAsTable/Row index 72a744a0ea..d2219b1ba6 100644 --- a/share/html/Elements/CollectionAsTable/Row +++ b/share/html/Elements/CollectionAsTable/Row @@ -175,7 +175,7 @@ foreach my $column (@Format) { if ( $attrs{edit} ) { my $helper_name = $record->isa('RT::Ticket') ? 'TicketUpdate' : 'AssetUpdate'; - $row_content[$item][$inner_row] .= '
'; + $row_content[$item][$inner_row] .= ''; $row_content[$item][$inner_row] .= $attrs{edit}; $row_content[$item][$inner_row] .= GetSVGImage( Name => 'close-circle', ExtraClasses => 'cancel text-danger', Title => loc('Cancel') ); diff --git a/share/html/Helpers/AssetUpdate b/share/html/Helpers/AssetUpdate index 07c5feab62..bd43c8bef1 100644 --- a/share/html/Helpers/AssetUpdate +++ b/share/html/Helpers/AssetUpdate @@ -144,7 +144,7 @@ $r->headers_out->{'HX-Trigger'} = JSON( actionsChanged => { messages => \@results, isWarning => $checks_failure }, $checks_failure ? ( validationFailed => [ GetInvalidFields( Object => $asset ) ] ) - : ( requestSucceeded => 1 ), + : ( requestSucceeded => 1, @results ? ( collectionsChanged => { class => 'RT::Asset', id => $asset->Id } ) : () ), map { $_ => '' } @events }, ascii => 1, diff --git a/share/html/Helpers/EditTicketDescription b/share/html/Helpers/EditTicketDescription index e8603c64e3..0e00379194 100644 --- a/share/html/Helpers/EditTicketDescription +++ b/share/html/Helpers/EditTicketDescription @@ -54,7 +54,7 @@