mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-24 02:04:04 +08:00
style changes and only show the icon if the user has activated the communication app inside of user-preferences
This commit is contained in:
@@ -48,7 +48,7 @@ var PageLayoutView = Backbone.View.extend( BaseMVC.LoggableMixin ).extend({
|
||||
this.renderMessageBox();
|
||||
this.renderInactivityBox();
|
||||
this.renderPanels();
|
||||
this._checkChatServerOnline();
|
||||
this._checkCommunicationServerOnline();
|
||||
return this;
|
||||
},
|
||||
|
||||
@@ -134,28 +134,32 @@ var PageLayoutView = Backbone.View.extend( BaseMVC.LoggableMixin ).extend({
|
||||
|
||||
toString : function() { return 'PageLayoutView'; },
|
||||
|
||||
/** Check if the chat server is online and show icon otherwise hide it chat */
|
||||
_checkChatServerOnline: function(){
|
||||
var host = window.Galaxy.config.communication_server_host,
|
||||
port = window.Galaxy.config.communication_server_port,
|
||||
$chat_icon_element = $( "#show-chat-online" );
|
||||
// ping the server whether it is online
|
||||
$.ajax({
|
||||
url: host + ":" + port,
|
||||
})
|
||||
.success( function( data ) {
|
||||
// enable chat only when a user is logged in
|
||||
if( window.Galaxy.user.id !== null ) {
|
||||
if( $chat_icon_element.css( "visibility") === "hidden" ) {
|
||||
$chat_icon_element.css( "visibility", "visible" );
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
.error( function( data ) {
|
||||
// makes the chat icon hidden if chat server is not up
|
||||
$chat_icon_element.css( "visibility", "hidden" );
|
||||
});
|
||||
/** Check if the communication server is online and show the icon otherwise hide the icon */
|
||||
_checkCommunicationServerOnline: function(){
|
||||
/** Check if the user has deactivated the communication in it's personal settings */
|
||||
if (Galaxy.user.attributes.preferences.communication_server === '1') {
|
||||
var host = window.Galaxy.config.communication_server_host,
|
||||
port = window.Galaxy.config.communication_server_port,
|
||||
$chat_icon_element = $( "#show-chat-online" );
|
||||
// See if the configured communication server is available
|
||||
$.ajax({
|
||||
url: host + ":" + port,
|
||||
})
|
||||
.success( function( data ) {
|
||||
// enable chat only when a user is logged in
|
||||
if( window.Galaxy.user.id !== null ) {
|
||||
if( $chat_icon_element.css( "visibility") === "hidden" ) {
|
||||
$chat_icon_element.css( "visibility", "visible" );
|
||||
}
|
||||
}
|
||||
})
|
||||
.error( function( data ) {
|
||||
// hide the communication icon if the chat server is not available
|
||||
$chat_icon_element.css( "visibility", "hidden" );
|
||||
});
|
||||
} else {
|
||||
$chat_icon_element.css( "visibility", "hidden" );
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user