bastion 6.0.0 → 6.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae9b48bfa4139331abb65d5ecf10b10c9b08ed1e
4
- data.tar.gz: 5e26dc53a556b3cbaa84f37066936ccd8edf70b3
3
+ metadata.gz: d2624c30e050fec596f8341365cf7d757cfee32f
4
+ data.tar.gz: 68769000b30bc44480bf3e56129779a0cd0ad568
5
5
  SHA512:
6
- metadata.gz: 96683ab81ce096e2dea168e8586535fec6fe559bc1744dc10ee4fb10e0a0c88089c1cf13952eb03cb39ddcccb3b1dd9af97bce992170f30978955efb85ddc4d0
7
- data.tar.gz: eb602971bdd07fd4be6d68db2857a4c36f4d5c686632b8cccf4e03c6eb96a6d8887ea8d2d7d694725f4c0080df5ce5e0efa56fc84fa7b210bb2f495bbf3c80c4
6
+ metadata.gz: d0b6d2b4b1d9f8ec9dd994931f6d8ddf045e2ad4337d27a263eb595b69219f55b973a66c5c659977a865af367849ca16d80e3ebc9cdae7211ccd4d0ef0acbcb4
7
+ data.tar.gz: b68dc2fdf849417d3f97dd922e40124403f2c87e95e965ae1d41420f6cf068cbca796794e26614d4f55fabff6002976c5c3a564e265903d10464b6cea0ca99d3
data/README.md CHANGED
@@ -151,7 +151,7 @@ A resource serves as a representation of an API endpoint for an entity and provi
151
151
  * Defines the API endpoint for Content Host
152
152
  */
