You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2014/09/05 11:55:28 UTC
git commit: AMBARI-7165 When pasting in a url that requires login,
login should redirect after login. (atkach)
Repository: ambari
Updated Branches:
refs/heads/trunk 6c651f6dc -> 71ef2f1d1
AMBARI-7165 When pasting in a url that requires login, login should redirect after login. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/71ef2f1d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/71ef2f1d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/71ef2f1d
Branch: refs/heads/trunk
Commit: 71ef2f1d19a8cef3e79793c39389482e59f6fa0c
Parents: 6c651f6
Author: atkach <at...@hortonworks.com>
Authored: Fri Sep 5 12:53:34 2014 +0300
Committer: atkach <at...@hortonworks.com>
Committed: Fri Sep 5 12:53:34 2014 +0300
----------------------------------------------------------------------
ambari-web/app/router.js | 17 +++++++++++++----
ambari-web/app/routes/main.js | 5 +++--
2 files changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/71ef2f1d/ambari-web/app/router.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js
index 15d269c..e9a965f 100644
--- a/ambari-web/app/router.js
+++ b/ambari-web/app/router.js
@@ -29,6 +29,10 @@ App.Router = Em.Router.extend({
enableLogging: true,
isFwdNavigation: true,
backBtnForHigherStep: false,
+ /**
+ * user prefered path to route
+ */
+ preferedPath: null,
setNavigationFlow: function (step) {
var matches = step.match(/\d+$/);
@@ -282,10 +286,15 @@ App.Router = Em.Router.extend({
}
}
if (transitionToApp) {
- router.getSection(function (route) {
- router.transitionTo(route);
- loginController.postLogin(true, true);
- });
+ if (!Em.isNone(router.get('preferedPath'))) {
+ window.location = router.get('preferedPath');
+ router.set('preferedPath', null);
+ } else {
+ router.getSection(function (route) {
+ router.transitionTo(route);
+ loginController.postLogin(true, true);
+ });
+ }
} else {
router.transitionTo('main.views.index');
loginController.postLogin(true,true);
http://git-wip-us.apache.org/repos/asf/ambari/blob/71ef2f1d/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index 057b836..7a39aed 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -45,6 +45,7 @@ module.exports = Em.Route.extend({
});
// TODO: redirect to last known state
} else {
+ router.set('preferedPath', router.location.location.hash);
Em.run.next(function () {
router.transitionTo('login');
});
@@ -89,7 +90,7 @@ module.exports = Em.Route.extend({
route: '/',
enter: function (router) {
Em.run.next(function () {
- router.transitionTo('widgets');
+ router.transitionTo('main.dashboard.widgets');
});
}
}),
@@ -312,7 +313,7 @@ module.exports = Em.Route.extend({
admin: Em.Route.extend({
route: '/admin',
enter: function (router, transition) {
- if (!App.isAdmin) {
+ if (router.get('loggeIn') && !App.get('isAdmin')) {
Em.run.next(function () {
router.transitionTo('main.dashboard.index');
});