You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by GitBox <gi...@apache.org> on 2019/12/18 16:16:37 UTC

[GitHub] [brooklyn-ui] jcabrerizo opened a new pull request #159: Manage backend errors including expired sessions

jcabrerizo opened a new pull request #159: Manage backend errors including expired sessions
URL: https://github.com/apache/brooklyn-ui/pull/159
 
 
   Manages the errors that the back end send using the code on this PR: 
   https://github.com/apache/brooklyn-server/pull/1079 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [brooklyn-ui] tbouron commented on a change in pull request #159: Manage backend errors including expired sessions

Posted by GitBox <gi...@apache.org>.
tbouron commented on a change in pull request #159: Manage backend errors including expired sessions
URL: https://github.com/apache/brooklyn-ui/pull/159#discussion_r365888028
 
 

 ##########
 File path: ui-modules/utils/server-status/server-status.js
 ##########
 @@ -73,7 +73,7 @@ export function BrServerStatusDirective() {
                         // we're now getting a new server error, possibly because the old error has expired
                         // but changing the message for the user would be confusing so don't do that!
                         // eg we get a 405 after a 307 (which the browser handles automatically) if redirected to Google for login
-                        console.log("Server responded \"" + stateData + "\" after previous problem \"" + previousState + "\"");
+                        $log.info("Server responded \"" + stateData + "\" after previous problem \"" + previousState + "\"");
 
 Review comment:
   @jcabrerizo You need to add `$log` as the last parameter of the controller function (line 42)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [brooklyn-ui] tbouron commented on a change in pull request #159: Manage backend errors including expired sessions

Posted by GitBox <gi...@apache.org>.
tbouron commented on a change in pull request #159: Manage backend errors including expired sessions
URL: https://github.com/apache/brooklyn-ui/pull/159#discussion_r365318599
 
 

 ##########
 File path: ui-modules/utils/server-status/server-status.js
 ##########
 @@ -55,7 +56,28 @@ export function BrServerStatusDirective() {
             let state = BrServerStatusModalController.STATES.OK;
             let stateData = null;
             if (error) {
-                state = BrServerStatusModalController.STATES.NO_CONNECTION;
+                stateData = response.data;
+
+                if (stateData && stateData.SESSION_AGE_EXCEEDED) {
+                    state = BrServerStatusModalController.STATES.SESSION_AGE_EXCEEDED;
+                } else if (stateData && stateData.SESSION_INVALIDATED) {
+                    state = BrServerStatusModalController.STATES.SESSION_INVALIDATED;
+                }else if(response.status === 404) {
+                    state = BrServerStatusModalController.STATES.NO_CONNECTION;
+                }else if(response.status === 401 || response.status === 403 ) {
+                    state = BrServerStatusModalController.STATES.USER_NOT_AUTHORIZED;
+                }else {
+                    if (previousState === null || previousState == BrServerStatusModalController.STATES.OK){
+                        state = BrServerStatusModalController.STATES.OTHER_ERROR;
+                    } else {
+                        // we're now getting a new server error, possibly because the old error has expired
+                        // but changing the message for the user would be confusing so don't do that!
+                        // eg we get a 405 after a 307 (which the browser handles automatically) if redirected to Google for login
+                        console.log("Server responded \"" + stateData + "\" after previous problem \"" + previousState + "\"");
 
 Review comment:
   Could you use the `$log` service instead and make it `debug`? Can be injected in the controller on line 39

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [brooklyn-ui] jcabrerizo commented on a change in pull request #159: Manage backend errors including expired sessions

Posted by GitBox <gi...@apache.org>.
jcabrerizo commented on a change in pull request #159: Manage backend errors including expired sessions
URL: https://github.com/apache/brooklyn-ui/pull/159#discussion_r365737214
 
 

 ##########
 File path: ui-modules/utils/server-status/server-status.js
 ##########
 @@ -55,7 +56,28 @@ export function BrServerStatusDirective() {
             let state = BrServerStatusModalController.STATES.OK;
             let stateData = null;
             if (error) {
-                state = BrServerStatusModalController.STATES.NO_CONNECTION;
+                stateData = response.data;
+
+                if (stateData && stateData.SESSION_AGE_EXCEEDED) {
+                    state = BrServerStatusModalController.STATES.SESSION_AGE_EXCEEDED;
+                } else if (stateData && stateData.SESSION_INVALIDATED) {
+                    state = BrServerStatusModalController.STATES.SESSION_INVALIDATED;
+                }else if(response.status === 404) {
+                    state = BrServerStatusModalController.STATES.NO_CONNECTION;
+                }else if(response.status === 401 || response.status === 403 ) {
+                    state = BrServerStatusModalController.STATES.USER_NOT_AUTHORIZED;
+                }else {
+                    if (previousState === null || previousState == BrServerStatusModalController.STATES.OK){
+                        state = BrServerStatusModalController.STATES.OTHER_ERROR;
+                    } else {
+                        // we're now getting a new server error, possibly because the old error has expired
+                        // but changing the message for the user would be confusing so don't do that!
+                        // eg we get a 405 after a 307 (which the browser handles automatically) if redirected to Google for login
+                        console.log("Server responded \"" + stateData + "\" after previous problem \"" + previousState + "\"");
 
 Review comment:
   Done. Thanks for pointed it

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [brooklyn-ui] tbouron merged pull request #159: Manage backend errors including expired sessions

Posted by GitBox <gi...@apache.org>.
tbouron merged pull request #159: Manage backend errors including expired sessions
URL: https://github.com/apache/brooklyn-ui/pull/159
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services