This is Pluto, the webhook server.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 

123 行
4.9 KiB

{% macro checked_if(value) -%}{% if value %}checked{% endif %}{%- endmacro %}
{% macro text_in(desc, name, value) -%}
<p>{{desc}}: <input type="text" name="{{ name }}" value="{{ value }}"/></p>
{%- endmacro %}
{% macro text_in_id(desc, id, name, value) -%}
<p><span id="{{ id }}">{{desc}}</span>: <input type="text" name="{{ name }}" value="{{ value }}"/></p>
{%- endmacro %}
{% macro select_in(desc, name, value, displays, options) -%}
<p>{{desc}}:
<select name="{{ name }}" value="{{ value }}">
{% for disp in displays %}
{% set opt = options[loop.index0] %}
<option value="{{ opt }}">{{ disp }}</option>
{% endfor %}
</select>
</p>
{%- endmacro %}
{% macro select_in_id(desc, id, name, value, displays, options) -%}
<p>{{desc}}:
<select name="{{ name }}" value="{{ value }}" id="{{ id }}">
{% for disp in displays %}
{% set opt = options[loop.index0] %}
<option value="{{ opt }}">{{ disp }}</option>
{% endfor %}
</select>
</p>
{%- endmacro %}
{% macro checkbox_in(desc, name, value) -%}
<p><label><input type="checkbox" name="{{ name }}" value="1" {{ checked_if(value) }}/>{{ desc }}</label></p>
{%- endmacro %}
{% macro hook(hook) -%}
{% if hook %}
<a class="hook" href="/hook/{{ hook.rowid }}">hook {{ hook.name }} ({{ hook.rowid }})</a>
{% else %}
<span class="nodata">Bad hook</span>
{% 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 %}
<a class="cond" href="/cond/{{ cond.rowid }}">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}})</a>
{% else %}
<span class="nodata">Bad condition</span>
{% 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) }}
<script type="text/javascript">
reg_selector_select(
document.querySelector("#select_selector"),
document.querySelector("#label_s1"),
document.querySelector("#label_s2"),
document.querySelector("#label_s3")
);
reg_test_select(
document.querySelector("#select_test"),
document.querySelector("#label_t1"),
document.querySelector("#label_t2"),
document.querySelector("#label_t3")
);
</script>
{%- endmacro %}
{% macro act(act) -%}
{% if act %}
<a class="act" href="/act/{{ act.rowid }}">action {{ act.rowid }}, action {{ act.action }} ({{ act.a1 | pprint }}, {{ act.a2 | pprint }}, {{ act.a3 | pprint }})</a>
{% else %}
<span class="nodata">Bad action</span>
{% 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) }}
<script type="text/javascript">
reg_action_select(
document.querySelector("#select_action"),
document.querySelector("#label_a1"),
document.querySelector("#label_a2"),
document.querySelector("#label_a3")
);
</script>
{%- endmacro %}
{% macro yesno(booly) -%}
{% if booly %}<span class="positive">Yes</span>{% else %}<span class="negative">No</span>{% endif %}
{%- endmacro %}