Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Also show errors for webhook triggers.
James Coledb5e792a320a
diff --git a/config/translations.php b/config/translations.phpindex f6b0ebca78..d6a6d60896 100644--- a/config/translations.php+++ b/config/translations.php@@ -174,7 +174,16 @@ return ['webhook_trigger_ANY','webhook_trigger_STORE_TRANSACTION','webhook_trigger_UPDATE_TRANSACTION',+ 'webhook_trigger_DESTROY_TRANSACTION',+ 'webhook_trigger_STORE_BUDGET',+ 'webhook_trigger_UPDATE_BUDGET',+ 'webhook_trigger_DESTROY_BUDGET',+ 'webhook_trigger_STORE_UPDATE_BUDGET_LIMIT','webhook_response_RELEVANT',+ 'webhook_response_TRANSACTIONS',+ 'webhook_response_ACCOUNTS',+ 'webhook_response_BUDGET',+ 'webhook_response_NONE','webhook_delivery_JSON',// 'account_column_opt_drag_and_drop',// 'account_column_opt_active',@@ -337,6 +346,7 @@ return ['webhook_active_form_help','edit_webhook_js','webhook_was_triggered',+ 'webhook_triggered_error','view_message','view_attempts','message_content_title',diff --git a/resources/assets/v3/js/pages/webhooks/show.js b/resources/assets/v3/js/pages/webhooks/show.jsindex fe91037b6d..df518d5479 100644--- a/resources/assets/v3/js/pages/webhooks/show.js+++ b/resources/assets/v3/js/pages/webhooks/show.js@@ -53,6 +53,7 @@ let show = function () {edit_url: "#",delete_url: "#",success_message: "",+ error_message: "",disabledTrigger: false,init() {this.i18next = i18next;@@ -75,15 +76,20 @@ let show = function () {let journalId = parseInt(prompt("Enter a transaction ID"));if (journalId !== null && journalId > 0 && journalId <= 16777216) {this.disabledTrigger = true;- this.success_message = i18next.t("firefly.webhook_was_triggered");- new Post().triggerTransaction(this.id, journalId);-- // set a time-outs.this.loading = true;- setTimeout(() => {+ new Post().triggerTransaction(this.id, journalId).then(() => {+ this.success_message = i18next.t("firefly.webhook_was_triggered");+ this.getWebhook();+ this.loading = false;+ this.disabledTrigger = false;+ }).catch((e) => {this.getWebhook();+ this.loading = false;+ this.error_message = i18next.t("firefly.webhook_triggered_error") + ' ' + e;this.disabledTrigger = false;- }, 2000);+ });++// console.log('OK 3');}diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.phpindex 0b609c52d4..741f50aa39 100644--- a/resources/lang/en_US/firefly.php+++ b/resources/lang/en_US/firefly.php@@ -285,6 +285,7 @@ return ['edit_webhook_js' => 'Edit webhook "{title}"','show_webhook' => 'Webhook ":title"','webhook_was_triggered' => 'The webhook was triggered on the indicated transaction. Please wait for results to appear.',+ 'webhook_triggered_error' => 'The webhook could not be triggered.','webhook_messages' => 'Webhook message','view_message' => 'View message','view_attempts' => 'View failed attempts',diff --git a/resources/views/webhooks/show.blade.php b/resources/views/webhooks/show.blade.phpindex 8bf0a32982..0eb87540a1 100644--- a/resources/views/webhooks/show.blade.php+++ b/resources/views/webhooks/show.blade.php@@ -5,9 +5,18 @@<div class="row"><div class="col-lg-12"><div class="alert alert-success alert-dismissible" role="alert">- <button class="close" data-bs-dismiss="alert" type="button"- aria-label="{{ __('firefly.close') }}"><span aria-hidden="true">×</span></button><strong>{{ __("firefly.flash_success") }}</strong> <span x-html="success_message"></span>+ <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="{{ __('firefly.close') }}"></button>+ </div>+ </div>+ </div>+ </template>+ <template x-if="error_message !== ''">+ <div class="row">+ <div class="col-lg-12">+ <div class="alert alert-danger alert-dismissible" role="alert">+ <strong>{{ __("firefly.flash_error") }}</strong> <span x-text="error_message"></span>+ <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="{{ __('firefly.close') }}"></button></div></div></div>