Refactor HTTP function editor with Mithril components and new API endpoints
- Add new Mithril components for editor (editor.js), response view (responseView.js), and alerts (alert.js) - Create new API endpoints for creating, updating, and deleting HTTP functions - Update templates to use new Mithril editor component - Improve header navigation with more consistent styling and active state indicators - Remove old edit form route and template - Add new dedicated editor route and template cursor.ai
This commit is contained in:
@@ -2,12 +2,40 @@
|
||||
|
||||
{% block page %}
|
||||
|
||||
{{ render_partial('dashboard/http_functions/header.html', title='New HTTP function', user_id=user_id, show_name=False,
|
||||
show_refresh=False, show_logs=False,
|
||||
show_client=False, show_link=False)
|
||||
{{ render_partial('dashboard/http_functions/header.html',
|
||||
user_id=user_id,
|
||||
show_name=False,
|
||||
show_refresh=False,
|
||||
show_logs=False,
|
||||
show_client=False,
|
||||
show_link=False,
|
||||
dashboardUrl=url_for('dashboard_http_functions'),
|
||||
title='New HTTP Function')
|
||||
}}
|
||||
|
||||
{{ render_partial('function_editor.html', name=name, script=script, environment_info=environment_info,
|
||||
is_public=is_public, log_request=log_request, log_response=log_response, is_add=True) }}
|
||||
<div id="app" class="p-1">
|
||||
<!-- The Editor component will be mounted here -->
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Mount the component
|
||||
m.mount(document.getElementById("app"), {
|
||||
view: () => m(Editor, {
|
||||
name: '{{ name }}',
|
||||
jsValue: {{ script | tojson | safe }},
|
||||
jsonValue: {{ environment_info | tojson | safe }},
|
||||
isEdit: false,
|
||||
isAdd: true,
|
||||
showHeader: true,
|
||||
isPublic: {{ is_public | tojson }},
|
||||
logRequest: {{ log_request | tojson }},
|
||||
logResponse: {{ log_response | tojson }},
|
||||
executeUrl: "{{ url_for('execute_code', playground='true') }}",
|
||||
saveUrl: "{{ url_for('api_create_http_function') }}",
|
||||
showDeleteButton: false,
|
||||
dashboardUrl: "{{ url_for('dashboard_http_functions') }}"
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user