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:
@@ -21,6 +21,13 @@
|
||||
integrity="sha512-g9yptARGYXbHR9r3kTKIAzF+vvmgEieTxuuUUcHC5tKYFpLR3DR+lsisH2KZJG2Nwaou8jjYVRdbbbBQI3Bo5w=="
|
||||
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
|
||||
<script src="https://unpkg.com/mithril/mithril.js"></script>
|
||||
<script src="/static/js/mithril/editor.js"></script>
|
||||
<script src="/static/js/mithril/responseView.js"></script>
|
||||
<script src="/static/js/mithril/alert.js"></script>
|
||||
<script src="https://unpkg.com/ace-diff@^2"></script>
|
||||
<link href="https://unpkg.com/ace-diff@^2/dist/ace-diff.min.css" rel="stylesheet">
|
||||
|
||||
<style>
|
||||
@import url("https://rsms.me/inter/inter.css");
|
||||
|
||||
@@ -109,8 +116,24 @@
|
||||
View documentation</a>
|
||||
</div>
|
||||
|
||||
<div id="app" class="p-1">
|
||||
<!-- The Editor component will be mounted here -->
|
||||
</div>
|
||||
|
||||
{{ render_partial('function_editor.html', name=name, script=script, environment_info=environment_info) }}
|
||||
<script>
|
||||
// Mount the component
|
||||
m.mount(document.getElementById("app"), {
|
||||
view: () => m(Editor, {
|
||||
name: '{{ name }}',
|
||||
jsValue: {{ script | tojson | safe }},
|
||||
jsonValue: {{ environment_info | tojson | safe }},
|
||||
isEdit: true,
|
||||
showHeader: false,
|
||||
showFunctionSettings: false,
|
||||
executeUrl: "{{ url_for('execute_code', playground='true') }}",
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<section class="py-8">
|
||||
<div class="container mx-auto flex flex-wrap pt-4 pb-12">
|
||||
|
||||
Reference in New Issue
Block a user