Repository: incubator-atlas Updated Branches: refs/heads/master 143c0f813 -> 6679c8eed
ATLAS-1486: UI updates to handle errors from V2 APIs Signed-off-by: Madhan Neethiraj <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/6679c8ee Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/6679c8ee Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/6679c8ee Branch: refs/heads/master Commit: 6679c8eed29d9850a43b682970084e197ad16dc7 Parents: 143c0f8 Author: kevalbhatt <[email protected]> Authored: Tue Jan 24 18:02:48 2017 +0530 Committer: Madhan Neethiraj <[email protected]> Committed: Tue Jan 24 09:18:00 2017 -0800 ---------------------------------------------------------------------- .../public/js/collection/BaseCollection.js | 14 +--- .../public/js/collection/VCatalogList.js | 1 - dashboardv2/public/js/collection/VCommonList.js | 1 - dashboardv2/public/js/collection/VEntityList.js | 1 - .../public/js/collection/VLineageList.js | 1 - dashboardv2/public/js/collection/VSchemaList.js | 1 - dashboardv2/public/js/collection/VSearchList.js | 1 - dashboardv2/public/js/collection/VTagList.js | 1 - dashboardv2/public/js/models/BaseModel.js | 12 ++-- dashboardv2/public/js/models/VCatalog.js | 1 - dashboardv2/public/js/models/VCommon.js | 1 - dashboardv2/public/js/models/VEntity.js | 1 - dashboardv2/public/js/models/VLineage.js | 1 - dashboardv2/public/js/models/VSchema.js | 1 - dashboardv2/public/js/models/VSearch.js | 1 - dashboardv2/public/js/models/VTag.js | 1 - .../public/js/utils/CommonViewFunction.js | 19 ++---- dashboardv2/public/js/utils/Messages.js | 3 +- dashboardv2/public/js/utils/Overrides.js | 20 +++++- dashboardv2/public/js/utils/Utils.js | 68 +++++++++++--------- .../BusinessCatalogDetailLayoutView.js | 8 --- .../js/views/business_catalog/TreeLayoutView.js | 25 ++----- .../public/js/views/common/aboutAtlas.js | 1 - .../js/views/entity/CreateEntityLayoutView.js | 7 -- .../public/js/views/graph/LineageLayoutView.js | 3 +- .../js/views/search/SearchResultLayoutView.js | 1 - .../public/js/views/tag/CreateTagLayoutView.js | 1 - .../views/tag/TagAttributeDetailLayoutView.js | 7 -- .../public/js/views/tag/TagLayoutView.js | 7 -- .../public/js/views/tag/addTagModalView.js | 8 +-- release-log.txt | 2 + 31 files changed, 81 insertions(+), 139 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/collection/BaseCollection.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/collection/BaseCollection.js b/dashboardv2/public/js/collection/BaseCollection.js index 1f3faba..78261ee 100644 --- a/dashboardv2/public/js/collection/BaseCollection.js +++ b/dashboardv2/public/js/collection/BaseCollection.js @@ -36,19 +36,6 @@ define(['require', initialize: function() { this.sort_key = 'id'; }, - bindErrorEvents: function() { - this.bind("error", Utils.defaultErrorHandler); - }, - bindRequest: function() { - this.bind('request', function(model, ajaxObj, collectionObj) { - this.ajaxStart(model, ajaxObj, collectionObj); - }, this); - this.bind('sync', function(model, ajaxObj, collectionObj) { - this.ajaxComplete(model, ajaxObj, collectionObj); - }, this); - }, - ajaxStart: function(model, ajaxObj, collectionObj) {}, - ajaxComplete: function(model, ajaxObj, collectionObj) {}, comparator: function(key, value) { key = key.get(this.sort_key); value = value.get(this.sort_key); @@ -140,6 +127,7 @@ define(['require', return retCols; }, nonCrudOperation: function(url, requestMethod, options) { + var that = this; options['beforeSend'] = CommonViewFunction.addRestCsrfCustomHeader; return Backbone.sync.call(this, null, this, _.extend({ url: url, http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/collection/VCatalogList.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/collection/VCatalogList.js b/dashboardv2/public/js/collection/VCatalogList.js index a631de1..7899b3e 100644 --- a/dashboardv2/public/js/collection/VCatalogList.js +++ b/dashboardv2/public/js/collection/VCatalogList.js @@ -33,7 +33,6 @@ define(['require', initialize: function() { this.modelName = 'VCatalog'; this.modelAttrName = ''; - this.bindErrorEvents(); }, fetch: function(options) { //Call Backbone's fetch http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/collection/VCommonList.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/collection/VCommonList.js b/dashboardv2/public/js/collection/VCommonList.js index 87091ca..8b9254f 100644 --- a/dashboardv2/public/js/collection/VCommonList.js +++ b/dashboardv2/public/js/collection/VCommonList.js @@ -33,7 +33,6 @@ define(['require', initialize: function() { this.modelName = 'VCommon'; this.modelAttrName = ''; - this.bindErrorEvents(); }, }, //Static Class Members http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/collection/VEntityList.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/collection/VEntityList.js b/dashboardv2/public/js/collection/VEntityList.js index 99b0f3b..642ef93 100644 --- a/dashboardv2/public/js/collection/VEntityList.js +++ b/dashboardv2/public/js/collection/VEntityList.js @@ -33,7 +33,6 @@ define(['require', initialize: function() { this.modelName = 'VEntity'; this.modelAttrName = ''; - this.bindErrorEvents(); }, parseRecords: function(resp, options) { try { http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/collection/VLineageList.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/collection/VLineageList.js b/dashboardv2/public/js/collection/VLineageList.js index a2656df..982921c 100644 --- a/dashboardv2/public/js/collection/VLineageList.js +++ b/dashboardv2/public/js/collection/VLineageList.js @@ -33,7 +33,6 @@ define(['require', initialize: function() { this.modelName = 'VLineage'; this.modelAttrName = 'results'; - this.bindErrorEvents(); }, getLineage: function(id, options) { var url = UrlLinks.lineageApiUrl(id); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/collection/VSchemaList.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/collection/VSchemaList.js b/dashboardv2/public/js/collection/VSchemaList.js index 18ffeda..af58244 100644 --- a/dashboardv2/public/js/collection/VSchemaList.js +++ b/dashboardv2/public/js/collection/VSchemaList.js @@ -31,7 +31,6 @@ define(['require', initialize: function() { this.modelName = 'VSchema'; this.modelAttrName = 'results'; - this.bindErrorEvents(); }, parseRecords: function(resp, options) { try { http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/collection/VSearchList.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/collection/VSearchList.js b/dashboardv2/public/js/collection/VSearchList.js index 3b02f05..2ec4952 100644 --- a/dashboardv2/public/js/collection/VSearchList.js +++ b/dashboardv2/public/js/collection/VSearchList.js @@ -33,7 +33,6 @@ define(['require', initialize: function() { this.modelName = 'VSearch'; this.modelAttrName = 'results'; - this.bindErrorEvents(); }, parseRecords: function(resp, options) { this.responseData = { http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/collection/VTagList.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/collection/VTagList.js b/dashboardv2/public/js/collection/VTagList.js index 92c6436..0aa74df 100644 --- a/dashboardv2/public/js/collection/VTagList.js +++ b/dashboardv2/public/js/collection/VTagList.js @@ -31,7 +31,6 @@ define(['require', initialize: function() { this.modelName = 'VTag'; this.modelAttrName = 'list'; - this.bindErrorEvents(); }, parseRecords: function(resp, options) { try { http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/models/BaseModel.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/models/BaseModel.js b/dashboardv2/public/js/models/BaseModel.js index 27e0332..666ade7 100644 --- a/dashboardv2/public/js/models/BaseModel.js +++ b/dashboardv2/public/js/models/BaseModel.js @@ -16,7 +16,7 @@ * limitations under the License. */ -define(['require', 'utils/Utils', 'backbone','utils/CommonViewFunction'], function(require, Utils, Backbone,CommonViewFunction) { +define(['require', 'utils/Utils', 'backbone', 'utils/CommonViewFunction'], function(require, Utils, Backbone, CommonViewFunction) { 'use strict'; var BaseModel = Backbone.Model.extend( @@ -27,12 +27,7 @@ define(['require', 'utils/Utils', 'backbone','utils/CommonViewFunction'], functi * @augments Backbone.Model * @constructs */ - initialize: function() { - - }, - bindErrorEvents: function() { - this.bind("error", Utils.defaultErrorHandler); - }, + initialize: function() {}, /** * toString for a model. Every model should implement this function. */ @@ -60,7 +55,8 @@ define(['require', 'utils/Utils', 'backbone','utils/CommonViewFunction'], functi * @return {[type]} [description] */ nonCrudOperation: function(url, requestMethod, options) { - options['beforeSend'] = CommonViewFunction.addRestCsrfCustomHeader; + var that = this; + options['beforeSend'] = CommonViewFunction.addRestCsrfCustomHeader; return Backbone.sync.call(this, null, this, _.extend({ url: url, type: requestMethod http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/models/VCatalog.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/models/VCatalog.js b/dashboardv2/public/js/models/VCatalog.js index 85160b7..eb52e9a 100644 --- a/dashboardv2/public/js/models/VCatalog.js +++ b/dashboardv2/public/js/models/VCatalog.js @@ -33,7 +33,6 @@ define(['require', initialize: function() { this.modelName = 'VCatalog'; - this.bindErrorEvents(); }, toString: function() { return this.get('name'); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/models/VCommon.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/models/VCommon.js b/dashboardv2/public/js/models/VCommon.js index 25462fe..062e1b6 100644 --- a/dashboardv2/public/js/models/VCommon.js +++ b/dashboardv2/public/js/models/VCommon.js @@ -33,7 +33,6 @@ define(['require', initialize: function() { this.modelName = 'VCommon'; - this.bindErrorEvents(); }, toString: function() { return this.get('name'); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/models/VEntity.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/models/VEntity.js b/dashboardv2/public/js/models/VEntity.js index 2173534..ce86c24 100644 --- a/dashboardv2/public/js/models/VEntity.js +++ b/dashboardv2/public/js/models/VEntity.js @@ -34,7 +34,6 @@ define(['require', initialize: function() { this.modelName = 'VEntity'; - this.bindErrorEvents(); }, toString: function() { return this.get('name'); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/models/VLineage.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/models/VLineage.js b/dashboardv2/public/js/models/VLineage.js index d55bfeb..d65418f 100644 --- a/dashboardv2/public/js/models/VLineage.js +++ b/dashboardv2/public/js/models/VLineage.js @@ -34,7 +34,6 @@ define(['require', initialize: function() { this.modelName = 'VLineage'; - this.bindErrorEvents(); }, toString: function() { return this.get('id'); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/models/VSchema.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/models/VSchema.js b/dashboardv2/public/js/models/VSchema.js index f7f083c..5743c19 100644 --- a/dashboardv2/public/js/models/VSchema.js +++ b/dashboardv2/public/js/models/VSchema.js @@ -33,7 +33,6 @@ define(['require', initialize: function() { this.modelName = 'VSchema'; - this.bindErrorEvents(); }, toString: function() { return this.get('id'); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/models/VSearch.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/models/VSearch.js b/dashboardv2/public/js/models/VSearch.js index 906b96f..5c3df97 100644 --- a/dashboardv2/public/js/models/VSearch.js +++ b/dashboardv2/public/js/models/VSearch.js @@ -33,7 +33,6 @@ define(['require', initialize: function() { this.modelName = 'VSearch'; - this.bindErrorEvents(); }, toString: function() { return this.get('name'); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/models/VTag.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/models/VTag.js b/dashboardv2/public/js/models/VTag.js index 73cf3c8..064c1f0 100644 --- a/dashboardv2/public/js/models/VTag.js +++ b/dashboardv2/public/js/models/VTag.js @@ -33,7 +33,6 @@ define(['require', initialize: function() { this.modelName = 'VTag'; - this.bindErrorEvents(); }, toString: function() { return this.get('name'); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/utils/CommonViewFunction.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js index 7d41c1c..c0203ea 100644 --- a/dashboardv2/public/js/utils/CommonViewFunction.js +++ b/dashboardv2/public/js/utils/CommonViewFunction.js @@ -37,6 +37,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum var tagModel = new VTag(); if (options && options.guid && options.tagName) { tagModel.deleteTag(options.guid, options.tagName, { + skipDefaultError: true, success: function(data) { var msg = "Tag " + name.name + Messages.removeSuccessMessage; if (options.tagOrTerm === "term") { @@ -55,16 +56,15 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum } }, - error: function(error, data, status) { + cust_error: function(model, response) { var message = options.tagName + Messages.deleteErrorMessage; - if (data.error) { - message = data.error; + if (response && response.responseJSON) { + message = response.responseJSON.errorMessage; } Utils.notifyError({ content: message }); - }, - complete: function() {} + } }); } }); @@ -106,7 +106,6 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum scope.$('td div[data-id="' + id + '"]').append(deleteButton); } }, - error: function(error, data, status) {}, complete: function() { if (searchTable) { --scope.fetchList; @@ -377,14 +376,6 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum options.collection.fetch({ reset: true }); } }, - error: function(error, data, status) { - if (data && data.responseText) { - var data = JSON.parse(data.responseText); - Utils.notifyError({ - content: data.message || data.msgDesc - }); - } - }, complete: function() { --that.asyncFetchCounter if (that.callback && that.asyncFetchCounter === 0) { http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/utils/Messages.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/utils/Messages.js b/dashboardv2/public/js/utils/Messages.js index d6acc32..4bf404e 100644 --- a/dashboardv2/public/js/utils/Messages.js +++ b/dashboardv2/public/js/utils/Messages.js @@ -20,6 +20,7 @@ define(['require'], function(require) { 'use strict'; var Messages = { + defaultErrorMessage: "Something went wrong", addSuccessMessage: " has been created successfully", addErrorMessage: " could not be Created", addTermToEntitySuccessMessage: " has been added to entity", @@ -34,7 +35,7 @@ define(['require'], function(require) { updateTagDescriptionMessage: "Tag description is updated successfully", updateTermDescriptionMessage: "Term description is updated successfully", editSuccessMessage: " has been updated successfully", - assignDeletedEntity: " entity is deleted, Tag cannot be assign" + assignDeletedEntity: " entity is deleted, tag cannot be assigned" }; return Messages; }); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/utils/Overrides.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/utils/Overrides.js b/dashboardv2/public/js/utils/Overrides.js index 3945e9f..d6d9b6c 100644 --- a/dashboardv2/public/js/utils/Overrides.js +++ b/dashboardv2/public/js/utils/Overrides.js @@ -16,13 +16,31 @@ * limitations under the License. */ -define(['require', 'marionette', 'backgrid', 'asBreadcrumbs', 'jquery-placeholder'], function(require) { +define(['require', 'utils/Utils', 'marionette', 'backgrid', 'asBreadcrumbs', 'jquery-placeholder'], function(require, Utils) { 'use strict'; Backbone.$.ajaxSetup({ cache: false }); + var oldBackboneSync = Backbone.sync; + Backbone.sync = function(method, model, options) { + var that = this; + return oldBackboneSync.apply(this, [method, model, + _.extend(options, { + error: function(response) { + if (!options.skipDefaultError) { + Utils.defaultErrorHandler(that, response); + } + that.trigger("error", that, response); + if (options.cust_error) { + options.cust_error(that, response); + } + } + }) + ]); + } + // For placeholder support if (!('placeholder' in HTMLInputElement.prototype)) { var originalRender = Backbone.Marionette.LayoutView.prototype.render; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/utils/Utils.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/utils/Utils.js b/dashboardv2/public/js/utils/Utils.js index 4e003d9..259ea2c 100644 --- a/dashboardv2/public/js/utils/Utils.js +++ b/dashboardv2/public/js/utils/Utils.js @@ -16,7 +16,7 @@ * limitations under the License. */ -define(['require', 'utils/Globals', 'pnotify'], function(require, Globals, pnotify) { +define(['require', 'utils/Globals', 'pnotify', 'utils/Messages'], function(require, Globals, pnotify, Messages) { 'use strict'; var Utils = {}; @@ -79,43 +79,47 @@ define(['require', 'utils/Globals', 'pnotify'], function(require, Globals, pnoti }); }; Utils.defaultErrorHandler = function(model, error) { - if (error.status == 401) { - if (error.statusText) { - var redirectURL; - try { - redirectURL = JSON.parse(error.statusText).knoxssoredirectURL; - } catch(err){ - } - if(redirectURL!=undefined && redirectURL!='' ){ - window.location.replace(decodeURIComponent(redirectURL)); - }else{ - window.location = 'login.jsp'; - } + if (error && error.status) { + if (error.status == 401) { + window.location = 'login.jsp' + } else if (error.status == 419) { + window.location = 'login.jsp' + } else if (error.status == 403) { + var message = "You are not authorized"; + if (error.statusText) { + message = JSON.parse(error.statusText).AuthorizationError; + } + Utils.notifyError({ + content: message + }); + } else if (error.status == "0" && error.statusText != "abort") { + var diffTime = (new Date().getTime() - prevNetworkErrorTime); + if (diffTime > 3000) { + prevNetworkErrorTime = new Date().getTime(); + Utils.notifyError({ + content: "Network Connection Failure : " + + "It seems you are not connected to the internet. Please check your internet connection and try again" + }); + } } else { - window.location = 'login.jsp'; - } - } else if (error.status == 419) { - window.location = 'login.jsp' - } else if (error.status == 403) { - var message = "You are not authorized"; - if (error.statusText) { - message = JSON.parse(error.statusText).AuthorizationError; + Utils.serverErrorHandler(model, error) } + } else { + Utils.serverErrorHandler(model, error) + } + }; + Utils.serverErrorHandler = function(model, response) { + var responseJSON = response ? response.responseJSON : response; + if (response && responseJSON && (responseJSON.errorMessage || responseJSON.message || responseJSON.error)) { Utils.notifyError({ - content: message + content: responseJSON.errorMessage || responseJSON.message || responseJSON.error + }); + } else { + Utils.notifyError({ + content: Messages.defaultErrorMessage }); - } else if (error.status == "0" && error.statusText != "abort") { - var diffTime = (new Date().getTime() - prevNetworkErrorTime); - if (diffTime > 3000) { - prevNetworkErrorTime = new Date().getTime(); - Utils.notifyError({ - content: "Network Connection Failure : " + - "It seems you are not connected to the internet. Please check your internet connection and try again" - }); - } } }; - Utils.localStorage = { checkLocalStorage: function(key, value) { if (typeof(Storage) !== "undefined") { http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/views/business_catalog/BusinessCatalogDetailLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/business_catalog/BusinessCatalogDetailLayoutView.js b/dashboardv2/public/js/views/business_catalog/BusinessCatalogDetailLayoutView.js index edf5dec..6971a3a 100644 --- a/dashboardv2/public/js/views/business_catalog/BusinessCatalogDetailLayoutView.js +++ b/dashboardv2/public/js/views/business_catalog/BusinessCatalogDetailLayoutView.js @@ -158,14 +158,6 @@ define(['require', Utils.notifySuccess({ content: message }); - }, - error: function(model, response) { - if (response.responseJSON && response.responseJSON.error) { - that.collection.fetch({ reset: true }); - Utils.notifyError({ - content: response.responseJSON.error - }); - } } }); } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/views/business_catalog/TreeLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/business_catalog/TreeLayoutView.js b/dashboardv2/public/js/views/business_catalog/TreeLayoutView.js index 431a6e7..b872e50 100644 --- a/dashboardv2/public/js/views/business_catalog/TreeLayoutView.js +++ b/dashboardv2/public/js/views/business_catalog/TreeLayoutView.js @@ -119,19 +119,9 @@ define(['require', this.termSearchData(); }, this); this.listenTo(this.childCollection, 'error', function(model, response) { - if (response && response.responseJSON && response.responseJSON.message) { - Utils.notifyError({ - content: response.responseJSON.message - }); - } this.hideLoader(); }, this); this.listenTo(this.parentCollection, 'error', function(model, response) { - if (response && response.responseJSON && response.responseJSON.message) { - Utils.notifyError({ - content: response.responseJSON.message - }); - } this.hideLoader(); }, this); }, @@ -515,11 +505,6 @@ define(['require', content: "Term " + view.ui.termName.val() + Messages.addSuccessMessage }); }, - error: function(model, response) { - Utils.notifyError({ - content: "Term " + view.ui.termName.val() + Messages.addErrorMessage - }); - }, complete: function() { that.hideLoader(); } @@ -550,6 +535,7 @@ define(['require', url = that.$('.taxonomyTree').find('li.active a').data('href'); var termName = that.$('.taxonomyTree').find('li.active a').text(); termModel.deleteTerm(url, { + skipDefaultError: true, success: function(data) { Utils.notifySuccess({ content: "Term " + termName + Messages.deleteSuccessMessage @@ -567,10 +553,10 @@ define(['require', } that.fetchCollection(termURL, true); }, - error: function(error, data, status) { + cust_error: function(model, response) { var message = "Term " + termName + Messages.deleteErrorMessage; - if (data.error) { - message = data.error; + if (response && response.responseJSON) { + message = response.responseJSON.errorMessage; } Utils.notifyError({ content: message @@ -652,13 +638,14 @@ define(['require', view.model.url = url + "/" + view.ui.termName.val(); this.showLoader(); view.model.set({ description: view.ui.termDetail.val() }).save(null, { + skipDefaultError: true, success: function(model, response) { that.fetchCollection(view.model.url, true); Utils.notifySuccess({ content: "Default taxonomy " + view.ui.termName.val() + Messages.addSuccessMessage }); }, - error: function(error, data, status) { + cust_error: function(model, response) { Utils.notifyError({ content: "Default taxonomy " + view.ui.termName.val() + Messages.addErrorMessage }); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/views/common/aboutAtlas.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/common/aboutAtlas.js b/dashboardv2/public/js/views/common/aboutAtlas.js index 75b009c..8fff13c 100644 --- a/dashboardv2/public/js/views/common/aboutAtlas.js +++ b/dashboardv2/public/js/views/common/aboutAtlas.js @@ -56,7 +56,6 @@ define(['require', var str = "<b>Version : </b>" + data.Version; that.ui.atlasVersion.html(str); }, - error: function(error, data, status) {}, complete: function() {} }); }, http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js b/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js index c98ea18..9f4e1d7 100644 --- a/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js +++ b/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js @@ -516,13 +516,6 @@ define(['require', content: "entity " + Messages[that.guid ? 'editSuccessMessage' : 'addSuccessMessage'] }); }, - error: function(response) { - if (response.responseJSON) { - Utils.notifyError({ - content: response.responseJSON.error || response.responseJSON.errorMessage - }); - } - }, complete: function() { that.hideLoader(); } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/views/graph/LineageLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/graph/LineageLayoutView.js b/dashboardv2/public/js/views/graph/LineageLayoutView.js index c1d860a..7dae6d8 100644 --- a/dashboardv2/public/js/views/graph/LineageLayoutView.js +++ b/dashboardv2/public/js/views/graph/LineageLayoutView.js @@ -92,6 +92,7 @@ define(['require', var that = this; this.fromToObj = {}; this.collection.getLineage(this.guid, { + skipDefaultError: true, success: function(data) { if (data.relations.length) { that.generateData(data.relations, data.guidEntityMap); @@ -99,7 +100,7 @@ define(['require', that.noLineage(); } }, - error: function(error, data, status) { + cust_error: function(model, response) { that.noLineage(); }, complete: function() {} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/views/search/SearchResultLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/search/SearchResultLayoutView.js b/dashboardv2/public/js/views/search/SearchResultLayoutView.js index 8d0720e..23d74a5 100644 --- a/dashboardv2/public/js/views/search/SearchResultLayoutView.js +++ b/dashboardv2/public/js/views/search/SearchResultLayoutView.js @@ -362,7 +362,6 @@ define(['require', } } }, - error: function(error, data, status) {}, complete: function() { --that.asyncFetchCounter; if (that.asyncFetchCounter === 0) { http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/views/tag/CreateTagLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/tag/CreateTagLayoutView.js b/dashboardv2/public/js/views/tag/CreateTagLayoutView.js index 3179276..41f8886 100644 --- a/dashboardv2/public/js/views/tag/CreateTagLayoutView.js +++ b/dashboardv2/public/js/views/tag/CreateTagLayoutView.js @@ -101,7 +101,6 @@ define(['require', str += '<option>' + _.escape(val.get("name")) + '</option>'; }); that.ui.parentTag.html(str); - console.log(platform); // IE9 support if (platform.name === "IE") { that.ui.parentTag.select2({ http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js b/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js index ac28c0f..24e1e24 100644 --- a/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js +++ b/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js @@ -147,13 +147,6 @@ define(['require', content: message }); that.modal.close(); - }, - error: function(model, response) { - if (response.responseJSON && response.responseJSON.error) { - Utils.notifyError({ - content: response.responseJSON.error - }); - } } }); }, http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/views/tag/TagLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/tag/TagLayoutView.js b/dashboardv2/public/js/views/tag/TagLayoutView.js index 9ed7ae9..450866c 100644 --- a/dashboardv2/public/js/views/tag/TagLayoutView.js +++ b/dashboardv2/public/js/views/tag/TagLayoutView.js @@ -251,13 +251,6 @@ define(['require', content: "Tag " + that.name + Messages.addSuccessMessage }); modal.trigger('cancel'); - }, - error: function(model, response) { - if (response.responseJSON && response.responseJSON.error) { - Utils.notifyError({ - content: response.responseJSON.error - }); - } } }); }, http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/dashboardv2/public/js/views/tag/addTagModalView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/tag/addTagModalView.js b/dashboardv2/public/js/views/tag/addTagModalView.js index 9c82d5c..dcefc5a 100644 --- a/dashboardv2/public/js/views/tag/addTagModalView.js +++ b/dashboardv2/public/js/views/tag/addTagModalView.js @@ -207,6 +207,7 @@ define(['require', "attributes": tagAttributes }]; this.entityModel.saveEntity(options.guid, { + skipDefaultError: true, data: JSON.stringify(json), success: function(data) { Utils.notifySuccess({ @@ -216,11 +217,10 @@ define(['require', options.modalCollection.fetch({ reset: true }); } }, - error: function(error, data, status) { + cust_error: function(model, response) { var message = "Tag " + tagName + " could not be added"; - if (error && error.responseText) { - var data = JSON.parse(error.responseText); - message = data.error; + if (response && response.responseJSON) { + message = response.responseJSON.errorMessage; } Utils.notifyError({ content: message http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6679c8ee/release-log.txt ---------------------------------------------------------------------- diff --git a/release-log.txt b/release-log.txt index a770877..dc7d12e 100644 --- a/release-log.txt +++ b/release-log.txt @@ -9,6 +9,8 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai) ALL CHANGES: +ATLAS-1486 UI updates to handle errors from V2 APIs (Kalyanikashikar via mneethiraj) +ATLAS-1436 Metrics collection using gremlin (apoorvnaik via mneethiraj) ATLAS-1489 Show create/edit entity button based on role (Kalyanikashikar via kevalbhatt) ATLAS-1478 REST API to add classification to multiple entities (svimal2106 via mneethiraj) ATLAS-1490 added methods to get sub-types of entity and classification types (mneethiraj)
