ngReorg - create 'widgets' module

This commit collects UI components into a new
'horizon.framework.widgets' module. It also standardizes
the naming pattern for .scss files and makes them hierarchical.

This is one step in a larger effort to restructure the Angular
source. See https://review.openstack.org/#/c/176152/ for the
full set of planned changes.

Change-Id: I2edabd6c43f811a4bb2e3abe982dbc24958ddf93
Partial-Bug: #1454880
This commit is contained in:
Tyr Johanson 2015-05-13 18:41:21 -06:00
parent 317023e2e2
commit 5762d0deee
76 changed files with 122 additions and 109 deletions

View File

@ -0,0 +1,10 @@
(function () {
'use strict';
angular.module('horizon.framework', [
'horizon.framework.util',
'horizon.framework.widgets'
])
.constant('horizon.framework.basePath', '/static/framework/');
})();

View File

@ -0,0 +1 @@
@import "widgets/widgets";

View File

@ -12,7 +12,7 @@
var $scope, $element;
beforeEach(module('hz'));
beforeEach(module('hz.widgets'));
beforeEach(module('horizon.framework.widgets'));
beforeEach(module('hz.framework.bind-scope'));
beforeEach(module('hz.framework.bind-scope', function($compileProvider) {

View File

@ -10,7 +10,7 @@
describe('validators directive', function() {
beforeEach(module('hz'));
beforeEach(module('hz.widgets'));
beforeEach(module('horizon.framework.widgets'));
beforeEach(module('hz.framework.validators'));
describe('validateNumberMax directive', function() {

View File

@ -80,7 +80,7 @@
* </action-list>
* ```
*/
.directive('actionList', [ 'basePath', function() {
.directive('actionList', [ 'horizon.framework.widgets.basePath', function() {
return {
restrict: 'E',
link: function (scope, element) {
@ -116,7 +116,7 @@
* </menu>
* ```
*/
.directive('menu', [ 'basePath', function(path) {
.directive('menu', [ 'horizon.framework.widgets.basePath', function(path) {
return {
restrict: 'E',
templateUrl: path + 'action-list/menu.html',
@ -179,7 +179,7 @@
* </action>
* ```
*/
.directive('action', [ 'basePath', function(path) {
.directive('action', [ 'horizon.framework.widgets.basePath', function(path) {
return {
restrict: 'E',
scope: {

View File

@ -11,7 +11,7 @@
beforeEach(module('templates'));
beforeEach(module('hz'));
beforeEach(module('hz.widgets'));
beforeEach(module('horizon.framework.widgets'));
beforeEach(module('hz.widget.action-list'));
describe('single button dropdown', function() {

View File

@ -55,7 +55,7 @@
* ```
*/
.directive('buttonTooltip',
[ 'basePath', '$compile', '$http', '$templateCache', 'tooltipConfig',
[ 'horizon.framework.widgets.basePath', '$compile', '$http', '$templateCache', 'tooltipConfig',
function(path, $compile, $http, $templateCache, tooltipConfig) {
return {
restrict: 'A',

View File

@ -34,7 +34,7 @@
* ```
*
*/
.directive('chartTooltip', [ 'basePath', function (path) {
.directive('chartTooltip', [ 'horizon.framework.widgets.basePath', function (path) {
return {
restrict: 'E',
scope: {

View File

@ -74,7 +74,7 @@
* ```
*
*/
.directive('pieChart', [ 'basePath', 'donutChartSettings', function (path, donutChartSettings) {
.directive('pieChart', [ 'horizon.framework.widgets.basePath', 'donutChartSettings', function (path, donutChartSettings) {
return {
restrict: 'E',
scope: {

View File

@ -15,7 +15,7 @@
beforeEach(module('templates'));
beforeEach(module('hz'));
beforeEach(module('hz.widgets'));
beforeEach(module('horizon.framework.widgets'));
beforeEach(module('hz.widget.charts'));
beforeEach(inject(function($injector) {

View File

@ -9,7 +9,7 @@
describe('form directives', function() {
beforeEach(module('hz'));
beforeEach(module('hz.widgets'));
beforeEach(module('horizon.framework.widgets'));
beforeEach(module('hz.widget.form'));
describe('hzPasswordMatch directive', function() {

View File

@ -2,7 +2,7 @@
'use strict';
angular.module('hz.widget.help-panel', [])
.directive('helpPanel', ['basePath',
.directive('helpPanel', ['horizon.framework.widgets.basePath',
function (path) {
return {
templateUrl: path + 'help-panel/help-panel.html',

View File

@ -14,7 +14,7 @@
beforeEach(module('templates'));
beforeEach(module('hz'));
beforeEach(module('hz.widgets'));
beforeEach(module('horizon.framework.widgets'));
beforeEach(module('hz.widget.help-panel'));
beforeEach(inject(function ($injector) {
$scope = $injector.get('$rootScope').$new();

View File

@ -46,7 +46,7 @@
* @param {object} existing Key-value pairs with existing properties
* @param {object=} text Text override
*/
.directive('hzMetadataDisplay', ['basePath',
.directive('hzMetadataDisplay', ['horizon.framework.widgets.basePath',
function (path) {
return {
scope: {

View File

@ -94,7 +94,7 @@
beforeEach(module('templates'));
beforeEach(module('hz'));
beforeEach(module('hz.widgets'));
beforeEach(module('horizon.framework.widgets'));
beforeEach(module('hz.widget.metadata-tree'));
beforeEach(module('hz.widget.metadata-display'));
beforeEach(inject(function ($injector) {

View File

@ -65,7 +65,7 @@
* @param {object=} existing Key-value pairs with existing properties
* @param {object=} text Text override
*/
.directive('hzMetadataTree', ['basePath',
.directive('hzMetadataTree', ['horizon.framework.widgets.basePath',
function (path) {
return {
scope: {
@ -93,7 +93,7 @@
* @param {Item} item Item to display
* @param {object} text Text override
*/
.directive('hzMetadataTreeItem', ['basePath',
.directive('hzMetadataTreeItem', ['horizon.framework.widgets.basePath',
function (path) {
return {
scope: {

View File

@ -88,7 +88,7 @@
beforeEach(module('templates'));
beforeEach(module('hz'));
beforeEach(module('hz.widgets'));
beforeEach(module('horizon.framework.widgets'));
beforeEach(module('hz.widget.metadata-tree'));
describe('hzMetadataTree directive', function() {

View File

@ -68,7 +68,7 @@
* }
* ]);
*/
.factory('simpleModalService', ['$modal', 'basePath', 'hz.i18n.gettext',
.factory('simpleModalService', ['$modal', 'horizon.framework.widgets.basePath', 'hz.i18n.gettext',
function($modal, path, gettext) {
return function(params) {
if (params && params.title && params.body){

View File

@ -70,7 +70,7 @@
beforeEach(module(function($provide) {
modal = { open: function() {return 'val';} };
$provide.value('basePath', '/this/path/');
$provide.value('horizon.framework.widgets.basePath', '/this/path/');
$provide.value('$modal', modal);
}));

View File

@ -30,7 +30,7 @@
* </search-bar>
* ```
*/
.directive('searchBar', [ 'FILTER_PLACEHOLDER_TEXT', 'basePath',
.directive('searchBar', [ 'FILTER_PLACEHOLDER_TEXT', 'horizon.framework.widgets.basePath',
function(FILTER_PLACEHOLDER_TEXT, path) {
return {
restrict: 'E',

View File

@ -8,7 +8,7 @@
beforeEach(module('templates'));
beforeEach(module('smart-table'));
beforeEach(module('hz'));
beforeEach(module('hz.widgets'));
beforeEach(module('horizon.framework.widgets'));
beforeEach(module('hz.widget.table'));
describe('search bar', function() {

View File

@ -14,7 +14,7 @@
beforeEach(module('smart-table'));
beforeEach(module('hz'));
beforeEach(module('hz.widgets'));
beforeEach(module('horizon.framework.widgets'));
beforeEach(module('hz.widget.table'));
beforeEach(inject(function($injector) {

View File

@ -147,7 +147,7 @@
* @scope true
*
*/
.directive('toast', ['toastService', 'basePath', function(toastService, path) {
.directive('toast', ['toastService', 'horizon.framework.widgets.basePath', function(toastService, path) {
return {
restrict: 'EA',
templateUrl: path + 'toast/toast.html',

View File

@ -34,7 +34,7 @@
beforeEach(module('templates'));
beforeEach(module('hz'));
beforeEach(module('hz.widgets'));
beforeEach(module('horizon.framework.widgets'));
beforeEach(module('hz.widget.toast'));
beforeEach(inject(function ($injector, toastService) {
service = toastService;
@ -109,7 +109,7 @@
beforeEach(module('templates'));
beforeEach(module('hz'));
beforeEach(module('hz.widgets'));
beforeEach(module('horizon.framework.widgets'));
beforeEach(module('hz.widget.toast'));
beforeEach(inject(function ($injector, toastService) {
$scope = $injector.get('$rootScope').$new();

View File

@ -143,7 +143,7 @@
*
*/
.controller('transferTableCtrl',
[ 'basePath', '$scope', '$timeout', '$parse', '$attrs', '$log', 'helpText', 'limits',
[ 'horizon.framework.widgets.basePath', '$scope', '$timeout', '$parse', '$attrs', '$log', 'helpText', 'limits',
function(path, $scope, $timeout, $parse, $attrs, $log, helpText, limits) {
var trModel = $parse($attrs.trModel)($scope);
var trHelpText = $parse($attrs.helpText)($scope);
@ -385,7 +385,7 @@
* </transfer-table>
* ```
*/
.directive('transferTable', [ 'basePath',
.directive('transferTable', [ 'horizon.framework.widgets.basePath',
function(path) {
return {
controller: 'transferTableCtrl',

View File

@ -87,7 +87,7 @@
beforeEach(module('templates'));
beforeEach(module('smart-table'));
beforeEach(module('hz'));
beforeEach(module('hz.widgets'));
beforeEach(module('horizon.framework.widgets'));
beforeEach(module('hz.widget.action-list'));
beforeEach(module('hz.widget.table'));
beforeEach(module('hz.widget.transfer-table'));

View File

@ -1,8 +1,7 @@
(function () {
'use strict';
angular.module('hz.widgets', [
'horizon.framework.util',
angular.module('horizon.framework.widgets', [
'hz.widget.form',
'hz.widget.help-panel',
'hz.widget.wizard',
@ -16,6 +15,6 @@
'hz.widget.metadata-display',
'hz.widget.toast'
])
.constant('basePath', '/static/framework/');
.constant('horizon.framework.widgets.basePath', '/static/framework/widgets/');
})();

View File

@ -8,4 +8,4 @@
@import "modal/modal-wait-spinner";
@import "metadata-tree/metadata-tree";
@import "metadata-display/metadata-display";
@import "magic-search/magic-search.scss";
@import "magic-search/magic-search";

View File

@ -21,7 +21,7 @@
AFTER_SUBMIT: 'AFTER_SUBMIT'
})
.directive('wizard', ['basePath', function (path) {
.directive('wizard', ['horizon.framework.widgets.basePath', function (path) {
return {
controller: ['$scope', '$q', 'wizardLabels', 'wizardEvents',
function ($scope, $q, wizardLabels, wizardEvents) {

View File

@ -14,7 +14,7 @@
beforeEach(module('templates'));
beforeEach(module('hz'));
beforeEach(module('hz.widgets'));
beforeEach(module('horizon.framework.widgets'));
beforeEach(module('hz.widget.wizard'));
beforeEach(inject(function ($injector) {
$scope = $injector.get('$rootScope').$new();

View File

@ -2,7 +2,7 @@
(function () {
'use strict';
var horizon_dependencies = ['hz.conf', 'hz.utils', 'hz.api', 'ngCookies', 'hz.widgets', 'hz.filters'];
var horizon_dependencies = ['hz.conf', 'hz.utils', 'hz.api', 'ngCookies', 'horizon.framework', 'hz.filters'];
var dependencies = horizon_dependencies.concat(angularModuleExtension);
angular.module('hz', dependencies)
.config(['$interpolateProvider', '$httpProvider',

View File

@ -35,32 +35,34 @@
<script src="{{ STATIC_URL }}horizon/lib/d3.js"></script>
<script src='{{ STATIC_URL }}framework/framework.module.js'></script>
<script src='{{ STATIC_URL }}framework/util/util.module.js'></script>
<script src='{{ STATIC_URL }}framework/util/bind-scope/bind-scope.js'></script>
<script src='{{ STATIC_URL }}framework/util/validators/validators.js'></script>
<script src='{{ STATIC_URL }}framework/util/workflow/workflow.js'></script>
<script src='{{ STATIC_URL }}framework/widget.module.js'></script>
<script src='{{ STATIC_URL }}framework/form/form.js'></script>
<script src='{{ STATIC_URL }}framework/help-panel/help-panel.js'></script>
<script src='{{ STATIC_URL }}framework/i18n/i18n.js'></script>
<script src='{{ STATIC_URL }}framework/wizard/wizard.js'></script>
<script src='{{ STATIC_URL }}framework/action-list/action-list.js'></script>
<script src='{{ STATIC_URL }}framework/action-list/button-tooltip.js'></script>
<script src='{{ STATIC_URL }}framework/table/table.js'></script>
<script src='{{ STATIC_URL }}framework/table/basic-table.js'></script>
<script src="{{ STATIC_URL }}framework/login/login.js"></script>
<script src='{{ STATIC_URL }}framework/modal/modal.js'></script>
<script src='{{ STATIC_URL }}framework/modal/modal-wait-spinner.js'></script>
<script src='{{ STATIC_URL }}framework/transfer-table/transfer-table.js'></script>
<script src='{{ STATIC_URL }}framework/charts/charts.js'></script>
<script src='{{ STATIC_URL }}framework/charts/chart-tooltip.js'></script>
<script src='{{ STATIC_URL }}framework/charts/pie-chart.js'></script>
<script src='{{ STATIC_URL }}framework/metadata-tree/metadata-tree.js'></script>
<script src='{{ STATIC_URL }}framework/metadata-tree/metadata-tree-service.js'></script>
<script src='{{ STATIC_URL }}framework/metadata-display/metadata-display.js'></script>
<script src='{{ STATIC_URL }}framework/magic-search/magic-search.js'></script>
<script src='{{ STATIC_URL }}framework/toast/toast.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/widgets.module.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/form/form.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/help-panel/help-panel.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/i18n/i18n.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/wizard/wizard.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/action-list/action-list.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/action-list/button-tooltip.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/table/table.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/table/basic-table.js'></script>
<script src="{{ STATIC_URL }}framework/widgets/login/login.js"></script>
<script src='{{ STATIC_URL }}framework/widgets/modal/modal.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/modal/modal-wait-spinner.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/transfer-table/transfer-table.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/charts/charts.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/charts/chart-tooltip.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/charts/pie-chart.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/metadata-tree/metadata-tree.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/metadata-tree/metadata-tree-service.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/metadata-display/metadata-display.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/magic-search/magic-search.js'></script>
<script src='{{ STATIC_URL }}framework/widgets/toast/toast.js'></script>
<script src='{{ STATIC_URL }}horizon/lib/jquery/jquery.quicksearch.js'></script>
<script src="{{ STATIC_URL }}horizon/lib/jquery/jquery.tablesorter.js"></script>

View File

@ -24,32 +24,33 @@ class ServicesTests(test.JasmineTests):
'horizon/js/angular/services/hz.api.service.js',
'horizon/js/angular/services/hz.api.config.js',
'framework/framework.module.js',
'framework/util/util.module.js',
'framework/util/bind-scope/bind-scope.js',
'framework/util/validators/validators.js',
'framework/util/workflow/workflow.js',
'framework/widget.module.js',
'framework/action-list/action-list.js',
'framework/action-list/button-tooltip.js',
'framework/charts/charts.js',
'framework/charts/chart-tooltip.js',
'framework/charts/pie-chart.js',
'framework/form/form.js',
'framework/help-panel/help-panel.js',
'framework/login/login.js',
'framework/metadata-tree/metadata-tree.js',
'framework/metadata-tree/metadata-tree-service.js',
'framework/modal/modal.js',
'framework/modal/modal-wait-spinner.js',
'framework/table/table.js',
'framework/table/basic-table.js',
'framework/transfer-table/transfer-table.js',
'framework/wizard/wizard.js',
'framework/metadata-display/metadata-display.js',
'framework/toast/toast.js',
'framework/i18n/i18n.js',
'framework/widgets/widgets.module.js',
'framework/widgets/action-list/action-list.js',
'framework/widgets/action-list/button-tooltip.js',
'framework/widgets/charts/charts.js',
'framework/widgets/charts/chart-tooltip.js',
'framework/widgets/charts/pie-chart.js',
'framework/widgets/form/form.js',
'framework/widgets/help-panel/help-panel.js',
'framework/widgets/login/login.js',
'framework/widgets/metadata-tree/metadata-tree.js',
'framework/widgets/metadata-tree/metadata-tree-service.js',
'framework/widgets/modal/modal.js',
'framework/widgets/modal/modal-wait-spinner.js',
'framework/widgets/table/table.js',
'framework/widgets/table/basic-table.js',
'framework/widgets/transfer-table/transfer-table.js',
'framework/widgets/wizard/wizard.js',
'framework/widgets/metadata-display/metadata-display.js',
'framework/widgets/toast/toast.js',
'framework/widgets/i18n/i18n.js',
'horizon/js/angular/filters/filters.js',
]
specs = [
@ -61,37 +62,37 @@ class ServicesTests(test.JasmineTests):
'framework/util/validators/validators.spec.js',
'framework/util/workflow/workflow.spec.js',
'framework/action-list/action-list.spec.js',
'framework/charts/pie-chart.spec.js',
'framework/form/form.spec.js',
'framework/help-panel/help-panel.spec.js',
'framework/login/login.spec.js',
'framework/modal/modal.spec.js',
'framework/modal/modal-wait-spinner.spec.js',
'framework/table/table.spec.js',
'framework/table/basic-table.spec.js',
'framework/transfer-table/transfer-table.spec.js',
'framework/wizard/wizard.spec.js',
'framework/metadata-tree/metadata-tree.spec.js',
'framework/metadata-display/metadata-display.spec.js',
'framework/toast/toast.spec.js',
'framework/i18n/i18n.spec.js',
'framework/widgets/action-list/action-list.spec.js',
'framework/widgets/charts/pie-chart.spec.js',
'framework/widgets/form/form.spec.js',
'framework/widgets/help-panel/help-panel.spec.js',
'framework/widgets/login/login.spec.js',
'framework/widgets/modal/modal.spec.js',
'framework/widgets/modal/modal-wait-spinner.spec.js',
'framework/widgets/table/table.spec.js',
'framework/widgets/table/basic-table.spec.js',
'framework/widgets/transfer-table/transfer-table.spec.js',
'framework/widgets/wizard/wizard.spec.js',
'framework/widgets/metadata-tree/metadata-tree.spec.js',
'framework/widgets/metadata-display/metadata-display.spec.js',
'framework/widgets/toast/toast.spec.js',
'framework/widgets/i18n/i18n.spec.js',
'horizon/js/angular/filters/filters.spec.js',
]
externalTemplates = [
'framework/action-list/action.html',
'framework/action-list/menu-item.html',
'framework/action-list/menu.html',
'framework/action-list/single-button.html',
'framework/action-list/split-button.html',
'framework/charts/chart-tooltip.html',
'framework/charts/pie-chart.html',
'framework/help-panel/help-panel.html',
'framework/table/search-bar.html',
'framework/transfer-table/transfer-table.html',
'framework/wizard/wizard.html',
'framework/metadata-tree/metadata-tree.html',
'framework/metadata-tree/metadata-tree-item.html',
'framework/metadata-display/metadata-display.html',
'framework/toast/toast.html',
'framework/widgets/action-list/action.html',
'framework/widgets/action-list/menu-item.html',
'framework/widgets/action-list/menu.html',
'framework/widgets/action-list/single-button.html',
'framework/widgets/action-list/split-button.html',
'framework/widgets/charts/chart-tooltip.html',
'framework/widgets/charts/pie-chart.html',
'framework/widgets/help-panel/help-panel.html',
'framework/widgets/table/search-bar.html',
'framework/widgets/transfer-table/transfer-table.html',
'framework/widgets/wizard/wizard.html',
'framework/widgets/metadata-tree/metadata-tree.html',
'framework/widgets/metadata-tree/metadata-tree-item.html',
'framework/widgets/metadata-display/metadata-display.html',
'framework/widgets/toast/toast.html',
]

View File

@ -25,7 +25,7 @@
@import "components/charts";
@import "components/workflow";
@import "components/network_topology";
@import "/framework/styles";
@import "/framework/framework";
/* new clearfix */