{% macro checked_if(value) -%}{% if value %}checked{% endif %}{%- endmacro %} {% macro text_in(desc, name, value) -%}

{{desc}}:

{%- endmacro %} {% macro text_in_id(desc, id, name, value) -%}

{{desc}}:

{%- endmacro %} {% macro select_in(desc, name, value, displays, options) -%}

{{desc}}:

{%- endmacro %} {% macro select_in_id(desc, id, name, value, displays, options) -%}

{{desc}}:

{%- endmacro %} {% macro checkbox_in(desc, name, value) -%}

{%- endmacro %} {% macro hook(hook) -%} {% if hook %} hook {{ hook.name }} ({{ hook.rowid }}) {% else %} Bad hook {% endif %} {%- endmacro %} {% macro hook_id(rowid) -%} {{ hook(safe_load('Hook', rowid)) }} {%- endmacro %} {% macro hook_params(hook) -%} {{ text_in('Name', 'name', hook.name) }} {{ checkbox_in('Disable hook', 'disabled', hook.disabled) }} {{ checkbox_in('Debug hook', 'debugged', hook.debugged) }} {%- endmacro %} {% macro cond(cond) -%} {% if cond %} condition {{ cond.rowid }}, selector {{ cond.selector }} ({{ cond.s1 | pprint }}, {{ cond.s2 | pprint }}, {{ cond.s3 | pprint }}), test {{ cond.test }} ({{ cond.t1 | pprint }}, {{ cond.t2 | pprint }}, {{ cond.t3 | pprint}}) {% else %} Bad condition {% endif %} {%- endmacro %} {% macro cond_id(rowid) -%} {{ cond(safe_load('Condition', rowid)) }} {%- endmacro %} {% macro cond_params(cond) -%} {{ select_in_id('Selector', 'select_selector', 'selector', cond.selector, ['header', 'JSON', 'path'], ['header', 'JSON', 'path']) }} {{ text_in_id('Selector parameter 1', 'label_s1', 's1', cond.s1) }} {{ text_in_id('Selector parameter 2', 'label_s2', 's2', cond.s2) }} {{ text_in_id('Selector parameter 3', 'label_s3', 's3', cond.s3) }} {{ select_in_id('Test', 'select_test', 'test', cond.test, ['equal', 'inrange', 'truthy', 'contains'], ['equal', 'inrange', 'truthy', 'contains']) }} {{ text_in_id('Test parameter 1', 'label_t1', 't1', cond.t1) }} {{ text_in_id('Test parameter 2', 'label_t2', 't2', cond.t2) }} {{ text_in_id('Test parameter 3', 'label_t3', 't3', cond.t3) }} {{ checkbox_in('Invert this condition', 'invert', cond.invert) }} {%- endmacro %} {% macro act(act) -%} {% if act %} action {{ act.rowid }}, action {{ act.action }} ({{ act.a1 | pprint }}, {{ act.a2 | pprint }}, {{ act.a3 | pprint }}) {% else %} Bad action {% endif %} {%- endmacro %} {% macro act_id(rowid) -%} {{ act(safe_load('Action', rowid)) }} {%- endmacro %} {% macro act_params(act) -%} {{ select_in_id('Action', 'select_action', 'action', act.action, ['post', 'gitlab', 'system', 'udp', 'tcp', 'set_response'], ['post', 'gitlab', 'system', 'udp', 'tcp', 'set_response']) }} {{ text_in_id('Action parameter 1', 'label_a1', 'a1', act.a1) }} {{ text_in_id('Action parameter 2', 'label_a2', 'a2', act.a2) }} {{ text_in_id('Action parameter 3', 'label_a3', 'a3', act.a3) }} {%- endmacro %} {% macro yesno(booly) -%} {% if booly %}Yes{% else %}No{% endif %} {%- endmacro %}