Improving readability for Horizon top module structure

This patch improves the readability on how Horizon's application
level module `hz.app` is composited and how its dependency modules
are organized.  The dependency modules come from three sources:

1) Library modules - modules defined in third-party libraries,
   including angular's extensions
2) Horizon's built-in modules, including modules from `framework`
   components and modules from `openstack_dashboard` application
   core components.
3) Horizon's plug-in modules - modules from Horizon's extensions
   components via Horizon's plug-in mechanism.

Horizon's built-in modules are managed as a couple of trees, then only
the top modules of each tree should be listed in the Horizon's built-in
modules.

Change-Id: I989a0b5cc8b24f6b168629f4a8fa5e485dcf1a2d
Closes-Bug: #1472098
This commit is contained in:
Shaoquan Chen 2015-07-06 13:14:14 -07:00
parent 653f85444f
commit 3c0ff6f398
4 changed files with 42 additions and 10 deletions

View File

@ -24,7 +24,7 @@
<script type="text/javascript">
/* Load angular modules extensions list before we include angular/horizon.js */
var angularModuleExtension = {{ HORIZON_CONFIG.angular_modules|default:"[]"|safe }};
var horizonPlugInModules = {{ HORIZON_CONFIG.angular_modules|default:"[]"|safe }};
</script>
<!-- source files -->

View File

@ -12,18 +12,50 @@
* limitations under the License.
*/
/*global angularModuleExtension*/
/*global horizonPlugInModules*/
(function () {
'use strict';
/**
* Library modules - modules defined in third-party libraries, including
* angular's extensions.
*/
var libraryModules = [
'ngCookies'
];
/**
* Horizon's built-in modules, including modules from `framework` components
* and modules from `openstack_dashboard` application core components.
*/
var horizonBuiltInModules = [
'horizon.auth',
'hz.dashboard',
'horizon.framework',
'horizon.openstack-service-api'
];
/**
* @ngdoc overview
* @name horizon.app
* @description
*
* # horizon.app
*
* Horizon's application level module depends on modules from three
* sources:
*
* 1) Library modules.
* 2) Horizon's built-in modules.
* 3) Horizon's plug-in modules.
*/
angular
.module('horizon.app', [
'horizon.auth',
'horizon.openstack-service-api',
'horizon.framework',
'hz.dashboard',
'ngCookies'].concat(angularModuleExtension))
.module('horizon.app', []
.concat(libraryModules)
.concat(horizonBuiltInModules)
.concat(horizonPlugInModules)
)
.constant('horizon.app.conf', {
// Placeholders; updated by Django.

View File

@ -19,7 +19,7 @@
horizon.datepickerLocale = '{{ DATEPICKER_LOCALE }}';
/* Load angular modules extensions list before we include angular/horizon.js */
var angularModuleExtension = {{ HORIZON_CONFIG.angular_modules|default:"[]"|safe }};
var horizonPlugInModules = {{ HORIZON_CONFIG.angular_modules|default:"[]"|safe }};
</script>
{% compress js %}

View File

@ -4,7 +4,7 @@
* Taken from default i18n file provided by Django.
*/
var angularModuleExtension = [];
var horizonPlugInModules = [];
(function (globals) {