Fix placement of disconnection tip

This commit is contained in:
Julia Radzhabova 2021-12-14 00:07:24 +03:00
parent 6e28d2778f
commit e5c0eef2a8
7 changed files with 35 additions and 14 deletions

View file

@ -956,6 +956,7 @@ define([
setLongActionView: function(action) { setLongActionView: function(action) {
var title = '', text = '', force = false; var title = '', text = '', force = false;
var statusCallback = null; // call after showing status
switch (action.id) { switch (action.id) {
case Asc.c_oAscAsyncAction['Open']: case Asc.c_oAscAsyncAction['Open']:
@ -1044,7 +1045,10 @@ define([
case Asc.c_oAscAsyncAction['Disconnect']: case Asc.c_oAscAsyncAction['Disconnect']:
text = this.textDisconnect; text = this.textDisconnect;
this.disableEditing(true, true); this.disableEditing(true, true);
this.getApplication().getController('Statusbar').showDisconnectTip(); var me = this;
statusCallback = function() {
me.getApplication().getController('Statusbar').showDisconnectTip();
};
break; break;
default: default:
@ -1064,7 +1068,7 @@ define([
if (!this.isShowOpenDialog) if (!this.isShowOpenDialog)
this.loadMask.show(action.id===Asc.c_oAscAsyncAction['Open']); this.loadMask.show(action.id===Asc.c_oAscAsyncAction['Open']);
} else { } else {
this.getApplication().getController('Statusbar').setStatusCaption(text, force); this.getApplication().getController('Statusbar').setStatusCaption(text, force, 0, statusCallback);
} }
}, },

View file

@ -251,13 +251,14 @@ define([
this.statusbar.reloadLanguages(langs); this.statusbar.reloadLanguages(langs);
}, },
setStatusCaption: function(text, force, delay) { setStatusCaption: function(text, force, delay, callback) {
if (this.timerCaption && ( ((new Date()) < this.timerCaption) || text.length==0 ) && !force ) if (this.timerCaption && ( ((new Date()) < this.timerCaption) || text.length==0 ) && !force )
return; return;
this.timerCaption = undefined; this.timerCaption = undefined;
if (text.length) { if (text.length) {
this.statusbar.showStatusMessage(text); this.statusbar.showStatusMessage(text);
callback && callback();
if (delay>0) if (delay>0)
this.timerCaption = (new Date()).getTime() + delay; this.timerCaption = (new Date()).getTime() + delay;
} else } else
@ -309,8 +310,10 @@ define([
showDisconnectTip: function () { showDisconnectTip: function () {
var me = this; var me = this;
if (!this.disconnectTip) { if (!this.disconnectTip) {
var target = this.statusbar.getStatusLabel();
target = target.is(':visible') ? target.parent() : this.statusbar.isVisible() ? this.statusbar.$el : $(document.body);
this.disconnectTip = new Common.UI.SynchronizeTip({ this.disconnectTip = new Common.UI.SynchronizeTip({
target : this.statusbar.isVisible() ? this.statusbar.getStatusLabel().parent() : $(document.body), target : target,
text : this.textDisconnect, text : this.textDisconnect,
placement: 'top', placement: 'top',
position: this.statusbar.isVisible() ? undefined : {bottom: 0}, position: this.statusbar.isVisible() ? undefined : {bottom: 0},

View file

@ -632,6 +632,7 @@ define([
setLongActionView: function(action) { setLongActionView: function(action) {
var title = '', text = '', force = false; var title = '', text = '', force = false;
var statusCallback = null; // call after showing status
switch (action.id) { switch (action.id) {
case Asc.c_oAscAsyncAction['Open']: case Asc.c_oAscAsyncAction['Open']:
@ -713,7 +714,10 @@ define([
case Asc.c_oAscAsyncAction['Disconnect']: case Asc.c_oAscAsyncAction['Disconnect']:
text = this.textDisconnect; text = this.textDisconnect;
this.disableEditing(true, true); this.disableEditing(true, true);
this.getApplication().getController('Statusbar').showDisconnectTip(); var me = this;
statusCallback = function() {
me.getApplication().getController('Statusbar').showDisconnectTip();
};
break; break;
default: default:
@ -733,7 +737,7 @@ define([
if (!this.isShowOpenDialog) if (!this.isShowOpenDialog)
this.loadMask.show(action.id===Asc.c_oAscAsyncAction['Open']); this.loadMask.show(action.id===Asc.c_oAscAsyncAction['Open']);
} else { } else {
this.getApplication().getController('Statusbar').setStatusCaption(text, force); this.getApplication().getController('Statusbar').setStatusCaption(text, force, 0, statusCallback);
} }
}, },

View file

@ -205,13 +205,14 @@ define([
this.statusbar.reloadLanguages(langs); this.statusbar.reloadLanguages(langs);
}, },
setStatusCaption: function(text, force, delay) { setStatusCaption: function(text, force, delay, callback) {
if (this.timerCaption && ( ((new Date()) < this.timerCaption) || text.length==0 ) && !force ) if (this.timerCaption && ( ((new Date()) < this.timerCaption) || text.length==0 ) && !force )
return; return;
this.timerCaption = undefined; this.timerCaption = undefined;
if (text.length) { if (text.length) {
this.statusbar.showStatusMessage(text); this.statusbar.showStatusMessage(text);
callback && callback();
if (delay>0) if (delay>0)
this.timerCaption = (new Date()).getTime() + delay; this.timerCaption = (new Date()).getTime() + delay;
} else } else
@ -229,8 +230,10 @@ define([
showDisconnectTip: function () { showDisconnectTip: function () {
var me = this; var me = this;
if (!this.disconnectTip) { if (!this.disconnectTip) {
var target = this.statusbar.getStatusLabel();
target = target.is(':visible') ? target.parent() : this.statusbar.isVisible() ? this.statusbar.$el : $(document.body);
this.disconnectTip = new Common.UI.SynchronizeTip({ this.disconnectTip = new Common.UI.SynchronizeTip({
target : this.statusbar.isVisible() ? this.statusbar.getStatusLabel().parent() : $(document.body), target : target,
text : this.textDisconnect, text : this.textDisconnect,
placement: 'top', placement: 'top',
position: this.statusbar.isVisible() ? undefined : {bottom: 0}, position: this.statusbar.isVisible() ? undefined : {bottom: 0},

View file

@ -713,6 +713,7 @@ define([
setLongActionView: function(action) { setLongActionView: function(action) {
var title = '', text = '', force = false; var title = '', text = '', force = false;
var statusCallback = null; // call after showing status
switch (action.id) { switch (action.id) {
case Asc.c_oAscAsyncAction.Open: case Asc.c_oAscAsyncAction.Open:
@ -788,7 +789,10 @@ define([
title = this.textDisconnect; title = this.textDisconnect;
text = this.textDisconnect; text = this.textDisconnect;
this.disableEditing(true, true); this.disableEditing(true, true);
this.getApplication().getController('Statusbar').showDisconnectTip(); var me = this;
statusCallback = function() {
me.getApplication().getController('Statusbar').showDisconnectTip();
};
break; break;
default: default:
@ -808,7 +812,7 @@ define([
this.loadMask.show(); this.loadMask.show();
} }
} else { } else {
this.getApplication().getController('Statusbar').setStatusCaption(text, force); this.getApplication().getController('Statusbar').setStatusCaption(text, force, 0, statusCallback);
} }
}, },

View file

@ -788,13 +788,13 @@ define([
Common.NotificationCenter.trigger('edit:complete', this.statusbar); Common.NotificationCenter.trigger('edit:complete', this.statusbar);
}, },
setStatusCaption: function(text, force, delay) { setStatusCaption: function(text, force, delay, callback) {
if (this.timerCaption && ( ((new Date()) < this.timerCaption) || text.length==0 ) && !force ) if (this.timerCaption && ( ((new Date()) < this.timerCaption) || text.length==0 ) && !force )
return; return;
this.timerCaption = undefined; this.timerCaption = undefined;
if (text.length) { if (text.length) {
this.statusbar.showStatusMessage(text); this.statusbar.showStatusMessage(text, callback);
if (delay>0) if (delay>0)
this.timerCaption = (new Date()).getTime() + delay; this.timerCaption = (new Date()).getTime() + delay;
} else } else
@ -814,8 +814,10 @@ define([
showDisconnectTip: function () { showDisconnectTip: function () {
var me = this; var me = this;
if (!this.disconnectTip) { if (!this.disconnectTip) {
var target = this.statusbar.getStatusLabel();
target = target.is(':visible') ? target.parent() : this.statusbar.isVisible() ? this.statusbar.$el : $(document.body);
this.disconnectTip = new Common.UI.SynchronizeTip({ this.disconnectTip = new Common.UI.SynchronizeTip({
target : this.statusbar.isVisible() ? this.statusbar.getStatusLabel().parent() : $(document.body), target : target,
text : this.textDisconnect, text : this.textDisconnect,
placement: 'top', placement: 'top',
position: this.statusbar.isVisible() ? undefined : {bottom: 0}, position: this.statusbar.isVisible() ? undefined : {bottom: 0},

View file

@ -987,7 +987,7 @@ define([
return _message; return _message;
}, },
showStatusMessage: function(message) { showStatusMessage: function(message, callback) {
this.statusMessage = message; this.statusMessage = message;
if (!this.actionWidth) { if (!this.actionWidth) {
this.actionWidth = message.length > 22 ? 166 : 140; this.actionWidth = message.length > 22 ? 166 : 140;
@ -1006,6 +1006,7 @@ define([
_.delay(function(){ _.delay(function(){
me.updateTabbarBorders(); me.updateTabbarBorders();
me.onTabInvisible(undefined, me.tabbar.checkInvisible(true)); me.onTabInvisible(undefined, me.tabbar.checkInvisible(true));
callback && callback();
},30); },30);
}, },