{% extends "freeadmin/generic_model_edit.html" %}

{% block buttons_extra %}
    {{ block.super }}

    <button id="btn_Fake" data-dojo-type="dijit.form.Button" type="button">
        <script type="dojo/method" data-dojo-event="onClick" data-dojo-args="evt">
            form = getForm(this);
            value = form.get('value');
            form.set('value', {'remote_host_key': 'Discovering...'});
            Middleware.call('keychaincredential.remote_ssh_host_key_scan', [{
                host: value.host,
                port: value.port,
                connect_timeout: value.connect_timeout
            }], function(data) {
                form.set('value', {'remote_host_key': data});
            }, function(e) {
                alert(e.reason);
                form.set('value', {'remote_host_key': ''});
            });
        </script>
        {% trans "Discover Remote host key" %}
    </button>
{% endblock %}
