feat: add status endpoint, hide FAB/dashlet when integration disabled
This commit is contained in:
@@ -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 > Integrations > 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);
|
||||
|
||||
Reference in New Issue
Block a user