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

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

commit 8d9c06fe1527f637301c1c4d47dc3e2edd1abde3
Author: kevalbhatt <[email protected]>
AuthorDate: Fri Feb 28 11:29:52 2020 +0530

    ATLAS-3629 : UI: skipDefaultError handler improvement (2 patch)
    
    (cherry picked from commit 91d2b8ea5b7b968d243717205903f31e3a2d574f)
---
 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 5650f41..cd9fd61 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
                             });
                         }

Reply via email to