mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-06 04:34:00 +00:00
Better debug for webhooks
This commit is contained in:
@@ -127,6 +127,7 @@ class ShowController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function triggerTransaction(Webhook $webhook, TransactionGroup $group): JsonResponse
|
public function triggerTransaction(Webhook $webhook, TransactionGroup $group): JsonResponse
|
||||||
{
|
{
|
||||||
|
app('log')->debug(sprintf('Now in triggerTransaction(%d, %d)',$webhook->id, $group->id));
|
||||||
/** @var MessageGeneratorInterface $engine */
|
/** @var MessageGeneratorInterface $engine */
|
||||||
$engine = app(MessageGeneratorInterface::class);
|
$engine = app(MessageGeneratorInterface::class);
|
||||||
$engine->setUser(auth()->user());
|
$engine->setUser(auth()->user());
|
||||||
@@ -141,6 +142,7 @@ class ShowController extends Controller
|
|||||||
$engine->generateMessages();
|
$engine->generateMessages();
|
||||||
|
|
||||||
// trigger event to send them:
|
// trigger event to send them:
|
||||||
|
app('log')->debug('send event RequestedSendWebhookMessages');
|
||||||
event(new RequestedSendWebhookMessages());
|
event(new RequestedSendWebhookMessages());
|
||||||
|
|
||||||
return response()->json([], 204);
|
return response()->json([], 204);
|
||||||
|
2
public/v1/js/webhooks/show.js
vendored
2
public/v1/js/webhooks/show.js
vendored
File diff suppressed because one or more lines are too long
@@ -68,7 +68,7 @@
|
|||||||
<div class="box-footer">
|
<div class="box-footer">
|
||||||
<div class="btn-group pull-right">
|
<div class="btn-group pull-right">
|
||||||
<a :href=edit_url class="btn btn-default"><em class="fa fa-pencil"></em> {{ $t('firefly.edit') }}</a>
|
<a :href=edit_url class="btn btn-default"><em class="fa fa-pencil"></em> {{ $t('firefly.edit') }}</a>
|
||||||
<a id="triggerButton" v-if="active" href="#" @click="submitTest" class="btn btn-default"><em
|
<a id="triggerButton" v-if="active" href="#" @click="submitTest" :class="disabledTrigger ? 'btn btn-default disabled ' : 'btn btn-default'"><em
|
||||||
class="fa fa-bolt"></em>
|
class="fa fa-bolt"></em>
|
||||||
{{ $t('list.trigger') }}
|
{{ $t('list.trigger') }}
|
||||||
</a>
|
</a>
|
||||||
@@ -270,6 +270,7 @@ export default {
|
|||||||
edit_url: '#',
|
edit_url: '#',
|
||||||
delete_url: '#',
|
delete_url: '#',
|
||||||
success_message: '',
|
success_message: '',
|
||||||
|
disabledTrigger: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -284,27 +285,34 @@ export default {
|
|||||||
this.show_secret = !this.show_secret;
|
this.show_secret = !this.show_secret;
|
||||||
},
|
},
|
||||||
submitTest: function (e) {
|
submitTest: function (e) {
|
||||||
|
if (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
console.log('here we are');
|
||||||
let journalId = parseInt(prompt('Enter a transaction ID'));
|
let journalId = parseInt(prompt('Enter a transaction ID'));
|
||||||
if (journalId !== null && journalId > 0 && journalId <= 2 ^ 24) {
|
if (journalId !== null && journalId > 0 && journalId <= 16777216) {
|
||||||
|
console.log('OK 1');
|
||||||
|
this.disabledTrigger = true;
|
||||||
// disable button. Add informative message.
|
// disable button. Add informative message.
|
||||||
let button = $('#triggerButton');
|
//let button = $('#triggerButton');
|
||||||
button.prop('disabled', true).addClass('disabled');
|
//button.prop('disabled', true).addClass('disabled');
|
||||||
|
|
||||||
this.success_message = $.text(this.$t('firefly.webhook_was_triggered'));
|
this.success_message = this.$t('firefly.webhook_was_triggered');
|
||||||
// TODO actually trigger the webhook.
|
// TODO actually trigger the webhook.
|
||||||
axios.post('./api/v1/webhooks/' + this.id + '/trigger-transaction/' + journalId, {});
|
axios.post('./api/v1/webhooks/' + this.id + '/trigger-transaction/' + journalId, {});
|
||||||
button.prop('disabled', false).removeClass('disabled');
|
//button.prop('disabled', false).removeClass('disabled');
|
||||||
|
console.log('OK 2');
|
||||||
|
|
||||||
// set a time-outs.
|
// set a time-outs.
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.getWebhook();
|
this.getWebhook();
|
||||||
|
this.disabledTrigger = false;
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
console.log('OK 3');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
resetSecret: function () {
|
resetSecret: function () {
|
||||||
|
Reference in New Issue
Block a user