diff options
author | Vadym Markov <vmarkov@mirantis.com> | 2021-11-24 17:18:41 +0200 |
---|---|---|
committer | Vadym Markov <vmarkov@mirantis.com> | 2022-01-25 10:55:44 +0000 |
commit | 0bba95f190594120c21b8aac1852f113eb902ea6 (patch) | |
tree | b84e1e8096a12532cd1434139058bc35f39850d2 | |
parent | 83f864f490d9e7dbbc90bf14893c364de9311349 (diff) | |
download | horizon-0bba95f190594120c21b8aac1852f113eb902ea6.tar.gz |
Make stack template page handle session expiration
Currently, stack template diagram ignores user session timeout and
silently tries to update diagram data getting 401 response for the every
request. Proposed patch redirects to logout if Heat API returns 401 or 403
Closes-Bug: #1952112
Change-Id: I5a389e5fd04ff07cd0821712a56a319e21d91891
-rw-r--r-- | horizon/static/horizon/js/horizon.heattop.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/horizon/static/horizon/js/horizon.heattop.js b/horizon/static/horizon/js/horizon.heattop.js index 97f28ef13..c80b8a3ee 100644 --- a/horizon/static/horizon/js/horizon.heattop.js +++ b/horizon/static/horizon/js/horizon.heattop.js @@ -256,6 +256,10 @@ function ajax_poll(poll_time){ if (needs_update === true){ update(); } + }).fail(function (jqXHR) { + if (jqXHR.status === 401 || jqXHR.status === 403) { + window.location.replace(logout_url); + } }); //if no nodes still in progress, slow AJAX polling if (in_progress === false) { poll_time = 30000; } @@ -270,6 +274,7 @@ if ($(container).length){ height = 500, stack_id = $("#stack_id").data("stack_id"), ajax_url = WEBROOT + 'project/stacks/get_d3_data/' + stack_id + '/', + logout_url = WEBROOT + 'auth/logout', graph = $("#d3_data").data("d3_data"), force = d3.layout.force() .nodes(graph.nodes) |