Display http function invoked count in list
This commit is contained in:
2
app.py
2
app.py
@@ -210,7 +210,7 @@ def execute_http_function(function):
|
|||||||
response = requests.post(API_URL, json={'code': code, 'request': request_obj, 'environment': environment})
|
response = requests.post(API_URL, json={'code': code, 'request': request_obj, 'environment': environment})
|
||||||
response_data = response.json()
|
response_data = response.json()
|
||||||
|
|
||||||
db.update_http_function_environment_info(function, json.dumps(response_data['environment']))
|
db.update_http_function_environment_info_and_invoked_count(function, json.dumps(response_data['environment']))
|
||||||
|
|
||||||
# Map the Node.js response to Flask response
|
# Map the Node.js response to Flask response
|
||||||
flask_response = map_isolator_response_to_flask_response(response_data)
|
flask_response = map_isolator_response_to_flask_response(response_data)
|
||||||
|
|||||||
4
db.py
4
db.py
@@ -64,9 +64,9 @@ class DataBase():
|
|||||||
self.execute(
|
self.execute(
|
||||||
'UPDATE http_functions SET script_content=%s, environment_info=%s WHERE NAME=%s', [script_content, environment_info, name], commit=True)
|
'UPDATE http_functions SET script_content=%s, environment_info=%s WHERE NAME=%s', [script_content, environment_info, name], commit=True)
|
||||||
|
|
||||||
def update_http_function_environment_info(self, name, environment_info):
|
def update_http_function_environment_info_and_invoked_count(self, name, environment_info):
|
||||||
self.execute(
|
self.execute(
|
||||||
'UPDATE http_functions SET environment_info=%s WHERE NAME=%s', [environment_info, name], commit=True)
|
'UPDATE http_functions SET environment_info=%s, invoked_count = invoked_count + 1 WHERE NAME=%s', [environment_info, name], commit=True)
|
||||||
|
|
||||||
def delete_http_function(self, name):
|
def delete_http_function(self, name):
|
||||||
self.execute(
|
self.execute(
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ def create_http_function_view_model(http_function):
|
|||||||
"name": name,
|
"name": name,
|
||||||
"script_content": http_function['script_content'],
|
"script_content": http_function['script_content'],
|
||||||
"url": f"{base_url}{name}",
|
"url": f"{base_url}{name}",
|
||||||
"invoke_count": http_function['invoked_count'],
|
"invoked_count": http_function['invoked_count'],
|
||||||
"environment_info": http_function['environment_info']
|
"environment_info": http_function['environment_info']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,12 @@
|
|||||||
{% for function in http_functions %}
|
{% for function in http_functions %}
|
||||||
<tr class="border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted" data-id="63">
|
<tr class="border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted" data-id="63">
|
||||||
<td class="p-4 align-middle [&:has([role=checkbox])]:pr-0 font-medium cursor-pointer"
|
<td class="p-4 align-middle [&:has([role=checkbox])]:pr-0 font-medium cursor-pointer"
|
||||||
data-id="66">{{ function.name }}</td>
|
data-id="66">{{ function.name }}
|
||||||
|
<span
|
||||||
|
class="inline-flex items-center justify-center w-4 h-4 ms-2 text-xs font-semibold text-blue-800 bg-blue-200 rounded-full">
|
||||||
|
{{ function.invoked_count }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
<td class="p-4 align-middle [&:has([role=checkbox])]:pr-0 hidden md:table-cell" data-id="67">
|
<td class="p-4 align-middle [&:has([role=checkbox])]:pr-0 hidden md:table-cell" data-id="67">
|
||||||
<a href="{{ function.url }}">{{ function.url }}</a>
|
<a href="{{ function.url }}">{{ function.url }}</a>
|
||||||
<button
|
<button
|
||||||
|
|||||||
Reference in New Issue
Block a user