153
153
  function ContentHost(BastionResource) {
154
- return BastionResource('/api/v2/content-hosts/:id/:action',
154
+ return BastionResource('api/v2/content-hosts/:id/:action',
155
155
  {id: '@uuid'},
156
156
  {
157
157
  update: {method: 'PUT'},
@@ -170,7 +170,7 @@ A resource serves as a representation of an API endpoint for an entity and provi
170
170
  })();
171
171
  ```
172
172
 
173
- Here we have created an angular factory named `content-host` and attached it to the `Bastion.content-hosts` namespace. You can read more about the $resource service here - http://code.angularjs.org/1.0.7/docs/api/ngResource.$resource
173
+ Here we have created an angular factory named `content-host` and attached it to the `Bastion.content-hosts` namespace. It's important that the resource URL does not begin with a '/' so that the application can live in a subdirectory without errors. You can read more about the $resource service here - http://code.angularjs.org/1.0.7/docs/api/ngResource.$resource
174
174
 
175
175
  #### Asset Pipeline
176
176
 
@@ -58,14 +58,14 @@ angular.module('Bastion.auth').config(['$httpProvider', '$provide',
58
58
  * @name Bastion.auth.run
59
59
  *
60
60
  * @requires $rootScope
61
- * @requires $window
61
+ * @requires $location
62
62
  * @requires Authorization
63
63
  *
64
64
  * @description
65
65
  * Check current user permissions and redirect to the 403 page if appropriate
66
66
  */
67
- angular.module('Bastion.auth').run(['$rootScope', '$window', 'Authorization',
68
- function ($rootScope, $window, Authorization) {
67
+ angular.module('Bastion.auth').run(['$rootScope', '$location', 'Authorization',
68
+ function ($rootScope, $location, Authorization) {
69
69
 
70
70
  function isAuthorized(permission) {
71
71
  return !(permission !== false && (angular.isUndefined(permission) || Authorization.denied(permission)));
@@ -83,7 +83,7 @@ angular.module('Bastion.auth').run(['$rootScope', '$window', 'Authorization',
83
83
  });
84
84
 
85
85
  if (angular.isUndefined(permitted)) {
86
- $window.location.href = '/katello/403';
86
+ $location.path('/katello/403');
87
87
  }
88
88
  });
89
89
 
@@ -31,10 +31,13 @@ angular.module('Bastion').config(
31
31
  $provide.factory('PrefixInterceptor', ['$q', '$templateCache', function ($q, $templateCache) {
32
32
  return {
33
33
  request: function (config) {
34
+ var relativeUrl = BastionConfig.relativeUrlRoot;
34
35
  if (config.url.indexOf('.html') !== -1) {
35
36
  if (angular.isUndefined($templateCache.get(config.url))) {
36
- config.url = '/' + config.url;
37
+ config.url = relativeUrl + config.url;
37
38
  }
39
+ } else {
40
+ config.url = relativeUrl + config.url;
38
41
  }
39
42
 
40
43
  return config || $q.when(config);
@@ -73,12 +76,13 @@ angular.module('Bastion').config(
73
76
  * @requires $breadcrumb
74
77
  * @requires PageTitle
75
78
  * @requires markActiveMenu
79
+ * @requires BastionConfig
76
80
  *
77
81
  * @description
78
82
  * Set up some common state related functionality and set the current language.
79
83
  */
80
- angular.module('Bastion').run(['$rootScope', '$state', '$stateParams', 'gettextCatalog', 'currentLocale', '$location', '$window', '$breadcrumb', 'PageTitle', 'markActiveMenu',
81
- function ($rootScope, $state, $stateParams, gettextCatalog, currentLocale, $location, $window, $breadcrumb, PageTitle, markActiveMenu) {
84
+ angular.module('Bastion').run(['$rootScope', '$state', '$stateParams', 'gettextCatalog', 'currentLocale', '$location', '$window', '$breadcrumb', 'PageTitle', 'markActiveMenu', 'BastionConfig',
85
+ function ($rootScope, $state, $stateParams, gettextCatalog, currentLocale, $location, $window, $breadcrumb, PageTitle, markActiveMenu, BastionConfig) {
82
86
  var fromState, fromParams, orgSwitcherRegex;
83
87
 
84
88
  $rootScope.$state = $state;
@@ -107,7 +111,7 @@ angular.module('Bastion').run(['$rootScope', '$state', '$stateParams', 'gettextC
107
111
  };
108
112
 
109
113
  $rootScope.taskUrl = function (taskId) {
110
- return "/foreman_tasks/tasks/" + taskId;
114
+ return BastionConfig.relativeUrlRoot + "/foreman_tasks/tasks/" + taskId;
111
115
  };
112
116
 
113
117
  // Set the current language
@@ -10,7 +10,7 @@
10
10
  angular.module('Bastion.components').factory('BstBookmark',
11
11
  ['BastionResource', function (BastionResource) {
12
12
 
13
- return BastionResource('/api/v2/bookmarks', {id: '@id'},
13
+ return BastionResource('api/v2/bookmarks', {id: '@id'},
14
14
  {
15
15
  create: { method: 'POST' }
16
16
  }
@@ -1,5 +1,5 @@
1
1
  <span uib-dropdown ng-show="table.rows" on-toggle="toggled(open)">
2
- <a href uib-dropdown-toggle>
2
+ <a uib-dropdown-toggle>
3
3
  <i class="fa fa-exchange"></i>
4
4
  </a>
5
5
  <ul class="dropdown-menu" uib-dropdown-menu>
@@ -2,6 +2,9 @@ module Bastion
2
2
  class BastionController < ::ApplicationController
3
3
  skip_before_filter :authorize
4
4
 
5
+ # prevent Foreman routes from being incorrectly generated (don't use the Bastion url_helpers)
6
+ include Rails.application.routes.url_helpers
7
+
5
8
  def index
6
9
  render 'bastion/layouts/application', :layout => false
7
10
  end
@@ -1,3 +1,7 @@
1
+ <% content_for(:head) do %>
2
+ <base href="<%= Bastion.config['relativeUrlRoot'] %>" />
3
+ <% end %>
4
+
1
5
  <% content_for(:stylesheets) do %>
2
6
  <%= stylesheet_link_tag "bastion/bastion" %>
3
7
  <% Bastion.plugins.each do |name, plugin| %>
@@ -1,3 +1,3 @@
1
1
  module Bastion
2
- VERSION = "6.0.0"
2
+ VERSION = "6.1.0"
3
3
  end
data/lib/bastion.rb CHANGED
@@ -17,8 +17,10 @@ module Bastion
17
17
  end
18
18
 
19
19
  def self.config
20
+ url_root = ENV['RAILS_RELATIVE_URL_ROOT']
20
21
  base_config = {
21
- 'markTranslated' => SETTINGS[:mark_translated] || false
22
+ 'markTranslated' => SETTINGS[:mark_translated] || false,
23
+ 'relativeUrlRoot' => url_root ? url_root + '/' : '/'
22
24
  }
23
25
 
24
26
  Bastion.plugins.each do |name, plugin|
@@ -3,11 +3,13 @@ angular.module('Bastion').value('currentLocale', 'Here');
3
3
  angular.module('Bastion').value('CurrentOrganization', "ACME");
4
4
  angular.module('Bastion').value('Authorization', {});
5
5
  angular.module('Bastion').value('entriesPerPage', 20);
6
+ angular.module('Bastion').value('PageTitle', 'Bastion Page');
6
7
  angular.module('Bastion').value('markActiveMenu', function () {});
7
8
  angular.module('Bastion').value('foreman', function () {});
8
9
  angular.module('Bastion').constant('BastionConfig', {
9
10
  consumerCertRPM: "consumer_cert_rpm",
10
- markTranslated: false
11
+ markTranslated: false,
12
+ relativeUrlRoot: '/'
11
13
  });
12
14
  angular.module('Bastion.auth').value('CurrentUser', {id: "User"});
13
15
  angular.module('Bastion.auth').value('Permissions', []);
@@ -0,0 +1,39 @@
1
+ var BastionConfig,
2
+ PrefixInterceptor;
3
+
4
+ describe('PrefixInterceptor', function() {
5
+ beforeEach(module('gettext'));
6
+ beforeEach(module('Bastion'));
7
+
8
+ beforeEach(inject(function(_PrefixInterceptor_, _BastionConfig_) {
9
+ PrefixInterceptor = _PrefixInterceptor_;
10
+ BastionConfig = _BastionConfig_;
11
+ }));
12
+
13
+ describe('uncached template URL and no relativeUrlRoot', function() {
14
+ it('prepends / to config.url', function() {
15
+ var result = PrefixInterceptor.request({ url: 'template.html'});
16
+ expect(result.url).toBe('/template.html');
17
+ });
18
+ });
19
+
20
+ describe('relativeUrlRoot configured', function() {
21
+ beforeEach(function() {
22
+ BastionConfig.relativeUrlRoot = '/foreman/';
23
+ });
24
+
25
+ describe('uncached template URL', function() {
26
+ it('prepends the relative URL prefix', function() {
27
+ var result = PrefixInterceptor.request({ url: 'template.html'});
28
+ expect(result.url).toBe('/foreman/template.html');
29
+ });
30
+ });
31
+
32
+ describe('non-template URL', function() {
33
+ it('prepends the relative URL prefix', function() {
34
+ var result = PrefixInterceptor.request({ url: 'api/v2/hosts'});
35
+ expect(result.url).toBe('/foreman/api/v2/hosts');
36
+ });
37
+ });
38
+ });
39
+ });
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: 6.0.0
4
+ version: 6.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric D Helms
@@ -9,34 +9,34 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-09-19 00:00:00.000000000 Z
12
+ date: 2017-09-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: angular-rails-templates
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ~>
19
19
  - !ruby/object:Gem::Version
20
20
  version: 1.0.2
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ~>
26
26
  - !ruby/object:Gem::Version
27
27
  version: 1.0.2
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: uglifier
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ">="
32
+ - - '>='
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
39
+ - - '>='
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  description: Bastion provides a UI library of AngularJS based components designed
@@ -48,12 +48,6 @@ executables: []
48
48
  extensions: []
49
49
  extra_rdoc_files: []
50
50
  files:
51
- - ".eslintignore"
52
- - ".jshintrc"
53
- - Gruntfile.js
54
- - LICENSE
55
- - README.md
56
- - Rakefile
57
51
  - app/assets/javascripts/bastion/auth/auth.module.js
58
52
  - app/assets/javascripts/bastion/auth/authorization.service.js
59
53
  - app/assets/javascripts/bastion/bastion-bootstrap.js
@@ -117,10 +111,8 @@ files:
117
111
  - app/assets/javascripts/bastion/features/feature-flag.service.js
118
112
  - app/assets/javascripts/bastion/features/features.module.js
119
113
  - app/assets/javascripts/bastion/features/features.service.js
120
- - app/assets/javascripts/bastion/i18n/README
121
114
  - app/assets/javascripts/bastion/i18n/bastion.pot
122
115
  - app/assets/javascripts/bastion/i18n/i18n.module.js
123
- - app/assets/javascripts/bastion/i18n/locale/README
124
116
  - app/assets/javascripts/bastion/i18n/locale/de.po
125
117
  - app/assets/javascripts/bastion/i18n/locale/es.po
126
118
  - app/assets/javascripts/bastion/i18n/locale/fr.po
@@ -128,9 +120,11 @@ files:
128
120
  - app/assets/javascripts/bastion/i18n/locale/ja.po
129
121
  - app/assets/javascripts/bastion/i18n/locale/ko.po
130
122
  - app/assets/javascripts/bastion/i18n/locale/pt_BR.po
123
+ - app/assets/javascripts/bastion/i18n/locale/README
131
124
  - app/assets/javascripts/bastion/i18n/locale/ru.po
132
125
  - app/assets/javascripts/bastion/i18n/locale/zh_CN.po
133
126
  - app/assets/javascripts/bastion/i18n/locale/zh_TW.po
127
+ - app/assets/javascripts/bastion/i18n/README
134
128
  - app/assets/javascripts/bastion/i18n/translate.service.js
135
129
  - app/assets/javascripts/bastion/i18n/translations.js
136
130
  - app/assets/javascripts/bastion/i18n/zanata.xml
@@ -172,59 +166,12 @@ files:
172
166
  - app/views/bastion/layouts/application.html.erb
173
167
  - app/views/bastion/layouts/application_ie.html.erb
174
168
  - app/views/bastion/layouts/assets.html.erb
175
- - bastion.js
176
- - bower.json
177
- - config/routes.rb
178
169
  - config/routes/mount_engine.rb
179
- - eslint.yaml
180
- - grunt/bower.js
181
- - grunt/eslint.js
182
- - grunt/htmlhint.js
183
- - grunt/karma.js
184
- - grunt/nggettext_compile.js
185
- - grunt/nggettext_extract.js
186
- - lib/bastion.rb
170
+ - config/routes.rb
187
171
  - lib/bastion/engine.rb
188
172
  - lib/bastion/version.rb
189
- - package.json
190
- - test/auth/authorization.service.test.js
191
- - test/bastion/test-constants.js
192
- - test/components/bst-alert.directive.test.js
193
- - test/components/bst-bookmark.directive.test.js
194
- - test/components/bst-bookmark.factory.test.js
195
- - test/components/bst-dropdown.directive.test.js
196
- - test/components/bst-edit.directive.test.js
197
- - test/components/bst-flyout.directive.test.js
198
- - test/components/bst-form-buttons.directive.test.js
199
- - test/components/bst-form-group.directive.test.js
200
- - test/components/bst-menu.directive.test.js
201
- - test/components/bst-modal.directive.test.js
202
- - test/components/bst-resource-switcher.test.js
203
- - test/components/bst-table.directive.test.js
204
- - test/components/formatters/array-to-string.filter.test.js
205
- - test/components/formatters/boolean-to-yes-no.filter.test.js
206
- - test/components/formatters/capitalize.filter.test.js
207
- - test/components/formatters/key-value-to-string.filter.test.js
208
- - test/components/formatters/unlimited-filter.filter.test.js
209
- - test/components/notification.service.test.js
210
- - test/components/nutupane.factory.test.js
211
- - test/components/page-title.directive.test.js
212
- - test/components/page-title.service.test.js
213
- - test/components/path-selector.directive.test.js
214
- - test/components/table-cache.service.test.js
215
- - test/components/typeahead-empty.directive.test.js
216
- - test/features/bst-feature-flag.directive.test.js
217
- - test/features/feature-flag.service.test.js
218
- - test/i18n/translate.service.test.js
219
- - test/menu/menu-expander.service.test.js
220
- - test/routing.module.test.js
221
- - test/test-mocks.module.js
222
- - test/utils/bastion-resource.factory.test.js
223
- - test/utils/disable-link.directive.test.js
224
- - test/utils/form-utils.service.test.js
225
- - test/utils/round-up.filter.test.js
226
- - test/utils/stop-event.directive.test.js
227
- - test/utils/urlencode.filter.test.js
173
+ - lib/bastion.rb
174
+ - vendor/assets/javascripts/bastion/angular/angular.js
228
175
  - vendor/assets/javascripts/bastion/angular-animate/angular-animate.js
229
176
  - vendor/assets/javascripts/bastion/angular-blocks/angular-blocks.js
230
177
  - vendor/assets/javascripts/bastion/angular-bootstrap/ui-bootstrap-tpls.js
@@ -1735,9 +1682,63 @@ files:
1735
1682
  - vendor/assets/javascripts/bastion/angular-ui-bootstrap/timepicker.js
1736
1683
  - vendor/assets/javascripts/bastion/angular-ui-router/angular-ui-router.js
1737
1684
  - vendor/assets/javascripts/bastion/angular-uuid4/angular-uuid4.js
1738
- - vendor/assets/javascripts/bastion/angular/angular.js
1739
1685
  - vendor/assets/javascripts/bastion/json3/json3.js
1740
1686
  - vendor/assets/javascripts/bastion/ngUpload/ng-upload.js
1687
+ - grunt/bower.js
1688
+ - grunt/eslint.js
1689
+ - grunt/htmlhint.js
1690
+ - grunt/karma.js
1691
+ - grunt/nggettext_compile.js
1692
+ - grunt/nggettext_extract.js
1693
+ - Rakefile
1694
+ - README.md
1695
+ - Gruntfile.js
1696
+ - package.json
1697
+ - bower.json
1698
+ - bastion.js
1699
+ - eslint.yaml
1700
+ - .eslintignore
1701
+ - LICENSE
1702
+ - .jshintrc
1703
+ - test/auth/authorization.service.test.js
1704
+ - test/bastion/test-constants.js
1705
+ - test/bastion-config.test.js
1706
+ - test/components/bst-alert.directive.test.js
1707
+ - test/components/bst-bookmark.directive.test.js
1708
+ - test/components/bst-bookmark.factory.test.js
1709
+ - test/components/bst-dropdown.directive.test.js
1710
+ - test/components/bst-edit.directive.test.js
1711
+ - test/components/bst-flyout.directive.test.js
1712
+ - test/components/bst-form-buttons.directive.test.js
1713
+ - test/components/bst-form-group.directive.test.js
1714
+ - test/components/bst-menu.directive.test.js
1715
+ - test/components/bst-modal.directive.test.js
1716
+ - test/components/bst-resource-switcher.test.js
1717
+ - test/components/bst-table.directive.test.js
1718
+ - test/components/formatters/array-to-string.filter.test.js
1719
+ - test/components/formatters/boolean-to-yes-no.filter.test.js
1720
+ - test/components/formatters/capitalize.filter.test.js
1721
+ - test/components/formatters/key-value-to-string.filter.test.js
1722
+ - test/components/formatters/unlimited-filter.filter.test.js
1723
+ - test/components/notification.service.test.js
1724
+ - test/components/nutupane.factory.test.js
1725
+ - test/components/page-title.directive.test.js
1726
+ - test/components/page-title.service.test.js
1727
+ - test/components/path-selector.directive.test.js
1728
+ - test/components/table-cache.service.test.js
1729
+ - test/components/typeahead-empty.directive.test.js
1730
+ - test/features/bst-feature-flag.directive.test.js
1731
+ - test/features/feature-flag.service.test.js
1732
+ - test/i18n/translate.service.test.js
1733
+ - test/menu/menu-expander.service.test.js
1734
+ - test/routing.module.test.js
1735
+ - test/test-mocks.module.js
1736
+ - test/utils/bastion-resource.factory.test.js
1737
+ - test/utils/disable-link.directive.test.js
1738
+ - test/utils/form-utils.service.test.js
1739
+ - test/utils/round-up.filter.test.js
1740
+ - test/utils/stop-event.directive.test.js
1741
+ - test/utils/urlencode.filter.test.js
1741
1742
  homepage: http://www.github.com/Katello/bastion
1742
1743
  licenses: []
1743
1744
  metadata: {}
@@ -1747,23 +1748,24 @@ require_paths:
1747
1748
  - lib
1748
1749
  required_ruby_version: !ruby/object:Gem::Requirement
1749
1750
  requirements:
1750
- - - ">="
1751
+ - - '>='
1751
1752
  - !ruby/object:Gem::Version
1752
1753
  version: '0'
1753
1754
  required_rubygems_version: !ruby/object:Gem::Requirement
1754
1755
  requirements:
1755
- - - ">="
1756
+ - - '>='
1756
1757
  - !ruby/object:Gem::Version
1757
1758
  version: '0'
1758
1759
  requirements: []
1759
1760
  rubyforge_project:
1760
- rubygems_version: 2.6.11
1761
+ rubygems_version: 2.0.14.1
1761
1762
  signing_key:
1762
1763
  specification_version: 4
1763
1764
  summary: UI library of AngularJS based components for Foreman
1764
1765
  test_files:
1765
1766
  - test/auth/authorization.service.test.js
1766
1767
  - test/bastion/test-constants.js
1768
+ - test/bastion-config.test.js
1767
1769
  - test/components/bst-alert.directive.test.js
1768
1770
  - test/components/bst-bookmark.directive.test.js
1769
1771
  - test/components/bst-bookmark.factory.test.js