Add option to toggle logging of request/response for http functions, this has been added to due storage capacity concerns
This commit is contained in:
@@ -43,4 +43,4 @@
|
||||
</div>
|
||||
|
||||
{{ render_partial('function_editor.html', name=name, script=script, environment_info=environment_info,
|
||||
is_public=is_public, is_edit=True) }}
|
||||
is_public=is_public, log_request=log_request, log_response=log_response, is_edit=True) }}
|
||||
@@ -9,4 +9,4 @@
|
||||
|
||||
|
||||
{{ render_partial('function_editor.html', name=name, script=script, environment_info=environment_info,
|
||||
is_public=is_public, is_add=True) }}
|
||||
is_public=is_public, log_request=log_request, log_response=log_response, is_add=True) }}
|
||||
@@ -164,6 +164,46 @@
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="inline-flex items-center">
|
||||
<label class="relative flex items-center p-3 rounded-full cursor-pointer" htmlFor="log_request">
|
||||
<input type="checkbox"
|
||||
class="before:content[''] peer relative h-5 w-5 cursor-pointer appearance-none rounded-md border border-blue-gray-200 transition-all before:absolute before:top-2/4 before:left-2/4 before:block before:h-12 before:w-12 before:-translate-y-2/4 before:-translate-x-2/4 before:rounded-full before:bg-blue-gray-500 before:opacity-0 before:transition-opacity checked:border-gray-900 checked:bg-gray-900 checked:before:bg-gray-900 hover:before:opacity-10"
|
||||
id="log_request" {% if log_request|default(false, true) %} checked {% endif %} />
|
||||
<span
|
||||
class="absolute text-white transition-opacity opacity-0 pointer-events-none top-2/4 left-2/4 -translate-y-2/4 -translate-x-2/4 peer-checked:opacity-100">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-3.5 w-3.5" viewBox="0 0 20 20" fill="currentColor"
|
||||
stroke="currentColor" stroke-width="1">
|
||||
<path fill-rule="evenodd"
|
||||
d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
|
||||
clip-rule="evenodd"></path>
|
||||
</svg>
|
||||
</span>
|
||||
</label>
|
||||
<label class="mt-px font-light text-gray-700 cursor-pointer select-none" htmlFor="log_request">
|
||||
Log Request
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="inline-flex items-center">
|
||||
<label class="relative flex items-center p-3 rounded-full cursor-pointer" htmlFor="log_response">
|
||||
<input type="checkbox"
|
||||
class="before:content[''] peer relative h-5 w-5 cursor-pointer appearance-none rounded-md border border-blue-gray-200 transition-all before:absolute before:top-2/4 before:left-2/4 before:block before:h-12 before:w-12 before:-translate-y-2/4 before:-translate-x-2/4 before:rounded-full before:bg-blue-gray-500 before:opacity-0 before:transition-opacity checked:border-gray-900 checked:bg-gray-900 checked:before:bg-gray-900 hover:before:opacity-10"
|
||||
id="log_response" {% if log_response|default(false, true) %} checked {% endif %} />
|
||||
<span
|
||||
class="absolute text-white transition-opacity opacity-0 pointer-events-none top-2/4 left-2/4 -translate-y-2/4 -translate-x-2/4 peer-checked:opacity-100">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-3.5 w-3.5" viewBox="0 0 20 20" fill="currentColor"
|
||||
stroke="currentColor" stroke-width="1">
|
||||
<path fill-rule="evenodd"
|
||||
d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
|
||||
clip-rule="evenodd"></path>
|
||||
</svg>
|
||||
</span>
|
||||
</label>
|
||||
<label class="mt-px font-light text-gray-700 cursor-pointer select-none" htmlFor="log_response">
|
||||
Log Response
|
||||
</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -197,13 +237,15 @@
|
||||
let script_content = editor.getValue().trim();
|
||||
let environment_info = editor_environment.getValue().trim();
|
||||
let is_public = document.querySelector('#is_public').checked
|
||||
let log_request = document.querySelector('#log_request').checked
|
||||
let log_response = document.querySelector('#log_response').checked
|
||||
|
||||
fetch("{{ url_for('edit_http_function') }}", {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ name, script_content, environment_info, is_public }),
|
||||
body: JSON.stringify({ name, script_content, environment_info, is_public, log_request, log_response }),
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(json => showAlert(json.message, json.status))
|
||||
@@ -229,13 +271,15 @@
|
||||
let script_content = editor.getValue().trim();
|
||||
let environment_info = editor_environment.getValue().trim();
|
||||
let is_public = document.querySelector('#is_public').checked
|
||||
let log_request = document.querySelector('#log_request').checked
|
||||
let log_response = document.querySelector('#log_response').checked
|
||||
|
||||
fetch("{{ url_for('create_http_function') }}", {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ name, script_content, environment_info, is_public }),
|
||||
body: JSON.stringify({ name, script_content, environment_info, is_public, log_request, log_response }),
|
||||
})
|
||||
.then(response => response.text())
|
||||
.then(text => {
|
||||
|
||||
Reference in New Issue
Block a user