Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 2AB40200CCC for ; Fri, 21 Jul 2017 16:05:39 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 25D4C169BDA; Fri, 21 Jul 2017 14:05:39 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 6AA28160BEB for ; Fri, 21 Jul 2017 16:05:38 +0200 (CEST) Received: (qmail 72425 invoked by uid 500); 21 Jul 2017 14:05:37 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 72416 invoked by uid 99); 21 Jul 2017 14:05:37 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Jul 2017 14:05:37 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C236AF327E; Fri, 21 Jul 2017 14:05:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ptupitsyn@apache.org To: commits@ignite.apache.org Date: Fri, 21 Jul 2017 14:05:36 -0000 Message-Id: <86b77214bb7049eb90fce8aa70db3409@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/6] ignite git commit: IGNITE-4728 Web Console: Saved last succeeded state and redirect to it on reload. archived-at: Fri, 21 Jul 2017 14:05:39 -0000 Repository: ignite Updated Branches: refs/heads/master 0adaf6e4a -> ca496f6e9 IGNITE-4728 Web Console: Saved last succeeded state and redirect to it on reload. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/70d0f991 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/70d0f991 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/70d0f991 Branch: refs/heads/master Commit: 70d0f9918c708cb117e69163cc7b7c119c9a693c Parents: 23f26af Author: Dmitriy Shabalin Authored: Thu Jul 20 15:08:20 2017 +0700 Committer: Andrey Novikov Committed: Thu Jul 20 15:08:20 2017 +0700 ---------------------------------------------------------------------- modules/web-console/frontend/app/app.js | 14 ++++++++++++++ .../frontend/app/modules/states/errors.state.js | 6 ++++-- .../frontend/app/modules/states/signin.state.js | 10 +++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/70d0f991/modules/web-console/frontend/app/app.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/app.js b/modules/web-console/frontend/app/app.js index c707810..dc5c6e9 100644 --- a/modules/web-console/frontend/app/app.js +++ b/modules/web-console/frontend/app/app.js @@ -289,6 +289,20 @@ angular $root.$on('$stateChangeStart', () => { _.forEach(angular.element('.modal'), (m) => angular.element(m).scope().$hide()); }); + + if (!$root.IgniteDemoMode) { + $root.$on('$stateChangeSuccess', (event, {name, unsaved}, params) => { + try { + if (unsaved) + localStorage.removeItem('lastStateChangeSuccess'); + else + localStorage.setItem('lastStateChangeSuccess', JSON.stringify({name, params})); + } + catch (ignored) { + // No-op. + } + }); + } }]) .run(['$rootScope', '$http', '$state', 'IgniteMessages', 'User', 'IgniteNotebookData', ($root, $http, $state, Messages, User, Notebook) => { // eslint-disable-line no-shadow http://git-wip-us.apache.org/repos/asf/ignite/blob/70d0f991/modules/web-console/frontend/app/modules/states/errors.state.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/states/errors.state.js b/modules/web-console/frontend/app/modules/states/errors.state.js index e816ff8..e3d4d41 100644 --- a/modules/web-console/frontend/app/modules/states/errors.state.js +++ b/modules/web-console/frontend/app/modules/states/errors.state.js @@ -31,13 +31,15 @@ angular templateUrl: templateNotFoundPage, metaTags: { title: 'Page not found' - } + }, + unsaved: true }) .state('403', { url: '/403', templateUrl: templateNotAuthorizedPage, metaTags: { title: 'Not authorized' - } + }, + unsaved: true }); }]); http://git-wip-us.apache.org/repos/asf/ignite/blob/70d0f991/modules/web-console/frontend/app/modules/states/signin.state.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/states/signin.state.js b/modules/web-console/frontend/app/modules/states/signin.state.js index 5155bde..b7be51d 100644 --- a/modules/web-console/frontend/app/modules/states/signin.state.js +++ b/modules/web-console/frontend/app/modules/states/signin.state.js @@ -33,7 +33,15 @@ angular resolve: { user: ['$state', 'User', ($state, User) => { return User.read() - .then(() => $state.go('base.configuration.tabs')) + .then(() => { + try { + const {name, params} = JSON.parse(localStorage.getItem('lastStateChangeSuccess')); + + $state.go(name, params); + } catch (ignored) { + $state.go('base.configuration.tabs'); + } + }) .catch(() => {}); }] },