bastion 5.1.1 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/bastion/components/bst-resource-switcher.directive.js +0 -12
- data/app/assets/javascripts/bastion/components/components.module.js +0 -1
- data/app/assets/javascripts/bastion/components/notification.service.js +30 -0
- data/app/assets/javascripts/bastion/components/nutupane.factory.js +3 -3
- data/app/assets/javascripts/bastion/components/views/bst-resource-switcher.html +2 -2
- data/app/assets/javascripts/bastion/layouts/partials/messages-container.html +0 -12
- data/app/views/bastion/layouts/application.html.erb +2 -0
- data/app/views/bastion/layouts/assets.html.erb +1 -0
- data/lib/bastion/version.rb +1 -1
- data/test/bastion/test-constants.js +1 -0
- data/test/components/notification.service.test.js +47 -0
- data/test/components/nutupane.factory.test.js +7 -0
- metadata +28 -36
- data/app/assets/javascripts/bastion/components/bst-alerts.directive.js +0 -54
- data/app/assets/javascripts/bastion/components/bst-global-notification.directive.js +0 -21
- data/app/assets/javascripts/bastion/components/global-notification.service.js +0 -29
- data/app/assets/javascripts/bastion/components/views/bst-alerts.html +0 -7
- data/app/assets/javascripts/bastion/components/views/bst-global-notification.html +0 -1
- data/test/components/bst-alerts.directive.test.js +0 -76
- data/test/components/bst-global-notification.directive.test.js +0 -39
- data/test/components/global-notification.service.test.js +0 -35
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: ae9b48bfa4139331abb65d5ecf10b10c9b08ed1e
         | 
| 4 | 
            +
              data.tar.gz: 5e26dc53a556b3cbaa84f37066936ccd8edf70b3
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 96683ab81ce096e2dea168e8586535fec6fe559bc1744dc10ee4fb10e0a0c88089c1cf13952eb03cb39ddcccb3b1dd9af97bce992170f30978955efb85ddc4d0
         | 
| 7 | 
            +
              data.tar.gz: eb602971bdd07fd4be6d68db2857a4c36f4d5c686632b8cccf4e03c6eb96a6d8887ea8d2d7d694725f4c0080df5ce5e0efa56fc84fa7b210bb2f495bbf3c80c4
         | 
| @@ -30,18 +30,6 @@ | |
| 30 30 | 
             
                                scope.table = TableCache.getTable(getTableName(listUrl));
         | 
| 31 31 | 
             
                            }
         | 
| 32 32 |  | 
| 33 | 
            -
                            scope.showSwitcher = function () {
         | 
| 34 | 
            -
                                var tableHasRows, isNewPage;
         | 
| 35 | 
            -
             | 
| 36 | 
            -
                                // Must have at least two items to switch between them
         | 
| 37 | 
            -
                                tableHasRows = scope.table && scope.table.rows.length > 1;
         | 
| 38 | 
            -
             | 
| 39 | 
            -
                                // Don't show the switcher when creating a new product
         | 
| 40 | 
            -
                                isNewPage = /new$/.test($location.path());
         | 
| 41 | 
            -
             | 
| 42 | 
            -
                                return tableHasRows && !isNewPage;
         | 
| 43 | 
            -
                            };
         | 
| 44 | 
            -
             | 
