diff --git a/magnum_ui/api/magnum.py b/magnum_ui/api/magnum.py
index 04dbc280..198394c6 100644
--- a/magnum_ui/api/magnum.py
+++ b/magnum_ui/api/magnum.py
@@ -98,7 +98,7 @@ def bay_delete(request, id):
def bay_list(request, limit=None, marker=None, sort_key=None,
- sort_dir=None, detail=False):
+ sort_dir=None, detail=True):
return magnumclient(request).bays.list(limit, marker, sort_key,
sort_dir, detail)
diff --git a/magnum_ui/api/rest/magnum.py b/magnum_ui/api/rest/magnum.py
index 0846da66..c26bfd50 100644
--- a/magnum_ui/api/rest/magnum.py
+++ b/magnum_ui/api/rest/magnum.py
@@ -81,7 +81,7 @@ class Bays(generic.View):
item under this is a Bay.
"""
result = magnum.bay_list(request)
- return{'bays': [n.to_dict() for n in result]}
+ return{'bays': [change_to_id(n.to_dict()) for n in result]}
@rest_utils.ajax(data_required=True)
def delete(self, request):
diff --git a/magnum_ui/bay/templates/bay/index.html b/magnum_ui/bay/templates/bay/index.html
index 95c949b8..e47d9000 100644
--- a/magnum_ui/bay/templates/bay/index.html
+++ b/magnum_ui/bay/templates/bay/index.html
@@ -3,8 +3,9 @@
{% block title %}{% trans "Bays" %}{% endblock %}
{% block page_header %}
- {% include "horizon/common/_page_header.html" with title=_("Bays") %}
+
{% endblock page_header %}
{% block main %}
+
{% endblock %}
diff --git a/magnum_ui/static/dashboard/containers/bay/table/table.controller.js b/magnum_ui/static/dashboard/containers/bay/table/table.controller.js
new file mode 100644
index 00000000..72db5183
--- /dev/null
+++ b/magnum_ui/static/dashboard/containers/bay/table/table.controller.js
@@ -0,0 +1,80 @@
+/**
+ * Copyright 2015 Cisco Systems, Inc.
+ *
+ * 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';
+
+ /**
+ * @ngdoc overview
+ * @name containersBayTableController
+ * @ngController
+ *
+ * @description
+ * Controller for the containers bay table
+ */
+ angular
+ .module('horizon.dashboard.containers.bay')
+ .controller('containersBayTableController', containersBayTableController);
+
+ containersBayTableController.$inject = [
+ '$scope',
+ 'horizon.app.core.openstack-service-api.magnum'
+ ];
+
+ function containersBayTableController($scope, magnum) {
+ var ctrl = this;
+ ctrl.ibays = [];
+ ctrl.bays = [];
+
+ ctrl.singleDelete = singleDelete;
+ ctrl.batchDelete = batchDelete;
+
+ init();
+
+ function init() {
+ magnum.getBays().success(getBaysSuccess);
+ }
+
+ function getBaysSuccess(response) {
+ ctrl.bays = response.bays;
+ }
+
+ function singleDelete(bay) {
+ magnum.deleteBay(bay.id).success(function() {
+ ctrl.bays.splice(ctrl.bays.indexOf(bay), 1);
+ });
+ }
+
+ function batchDelete() {
+ var ids = [];
+ for (var id in $scope.selected) {
+ if ($scope.selected[id].checked) {
+ ids.push(id);
+ }
+ }
+ magnum.deleteBays(ids).success(function() {
+ for (var b in ids) {
+ var todelete = ctrl.bays.filter(function(obj) {
+ return obj.id == ids[b];
+ });
+ ctrl.bays.splice(ctrl.bays.indexOf(todelete[0]), 1);
+ }
+ $scope.selected = {};
+ });
+ }
+ }
+
+})();
diff --git a/magnum_ui/static/dashboard/containers/bay/table/table.controller.spec.js b/magnum_ui/static/dashboard/containers/bay/table/table.controller.spec.js
new file mode 100644
index 00000000..e69de29b
diff --git a/magnum_ui/static/dashboard/containers/bay/table/table.html b/magnum_ui/static/dashboard/containers/bay/table/table.html
new file mode 100644
index 00000000..c6add53a
--- /dev/null
+++ b/magnum_ui/static/dashboard/containers/bay/table/table.html
@@ -0,0 +1,162 @@
+
diff --git a/magnum_ui/static/dashboard/containers/magnum.service.js b/magnum_ui/static/dashboard/containers/magnum.service.js
index 7147be15..41f0bd57 100644
--- a/magnum_ui/static/dashboard/containers/magnum.service.js
+++ b/magnum_ui/static/dashboard/containers/magnum.service.js
@@ -27,6 +27,9 @@
function MagnumAPI(apiService, toastService) {
var service = {
+ getBays: getBays,
+ deleteBay: deleteBay,
+ deleteBays: deleteBays,
getBayModels: getBayModels,
deleteBayModel: deleteBayModel,
deleteBayModels: deleteBayModels
@@ -34,7 +37,34 @@
return service;
- ///////////
+ //////////
+ // Bays //
+ //////////
+
+ function getBays() {
+ return apiService.get('/api/containers/bays/')
+ .error(function() {
+ toastService.add('error', gettext('Unable to retrieve the Bays.'));
+ });
+ }
+
+ function deleteBay(id) {
+ return apiService.delete('/api/containers/bays/', [id])
+ .error(function() {
+ toastService.add('error', gettext('Unable to delete the Bay.'));
+ });
+ }
+
+ function deleteBays(ids) {
+ return apiService.delete('/api/containers/bays/', ids)
+ .error(function() {
+ toastService.add('error', gettext('Unable to delete the Bays.'));
+ });
+ }
+
+ ///////////////
+ // BayModels //
+ ///////////////
function getBayModels() {
return apiService.get('/api/containers/baymodels/')