Commit b0c85dd9 by kevalbhatt

ATLAS-3629 : UI: skipDefaultError handler improvement

parent cd177f83
...@@ -258,7 +258,6 @@ require(['App', ...@@ -258,7 +258,6 @@ require(['App',
} }
}); });
this.entityDefCollection.fetch({ this.entityDefCollection.fetch({
skipDefaultError: true,
complete: function() { complete: function() {
that.entityDefCollection.fullCollection.comparator = function(model) { that.entityDefCollection.fullCollection.comparator = function(model) {
return model.get('name').toLowerCase(); return model.get('name').toLowerCase();
...@@ -269,7 +268,6 @@ require(['App', ...@@ -269,7 +268,6 @@ require(['App',
} }
}); });
this.typeHeaders.fetch({ this.typeHeaders.fetch({
skipDefaultError: true,
complete: function() { complete: function() {
that.typeHeaders.fullCollection.comparator = function(model) { that.typeHeaders.fullCollection.comparator = function(model) {
return model.get('name').toLowerCase(); return model.get('name').toLowerCase();
...@@ -280,7 +278,6 @@ require(['App', ...@@ -280,7 +278,6 @@ require(['App',
} }
}); });
this.enumDefCollection.fetch({ this.enumDefCollection.fetch({
skipDefaultError: true,
complete: function() { complete: function() {
that.enumDefCollection.fullCollection.comparator = function(model) { that.enumDefCollection.fullCollection.comparator = function(model) {
return model.get('name').toLowerCase(); return model.get('name').toLowerCase();
...@@ -291,7 +288,6 @@ require(['App', ...@@ -291,7 +288,6 @@ require(['App',
} }
}); });
this.classificationDefCollection.fetch({ this.classificationDefCollection.fetch({
skipDefaultError: true,
complete: function() { complete: function() {
that.classificationDefCollection.fullCollection.comparator = function(model) { that.classificationDefCollection.fullCollection.comparator = function(model) {
return model.get('name').toLowerCase(); return model.get('name').toLowerCase();
...@@ -303,7 +299,6 @@ require(['App', ...@@ -303,7 +299,6 @@ require(['App',
}); });
this.metricCollection.fetch({ this.metricCollection.fetch({
skipDefaultError: true,
complete: function() { complete: function() {
--that.asyncFetchCounter; --that.asyncFetchCounter;
startApp(); startApp();
......
...@@ -34,7 +34,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -34,7 +34,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
options.showLoader(); options.showLoader();
} }
tagModel.deleteAssociation(options.guid, options.tagName, options.associatedGuid, { tagModel.deleteAssociation(options.guid, options.tagName, options.associatedGuid, {
skipDefaultError: true, defaultErrorMessage: options.tagName + Messages.deleteErrorMessage,
success: function(data) { success: function(data) {
Utils.notifySuccess({ Utils.notifySuccess({
content: "Classification " + options.tagName + Messages.getAbbreviationMsg(false, 'removeSuccessMessage') content: "Classification " + options.tagName + Messages.getAbbreviationMsg(false, 'removeSuccessMessage')
...@@ -48,16 +48,9 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -48,16 +48,9 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
}, },
cust_error: function(model, response) { cust_error: function(model, response) {
var message = options.tagName + Messages.deleteErrorMessage;
if (response && response.responseJSON) {
message = response.responseJSON.errorMessage;
}
if (options.hideLoader) { if (options.hideLoader) {
options.hideLoader(); options.hideLoader();
} }
Utils.notifyError({
content: message
});
} }
}); });
}, },
......
...@@ -37,9 +37,7 @@ define(['require', 'utils/Utils', 'marionette', 'backgrid', 'asBreadcrumbs', 'jq ...@@ -37,9 +37,7 @@ define(['require', 'utils/Utils', 'marionette', 'backgrid', 'asBreadcrumbs', 'jq
return oldBackboneSync.apply(this, [method, model, return oldBackboneSync.apply(this, [method, model,
_.extend(options, { _.extend(options, {
error: function(response) { error: function(response) {
if (!options.skipDefaultError) { Utils.defaultErrorHandler(that, response, options);
Utils.defaultErrorHandler(that, response);
}
that.trigger("error", that, response); that.trigger("error", that, response);
if (options.cust_error) { if (options.cust_error) {
options.cust_error(that, response); options.cust_error(that, response);
......
...@@ -218,22 +218,20 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -218,22 +218,20 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
} }
}); });
} }
Utils.defaultErrorHandler = function(model, error) { Utils.defaultErrorHandler = function(model, error, options) {
var skipDefaultError = null,
defaultErrorMessage = null;
if (options) {
skipDefaultError = options.skipDefaultError;
defaultErrorMessage = options.defaultErrorMessage;
}
if (error && error.status) { if (error && error.status) {
if (error.status == 401) { if (error.status == 401) {
window.location = 'login.jsp' window.location = 'login.jsp'
} else if (error.status == 419) { } else if (error.status == 419) {
window.location = 'login.jsp' window.location = 'login.jsp'
} else if (error.status == 403) { } else if (error.status == 403) {
var message = "You are not authorized"; Utils.serverErrorHandler(error, "You are not authorized");
if (error.statusText) {
try {
message = JSON.parse(error.statusText).AuthorizationError;
} catch (err) {}
Utils.notifyError({
content: message
});
}
} else if (error.status == "0" && error.statusText != "abort") { } else if (error.status == "0" && error.statusText != "abort") {
var diffTime = (new Date().getTime() - prevNetworkErrorTime); var diffTime = (new Date().getTime() - prevNetworkErrorTime);
if (diffTime > 3000) { if (diffTime > 3000) {
...@@ -243,22 +241,23 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -243,22 +241,23 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
"It seems you are not connected to the internet. Please check your internet connection and try again" "It seems you are not connected to the internet. Please check your internet connection and try again"
}); });
} }
} else { } else if (skipDefaultError !== true) {
Utils.serverErrorHandler(model, error) Utils.serverErrorHandler(error, defaultErrorMessage);
} }
} else { } else if (skipDefaultError !== true) {
Utils.serverErrorHandler(model, error) Utils.serverErrorHandler(error, defaultErrorMessage);
} }
}; };
Utils.serverErrorHandler = function(model, response) { Utils.serverErrorHandler = function(response, defaultErrorMessage) {
var responseJSON = response ? response.responseJSON : response; var responseJSON = response ? response.responseJSON : response,
if (response && responseJSON && (responseJSON.errorMessage || responseJSON.message || responseJSON.error)) { message = defaultErrorMessage ? defaultErrorMessage : Messages.defaultErrorMessage
Utils.notifyError({ if (response && responseJSON) {
content: responseJSON.errorMessage || responseJSON.message || responseJSON.error message = responseJSON.errorMessage || responseJSON.message || responseJSON.error || message
}); }
} else { var existingError = $(".ui-pnotify-container.alert-danger .ui-pnotify-text").text();
if (existingError !== message) {
Utils.notifyError({ Utils.notifyError({
content: Messages.defaultErrorMessage content: message
}); });
} }
}; };
......
...@@ -225,7 +225,6 @@ define(['require', ...@@ -225,7 +225,6 @@ define(['require',
"el": that.$(".graph-button-group button,select[data-id='selectDepth']") "el": that.$(".graph-button-group button,select[data-id='selectDepth']")
}); });
this.collection.getLineage(this.guid, { this.collection.getLineage(this.guid, {
skipDefaultError: true,
queryParam: queryParam, queryParam: queryParam,
success: function(data) { success: function(data) {
if (that.isDestroyed) { if (that.isDestroyed) {
......
...@@ -69,7 +69,6 @@ define(['require', ...@@ -69,7 +69,6 @@ define(['require',
fetchEntity: function(argument) { fetchEntity: function(argument) {
var that = this; var that = this;
this.entityModel.getEntity(this.entityDetail.table.guid, { this.entityModel.getEntity(this.entityDetail.table.guid, {
skipDefaultError: true,
success: function(data) { success: function(data) {
var entity = data.entity, var entity = data.entity,
profileData = entity && entity.attributes && entity.attributes.profileData ? entity.attributes.profileData.attributes : null; profileData = entity && entity.attributes && entity.attributes.profileData ? entity.attributes.profileData.attributes : null;
......
...@@ -110,7 +110,6 @@ define(['require', ...@@ -110,7 +110,6 @@ define(['require',
fetchEntity: function(argument) { fetchEntity: function(argument) {
var that = this; var that = this;
this.entityModel.getEntity(this.entityDetail.db.guid, { this.entityModel.getEntity(this.entityDetail.db.guid, {
skipDefaultError: true,
success: function(data) { success: function(data) {
var entity = data.entity; var entity = data.entity;
if (entity.attributes) { if (entity.attributes) {
......
...@@ -381,7 +381,6 @@ define(['require', ...@@ -381,7 +381,6 @@ define(['require',
} }
}; };
this.metricCollection.fetch({ this.metricCollection.fetch({
skipDefaultError: true,
complete: function() { complete: function() {
--apiCount; --apiCount;
that.entityCountObj = _.first(that.metricCollection.toJSON()); that.entityCountObj = _.first(that.metricCollection.toJSON());
...@@ -390,7 +389,6 @@ define(['require', ...@@ -390,7 +389,6 @@ define(['require',
}); });
this.typeHeaders.fetch({ this.typeHeaders.fetch({
skipDefaultError: true,
silent: true, silent: true,
complete: function() { complete: function() {
--apiCount; --apiCount;
......
...@@ -104,7 +104,6 @@ define(['require', ...@@ -104,7 +104,6 @@ define(['require',
fetchMetricData: function(options) { fetchMetricData: function(options) {
var that = this; var that = this;
this.metricCollection.fetch({ this.metricCollection.fetch({
skipDefaultError: true,
success: function(data) { success: function(data) {
var data = _.first(data.toJSON()); var data = _.first(data.toJSON());
that.renderStats({ valueObject: data.general.stats, dataObject: data.general }); that.renderStats({ valueObject: data.general.stats, dataObject: data.general });
......
...@@ -439,9 +439,9 @@ define(['require', ...@@ -439,9 +439,9 @@ define(['require',
this.showLoader(); this.showLoader();
} }
this.entityModel.saveTraitsEntity(this.tagModel ? options.guid : null, { this.entityModel.saveTraitsEntity(this.tagModel ? options.guid : null, {
skipDefaultError: true,
data: JSON.stringify(json), data: JSON.stringify(json),
type: this.tagModel ? 'PUT' : 'POST', type: this.tagModel ? 'PUT' : 'POST',
defaultErrorMessage: "Tag " + tagName + " could not be added",
success: function(data) { success: function(data) {
var addupdatetext = that.tagModel ? 'updated successfully to ' : 'added to '; var addupdatetext = that.tagModel ? 'updated successfully to ' : 'added to ';
Utils.notifySuccess({ Utils.notifySuccess({
...@@ -455,13 +455,6 @@ define(['require', ...@@ -455,13 +455,6 @@ define(['require',
} }
}, },
cust_error: function(model, response) { cust_error: function(model, response) {
var message = "Tag " + tagName + " could not be added";
if (response && response.responseJSON) {
message = response.responseJSON.errorMessage;
}
Utils.notifyError({
content: message
});
if (that.hideLoader) { if (that.hideLoader) {
that.hideLoader(); that.hideLoader();
} }
......
...@@ -268,7 +268,6 @@ require(['App', ...@@ -268,7 +268,6 @@ require(['App',
} }
}); });
this.entityDefCollection.fetch({ this.entityDefCollection.fetch({
skipDefaultError: true,
complete: function() { complete: function() {
that.entityDefCollection.fullCollection.comparator = function(model) { that.entityDefCollection.fullCollection.comparator = function(model) {
return model.get('name').toLowerCase(); return model.get('name').toLowerCase();
...@@ -279,7 +278,6 @@ require(['App', ...@@ -279,7 +278,6 @@ require(['App',
} }
}); });
this.typeHeaders.fetch({ this.typeHeaders.fetch({
skipDefaultError: true,
complete: function() { complete: function() {
that.typeHeaders.fullCollection.comparator = function(model) { that.typeHeaders.fullCollection.comparator = function(model) {
return model.get('name').toLowerCase(); return model.get('name').toLowerCase();
...@@ -290,7 +288,6 @@ require(['App', ...@@ -290,7 +288,6 @@ require(['App',
} }
}); });
this.enumDefCollection.fetch({ this.enumDefCollection.fetch({
skipDefaultError: true,
complete: function() { complete: function() {
that.enumDefCollection.fullCollection.comparator = function(model) { that.enumDefCollection.fullCollection.comparator = function(model) {
return model.get('name').toLowerCase(); return model.get('name').toLowerCase();
...@@ -301,7 +298,6 @@ require(['App', ...@@ -301,7 +298,6 @@ require(['App',
} }
}); });
this.classificationDefCollection.fetch({ this.classificationDefCollection.fetch({
skipDefaultError: true,
complete: function() { complete: function() {
that.classificationDefCollection.fullCollection.comparator = function(model) { that.classificationDefCollection.fullCollection.comparator = function(model) {
return model.get('name').toLowerCase(); return model.get('name').toLowerCase();
...@@ -313,7 +309,6 @@ require(['App', ...@@ -313,7 +309,6 @@ require(['App',
}); });
this.metricCollection.fetch({ this.metricCollection.fetch({
skipDefaultError: true,
complete: function() { complete: function() {
--that.asyncFetchCounter; --that.asyncFetchCounter;
startApp(); startApp();
...@@ -321,7 +316,6 @@ require(['App', ...@@ -321,7 +316,6 @@ require(['App',
}); });
this.nameSpaceCollection.fetch({ this.nameSpaceCollection.fetch({
skipDefaultError: true,
complete: function() { complete: function() {
that.nameSpaceCollection.fullCollection.comparator = function(model) { that.nameSpaceCollection.fullCollection.comparator = function(model) {
return model.get('name').toLowerCase(); return model.get('name').toLowerCase();
......
...@@ -34,7 +34,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -34,7 +34,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
options.showLoader(); options.showLoader();
} }
tagModel.deleteAssociation(options.guid, options.tagName, options.associatedGuid, { tagModel.deleteAssociation(options.guid, options.tagName, options.associatedGuid, {
skipDefaultError: true, defaultErrorMessage: options.tagName + Messages.deleteErrorMessage,
success: function(data) { success: function(data) {
Utils.notifySuccess({ Utils.notifySuccess({
content: "Classification " + options.tagName + Messages.getAbbreviationMsg(false, 'removeSuccessMessage') content: "Classification " + options.tagName + Messages.getAbbreviationMsg(false, 'removeSuccessMessage')
...@@ -48,16 +48,9 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -48,16 +48,9 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
}, },
cust_error: function(model, response) { cust_error: function(model, response) {
var message = options.tagName + Messages.deleteErrorMessage;
if (response && response.responseJSON) {
message = response.responseJSON.errorMessage;
}
if (options.hideLoader) { if (options.hideLoader) {
options.hideLoader(); options.hideLoader();
} }
Utils.notifyError({
content: message
});
} }
}); });
}, },
......
...@@ -37,9 +37,7 @@ define(['require', 'utils/Utils', 'marionette', 'backgrid', 'asBreadcrumbs', 'jq ...@@ -37,9 +37,7 @@ define(['require', 'utils/Utils', 'marionette', 'backgrid', 'asBreadcrumbs', 'jq
return oldBackboneSync.apply(this, [method, model, return oldBackboneSync.apply(this, [method, model,
_.extend(options, { _.extend(options, {
error: function(response) { error: function(response) {
if (!options.skipDefaultError) { Utils.defaultErrorHandler(that, response, options);
Utils.defaultErrorHandler(that, response);
}
that.trigger("error", that, response); that.trigger("error", that, response);
if (options.cust_error) { if (options.cust_error) {
options.cust_error(that, response); options.cust_error(that, response);
......
...@@ -224,22 +224,20 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -224,22 +224,20 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
} }
}); });
} }
Utils.defaultErrorHandler = function(model, error) { Utils.defaultErrorHandler = function(model, error, options) {
var skipDefaultError = null,
defaultErrorMessage = null;
if (options) {
skipDefaultError = options.skipDefaultError;
defaultErrorMessage = options.defaultErrorMessage;
}
if (error && error.status) { if (error && error.status) {
if (error.status == 401) { if (error.status == 401) {
window.location = 'login.jsp' window.location = 'login.jsp'
} else if (error.status == 419) { } else if (error.status == 419) {
window.location = 'login.jsp' window.location = 'login.jsp'
} else if (error.status == 403) { } else if (error.status == 403) {
var message = "You are not authorized"; Utils.serverErrorHandler(error, "You are not authorized");
if (error.statusText) {
try {
message = JSON.parse(error.statusText).AuthorizationError;
} catch (err) {}
Utils.notifyError({
content: message
});
}
} else if (error.status == "0" && error.statusText != "abort") { } else if (error.status == "0" && error.statusText != "abort") {
var diffTime = (new Date().getTime() - prevNetworkErrorTime); var diffTime = (new Date().getTime() - prevNetworkErrorTime);
if (diffTime > 3000) { if (diffTime > 3000) {
...@@ -249,22 +247,23 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -249,22 +247,23 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
"It seems you are not connected to the internet. Please check your internet connection and try again" "It seems you are not connected to the internet. Please check your internet connection and try again"
}); });
} }
} else { } else if (skipDefaultError !== true) {
Utils.serverErrorHandler(model, error) Utils.serverErrorHandler(error, defaultErrorMessage);
} }
} else { } else if (skipDefaultError !== true) {
Utils.serverErrorHandler(model, error) Utils.serverErrorHandler(error, defaultErrorMessage);
} }
}; };
Utils.serverErrorHandler = function(model, response) { Utils.serverErrorHandler = function(response, defaultErrorMessage) {
var responseJSON = response ? response.responseJSON : response; var responseJSON = response ? response.responseJSON : response,
if (response && responseJSON && (responseJSON.errorMessage || responseJSON.message || responseJSON.error)) { message = defaultErrorMessage ? defaultErrorMessage : Messages.defaultErrorMessage
Utils.notifyError({ if (response && responseJSON) {
content: responseJSON.errorMessage || responseJSON.message || responseJSON.error message = responseJSON.errorMessage || responseJSON.message || responseJSON.error || message
}); }
} else { var existingError = $(".ui-pnotify-container.alert-danger .ui-pnotify-text").text();
if (existingError !== message) {
Utils.notifyError({ Utils.notifyError({
content: Messages.defaultErrorMessage content: message
}); });
} }
}; };
......
...@@ -310,7 +310,6 @@ define(['require', ...@@ -310,7 +310,6 @@ define(['require',
} }
} }
var apiObj = { var apiObj = {
skipDefaultError: true,
sort: false, sort: false,
success: function(dataOrCollection, response) { success: function(dataOrCollection, response) {
if (!(that.ui.pageRecordText instanceof jQuery)) { if (!(that.ui.pageRecordText instanceof jQuery)) {
......
...@@ -240,7 +240,6 @@ define(['require', ...@@ -240,7 +240,6 @@ define(['require',
"el": that.$(".graph-button-group button,select[data-id='selectDepth']") "el": that.$(".graph-button-group button,select[data-id='selectDepth']")
}); });
this.collection.getLineage(this.guid, { this.collection.getLineage(this.guid, {
skipDefaultError: true,
queryParam: queryParam, queryParam: queryParam,
success: function(data) { success: function(data) {
if (that.isDestroyed) { if (that.isDestroyed) {
......
...@@ -132,7 +132,6 @@ define(['require', ...@@ -132,7 +132,6 @@ define(['require',
enumDefCollection.fetch({ reset: true }); enumDefCollection.fetch({ reset: true });
that.nameSpaceAttr.fullCollection.reset(); that.nameSpaceAttr.fullCollection.reset();
that.options.selectedNameSpace.fetch({ that.options.selectedNameSpace.fetch({
skipDefaultError: true,
complete: function(model, status) { complete: function(model, status) {
that.nameSpaceAttr.fullCollection.add(model.responseJSON.attributeDefs); that.nameSpaceAttr.fullCollection.add(model.responseJSON.attributeDefs);
} }
...@@ -179,40 +178,40 @@ define(['require', ...@@ -179,40 +178,40 @@ define(['require',
getNamespaceTableColumns: function() { getNamespaceTableColumns: function() {
var that = this; var that = this;
return this.nameSpaceAttr.constructor.getTableCols({ return this.nameSpaceAttr.constructor.getTableCols({
name: { name: {
label: "Attribute Name", label: "Attribute Name",
cell: "html", cell: "html",
editable: false, editable: false,
formatter: _.extend({}, Backgrid.CellFormatter.prototype, { formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) { fromRaw: function(rawValue, model) {
return model.get('name'); return model.get('name');
} }
}) })
}, },
typeName: { typeName: {
label: "typeName", label: "typeName",
cell: "html", cell: "html",
editable: false, editable: false,
formatter: _.extend({}, Backgrid.CellFormatter.prototype, { formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) { fromRaw: function(rawValue, model) {
return model.get('typeName'); return _.escape(model.get('typeName'));
} }
}) })
}, },
options: { options: {
label: "Entity Type(s)", label: "Entity Type(s)",
cell: "html", cell: "html",
editable: false, editable: false,
formatter: _.extend({}, Backgrid.CellFormatter.prototype, { formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) { fromRaw: function(rawValue, model) {
var applicableEntityTypes = '', var applicableEntityTypes = '',
attrEntityTypes = JSON.parse(model.get('options').applicableEntityTypes); attrEntityTypes = JSON.parse(model.get('options').applicableEntityTypes);
_.each(attrEntityTypes, function(values) { _.each(attrEntityTypes, function(values) {
applicableEntityTypes += '<label class="btn btn-action btn-xs btn-blue no-pointer">' + values + '</label>'; applicableEntityTypes += '<label class="btn btn-action btn-xs btn-blue no-pointer">' + values + '</label>';
}); });
return applicableEntityTypes; return applicableEntityTypes;
} }
}) })
}, },
tool: { tool: {
label: "Action", label: "Action",
...@@ -226,7 +225,7 @@ define(['require', ...@@ -226,7 +225,7 @@ define(['require',
}) })
} }
}, this.nameSpaceAttr); }, this.nameSpaceAttr);
} }
}); });
return NameSpaceAttrTableLayoutView; return NameSpaceAttrTableLayoutView;
}); });
\ No newline at end of file
...@@ -69,7 +69,6 @@ define([ ...@@ -69,7 +69,6 @@ define([
fetchNameSpaceGuid: function() { fetchNameSpaceGuid: function() {
var that = this; var that = this;
this.selectedNameSpace.fetch({ this.selectedNameSpace.fetch({
skipDefaultError: true,
complete: function(model, status) { complete: function(model, status) {
that.nameSpaceAttr.fullCollection.add(model.responseJSON.attributeDefs); that.nameSpaceAttr.fullCollection.add(model.responseJSON.attributeDefs);
} }
......
...@@ -69,7 +69,6 @@ define(['require', ...@@ -69,7 +69,6 @@ define(['require',
fetchEntity: function(argument) { fetchEntity: function(argument) {
var that = this; var that = this;
this.entityModel.getEntity(this.entityDetail.table.guid, { this.entityModel.getEntity(this.entityDetail.table.guid, {
skipDefaultError: true,
success: function(data) { success: function(data) {
var entity = data.entity, var entity = data.entity,
profileData = entity && entity.attributes && entity.attributes.profileData ? entity.attributes.profileData.attributes : null; profileData = entity && entity.attributes && entity.attributes.profileData ? entity.attributes.profileData.attributes : null;
......
...@@ -110,7 +110,6 @@ define(['require', ...@@ -110,7 +110,6 @@ define(['require',
fetchEntity: function(argument) { fetchEntity: function(argument) {
var that = this; var that = this;
this.entityModel.getEntity(this.entityDetail.db.guid, { this.entityModel.getEntity(this.entityDetail.db.guid, {
skipDefaultError: true,
success: function(data) { success: function(data) {
var entity = data.entity; var entity = data.entity;
if (entity.attributes) { if (entity.attributes) {
......
...@@ -174,7 +174,6 @@ define([ ...@@ -174,7 +174,6 @@ define([
var opt = options || {}; var opt = options || {};
if (opt && !opt.metricData) { if (opt && !opt.metricData) {
that.metricCollection.fetch({ that.metricCollection.fetch({
skipDefaultError: true,
complete: function() { complete: function() {
that.entityCountObj = _.first(that.metricCollection.toJSON()); that.entityCountObj = _.first(that.metricCollection.toJSON());
that.classificationTreeUpdate = true; that.classificationTreeUpdate = true;
...@@ -351,7 +350,6 @@ define([ ...@@ -351,7 +350,6 @@ define([
} }
}; };
this.classificationDefCollection.fetch({ this.classificationDefCollection.fetch({
skipDefaultError: true,
silent: true, silent: true,
complete: function() { complete: function() {
--apiCount; --apiCount;
...@@ -359,7 +357,6 @@ define([ ...@@ -359,7 +357,6 @@ define([
} }
}); });
this.metricCollection.fetch({ this.metricCollection.fetch({
skipDefaultError: true,
complete: function() { complete: function() {
--apiCount; --apiCount;
that.entityCountObj = _.first(that.metricCollection.toJSON()); that.entityCountObj = _.first(that.metricCollection.toJSON());
......
...@@ -91,7 +91,6 @@ define([ ...@@ -91,7 +91,6 @@ define([
var opt = options || {}; var opt = options || {};
if (opt && !opt.metricData) { if (opt && !opt.metricData) {
that.metricCollection.fetch({ that.metricCollection.fetch({
skipDefaultError: true,
complete: function() { complete: function() {
that.entityCountObj = _.first(that.metricCollection.toJSON()); that.entityCountObj = _.first(that.metricCollection.toJSON());
that.ui.entitySearchTree.jstree(true).refresh(); that.ui.entitySearchTree.jstree(true).refresh();
...@@ -510,7 +509,6 @@ define([ ...@@ -510,7 +509,6 @@ define([
} }
}; };
this.entityDefCollection.fetch({ this.entityDefCollection.fetch({
skipDefaultError: true,
complete: function() { complete: function() {
that.entityDefCollection.fullCollection.comparator = function(model) { that.entityDefCollection.fullCollection.comparator = function(model) {
return model.get('name').toLowerCase(); return model.get('name').toLowerCase();
...@@ -522,7 +520,6 @@ define([ ...@@ -522,7 +520,6 @@ define([
}); });
this.metricCollection.fetch({ this.metricCollection.fetch({
skipDefaultError: true,
complete: function() { complete: function() {
--apiCount; --apiCount;
that.entityCountObj = _.first(that.metricCollection.toJSON()); that.entityCountObj = _.first(that.metricCollection.toJSON());
...@@ -531,7 +528,6 @@ define([ ...@@ -531,7 +528,6 @@ define([
}); });
this.typeHeaders.fetch({ this.typeHeaders.fetch({
skipDefaultError: true,
complete: function() { complete: function() {
that.typeHeaders.fullCollection.comparator = function(model) { that.typeHeaders.fullCollection.comparator = function(model) {
return model.get('name').toLowerCase(); return model.get('name').toLowerCase();
......
...@@ -215,7 +215,6 @@ define([ ...@@ -215,7 +215,6 @@ define([
refresh: function(options) { refresh: function(options) {
var that = this; var that = this;
this.nameSpaceCollection.fetch({ this.nameSpaceCollection.fetch({
skipDefaultError: true,
silent: true, silent: true,
complete: function() { complete: function() {
that.nameSpaceCollection.fullCollection.comparator = function(model) { that.nameSpaceCollection.fullCollection.comparator = function(model) {
......
...@@ -99,7 +99,6 @@ define(['require', ...@@ -99,7 +99,6 @@ define(['require',
fetchMetricData: function(options) { fetchMetricData: function(options) {
var that = this; var that = this;
this.metricCollection.fetch({ this.metricCollection.fetch({
skipDefaultError: true,
success: function(data) { success: function(data) {
var data = _.first(data.toJSON()); var data = _.first(data.toJSON());
that.renderStats({ valueObject: data.general.stats, dataObject: data.general }); that.renderStats({ valueObject: data.general.stats, dataObject: data.general });
......
...@@ -439,9 +439,9 @@ define(['require', ...@@ -439,9 +439,9 @@ define(['require',
this.showLoader(); this.showLoader();
} }
this.entityModel.saveTraitsEntity(this.tagModel ? options.guid : null, { this.entityModel.saveTraitsEntity(this.tagModel ? options.guid : null, {
skipDefaultError: true,
data: JSON.stringify(json), data: JSON.stringify(json),
type: this.tagModel ? 'PUT' : 'POST', type: this.tagModel ? 'PUT' : 'POST',
defaultErrorMessage: "Tag " + tagName + " could not be added",
success: function(data) { success: function(data) {
var addupdatetext = that.tagModel ? 'updated successfully to ' : 'added to '; var addupdatetext = that.tagModel ? 'updated successfully to ' : 'added to ';
Utils.notifySuccess({ Utils.notifySuccess({
...@@ -455,13 +455,6 @@ define(['require', ...@@ -455,13 +455,6 @@ define(['require',
} }
}, },
cust_error: function(model, response) { cust_error: function(model, response) {
var message = "Tag " + tagName + " could not be added";
if (response && response.responseJSON) {
message = response.responseJSON.errorMessage;
}
Utils.notifyError({
content: message
});
if (that.hideLoader) { if (that.hideLoader) {
that.hideLoader(); that.hideLoader();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment