diff --git a/app/coffee/modules/admin/third-parties.coffee b/app/coffee/modules/admin/third-parties.coffee index 5e88b3fb..3e611b46 100644 --- a/app/coffee/modules/admin/third-parties.coffee +++ b/app/coffee/modules/admin/third-parties.coffee @@ -86,13 +86,11 @@ WebhookDirective = ($rs, $repo, $confirm, $loading) -> updateLogs = () -> $rs.webhooklogs.list(webhook.id).then (webhooklogs) => - webhooklogs = webhooklogs.reverse() - for log in webhooklogs - statusText = String(log.status) - log.validStatus = statusText.length==3 and statusText[0]="2" + for log in webhooklogs + log.validStatus = 200 <= log.status < 300 + log.prettySentHeaders = _.map(_.pairs(log.request_headers), ([header, value]) -> "#{header}: #{value}").join("\n") log.prettySentData = JSON.stringify(log.request_data.data, undefined, 2) - log.prettySentHeaders = JSON.stringify(log.request_headers, undefined, 2) - log.prettyDate = moment(log.created).format("DD MMM YYYY [at] hh:mm:ss") + log.prettyDate = moment(log.created).format("DD MMM YYYY [at] hh:mm:ss") # TODO: i18n webhook.logs_counter = webhooklogs.length webhook.logs = webhooklogs @@ -102,9 +100,9 @@ WebhookDirective = ($rs, $repo, $confirm, $loading) -> textElement = $el.find(".toggle-history") historyElement = textElement.parents(".single-webhook-wrapper").find(".webhooks-history") if historyElement.hasClass("open") - textElement.text("(Hide history)") + textElement.text("(Hide history)") # TODO: i18n else - textElement.text("(Show history)") + textElement.text("(Show history)") # TODO: i18n showVisualizationMode = () -> $el.find(".edition-mode").addClass("hidden") @@ -160,8 +158,8 @@ WebhookDirective = ($rs, $repo, $confirm, $loading) -> cancel(target) $el.on "click", ".delete-webhook", () -> - title = "Delete webhook" #TODO: i18in - message = "Webhook '#{webhook.name}'" #TODO: i18in + title = "Delete webhook" #TODO: i18n + message = "Webhook '#{webhook.name}'" #TODO: i18n $confirm.askOnDelete(title, message).then (finish) => onSucces = -> diff --git a/app/partials/admin/admin-third-parties-webhooks.jade b/app/partials/admin/admin-third-parties-webhooks.jade index 6b8810de..e56468a5 100644 --- a/app/partials/admin/admin-third-parties-webhooks.jade +++ b/app/partials/admin/admin-third-parties-webhooks.jade @@ -56,7 +56,7 @@ block content div.history-single-wrapper(ng-repeat="log in webhook.logs") div.history-single div - span.history-response-icon(ng-class="validStatus ? 'history-success' : 'history-error'") + span.history-response-icon(ng-class="log.validStatus ? 'history-success' : 'history-error'", title="{{log.status}}") span.history-date(ng-bind="log.prettyDate") span.toggle-log.icon.icon-arrow-bottom diff --git a/app/styles/modules/admin/admin-third-parties-webhooks.scss b/app/styles/modules/admin/admin-third-parties-webhooks.scss index 96ca1ed1..e8638bb2 100644 --- a/app/styles/modules/admin/admin-third-parties-webhooks.scss +++ b/app/styles/modules/admin/admin-third-parties-webhooks.scss @@ -135,15 +135,12 @@ } .history-single-response { @include slide(1000px, hidden, $min: 0); - &.open { - margin-top: 1rem; - } } .history-single-request-header, .history-single-response-header { display: flex; justify-content: space-between; - padding: .5rem 0; + padding: 1.5rem 0 .5rem 0; span:first-child { @extend %bold; color: $gray-light;