diff --git a/frontend/src/views/applications/ApplicationDetail.vue b/frontend/src/views/applications/ApplicationDetail.vue
index 180bb46..1f93ab3 100644
--- a/frontend/src/views/applications/ApplicationDetail.vue
+++ b/frontend/src/views/applications/ApplicationDetail.vue
@@ -93,6 +93,23 @@
+
+
+
+
Knowledge Base ({{ app.knowledgebase.length }})
+
+
diff --git a/shopdb/core/api/applications.py b/shopdb/core/api/applications.py
index ed0c05d..8e4d1ba 100644
--- a/shopdb/core/api/applications.py
+++ b/shopdb/core/api/applications.py
@@ -40,6 +40,19 @@ def _installed_count(appid):
return ComputerInstalledApp.query.filter_by(appid=appid, isactive=True).count()
+def _related_kb(appid):
+ """Knowledge Base articles linked to this app, [] when the KB plugin is
+ absent. Lazy + guarded so core stays decoupled from the plugin."""
+ try:
+ from plugins.knowledgebase.models import KnowledgeBase
+ except ImportError:
+ return []
+ rows = KnowledgeBase.query.filter_by(appid=appid, isactive=True).order_by(
+ KnowledgeBase.shortdescription).all()
+ return [{'linkid': k.linkid, 'shortdescription': k.shortdescription,
+ 'linkurl': k.linkurl, 'keywords': k.keywords} for k in rows]
+
+
def _require_computer_models():
"""Resolve (Computer, ComputerInstalledApp) or a 503 response tuple.
@@ -116,6 +129,7 @@ def get_application(app_id: int):
data = app.to_dict()
data['versions'] = [v.to_dict() for v in app.versions.filter_by(isactive=True).order_by(AppVersion.version.desc()).all()]
data['installedcount'] = _installed_count(app.appid)
+ data['knowledgebase'] = _related_kb(app.appid)
return success_response(data)