bastion 0.1.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 +15 -0
- data/.jshintrc +35 -0
- data/Gruntfile.js +24 -0
- data/LICENSE +339 -0
- data/README.md +8 -0
- data/Rakefile +53 -0
- data/app/assets/javascripts/bastion/auth/auth.module.js +87 -0
- data/app/assets/javascripts/bastion/auth/authorization.service.js +48 -0
- data/app/assets/javascripts/bastion/bastion-bootstrap.js +32 -0
- data/app/assets/javascripts/bastion/bastion-resource.factory.js +39 -0
- data/app/assets/javascripts/bastion/bastion.js +52 -0
- data/app/assets/javascripts/bastion/bastion.module.js +213 -0
- data/app/assets/javascripts/bastion/i18n/README +9 -0
- data/app/assets/javascripts/bastion/i18n/i18n.module.js +24 -0
- data/app/assets/javascripts/bastion/i18n/katello.pot +968 -0
- data/app/assets/javascripts/bastion/i18n/locale/README +1 -0
- data/app/assets/javascripts/bastion/i18n/translate.service.js +14 -0
- data/app/assets/javascripts/bastion/i18n/translations.js +3 -0
- data/app/assets/javascripts/bastion/i18n/zanata.xml +28 -0
- data/app/assets/javascripts/bastion/incubator/alch-alert.directive.js +67 -0
- data/app/assets/javascripts/bastion/incubator/alch-container-scroll.directive.js +44 -0
- data/app/assets/javascripts/bastion/incubator/alch-dropdown.directive.js +28 -0
- data/app/assets/javascripts/bastion/incubator/alch-edit.directive.js +361 -0
- data/app/assets/javascripts/bastion/incubator/alch-flyout.directive.js +19 -0
- data/app/assets/javascripts/bastion/incubator/alch-form-buttons.directive.js +60 -0
- data/app/assets/javascripts/bastion/incubator/alch-form-group.directive.js +87 -0
- data/app/assets/javascripts/bastion/incubator/alch-infinite-scroll.directive.js +84 -0
- data/app/assets/javascripts/bastion/incubator/alch-menu.directive.js +56 -0
- data/app/assets/javascripts/bastion/incubator/alch-modal.directive.js +80 -0
- data/app/assets/javascripts/bastion/incubator/alch-save-control.directive.js +42 -0
- data/app/assets/javascripts/bastion/incubator/alch-table.directive.js +295 -0
- data/app/assets/javascripts/bastion/incubator/format/alch-format.module.js +21 -0
- data/app/assets/javascripts/bastion/incubator/format/array-to-string.filter.js +30 -0
- data/app/assets/javascripts/bastion/incubator/format/boolean-to-yes-no.filter.js +34 -0
- data/app/assets/javascripts/bastion/incubator/format/capitalize.filter.js +32 -0
- data/app/assets/javascripts/bastion/incubator/format/key-value-to-string.filter.js +40 -0
- data/app/assets/javascripts/bastion/incubator/format/unlimitedFilter.filter.js +35 -0
- data/app/assets/javascripts/bastion/incubator/stylesheets/alch-edit.scss +34 -0
- data/app/assets/javascripts/bastion/incubator/stylesheets/header.scss +207 -0
- data/app/assets/javascripts/bastion/incubator/views/alch-alert.html +6 -0
- data/app/assets/javascripts/bastion/incubator/views/alch-dropdown.html +19 -0
- data/app/assets/javascripts/bastion/incubator/views/alch-edit-add-item.html +21 -0
- data/app/assets/javascripts/bastion/incubator/views/alch-edit-add-remove-cancel.html +28 -0
- data/app/assets/javascripts/bastion/incubator/views/alch-edit-checkbox.html +6 -0
- data/app/assets/javascripts/bastion/incubator/views/alch-edit-custom.html +8 -0
- data/app/assets/javascripts/bastion/incubator/views/alch-edit-multiselect.html +17 -0
- data/app/assets/javascripts/bastion/incubator/views/alch-edit-save-cancel.html +20 -0
- data/app/assets/javascripts/bastion/incubator/views/alch-edit-select.html +10 -0
- data/app/assets/javascripts/bastion/incubator/views/alch-edit-text.html +6 -0
- data/app/assets/javascripts/bastion/incubator/views/alch-edit-textarea.html +6 -0
- data/app/assets/javascripts/bastion/incubator/views/alch-edit.html +18 -0
- data/app/assets/javascripts/bastion/incubator/views/alch-flyout.html +10 -0
- data/app/assets/javascripts/bastion/incubator/views/alch-form-buttons.html +10 -0
- data/app/assets/javascripts/bastion/incubator/views/alch-form-group.html +9 -0
- data/app/assets/javascripts/bastion/incubator/views/alch-menu.html +18 -0
- data/app/assets/javascripts/bastion/incubator/views/alch-modal-remove.html +13 -0
- data/app/assets/javascripts/bastion/incubator/views/alch-save-control.html +18 -0
- data/app/assets/javascripts/bastion/layouts/details-nutupane.html +73 -0
- data/app/assets/javascripts/bastion/layouts/nutupane.html +63 -0
- data/app/assets/javascripts/bastion/layouts/select-all-results.html +9 -0
- data/app/assets/javascripts/bastion/menu/menu-expander.service.js +51 -0
- data/app/assets/javascripts/bastion/menu/menu.module.js +26 -0
- data/app/assets/javascripts/bastion/utils/as.filter.js +33 -0
- data/app/assets/javascripts/bastion/utils/form-utils.service.js +53 -0
- data/app/assets/javascripts/bastion/utils/utils.module.js +21 -0
- data/app/assets/javascripts/bastion/widgets/current-tasks.directive.js +67 -0
- data/app/assets/javascripts/bastion/widgets/nutupane-table.directive.js +59 -0
- data/app/assets/javascripts/bastion/widgets/nutupane.factory.js +316 -0
- data/app/assets/javascripts/bastion/widgets/page-title.directive.js +61 -0
- data/app/assets/javascripts/bastion/widgets/page-title.service.js +42 -0
- data/app/assets/javascripts/bastion/widgets/path-selector.directive.js +109 -0
- data/app/assets/javascripts/bastion/widgets/views/current-tasks.html +23 -0
- data/app/assets/javascripts/bastion/widgets/views/path-selector.html +11 -0
- data/app/assets/javascripts/bastion/widgets/widgets.module.js +24 -0
- data/app/assets/stylesheets/bastion/animations.less +15 -0
- data/app/assets/stylesheets/bastion/bastion.less +160 -0
- data/app/assets/stylesheets/bastion/forms.less +41 -0
- data/app/assets/stylesheets/bastion/gpg-keys.less +36 -0
- data/app/assets/stylesheets/bastion/helpers.less +6 -0
- data/app/assets/stylesheets/bastion/mixins.less +15 -0
- data/app/assets/stylesheets/bastion/nutupane.less +382 -0
- data/app/assets/stylesheets/bastion/overrides.less +54 -0
- data/app/assets/stylesheets/bastion/path-selector.less +123 -0
- data/app/assets/stylesheets/bastion/systems.less +35 -0
- data/app/assets/stylesheets/bastion/tasks.less +23 -0
- data/app/assets/stylesheets/bastion/typography.less +31 -0
- data/app/assets/stylesheets/bastion/variables.less +3 -0
- data/app/controllers/bastion/bastion_controller.rb +24 -0
- data/app/views/bastion/layouts/application.html.erb +32 -0
- data/app/views/bastion/layouts/application_ie.html.erb +5 -0
- data/bastion.js +26 -0
- data/bower.json +94 -0
- data/config/routes.rb +25 -0
- data/config/routes/mount_engine.rb +3 -0
- data/grunt/bower.js +20 -0
- data/grunt/htmlhint.js +15 -0
- data/grunt/jshint.js +9 -0
- data/grunt/karma.js +83 -0
- data/lib/bastion.rb +17 -0
- data/lib/bastion/engine.rb +37 -0
- data/lib/bastion/version.rb +3 -0
- data/package.json +29 -0
- data/test/auth/authorization.service.test.js +63 -0
- data/test/bastion/bastion-resource.factory.test.js +31 -0
- data/test/bastion/test-constants.js +30 -0
- data/test/i18n/translate.service.test.js +31 -0
- data/test/incubator/alch-alert.directive.test.js +84 -0
- data/test/incubator/alch-container-scroll.directive.test.js +68 -0
- data/test/incubator/alch-dropdown.directive.test.js +113 -0
- data/test/incubator/alch-edit.directive.test.js +320 -0
- data/test/incubator/alch-flyout.directive.test.js +73 -0
- data/test/incubator/alch-form-buttons.directive.test.js +55 -0
- data/test/incubator/alch-form-group.directive.test.js +76 -0
- data/test/incubator/alch-infinite-scroll.directive.test.js +123 -0
- data/test/incubator/alch-menu.directive.test.js +94 -0
- data/test/incubator/alch-modal.directive.test.js +81 -0
- data/test/incubator/alch-table.directive.test.js +270 -0
- data/test/incubator/format/array-to-string.filter.test.js +38 -0
- data/test/incubator/format/boolean-to-yes-no.filter.test.js +41 -0
- data/test/incubator/format/capitalize.filter.test.js +35 -0
- data/test/incubator/format/key-value-to-string.filter.test.js +60 -0
- data/test/incubator/format/unlimited-filter.filter.test.js +31 -0
- data/test/incubator/nutupane-table.directive.test.js +69 -0
- data/test/incubator/nutupane.factory.test.js +307 -0
- data/test/menu/menu-expander.service.test.js +74 -0
- data/test/test-mocks.module.js +268 -0
- data/test/utils/as.filter.test.js +33 -0
- data/test/utils/form-utils.service.test.js +52 -0
- data/test/widgets/page-title.directive.test.js +54 -0
- data/test/widgets/page-title.service.test.js +51 -0
- data/test/widgets/path-selector.directive.test.js +136 -0
- data/vendor/assets/fonts/bastion/bootstrap/glyphicons-halflings-regular.eot +0 -0
- data/vendor/assets/fonts/bastion/bootstrap/glyphicons-halflings-regular.svg +229 -0
- data/vendor/assets/fonts/bastion/bootstrap/glyphicons-halflings-regular.ttf +0 -0
- data/vendor/assets/fonts/bastion/bootstrap/glyphicons-halflings-regular.woff +0 -0
- data/vendor/assets/fonts/bastion/font-awesome/FontAwesome.otf +0 -0
- data/vendor/assets/fonts/bastion/font-awesome/fontawesome-webfont.eot +0 -0
- data/vendor/assets/fonts/bastion/font-awesome/fontawesome-webfont.svg +399 -0
- data/vendor/assets/fonts/bastion/font-awesome/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/bastion/font-awesome/fontawesome-webfont.woff +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-Bold-webfont.eot +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-Bold-webfont.svg +146 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-Bold-webfont.ttf +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-Bold-webfont.woff +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-BoldItalic-webfont.eot +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-BoldItalic-webfont.svg +146 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-BoldItalic-webfont.ttf +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-BoldItalic-webfont.woff +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-ExtraBold-webfont.eot +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-ExtraBold-webfont.svg +146 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-ExtraBold-webfont.ttf +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-ExtraBold-webfont.woff +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-ExtraBoldItalic-webfont.eot +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-ExtraBoldItalic-webfont.svg +146 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-ExtraBoldItalic-webfont.ttf +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-ExtraBoldItalic-webfont.woff +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-Italic-webfont.eot +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-Italic-webfont.svg +146 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-Italic-webfont.ttf +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-Italic-webfont.woff +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-Light-webfont.eot +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-Light-webfont.svg +146 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-Light-webfont.ttf +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-Light-webfont.woff +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-LightItalic-webfont.eot +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-LightItalic-webfont.svg +146 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-LightItalic-webfont.ttf +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-LightItalic-webfont.woff +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-Regular-webfont.eot +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-Regular-webfont.svg +146 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-Regular-webfont.ttf +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-Regular-webfont.woff +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-Semibold-webfont.eot +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-Semibold-webfont.svg +146 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-Semibold-webfont.ttf +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-Semibold-webfont.woff +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-SemiboldItalic-webfont.eot +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-SemiboldItalic-webfont.svg +146 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-SemiboldItalic-webfont.ttf +0 -0
- data/vendor/assets/fonts/bastion/rcue/OpenSans-SemiboldItalic-webfont.woff +0 -0
- data/vendor/assets/fonts/bastion/rcue/Overpass-Bold-webfont.eot +0 -0
- data/vendor/assets/fonts/bastion/rcue/Overpass-Bold-webfont.svg +454 -0
- data/vendor/assets/fonts/bastion/rcue/Overpass-Bold-webfont.ttf +0 -0
- data/vendor/assets/fonts/bastion/rcue/Overpass-Bold-webfont.woff +0 -0
- data/vendor/assets/fonts/bastion/rcue/Overpass-Regular-webfont.eot +0 -0
- data/vendor/assets/fonts/bastion/rcue/Overpass-Regular-webfont.svg +454 -0
- data/vendor/assets/fonts/bastion/rcue/Overpass-Regular-webfont.ttf +0 -0
- data/vendor/assets/fonts/bastion/rcue/Overpass-Regular-webfont.woff +0 -0
- data/vendor/assets/javascripts/bastion/alchemy/alchemy.js +20 -0
- data/vendor/assets/javascripts/bastion/angular-animate/angular-animate.js +1226 -0
- data/vendor/assets/javascripts/bastion/angular-blocks/angular-blocks.js +79 -0
- data/vendor/assets/javascripts/bastion/angular-bootstrap/ui-bootstrap-tpls.js +3677 -0
- data/vendor/assets/javascripts/bastion/angular-bootstrap/ui-bootstrap.js +3427 -0
- data/vendor/assets/javascripts/bastion/angular-gettext/angular-gettext.js +345 -0
- data/vendor/assets/javascripts/bastion/angular-resource/angular-resource.js +594 -0
- data/vendor/assets/javascripts/bastion/angular-route/angular-route.js +920 -0
- data/vendor/assets/javascripts/bastion/angular-sanitize/angular-sanitize.js +622 -0
- data/vendor/assets/javascripts/bastion/angular-ui-bootstrap/datepicker.js +447 -0
- data/vendor/assets/javascripts/bastion/angular-ui-bootstrap/timepicker.js +232 -0
- data/vendor/assets/javascripts/bastion/angular-ui-router/angular-ui-router.js +3223 -0
- data/vendor/assets/javascripts/bastion/angular-uuid4/angular-uuid4.js +21 -0
- data/vendor/assets/javascripts/bastion/angular/angular.js +20560 -0
- data/vendor/assets/javascripts/bastion/es5-shim/es5-shim.js +1216 -0
- data/vendor/assets/javascripts/bastion/json3/json3.js +861 -0
- data/vendor/assets/javascripts/bastion/ngUpload/ng-upload.js +205 -0
- data/vendor/assets/javascripts/bastion/underscore/underscore.js +1276 -0
- data/vendor/assets/stylesheets/bastion/alchemy/_colors.scss +99 -0
- data/vendor/assets/stylesheets/bastion/alchemy/_media_object.scss +22 -0
- data/vendor/assets/stylesheets/bastion/alchemy/_mixins.scss +24 -0
- data/vendor/assets/stylesheets/bastion/alchemy/_normalize.scss +396 -0
- data/vendor/assets/stylesheets/bastion/alchemy/_vars.scss +31 -0
- data/vendor/assets/stylesheets/bastion/alchemy/alchemy.scss +8 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/alerts.less +67 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/badges.less +51 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/bootstrap.less +49 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/breadcrumbs.less +23 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/button-groups.less +227 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/buttons.less +155 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/carousel.less +232 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/close.less +33 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/code.less +53 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/component-animations.less +29 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/dropdowns.less +187 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/forms.less +375 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/glyphicons.less +237 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/grid.less +79 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/input-groups.less +136 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/jumbotron.less +46 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/labels.less +64 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/list-group.less +88 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/media.less +56 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/mixins.less +845 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/modals.less +129 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/navbar.less +612 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/navs.less +242 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/normalize.less +406 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/pager.less +55 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/pagination.less +85 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/panels.less +182 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/popovers.less +133 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/print.less +105 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/progress-bars.less +80 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/responsive-utilities.less +209 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/scaffolding.less +119 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/tables.less +231 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/theme.less +247 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/thumbnails.less +36 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/tooltip.less +95 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/type.less +281 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/utilities.less +56 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/variables.less +642 -0
- data/vendor/assets/stylesheets/bastion/bootstrap/wells.less +29 -0
- data/vendor/assets/stylesheets/bastion/font-awesome/less/bootstrap.less +84 -0
- data/vendor/assets/stylesheets/bastion/font-awesome/less/core.less +129 -0
- data/vendor/assets/stylesheets/bastion/font-awesome/less/extras.less +93 -0
- data/vendor/assets/stylesheets/bastion/font-awesome/less/font-awesome-ie7.less +1953 -0
- data/vendor/assets/stylesheets/bastion/font-awesome/less/font-awesome.less +33 -0
- data/vendor/assets/stylesheets/bastion/font-awesome/less/icons.less +381 -0
- data/vendor/assets/stylesheets/bastion/font-awesome/less/mixins.less +48 -0
- data/vendor/assets/stylesheets/bastion/font-awesome/less/path.less +14 -0
- data/vendor/assets/stylesheets/bastion/font-awesome/less/variables.less +735 -0
- data/vendor/assets/stylesheets/bastion/font-awesome/scss/_bootstrap.scss +84 -0
- data/vendor/assets/stylesheets/bastion/font-awesome/scss/_core.scss +129 -0
- data/vendor/assets/stylesheets/bastion/font-awesome/scss/_extras.scss +93 -0
- data/vendor/assets/stylesheets/bastion/font-awesome/scss/_icons.scss +381 -0
- data/vendor/assets/stylesheets/bastion/font-awesome/scss/_mixins.scss +48 -0
- data/vendor/assets/stylesheets/bastion/font-awesome/scss/_path.scss +14 -0
- data/vendor/assets/stylesheets/bastion/font-awesome/scss/_variables.scss +734 -0
- data/vendor/assets/stylesheets/bastion/font-awesome/scss/font-awesome-ie7.scss +1953 -0
- data/vendor/assets/stylesheets/bastion/font-awesome/scss/font-awesome.scss +33 -0
- data/vendor/assets/stylesheets/bastion/rcue/buttons.less +44 -0
- data/vendor/assets/stylesheets/bastion/rcue/fonts.less +52 -0
- data/vendor/assets/stylesheets/bastion/rcue/forms.less +19 -0
- data/vendor/assets/stylesheets/bastion/rcue/mixins.less +50 -0
- data/vendor/assets/stylesheets/bastion/rcue/navbar.less +481 -0
- data/vendor/assets/stylesheets/bastion/rcue/rcue.less +15 -0
- data/vendor/assets/stylesheets/bastion/rcue/variables.less +47 -0
- metadata +376 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2014 Red Hat, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This software is licensed to you under the GNU General Public
|
|
5
|
+
* License as published by the Free Software Foundation; either version
|
|
6
|
+
* 2 of the License (GPLv2) or (at your option) any later version.
|
|
7
|
+
* There is NO WARRANTY for this software, express or implied,
|
|
8
|
+
* including the implied warranties of MERCHANTABILITY,
|
|
9
|
+
* NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
|
|
10
|
+
* have received a copy of GPLv2 along with this software; if not, see
|
|
11
|
+
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @ngdoc module
|
|
16
|
+
* @name Bastion.menu
|
|
17
|
+
*
|
|
18
|
+
* @description
|
|
19
|
+
* Module for menu related functionality.
|
|
20
|
+
*/
|
|
21
|
+
angular.module('Bastion.menu', [
|
|
22
|
+
'alchemy',
|
|
23
|
+
'alch-templates',
|
|
24
|
+
'Bastion',
|
|
25
|
+
'Bastion.widgets'
|
|
26
|
+
]);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2014 Red Hat, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This software is licensed to you under the GNU General Public
|
|
5
|
+
* License as published by the Free Software Foundation; either version
|
|
6
|
+
* 2 of the License (GPLv2) or (at your option) any later version.
|
|
7
|
+
* There is NO WARRANTY for this software, express or implied,
|
|
8
|
+
* including the implied warranties of MERCHANTABILITY,
|
|
9
|
+
* NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
|
|
10
|
+
* have received a copy of GPLv2 along with this software; if not, see
|
|
11
|
+
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
|
12
|
+
**/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @ngdoc filter
|
|
16
|
+
* @name Bastion.utils.filter:as
|
|
17
|
+
*
|
|
18
|
+
* @requires $parse
|
|
19
|
+
*
|
|
20
|
+
* @description
|
|
21
|
+
* Adds variable to scope with the value passed in. This allows adding to the
|
|
22
|
+
* scope a variable that contains the result of multiple applied filters.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* <ul>
|
|
26
|
+
<li ng-repeat="item in items | filter:customFilter | as:filteredItems"></li>
|
|
27
|
+
</ul>
|
|
28
|
+
*/
|
|
29
|
+
angular.module('Bastion.utils').filter('as', ['$parse', function ($parse) {
|
|
30
|
+
return function (value, path) {
|
|
31
|
+
return $parse(path).assign(this, value);
|
|
32
|
+
};
|
|
33
|
+
}]);
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2014 Red Hat, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This software is licensed to you under the GNU General Public
|
|
5
|
+
* License as published by the Free Software Foundation; either version
|
|
6
|
+
* 2 of the License (GPLv2) or (at your option) any later version.
|
|
7
|
+
* There is NO WARRANTY for this software, express or implied,
|
|
8
|
+
* including the implied warranties of MERCHANTABILITY,
|
|
9
|
+
* NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
|
|
10
|
+
* have received a copy of GPLv2 along with this software; if not, see
|
|
11
|
+
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
|
12
|
+
**/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @ngdoc service
|
|
16
|
+
* @name Bastion.service.directive:FormUtils
|
|
17
|
+
*
|
|
18
|
+
* @requires uuid4
|
|
19
|
+
*
|
|
20
|
+
* @description
|
|
21
|
+
* A set of utilities that are useful when using forms.
|
|
22
|
+
*/
|
|
23
|
+
angular.module('Bastion.utils').service('FormUtils', ['uuid4', function (uuid4) {
|
|
24
|
+
var regex = new RegExp("[^a-z0-9\\-_]", 'gi'),
|
|
25
|
+
replacement = "_",
|
|
26
|
+
isASCII;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @ngdoc function
|
|
30
|
+
* @name Bastion.service.FormUtils#labelize
|
|
31
|
+
* @methodOf Bastion.service.FormUtils
|
|
32
|
+
* @function
|
|
33
|
+
*
|
|
34
|
+
* @description
|
|
35
|
+
* Turns a resource's name attribute into a labelized value.
|
|
36
|
+
*
|
|
37
|
+
* @param {Resource} resource An object representing a resource entity with a name property
|
|
38
|
+
* @returns {Bastion.service.FormUtils} Self for chaining.
|
|
39
|
+
*/
|
|
40
|
+
this.labelize = function (resource) {
|
|
41
|
+
if (resource.name) {
|
|
42
|
+
resource.label = (isASCII(resource.name) && resource.name.length <= 128) ?
|
|
43
|
+
resource.name.replace(regex, replacement) : uuid4.generate();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return this;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
isASCII = function isASCII(str) {
|
|
50
|
+
return (/^[\x00-\x7F]*$/).test(str);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
}]);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Copyright 2014 Red Hat, Inc.
|
|
3
|
+
|
|
4
|
+
This software is licensed to you under the GNU General Public
|
|
5
|
+
License as published by the Free Software Foundation; either version
|
|
6
|
+
2 of the License (GPLv2) or (at your option) any later version.
|
|
7
|
+
There is NO WARRANTY for this software, express or implied,
|
|
8
|
+
including the implied warranties of MERCHANTABILITY,
|
|
9
|
+
NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
|
|
10
|
+
have received a copy of GPLv2 along with this software; if not, see
|
|
11
|
+
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
|
12
|
+
**/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @ngdoc module
|
|
16
|
+
* @name Bastion.utils
|
|
17
|
+
*
|
|
18
|
+
* @description
|
|
19
|
+
* Module for common utilities.
|
|
20
|
+
*/
|
|
21
|
+
angular.module('Bastion.utils', ['Bastion', 'uuid4']);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Copyright 2014 Red Hat, Inc.
|
|
3
|
+
|
|
4
|
+
This software is licensed to you under the GNU General Public
|
|
5
|
+
License as published by the Free Software Foundation; either version
|
|
6
|
+
2 of the License (GPLv2) or (at your option) any later version.
|
|
7
|
+
There is NO WARRANTY for this software, express or implied,
|
|
8
|
+
including the implied warranties of MERCHANTABILITY,
|
|
9
|
+
NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
|
|
10
|
+
have received a copy of GPLv2 along with this software; if not, see
|
|
11
|
+
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
|
12
|
+
**/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @ngdoc directive
|
|
16
|
+
* @name Bastion.widgets.directive:currentTasks
|
|
17
|
+
*
|
|
18
|
+
* @requires $document
|
|
19
|
+
* @requires CurrentUser
|
|
20
|
+
* @requires Task
|
|
21
|
+
*
|
|
22
|
+
* @description
|
|
23
|
+
* Provides a widget showing current number of runnings tasks, popping
|
|
24
|
+
* up the table of recent tasks when clicked on.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
<span current-tasks></span>
|
|
28
|
+
*/
|
|
29
|
+
angular.module('Bastion.widgets').directive('currentTasks',
|
|
30
|
+
['$document', 'CurrentUser', 'Task',
|
|
31
|
+
function ($document, CurrentUser, Task) {
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
restrict: 'A',
|
|
35
|
+
scope: true,
|
|
36
|
+
templateUrl: 'widgets/views/current-tasks.html',
|
|
37
|
+
|
|
38
|
+
controller: ['$scope', function ($scope) {
|
|
39
|
+
// Hide the current tasks list if the user clicks outside of it
|
|
40
|
+
var currentTasksMenu = angular.element('#currentTasks');
|
|
41
|
+
$scope.visible = false;
|
|
42
|
+
$scope.currentUser = CurrentUser;
|
|
43
|
+
$scope.count = 0;
|
|
44
|
+
|
|
45
|
+
$scope.toggleVisibility = function () {
|
|
46
|
+
$scope.visible = !$scope.visible;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
$scope.updateTasks = function (tasks) {
|
|
50
|
+
$scope.count = tasks.length;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
$document.bind('click', function (event) {
|
|
54
|
+
var target = angular.element(event.target);
|
|
55
|
+
if (!currentTasksMenu.find(target).length) {
|
|
56
|
+
$scope.visible = false;
|
|
57
|
+
if (!$scope.$$phase) {
|
|
58
|
+
$scope.$apply();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}],
|
|
63
|
+
link: function (scope) {
|
|
64
|
+
Task.registerSearch({ 'active_only': true, 'type': 'user', 'user_id': CurrentUser.id}, scope.updateTasks);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}]);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ngdoc directive
|
|
3
|
+
* @name Bastion.components.directive:nutupaneTable
|
|
4
|
+
* @restrict A
|
|
5
|
+
*
|
|
6
|
+
* @require $compile
|
|
7
|
+
*
|
|
8
|
+
* @description
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
*/
|
|
12
|
+
angular.module('alchemy').directive('nutupaneTable', ['$compile', function ($compile) {
|
|
13
|
+
return {
|
|
14
|
+
restrict: 'A',
|
|
15
|
+
link: function (scope, element) {
|
|
16
|
+
var originalTable, clonedTable, clonedThs;
|
|
17
|
+
|
|
18
|
+
scope.$on("$stateChangeSuccess", function (event, newState, newParams, oldState) {
|
|
19
|
+
// Only clone the table if the collapsed value changed or it's the first time.
|
|
20
|
+
if (newState.collapsed !== oldState.collapsed || !oldState.name) {
|
|
21
|
+
buildTable();
|
|
22
|
+
} else {
|
|
23
|
+
element.find("table:not(.cloned-nutupane-table)").find('thead').hide();
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
function buildTable() {
|
|
28
|
+
element.find('.cloned-nutupane-table').remove();
|
|
29
|
+
|
|
30
|
+
originalTable = element.find('table');
|
|
31
|
+
clonedTable = originalTable.clone();
|
|
32
|
+
|
|
33
|
+
clonedTable.removeAttr("nutupane-table");
|
|
34
|
+
clonedTable.addClass("cloned-nutupane-table");
|
|
35
|
+
clonedTable.find('tbody').remove();
|
|
36
|
+
|
|
37
|
+
originalTable.find('thead').hide();
|
|
38
|
+
|
|
39
|
+
element.prepend(clonedTable);
|
|
40
|
+
$compile(element.find('.cloned-nutupane-table'))(scope);
|
|
41
|
+
|
|
42
|
+
// Need to remove duplicate row-select created by second $compile
|
|
43
|
+
var rowSelect = element.find(".row-select")[0];
|
|
44
|
+
if (rowSelect) {
|
|
45
|
+
angular.element(rowSelect).remove();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Compile each cloned th individually with original th scope
|
|
49
|
+
// so sort will work.
|
|
50
|
+
clonedThs = element.find('.cloned-nutupane-table th');
|
|
51
|
+
angular.forEach(originalTable.find('th'), function (th, index) {
|
|
52
|
+
$compile(clonedThs[index])(angular.element(th).scope());
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
buildTable();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}]);
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2014 Red Hat, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This software is licensed to you under the GNU General Public
|
|
5
|
+
* License as published by the Free Software Foundation; either version
|
|
6
|
+
* 2 of the License (GPLv2) or (at your option) any later version.
|
|
7
|
+
* There is NO WARRANTY for this software, express or implied,
|
|
8
|
+
* including the implied warranties of MERCHANTABILITY,
|
|
9
|
+
* NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
|
|
10
|
+
* have received a copy of GPLv2 along with this software; if not, see
|
|
11
|
+
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @ngdoc service
|
|
16
|
+
* @name Bastion.widgets.service:Nutupane
|
|
17
|
+
*
|
|
18
|
+
* @requires $location
|
|
19
|
+
* @requires $q
|
|
20
|
+
* @requires $timeout
|
|
21
|
+
*
|
|
22
|
+
* @description
|
|
23
|
+
* Defines the Nutupane factory for adding common functionality to the Nutupane master-detail
|
|
24
|
+
* pattern. Note that the API Nutupane uses must provide a response of the following structure:
|
|
25
|
+
*
|
|
26
|
+
* {
|
|
27
|
+
* page: 1,
|
|
28
|
+
* subtotal: 50,
|
|
29
|
+
* total: 100,
|
|
30
|
+
* results: [...]
|
|
31
|
+
* }
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* <pre>
|
|
35
|
+
angular.module('example').controller('ExampleController',
|
|
36
|
+
['Nutupane', function (Nutupane)) {
|
|
37
|
+
var nutupane = new Nutupane(ExampleResource);
|
|
38
|
+
$scope.table = nutupane.table;
|
|
39
|
+
}]
|
|
40
|
+
);
|
|
41
|
+
</pre>
|
|
42
|
+
*/
|
|
43
|
+
angular.module('Bastion.widgets').factory('Nutupane',
|
|
44
|
+
['$location', '$q', '$timeout', function ($location, $q, $timeout) {
|
|
45
|
+
var Nutupane = function (resource, params, action) {
|
|
46
|
+
var self = this;
|
|
47
|
+
params = params || {};
|
|
48
|
+
|
|
49
|
+
self.searchKey = action ? action + 'Search' : 'search';
|
|
50
|
+
|
|
51
|
+
self.table = {
|
|
52
|
+
action: action || 'queryPaged',
|
|
53
|
+
params: params,
|
|
54
|
+
resource: resource,
|
|
55
|
+
rows: [],
|
|
56
|
+
searchTerm: $location.search()[self.searchKey],
|
|
57
|
+
initialLoad: true
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// Set default resource values
|
|
61
|
+
resource.page = 0;
|
|
62
|
+
resource.subtotal = "0";
|
|
63
|
+
resource.total = "0";
|
|
64
|
+
resource.results = [];
|
|
65
|
+
|
|
66
|
+
self.load = function (replace) {
|
|
67
|
+
var deferred = $q.defer(),
|
|
68
|
+
table = self.table;
|
|
69
|
+
|
|
70
|
+
replace = replace || false;
|
|
71
|
+
table.working = true;
|
|
72
|
+
|
|
73
|
+
params.page = table.resource.page + 1;
|
|
74
|
+
params.search = table.searchTerm || "";
|
|
75
|
+
params.search = self.searchTransform(params.search);
|
|
76
|
+
|
|
77
|
+
resource[table.action](params, function (response) {
|
|
78
|
+
|
|
79
|
+
angular.forEach(response.results, function (row) {
|
|
80
|
+
row.selected = table.allResultsSelected;
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
if (replace) {
|
|
84
|
+
table.rows = response.results;
|
|
85
|
+
} else {
|
|
86
|
+
table.rows = table.rows.concat(response.results);
|
|
87
|
+
}
|
|
88
|
+
table.resource.page = parseInt(response.page, 10);
|
|
89
|
+
|
|
90
|
+
if (table.initialSelectAll) {
|
|
91
|
+
table.selectAll(true);
|
|
92
|
+
table.initialSelectAll = false;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// This $timeout is necessary to cause a digest cycle
|
|
96
|
+
// in order to prevent loading two sets of results.
|
|
97
|
+
$timeout(function () {
|
|
98
|
+
deferred.resolve(response);
|
|
99
|
+
table.resource = response;
|
|
100
|
+
table.resource.page = parseInt(response.page, 10);
|
|
101
|
+
|
|
102
|
+
if (self.selectAllMode) {
|
|
103
|
+
table.selectAll(true);
|
|
104
|
+
}
|
|
105
|
+
table.resource.offset = table.rows.length;
|
|
106
|
+
}, 0);
|
|
107
|
+
table.working = false;
|
|
108
|
+
table.refreshing = false;
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
return deferred.promise;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
self.getParams = function () {
|
|
115
|
+
return params;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
self.enableSelectAllResults = function () {
|
|
119
|
+
self.table.selectAllResultsEnabled = true;
|
|
120
|
+
self.table.allResultsSelected = false;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
self.setParams = function (newParams) {
|
|
124
|
+
params = newParams;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
self.addParam = function (param, value) {
|
|
128
|
+
params[param] = value;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
self.searchTransform = function (term) {
|
|
132
|
+
return term;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
self.query = function () {
|
|
136
|
+
var table = self.table;
|
|
137
|
+
if (table.rows.length === 0) {
|
|
138
|
+
table.resource.page = 0;
|
|
139
|
+
}
|
|
140
|
+
return self.load();
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
self.refresh = function () {
|
|
144
|
+
self.table.resource.page = 0;
|
|
145
|
+
return self.load(true);
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
self.removeRow = function (id, field) {
|
|
149
|
+
var foundItem, table = self.table;
|
|
150
|
+
|
|
151
|
+
field = field || 'id';
|
|
152
|
+
|
|
153
|
+
angular.forEach(table.rows, function (item) {
|
|
154
|
+
if (item[field] === id) {
|
|
155
|
+
foundItem = item;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
table.rows = _.reject(table.rows, function (item) {
|
|
160
|
+
return item[field] === id;
|
|
161
|
+
}, this);
|
|
162
|
+
|
|
163
|
+
table.resource.total = table.resource.total - 1;
|
|
164
|
+
table.resource.subtotal = table.resource.subtotal - 1;
|
|
165
|
+
if (foundItem && foundItem.selected) {
|
|
166
|
+
table.numSelected = table.numSelected - 1;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return self.table.rows;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
self.getAllSelectedResults = function (identifier) {
|
|
173
|
+
var selected, selectedRows;
|
|
174
|
+
identifier = identifier || 'id';
|
|
175
|
+
selected = {
|
|
176
|
+
included: {
|
|
177
|
+
ids: [],
|
|
178
|
+
resources: [],
|
|
179
|
+
search: null,
|
|
180
|
+
params: params
|
|
181
|
+
},
|
|
182
|
+
excluded: {
|
|
183
|
+
ids: []
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
if (self.table.allResultsSelected) {
|
|
188
|
+
selected.included.search = self.table.searchTerm || '';
|
|
189
|
+
selected.excluded.ids = _.pluck(self.getDeselected(), identifier);
|
|
190
|
+
} else {
|
|
191
|
+
selectedRows = self.table.getSelected();
|
|
192
|
+
selected.included.ids = _.pluck(selectedRows, identifier);
|
|
193
|
+
selected.included.resources = selectedRows;
|
|
194
|
+
}
|
|
195
|
+
return selected;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
self.getDeselected = function () {
|
|
199
|
+
var deselectedRows = [];
|
|
200
|
+
angular.forEach(self.table.rows, function (row, rowIndex) {
|
|
201
|
+
if (row.selected !== true) {
|
|
202
|
+
deselectedRows.push(self.table.rows[rowIndex]);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
return deselectedRows;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
self.table.search = function (searchTerm) {
|
|
209
|
+
$location.search(self.searchKey, searchTerm);
|
|
210
|
+
self.table.resource.page = 1;
|
|
211
|
+
self.table.rows = [];
|
|
212
|
+
self.table.closeItem();
|
|
213
|
+
self.table.selectAllResults(false);
|
|
214
|
+
|
|
215
|
+
if (!self.table.working) {
|
|
216
|
+
self.query(searchTerm);
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
// Must be overridden
|
|
221
|
+
self.table.closeItem = function () {
|
|
222
|
+
throw "NotImplementedError";
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
self.table.replaceRow = function (row) {
|
|
226
|
+
var index, selected;
|
|
227
|
+
index = null;
|
|
228
|
+
angular.forEach(self.table.rows, function (item, itemIndex) {
|
|
229
|
+
if (item.id === row.id) {
|
|
230
|
+
index = itemIndex;
|
|
231
|
+
selected = item.selected;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
if (index >= 0) {
|
|
236
|
+
row.selected = selected; //Preserve selectedness
|
|
237
|
+
self.table.rows[index] = row;
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
self.table.addRow = function (row) {
|
|
242
|
+
self.table.rows.unshift(row);
|
|
243
|
+
self.table.resource.subtotal += 1;
|
|
244
|
+
self.table.resource.total += 1;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
self.table.nextPage = function () {
|
|
248
|
+
var table = self.table;
|
|
249
|
+
if (table.working || !table.hasMore()) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
return self.query();
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
self.table.hasMore = function () {
|
|
256
|
+
var length = self.table.rows.length,
|
|
257
|
+
subtotal = self.table.resource.subtotal,
|
|
258
|
+
hasMore = false;
|
|
259
|
+
|
|
260
|
+
if (!subtotal) {
|
|
261
|
+
hasMore = false;
|
|
262
|
+
} else {
|
|
263
|
+
var justBegun = (length === 0 && subtotal !== 0);
|
|
264
|
+
hasMore = (length < subtotal) || justBegun;
|
|
265
|
+
}
|
|
266
|
+
return hasMore;
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
// Wraps the table.selectAll() function if selectAllResultsEnabled is not set
|
|
270
|
+
// Otherwise provides expanded functionality
|
|
271
|
+
|
|
272
|
+
self.table.selectAllResults = function (selectAll) {
|
|
273
|
+
if (self.table.allSelected() || selectAll !== 'undefined') {
|
|
274
|
+
self.table.selectAll(selectAll);
|
|
275
|
+
} else if (selectAll) {
|
|
276
|
+
self.table.initialSelectAll = true;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
if (self.table.selectAllResultsEnabled) {
|
|
280
|
+
if (selectAll) {
|
|
281
|
+
self.table.disableSelectAll();
|
|
282
|
+
} else {
|
|
283
|
+
self.table.enableSelectAll();
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
self.table.allResultsSelected = selectAll;
|
|
287
|
+
self.table.numSelected = selectAll ? self.table.resource.subtotal : 0;
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
self.table.allResultsSelectCount = function () {
|
|
292
|
+
return self.table.resource.subtotal - self.getDeselected().length;
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
self.table.sortBy = function (column) {
|
|
296
|
+
var sort = self.table.resource.sort;
|
|
297
|
+
if (!column) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
params["sort_by"] = column.id;
|
|
302
|
+
if (column.id === sort.by) {
|
|
303
|
+
params["sort_order"] = (sort.order === 'ASC') ? 'DESC' : 'ASC';
|
|
304
|
+
} else {
|
|
305
|
+
params["sort_order"] = 'ASC';
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
column.sortOrder = params["sort_order"];
|
|
309
|
+
column.active = true;
|
|
310
|
+
self.table.rows = [];
|
|
311
|
+
self.query();
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
return Nutupane;
|
|
315
|
+
}]
|
|
316
|
+
);
|