bastion 4.1.0 → 4.2.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: f40e45968eef402e29e6881759d26a013a601dcc
4
- data.tar.gz: 605dc9d2da6569ecdb79418c2546b74bac899cba
3
+ metadata.gz: 1b6d287c667939df014a45086236bd915114ebf8
4
+ data.tar.gz: 40d47f913d1b43f0f4c2a2240b467c6737d51ac6
5
5
  SHA512:
6
- metadata.gz: 51c603a77faa26e724ff788b533b98c250d07a42d03c57df783539a3657a1d75f3838a7106c30f95b6b939db7987d0466be2c630d10aab4398543cb46f5c8315
7
- data.tar.gz: 69dfb2786cb0556947b2b773ea689a24b69894e2888c33f4112d8a1ef380d27f79a79399f55fc9e841aa70ea7602c8bc6a1823017a7251259589d34ea6467561
6
+ metadata.gz: 7d423ce033cd373f3acb0d4416f3305cad5f04ce36591c3dc16c038dd6253112df538ced1dd1eedaa9839469f4328221dbdf86eb9b9072bbaf278a88ad31d3f0
7
+ data.tar.gz: 2d2f4506c5f5b55f83c17afb67461f0beebed6b6b93a030c1b140cc8d951b3acd1de8045ec3644f4e277669edaa8e4e80278ff57efaee95b90f17ede61461d47
@@ -33,7 +33,6 @@ angular.module('Bastion.components').directive('nutupaneTable', ['$compile', '$w
33
33
  clonedTable.removeAttr("nutupane-table");
34
34
  clonedTable.addClass("cloned-nutupane-table");
35
35
  clonedTable.find('tbody').remove();
36
- clonedTable.find('thead tr').append('<th class="table-header-spacer"></th>');
37
36
 
38
37
  originalTable.find('thead').hide();
39
38
 
@@ -46,12 +45,6 @@ angular.module('Bastion.components').directive('nutupaneTable', ['$compile', '$w
46
45
  angular.element(rowSelect).remove();
47
46
  }
48
47
 
49
- windowElement.bind('resize', function () {
50
- if (element.find('[bst-container-scroll]').length > 0) {
51
- clonedTable.find('thead tr th:last-child').width(element.width() - element.find('[bst-container-scroll]')[0].scrollWidth);
52
- }
53
- });
54
-
55
48
  // Compile each cloned th individually with original th scope
56
49
  // so sort will work.
57
50
  clonedThs = element.find('.cloned-nutupane-table th');
@@ -36,8 +36,12 @@ angular.module('Bastion.components').factory('Nutupane',
36
36
  var self = this,
37
37
  orgSwitcherRegex = new RegExp("/(organizations|locations)/(.+/)*(select|clear)");
38
38
 
39
+ // TODO: remove me
40
+ // http://projects.theforeman.org/issues/18079
41
+ TableCache.setTable = function () {};
42
+
39
43
  function getTableName() {
40
- return $location.path().split('/').join('-');
44
+ return $location.path().split('/').join('-').slice(1);
41
45
  }
42
46
 
43
47
  params = params || {};
@@ -192,11 +196,17 @@ angular.module('Bastion.components').factory('Nutupane',
192
196
  };
193
197
 
194
198
  self.refresh = function () {
199
+ self.invalidate();
195
200
  self.table.refreshing = true;
196
201
  self.table.resource.page = 0;
202
+ self.table.numSelected = 0;
197
203
  return self.load(true);
198
204
  };
199
205
 
206
+ self.invalidate = function () {
207
+ TableCache.removeTable(getTableName());
208
+ };
209
+
200
210
  self.removeRow = function (id, field) {
201
211
  var foundItem, table = self.table;
202
212
 
@@ -14,6 +14,10 @@
14
14
  cache.put(tableName, table);
15
15
  };
16
16
 
17
+ this.removeTable = function (tableName) {
18
+ cache.remove(tableName);
19
+ };
20
+
17
21
  this.getTable = function (tableName) {
18
22
  return cache.get(tableName);
19
23
  };
@@ -16,7 +16,9 @@
16
16
 
17
17
  <div class="row">
18
18
  <header class="col-sm-12">
19
- <span data-block="sub-header"></span>
19
+ <h3>
20
+ <span data-block="sub-header"></span>
21
+ </h3>
20
22
  </header>
21
23
  </div>
22
24
 
@@ -1,9 +1,13 @@
1
- <div class="row header-bar">
2
- <div class="col-sm-10">
3
- <span data-block="header"></span>
1
+ <div class="row">
2
+ <div class="col-sm-9">
3
+ <h1>
4
+ <span data-block="header"></span>
5
+ </h1>
4
6
  </div>
5
7
 
6
- <div class="fr">
7
- <span data-block="item-actions"></span>
8
+ <div class="col-sm-3">
9
+ <h1 class="fr">
10
+ <span data-block="item-actions"></span>
11
+ </h1>
8
12
  </div>
9
- </div>
13
+ </div>
@@ -1,21 +1,22 @@
1
- <div class="row header-bar">
2
- <div class="row">
3
- <div class="col-sm-12">
4
- <div data-block="search-filter"></div>
5
- </div>
6
- </div>
1
+ <div class="row toolbar-pf table-view-pf-toolbar-external" ng-class="{'empty-table': table.rows.length === 0}">
2
+ <div class="col-sm-12">
3
+ <form class="toolbar-pf-actions">
4
+ <div class="toolbar-pf-action-right">
5
+ <div data-block="list-actions"></div>
6
+ </div>
7
+
8
+ <div class="form-group toolbar-pf-filter">
9
+ <div data-block="search">
10
+ <div class="input-group">
11
+ <input type="text"
12
+ class="form-control"
13
+ placeholder="{{ 'Filter...' | translate }}"
14
+ bst-on-enter="table.search(table.searchTerm)"
15
+ ng-model="table.searchTerm"
16
+ ng-trim="false"
17
+ uib-typeahead="item.label for item in table.autocomplete($viewValue)"
18
+ typeahead-template-url="components/views/autocomplete-scoped-search.html"/>
7
19
 
8
- <div data-block="search">
9
- <div class="col-sm-3">
10
- <div class="input-group">
11
- <input type="text"
12
- class="form-control"
13
- placeholder="{{ 'Filter...' | translate }}"
14
- bst-on-enter="table.search(table.searchTerm)"
15
- ng-model="table.searchTerm"
16
- ng-trim="false"
17
- uib-typeahead="item.label for item in table.autocomplete($viewValue)"
18
- typeahead-template-url="components/views/autocomplete-scoped-search.html"/>
19
20
  <span class="input-group-btn">
20
21
  <button class="btn btn-default"
21
22
  type="button"
@@ -31,48 +32,47 @@
31
32
  </button>
32
33
  <ul bst-bookmark controller-name="controllerName" query="table.searchTerm" class="dropdown-menu pull-right"></ul>
33
34
  </span>
35
+ </div>
36
+ </div>
34
37
 
38
+ <span data-block="filters"></span>
39
+ <span data-block="search-filter"></span>
35
40
  </div>
36
- </div>
41
+ </form>
37
42
 
38
- <div class="col-sm-3">
39
- <span translate>Showing {{ table.rows.length }} of {{ table.resource.subtotal }} ({{ table.resource.total }} Total)</span>
40
- </div>
41
- </div>
43
+ <div class="row toolbar-pf-results" ng-show="table.rows.length > 0">
44
+ <div class="col-sm-9">
45
+ <span translate>Showing {{ table.rows.length }} of {{ table.resource.subtotal }} ({{ table.resource.total }} Total)</span>
46
+ </div>
42
47
 
43
- <div class="fr">
44
- <div class="fl">
45
- <div data-block="list-actions"></div>
48
+ <div class="col-sm-3 table-view-pf-select-results" ng-show="table.rowSelect">
49
+ <span translate>{{ table.numSelected }} Selected</span>
50
+ </div>
46
51
  </div>
47
52
  </div>
48
53
  </div>
49
54
 
50
- <div class="row header-bar">
51
- <div class="fr" ng-show="table.rowSelect">
52
- <span translate>{{ table.numSelected }} Selected</span>
53
- </div>
54
- <div class="col-sm-10">
55
- <span data-block="filters"></span>
56
- </div>
57
- </div>
58
-
59
- <div class="row nutupane" bst-table="table" nutupane-table>
60
- <div class="loading-mask" ng-show="table.refreshing || table.working" >
61
- <i class="fa fa-spinner fa-spin"></i>
62
- <span>{{ "Loading..." | translate }}</span>
63
- </div>
55
+ <div bst-table="table" nutupane-table>
56
+ <div class="row">
57
+ <div class="col-sm-12">
58
+ <div class="loading-mask" ng-show="table.refreshing || table.working" >
59
+ <i class="fa fa-spinner fa-spin"></i>
60
+ <span>{{ "Loading..." | translate }}</span>
61
+ </div>
64
62
 
65
- <p bst-alert="info" ng-show="table.rows.length === 0 && !table.working && !table.searchTerm && !table.searchCompleted">
66
- <span data-block="no-rows-message"></span>
67
- </p>
68
- <p bst-alert="info" ng-show="table.rows.length === 0 && !table.working && (table.searchTerm || table.searchCompleted)">
69
- <span data-block="no-search-results-message"></span>
70
- </p>
63
+ <p bst-alert="info" ng-show="table.rows.length === 0 && !table.working && !table.searchTerm && !table.searchCompleted">
64
+ <span data-block="no-rows-message"></span>
65
+ </p>
66
+ <p bst-alert="info" ng-show="table.rows.length === 0 && !table.working && (table.searchTerm || table.searchCompleted)">
67
+ <span data-block="no-search-results-message"></span>
68
+ </p>
71
69
 
72
- <div ng-show="table.rows.length > 0" bst-container-scroll data="table.rows">
73
- <div infinite-scroll="table.nextPage()" infinite-scroll-container="'.container-scroll-wrapper'"
74
- infinite-scroll-listen-for-event="nutupane:loaded">
75
- <div data-block="table"></div>
70
+ <div ng-show="table.rows.length > 0 && !(table.refreshing || table.working)" bst-container-scroll data="table.rows">
71
+ <div infinite-scroll="table.nextPage()" infinite-scroll-container="'.container-scroll-wrapper'"
72
+ infinite-scroll-listen-for-event="nutupane:loaded">
73
+ <div data-block="table"></div>
74
+ </div>
75
+ </div>
76
76
  </div>
77
77
  </div>
78
78
  </div>
@@ -2,17 +2,20 @@
2
2
  word-wrap: break-word;
3
3
  }
4
4
 
5
+ @import "overrides";
6
+ @import "path-selector";
7
+ @import "tables";
8
+
5
9
  .bastion {
6
10
  // Bastion Components
11
+ @import "patternfly";
7
12
  @import "mixins";
8
13
  @import "variables";
9
14
  @import "nutupane";
10
15
  @import "components";
11
- @import "overrides";
12
16
  @import "helpers";
13
17
  @import "./forms";
14
18
  @import "animations";
15
- @import "path-selector";
16
19
  @import "typography";
17
20
 
18
21
  body {
@@ -1,13 +1,3 @@
1
- .header-bar {
2
- background: rgb(250, 250, 250);
3
- padding: 10px 15px 10px 0;
4
- border-bottom: 1px solid rgb(230, 230, 230);
5
-
6
- h2 {
7
- margin: 5px 0 0 0;
8
- }
9
- }
10
-
11
1
  .nav.nav-tabs.details-nav {
12
2
  margin-bottom: 10px;
13
3
  }
@@ -47,8 +47,8 @@ td.row-select {
47
47
  .table {
48
48
  margin-bottom: 0;
49
49
 
50
- tr:hover td, tr:hover td a,
51
- tr.focus td, tr.focus td a {
50
+ tr:hover td, tr:hover td > a,
51
+ tr.focus td, tr.focus td > a {
52
52
  background-color: $listhover_color;
53
53
  color: #FFF;
54
54
 
@@ -61,7 +61,7 @@ td.row-select {
61
61
  background-color: $listhover_color;
62
62
  color: #FFF;
63
63
 
64
- a {
64
+ > a {
65
65
  color: #FFF;
66
66
  }
67
67
 
@@ -110,7 +110,7 @@ td.row-select {
110
110
  background-color: lighten($listhover_color, 8%);
111
111
  color: white;
112
112
 
113
- a {
113
+ > a {
114
114
  color: white;
115
115
  }
116
116
  }
@@ -1,5 +1,4 @@
1
- // Bootstrap overrides
2
- @import "patternfly";
1
+ @import "patternfly/variables";
3
2
 
4
3
  .filter-option label {
5
4
  font-weight: normal;
@@ -14,7 +13,7 @@ $table-cell-padding-top: 5px;
14
13
  $table-cell-padding-bottom: 5px;
15
14
 
16
15
  // Foreman Core Overrides
17
- table {
16
+ table.table {
18
17
  margin-bottom: 0 !important;
19
18
  }
20
19
 
@@ -44,11 +43,6 @@ ul {
44
43
  }
45
44
  }
46
45
 
47
- .dropdown-menu li .disabled {
48
- @extend .text-muted;
49
- padding: 1px 10px;
50
- }
51
-
52
46
  .breadcrumbs .breadcrumb {
53
47
  margin-bottom: 0;
54
48
  }
@@ -60,4 +54,24 @@ ul {
60
54
  .uib-datepicker-popup.dropdown-menu
61
55
  {
62
56
  display: block;
57
+ }
58
+
59
+ // Fix bad margin and border on patternfly dropdown buttons
60
+ html .toolbar-pf .toolbar-pf-filter.form-group .input-group-btn .btn {
61
+ border-bottom-left-radius: 0;
62
+ border-top-left-radius: 0;
63
+ margin-right: -1px;
64
+ margin-left: -1px;
65
+ }
66
+
67
+ // Add border to bottom of empty table
68
+ .row.toolbar-pf.table-view-pf-toolbar.empty-table{
69
+ border-bottom: 1px solid #d1d1d1;
70
+ margin-bottom: 10px;
71
+ }
72
+
73
+ // Ensure scrolling on the modal body
74
+ .modal-body {
75
+ overflow-x: hidden;
76
+ overflow-y: scroll;
63
77
  }
@@ -0,0 +1,46 @@
1
+ .table {
2
+ table-layout: fixed;
3
+
4
+ .number-cell {
5
+ text-align: right;
6
+ }
7
+
8
+ .action-cell {
9
+ text-align: center;
10
+ }
11
+
12
+ tr.clickable-row,
13
+ th.sortable {
14
+ cursor: pointer;
15
+ }
16
+
17
+ th.row-select,
18
+ td.row-select {
19
+ width: 30px;
20
+ max-width: 30px;
21
+ }
22
+
23
+ tr:hover td, tr:hover td > a,
24
+ tr.focus td, tr.focus td > a {
25
+ background-color: $listhover_color;
26
+ color: #FFF;
27
+
28
+ button, select {
29
+ color: #000;
30
+ }
31
+ }
32
+
33
+ tr.active, tbody tr:hover, tr.selected-row td {
34
+ background-color: $listhover_color;
35
+ color: #FFF;
36
+
37
+ > a {
38
+ color: #FFF;
39
+ }
40
+
41
+ .bst-edit:hover {
42
+ color: #000;
43
+ }
44
+ }
45
+ }
46
+
@@ -1,3 +1,3 @@
1
1
  module Bastion
2
- VERSION = "4.1.0"
2
+ VERSION = "4.2.0"
3
3
  end
@@ -3,11 +3,25 @@ describe('Factory: Nutupane', function() {
3
3
  $location,
4
4
  $rootScope,
5
5
  Resource,
6
+ TableCache,
6
7
  expectedResult,
7
8
  Nutupane;
8
9
 
9
10
  beforeEach(module('Bastion.components'));
10
11
 
12
+ beforeEach(module(function ($provide) {
13
+ TableCache = {
14
+ getTable: function () {
15
+ },
16
+ setTable: function () {
17
+ },
18
+ removeTable: function () {
19
+ }
20
+ };
21
+
22
+ $provide.value('TableCache', TableCache);
23
+ }));
24
+
11
25
  beforeEach(module(function() {
12
26
  expectedResult = [{id: 2, value: "value2"}, {id:3, value: "value3"}];
13
27
  Resource = {
@@ -66,12 +80,21 @@ describe('Factory: Nutupane', function() {
66
80
 
67
81
  it("providing a method to refresh the table", function() {
68
82
  spyOn(Resource, 'queryPaged').and.callThrough();
83
+ spyOn(TableCache, 'removeTable');
84
+
69
85
  nutupane.refresh();
70
86
 
87
+ expect(TableCache.removeTable).toHaveBeenCalled();
71
88
  expect(Resource.queryPaged).toHaveBeenCalled();
72
89
  expect(nutupane.table.rows).toBe(expectedResult);
73
90
  });
74
91
 
92
+ it("provides a way to invalidate the table", function () {
93
+ spyOn(TableCache, 'removeTable');
94
+ nutupane.invalidate();
95
+ expect(TableCache.removeTable).toHaveBeenCalled();
96
+ });
97
+
75
98
  it("providing a method to perform a search", function() {
76
99
  spyOn(Resource, 'queryPaged');
77
100
  nutupane.table.closeItem = function() {};
@@ -8,7 +8,8 @@ describe('Factory: TableCahce', function () {
8
8
  get: function () {
9
9
  return table;
10
10
  },
11
- put: function () {}
11
+ put: function () {},
12
+ remove: function () {}
12
13
  };
13
14
 
14
15
  $cacheFactory = function () {
@@ -29,6 +30,12 @@ describe('Factory: TableCahce', function () {
29
30
  expect(cache.put).toHaveBeenCalledWith("table", table);
30
31
  });
31
32
 
33
+ it("allows removing a table from the cache", function () {
34
+ spyOn(cache, 'remove').and.callThrough();
35
+ TableCache.removeTable("table");
36
+ expect(cache.remove).toHaveBeenCalledWith("table");
37
+ });
38
+
32
39
  it("allows getting a table from the cache", function () {
33
40
  var result;
34
41
  spyOn(cache, 'get').and.callThrough();
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.1.0
4
+ version: 4.2.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-01-04 00:00:00.000000000 Z
12
+ date: 2017-01-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: angular-rails-templates
@@ -29,14 +29,14 @@ dependencies:
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,8 +48,8 @@ executables: []
48
48
  extensions: []
49
49
  extra_rdoc_files: []
50
50
  files:
51
- - .eslintignore
52
- - .jshintrc
51
+ - ".eslintignore"
52
+ - ".jshintrc"
53
53
  - Gruntfile.js
54
54
  - LICENSE
55
55
  - README.md
@@ -167,6 +167,7 @@ files:
167
167
  - app/assets/stylesheets/bastion/nutupane.scss
168
168
  - app/assets/stylesheets/bastion/overrides.scss
169
169
  - app/assets/stylesheets/bastion/path-selector.scss
170
+ - app/assets/stylesheets/bastion/tables.scss
170
171
  - app/assets/stylesheets/bastion/typography.scss
171
172
  - app/assets/stylesheets/bastion/variables.scss
172
173
  - app/controllers/bastion/bastion_controller.rb
@@ -1749,17 +1750,17 @@ require_paths:
1749
1750
  - lib
1750
1751
  required_ruby_version: !ruby/object:Gem::Requirement
1751
1752
  requirements:
1752
- - - '>='
1753
+ - - ">="
1753
1754
  - !ruby/object:Gem::Version
1754
1755
  version: '0'
1755
1756
  required_rubygems_version: !ruby/object:Gem::Requirement
1756
1757
  requirements:
1757
- - - '>='
1758
+ - - ">="
1758
1759
  - !ruby/object:Gem::Version
1759
1760
  version: '0'
1760
1761
  requirements: []
1761
1762
  rubyforge_project:
1762
- rubygems_version: 2.4.8
1763
+ rubygems_version: 2.4.6
1763
1764
  signing_key:
1764
1765
  specification_version: 4
1765
1766
  summary: UI library of AngularJS based components for Foreman