diff --git a/commit/api/api_explorer.py b/commit/api/api_explorer.py
index 82e88da..ef457cb 100644
--- a/commit/api/api_explorer.py
+++ b/commit/api/api_explorer.py
@@ -13,7 +13,6 @@ def get_apis_for_project(project_branch: str):
apis = json.loads(branch_doc.whitelisted_apis).get("apis", []) if branch_doc.whitelisted_apis else []
documentation = json.loads(branch_doc.documentation).get("apis", []) if branch_doc.documentation else []
- print('documentation', len(documentation))
for api in apis:
# find the documentation for the api whose function_name equals to name and path same as path
for doc in documentation:
@@ -33,7 +32,8 @@ def get_apis_for_project(project_branch: str):
"org_logo": org_logo,
"branch_name": branch_doc.branch_name,
"project_branch": branch_doc.name,
- "last_updated": branch_doc.last_fetched
+ "last_updated": branch_doc.last_fetched,
+ 'path_to_folder':branch_doc.path_to_folder
}
diff --git a/commit/api/get_commands.py b/commit/api/get_commands.py
new file mode 100644
index 0000000..218a4ec
--- /dev/null
+++ b/commit/api/get_commands.py
@@ -0,0 +1,70 @@
+import importlib
+import sys
+import traceback
+import os
+import frappe
+from frappe.utils.bench_helper import get_app_commands
+
+@frappe.whitelist(allow_guest=True)
+def get_project_app_commands(app: str, app_path: str = None) -> dict:
+ '''
+ Gets the commands for the app
+ '''
+ if not app_path or app_path == '':
+ # Check the permissions of the user
+ if not frappe.has_permission('System Manager'):
+ return frappe.throw('You do not have permission to access this resource', frappe.PermissionError)
+ return get_site_app_commands(app)
+ else:
+ ret = []
+ try:
+ if app_path:
+ # Add the app's directory to the Python path
+ sys.path.append(app_path)
+
+ app_command_module = importlib.import_module(f"{app}.commands")
+ except ModuleNotFoundError as e:
+ if e.name == f"{app}.commands":
+ return ret
+ traceback.print_exc()
+ return ret
+ except Exception:
+ traceback.print_exc()
+ return ret
+ finally:
+ if app_path:
+ # Remove the app's directory from the Python path to avoid side effects
+ sys.path.remove(app_path)
+
+ command_list = []
+ if hasattr(app_command_module, 'get_commands') and callable(getattr(app_command_module, 'get_commands')):
+ commands_from_function = app_command_module.get_commands()
+ if commands_from_function:
+ for command_instance in commands_from_function:
+ help_text = getattr(command_instance, 'help', 'No help text available')
+ name = getattr(command_instance, 'name', [])
+ obj = {
+ 'name': name,
+ 'help': help_text
+ }
+ command_list.append(obj)
+ return command_list
+
+@frappe.whitelist()
+def get_site_app_commands(app: str) -> dict:
+ app_command_module = importlib.import_module(f"{app}.commands")
+ # Call get_commands if it is a callable
+
+ command_list = []
+ if hasattr(app_command_module, 'get_commands') and callable(getattr(app_command_module, 'get_commands')):
+ commands_from_function = app_command_module.get_commands()
+ if commands_from_function:
+ for command_instance in commands_from_function:
+ help_text = getattr(command_instance, 'help', 'No help text available')
+ name = getattr(command_instance, 'name', [])
+ obj = {
+ 'name': name,
+ 'help': help_text
+ }
+ command_list.append(obj)
+ return command_list
diff --git a/dashboard/src/components/common/ErrorBanner/ErrorBanner.tsx b/dashboard/src/components/common/ErrorBanner/ErrorBanner.tsx
index 0bf5f3a..597b251 100644
--- a/dashboard/src/components/common/ErrorBanner/ErrorBanner.tsx
+++ b/dashboard/src/components/common/ErrorBanner/ErrorBanner.tsx
@@ -102,7 +102,7 @@ export const ErrorBanner = ({ error, overrideHeading, ...props }: ErrorBannerPro
// TODO: Sometimes, error message has links which route to the ERPNext interface. We need to parse the link to route to the correct page in our interface
// Links are of format LEAD-00001
-
+ if (!error) return null
return (
+ )
+}
\ No newline at end of file
diff --git a/dashboard/src/components/features/meta_apps/YourAppAPIExplorer.tsx b/dashboard/src/components/features/meta_apps/YourAppAPIExplorer.tsx
index ed77efa..05aa70c 100644
--- a/dashboard/src/components/features/meta_apps/YourAppAPIExplorer.tsx
+++ b/dashboard/src/components/features/meta_apps/YourAppAPIExplorer.tsx
@@ -33,12 +33,11 @@ export const YourAppAPIExplorer = () => {
- Explore your API's
+ Explore your API's and Bench Commands
- Explore and interact with your site installed apps whitelisted API's effortlessly
- using our API Explorer.
+ Effortlessly explore and interact with the whitelisted API's and Bench commands of your site's installed apps using our API Explorer.
- Explore your API's
+ Explore your API's and Bench Commands
- Explore and interact with your whitelisted API's effortlessly
- using our API Explorer.
+ Effortlessly explore and interact with your whitelisted API's and Bench commands using our API Explorer.