Skip to content

Commit

Permalink
fix(BenchApps): show version/commit
Browse files Browse the repository at this point in the history
  • Loading branch information
BreadGenie committed Jun 7, 2024
1 parent 630f988 commit 9a8988e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
9 changes: 9 additions & 0 deletions dashboard/src2/objects/bench.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,15 @@ export default {
return `${row.repository_url}/tree/${value}`;
}
},
{
label: 'Version',
type: 'Badge',
fieldname: 'tag',
width: 1,
format(value, row) {
return value || row.hash?.slice(0, 7);
}
},
{
label: 'Status',
type: 'Badge',
Expand Down
25 changes: 25 additions & 0 deletions press/api/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,12 +391,35 @@ def apps(name):
deployed_apps = unique(deployed_apps)
updates = deploy_information(name)

latest_bench = frappe.get_all(
"Bench",
filters={"group": group.name, "status": "Active"},
order_by="creation desc",
limit=1,
pluck="name",
)
if latest_bench:
latest_bench = latest_bench[0]
else:
latest_bench = None

latest_deployed_apps = frappe.get_all(
"Bench",
filters={"name": latest_bench},
fields=["`tabBench App`.app", "`tabBench App`.hash"],
)

for app in group.apps:
source = frappe.get_doc("App Source", app.source)
app = frappe.get_doc("App", app.app)
update_available = updates["update_available"] and find(
updates.apps, lambda x: x["app"] == app.name and x["update_available"]
)

latest_deployed_app = find(latest_deployed_apps, lambda x: x.app == app.name)
hash = latest_deployed_app.hash if latest_deployed_app else None
tag = get_app_tag(source.repository, source.repository_owner, hash)

apps.append(
{
"name": app.name,
Expand All @@ -406,6 +429,8 @@ def apps(name):
"repository_url": source.repository_url,
"repository": source.repository,
"repository_owner": source.repository_owner,
"tag": tag,
"hash": hash,
"deployed": app.name in deployed_apps,
"update_available": bool(update_available),
"last_github_poll_failed": source.last_github_poll_failed,
Expand Down

0 comments on commit 9a8988e

Please sign in to comment.