[Common] Change api method showMessage (2 parameter will be deprecated).

This commit is contained in:
Julia Radzhabova 2017-05-16 10:46:04 +03:00
parent bb6344b373
commit f10c01cfd2
10 changed files with 21 additions and 31 deletions

View file

@ -409,21 +409,12 @@
});
};
var _showError = function(title, msg) {
_showMessage(title, msg, "error");
};
// severity could be one of: "error", "info" or "warning"
var _showMessage = function(title, msg, severity) {
if (typeof severity !== 'string') {
severity = "info";
}
var _showMessage = function(title, msg) {
msg = msg || title;
_sendCommand({
command: 'showMessage',
data: {
title: title,
msg: msg,
severity: severity
msg: msg
}
});
};
@ -540,7 +531,6 @@
};
return {
showError : _showError,
showMessage : _showMessage,
processSaveResult : _processSaveResult,
processRightsChange : _processRightsChange,

View file

@ -402,14 +402,14 @@ var ApplicationController = new(function(){
Common.Analytics.trackEvent('Internal Error', id.toString());
}
function onExternalError(error) {
function onExternalMessage(error) {
if (error) {
hidePreloader();
$('#id-error-mask-title').text(error.title);
$('#id-error-mask-title').text('Error');
$('#id-error-mask-text').text(error.msg);
$('#id-error-mask').css('display', 'block');
Common.Analytics.trackEvent('External Error', error.title);
Common.Analytics.trackEvent('External Error');
}
}
@ -497,7 +497,7 @@ var ApplicationController = new(function(){
// Initialize api gateway
Common.Gateway.on('init', loadConfig);
Common.Gateway.on('opendocument', loadDocument);
Common.Gateway.on('showerror', onExternalError);
Common.Gateway.on('showmessage', onExternalMessage);
Common.Gateway.ready();
}

View file

@ -1138,7 +1138,7 @@ define([
msg.msg = (msg.msg).toString();
this.showTips([msg.msg.charAt(0).toUpperCase() + msg.msg.substring(1)]);
Common.component.Analytics.trackEvent('External Error', msg.title);
Common.component.Analytics.trackEvent('External Error');
}
},

View file

@ -697,7 +697,7 @@ define([
message: [msg.msg.charAt(0).toUpperCase() + msg.msg.substring(1)]
});
Common.component.Analytics.trackEvent('External Error', msg.title);
Common.component.Analytics.trackEvent('External Error');
}
},

View file

@ -506,14 +506,14 @@ var ApplicationController = new(function(){
Common.Analytics.trackEvent('Internal Error', id.toString());
}
function onExternalError(error) {
function onExternalMessage(error) {
if (error) {
hidePreloader();
$('#id-error-mask-title').text(error.title);
$('#id-error-mask-title').text('Error');
$('#id-error-mask-text').text(error.msg);
$('#id-error-mask').css('display', 'block');
Common.Analytics.trackEvent('External Error', error.title);
Common.Analytics.trackEvent('External Error');
}
}
@ -573,7 +573,7 @@ var ApplicationController = new(function(){
// Initialize api gateway
Common.Gateway.on('init', loadConfig);
Common.Gateway.on('opendocument', loadDocument);
Common.Gateway.on('showerror', onExternalError);
Common.Gateway.on('showmessage', onExternalMessage);
Common.Gateway.ready();
}

View file

@ -897,7 +897,7 @@ define([
msg.msg = (msg.msg).toString();
this.showTips([msg.msg.charAt(0).toUpperCase() + msg.msg.substring(1)]);
Common.component.Analytics.trackEvent('External Error', msg.title);
Common.component.Analytics.trackEvent('External Error');
}
},

View file

@ -658,7 +658,7 @@ define([
message: [msg.msg.charAt(0).toUpperCase() + msg.msg.substring(1)]
});
Common.component.Analytics.trackEvent('External Error', msg.title);
Common.component.Analytics.trackEvent('External Error');
}
},

View file

@ -414,14 +414,14 @@ var ApplicationController = new(function(){
Common.Analytics.trackEvent('Internal Error', id.toString());
}
function onExternalError(error) {
function onExternalMessage(error) {
if (error) {
hidePreloader();
$('#id-error-mask-title').text(error.title);
$('#id-error-mask-title').text('Error');
$('#id-error-mask-text').text(error.msg);
$('#id-error-mask').css('display', 'block');
Common.Analytics.trackEvent('External Error', error.title);
Common.Analytics.trackEvent('External Error');
}
}
@ -519,7 +519,7 @@ var ApplicationController = new(function(){
// Initialize api gateway
Common.Gateway.on('init', loadConfig);
Common.Gateway.on('opendocument', loadDocument);
Common.Gateway.on('showerror', onExternalError);
Common.Gateway.on('showmessage', onExternalMessage);
Common.Gateway.ready();
}

View file

@ -954,7 +954,7 @@ define([
msg.msg = (msg.msg).toString();
this.showTips([msg.msg.charAt(0).toUpperCase() + msg.msg.substring(1)]);
Common.component.Analytics.trackEvent('External Error', msg.title);
Common.component.Analytics.trackEvent('External Error');
}
},

View file

@ -676,7 +676,7 @@ define([
message: [msg.msg.charAt(0).toUpperCase() + msg.msg.substring(1)]
});
Common.component.Analytics.trackEvent('External Error', msg.title);
Common.component.Analytics.trackEvent('External Error');
}
},