aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui
diff options
context:
space:
mode:
authorIdan Amit <ia096e@intl.att.com>2018-05-16 14:32:01 +0300
committerMichael Lando <ml636r@att.com>2018-05-21 20:23:52 +0000
commit5887a4293968696b055af48dae561c0b731f0364 (patch)
tree92cb7767aa1a973fd553da4109e58e7ddbf0d9d7 /catalog-ui
parentf1039ca450c906389099e22b37febf0a73044490 (diff)
Fixing bug with router state change
Fixing a bug on state change to "welcome" page and "previousState" state param. Change-Id: I12be09166809c862766973be8fc3b567d47f955f Issue-ID: SDC-1328 Signed-off-by: Idan Amit <ia096e@intl.att.com>
Diffstat (limited to 'catalog-ui')
-rw-r--r--catalog-ui/src/app/app.ts20
1 files changed, 12 insertions, 8 deletions
diff --git a/catalog-ui/src/app/app.ts b/catalog-ui/src/app/app.ts
index e2240ed18a..723f244dc6 100644
--- a/catalog-ui/src/app/app.ts
+++ b/catalog-ui/src/app/app.ts
@@ -768,7 +768,9 @@ ng1appModule.run([
console.info('$stateChangeStart', toState.name);
if (toState.name !== 'error-403' && !userService.getLoggedinUser()) {
- event.preventDefault();
+ if (toState.name !== 'welcome') {
+ event.preventDefault();
+ }
userService.authorize().subscribe((userInfo:IUserProperties) => {
if (!doesUserHasAccess(toState, userInfo)) {
@@ -824,18 +826,20 @@ ng1appModule.run([
}
}
+ // if enetering workspace, set the previousState param
+ if (toState.name.indexOf('workspace') !== -1) {
+ if (!toParams.previousState) {
+ const tmpPreviousState1 = fromParams && fromParams.previousState;
+ const tmpPreviousState2 = (['dashboard', 'catalog'].indexOf(fromState.name) !== -1) ? fromState.name : 'catalog';
+ toParams.previousState = tmpPreviousState1 || tmpPreviousState2;
+ }
+ }
+
};
let onStateChangeSuccess:Function = (event, toState, toParams, fromState, fromParams):void => {
console.info('$stateChangeSuccess', toState.name);
- //saving last state to params , for breadcrumbs
- if (['dashboard', 'catalog', 'onboardVendor'].indexOf(fromState.name) > -1) {
- toParams.previousState = fromState.name;
- } else {
- toParams.previousState = fromParams.previousState;
- }
-
// Workaround in case we are entering other state then workspace (user move to catalog)
// remove the changeComponentCsarVersion, user should open again the VSP list and select one for update.
if (toState.name.indexOf('workspace') === -1) {