{% extends "base.html" %} {% block title %}{{ config.APP_NAME }} - Datagrid{% endblock %} {% block body %}
{{ _('Loading {0} v{1}...').format(config.APP_NAME, config.APP_VERSION) }}
{% endblock %} {% block init_script %} require(['sources/generated/sqleditor'], function(ctx) { var $ = pgAdmin.SqlEditor.jquery, S = pgAdmin.SqlEditor.S, editorPanel = $('.sql-editor'), loadingDiv = $('#fetching_data'), msgDiv = loadingDiv.find('.sql-editor-busy-text'); // Register unload event on window close. /* If opened in new tab, close the connection only on tab/window close and * not on refresh attempt because the user may cancel the reload */ if(window.opener) { $(window).on('unload', function(ev) { $.ajax({ method: 'DELETE', url: "{{ url_for('datagrid.index') }}" + "close/" + {{ uniqueId }} }); }); } else { $(window).on('beforeunload', function(ev) { $.ajax({ method: 'DELETE', url: "{{ url_for('datagrid.index') }}" + "close/" + {{ uniqueId }} }); }); } // Get the controller object from pgAdmin.SqlEditor var sqlEditorController = pgAdmin.SqlEditor.create(editorPanel); // Listen on events to show/hide loading-icon and change messages. sqlEditorController.on('pgadmin-sqleditor:loading-icon:message', function(msg) { msgDiv.text(msg); }).on('pgadmin-sqleditor:loading-icon:show', function(msg) { loadingDiv.removeClass('d-none'); msgDiv.text(msg); }).on('pgadmin-sqleditor:loading-icon:hide', function() { loadingDiv.addClass('d-none'); }); {% if script_type_url %} var script_type_url = '{{ script_type_url }}'; {% else %} var script_type_url = ''; {% endif %} // Start the query tool. sqlEditorController.start( {{ uniqueId }}, {{ is_query_tool }}, "{{ editor_title }}", script_type_url, "{{ server_type }}", {{ url_params|safe}}, '{{ layout|safe }}' ); }); {% endblock %}