feat: add status endpoint, hide FAB/dashlet when integration disabled

This commit is contained in:
2026-03-31 23:10:33 +00:00
parent 49c42e3d20
commit 0157b31249
@@ -25,7 +25,19 @@ define('modules/smart-assistant/views/dashlets/smart-assistant', ['view'], funct
this._alerts = [];
this._summary = {};
this._activeType = null;
this.loadSummary();
var self = this;
Espo.Ajax.getRequest('SmartAssistant/action/status').then(function (result) {
if (!result.enabled) {
self.$el.find('.sa-dashlet-cards').html(
'<div style="text-align: center; color: #999; padding: 20px; font-size: 13px;">שירה לא מופעלת. הפעל ב-Admin &gt; Integrations &gt; Smart Assistant</div>'
);
return;
}
self.loadSummary();
}).catch(function () {
self.loadSummary();
});
},
loadSummary: function () {
@@ -65,6 +77,7 @@ define('modules/smart-assistant/views/dashlets/smart-assistant', ['view'], funct
var $detail = this.$el.find('.sa-dashlet-detail');
if (!type || type === this._activeType && $detail.html()) {
// Toggle off
this._activeType = null;
$detail.html('');
this.renderCards(this._summary);