@@ -74,6 +74,11 @@ def project_url
7474 "#{ host } /#{ @project . slug } "
7575 end
7676
77+ def performance_action_url ( target )
78+ return "#{ project_url } /performance" if target . blank? || target == "Unknown"
79+ "#{ project_url } /performance/actions/#{ URI . encode_www_form_component ( target ) } "
80+ end
81+
7782 def error_url ( issue , tab : nil , event_id : nil )
7883 q = [ ]
7984 q << "tab=#{ tab } " if tab
@@ -145,7 +150,7 @@ def build_performance_blocks(event, payload)
145150 {
146151 type : "actions" ,
147152 elements : [
148- { type : "button" , text : { type : "plain_text" , text : "View Performance" , emoji : true } , url : " #{ project_url } /performance" , style : "primary" }
153+ { type : "button" , text : { type : "plain_text" , text : "View Performance" , emoji : true } , url : performance_action_url ( endpoint ) , style : "primary" }
149154 ]
150155 }
151156 ]
@@ -172,7 +177,7 @@ def build_n_plus_one_blocks(payload)
172177 {
173178 type : "actions" ,
174179 elements : [
175- { type : "button" , text : { type : "plain_text" , text : "View Queries" , emoji : true } , url : " #{ project_url } /performance" , style : "primary" }
180+ { type : "button" , text : { type : "plain_text" , text : "View Queries" , emoji : true } , url : performance_action_url ( controller_action ) , style : "primary" }
176181 ]
177182 }
178183 ]
@@ -373,7 +378,7 @@ def build_performance_message(event, payload)
373378 {
374379 type : "button" ,
375380 text : "View Performance" ,
376- url : " #{ project_url } /performance" ,
381+ url : performance_action_url ( event . target . presence || payload [ "target" ] || payload [ "controller_action" ] || event . request_path ) ,
377382 style : "primary"
378383 }
379384 ] ,
@@ -435,7 +440,7 @@ def build_n_plus_one_message(payload)
435440 {
436441 type : "button" ,
437442 text : "View Queries" ,
438- url : " #{ project_url } /performance" ,
443+ url : performance_action_url ( controller_action ) ,
439444 style : "primary"
440445 }
441446 ] ,
0 commit comments