Commit 8eae426c authored by Michael Johnson's avatar Michael Johnson

Remove neutron-lbaas checks and rename "slug"

This patch removes the dependency on neutron-lbaas being enabled in neutron
and it renames the "slug" from ngloadbalancersv2 to load_balancer.  These
changes should allow co-installation of the neutron-lbaas-dashboard with
octavia-dashboard (however, they will both show up as "Load Balancers" in the
menu).

Change-Id: I4b02f67ba10e6339316fd17fcaf522f7339993ca
parent 89674dbf
......@@ -35,7 +35,7 @@ Howto
install on the horizon machine or within horizon's python virtual
environment.
2. Copy ``_1481_project_ng_loadbalancersv2_panel.py`` in
2. Copy ``_1482_project_load_balancer_panel.py`` in
``octavia_dashboard/enabled`` directory
to ``openstack_dashboard/local/enabled``.
......
OCTAVIA_DASHBOARD_DIR=$DEST/octavia-dashboard
OCTAVIA_DASHBOARD_ENABLE_FILE_NAME=_1481_project_ng_loadbalancersv2_panel.py
OCTAVIA_DASHBOARD_ENABLE_FILE_NAME=_1482_project_load_balancer_panel.py
OCTAVIA_DASHBOARD_ENABLE_FILE_PATH=$OCTAVIA_DASHBOARD_DIR/octavia_dashboard/enabled/$OCTAVIA_DASHBOARD_ENABLE_FILE_NAME
......@@ -18,27 +18,10 @@ from django.utils.translation import ugettext_lazy as _
import horizon
from openstack_dashboard.api import neutron
LOG = logging.getLogger(__name__)
class NGLoadBalancers(horizon.Panel):
name = _("Load Balancers")
slug = 'ngloadbalancersv2'
slug = 'load_balancer'
permissions = ('openstack.services.network',)
def allowed(self, context):
request = context['request']
try:
if not neutron.is_service_enabled(request,
config_name='enable_lb',
ext_name='lbaasv2'):
return False
except Exception:
LOG.error("Call to list enabled services failed. This is likely "
"due to a problem communicating with the Neutron "
"endpoint. Load Balancers v2 panel will not be "
"displayed")
return False
return super(NGLoadBalancers, self).allowed(context)
......@@ -14,7 +14,7 @@
from django.conf.urls import url
from octavia_dashboard.dashboards.project.ngloadbalancersv2 import views
from octavia_dashboard.dashboards.project.load_balancer import views
urlpatterns = [
......
......@@ -16,5 +16,5 @@ from horizon.views import HorizonTemplateView
class IndexView(HorizonTemplateView):
template_name = 'project/ngloadbalancersv2/index.html'
template_name = 'project/load_balancer/index.html'
page_title = 'Load Balancers'
......@@ -13,7 +13,7 @@
# limitations under the License.
# The slug of the panel to be added to HORIZON_CONFIG. Required.
PANEL = 'ngloadbalancersv2'
PANEL = 'load_balancer'
# The slug of the dashboard the PANEL is associated with. Required.
PANEL_DASHBOARD = 'project'
# The slug of the panel group the PANEL is associated with.
......@@ -21,7 +21,7 @@ PANEL_GROUP = 'network'
# Python panel class of the PANEL to be added.
ADD_PANEL = (
'octavia_dashboard.dashboards.project.ngloadbalancersv2.panel'
'octavia_dashboard.dashboards.project.load_balancer.panel'
'.NGLoadBalancers')
ADD_INSTALLED_APPS = ['octavia_dashboard']
......
......@@ -80,7 +80,7 @@
function onCreate(response) {
var healthMonitorId = response.data.id;
$location.path('project/ngloadbalancersv2/' + loadbalancerId + '/listeners/' +
$location.path('project/load_balancer/' + loadbalancerId + '/listeners/' +
listenerId + '/pools/' + poolId + '/healthmonitors/' + healthMonitorId);
}
......
......@@ -98,7 +98,7 @@
init('loadbalancer1', 'listener1', loadBalancerState.promise).create.allowed({id: 'pool1'});
service.create.perform();
expect($location.path).toHaveBeenCalledWith(
'project/ngloadbalancersv2/loadbalancer1/listeners/listener1/pools/pool1/' +
'project/load_balancer/loadbalancer1/listeners/listener1/pools/pool1/' +
'healthmonitors/healthmonitor1');
});
......
......@@ -106,7 +106,7 @@
$route.reload();
} else {
// Success, go back to pool details page
var path = 'project/ngloadbalancersv2/' + loadbalancerId +
var path = 'project/load_balancer/' + loadbalancerId +
'/listeners/' + listenerId +
'/pools/' + poolId;
$location.path(path);
......
......@@ -143,7 +143,7 @@
});
it('should return to pool details after delete', function() {
var path = 'project/ngloadbalancersv2/1/listeners/2/pools/3';
var path = 'project/load_balancer/1/listeners/2/pools/3';
spyOn($location, 'path');
spyOn(toast, 'add');
service.perform(monitor);
......
......@@ -3,10 +3,10 @@
<div ng-if="!ctrl.loading && !ctrl.error">
<div class="page-header">
<ol class="breadcrumb">
<li><a href="project/ngloadbalancersv2/"><translate>Load Balancers</translate></a></li>
<li><a href="project/ngloadbalancersv2/{$ ::ctrl.loadbalancer.id $}">{$ ::(ctrl.loadbalancer.name || ctrl.loadbalancer.id) $}</a></li>
<li><a href="project/ngloadbalancersv2/{$ ::ctrl.loadbalancer.id $}/listeners/{$ ::ctrl.listener.id $}">{$ ::(ctrl.listener.name || ctrl.listener.id) $}</a></li>
<li><a href="project/ngloadbalancersv2/{$ ::ctrl.loadbalancer.id $}/listeners/{$ ::ctrl.listener.id $}/pools/{$ ::ctrl.pool.id $}">{$ ::(ctrl.pool.name || ctrl.pool.id) $}</a></li>
<li><a href="project/load_balancer/"><translate>Load Balancers</translate></a></li>
<li><a href="project/load_balancer/{$ ::ctrl.loadbalancer.id $}">{$ ::(ctrl.loadbalancer.name || ctrl.loadbalancer.id) $}</a></li>
<li><a href="project/load_balancer/{$ ::ctrl.loadbalancer.id $}/listeners/{$ ::ctrl.listener.id $}">{$ ::(ctrl.listener.name || ctrl.listener.id) $}</a></li>
<li><a href="project/load_balancer/{$ ::ctrl.loadbalancer.id $}/listeners/{$ ::ctrl.listener.id $}/pools/{$ ::ctrl.pool.id $}">{$ ::(ctrl.pool.name || ctrl.pool.id) $}</a></li>
<li class="active">{$ ::(ctrl.healthmonitor.name || ctrl.healthmonitor.id) $}</li>
<actions allowed="ctrl.actions" type="row" item="ctrl.healthmonitor"
ng-if="ctrl.healthmonitor" class="actions_column pull-right"></actions>
......@@ -39,4 +39,4 @@
</div>
</div>
</div>
</div>
\ No newline at end of file
</div>
......@@ -57,7 +57,7 @@
var basePath = $windowProvider.$get().STATIC_URL + 'dashboard/project/lbaasv2/';
$provide.constant('horizon.dashboard.project.lbaasv2.basePath', basePath);
var loadbalancers = '/project/ngloadbalancersv2';
var loadbalancers = '/project/load_balancer';
var listener = loadbalancers + '/:loadbalancerId/listeners/:listenerId';
var pool = listener + '/pools/:poolId';
var member = pool + '/members/:memberId';
......
......@@ -105,7 +105,7 @@
});
it('should route URLs', function () {
var loadbalancers = '/project/ngloadbalancersv2';
var loadbalancers = '/project/load_balancer';
var listener = loadbalancers + '/:loadbalancerId/listeners/:listenerId';
var pool = listener + '/pools/:poolId';
var member = pool + '/members/:memberId';
......
......@@ -100,7 +100,7 @@
function onCreate(response) {
var id = response.data.id;
$location.path('project/ngloadbalancersv2/' + loadBalancerId + '/listeners/' + id);
$location.path('project/load_balancer/' + loadBalancerId + '/listeners/' + id);
}
}
......
......@@ -98,7 +98,7 @@
it('should redirect after create', function() {
spyOn($location, 'path').and.callThrough();
actions[0].service.perform();
expect($location.path).toHaveBeenCalledWith('project/ngloadbalancersv2/1234/listeners/5678');
expect($location.path).toHaveBeenCalledWith('project/load_balancer/1234/listeners/5678');
});
});
......
......@@ -115,11 +115,11 @@
} else {
// If the user is on the listeners table then just reload the page, otherwise they
// are on the details page and we return to the table.
var regex = new RegExp('project\/ngloadbalancersv2\/' + loadbalancerId + '(\/)?$');
var regex = new RegExp('project\/load_balancer\/' + loadbalancerId + '(\/)?$');
if (regex.test($location.path())) {
$route.reload();
} else {
$location.path('project/ngloadbalancersv2/' + loadbalancerId);
$location.path('project/load_balancer/' + loadbalancerId);
}
}
}
......
......@@ -144,7 +144,7 @@
});
it('should reload table after delete', function() {
path = 'project/ngloadbalancersv2/1';
path = 'project/load_balancer/1';
spyOn($route, 'reload');
service.perform(items);
$scope.$apply();
......@@ -152,12 +152,12 @@
});
it('should return to table after delete if on detail page', function() {
path = 'project/ngloadbalancersv2/1/listeners/2';
path = 'project/load_balancer/1/listeners/2';
spyOn($location, 'path');
spyOn(toast, 'add');
service.perform(items[0]);
$scope.$apply();
expect($location.path).toHaveBeenCalledWith('project/ngloadbalancersv2/1');
expect($location.path).toHaveBeenCalledWith('project/load_balancer/1');
expect(toast.add).toHaveBeenCalledWith('success', 'Deleted listeners: First.');
});
......
......@@ -3,8 +3,8 @@
<div ng-if="!ctrl.loading && !ctrl.error">
<div class="page-header">
<ol class="breadcrumb">
<li><a href="project/ngloadbalancersv2/"><translate>Load Balancers</translate></a></li>
<li><a href="project/ngloadbalancersv2/{$ ::ctrl.loadbalancer.id $}">{$ ::(ctrl.loadbalancer.name || ctrl.loadbalancer.id) $}</a></li>
<li><a href="project/load_balancer/"><translate>Load Balancers</translate></a></li>
<li><a href="project/load_balancer/{$ ::ctrl.loadbalancer.id $}">{$ ::(ctrl.loadbalancer.name || ctrl.loadbalancer.id) $}</a></li>
<li class="active">{$ ::(ctrl.listener.name || ctrl.listener.id) $}</li>
<actions allowed="ctrl.actions" type="row" item="ctrl.listener" ng-if="ctrl.listener"
class="actions_column pull-right"></actions>
......@@ -24,7 +24,7 @@
<dd>{$ ctrl.listener.admin_state_up | yesno $}</dd>
<dt translate>Default Pool ID</dt>
<dd>
<a ng-href="project/ngloadbalancersv2/{$ ::ctrl.loadbalancer.id $}/listeners/{$ ::ctrl.listener.id $}/pools/{$ ::ctrl.listener.default_pool_id $}" ng-if="ctrl.listener.default_pool_id">
<a ng-href="project/load_balancer/{$ ::ctrl.loadbalancer.id $}/listeners/{$ ::ctrl.listener.id $}/pools/{$ ::ctrl.listener.default_pool_id $}" ng-if="ctrl.listener.default_pool_id">
{$ ::ctrl.listener.default_pool_id $}
</a>
<span ng-if="!ctrl.listener.default_pool_id">
......@@ -39,4 +39,4 @@
</div>
</div>
</div>
</div>
\ No newline at end of file
</div>
......@@ -68,7 +68,7 @@
duration="200">
</span>
</td>
<td class="rsp-p1"><a ng-href="project/ngloadbalancersv2/{$ ::table.loadbalancerId $}/listeners/{$ ::item.id $}">{$ ::(item.name || item.id) $}</a></td>
<td class="rsp-p1"><a ng-href="project/load_balancer/{$ ::table.loadbalancerId $}/listeners/{$ ::item.id $}">{$ ::(item.name || item.id) $}</a></td>
<td class="rsp-p1">{$ ::item.description | noValue $}</td>
<td class="rsp-p1">{$ ::item.protocol$}</td>
<td class="rsp-p1">{$ ::item.protocol_port$}</td>
......@@ -121,4 +121,4 @@
-->
<tfoot hz-table-footer items="table.items"></tfoot>
</table>
\ No newline at end of file
</table>
......@@ -86,7 +86,7 @@
}
function onCreate(response) {
$location.path('project/ngloadbalancersv2/' + response.data.id);
$location.path('project/load_balancer/' + response.data.id);
}
}
......
......@@ -76,7 +76,7 @@
it('should redirect after create', function() {
spyOn($location, 'path').and.callThrough();
actions[0].service.perform();
expect($location.path).toHaveBeenCalledWith('project/ngloadbalancersv2/1');
expect($location.path).toHaveBeenCalledWith('project/load_balancer/1');
});
});
......
......@@ -142,10 +142,10 @@
} else {
// If the user is on the load balancers table then just reload the page, otherwise they
// are on the details page and we return to the table.
if (/\/ngloadbalancersv2(\/)?$/.test($location.path())) {
if (/\/load_balancer(\/)?$/.test($location.path())) {
$route.reload();
} else {
$location.path('project/ngloadbalancersv2');
$location.path('project/load_balancer');
}
}
}
......
......@@ -156,7 +156,7 @@
});
it('should reload table after delete', function() {
path = 'project/ngloadbalancersv2';
path = 'project/load_balancer';
spyOn($route, 'reload');
service.perform(items);
$scope.$apply();
......@@ -164,12 +164,12 @@
});
it('should return to table after delete if on detail page', function() {
path = 'project/ngloadbalancersv2/1';
path = 'project/load_balancer/1';
spyOn($location, 'path');
spyOn(toast, 'add');
service.perform(items[0]);
$scope.$apply();
expect($location.path).toHaveBeenCalledWith('project/ngloadbalancersv2');
expect($location.path).toHaveBeenCalledWith('project/load_balancer');
expect(toast.add).toHaveBeenCalledWith('success', 'Deleted load balancers: First.');
});
......
......@@ -3,7 +3,7 @@
<div ng-if="!ctrl.loading && !ctrl.error">
<div class="page-header">
<ol class="breadcrumb">
<li><a href="project/ngloadbalancersv2/"><translate>Load Balancers</translate></a></li>
<li><a href="project/load_balancer/"><translate>Load Balancers</translate></a></li>
<li class="active">{$ ctrl.loadbalancer.name || ctrl.loadbalancer.id $}</li>
<actions allowed="ctrl.actions" type="row" item="ctrl.loadbalancer"
ng-if="ctrl.loadbalancer" class="actions_column pull-right"></actions>
......@@ -54,4 +54,4 @@
</tab>
</tabset>
</div>
</div>
\ No newline at end of file
</div>
......@@ -72,7 +72,7 @@
duration="200">
</span>
</td>
<td class="rsp-p1"><a ng-href="project/ngloadbalancersv2/{$ ::item.id $}">{$ ::(item.name || item.id) $}</a></td>
<td class="rsp-p1"><a ng-href="project/load_balancer/{$ ::item.id $}">{$ ::(item.name || item.id) $}</a></td>
<td class="rsp-p1">{$ ::item.description | noValue $}</td>
<td class="rsp-p1">{$ ::item.operating_status | decode:table.operatingStatus $}</td>
<td class="rsp-p1">{$ ::item.provisioning_status | decode:table.provisioningStatus $}</td>
......@@ -152,4 +152,4 @@
-->
<tfoot hz-table-footer items="table.items"></tfoot>
</table>
\ No newline at end of file
</table>
......@@ -3,10 +3,10 @@
<div ng-if="!ctrl.loading && !ctrl.error">
<div class="page-header">
<ol class="breadcrumb">
<li><a href="project/ngloadbalancersv2/"><translate>Load Balancers</translate></a></li>
<li><a href="project/ngloadbalancersv2/{$ ::ctrl.loadbalancer.id $}">{$ ::(ctrl.loadbalancer.name || ctrl.loadbalancer.id) $}</a></li>
<li><a href="project/ngloadbalancersv2/{$ ::ctrl.loadbalancer.id $}/listeners/{$ ::ctrl.listener.id $}">{$ ::(ctrl.listener.name || ctrl.listener.id) $}</a></li>
<li><a href="project/ngloadbalancersv2/{$ ::ctrl.loadbalancer.id $}/listeners/{$ ::ctrl.listener.id $}/pools/{$ ::ctrl.pool.id $}">{$ ::(ctrl.pool.name || ctrl.pool.id) $}</a></li>
<li><a href="project/load_balancer/"><translate>Load Balancers</translate></a></li>
<li><a href="project/load_balancer/{$ ::ctrl.loadbalancer.id $}">{$ ::(ctrl.loadbalancer.name || ctrl.loadbalancer.id) $}</a></li>
<li><a href="project/load_balancer/{$ ::ctrl.loadbalancer.id $}/listeners/{$ ::ctrl.listener.id $}">{$ ::(ctrl.listener.name || ctrl.listener.id) $}</a></li>
<li><a href="project/load_balancer/{$ ::ctrl.loadbalancer.id $}/listeners/{$ ::ctrl.listener.id $}/pools/{$ ::ctrl.pool.id $}">{$ ::(ctrl.pool.name || ctrl.pool.id) $}</a></li>
<li class="active">{$ ::(ctrl.member.name || ctrl.member.id) $}</li>
<actions allowed="ctrl.actions" type="row" item="ctrl.member"
ng-if="ctrl.member" class="actions_column pull-right"></actions>
......
......@@ -62,7 +62,7 @@
ng-model="tCtrl.selections[item.id].checked"
hz-select="item">
</td>
<td class="rsp-p1"><a ng-href="project/ngloadbalancersv2/{$ ::table.loadbalancerId $}/listeners/{$ ::table.listenerId $}/pools/{$ ::table.poolId $}/members/{$ ::item.id $}">{$ ::item.id $}</a></td>
<td class="rsp-p1"><a ng-href="project/load_balancer/{$ ::table.loadbalancerId $}/listeners/{$ ::table.listenerId $}/pools/{$ ::table.poolId $}/members/{$ ::item.id $}">{$ ::item.id $}</a></td>
<td class="rsp-p1">{$ ::item.address $}</td>
<td class="rsp-p1">{$ ::item.protocol_port $}</td>
<td class="rsp-p1">{$ ::item.operating_status | decode:table.operatingStatus $}</td>
......@@ -86,4 +86,4 @@
-->
<tfoot hz-table-footer items="table.items"></tfoot>
</table>
\ No newline at end of file
</table>
......@@ -81,7 +81,7 @@
function onCreate(response) {
var poolId = response.data.id;
$location.path('project/ngloadbalancersv2/' + loadbalancerId + '/listeners/' +
$location.path('project/load_balancer/' + loadbalancerId + '/listeners/' +
listenerId + '/pools/' + poolId);
}
......
......@@ -104,7 +104,7 @@
init('1234', defer.promise).create.allowed({id: '5678'});
createPoolService.create.perform();
expect($location.path).toHaveBeenCalledWith(
'project/ngloadbalancersv2/1234/listeners/5678/pools/9012');
'project/load_balancer/1234/listeners/5678/pools/9012');
});
});
......
......@@ -103,7 +103,7 @@
$route.reload();
} else {
// Success, go back to listener details page
var path = 'project/ngloadbalancersv2/' + loadbalancerId + '/listeners/' + listenerId;
var path = 'project/load_balancer/' + loadbalancerId + '/listeners/' + listenerId;
$location.path(path);
}
}
......
......@@ -146,7 +146,7 @@
spyOn(toast, 'add');
service.perform(pool);
$scope.$apply();
expect($location.path).toHaveBeenCalledWith('project/ngloadbalancersv2/1/listeners/2');
expect($location.path).toHaveBeenCalledWith('project/load_balancer/1/listeners/2');
expect(toast.add).toHaveBeenCalledWith('success', 'Deleted pool: Pool1.');
});
......
......@@ -3,9 +3,9 @@
<div ng-if="!ctrl.loading && !ctrl.error">
<div class="page-header">
<ol class="breadcrumb">
<li><a href="project/ngloadbalancersv2/"><translate>Load Balancers</translate></a></li>
<li><a href="project/ngloadbalancersv2/{$ ::ctrl.loadbalancer.id $}">{$ ::(ctrl.loadbalancer.name || ctrl.loadbalancer.id) $}</a></li>
<li><a href="project/ngloadbalancersv2/{$ ::ctrl.loadbalancer.id $}/listeners/{$ ::ctrl.listener.id $}">{$ ::(ctrl.listener.name || ctrl.listener.id) $}</a></li>
<li><a href="project/load_balancer/"><translate>Load Balancers</translate></a></li>
<li><a href="project/load_balancer/{$ ::ctrl.loadbalancer.id $}">{$ ::(ctrl.loadbalancer.name || ctrl.loadbalancer.id) $}</a></li>
<li><a href="project/load_balancer/{$ ::ctrl.loadbalancer.id $}/listeners/{$ ::ctrl.listener.id $}">{$ ::(ctrl.listener.name || ctrl.listener.id) $}</a></li>
<li class="active">{$ ::(ctrl.pool.name || ctrl.pool.id) $}</li>
<actions allowed="ctrl.actions" type="row" item="ctrl.pool"
ng-if="ctrl.pool" class="actions_column pull-right"></actions>
......@@ -27,7 +27,7 @@
<dd>{$ ctrl.pool.admin_state_up | yesno $}</dd>
<dt translate>Health Monitor ID</dt>
<dd>
<a ng-href="project/ngloadbalancersv2/{$ ::ctrl.loadbalancer.id $}/listeners/{$ ::ctrl.listener.id $}/pools/{$ ::ctrl.pool.id $}/healthmonitors/{$ ::ctrl.pool.healthmonitor_id $}" ng-if="ctrl.pool.healthmonitor_id">
<a ng-href="project/load_balancer/{$ ::ctrl.loadbalancer.id $}/listeners/{$ ::ctrl.listener.id $}/pools/{$ ::ctrl.pool.id $}/healthmonitors/{$ ::ctrl.pool.healthmonitor_id $}" ng-if="ctrl.pool.healthmonitor_id">
{$ ::ctrl.pool.healthmonitor_id $}
</a>
<span ng-if="!ctrl.pool.healthmonitor_id">
......@@ -47,4 +47,4 @@
</tab>
</tabset>
</div>
</div>
\ No newline at end of file
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment