Add pools panel into admin dashboard
This patch adds storage pools panel into admin dashboard. This provides only list view. Actions will be provided in the next patch. Change-Id: Ia8cb1a0718001292ef078850d5e0433c88c9a0f2 Partial-Implements: blueprint support-pool
This commit is contained in:
parent
61b638e722
commit
13820b1358
0
zaqar_ui/content/pools/__init__.py
Normal file
0
zaqar_ui/content/pools/__init__.py
Normal file
22
zaqar_ui/content/pools/panel.py
Normal file
22
zaqar_ui/content/pools/panel.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# Copyright 2015 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.
|
||||||
|
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
import horizon
|
||||||
|
|
||||||
|
|
||||||
|
class Pools(horizon.Panel):
|
||||||
|
name = _("Pools")
|
||||||
|
slug = "pools"
|
19
zaqar_ui/content/pools/urls.py
Normal file
19
zaqar_ui/content/pools/urls.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
from django.conf import urls
|
||||||
|
from horizon.browsers import views
|
||||||
|
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
urls.url(r'^$', views.AngularIndexView.as_view(), name='index'),
|
||||||
|
]
|
24
zaqar_ui/enabled/_2510_admin_messaging_group.py
Normal file
24
zaqar_ui/enabled/_2510_admin_messaging_group.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# Copyright 2015 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.
|
||||||
|
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
# The slug of the panel group to be added to HORIZON_CONFIG. Required.
|
||||||
|
PANEL_GROUP = 'messaging'
|
||||||
|
|
||||||
|
# The display name of the PANEL_GROUP. Required.
|
||||||
|
PANEL_GROUP_NAME = _('Messaging')
|
||||||
|
|
||||||
|
# The slug of the dashboard the PANEL_GROUP associated with. Required.
|
||||||
|
PANEL_GROUP_DASHBOARD = 'admin'
|
22
zaqar_ui/enabled/_2520_admin_pools.py
Normal file
22
zaqar_ui/enabled/_2520_admin_pools.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# Copyright 2015 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.
|
||||||
|
|
||||||
|
PANEL = 'pools'
|
||||||
|
PANEL_GROUP = 'messaging'
|
||||||
|
PANEL_DASHBOARD = 'admin'
|
||||||
|
|
||||||
|
ADD_PANEL = ('zaqar_ui.content.pools.panel.Pools')
|
||||||
|
ADD_ANGULAR_MODULES = ['horizon.dashboard.admin.pools']
|
||||||
|
|
||||||
|
AUTO_DISCOVER_STATIC_FILES = True
|
5
zaqar_ui/static/dashboard/admin/pools/drawer.html
Normal file
5
zaqar_ui/static/dashboard/admin/pools/drawer.html
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<hz-resource-property-list
|
||||||
|
resource-type-name="OS::Zaqar::Pools"
|
||||||
|
item="item"
|
||||||
|
property-groups="[['uri'], ['options']]">
|
||||||
|
</hz-resource-property-list>
|
4
zaqar_ui/static/dashboard/admin/pools/panel.html
Normal file
4
zaqar_ui/static/dashboard/admin/pools/panel.html
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<hz-resource-panel resource-type-name="OS::Zaqar::Pools">
|
||||||
|
<hz-resource-table resource-type-name="OS::Zaqar::Pools" track-by="name">
|
||||||
|
</hz-resource-table>
|
||||||
|
</hz-resource-panel>
|
120
zaqar_ui/static/dashboard/admin/pools/pools.module.js
Normal file
120
zaqar_ui/static/dashboard/admin/pools/pools.module.js
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
/*
|
||||||
|
* 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 horizon.dashboard.admin.pools
|
||||||
|
* @description Pools module for messaging.
|
||||||
|
*/
|
||||||
|
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.admin.pools', [
|
||||||
|
'ngRoute'
|
||||||
|
])
|
||||||
|
.constant('horizon.dashboard.admin.pools.resourceType', 'OS::Zaqar::Pools')
|
||||||
|
.run(run)
|
||||||
|
.config(config);
|
||||||
|
|
||||||
|
run.$inject = [
|
||||||
|
'horizon.app.core.openstack-service-api.zaqar',
|
||||||
|
'horizon.dashboard.admin.pools.basePath',
|
||||||
|
'horizon.dashboard.admin.pools.resourceType',
|
||||||
|
'horizon.dashboard.admin.pools.service',
|
||||||
|
'horizon.framework.conf.resource-type-registry.service'
|
||||||
|
];
|
||||||
|
|
||||||
|
function run(zaqar, basePath, resourceType, poolsService, registry) {
|
||||||
|
registry.getResourceType(resourceType)
|
||||||
|
.setNames(gettext('Pool'), gettext('Pools'))
|
||||||
|
.setSummaryTemplateUrl(basePath + 'drawer.html')
|
||||||
|
.setProperties(poolProperties())
|
||||||
|
.setListFunction(poolsService.getPoolsPromise)
|
||||||
|
.tableColumns
|
||||||
|
.append({
|
||||||
|
id: 'name',
|
||||||
|
priority: 1,
|
||||||
|
sortDefault: true
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
id: 'group',
|
||||||
|
priority: 1
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
id: 'weight',
|
||||||
|
priority: 1
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
id: 'uri',
|
||||||
|
priority: 2
|
||||||
|
});
|
||||||
|
// for magic-search
|
||||||
|
registry.getResourceType(resourceType).filterFacets
|
||||||
|
.append({
|
||||||
|
label: gettext('Name'),
|
||||||
|
name: 'name',
|
||||||
|
singleton: true
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
label: gettext('Group'),
|
||||||
|
name: 'group',
|
||||||
|
singleton: true
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
label: gettext('Weight'),
|
||||||
|
name: 'weight',
|
||||||
|
singleton: true
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
label: gettext('URI'),
|
||||||
|
name: 'uri',
|
||||||
|
singleton: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function poolProperties() {
|
||||||
|
return {
|
||||||
|
name: { label: gettext('Name'), filters: [] },
|
||||||
|
group: { label: gettext('Group'), filters: ['noName'] },
|
||||||
|
weight: { label: gettext('Weight'), filters: ['noValue'] },
|
||||||
|
uri: { label: gettext('URI'), filters: ['noValue'] },
|
||||||
|
options: { label: gettext('Options'), filters: ['noValue'] }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
config.$inject = [
|
||||||
|
'$provide',
|
||||||
|
'$windowProvider',
|
||||||
|
'$routeProvider'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ndoc config
|
||||||
|
* @name horizon.dashboard.admin.pools.basePath
|
||||||
|
* @param {Object} $provide
|
||||||
|
* @param {Object} $windowProvider
|
||||||
|
* @param {Object} $routeProvider
|
||||||
|
* @returns {undefined} Returns nothing
|
||||||
|
* @description Base path for the pools panel
|
||||||
|
*/
|
||||||
|
function config($provide, $windowProvider, $routeProvider) {
|
||||||
|
var path = $windowProvider.$get().STATIC_URL + 'dashboard/admin/pools/';
|
||||||
|
$provide.constant('horizon.dashboard.admin.pools.basePath', path);
|
||||||
|
|
||||||
|
$routeProvider.when('/admin/pools', {
|
||||||
|
templateUrl: path + 'panel.html'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}());
|
49
zaqar_ui/static/dashboard/admin/pools/pools.service.js
Normal file
49
zaqar_ui/static/dashboard/admin/pools/pools.service.js
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* 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.admin.pools')
|
||||||
|
.factory('horizon.dashboard.admin.pools.service', poolsService);
|
||||||
|
|
||||||
|
poolsService.$inject = [
|
||||||
|
'horizon.app.core.openstack-service-api.zaqar'
|
||||||
|
];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @ngdoc factory
|
||||||
|
* @name horizon.dashboard.admin.pools.service
|
||||||
|
*
|
||||||
|
* @description
|
||||||
|
* This service provides functions that are used through
|
||||||
|
* the Pools features.
|
||||||
|
*/
|
||||||
|
function poolsService(zaqar) {
|
||||||
|
return {
|
||||||
|
getPoolsPromise: getPoolsPromise
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @ngdoc function
|
||||||
|
* @name getPoolsPromise
|
||||||
|
* @description
|
||||||
|
* Given filter/query parameters, returns a promise for the matching
|
||||||
|
* pools. This is used in displaying lists of Pools.
|
||||||
|
*/
|
||||||
|
function getPoolsPromise(params) {
|
||||||
|
return zaqar.getPools(params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
Loading…
Reference in New Issue
Block a user