You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ss...@apache.org on 2013/10/31 22:53:31 UTC
git commit: Redirected navigation to framework page if slave was gone.
Updated Branches:
refs/heads/master 13b8a8d2c -> 270b7594c
Redirected navigation to framework page if slave was gone.
If an invalid slave ID is used in the redirect controller, redirect the
request to either the homepage or the frameworks page.
Fixes MESOS-650
Review: http://reviews.apache.org/r/15144
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/270b7594
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/270b7594
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/270b7594
Branch: refs/heads/master
Commit: 270b7594c8eb3dd0d4db8461c3ee1108fa16b45d
Parents: 13b8a8d
Author: Ross Allen <re...@gmail.com>
Authored: Mon Oct 14 15:32:59 2013 -0700
Committer: Ross Allen <re...@gmail.com>
Committed: Thu Oct 31 10:09:45 2013 -1000
----------------------------------------------------------------------
src/webui/master/static/js/controllers.js | 38 ++++++++++++++++----------
1 file changed, 24 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/270b7594/src/webui/master/static/js/controllers.js
----------------------------------------------------------------------
diff --git a/src/webui/master/static/js/controllers.js b/src/webui/master/static/js/controllers.js
index 33dbc5d..0c930a2 100644
--- a/src/webui/master/static/js/controllers.js
+++ b/src/webui/master/static/js/controllers.js
@@ -734,7 +734,30 @@
mesosApp.controller('SlaveExecutorRerouterCtrl',
function($http, $location, $routeParams, $scope, $window) {
- var pid = $scope.slaves[$routeParams.slave_id].pid;
+ // TODO(ssorallen): Add error messaging on the following pageview should
+ // an error cause this function to be called.
+ function goBack() {
+ if ($window.history.length > 1) {
+ // If the browser has something in its history, just go back.
+ $window.history.back();
+ } else {
+ // Otherwise navigate to the framework page, which is likely the
+ // previous page anyway.
+ $location.path('/frameworks/' + $routeParams.framework_id).replace();
+ }
+ }
+
+ // When navigating directly to this page, e.g. pasting the URL into the
+ // browser, the previous page is not a page in Mesos. In that case, navigate
+ // home.
+ if (!$scope.slaves) { return $location.path('/').replace(); }
+
+ var slave = $scope.slaves[$routeParams.slave_id];
+
+ // If the slave doesn't exist, send the user back.
+ if (!slave) { return goBack(); }
+
+ var pid = slave.pid;
var hostname = $scope.slaves[$routeParams.slave_id].hostname;
var id = pid.substring(0, pid.indexOf('@'));
var host = hostname + ":" + pid.substring(pid.lastIndexOf(':') + 1);
@@ -744,19 +767,6 @@
$http.jsonp('http://' + host + '/' + id + '/state.json?jsonp=JSON_CALLBACK')
.success(function(response) {
- // TODO(ssorallen): Add error messaging on the following pageview should
- // an error cause this function to be called.
- function goBack() {
- if ($window.history.length > 1) {
- // If the browser has something in its history, just go back.
- $window.history.back();
- } else {
- // Otherwise navigate to the framework page, which is likely the
- // previous page anyway.
- $location.path('/frameworks/' + $routeParams.framework_id).replace();
- }
- }
-
function matchFramework(framework) {
return $routeParams.framework_id === framework.id;
}