File tree Expand file tree Collapse file tree
src/Umbraco.Web.UI.Client/src/views/webhooks Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33 < thead >
44 < tr >
55 < th > </ th >
6- < th > < localize key ="webhooks_webhookKey "> Webhook key</ localize > </ th >
76 < th > < localize key ="general_date "> Date</ localize > </ th >
87 < th > < localize key ="webhooks_url "> Url</ localize > </ th >
98 < th > < localize key ="webhooks_event "> Event</ localize > </ th >
2019 </ umb-checkmark >
2120 < umb-icon icon ="icon-wrong " class ="umb-checkmark umb-checkmark--m " style ="cursor: default; " ng-if ="!vm.isChecked(log) "> </ umb-icon >
2221 </ td >
23- < td > {{ log.webhookKey }}</ td >
2422 < td > {{ log.formattedLogDate }}</ td >
2523 < td > {{ log.url }}</ td >
2624 < td > {{ log.eventAlias }}</ td >
Original file line number Diff line number Diff line change 55
66 vm . close = close ;
77 vm . formatData = formatData ;
8+ vm . detectLanguage = detectLanguage ;
89
910 function formatData ( data ) {
1011
1112 let obj = data ;
1213
1314 if ( data . detectIsJson ( ) ) {
1415 try {
15- obj = Utilities . fromJson ( data )
16+ obj = JSON . stringify ( Utilities . fromJson ( data ) , null , 2 ) ;
1617 } catch ( err ) {
1718 obj = data ;
1819 }
2122 return obj ;
2223 }
2324
25+ function detectLanguage ( headers , defaultLanguage ) {
26+ const matches = headers . match ( / ^ C o n t e n t - T y p e : \s * (?< type > [ a - z \/ + . - ] + ) ( \; ? .* ?) $ / mi)
27+ if ( matches ) {
28+ const contentType = matches . groups [ "type" ] ;
29+ if ( contentType === "application/json" )
30+ return "JSON" ;
31+ if ( contentType === "text/html" )
32+ return "HTML" ;
33+ if ( contentType === "application/xml" || contentType === "text/xml" )
34+ return "XML" ;
35+ }
36+
37+ return defaultLanguage || "TEXT" ;
38+ }
39+
2440 function close ( ) {
2541 if ( $scope . model && $scope . model . close ) {
2642 $scope . model . close ( ) ;
Original file line number Diff line number Diff line change 4545 < div > {{model.log.retryCount}}</ div >
4646 </ umb-control-group >
4747
48+ < umb-control-group label ="Webhook key ">
49+ < div > {{model.log.webhookKey}}</ div >
50+ </ umb-control-group >
51+
4852 </ umb-box-content >
4953
5054 </ umb-box >
5357 < umb-box-header title ="Request "> </ umb-box-header >
5458 < umb-box-content class ="block-form ">
5559 < pre class ="code "> {{model.log.requestHeaders}}</ pre >
56- < umb-code-snippet language ="'JSON' " wrap ="true "> {{vm.formatData(model.log.requestBody) | json}}
57- </ umb-code-snippet >
60+ < umb-code-snippet language ="vm.detectLanguage(model.log.requestHeaders, 'JSON') " wrap ="true "> {{vm.formatData(model.log.requestBody)}}</ umb-code-snippet >
5861 </ umb-box-content >
5962 </ umb-box >
6063 < umb-box >
6164 < umb-box-header title ="Response "> </ umb-box-header >
6265 < umb-box-content class ="block-form ">
6366 < pre class ="code "> {{model.log.responseHeaders}}</ pre >
64- < umb-code-snippet language ="'TEXT' " wrap ="true "> {{vm.formatData(model.log.responseBody) | json}}
65- </ umb-code-snippet >
67+ < umb-code-snippet language ="vm.detectLanguage(model.log.responseHeaders) " wrap ="true "> {{vm.formatData(model.log.responseBody)}}</ umb-code-snippet >
6668 </ umb-box-content >
6769 </ umb-box >
6870 < div ng-if ="model.log.exceptionOccured ">
You can’t perform that action at this time.
0 commit comments