diff --git a/app.py b/app.py index c5fc304..e7b97c8 100644 --- a/app.py +++ b/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_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 flask_response = map_isolator_response_to_flask_response(response_data) diff --git a/db.py b/db.py index fab026c..a822d73 100644 --- a/db.py +++ b/db.py @@ -64,9 +64,9 @@ class DataBase(): self.execute( '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( - '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): self.execute( diff --git a/services.py b/services.py index 5c71bbd..d8fb311 100644 --- a/services.py +++ b/services.py @@ -8,7 +8,7 @@ def create_http_function_view_model(http_function): "name": name, "script_content": http_function['script_content'], "url": f"{base_url}{name}", - "invoke_count": http_function['invoked_count'], + "invoked_count": http_function['invoked_count'], "environment_info": http_function['environment_info'] } diff --git a/templates/dashboard/http_functions.html b/templates/dashboard/http_functions.html index 5befef5..f5b0d56 100644 --- a/templates/dashboard/http_functions.html +++ b/templates/dashboard/http_functions.html @@ -23,7 +23,12 @@ {% for function in http_functions %} {{ function.name }} + data-id="66">{{ function.name }} + + {{ function.invoked_count }} + + {{ function.url }}