Add pool flavors panel into admin dashboard
This patch adds pool flavors panel into admin dashboard. This provides only list view. Actions will be provided in the next patches. Change-Id: Iaf0e1e2f08b2bc7f06d6888943ed3304513394f7 Partial-Implement: blueprint support-pool-flavor
This commit is contained in:
parent
13820b1358
commit
43c93dcc85
0
zaqar_ui/content/pool-flavors/__init__.py
Normal file
0
zaqar_ui/content/pool-flavors/__init__.py
Normal file
22
zaqar_ui/content/pool-flavors/panel.py
Normal file
22
zaqar_ui/content/pool-flavors/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 PoolFlavors(horizon.Panel):
|
||||||
|
name = _("Pool Flavors")
|
||||||
|
slug = "pool-flavors"
|
19
zaqar_ui/content/pool-flavors/urls.py
Normal file
19
zaqar_ui/content/pool-flavors/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'),
|
||||||
|
]
|
22
zaqar_ui/enabled/_2530_admin_pool_flavors.py
Normal file
22
zaqar_ui/enabled/_2530_admin_pool_flavors.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 = 'pool-flavors'
|
||||||
|
PANEL_GROUP = 'messaging'
|
||||||
|
PANEL_DASHBOARD = 'admin'
|
||||||
|
|
||||||
|
ADD_PANEL = ('zaqar_ui.content.pool-flavors.panel.PoolFlavors')
|
||||||
|
ADD_ANGULAR_MODULES = ['horizon.dashboard.admin.pool-flavors']
|
||||||
|
|
||||||
|
AUTO_DISCOVER_STATIC_FILES = True
|
5
zaqar_ui/static/dashboard/admin/pool-flavors/drawer.html
Normal file
5
zaqar_ui/static/dashboard/admin/pool-flavors/drawer.html
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<hz-resource-property-list
|
||||||
|
resource-type-name="OS::Zaqar::Flavors"
|
||||||
|
item="item"
|
||||||
|
property-groups="[['capabilities']]">
|
||||||
|
</hz-resource-property-list>
|
4
zaqar_ui/static/dashboard/admin/pool-flavors/panel.html
Normal file
4
zaqar_ui/static/dashboard/admin/pool-flavors/panel.html
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<hz-resource-panel resource-type-name="OS::Zaqar::Flavors">
|
||||||
|
<hz-resource-table resource-type-name="OS::Zaqar::Flavors" track-by="name">
|
||||||
|
</hz-resource-table>
|
||||||
|
</hz-resource-panel>
|
@ -0,0 +1,100 @@
|
|||||||
|
/*
|
||||||
|
* 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.pool-flavors
|
||||||
|
* @description Flavors module for messaging pool.
|
||||||
|
*/
|
||||||
|
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.admin.pool-flavors', [
|
||||||
|
'ngRoute'
|
||||||
|
])
|
||||||
|
.constant('horizon.dashboard.admin.pool-flavors.resourceType', 'OS::Zaqar::Flavors')
|
||||||
|
.run(run)
|
||||||
|
.config(config);
|
||||||
|
|
||||||
|
run.$inject = [
|
||||||
|
'horizon.app.core.openstack-service-api.zaqar',
|
||||||
|
'horizon.dashboard.admin.pool-flavors.basePath',
|
||||||
|
'horizon.dashboard.admin.pool-flavors.resourceType',
|
||||||
|
'horizon.dashboard.admin.pool-flavors.service',
|
||||||
|
'horizon.framework.conf.resource-type-registry.service'
|
||||||
|
];
|
||||||
|
|
||||||
|
function run(zaqar, basePath, resourceType, flavorsService, registry) {
|
||||||
|
registry.getResourceType(resourceType)
|
||||||
|
.setNames(gettext('Pool Flavor'), gettext('Pool Flavors'))
|
||||||
|
.setSummaryTemplateUrl(basePath + 'drawer.html')
|
||||||
|
.setProperties(flavorProperties())
|
||||||
|
.setListFunction(flavorsService.getFlavorsPromise)
|
||||||
|
.tableColumns
|
||||||
|
.append({
|
||||||
|
id: 'name',
|
||||||
|
priority: 1,
|
||||||
|
sortDefault: true
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
id: 'pool_group',
|
||||||
|
priority: 1
|
||||||
|
});
|
||||||
|
// for magic-search
|
||||||
|
registry.getResourceType(resourceType).filterFacets
|
||||||
|
.append({
|
||||||
|
label: gettext('Name'),
|
||||||
|
name: 'name',
|
||||||
|
singleton: true
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
label: gettext('Pool Group'),
|
||||||
|
name: 'pool_group',
|
||||||
|
singleton: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function flavorProperties() {
|
||||||
|
return {
|
||||||
|
name: { label: gettext('Name'), filters: [] },
|
||||||
|
pool_group: { label: gettext('Pool Group'), filters: ['noName'] },
|
||||||
|
capabilities: { label: gettext('Capabilities'), filters: ['noValue'] }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
config.$inject = [
|
||||||
|
'$provide',
|
||||||
|
'$windowProvider',
|
||||||
|
'$routeProvider'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ndoc config
|
||||||
|
* @name horizon.dashboard.admin.pool-flavors.basePath
|
||||||
|
* @param {Object} $provide
|
||||||
|
* @param {Object} $windowProvider
|
||||||
|
* @param {Object} $routeProvider
|
||||||
|
* @returns {undefined} Returns nothing
|
||||||
|
* @description Base path for the pool-flavors panel
|
||||||
|
*/
|
||||||
|
function config($provide, $windowProvider, $routeProvider) {
|
||||||
|
var path = $windowProvider.$get().STATIC_URL + 'dashboard/admin/pool-flavors/';
|
||||||
|
$provide.constant('horizon.dashboard.admin.pool-flavors.basePath', path);
|
||||||
|
|
||||||
|
$routeProvider.when('/admin/pool-flavors', {
|
||||||
|
templateUrl: path + 'panel.html'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}());
|
@ -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.pool-flavors')
|
||||||
|
.factory('horizon.dashboard.admin.pool-flavors.service', flavorsService);
|
||||||
|
|
||||||
|
flavorsService.$inject = [
|
||||||
|
'horizon.app.core.openstack-service-api.zaqar'
|
||||||
|
];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @ngdoc factory
|
||||||
|
* @name horizon.dashboard.admin.pool-flavors.service
|
||||||
|
*
|
||||||
|
* @description
|
||||||
|
* This service provides functions that are used through
|
||||||
|
* the Pool Flavors features.
|
||||||
|
*/
|
||||||
|
function flavorsService(zaqar) {
|
||||||
|
return {
|
||||||
|
getFlavorsPromise: getFlavorsPromise
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @ngdoc function
|
||||||
|
* @name getFlavorsPromise
|
||||||
|
* @description
|
||||||
|
* Given filter/query parameters, returns a promise for the matching
|
||||||
|
* flavors. This is used in displaying lists of Pool Flavors.
|
||||||
|
*/
|
||||||
|
function getFlavorsPromise(params) {
|
||||||
|
return zaqar.getFlavors(params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
Loading…
x
Reference in New Issue
Block a user