Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
678 changes: 586 additions & 92 deletions benchmate/api/sync.py

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions benchmate/benchmate/doctype/bm_app/bm_app.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"table_fieldname": "installed_apps"
}
],
"modified": "2025-08-17 20:10:20.850577",
"modified": "2025-08-18 01:17:04.908817",
"modified_by": "Administrator",
"module": "BenchMate",
"name": "BM App",
Expand All @@ -89,5 +89,6 @@
"sort_field": "creation",
"sort_order": "DESC",
"states": [],
"title_field": "app_title"
"title_field": "app_title",
"track_changes": 1
}
19 changes: 16 additions & 3 deletions benchmate/benchmate/doctype/bm_bench/bm_bench.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"section_break_gudv",
"installed_apps",
"section_break_vxsq",
"description"
"description",
"section_break_oxtw",
"error_message"
],
"fields": [
{
Expand Down Expand Up @@ -82,6 +84,16 @@
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Branch"
},
{
"fieldname": "section_break_oxtw",
"fieldtype": "Section Break"
},
{
"depends_on": "eval:doc.status===\"Error\";",
"fieldname": "error_message",
"fieldtype": "Long Text",
"label": "Error Message"
}
],
"grid_page_length": 50,
Expand All @@ -93,7 +105,7 @@
"link_fieldname": "bench_name"
}
],
"modified": "2025-08-17 21:32:33.248615",
"modified": "2025-08-18 01:17:09.426283",
"modified_by": "Administrator",
"module": "BenchMate",
"name": "BM Bench",
Expand Down Expand Up @@ -133,5 +145,6 @@
"color": "Red",
"title": "Error"
}
]
],
"track_changes": 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"options": "BM App"
},
{
"fetch_from": "app_name.app_title",
"fieldname": "app_title",
"fieldtype": "Data",
"in_list_view": 1,
Expand All @@ -42,7 +41,6 @@
"label": "Version"
},
{
"fetch_from": "app_name.link",
"fieldname": "link",
"fieldtype": "Data",
"in_list_view": 1,
Expand All @@ -63,7 +61,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2025-08-17 21:44:59.925833",
"modified": "2025-08-18 01:17:56.627642",
"modified_by": "Administrator",
"module": "BenchMate",
"name": "BM Installed Apps",
Expand Down
45 changes: 41 additions & 4 deletions benchmate/benchmate/doctype/bm_settings/bm_settings.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,45 @@
// Copyright (c) 2025, Karan Mistry and contributors
// For license information, please see license.txt

// frappe.ui.form.on("BM Settings", {
// refresh(frm) {
frappe.ui.form.on("BM Settings", {
refresh(frm) {
// ? Add the "Sync Bench Details" button when the form is refreshed
addSyncBenchDetailsButton(frm);
},
});

// },
// });
function addSyncBenchDetailsButton(frm) {
// ? Check if the BM Settings document has syncing enabled
if (frm.doc.enable) {
// ? Add custom button to trigger bench details sync
frm.add_custom_button("Sync Bench Details", () => {
enqueueSyncBenchDetailsButton();
});
}
}

function enqueueSyncBenchDetailsButton() {
// ? Call Frappe backend method to enqueue sync
frappe.call({
method: "benchmate.api.sync.enqueue_sync_bench_details",
args: {},

// ? Freeze the UI with message while processing
freeze: true,
freeze_message: "Enqueuing Sync Bench Details...",

// ? Callback when backend call is complete
callback: function (res) {
// ? If enqueue was successful, show a success alert
if (res.message.success) {
frappe.show_alert(
{
message: __("Successfully Enqueued Sync Bench Details!"),
indicator: "green",
},
5
);
}
},
});
}
5 changes: 3 additions & 2 deletions benchmate/benchmate/doctype/bm_site/bm_site.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"grid_page_length": 50,
"index_web_pages_for_search": 1,
"links": [],
"modified": "2025-08-17 20:11:26.287364",
"modified": "2025-08-18 01:17:13.172040",
"modified_by": "Administrator",
"module": "BenchMate",
"name": "BM Site",
Expand Down Expand Up @@ -120,5 +120,6 @@
"title": "Error"
}
],
"title_field": "site_name"
"title_field": "site_name",
"track_changes": 1
}
Empty file.
8 changes: 8 additions & 0 deletions benchmate/benchmate/doctype/bm_sync_log/bm_sync_log.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) 2025, Karan Mistry and contributors
// For license information, please see license.txt

// frappe.ui.form.on("BM Sync Log", {
// refresh(frm) {

// },
// });
90 changes: 90 additions & 0 deletions benchmate/benchmate/doctype/bm_sync_log/bm_sync_log.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"actions": [],
"allow_rename": 1,
"autoname": "format:BM-SL-{#}",
"creation": "2025-08-18 01:20:36.254906",
"doctype": "DocType",
"engine": "MyISAM",
"field_order": [
"title",
"column_break_nerx",
"status",
"section_break_djza",
"log"
],
"fields": [
{
"fieldname": "title",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Title",
"read_only": 1
},
{
"fieldname": "log",
"fieldtype": "Long Text",
"in_list_view": 1,
"label": "Log",
"read_only": 1
},
{
"default": "Log",
"fieldname": "status",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Status",
"options": "\nError\nSuccess\nLog",
"read_only": 1
},
{
"fieldname": "column_break_nerx",
"fieldtype": "Column Break"
},
{
"fieldname": "section_break_djza",
"fieldtype": "Section Break"
}
],
"grid_page_length": 50,
"index_web_pages_for_search": 1,
"links": [],
"modified": "2025-08-18 02:47:10.030458",
"modified_by": "Administrator",
"module": "BenchMate",
"name": "BM Sync Log",
"naming_rule": "Expression",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"row_format": "Dynamic",
"sort_field": "creation",
"sort_order": "DESC",
"states": [
{
"color": "Red",
"title": "Error"
},
{
"color": "Green",
"title": "Success"
},
{
"color": "Blue",
"title": "Log"
}
],
"title_field": "title",
"track_seen": 1
}
9 changes: 9 additions & 0 deletions benchmate/benchmate/doctype/bm_sync_log/bm_sync_log.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2025, Karan Mistry and contributors
# For license information, please see license.txt

# import frappe
from frappe.model.document import Document


class BMSyncLog(Document):
pass
20 changes: 20 additions & 0 deletions benchmate/benchmate/doctype/bm_sync_log/test_bm_sync_log.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright (c) 2025, Karan Mistry and Contributors
# See license.txt

# import frappe
from frappe.tests import IntegrationTestCase

# On IntegrationTestCase, the doctype test records and all
# link-field test record dependencies are recursively loaded
# Use these module variables to add/remove to/from that list
EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]
IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]


class IntegrationTestBMSyncLog(IntegrationTestCase):
"""
Integration tests for BMSyncLog.
Use this class for testing interactions between multiple components.
"""

pass
2 changes: 1 addition & 1 deletion benchmate/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
# ------------

# before_install = "benchmate.install.before_install"
# after_install = "benchmate.install.after_install"
after_install = "benchmate.api.sync.after_install"

# Uninstallation
# ------------
Expand Down