Merge "Move to 404 page if specified navigation not found"
This commit is contained in:
commit
7094da9ae3
|
@ -24,7 +24,8 @@
|
|||
getActivePanelUrl: getActivePanelUrl,
|
||||
collapseAllNavigation: collapseAllNavigation,
|
||||
expandNavigationByUrl: expandNavigationByUrl,
|
||||
setBreadcrumb: setBreadcrumb
|
||||
setBreadcrumb: setBreadcrumb,
|
||||
isNavigationExists: isNavigationExists
|
||||
};
|
||||
|
||||
/* get URL for active panel on navigation side bar */
|
||||
|
@ -105,5 +106,10 @@
|
|||
breadcrumb.append(newItem);
|
||||
});
|
||||
}
|
||||
|
||||
/* check whether navigation exists from url */
|
||||
function isNavigationExists(url) {
|
||||
return angular.element("a.openstack-panel[href='" + url + "']").length ? true : false;
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
|
|
@ -158,6 +158,18 @@
|
|||
});
|
||||
});
|
||||
|
||||
describe('isNavigationExists', function() {
|
||||
it('returns true if navigation for specified URL exists', function() {
|
||||
var result = service.isNavigationExists('/project/images/');
|
||||
expect(result).toEqual(true);
|
||||
});
|
||||
|
||||
it('returns false if navigation for specified URL does not exist', function() {
|
||||
var result = service.isNavigationExists('/not/found/');
|
||||
expect(result).toEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
})();
|
||||
|
|
|
@ -74,6 +74,10 @@
|
|||
if (query.hasOwnProperty("nav")) {
|
||||
url = query.nav;
|
||||
}
|
||||
// check navigation from url
|
||||
if (!navigationsService.isNavigationExists(url)) {
|
||||
pageNotFound();
|
||||
}
|
||||
// set navigations (side bar and breadcrumb)
|
||||
var labels = navigationsService.expandNavigationByUrl(url);
|
||||
navigationsService.setBreadcrumb(labels);
|
||||
|
|
Loading…
Reference in New Issue