Added regions resource table to the Inventory panel
Regions resource table is now available in the inventory panel. Also added more JS unit testing and configurations Fixed the bug causing the rest urls not being registered in Django.
This commit is contained in:
parent
f63308d60f
commit
2779278204
1
AUTHORS
1
AUTHORS
|
@ -3,3 +3,4 @@ Eddie Ramirez <djedi.r@gmail.com>
|
|||
Eddie Ramirez <eddie.ramirez@intel.com>
|
||||
Luis Daniel Castellanos <luis.daniel.castellanos@intel.com>
|
||||
Revon Mathews <revon.mathews@intel.com>
|
||||
ldcastell <luis.daniel.castellanos@intel.com>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
CHANGES
|
||||
=======
|
||||
|
||||
* Add JavaScript unit tests code base
|
||||
* Move the panel dashboard outside of the project section
|
||||
* Removed the docstrings from the start of file
|
||||
* Removed PEP8 errors
|
||||
|
|
12
README.rst
12
README.rst
|
@ -3,13 +3,14 @@ Craton UI for Horizon Dashboard
|
|||
===============================
|
||||
|
||||
Test
|
||||
____
|
||||
----
|
||||
|
||||
* Python tests: `./run_test.sh`
|
||||
* Python tests: ``./run_test.sh``
|
||||
* JS tests:
|
||||
1. `npm install` (first do `./run_tests.sh` to create virtual environment)
|
||||
2. `npm run lint` for eslint
|
||||
3. `npm run test` for JS unit tests
|
||||
|
||||
1. ``npm install`` (first do ``./run_tests.sh`` to create virtual environment)
|
||||
2. ``npm run lint`` for eslint
|
||||
3. ``npm run test`` for JS unit tests
|
||||
|
||||
Install
|
||||
-------
|
||||
|
@ -24,4 +25,3 @@ From http://docs.openstack.org/developer/horizon/tutorials/plugin.html
|
|||
2. Run “cp -rv enabled horizon/openstack_dashboard/local/”
|
||||
3. Run “horizon/tools/with_venv.sh pip install dist/package.tar.gz”
|
||||
4. Restart Apache or your Django test server
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
# limitations under the License.
|
||||
|
||||
|
||||
from cratonclient.v1 import client as craton_client
|
||||
from cratonclient import session as craton_session
|
||||
from cratonclient.v1 import client as craton_client
|
||||
|
||||
from horizon.utils.memoized import memoized # noqa
|
||||
from horizon.utils.memoized import memoized_with_request # noqa
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
# Copyright 2016 Intel Corporation
|
||||
#
|
||||
# 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 craton_dashboard.api.rest import craton # noqa
|
|
@ -0,0 +1,15 @@
|
|||
# Copyright 2016 Intel Corporation
|
||||
#
|
||||
# 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 craton_dashboard.api import rest # noqa
|
|
@ -17,5 +17,5 @@ from django.views import generic
|
|||
|
||||
|
||||
class IndexView(generic.TemplateView):
|
||||
template_name = 'fleet_management/inventory/index.html'
|
||||
template_name = 'angular.html'
|
||||
page_title = _('Inventory')
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
# Copyright 2016 Intel Corporation
|
||||
#
|
||||
# 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 craton_dashboard.api import rest # noqa
|
|
@ -17,5 +17,5 @@ from django.views import generic
|
|||
|
||||
|
||||
class IndexView(generic.TemplateView):
|
||||
template_name = 'fleet_management/taskflows/index.html'
|
||||
template_name = 'angular.html'
|
||||
page_title = _('Taskflows')
|
||||
|
|
|
@ -31,11 +31,12 @@
|
|||
.factory('horizon.app.core.openstack-service-api.craton', cratonAPI);
|
||||
|
||||
cratonAPI.$inject = [
|
||||
'$q',
|
||||
'horizon.framework.util.http.service',
|
||||
'horizon.framework.widgets.toast.service'
|
||||
];
|
||||
|
||||
function cratonAPI(apiService, toastService) {
|
||||
function cratonAPI($q, apiService, toastService) {
|
||||
var service = {
|
||||
getRegions: getRegions
|
||||
};
|
||||
|
@ -51,8 +52,8 @@
|
|||
.error(function error() {
|
||||
toastService.add('error', gettext("Unable to get the Craton regions listing"));
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
return service;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
//TODO: ADD Tests!!
|
||||
describe('horizon.dashboard.project.fleet_management', function() {
|
||||
it('should be defined',function test() {
|
||||
expect(angular.module('horizon.dashboard.project.fleet_management')).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
})();
|
||||
|
|
|
@ -19,51 +19,52 @@
|
|||
|
||||
/**
|
||||
* @ngdoc overview
|
||||
* @name horizon.dashboard.project
|
||||
* @name horizon.dashboard.project.fleet_management
|
||||
*
|
||||
* @description
|
||||
* Dashboard module to host various backup panels.
|
||||
*/
|
||||
angular
|
||||
.module('horizon.dashboard.project.fleet_management', [])
|
||||
.module('horizon.dashboard.project.fleet_management', [
|
||||
'horizon.dashboard.project.fleet_management.regions'
|
||||
])
|
||||
.config(config);
|
||||
|
||||
config.$inject = [
|
||||
'$provide',
|
||||
'$windowProvider',
|
||||
'$routeProvider'
|
||||
'$windowProvider'
|
||||
];
|
||||
|
||||
function config($provide, $windowProvider, $routeProvider) {
|
||||
function config($provide, $windowProvider) {
|
||||
var basePath = $windowProvider.$get().STATIC_URL + 'dashboard/project/fleet_management/';
|
||||
$provide.constant('horizon.dashboard.project.fleet_management.basePath', basePath);
|
||||
|
||||
var regions = '/project/regions';
|
||||
var taskflows = '/project/fleet/taskflows';
|
||||
var alerts = '/project/fleet/alerts';
|
||||
var auditor = '/project/fleet/auditor';
|
||||
var reporting = '/project/fleet/reporting';
|
||||
var inventory = '/project/fleet/inventory';
|
||||
|
||||
$routeProvider
|
||||
.when(regions, {
|
||||
templateUrl: basePath + 'regions/index.html'
|
||||
})
|
||||
.when(taskflows, {
|
||||
templateUrl: basePath + 'taskflows/index.html'
|
||||
})
|
||||
.when(alerts, {
|
||||
templateUrl: basePath + 'alerts/index.html'
|
||||
})
|
||||
.when(auditor, {
|
||||
templateUrl: basePath + 'auditor/index.html'
|
||||
})
|
||||
.when(reporting, {
|
||||
templateUrl: basePath + 'reporting/index.html'
|
||||
})
|
||||
.when(inventory, {
|
||||
templateUrl: basePath + 'inventory/index.html'
|
||||
});
|
||||
// var regions = '/project/regions';
|
||||
// var taskflows = '/project/fleet/taskflows';
|
||||
// var alerts = '/project/fleet/alerts';
|
||||
// var auditor = '/project/fleet/auditor';
|
||||
// var reporting = '/project/fleet/reporting';
|
||||
// var inventory = '/project/fleet/inventory';
|
||||
//
|
||||
// $routeProvider
|
||||
// .when(regions, {
|
||||
// templateUrl: basePath + 'regions/index.html'
|
||||
// })
|
||||
// .when(taskflows, {
|
||||
// templateUrl: basePath + 'taskflows/index.html'
|
||||
// })
|
||||
// .when(alerts, {
|
||||
// templateUrl: basePath + 'alerts/index.html'
|
||||
// })
|
||||
// .when(auditor, {
|
||||
// templateUrl: basePath + 'auditor/index.html'
|
||||
// })
|
||||
// .when(reporting, {
|
||||
// templateUrl: basePath + 'reporting/index.html'
|
||||
// })
|
||||
// .when(inventory, {
|
||||
// templateUrl: basePath + 'inventory/index.html'
|
||||
// });
|
||||
}
|
||||
|
||||
})();
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<!--TODO(lcastell) figure out how to add hosts list here-->
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,5 @@
|
|||
<hz-resource-panel resource-type-name="OS::Craton::Region">
|
||||
<hz-resource-table resource-type-name="OS::Craton::Region"
|
||||
track-by="id">
|
||||
</hz-resource-table>
|
||||
</hz-resource-panel>
|
|
@ -0,0 +1,90 @@
|
|||
/**
|
||||
* Copyright 2016 Intel Corporation
|
||||
*
|
||||
* 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 Craton Regions module for fleet managament
|
||||
*
|
||||
* @name horizon.dashboard.project.fleet_management.regions
|
||||
*
|
||||
* @description
|
||||
* Provides services and widgets required to support and display
|
||||
* fleet management regions content
|
||||
*/
|
||||
|
||||
angular
|
||||
.module('horizon.dashboard.project.fleet_management.regions', ['ngRoute'])
|
||||
.constant('horizon.dashboard.project.fleet_management.resourceType', 'OS::Craton::Region')
|
||||
.run(run)
|
||||
.config(config);
|
||||
|
||||
run.$inject = [
|
||||
'horizon.framework.conf.resource-type-registry.service',
|
||||
'horizon.app.core.openstack-service-api.craton',
|
||||
'horizon.dashboard.project.fleet_management.basePath',
|
||||
'horizon.dashboard.project.fleet_management.resourceType'
|
||||
];
|
||||
|
||||
function run(registry, craton, basePath, cratonResourceType) {
|
||||
registry.getResourceType(cratonResourceType)
|
||||
.setNames(gettext('Region'), gettext('Regions'))
|
||||
.setSummaryTemplateUrl(basePath + 'inventory/details/drawer.html')
|
||||
.setProperty('name', {label: gettext('Name')})
|
||||
.setProperty('id', {label: gettext('ID')})
|
||||
.setProperty('note', {label: gettext('Note')})
|
||||
.setProperty('project_id', {label:gettext('Project ID')})
|
||||
.setListFunction(listFunction)
|
||||
.tableColumns
|
||||
.append({
|
||||
id: 'name',
|
||||
priority: 1,
|
||||
sortDefault: true
|
||||
})
|
||||
.append({
|
||||
id: 'id',
|
||||
priority: 1
|
||||
})
|
||||
.append({
|
||||
id: 'note',
|
||||
priority: 2
|
||||
})
|
||||
.append({
|
||||
id: 'project_id',
|
||||
priority: 3
|
||||
});
|
||||
|
||||
function listFunction() {
|
||||
return craton.getRegions();
|
||||
}
|
||||
}
|
||||
|
||||
config.$inject = [
|
||||
'$provide',
|
||||
'$windowProvider',
|
||||
'$routeProvider'
|
||||
];
|
||||
|
||||
function config($provide, $windowProvider, $routeProvider) {
|
||||
var path = $windowProvider.$get().STATIC_URL + 'dashboard/project/fleet_management/inventory/';
|
||||
$provide.constant('horizon.dashboard.project.fleet_management.regions.basePath', path);
|
||||
|
||||
$routeProvider.when('/fleet_management/', {
|
||||
templateUrl: path + 'panel.html'
|
||||
});
|
||||
}
|
||||
})();
|
|
@ -0,0 +1,26 @@
|
|||
/**
|
||||
* Copyright 2016 Intel Corporation
|
||||
*
|
||||
* 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';
|
||||
|
||||
describe('horizon.dashboard.project.fleet_management.regions', function () {
|
||||
it('should be defined', function test() {
|
||||
expect(angular.module('horizon.dashboard.project.fleet_management.regions')).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
})();
|
|
@ -128,6 +128,7 @@ module.exports = function(config) {
|
|||
* not significant.
|
||||
*/
|
||||
'./craton_dashboard/static/app/core/**/*.module.js',
|
||||
'./craton_dashboard/static/dashboard/**/**/**/*.module.js',
|
||||
|
||||
/**
|
||||
* Followed by other JavaScript files that defines angular providers
|
||||
|
@ -136,23 +137,27 @@ module.exports = function(config) {
|
|||
* significant.
|
||||
*/
|
||||
'./craton_dashboard/static/app/core/**/!(*.spec|*.mock).js',
|
||||
'./craton_dashboard/static/dashboard/**/**/**/!(*.spec|*.mock).js',
|
||||
|
||||
/**
|
||||
* Then, list files for mocks with `mock.js` extension. The order
|
||||
* among them should not be significant.
|
||||
*/
|
||||
'./craton_dashboard/static/app/core/**/*.mock.js',
|
||||
'./craton_dashboard/static/dashboard/**/**/**/*.mock.js',
|
||||
|
||||
/**
|
||||
* Finally, list files for spec with `spec.js` extension. The order
|
||||
* among them should not be significant.
|
||||
*/
|
||||
'./craton_dashboard/static/app/core/**/*.spec.js',
|
||||
'./craton_dashboard/static/dashboard/**/**/**/*.spec.js',
|
||||
|
||||
/**
|
||||
* Angular external templates
|
||||
*/
|
||||
'./craton_dashboard/static/app/core/**/*.html'
|
||||
'./craton_dashboard/static/app/core/**/*.html',
|
||||
'./craton_dashboard/static/dashboard/**/**/**/*.html'
|
||||
],
|
||||
|
||||
autoWatch: true,
|
||||
|
|
Loading…
Reference in New Issue