| 45 33 | 
             
                            scope.changeResource = function (id) {
         | 
| 46 34 | 
             
                                var currentUrl, nextUrl;
         | 
| 47 35 | 
             
                                currentUrl = $location.path();
         | 
| @@ -0,0 +1,30 @@ | |
| 1 | 
            +
            /**
         | 
| 2 | 
            +
             * @ngdoc service
         | 
| 3 | 
            +
             * @name  Bastion.components.service:Notification
         | 
| 4 | 
            +
             *
         | 
| 5 | 
            +
             * @description
         | 
| 6 | 
            +
             *  Service to display a foreman toast notification
         | 
| 7 | 
            +
             */
         | 
| 8 | 
            +
            angular.module('Bastion.components').service("Notification", ['$interpolate', 'foreman', function ($interpolate, foreman) {
         | 
| 9 | 
            +
                function interpolateIfNeeded(message, context) {
         | 
| 10 | 
            +
                    var result = message;
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                    if (context) {
         | 
| 13 | 
            +
                        result = $interpolate(message)(context);
         | 
| 14 | 
            +
                    }
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                    return result;
         | 
| 17 | 
            +
                }
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                this.setSuccessMessage = function (message, context) {
         | 
| 20 | 
            +
                    foreman.toastNotifications.notify({message: interpolateIfNeeded(message, context), type: 'success'});
         | 
| 21 | 
            +
                };
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                this.setWarningMessage = function (message, context) {
         | 
| 24 | 
            +
                    foreman.toastNotifications.notify({message: interpolateIfNeeded(message, context), type: 'warning'});
         | 
| 25 | 
            +
                };
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                this.setErrorMessage = function (message, context) {
         | 
| 28 | 
            +
                    foreman.toastNotifications.notify({message: interpolateIfNeeded(message, context), type: 'danger'});
         | 
| 29 | 
            +
                };
         | 
| 30 | 
            +
            }]);
         | 
| @@ -6,7 +6,7 @@ | |
| 6 6 | 
             
             * @requires $q
         | 
| 7 7 | 
             
             * @requires entriesPerPage
         | 
| 8 8 | 
             
             * @requires TableCache
         | 
| 9 | 
            -
             * @requires  | 
| 9 | 
            +
             * @requires Notification
         | 
| 10 10 | 
             
             *
         | 
| 11 11 | 
             
             * @description
         | 
| 12 12 | 
             
             *   Defines the Nutupane factory for adding common functionality to the Nutupane master-detail
         | 
| @@ -30,7 +30,7 @@ | |
| 30 30 | 
             
                </pre>
         | 
| 31 31 | 
             
             */
         | 
| 32 32 | 
             
            angular.module('Bastion.components').factory('Nutupane',
         | 
| 33 | 
            -
                ['$location', '$q', '$stateParams', 'entriesPerPage', 'TableCache', ' | 
| 33 | 
            +
                ['$location', '$q', '$stateParams', 'entriesPerPage', 'TableCache', 'Notification', function ($location, $q, $stateParams, entriesPerPage, TableCache, Notification) {
         | 
| 34 34 | 
             
                    var Nutupane = function (resource, params, action, nutupaneParams) {
         | 
| 35 35 | 
             
                        var self = this;
         | 
| 36 36 |  | 
| @@ -110,7 +110,7 @@ angular.module('Bastion.components').factory('Nutupane', | |
| 110 110 |  | 
| 111 111 | 
             
                            resourceCall = resource[table.action](params, function (response) {
         | 
| 112 112 | 
             
                                if (response.error) {
         | 
| 113 | 
            -
                                     | 
| 113 | 
            +
                                    Notification.setErrorMessage(response.error);
         | 
| 114 114 | 
             
                                }
         | 
| 115 115 |  | 
| 116 116 | 
             
                                angular.forEach(response.results, function (row) {
         | 
| @@ -1,5 +1,5 @@ | |
| 1 | 
            -
            <span uib-dropdown ng-show=" | 
| 2 | 
            -
              <a uib-dropdown-toggle>
         | 
| 1 | 
            +
            <span uib-dropdown ng-show="table.rows" on-toggle="toggled(open)">
         | 
| 2 | 
            +
              <a href uib-dropdown-toggle>
         | 
| 3 3 | 
             
                <i class="fa fa-exchange"></i>
         | 
| 4 4 | 
             
              </a>
         | 
| 5 5 | 
             
              <ul class="dropdown-menu" uib-dropdown-menu>
         | 
| @@ -1,15 +1,3 @@ | |
| 1 | 
            -
            <div class="row">
         | 
| 2 | 
            -
              <div class="col-sm-12">
         | 
| 3 | 
            -
                <div bst-global-notification></div>
         | 
| 4 | 
            -
              </div>
         | 
| 5 | 
            -
            </div>
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            <div class="row">
         | 
| 8 | 
            -
              <div class="col-sm-12">
         | 
| 9 | 
            -
                <div bst-alerts success-messages="successMessages" error-messages="errorMessages"></div>
         | 
| 10 | 
            -
              </div>
         | 
| 11 | 
            -
            </div>
         | 
| 12 | 
            -
             | 
| 13 1 | 
             
            <div class="row">
         | 
| 14 2 | 
             
              <div class="col-sm-12">
         | 
| 15 3 | 
             
                <div data-block="messages"></div>
         | 
| @@ -17,6 +17,7 @@ | |
| 17 17 | 
             
                angular.module('Bastion').value('currentLocale', '<%= I18n.locale %>');
         | 
| 18 18 | 
             
                angular.module('Bastion').value('CurrentOrganization', "<%= Organization.current.id if Organization.current %>");
         | 
| 19 19 | 
             
                angular.module('Bastion').value('contentAccessMode', "<%= Organization.current.try(:content_access_mode) if Organization.current %>");
         | 
| 20 | 
            +
                angular.module('Bastion').value('foreman', tfm);
         | 
| 20 21 | 
             
                angular.module('Bastion').value('markActiveMenu', mark_active_menu);
         | 
| 21 22 | 
             
                angular.module('Bastion').value('entriesPerPage', "<%= Setting[:entries_per_page] %>");
         | 
| 22 23 | 
             
                angular.module('Bastion').constant('BastionConfig', angular.fromJson('<%= Bastion.config.to_json.html_safe %>'));
         | 
    
        data/lib/bastion/version.rb
    CHANGED
    
    
| @@ -4,6 +4,7 @@ angular.module('Bastion').value('CurrentOrganization', "ACME"); | |
| 4 4 | 
             
            angular.module('Bastion').value('Authorization', {});
         | 
| 5 5 | 
             
            angular.module('Bastion').value('entriesPerPage', 20);
         | 
| 6 6 | 
             
            angular.module('Bastion').value('markActiveMenu', function () {});
         | 
| 7 | 
            +
            angular.module('Bastion').value('foreman', function () {});
         | 
| 7 8 | 
             
            angular.module('Bastion').constant('BastionConfig', {
         | 
| 8 9 | 
             
                consumerCertRPM: "consumer_cert_rpm",
         | 
| 9 10 | 
             
                markTranslated: false
         | 
| @@ -0,0 +1,47 @@ | |
| 1 | 
            +
            describe('Factory: Nofification', function() {
         | 
| 2 | 
            +
                var Notification, foreman;
         | 
| 3 | 
            +
             | 
| 4 | 
            +
                beforeEach(module('Bastion.components'));
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                beforeEach(module(function ($provide) {
         | 
| 7 | 
            +
                    foreman = {
         | 
| 8 | 
            +
                        toastNotifications: {
         | 
| 9 | 
            +
                            notify: function () {}
         | 
| 10 | 
            +
                        }
         | 
| 11 | 
            +
                    };
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                    $provide.value('foreman', foreman);
         | 
| 14 | 
            +
                }));
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                beforeEach(inject(function (_Notification_) {
         | 
| 17 | 
            +
                    Notification = _Notification_;
         | 
| 18 | 
            +
                    spyOn(foreman.toastNotifications, 'notify');
         | 
| 19 | 
            +
                }));
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                it("provides a way to set error messages", function () {
         | 
| 22 | 
            +
                    var message = "Everything is broken!";
         | 
| 23 | 
            +
                    Notification.setErrorMessage(message);
         | 
| 24 | 
            +
                    expect(foreman.toastNotifications.notify).toHaveBeenCalledWith({message: message, type: 'danger'});
         | 
| 25 | 
            +
                });
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                it("provides a way to set warning messages", function () {
         | 
| 28 | 
            +
                    var message = "Everything ran correctly!";
         | 
| 29 | 
            +
                    Notification.setWarningMessage(message);
         | 
| 30 | 
            +
                    expect(foreman.toastNotifications.notify).toHaveBeenCalledWith({message: message, type: 'warning'});
         | 
| 31 | 
            +
                });
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                it("provides a way to set success messages", function () {
         | 
| 34 | 
            +
                    var message = "Everything ran correctly!";
         | 
| 35 | 
            +
                    Notification.setSuccessMessage(message);
         | 
| 36 | 
            +
                    expect(foreman.toastNotifications.notify).toHaveBeenCalledWith({message: message, type: 'success'});
         | 
| 37 | 
            +
                });
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                it("allows message context to be specified for interpolation", function () {
         | 
| 40 | 
            +
                    var message = "Everything ran correctly {{ ending }}!",
         | 
| 41 | 
            +
                        $scope = {ending: 'yay'},
         | 
| 42 | 
            +
                        expectedMessage = 'Everything ran correctly yay!';
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                    Notification.setSuccessMessage(message, $scope);
         | 
| 45 | 
            +
                    expect(foreman.toastNotifications.notify).toHaveBeenCalledWith({message: expectedMessage, type: 'success'});
         | 
| 46 | 
            +
                });
         | 
| 47 | 
            +
            });
         | 
| @@ -6,6 +6,7 @@ describe('Factory: Nutupane', function() { | |
| 6 6 | 
             
                    $q,
         | 
| 7 7 | 
             
                    Resource,
         | 
| 8 8 | 
             
                    TableCache,
         | 
| 9 | 
            +
                    Notification,
         | 
| 9 10 | 
             
                    entriesPerPage,
         | 
| 10 11 | 
             
                    expectedResult,
         | 
| 11 12 | 
             
                    Nutupane;
         | 
| @@ -26,9 +27,15 @@ describe('Factory: Nutupane', function() { | |
| 26 27 | 
             
                        }
         | 
| 27 28 | 
             
                    };
         | 
| 28 29 |  | 
| 30 | 
            +
                    Notification = {
         | 
| 31 | 
            +
                        setSuccessMessage: function () {},
         | 
| 32 | 
            +
                        setErrorMessage: function () {}
         | 
| 33 | 
            +
                    };
         | 
| 34 | 
            +
             | 
| 29 35 | 
             
                    $provide.value('$stateParams', $stateParams);
         | 
| 30 36 | 
             
                    $provide.value('entriesPerPage', entriesPerPage);
         | 
| 31 37 | 
             
                    $provide.value('TableCache', TableCache);
         | 
| 38 | 
            +
                    $provide.value('Notification', Notification);
         | 
| 32 39 | 
             
                }));
         | 
| 33 40 |  | 
| 34 41 | 
             
                beforeEach(inject(function(_$location_, _$timeout_, _Nutupane_, _$rootScope_, _$q_) {
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: bastion
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version:  | 
| 4 | 
            +
              version: 6.0.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Eric D Helms
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2017- | 
| 12 | 
            +
            date: 2017-09-19 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: angular-rails-templates
         | 
| @@ -60,7 +60,6 @@ files: | |
| 60 60 | 
             
            - app/assets/javascripts/bastion/bastion.js
         | 
| 61 61 | 
             
            - app/assets/javascripts/bastion/bastion.module.js
         | 
| 62 62 | 
             
            - app/assets/javascripts/bastion/components/bst-alert.directive.js
         | 
| 63 | 
            -
            - app/assets/javascripts/bastion/components/bst-alerts.directive.js
         | 
| 64 63 | 
             
            - app/assets/javascripts/bastion/components/bst-bookmark.directive.js
         | 
| 65 64 | 
             
            - app/assets/javascripts/bastion/components/bst-bookmark.factory.js
         | 
| 66 65 | 
             
            - app/assets/javascripts/bastion/components/bst-dropdown.directive.js
         | 
| @@ -68,7 +67,6 @@ files: | |
| 68 67 | 
             
            - app/assets/javascripts/bastion/components/bst-flyout.directive.js
         | 
| 69 68 | 
             
            - app/assets/javascripts/bastion/components/bst-form-buttons.directive.js
         | 
| 70 69 | 
             
            - app/assets/javascripts/bastion/components/bst-form-group.directive.js
         | 
| 71 | 
            -
            - app/assets/javascripts/bastion/components/bst-global-notification.directive.js
         | 
| 72 70 | 
             
            - app/assets/javascripts/bastion/components/bst-menu.directive.js
         | 
| 73 71 | 
             
            - app/assets/javascripts/bastion/components/bst-modal.directive.js
         | 
| 74 72 | 
             
            - app/assets/javascripts/bastion/components/bst-on-enter.directive.js
         | 
| @@ -83,7 +81,7 @@ files: | |
| 83 81 | 
             
            - app/assets/javascripts/bastion/components/formatters/components-formatters.module.js
         | 
| 84 82 | 
             
            - app/assets/javascripts/bastion/components/formatters/key-value-to-string.filter.js
         | 
| 85 83 | 
             
            - app/assets/javascripts/bastion/components/formatters/unlimitedFilter.filter.js
         | 
| 86 | 
            -
            - app/assets/javascripts/bastion/components/ | 
| 84 | 
            +
            - app/assets/javascripts/bastion/components/notification.service.js
         | 
| 87 85 | 
             
            - app/assets/javascripts/bastion/components/nutupane.factory.js
         | 
| 88 86 | 
             
            - app/assets/javascripts/bastion/components/page-title.directive.js
         | 
| 89 87 | 
             
            - app/assets/javascripts/bastion/components/page-title.service.js
         | 
| @@ -92,7 +90,6 @@ files: | |
| 92 90 | 
             
            - app/assets/javascripts/bastion/components/typeahead-empty.directive.js
         | 
| 93 91 | 
             
            - app/assets/javascripts/bastion/components/views/autocomplete-scoped-search.html
         | 
| 94 92 | 
             
            - app/assets/javascripts/bastion/components/views/bst-alert.html
         | 
| 95 | 
            -
            - app/assets/javascripts/bastion/components/views/bst-alerts.html
         | 
| 96 93 | 
             
            - app/assets/javascripts/bastion/components/views/bst-bookmark.html
         | 
| 97 94 | 
             
            - app/assets/javascripts/bastion/components/views/bst-dropdown.html
         | 
| 98 95 | 
             
            - app/assets/javascripts/bastion/components/views/bst-edit-add-item.html
         | 
| @@ -109,7 +106,6 @@ files: | |
| 109 106 | 
             
            - app/assets/javascripts/bastion/components/views/bst-flyout.html
         | 
| 110 107 | 
             
            - app/assets/javascripts/bastion/components/views/bst-form-buttons.html
         | 
| 111 108 | 
             
            - app/assets/javascripts/bastion/components/views/bst-form-group.html
         | 
| 112 | 
            -
            - app/assets/javascripts/bastion/components/views/bst-global-notification.html
         | 
| 113 109 | 
             
            - app/assets/javascripts/bastion/components/views/bst-menu.html
         | 
| 114 110 | 
             
            - app/assets/javascripts/bastion/components/views/bst-modal.html
         | 
| 115 111 | 
             
            - app/assets/javascripts/bastion/components/views/bst-resource-switcher.html
         | 
| @@ -194,7 +190,6 @@ files: | |
| 194 190 | 
             
            - test/auth/authorization.service.test.js
         | 
| 195 191 | 
             
            - test/bastion/test-constants.js
         | 
| 196 192 | 
             
            - test/components/bst-alert.directive.test.js
         | 
| 197 | 
            -
            - test/components/bst-alerts.directive.test.js
         | 
| 198 193 | 
             
            - test/components/bst-bookmark.directive.test.js
         | 
| 199 194 | 
             
            - test/components/bst-bookmark.factory.test.js
         | 
| 200 195 | 
             
            - test/components/bst-dropdown.directive.test.js
         | 
| @@ -202,7 +197,6 @@ files: | |
| 202 197 | 
             
            - test/components/bst-flyout.directive.test.js
         | 
| 203 198 | 
             
            - test/components/bst-form-buttons.directive.test.js
         | 
| 204 199 | 
             
            - test/components/bst-form-group.directive.test.js
         | 
| 205 | 
            -
            - test/components/bst-global-notification.directive.test.js
         | 
| 206 200 | 
             
            - test/components/bst-menu.directive.test.js
         | 
| 207 201 | 
             
            - test/components/bst-modal.directive.test.js
         | 
| 208 202 | 
             
            - test/components/bst-resource-switcher.test.js
         | 
| @@ -212,7 +206,7 @@ files: | |
| 212 206 | 
             
            - test/components/formatters/capitalize.filter.test.js
         | 
| 213 207 | 
             
            - test/components/formatters/key-value-to-string.filter.test.js
         | 
| 214 208 | 
             
            - test/components/formatters/unlimited-filter.filter.test.js
         | 
| 215 | 
            -
            - test/components/ | 
| 209 | 
            +
            - test/components/notification.service.test.js
         | 
| 216 210 | 
             
            - test/components/nutupane.factory.test.js
         | 
| 217 211 | 
             
            - test/components/page-title.directive.test.js
         | 
| 218 212 | 
             
            - test/components/page-title.service.test.js
         | 
| @@ -1763,48 +1757,46 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 1763 1757 | 
             
                  version: '0'
         | 
| 1764 1758 | 
             
            requirements: []
         | 
| 1765 1759 | 
             
            rubyforge_project: 
         | 
| 1766 | 
            -
            rubygems_version: 2. | 
| 1760 | 
            +
            rubygems_version: 2.6.11
         | 
| 1767 1761 | 
             
            signing_key: 
         | 
| 1768 1762 | 
             
            specification_version: 4
         | 
| 1769 1763 | 
             
            summary: UI library of AngularJS based components for Foreman
         | 
| 1770 1764 | 
             
            test_files:
         | 
| 1771 | 
            -
            - test/features/bst-feature-flag.directive.test.js
         | 
| 1772 | 
            -
            - test/features/feature-flag.service.test.js
         | 
| 1773 1765 | 
             
            - test/auth/authorization.service.test.js
         | 
| 1766 | 
            +
            - test/bastion/test-constants.js
         | 
| 1767 | 
            +
            - test/components/bst-alert.directive.test.js
         | 
| 1768 | 
            +
            - test/components/bst-bookmark.directive.test.js
         | 
| 1769 | 
            +
            - test/components/bst-bookmark.factory.test.js
         | 
| 1770 | 
            +
            - test/components/bst-dropdown.directive.test.js
         | 
| 1771 | 
            +
            - test/components/bst-edit.directive.test.js
         | 
| 1772 | 
            +
            - test/components/bst-flyout.directive.test.js
         | 
| 1773 | 
            +
            - test/components/bst-form-buttons.directive.test.js
         | 
| 1774 1774 | 
             
            - test/components/bst-form-group.directive.test.js
         | 
| 1775 | 
            -
            - test/components/bst-table.directive.test.js
         | 
| 1776 | 
            -
            - test/components/page-title.directive.test.js
         | 
| 1777 1775 | 
             
            - test/components/bst-menu.directive.test.js
         | 
| 1776 | 
            +
            - test/components/bst-modal.directive.test.js
         | 
| 1778 1777 | 
             
            - test/components/bst-resource-switcher.test.js
         | 
| 1779 | 
            -
            - test/components/bst- | 
| 1780 | 
            -
            - test/components/nutupane.factory.test.js
         | 
| 1781 | 
            -
            - test/components/path-selector.directive.test.js
         | 
| 1778 | 
            +
            - test/components/bst-table.directive.test.js
         | 
| 1782 1779 | 
             
            - test/components/formatters/array-to-string.filter.test.js
         | 
| 1783 | 
            -
            - test/components/formatters/ | 
| 1780 | 
            +
            - test/components/formatters/boolean-to-yes-no.filter.test.js
         | 
| 1784 1781 | 
             
            - test/components/formatters/capitalize.filter.test.js
         | 
| 1785 1782 | 
             
            - test/components/formatters/key-value-to-string.filter.test.js
         | 
| 1786 | 
            -
            - test/components/formatters/ | 
| 1783 | 
            +
            - test/components/formatters/unlimited-filter.filter.test.js
         | 
| 1784 | 
            +
            - test/components/notification.service.test.js
         | 
| 1785 | 
            +
            - test/components/nutupane.factory.test.js
         | 
| 1786 | 
            +
            - test/components/page-title.directive.test.js
         | 
| 1787 1787 | 
             
            - test/components/page-title.service.test.js
         | 
| 1788 | 
            -
            - test/components/ | 
| 1789 | 
            -
            - test/components/bst-alert.directive.test.js
         | 
| 1790 | 
            -
            - test/components/bst-bookmark.directive.test.js
         | 
| 1791 | 
            -
            - test/components/bst-global-notification.directive.test.js
         | 
| 1792 | 
            -
            - test/components/bst-flyout.directive.test.js
         | 
| 1788 | 
            +
            - test/components/path-selector.directive.test.js
         | 
| 1793 1789 | 
             
            - test/components/table-cache.service.test.js
         | 
| 1794 | 
            -
            - test/components/bst-dropdown.directive.test.js
         | 
| 1795 1790 | 
             
            - test/components/typeahead-empty.directive.test.js
         | 
| 1796 | 
            -
            - test/ | 
| 1797 | 
            -
            - test/ | 
| 1798 | 
            -
            - test/ | 
| 1799 | 
            -
            - test/ | 
| 1791 | 
            +
            - test/features/bst-feature-flag.directive.test.js
         | 
| 1792 | 
            +
            - test/features/feature-flag.service.test.js
         | 
| 1793 | 
            +
            - test/i18n/translate.service.test.js
         | 
| 1794 | 
            +
            - test/menu/menu-expander.service.test.js
         | 
| 1800 1795 | 
             
            - test/routing.module.test.js
         | 
| 1801 1796 | 
             
            - test/test-mocks.module.js
         | 
| 1802 | 
            -
            - test/ | 
| 1803 | 
            -
            - test/i18n/translate.service.test.js
         | 
| 1804 | 
            -
            - test/bastion/test-constants.js
         | 
| 1805 | 
            -
            - test/utils/form-utils.service.test.js
         | 
| 1797 | 
            +
            - test/utils/bastion-resource.factory.test.js
         | 
| 1806 1798 | 
             
            - test/utils/disable-link.directive.test.js
         | 
| 1799 | 
            +
            - test/utils/form-utils.service.test.js
         | 
| 1800 | 
            +
            - test/utils/round-up.filter.test.js
         | 
| 1807 1801 | 
             
            - test/utils/stop-event.directive.test.js
         | 
| 1808 | 
            -
            - test/utils/bastion-resource.factory.test.js
         | 
| 1809 1802 | 
             
            - test/utils/urlencode.filter.test.js
         | 
| 1810 | 
            -
            - test/utils/round-up.filter.test.js
         | 
| @@ -1,54 +0,0 @@ | |
| 1 | 
            -
            /**
         | 
| 2 | 
            -
             * @ngdoc directive
         | 
| 3 | 
            -
             * @name Bastion.components.directive:bstAlerts
         | 
| 4 | 
            -
             *
         | 
| 5 | 
            -
             * @description
         | 
| 6 | 
            -
             *   Simple directive for encapsulating alert displays.
         | 
| 7 | 
            -
             *
         | 
| 8 | 
            -
             * @example
         | 
| 9 | 
            -
             *   <pre>
         | 
| 10 | 
            -
             *     <div bst-alerts
         | 
| 11 | 
            -
             *          successMessages="successMessages"
         | 
| 12 | 
            -
             *          errorMessages="errorMessages">
         | 
| 13 | 
            -
             *     </div>
         | 
| 14 | 
            -
             */
         | 
| 15 | 
            -
            angular.module('Bastion.components').directive('bstAlerts', function () {
         | 
| 16 | 
            -
                return {
         | 
| 17 | 
            -
                    templateUrl: 'components/views/bst-alerts.html',
         | 
| 18 | 
            -
                    scope: {
         | 
| 19 | 
            -
                        successMessages: '=',
         | 
| 20 | 
            -
                        infoMessages: '=',
         | 
| 21 | 
            -
                        warningMessages: '=',
         | 
| 22 | 
            -
                        errorMessages: '='
         | 
| 23 | 
            -
                    },
         | 
| 24 | 
            -
             | 
| 25 | 
            -
                    link: function (scope) {
         | 
| 26 | 
            -
                        scope.alerts = {};
         | 
| 27 | 
            -
                        scope.types = ['success', 'info', 'warning', 'danger'];
         | 
| 28 | 
            -
             | 
| 29 | 
            -
                        function handleMessages(type, messages) {
         | 
| 30 | 
            -
                            scope.alerts[type] = messages;
         | 
| 31 | 
            -
                        }
         | 
| 32 | 
            -
             | 
| 33 | 
            -
                        scope.$watch('successMessages', function (messages) {
         | 
| 34 | 
            -
                            handleMessages('success', messages);
         | 
| 35 | 
            -
                        }, true);
         | 
| 36 | 
            -
             | 
| 37 | 
            -
                        scope.$watch('infoMessages', function (messages) {
         | 
| 38 | 
            -
                            handleMessages('info', messages);
         | 
| 39 | 
            -
                        }, true);
         | 
| 40 | 
            -
             | 
| 41 | 
            -
                        scope.$watch('warningMessages', function (messages) {
         | 
| 42 | 
            -
                            handleMessages('warning', messages);
         | 
| 43 | 
            -
                        }, true);
         | 
| 44 | 
            -
             | 
| 45 | 
            -
                        scope.$watch('errorMessages', function (messages) {
         | 
| 46 | 
            -
                            handleMessages('danger', messages);
         | 
| 47 | 
            -
                        }, true);
         | 
| 48 | 
            -
             | 
| 49 | 
            -
                        scope.closeAlert = function (type, index) {
         | 
| 50 | 
            -
                            scope.alerts[type].splice(index, 1);
         | 
| 51 | 
            -
                        };
         | 
| 52 | 
            -
                    }
         | 
| 53 | 
            -
                };
         | 
| 54 | 
            -
            });
         | 
| @@ -1,21 +0,0 @@ | |
| 1 | 
            -
            /**
         | 
| 2 | 
            -
             * @ngdoc directive
         | 
| 3 | 
            -
             * @name Bastion.components.directive:bstGlobalNotification
         | 
| 4 | 
            -
             *
         | 
| 5 | 
            -
             * @requires $scope
         | 
| 6 | 
            -
             * @requires GlobalNotification
         | 
| 7 | 
            -
             *
         | 
| 8 | 
            -
             * @description
         | 
| 9 | 
            -
             *   Provides a way to display global notifications
         | 
| 10 | 
            -
             */
         | 
| 11 | 
            -
             | 
| 12 | 
            -
            angular.module("Bastion.components").directive('bstGlobalNotification', function () {
         | 
| 13 | 
            -
                return {
         | 
| 14 | 
            -
                    templateUrl: 'components/views/bst-global-notification.html',
         | 
| 15 | 
            -
                    scope: {},
         | 
| 16 | 
            -
                    controller: ['$scope', 'GlobalNotification', function ($scope, GlobalNotification) {
         | 
| 17 | 
            -
                        $scope.successMessages = GlobalNotification.successMessages;
         | 
| 18 | 
            -
                        $scope.errorMessages = GlobalNotification.errorMessages;
         | 
| 19 | 
            -
                    }]
         | 
| 20 | 
            -
                };
         | 
| 21 | 
            -
            });
         | 
| @@ -1,29 +0,0 @@ | |
| 1 | 
            -
            /**
         | 
| 2 | 
            -
             * @ngdoc service
         | 
| 3 | 
            -
             * @name  Bastion.components.service:GlobalNotification
         | 
| 4 | 
            -
             *
         | 
| 5 | 
            -
             * @description
         | 
| 6 | 
            -
             *  Service to display a global notifcation
         | 
| 7 | 
            -
             */
         | 
| 8 | 
            -
            angular.module('Bastion.components').service("GlobalNotification", function () {
         | 
| 9 | 
            -
                this.errorMessages = [];
         | 
| 10 | 
            -
                this.successMessages = [];
         | 
| 11 | 
            -
             | 
| 12 | 
            -
                this.setSuccessMessage = function (message) {
         | 
| 13 | 
            -
                    this.successMessages.push(message);
         | 
| 14 | 
            -
                };
         | 
| 15 | 
            -
             | 
| 16 | 
            -
                this.setErrorMessage = function (message) {
         | 
| 17 | 
            -
                    this.errorMessages.push(message);
         | 
| 18 | 
            -
                };
         | 
| 19 | 
            -
             | 
| 20 | 
            -
                this.setRenderedSuccessMessage = function (message) {
         | 
| 21 | 
            -
                    var messageObj = { "message": message, "render": true };
         | 
| 22 | 
            -
                    this.successMessages.push(messageObj);
         | 
| 23 | 
            -
                };
         | 
| 24 | 
            -
             | 
| 25 | 
            -
                this.setRenderedErrorMessage = function (message) {
         | 
| 26 | 
            -
                    var messageObj = { "message": message, "render": true };
         | 
| 27 | 
            -
                    this.errorMessages.push(messageObj);
         | 
| 28 | 
            -
                };
         | 
| 29 | 
            -
            });
         | 
| @@ -1,7 +0,0 @@ | |
| 1 | 
            -
            <div ng-repeat="type in types">
         | 
| 2 | 
            -
              <div bst-alert="{{type}}" ng-repeat="alert in alerts[type] track by $index" close="closeAlert(type, $index)">
         | 
| 3 | 
            -
                <span ng-if="alert.render" ng-bind-html="alert.message"></span>
         | 
| 4 | 
            -
                <span ng-if="!(alert.render)">{{ alert }}</span>
         | 
| 5 | 
            -
              </div>
         | 
| 6 | 
            -
            </div>
         | 
| 7 | 
            -
             | 
| @@ -1 +0,0 @@ | |
| 1 | 
            -
            <div bst-alerts error-messages="errorMessages" success-messages="successMessages"></div>
         | 
| @@ -1,76 +0,0 @@ | |
| 1 | 
            -
            describe('Directive: bstAlerts', function() {
         | 
| 2 | 
            -
                var scope,
         | 
| 3 | 
            -
                    compile,
         | 
| 4 | 
            -
                    element,
         | 
| 5 | 
            -
                    elementScope;
         | 
| 6 | 
            -
             | 
| 7 | 
            -
                beforeEach(module(
         | 
| 8 | 
            -
                    'ngSanitize',
         | 
| 9 | 
            -
                    'Bastion.components', 
         | 
| 10 | 
            -
                    'components/views/bst-alerts.html', 
         | 
| 11 | 
            -
                    'components/views/bst-alert.html'
         | 
| 12 | 
            -
                ));
         | 
| 13 | 
            -
             | 
| 14 | 
            -
                beforeEach(inject(function(_$compile_, _$rootScope_) {
         | 
| 15 | 
            -
                    compile = _$compile_;
         | 
| 16 | 
            -
                    scope = _$rootScope_;
         | 
| 17 | 
            -
                }));
         | 
| 18 | 
            -
             | 
| 19 | 
            -
                beforeEach(function() {
         | 
| 20 | 
            -
                    element = angular.element('<div bst-alerts ' +
         | 
| 21 | 
            -
                        'success-messages="successMessages" ' +
         | 
| 22 | 
            -
                        'info-messages="infoMessages" ' +
         | 
| 23 | 
            -
                        'warning-messages="warningMessages" ' +
         | 
| 24 | 
            -
                        'error-messages="errorMessages"></div>');
         | 
| 25 | 
            -
             | 
| 26 | 
            -
                    scope.successMessages = [];
         | 
| 27 | 
            -
                    scope.infoMessages = [];
         | 
| 28 | 
            -
                    scope.warningMessages = [];
         | 
| 29 | 
            -
                    scope.errorMessages = [];
         | 
| 30 | 
            -
             | 
| 31 | 
            -
                    compile(element)(scope);
         | 
| 32 | 
            -
                    scope.$digest();
         | 
| 33 | 
            -
             | 
| 34 | 
            -
                    elementScope = element.isolateScope();
         | 
| 35 | 
            -
                });
         | 
| 36 | 
            -
             | 
| 37 | 
            -
                it("should display success alerts", function() {
         | 
| 38 | 
            -
                    scope.successMessages = ['hello'];
         | 
| 39 | 
            -
                    scope.$digest();
         | 
| 40 | 
            -
             | 
| 41 | 
            -
                    expect(elementScope.alerts['success'].length).toBe(1);
         | 
| 42 | 
            -
                    expect(elementScope.alerts['success'][0]).toBe('hello');
         | 
| 43 | 
            -
                });
         | 
| 44 | 
            -
             | 
| 45 | 
            -
                it("should display info alerts", function() {
         | 
| 46 | 
            -
                    scope.infoMessages = ['hello'];
         | 
| 47 | 
            -
                    scope.$digest();
         | 
| 48 | 
            -
             | 
| 49 | 
            -
                    expect(elementScope.alerts['info'].length).toBe(1);
         | 
| 50 | 
            -
                    expect(elementScope.alerts['info'][0]).toBe('hello');
         | 
| 51 | 
            -
                });
         | 
| 52 | 
            -
             | 
| 53 | 
            -
                it("should display warning alerts", function() {
         | 
| 54 | 
            -
                    scope.warningMessages = ['hello'];
         | 
| 55 | 
            -
                    scope.$digest();
         | 
| 56 | 
            -
             | 
| 57 | 
            -
                    expect(elementScope.alerts['warning'].length).toBe(1);
         | 
| 58 | 
            -
                    expect(elementScope.alerts['warning'][0]).toBe('hello');
         | 
| 59 | 
            -
                });
         | 
| 60 | 
            -
             | 
| 61 | 
            -
                it("should display success alerts", function() {
         | 
| 62 | 
            -
                    scope.errorMessages = ['hello'];
         | 
| 63 | 
            -
                    scope.$digest();
         | 
| 64 | 
            -
             | 
| 65 | 
            -
                    expect(elementScope.alerts['danger'].length).toBe(1);
         | 
| 66 | 
            -
                    expect(elementScope.alerts['danger'][0]).toBe('hello');
         | 
| 67 | 
            -
                });
         | 
| 68 | 
            -
             | 
| 69 | 
            -
                it("provides a way to close alerts", function() {
         | 
| 70 | 
            -
                    elementScope.alerts = {success: ['yo!', 'hello'], danger: ['foo']};
         | 
| 71 | 
            -
                    elementScope.closeAlert('success', 1);
         | 
| 72 | 
            -
                    expect(elementScope.alerts['success'].length).toBe(1);
         | 
| 73 | 
            -
                    expect(elementScope.alerts['danger'].length).toBe(1);
         | 
| 74 | 
            -
                });
         | 
| 75 | 
            -
             | 
| 76 | 
            -
            });
         | 
| @@ -1,39 +0,0 @@ | |
| 1 | 
            -
            describe('Directive: bstGlobalNotification', function () {
         | 
| 2 | 
            -
                var $scope, $compile, PageTitle;
         | 
| 3 | 
            -
             | 
| 4 | 
            -
                beforeEach(module(
         | 
| 5 | 
            -
                    'ngSanitize',
         | 
| 6 | 
            -
                    'Bastion.components', 
         | 
| 7 | 
            -
                    'components/views/bst-global-notification.html',
         | 
| 8 | 
            -
                    'components/views/bst-alert.html', 
         | 
| 9 | 
            -
                    'components/views/bst-alerts.html'
         | 
| 10 | 
            -
                ));
         | 
| 11 | 
            -
             | 
| 12 | 
            -
                beforeEach(inject(function(_$compile_, _$rootScope_, _GlobalNotification_) {
         | 
| 13 | 
            -
                    $compile = _$compile_;
         | 
| 14 | 
            -
                    $scope = _$rootScope_;
         | 
| 15 | 
            -
                    GlobalNotification = _GlobalNotification_;
         | 
| 16 | 
            -
                }));
         | 
| 17 | 
            -
             | 
| 18 | 
            -
                beforeEach(function () {
         | 
| 19 | 
            -
                    element = angular.element('<div bst-global-notification></div>');
         | 
| 20 | 
            -
                    $compile(element)($scope);
         | 
| 21 | 
            -
                    $scope.$digest();
         | 
| 22 | 
            -
                });
         | 
| 23 | 
            -
             | 
| 24 | 
            -
                it("should display an error message", function () {
         | 
| 25 | 
            -
                    errorMessage = "Something is wrong!!";
         | 
| 26 | 
            -
                    GlobalNotification.setErrorMessage(errorMessage);
         | 
| 27 | 
            -
             | 
| 28 | 
            -
                    $scope.$digest();
         | 
| 29 | 
            -
                    expect(element.html().indexOf(errorMessage)).toBeGreaterThan(0);
         | 
| 30 | 
            -
                });
         | 
| 31 | 
            -
             | 
| 32 | 
            -
                it("should display a success message", function () {
         | 
| 33 | 
            -
                    successMessage = "success!!";
         | 
| 34 | 
            -
                    GlobalNotification.setSuccessMessage(successMessage);
         | 
| 35 | 
            -
             | 
| 36 | 
            -
                    $scope.$digest();
         | 
| 37 | 
            -
                    expect(element.html().indexOf(successMessage)).toBeGreaterThan(0);
         | 
| 38 | 
            -
                });
         | 
| 39 | 
            -
            });
         | 
| @@ -1,35 +0,0 @@ | |
| 1 | 
            -
            describe('Factory: GlobalNofification', function() {
         | 
| 2 | 
            -
                beforeEach(module('Bastion.components'));
         | 
| 3 | 
            -
             | 
| 4 | 
            -
                beforeEach(inject(function (_GlobalNotification_) {
         | 
| 5 | 
            -
                    GlobalNotification = _GlobalNotification_;
         | 
| 6 | 
            -
                }));
         | 
| 7 | 
            -
             | 
| 8 | 
            -
               it("provides a way to set error messages", function () {
         | 
| 9 | 
            -
                    errorMessage = "Everything is broken!";
         | 
| 10 | 
            -
                    GlobalNotification.setErrorMessage(errorMessage);
         | 
| 11 | 
            -
                    expect(GlobalNotification.errorMessages.length).toBe(1);
         | 
| 12 | 
            -
                    expect(GlobalNotification.errorMessages[0]).toBe(errorMessage);
         | 
| 13 | 
            -
                });
         | 
| 14 | 
            -
             | 
| 15 | 
            -
                it("provides a way to set success messages", function () {
         | 
| 16 | 
            -
                    successMessage = "Everything ran correctly!";
         | 
| 17 | 
            -
                    GlobalNotification.setSuccessMessage(successMessage);
         | 
| 18 | 
            -
                    expect(GlobalNotification.successMessages.length).toBe(1);
         | 
| 19 | 
            -
                    expect(GlobalNotification.successMessages[0]).toBe(successMessage);
         | 
| 20 | 
            -
                });
         | 
| 21 | 
            -
             | 
| 22 | 
            -
                it("provides a way to set rendered error messages", function () {
         | 
| 23 | 
            -
                    errorMessage = "Everything is broken!";
         | 
| 24 | 
            -
                    GlobalNotification.setRenderedErrorMessage(errorMessage);
         | 
| 25 | 
            -
                    expect(GlobalNotification.errorMessages.length).toBe(1);
         | 
| 26 | 
            -
                    expect(GlobalNotification.errorMessages[0]['message']).toBe(errorMessage);
         | 
| 27 | 
            -
                });
         | 
| 28 | 
            -
             | 
| 29 | 
            -
                it("provides a way to set rendered success messages", function () {
         | 
| 30 | 
            -
                    successMessage = "Everything ran correctly!";
         | 
| 31 | 
            -
                    GlobalNotification.setRenderedSuccessMessage(successMessage);
         | 
| 32 | 
            -
                    expect(GlobalNotification.successMessages.length).toBe(1);
         | 
| 33 | 
            -
                    expect(GlobalNotification.successMessages[0]['message']).toBe(successMessage);
         | 
| 34 | 
            -
                })
         | 
| 35 | 
            -
            });
         |