feat: add status endpoint, hide FAB/dashlet when integration disabled
This commit is contained in:
@@ -158,10 +158,22 @@ define('modules/smart-assistant/views/floating-chat', ['view'], function (View)
|
||||
},
|
||||
|
||||
afterRender: function () {
|
||||
this.$el.find('.sa-chat-messages').attr('data-empty-text',
|
||||
this.translate('Chat with the assistant', 'labels', 'SmartAssistant') || 'שוחח/י עם העוזר החכם');
|
||||
this.loadAlertCount();
|
||||
this._setupRouteListener();
|
||||
var self = this;
|
||||
|
||||
Espo.Ajax.getRequest('SmartAssistant/action/status').then(function (result) {
|
||||
if (!result.enabled) {
|
||||
self.$el.find('.sa-fab').hide();
|
||||
return;
|
||||
}
|
||||
|
||||
self.$el.find('.sa-fab').show();
|
||||
self.$el.find('.sa-chat-messages').attr('data-empty-text',
|
||||
self.translate('Chat with the assistant', 'labels', 'SmartAssistant') || 'שוחח/י עם העוזר החכם');
|
||||
self.loadAlertCount();
|
||||
self._setupRouteListener();
|
||||
}).catch(function () {
|
||||
self.$el.find('.sa-fab').hide();
|
||||
});
|
||||
},
|
||||
|
||||
_setupRouteListener: function () {
|
||||
|
||||
Reference in New Issue
Block a user