You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by kb...@apache.org on 2020/02/28 07:07:32 UTC

[atlas] 02/02: ATLAS-3629 : UI: skipDefaultError handler improvement (2 patch)

This is an automated email from the ASF dual-hosted git repository.

kbhatt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit 91d2b8ea5b7b968d243717205903f31e3a2d574f
Author: kevalbhatt <kb...@apache.org>
AuthorDate: Fri Feb 28 11:29:52 2020 +0530

    ATLAS-3629 : UI: skipDefaultError handler improvement (2 patch)
---
 dashboardv2/gruntfile.js                          | 1 +
 dashboardv2/public/js/utils/CommonViewFunction.js | 8 ++++++++
 dashboardv3/gruntfile.js                          | 1 +
 dashboardv3/public/js/utils/CommonViewFunction.js | 8 ++++++++
 4 files changed, 18 insertions(+)

diff --git a/dashboardv2/gruntfile.js b/dashboardv2/gruntfile.js
index 874813b..fef4e08 100644
--- a/dashboardv2/gruntfile.js
+++ b/dashboardv2/gruntfile.js
@@ -63,6 +63,7 @@ module.exports = function(grunt) {
                 proxies: [{
                     context: '/api', // the context of the data service
                     host: '127.0.0.1',
+                    auth: "admin:admin",
                     port: 21000, // the port that the data service is running on
                     https: false
                 }],
diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js
index 1d03732..6b2de3e 100644
--- a/dashboardv2/public/js/utils/CommonViewFunction.js
+++ b/dashboardv2/public/js/utils/CommonViewFunction.js
@@ -884,7 +884,15 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
                             CommonViewFunction.restCsrfCustomHeader = header;
                             CommonViewFunction.restCsrfMethodsToIgnore = {};
                             methods.map(function(method) { CommonViewFunction.restCsrfMethodsToIgnore[method] = true; });
+                            var statusCodeErrorFn = function(error) {
+                                Utils.defaultErrorHandler(null, error)
+                            }
                             Backbone.$.ajaxSetup({
+                                statusCode: {
+                                    401: statusCodeErrorFn,
+                                    419: statusCodeErrorFn,
+                                    403: statusCodeErrorFn
+                                },
                                 beforeSend: CommonViewFunction.addRestCsrfCustomHeader
                             });
                         }
diff --git a/dashboardv3/gruntfile.js b/dashboardv3/gruntfile.js
index edca8f2..f55ff0d 100644
--- a/dashboardv3/gruntfile.js
+++ b/dashboardv3/gruntfile.js
@@ -63,6 +63,7 @@ module.exports = function(grunt) {
                 proxies: [{
                     context: '/api', // the context of the data service
                     host: '127.0.0.1',
+                    auth: "admin:admin",
                     port: 21000, // the port that the data service is running on
                     https: false
                 }],
diff --git a/dashboardv3/public/js/utils/CommonViewFunction.js b/dashboardv3/public/js/utils/CommonViewFunction.js
index e429321..6ddfb84 100644
--- a/dashboardv3/public/js/utils/CommonViewFunction.js
+++ b/dashboardv3/public/js/utils/CommonViewFunction.js
@@ -904,7 +904,15 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
                             CommonViewFunction.restCsrfCustomHeader = header;
                             CommonViewFunction.restCsrfMethodsToIgnore = {};
                             methods.map(function(method) { CommonViewFunction.restCsrfMethodsToIgnore[method] = true; });
+                            var statusCodeErrorFn = function(error) {
+                                Utils.defaultErrorHandler(null, error)
+                            }
                             Backbone.$.ajaxSetup({
+                                statusCode: {
+                                    401: statusCodeErrorFn,
+                                    419: statusCodeErrorFn,
+                                    403: statusCodeErrorFn
+                                },
                                 beforeSend: CommonViewFunction.addRestCsrfCustomHeader
                             });
                         }