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: I1697c87f9ea281ee4fa8963f96bb3b66b9d6cca5 Closes-Bug: #1641250
This commit is contained in:
parent
0c50719352
commit
2c0d48e05a
|
@ -20,6 +20,7 @@
|
|||
.factory('horizon.cluster.clusters.service', clusterService);
|
||||
|
||||
clusterService.$inject = [
|
||||
'horizon.app.core.detailRoute',
|
||||
'horizon.app.core.openstack-service-api.senlin'
|
||||
];
|
||||
|
||||
|
@ -31,7 +32,7 @@
|
|||
* This service provides functions that are used through
|
||||
* the Clusters features.
|
||||
*/
|
||||
function clusterService(senlin) {
|
||||
function clusterService(detailRoute, senlin) {
|
||||
return {
|
||||
getDetailsClusterPath: getDetailsClusterPath,
|
||||
getDetailsProfilePath: getDetailsProfilePath,
|
||||
|
@ -47,7 +48,7 @@
|
|||
* Returns the relative path to the details view.
|
||||
*/
|
||||
function getDetailsClusterPath(item) {
|
||||
return 'project/ngdetails/OS::Senlin::Cluster/' + item.id;
|
||||
return detailRoute + 'OS::Senlin::Cluster/' + item.id;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -58,7 +59,7 @@
|
|||
* Returns the relative path to the details view.
|
||||
*/
|
||||
function getDetailsProfilePath(item) {
|
||||
return 'project/ngdetails/OS::Senlin::Profile/' + item.profile_id;
|
||||
return detailRoute + 'OS::Senlin::Profile/' + item.profile_id;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -17,25 +17,26 @@
|
|||
"use strict";
|
||||
|
||||
describe('Cluster service', function() {
|
||||
var service, $scope;
|
||||
var service, $scope, detailRoute;
|
||||
beforeEach(module('horizon.app.core'));
|
||||
beforeEach(module('horizon.cluster'));
|
||||
|
||||
beforeEach(inject(function($injector, _$rootScope_) {
|
||||
service = $injector.get('horizon.cluster.clusters.service');
|
||||
detailRoute = $injector.get('horizon.app.core.detailRoute');
|
||||
$scope = _$rootScope_.$new();
|
||||
}));
|
||||
|
||||
it("getDetailsClusterPath creates urls using the item's ID", function() {
|
||||
var myItem = {id: "666"};
|
||||
expect(service.getDetailsClusterPath(myItem)).toBe(
|
||||
'project/ngdetails/OS::Senlin::Cluster/666');
|
||||
detailRoute + 'OS::Senlin::Cluster/666');
|
||||
});
|
||||
|
||||
it("getDetailsProfilePath creates urls using the item's ID", function() {
|
||||
var myItem = {profile_id: "666"};
|
||||
expect(service.getDetailsProfilePath(myItem)).toBe(
|
||||
'project/ngdetails/OS::Senlin::Profile/666');
|
||||
detailRoute + 'OS::Senlin::Profile/666');
|
||||
});
|
||||
|
||||
describe('getClusterPromise', function() {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
.factory('horizon.cluster.nodes.service', nodesService);
|
||||
|
||||
nodesService.$inject = [
|
||||
'horizon.app.core.detailRoute',
|
||||
'horizon.app.core.openstack-service-api.senlin'
|
||||
];
|
||||
|
||||
|
@ -30,7 +31,7 @@
|
|||
* This service provides functions that are used through
|
||||
* the Nodes features.
|
||||
*/
|
||||
function nodesService(senlin) {
|
||||
function nodesService(detailRoute, senlin) {
|
||||
return {
|
||||
getDetailsPath: getDetailsPath,
|
||||
getNodePromise: getNodePromise,
|
||||
|
@ -45,7 +46,7 @@
|
|||
* Returns the relative path to the details view.
|
||||
*/
|
||||
function getDetailsPath(item) {
|
||||
return 'project/ngdetails/OS::Senlin::Node/' + item.id;
|
||||
return detailRoute + 'OS::Senlin::Node/' + item.id;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -16,18 +16,19 @@
|
|||
"use strict";
|
||||
|
||||
describe('node service', function() {
|
||||
var service, $scope;
|
||||
var service, $scope, detailRoute;
|
||||
beforeEach(module('horizon.app.core'));
|
||||
beforeEach(module('horizon.cluster'));
|
||||
|
||||
beforeEach(inject(function($injector, _$rootScope_) {
|
||||
service = $injector.get('horizon.cluster.nodes.service');
|
||||
detailRoute = $injector.get('horizon.app.core.detailRoute');
|
||||
$scope = _$rootScope_.$new();
|
||||
}));
|
||||
|
||||
it("getDetailsPath creates urls using the item's ID", function() {
|
||||
var myItem = {id: "666"};
|
||||
expect(service.getDetailsPath(myItem)).toBe('project/ngdetails/OS::Senlin::Node/666');
|
||||
expect(service.getDetailsPath(myItem)).toBe(detailRoute + 'OS::Senlin::Node/666');
|
||||
});
|
||||
|
||||
describe('getNodePromise', function() {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
.factory('horizon.cluster.policies.service', policiesService);
|
||||
|
||||
policiesService.$inject = [
|
||||
'horizon.app.core.detailRoute',
|
||||
'horizon.app.core.openstack-service-api.senlin'
|
||||
];
|
||||
|
||||
|
@ -30,7 +31,7 @@
|
|||
* This service provides functions that are used through
|
||||
* the policies features.
|
||||
*/
|
||||
function policiesService(senlin) {
|
||||
function policiesService(detailRoute, senlin) {
|
||||
return {
|
||||
getDetailsPath: getDetailsPath,
|
||||
getPolicyPromise: getPolicyPromise,
|
||||
|
@ -45,7 +46,7 @@
|
|||
* Returns the relative path to the details view.
|
||||
*/
|
||||
function getDetailsPath(item) {
|
||||
return 'project/ngdetails/OS::Senlin::Policy/' + item.id;
|
||||
return detailRoute + 'OS::Senlin::Policy/' + item.id;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -16,18 +16,19 @@
|
|||
"use strict";
|
||||
|
||||
describe('policy service', function() {
|
||||
var service, $scope;
|
||||
var service, $scope, detailRoute;
|
||||
beforeEach(module('horizon.app.core'));
|
||||
beforeEach(module('horizon.cluster'));
|
||||
|
||||
beforeEach(inject(function($injector, _$rootScope_) {
|
||||
service = $injector.get('horizon.cluster.policies.service');
|
||||
detailRoute = $injector.get('horizon.app.core.detailRoute');
|
||||
$scope = _$rootScope_.$new();
|
||||
}));
|
||||
|
||||
it("getDetailsPath creates urls using the item's ID", function() {
|
||||
var myItem = {id: "666"};
|
||||
expect(service.getDetailsPath(myItem)).toBe('project/ngdetails/OS::Senlin::Policy/666');
|
||||
expect(service.getDetailsPath(myItem)).toBe(detailRoute + 'OS::Senlin::Policy/666');
|
||||
});
|
||||
|
||||
describe('getPolicyPromise', function() {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
.factory('horizon.cluster.profiles.service', profileService);
|
||||
|
||||
profileService.$inject = [
|
||||
'horizon.app.core.detailRoute',
|
||||
'horizon.app.core.openstack-service-api.senlin'
|
||||
];
|
||||
|
||||
|
@ -31,7 +32,7 @@
|
|||
* This service provides functions that are used through
|
||||
* the Profiles features.
|
||||
*/
|
||||
function profileService(senlin) {
|
||||
function profileService(detailRoute, senlin) {
|
||||
return {
|
||||
getDetailsPath: getDetailsPath,
|
||||
getProfilePromise: getProfilePromise,
|
||||
|
@ -46,7 +47,7 @@
|
|||
* Returns the relative path to the details view.
|
||||
*/
|
||||
function getDetailsPath(item) {
|
||||
return 'project/ngdetails/OS::Senlin::Profile/' + item.id;
|
||||
return detailRoute + 'OS::Senlin::Profile/' + item.id;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -17,18 +17,19 @@
|
|||
"use strict";
|
||||
|
||||
describe('profile service', function() {
|
||||
var service, $scope;
|
||||
var service, $scope, detailRoute;
|
||||
beforeEach(module('horizon.app.core'));
|
||||
beforeEach(module('horizon.cluster'));
|
||||
|
||||
beforeEach(inject(function($injector, _$rootScope_) {
|
||||
service = $injector.get('horizon.cluster.profiles.service');
|
||||
detailRoute = $injector.get('horizon.app.core.detailRoute');
|
||||
$scope = _$rootScope_.$new();
|
||||
}));
|
||||
|
||||
it("getDetailsPath creates urls using the item's ID", function() {
|
||||
var myItem = {id: "666"};
|
||||
expect(service.getDetailsPath(myItem)).toBe('project/ngdetails/OS::Senlin::Profile/666');
|
||||
expect(service.getDetailsPath(myItem)).toBe(detailRoute + 'OS::Senlin::Profile/666');
|
||||
});
|
||||
|
||||
describe('getProfilePromise', function() {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
.factory('horizon.cluster.receivers.service', receiversService);
|
||||
|
||||
receiversService.$inject = [
|
||||
'horizon.app.core.detailRoute',
|
||||
'horizon.app.core.openstack-service-api.senlin'
|
||||
];
|
||||
|
||||
|
@ -30,7 +31,7 @@
|
|||
* This service provides functions that are used through
|
||||
* the Receivers features.
|
||||
*/
|
||||
function receiversService(senlin) {
|
||||
function receiversService(detailRoute, senlin) {
|
||||
return {
|
||||
getDetailsPath: getDetailsPath,
|
||||
getReceiverPromise: getReceiverPromise,
|
||||
|
@ -45,7 +46,7 @@
|
|||
* Returns the relative path to the details view.
|
||||
*/
|
||||
function getDetailsPath(item) {
|
||||
return 'project/ngdetails/OS::Senlin::Receiver/' + item.id;
|
||||
return detailRoute + 'OS::Senlin::Receiver/' + item.id;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -16,18 +16,19 @@
|
|||
"use strict";
|
||||
|
||||
describe('receiver service', function() {
|
||||
var service, $scope;
|
||||
var service, $scope, detailRoute;
|
||||
beforeEach(module('horizon.app.core'));
|
||||
beforeEach(module('horizon.cluster'));
|
||||
|
||||
beforeEach(inject(function($injector, _$rootScope_) {
|
||||
service = $injector.get('horizon.cluster.receivers.service');
|
||||
detailRoute = $injector.get('horizon.app.core.detailRoute');
|
||||
$scope = _$rootScope_.$new();
|
||||
}));
|
||||
|
||||
it("getDetailsPath creates urls using the item's ID", function() {
|
||||
var myItem = {id: "666"};
|
||||
expect(service.getDetailsPath(myItem)).toBe('project/ngdetails/OS::Senlin::Receiver/666');
|
||||
expect(service.getDetailsPath(myItem)).toBe(detailRoute + 'OS::Senlin::Receiver/666');
|
||||
});
|
||||
|
||||
describe('getReceiverPromise', function() {
|
||||
|
|
Loading…
Reference in New Issue