mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-30 12:43:57 -06:00
Updated frontend to access the 'test-rules' functionality
This commit is contained in:
parent
c8c69f1a66
commit
5dc556f0af
@ -37,4 +37,6 @@
|
||||
|
||||
/* cursors */
|
||||
.rule-triggers {cursor:move;}
|
||||
.rule-actions {cursor:move;}
|
||||
.rule-actions {cursor:move;}
|
||||
|
||||
#testTriggerModal .modal-body { max-height: 500px; overflow-y: scroll; }
|
||||
|
@ -82,4 +82,33 @@ function removeAction(e) {
|
||||
if($('.rule-action-tbody tr').length == 0) {
|
||||
addNewAction();
|
||||
}
|
||||
}
|
||||
|
||||
function testRuleTriggers() {
|
||||
"use strict";
|
||||
|
||||
// Serialize all trigger data
|
||||
var triggerData = $( ".rule-trigger-tbody" ).find( "input[type=text], input[type=checkbox], select" ).serializeArray();
|
||||
|
||||
// Find a list of existing transactions that match these triggers
|
||||
$.get('rules/rules/test_triggers', triggerData).done(function (data) {
|
||||
var modal = $( "#testTriggerModal" );
|
||||
var numTriggers = $( ".rule-trigger-body > tr" ).length;
|
||||
|
||||
// Set title and body
|
||||
modal.find( ".transactions-list" ).html(data.html);
|
||||
|
||||
// Show warning if appropriate
|
||||
if( data.warning ) {
|
||||
modal.find( ".transaction-warning .warning-contents" ).text(data.warning);
|
||||
modal.find( ".transaction-warning" ).show();
|
||||
} else {
|
||||
modal.find( ".transaction-warning" ).hide();
|
||||
}
|
||||
|
||||
// Show the modal dialog
|
||||
$( "#testTriggerModal" ).modal();
|
||||
}).fail(function () {
|
||||
alert('Cannot get transactions for given triggers.');
|
||||
});
|
||||
}
|
@ -31,4 +31,10 @@ $(function () {
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.test_rule_triggers').click(function () {
|
||||
testRuleTriggers();
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
@ -24,6 +24,12 @@ $(function () {
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.test_rule_triggers').click(function () {
|
||||
testRuleTriggers();
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.add_rule_action').click(function () {
|
||||
addNewAction();
|
||||
|
||||
|
@ -126,6 +126,10 @@ return [
|
||||
'delete_rule' => 'Delete rule ":title"',
|
||||
'update_rule' => 'Update rule',
|
||||
|
||||
'test_rule_triggers' => 'See matching transactions',
|
||||
'warning_transaction_subset' => 'For performance reasons this list is limited to :max_num_transactions and may only show a subset of matching transactions',
|
||||
'warning_no_matching_transactions' => 'No matching transactions found. Please note that for performance reasons, only the last :num_transactions transactions have been checked.',
|
||||
|
||||
// actions and triggers
|
||||
'rule_trigger_user_action' => 'User action is ":trigger_value"',
|
||||
'rule_trigger_from_account_starts' => 'Source account starts with ":trigger_value"',
|
||||
|
@ -125,6 +125,10 @@ return [
|
||||
'edit_rule' => 'Wijzig regel ":title"',
|
||||
'update_rule' => 'Werk regel bij',
|
||||
|
||||
'test_rule_triggers' => 'Transacties die voldoen aan triggers',
|
||||
'warning_transaction_subset' => 'In verband met de snelheid, worden in deze lijst maximaal :max_num_transactions transacties weergegeven. Het kan daarom zijn dat transacties ontbreken in deze lijst.',
|
||||
'warning_no_matching_transactions' => 'Er zijn geen transacties gevonden die voldoen aan de triggers in de laatste :num_transactions transacties.',
|
||||
|
||||
// actions and triggers
|
||||
'rule_trigger_user_action' => 'Gebruikersactie is ":trigger_value"',
|
||||
'rule_trigger_from_account_starts' => 'Bronrekeningnaam begint met ":trigger_value"',
|
||||
|
Loading…
Reference in New Issue
Block a user