Files
function/templates/dashboard/http_functions/new.html
Peter Stockings 5ec8bba9e8 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
2025-02-14 00:40:45 +11:00

41 lines
1.1 KiB
HTML

{% extends 'dashboard.html' %}
{% block page %}
{{ 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')
}}
<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 %}