Use detailRoute constant for path of details view
This patch replaces hard coded "project/ngdetails/" for path of details view to constant using "horizon.app.core.detailRoute". Change-Id: Ia0b0c1db3d2df6c3f459d1254deb974e71824bf7 Closes-Bug: #1641250
This commit is contained in:
parent
d28b05f894
commit
cac8f9e094
@ -21,6 +21,7 @@
|
||||
|
||||
clusterTemplatesService.$inject = [
|
||||
'$filter',
|
||||
'horizon.app.core.detailRoute',
|
||||
'horizon.app.core.openstack-service-api.magnum'
|
||||
];
|
||||
|
||||
@ -34,7 +35,7 @@
|
||||
* but do not need to be restricted to such use. Each exposed function
|
||||
* is documented below.
|
||||
*/
|
||||
function clusterTemplatesService($filter, magnum) {
|
||||
function clusterTemplatesService($filter, detailRoute, magnum) {
|
||||
return {
|
||||
getClusterTemplatesPromise: getClusterTemplatesPromise,
|
||||
urlFunction: urlFunction
|
||||
@ -56,7 +57,7 @@
|
||||
}
|
||||
|
||||
function urlFunction(item) {
|
||||
return 'project/ngdetails/OS::Magnum::ClusterTemplate/' + item.id;
|
||||
return detailRoute + 'OS::Magnum::ClusterTemplate/' + item.id;
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
@ -16,10 +16,11 @@
|
||||
"use strict";
|
||||
|
||||
describe('cluster templates service', function() {
|
||||
var service;
|
||||
var service, detailRoute;
|
||||
beforeEach(module('horizon.dashboard.container-infra.cluster-templates'));
|
||||
beforeEach(inject(function($injector) {
|
||||
service = $injector.get('horizon.dashboard.container-infra.cluster-templates.service');
|
||||
detailRoute = $injector.get('horizon.app.core.detailRoute');
|
||||
}));
|
||||
|
||||
describe('getClusterTemplatesPromise', function() {
|
||||
@ -42,7 +43,7 @@
|
||||
describe('urlFunction', function() {
|
||||
it("get url", inject(function() {
|
||||
var result = service.urlFunction({id:"123abc"});
|
||||
expect(result).toBe("project/ngdetails/OS::Magnum::ClusterTemplate/123abc");
|
||||
expect(result).toBe(detailRoute + "OS::Magnum::ClusterTemplate/123abc");
|
||||
}));
|
||||
});
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
clustersService.$inject = [
|
||||
'$filter',
|
||||
'horizon.app.core.detailRoute',
|
||||
'horizon.app.core.openstack-service-api.magnum'
|
||||
];
|
||||
|
||||
@ -34,7 +35,7 @@
|
||||
* but do not need to be restricted to such use. Each exposed function
|
||||
* is documented below.
|
||||
*/
|
||||
function clustersService($filter, magnum) {
|
||||
function clustersService($filter, detailRoute, magnum) {
|
||||
return {
|
||||
getClustersPromise: getClustersPromise,
|
||||
urlFunction: urlFunction
|
||||
@ -55,7 +56,7 @@
|
||||
}
|
||||
|
||||
function urlFunction(item) {
|
||||
return 'project/ngdetails/OS::Magnum::Cluster/' + item.id;
|
||||
return detailRoute + 'OS::Magnum::Cluster/' + item.id;
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
@ -16,10 +16,11 @@
|
||||
"use strict";
|
||||
|
||||
describe('cluster templates service', function() {
|
||||
var service;
|
||||
var service, detailRoute;
|
||||
beforeEach(module('horizon.dashboard.container-infra.cluster-templates'));
|
||||
beforeEach(inject(function($injector) {
|
||||
service = $injector.get('horizon.dashboard.container-infra.clusters.service');
|
||||
detailRoute = $injector.get('horizon.app.core.detailRoute');
|
||||
}));
|
||||
|
||||
describe('getClustersPromise', function() {
|
||||
@ -42,7 +43,7 @@
|
||||
describe('urlFunction', function() {
|
||||
it("get url", inject(function() {
|
||||
var result = service.urlFunction({id:"123abc"});
|
||||
expect(result).toBe("project/ngdetails/OS::Magnum::Cluster/123abc");
|
||||
expect(result).toBe(detailRoute + "OS::Magnum::Cluster/123abc");
|
||||
}));
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user