diff --git a/crm/www/crm.py b/crm/www/crm.py index c630506f..94f8142a 100644 --- a/crm/www/crm.py +++ b/crm/www/crm.py @@ -1,8 +1,10 @@ # Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors # GNU GPLv3 License. See license.txt - +import os +import subprocess import frappe +from frappe import safe_decode from frappe.integrations.frappe_providers.frappecloud_billing import is_fc_site from frappe.utils import cint, get_system_timezone from frappe.utils.telemetry import capture @@ -43,9 +45,41 @@ def get_boot(): "user": frappe.db.get_value("User", frappe.session.user, "time_zone") or get_system_timezone(), }, + "app_version": get_app_version(), } ) def get_default_route(): return "/crm" + + +def get_app_version(): + app = "crm" + branch = run_git_command(f"cd ../apps/{app} && git rev-parse --abbrev-ref HEAD") + commit = run_git_command(f"git -C ../apps/{app} rev-parse --short=7 HEAD") + tag = run_git_command(f"git -C ../apps/{app} describe --tags --abbrev=0") + dirty = run_git_command(f"git -C ../apps/{app} diff --quiet || echo 'dirty'") == "dirty" + commit_date = run_git_command(f"git -C ../apps/{app} log -1 --format=%cd") + commit_message = run_git_command(f"git -C ../apps/{app} log -1 --pretty=%B") + + return { + "branch": branch, + "commit": commit, + "commit_date": commit_date, + "commit_message": commit_message, + "tag": tag, + "dirty": dirty, + } + + +def run_git_command(command): + try: + with open(os.devnull, "wb") as null_stream: + result = subprocess.check_output(command, shell=True, stdin=null_stream, stderr=null_stream) + return safe_decode(result).strip() + except Exception: + frappe.log_error( + title="Git Command Error", + ) + return "" diff --git a/frontend/components.d.ts b/frontend/components.d.ts index 29a6ae9c..c83cddab 100644 --- a/frontend/components.d.ts +++ b/frontend/components.d.ts @@ -8,6 +8,7 @@ export {} /* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { + AboutModal: typeof import('./src/components/Modals/AboutModal.vue')['default'] Activities: typeof import('./src/components/Activities/Activities.vue')['default'] ActivityHeader: typeof import('./src/components/Activities/ActivityHeader.vue')['default'] ActivityIcon: typeof import('./src/components/Icons/ActivityIcon.vue')['default'] @@ -151,7 +152,9 @@ declare module 'vue' { ListRows: typeof import('./src/components/ListViews/ListRows.vue')['default'] LoadingIndicator: typeof import('./src/components/Icons/LoadingIndicator.vue')['default'] LucideCalendar: typeof import('~icons/lucide/calendar')['default'] + LucideInfo: typeof import('~icons/lucide/info')['default'] LucidePlus: typeof import('~icons/lucide/plus')['default'] + LucideSearch: typeof import('~icons/lucide/search')['default'] MarkAsDoneIcon: typeof import('./src/components/Icons/MarkAsDoneIcon.vue')['default'] MaximizeIcon: typeof import('./src/components/Icons/MaximizeIcon.vue')['default'] MenuIcon: typeof import('./src/components/Icons/MenuIcon.vue')['default'] @@ -221,6 +224,7 @@ declare module 'vue' { TaskPriorityIcon: typeof import('./src/components/Icons/TaskPriorityIcon.vue')['default'] TasksListView: typeof import('./src/components/ListViews/TasksListView.vue')['default'] TaskStatusIcon: typeof import('./src/components/Icons/TaskStatusIcon.vue')['default'] + TelegramIcon: typeof import('./src/components/Icons/TelegramIcon.vue')['default'] TelephonySettings: typeof import('./src/components/Settings/TelephonySettings.vue')['default'] TerritoryIcon: typeof import('./src/components/Icons/TerritoryIcon.vue')['default'] TwilioCallUI: typeof import('./src/components/Telephony/TwilioCallUI.vue')['default'] diff --git a/frontend/src/components/Icons/TelegramIcon.vue b/frontend/src/components/Icons/TelegramIcon.vue new file mode 100644 index 00000000..e05ebbd6 --- /dev/null +++ b/frontend/src/components/Icons/TelegramIcon.vue @@ -0,0 +1,21 @@ + diff --git a/frontend/src/components/Modals/AboutModal.vue b/frontend/src/components/Modals/AboutModal.vue new file mode 100644 index 00000000..b118d3f4 --- /dev/null +++ b/frontend/src/components/Modals/AboutModal.vue @@ -0,0 +1,100 @@ + +