Fix navigation from admin/trunks

In case of the details of the trunk was reached from admin/trunks add
?nav=/admin/trunks to fix the navigation back to /admin/trunks.

Change-Id: Ie80484814f471a6f939991d1c93ffc7e895102bd
This commit is contained in:
Lajos Katona 2018-02-27 16:17:22 +01:00
parent 07237c1fc6
commit 3af1d420ff
2 changed files with 17 additions and 1 deletions

View File

@ -55,7 +55,11 @@
* view.
*/
function getDetailsPath(item) {
return detailRoute + 'OS::Neutron::Trunk/' + item.id;
var detailsPath = detailRoute + 'OS::Neutron::Trunk/' + item.id;
if ($location.url() === '/admin/trunks') {
detailsPath = detailsPath + "?nav=/admin/trunks/";
}
return detailsPath;
}
/*

View File

@ -73,6 +73,18 @@
expect(result.$$state.value.data.items[0].id).toBe(1);
}));
it('returns detailsPath with nav parameter in case of admin url', function() {
spyOn(_location_, 'url').and.returnValue('/admin/trunks');
var result = service.getDetailsPath({id:"42"});
expect(result).toContain('?nav=/admin/trunks/');
});
it('returns detailsPath without nav parameter in case of non admin url', function() {
spyOn(_location_, 'url').and.returnValue('/project/trunks');
var result = service.getDetailsPath({id:"42"});
expect(result).not.toContain('?nav');
});
});
});