Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

history.tmpl 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. {{$isNew:=or .PageIsSettingsHooksNew .PageIsAdminDefaultHooksNew .PageIsAdminSystemHooksNew}}
  2. {{if .PageIsSettingsHooksEdit}}
  3. <h4 class="ui top attached header">
  4. {{ctx.Locale.Tr "repo.settings.recent_deliveries"}}
  5. {{if .Permission.IsAdmin}}
  6. <div class="ui right">
  7. <!-- the button is wrapped with a span because the tooltip doesn't show on hover if we put data-tooltip-content directly on the button -->
  8. <span data-tooltip-content="{{if or $isNew .Webhook.IsActive}}{{ctx.Locale.Tr "repo.settings.webhook.test_delivery_desc"}}{{else}}{{ctx.Locale.Tr "repo.settings.webhook.test_delivery_desc_disabled"}}{{end}}">
  9. <button class="ui tiny button{{if not (or $isNew .Webhook.IsActive)}} disabled{{end}}" id="test-delivery" data-link="{{.Link}}/test" data-redirect="{{.Link}}">
  10. <span class="text">{{ctx.Locale.Tr "repo.settings.webhook.test_delivery"}}</span>
  11. </button>
  12. </span>
  13. </div>
  14. {{end}}
  15. </h4>
  16. <div class="ui attached segment">
  17. <div class="ui list">
  18. {{range .History}}
  19. <div class="item">
  20. <div class="flex-text-block tw-justify-between">
  21. <div class="flex-text-inline">
  22. {{if .IsSucceed}}
  23. <span class="text green">{{svg "octicon-check"}}</span>
  24. {{else if not .IsDelivered}}
  25. <span class="text orange">{{svg "octicon-stopwatch"}}</span>
  26. {{else}}
  27. <span class="text red">{{svg "octicon-alert"}}</span>
  28. {{end}}
  29. <a class="ui primary sha label toggle button show-panel" data-panel="#info-{{.ID}}">{{.UUID}}</a>
  30. </div>
  31. <span class="text grey">
  32. {{TimeSince .Delivered.AsTime ctx.Locale}}
  33. </span>
  34. </div>
  35. <div class="info tw-hidden" id="info-{{.ID}}">
  36. <div class="ui top attached tabular menu">
  37. <a class="item active" data-tab="request-{{.ID}}">{{ctx.Locale.Tr "repo.settings.webhook.request"}}</a>
  38. <a class="item" data-tab="response-{{.ID}}">
  39. {{ctx.Locale.Tr "repo.settings.webhook.response"}}
  40. {{if .ResponseInfo}}
  41. {{if .IsSucceed}}
  42. <span class="ui green label">{{.ResponseInfo.Status}}</span>
  43. {{else}}
  44. <span class="ui red label">{{.ResponseInfo.Status}}</span>
  45. {{end}}
  46. {{else}}
  47. <span class="ui label">-</span>
  48. {{end}}
  49. </a>
  50. {{if or $.Permission.IsAdmin $.IsOrganizationOwner $.PageIsAdmin $.PageIsUserSettings}}
  51. <div class="right menu">
  52. <form class="item" action="{{$.Link}}/replay/{{.UUID}}" method="post">
  53. {{$.CsrfTokenHtml}}
  54. <span data-tooltip-content="{{if $.Webhook.IsActive}}{{ctx.Locale.Tr "repo.settings.webhook.replay.description"}}{{else}}{{ctx.Locale.Tr "repo.settings.webhook.replay.description_disabled"}}{{end}}">
  55. <button class="ui tiny button{{if not $.Webhook.IsActive}} disabled{{end}}">{{svg "octicon-sync"}}</button>
  56. </span>
  57. </form>
  58. </div>
  59. {{end}}
  60. </div>
  61. <div class="ui bottom attached tab segment active" data-tab="request-{{.ID}}">
  62. {{if .RequestInfo}}
  63. <h5>{{ctx.Locale.Tr "repo.settings.webhook.headers"}}</h5>
  64. <pre class="webhook-info"><strong>Request URL:</strong> {{.RequestInfo.URL}}
  65. <strong>Request method:</strong> {{if .RequestInfo.HTTPMethod}}{{.RequestInfo.HTTPMethod}}{{else}}POST{{end}}
  66. {{range $key, $val := .RequestInfo.Headers}}<strong>{{$key}}:</strong> {{$val}}
  67. {{end}}</pre>
  68. <h5>{{ctx.Locale.Tr "repo.settings.webhook.payload"}}</h5>
  69. <pre class="webhook-info"><code class="json">{{or .RequestInfo.Body .PayloadContent}}</code></pre>
  70. {{else}}
  71. -
  72. {{end}}
  73. </div>
  74. <div class="ui bottom attached tab segment" data-tab="response-{{.ID}}">
  75. {{if .ResponseInfo}}
  76. <h5>{{ctx.Locale.Tr "repo.settings.webhook.headers"}}</h5>
  77. <pre class="webhook-info">{{range $key, $val := .ResponseInfo.Headers}}<strong>{{$key}}:</strong> {{$val}}
  78. {{end}}</pre>
  79. <h5>{{ctx.Locale.Tr "repo.settings.webhook.body"}}</h5>
  80. <pre class="webhook-info"><code>{{.ResponseInfo.Body}}</code></pre>
  81. {{else}}
  82. -
  83. {{end}}
  84. </div>
  85. </div>
  86. </div>
  87. {{end}}
  88. </div>
  89. </div>
  90. {{end}}