Files
octavia-dashboard/neutron_lbaas_dashboard/static/dashboard/project/lbaasv2/members/detail.controller.js
Lucas Palm 7b90156da1 Add the angular LBaaS V2 members table and detail pages
This change implements the members table under the 'Members' tab on the pools
detail page that shows all of the members that belong to that particular pool.
It also adds the member detail page which includes the details for a specific
member in the pool.

Partially-Implements: blueprint horizon-lbaas-v2-ui
Change-Id: I879c840d174630c697375c5ce7649b01303aeb00
2016-02-05 14:54:00 +00:00

99 lines
2.5 KiB
JavaScript

/*
* Copyright 2016 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function() {
'use strict';
angular
.module('horizon.dashboard.project.lbaasv2.members')
.controller('MemberDetailController', MemberDetailController);
MemberDetailController.$inject = [
'horizon.app.core.openstack-service-api.lbaasv2',
'$routeParams'
];
/**
* @ngdoc controller
* @name MemberDetailController
*
* @description
* Controller for the LBaaS v2 member detail page.
*
* @param api The LBaaS v2 API service.
* @param $routeParams The angular $routeParams service.
* @returns undefined
*/
function MemberDetailController(api, $routeParams) {
var ctrl = this;
ctrl.member = {};
ctrl.pool = {};
ctrl.listener = {};
ctrl.loadbalancer = {};
var poolID = $routeParams.poolId;
var memberID = $routeParams.memberId;
init();
////////////////////////////////
function init() {
api.getMember(poolID, memberID).success(memberSuccess);
}
function memberSuccess(response) {
ctrl.member = response;
getPoolDetails(poolID);
}
function getPoolDetails(poolId) {
api.getPool(poolId).success(poolSuccess);
}
function poolSuccess(response) {
ctrl.pool = response;
if (ctrl.pool.hasOwnProperty('listeners') &&
ctrl.pool.listeners.length > 0) {
getListenerDetails(ctrl.pool.listeners[0].id);
}
}
function getListenerDetails(listenerId) {
api.getListener(listenerId).success(listenerSuccess);
}
function listenerSuccess(response) {
ctrl.listener = response;
if (ctrl.listener.hasOwnProperty('loadbalancers') &&
ctrl.listener.loadbalancers.length > 0) {
getLoadBalancerDetails(ctrl.listener.loadbalancers[0].id);
}
}
function getLoadBalancerDetails(loadbalancerId) {
api.getLoadBalancer(loadbalancerId).success(loadbalancerSuccess);
}
function loadbalancerSuccess(response) {
ctrl.loadbalancer = response;
}
}
})();