From 573765d51e9f80d8b1f51f69d21896ae6db3533e Mon Sep 17 00:00:00 2001 From: cclohmar Date: Wed, 15 Jul 2026 21:57:52 +0000 Subject: [PATCH] feat: add Service Factory app icon to desk grid - Added add_to_apps_screen hook in hooks.py with custom icon - Created service_factory SVG icon (blue rounded square) - Added permission check module (api/permission.py) - Assets symlink instruction in deploy README - Icon accessible at /assets/service_factory/icons/service_factory.svg --- deploy/README.md | 8 ++++++++ service_factory/api/__init__.py | 0 service_factory/api/permission.py | 13 +++++++++++++ service_factory/hooks.py | 18 +++++++++--------- .../public/icons/service_factory.svg | 10 ++++++++++ 5 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 service_factory/api/__init__.py create mode 100644 service_factory/api/permission.py create mode 100644 service_factory/public/icons/service_factory.svg diff --git a/deploy/README.md b/deploy/README.md index 568ac2e..8778e93 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -39,6 +39,14 @@ sudo systemctl enable frappe-bench.target sudo systemctl start frappe-bench.target ``` +### Assets Symlink + +After installing the app, create the assets symlink for custom icons: + +```bash +sudo ln -sf /opt/erpnext/frappe-bench/apps/service_factory/service_factory/public /opt/erpnext/frappe-bench/sites/assets/service_factory +``` + ### Credentials Admin credentials are stored in `/root/erpnext-admin-credentials.txt`. diff --git a/service_factory/api/__init__.py b/service_factory/api/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/service_factory/api/permission.py b/service_factory/api/permission.py new file mode 100644 index 0000000..5013202 --- /dev/null +++ b/service_factory/api/permission.py @@ -0,0 +1,13 @@ +# Copyright (c) 2026, cclohmar and contributors +# For license information, please see license.txt + + +def has_app_permission(): + """Check if the current user has permission to see the Service Factory app icon.""" + import frappe + + # All authenticated users with at least one role can see the app icon + if frappe.session.user == "Guest": + return False + + return True diff --git a/service_factory/hooks.py b/service_factory/hooks.py index 091726e..eb34b25 100644 --- a/service_factory/hooks.py +++ b/service_factory/hooks.py @@ -11,15 +11,15 @@ app_license = "mit" # required_apps = [] # Each item in the list will be shown as an app in the apps page -# add_to_apps_screen = [ -# { -# "name": "service_factory", -# "logo": "/assets/service_factory/logo.png", -# "title": "Service Factory", -# "route": "/service_factory", -# "has_permission": "service_factory.api.permission.has_app_permission" -# } -# ] +add_to_apps_screen = [ + { + "name": "service_factory", + "logo": "/assets/service_factory/icons/service_factory.svg", + "title": "Service Factory", + "route": "/app/engineer-workspace", + "has_permission": "service_factory.api.permission.has_app_permission" + } +] # Includes in # ------------------ diff --git a/service_factory/public/icons/service_factory.svg b/service_factory/public/icons/service_factory.svg new file mode 100644 index 0000000..1767ccc --- /dev/null +++ b/service_factory/public/icons/service_factory.svg @@ -0,0 +1,10 @@ + + + + + + + + + SF +