bastion 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gruntfile.js +7 -0
- data/app/assets/javascripts/bastion/auth/auth.module.js +3 -4
- data/app/assets/javascripts/bastion/bastion.module.js +3 -3
- data/app/assets/javascripts/bastion/components/bst-alerts.directive.js +1 -1
- data/app/assets/javascripts/bastion/components/bst-dropdown.directive.js +1 -1
- data/app/assets/javascripts/bastion/components/bst-edit.directive.js +27 -27
- data/app/assets/javascripts/bastion/components/bst-flyout.directive.js +1 -1
- data/app/assets/javascripts/bastion/components/bst-form-buttons.directive.js +1 -1
- data/app/assets/javascripts/bastion/components/bst-infinite-scroll.directive.js +12 -10
- data/app/assets/javascripts/bastion/components/bst-menu.directive.js +4 -4
- data/app/assets/javascripts/bastion/components/bst-modal.directive.js +2 -2
- data/app/assets/javascripts/bastion/components/bst-table.directive.js +18 -16
- data/app/assets/javascripts/bastion/components/formatters/boolean-to-yes-no.filter.js +3 -3
- data/app/assets/javascripts/bastion/components/nutupane-table.directive.js +12 -10
- data/app/assets/javascripts/bastion/components/nutupane.factory.js +12 -11
- data/app/assets/javascripts/bastion/components/page-title.directive.js +5 -3
- data/app/assets/javascripts/bastion/components/page-title.service.js +3 -1
- data/app/assets/javascripts/bastion/components/path-selector.directive.js +27 -27
- data/app/assets/javascripts/bastion/components/typeahead-empty.directive.js +2 -3
- data/app/assets/javascripts/bastion/features/bst-feature-flag.directive.js +1 -1
- data/app/assets/javascripts/bastion/features/feature-flag.service.js +3 -3
- data/app/assets/javascripts/bastion/menu/menu-expander.service.js +2 -2
- data/bastion.js +1 -0
- data/grunt/eslint.js +10 -0
- data/lib/bastion/version.rb +1 -1
- data/package.json +4 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NmU2ZTZkYTg5N2EwNmM1NTI5YTQyOTk3Yjg1NzY3NDQ3OWU5ZjlkYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTdkMTRkN2M0NTdkZjNhOGI3ZDg0MmJmYmUzNWRiNWUyMmM5ZmJjMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YjBiNjdiNWE2ZmU3ODJhOTNiNzU4MWNhMDI0Y2U5OGI2ZTJjMjJiMWNlZDlh
|
10
|
+
NmFhYzc5MmMyZjI5NmNhNWQ1MzZhYThmY2EwZmM5ZGMxNDY2ZDUzOGUyZmU1
|
11
|
+
MTY0YTdjYWQ1MmY2MmI3NTBjYTAwZjY1MjM5NTgxMDIwYzA5NjM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDU1MzA3ZjRhNGJkMzk3Y2U0ODc2MTZkNzExYmQyYTE0NTJlMjgwYzQ1YTUw
|
14
|
+
M2IzOGMwNDdmMTVlZGNhM2UxYjZmMTJmZDAwNjYxNGE4ZjM4NjQ5YTM5ODdm
|
15
|
+
YWZiNTNkZjIwNjM0NzQ3OTIwOGIwZGU0NDY3MDFkNDE0NjBjYWU=
|
data/Gruntfile.js
CHANGED
@@ -48,10 +48,9 @@ angular.module('Bastion.auth').config(['$httpProvider', '$provide',
|
|
48
48
|
message = translate('You are not authorized to perform this action.');
|
49
49
|
response.data.errors = [message];
|
50
50
|
response.data.displayMessage = message;
|
51
|
-
return $q.reject(response);
|
52
|
-
} else {
|
53
|
-
return $q.reject(response);
|
54
51
|
}
|
52
|
+
|
53
|
+
return $q.reject(response);
|
55
54
|
}
|
56
55
|
};
|
57
56
|
}]
|
@@ -76,7 +75,7 @@ angular.module('Bastion.auth').run(['$rootScope', '$window', 'Authorization',
|
|
76
75
|
function ($rootScope, $window, Authorization) {
|
77
76
|
$rootScope.$on('$stateChangeStart', function (event, toState) {
|
78
77
|
var permission = toState.permission;
|
79
|
-
if (permission !== false && (permission
|
78
|
+
if (permission !== false && (angular.isUndefined(permission) || Authorization.denied(permission))) {
|
80
79
|
$window.location.href = '/katello/403';
|
81
80
|
}
|
82
81
|
});
|
@@ -47,7 +47,7 @@ angular.module('Bastion').config(
|
|
47
47
|
|
48
48
|
$httpProvider.defaults.headers.common = {
|
49
49
|
Accept: 'application/json, text/plain, version=2; */*',
|
50
|
-
'X-CSRF-TOKEN':
|
50
|
+
'X-CSRF-TOKEN': angular.element('meta[name=csrf-token]').attr('content')
|
51
51
|
};
|
52
52
|
|
53
53
|
$urlRouterProvider.rule(function ($injector, $location) {
|
@@ -81,7 +81,7 @@ angular.module('Bastion').config(
|
|
81
81
|
return {
|
82
82
|
request: function (config) {
|
83
83
|
if (config.url.indexOf('.html') !== -1) {
|
84
|
-
if ($templateCache.get(config.url)
|
84
|
+
if (angular.isUndefined($templateCache.get(config.url))) {
|
85
85
|
config.url = '/' + config.url;
|
86
86
|
}
|
87
87
|
}
|
@@ -138,7 +138,7 @@ angular.module('Bastion').run(['$rootScope', '$state', '$stateParams', 'gettextC
|
|
138
138
|
};
|
139
139
|
|
140
140
|
$rootScope.stateIncludes = function (state, params) {
|
141
|
-
if (params
|
141
|
+
if (angular.isDefined(params)) {
|
142
142
|
angular.forEach(params, function (value, key) {
|
143
143
|
params[key] = value.toString();
|
144
144
|
});
|
@@ -40,7 +40,7 @@ angular.module('Bastion.components').directive('bstAlerts', function () {
|
|
40
40
|
scope.types = ['success', 'info', 'warning', 'danger'];
|
41
41
|
|
42
42
|
function handleMessages(type, messages) {
|
43
|
-
scope.alerts[type] =
|
43
|
+
scope.alerts[type] = messages;
|
44
44
|
}
|
45
45
|
|
46
46
|
scope.$watch('successMessages', function (messages) {
|
@@ -37,6 +37,27 @@ angular.module('Bastion.components')
|
|
37
37
|
.controller('BstEditController', ['$scope', '$filter', function ($scope, $filter) {
|
38
38
|
var previousValue;
|
39
39
|
|
40
|
+
function handleAction(action) {
|
41
|
+
$scope.editMode = false;
|
42
|
+
$scope.workingMode = true;
|
43
|
+
|
44
|
+
if (angular.isDefined(action) && action.hasOwnProperty('then')) {
|
45
|
+
action.then(
|
46
|
+
function () {
|
47
|
+
$scope.updateDisplay($scope.model);
|
48
|
+
$scope.workingMode = false;
|
49
|
+
},
|
50
|
+
function () {
|
51
|
+
$scope.workingMode = false;
|
52
|
+
$scope.editMode = true;
|
53
|
+
}
|
54
|
+
);
|
55
|
+
|
56
|
+
} else {
|
57
|
+
$scope.workingMode = false;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
40
61
|
$scope.edit = function () {
|
41
62
|
var options;
|
42
63
|
|
@@ -44,11 +65,11 @@ angular.module('Bastion.components')
|
|
44
65
|
$scope.editMode = true;
|
45
66
|
previousValue = $scope.model;
|
46
67
|
|
47
|
-
if ($scope.handleOptions
|
68
|
+
if (angular.isDefined($scope.handleOptions)) {
|
48
69
|
options = $scope.handleOptions();
|
49
70
|
}
|
50
71
|
|
51
|
-
if (options
|
72
|
+
if (angular.isDefined(options)) {
|
52
73
|
if (options.hasOwnProperty('then')) {
|
53
74
|
$scope.workingMode = true;
|
54
75
|
$scope.editMode = false;
|
@@ -93,27 +114,6 @@ angular.module('Bastion.components')
|
|
93
114
|
handleAction(action);
|
94
115
|
};
|
95
116
|
|
96
|
-
function handleAction(action) {
|
97
|
-
$scope.editMode = false;
|
98
|
-
$scope.workingMode = true;
|
99
|
-
|
100
|
-
if (action !== undefined && action.hasOwnProperty('then')) {
|
101
|
-
action.then(
|
102
|
-
function () {
|
103
|
-
$scope.updateDisplay($scope.model);
|
104
|
-
$scope.workingMode = false;
|
105
|
-
},
|
106
|
-
function () {
|
107
|
-
$scope.workingMode = false;
|
108
|
-
$scope.editMode = true;
|
109
|
-
}
|
110
|
-
);
|
111
|
-
|
112
|
-
} else {
|
113
|
-
$scope.workingMode = false;
|
114
|
-
}
|
115
|
-
}
|
116
|
-
|
117
117
|
$scope.cancel = function () {
|
118
118
|
$scope.editMode = false;
|
119
119
|
$scope.disableSave = false;
|
@@ -132,7 +132,7 @@ angular.module('Bastion.components')
|
|
132
132
|
|
133
133
|
handleDelete = $scope.handleDelete({ value: $scope.model });
|
134
134
|
|
135
|
-
if (handleDelete
|
135
|
+
if (angular.isDefined(handleDelete) && handleDelete.hasOwnProperty('then')) {
|
136
136
|
|
137
137
|
handleDelete.then(
|
138
138
|
function () {
|
@@ -169,7 +169,7 @@ angular.module('Bastion.components')
|
|
169
169
|
// Watch the model and displayed values for changes
|
170
170
|
// and update the displayed value accordingly.
|
171
171
|
$scope.$watch('model + displayValue', function (newValue) {
|
172
|
-
if (newValue
|
172
|
+
if (angular.isDefined(newValue)) {
|
173
173
|
$scope.updateDisplay($scope.model);
|
174
174
|
}
|
175
175
|
});
|
@@ -255,7 +255,7 @@ angular.module('Bastion.components')
|
|
255
255
|
},
|
256
256
|
templateUrl: 'components/views/bst-edit-select.html',
|
257
257
|
compile: function (element, attrs) {
|
258
|
-
var optionsFormat = attrs
|
258
|
+
var optionsFormat = attrs.optionsFormat;
|
259
259
|
if (optionsFormat) {
|
260
260
|
element.find('select').attr('ng-options', optionsFormat);
|
261
261
|
}
|
@@ -341,7 +341,7 @@ angular.module('Bastion.components')
|
|
341
341
|
|
342
342
|
handleAdd = $scope.handleAdd(value);
|
343
343
|
|
344
|
-
if (handleAdd
|
344
|
+
if (angular.isDefined(handleAdd) && handleAdd.hasOwnProperty('then')) {
|
345
345
|
|
346
346
|
handleAdd.then(
|
347
347
|
function () {
|
@@ -38,7 +38,7 @@ angular.module('Bastion.components').directive('bstFormButtons', function () {
|
|
38
38
|
},
|
39
39
|
link: function (scope, iElement, iAttrs, controller) {
|
40
40
|
|
41
|
-
if (scope.working
|
41
|
+
if (angular.isUndefined(scope.working)) {
|
42
42
|
scope.working = false;
|
43
43
|
}
|
44
44
|
|
@@ -38,7 +38,8 @@ angular.module('Bastion.components').directive('bstInfiniteScroll', [function ()
|
|
38
38
|
},
|
39
39
|
controller: function ($scope, $element) {
|
40
40
|
|
41
|
-
var result,
|
41
|
+
var result, getScrollHeight, isPromise, loadUntilScroll,
|
42
|
+
raw = $element[0];
|
42
43
|
|
43
44
|
$element.bind('scroll', function () {
|
44
45
|
var sliderPosition = raw.scrollTop + raw.offsetHeight;
|
@@ -47,24 +48,25 @@ angular.module('Bastion.components').directive('bstInfiniteScroll', [function ()
|
|
47
48
|
}
|
48
49
|
});
|
49
50
|
|
50
|
-
|
51
|
+
getScrollHeight = function () {
|
51
52
|
var scrollHeight = 0;
|
52
53
|
$element.children().each(function () {
|
53
|
-
scrollHeight = scrollHeight +
|
54
|
+
scrollHeight = scrollHeight + angular.element(this).get(0).scrollHeight;
|
54
55
|
});
|
55
56
|
return scrollHeight;
|
56
57
|
};
|
57
58
|
|
58
|
-
|
59
|
+
isPromise = function (promise) {
|
59
60
|
return promise && promise.hasOwnProperty('then');
|
60
61
|
};
|
61
62
|
|
62
|
-
|
63
|
-
var
|
63
|
+
loadUntilScroll = function () {
|
64
|
+
var loadResult;
|
65
|
+
|
64
66
|
if (getScrollHeight() < $element.height()) {
|
65
|
-
|
66
|
-
if (isPromise(
|
67
|
-
|
67
|
+
loadResult = $scope.loadMoreFunction();
|
68
|
+
if (isPromise(loadResult)) {
|
69
|
+
loadResult.then(function () {
|
68
70
|
if (getScrollHeight() < $element.height()) {
|
69
71
|
loadUntilScroll();
|
70
72
|
}
|
@@ -73,7 +75,7 @@ angular.module('Bastion.components').directive('bstInfiniteScroll', [function ()
|
|
73
75
|
}
|
74
76
|
};
|
75
77
|
|
76
|
-
if (!$scope.skipInitialLoad && ($scope.data
|
78
|
+
if (!$scope.skipInitialLoad && (angular.isUndefined($scope.data) || $scope.data.length === 0)) {
|
77
79
|
result = $scope.loadMoreFunction();
|
78
80
|
if (isPromise(result)) {
|
79
81
|
result.then(loadUntilScroll);
|
@@ -13,7 +13,7 @@ angular.module('Bastion.components').directive('bstMenu', ['$window', function (
|
|
13
13
|
replace: true,
|
14
14
|
scope: {
|
15
15
|
'menu': '=bstMenu',
|
16
|
-
'compact'
|
16
|
+
'compact': '@'
|
17
17
|
},
|
18
18
|
templateUrl: 'components/views/bst-menu.html',
|
19
19
|
controller: ['$scope', function ($scope) {
|
@@ -38,11 +38,11 @@ angular.module('Bastion.components').directive('bstMenu', ['$window', function (
|
|
38
38
|
link: function (scope, element, attrs) {
|
39
39
|
var elementOriginalOffset;
|
40
40
|
|
41
|
-
if (attrs.compact
|
42
|
-
elementOriginalOffset =
|
41
|
+
if (angular.isDefined(attrs.compact)) {
|
42
|
+
elementOriginalOffset = angular.element(element).offset().top;
|
43
43
|
|
44
44
|
angular.element($window).bind('scroll', function () {
|
45
|
-
var windowScrollTop =
|
45
|
+
var windowScrollTop = angular.element($window).scrollTop();
|
46
46
|
|
47
47
|
if (windowScrollTop > elementOriginalOffset + 2) {
|
48
48
|
element.parent().addClass('compact');
|
@@ -43,8 +43,8 @@ angular.module('Bastion.components').directive('bstModal',
|
|
43
43
|
|
44
44
|
modalController = ['$scope', '$modalInstance', 'model', function ($scope, $modalInstance, model) {
|
45
45
|
$scope[scope.modelName] = model;
|
46
|
-
$scope
|
47
|
-
$scope
|
46
|
+
$scope.modalHeader = scope.modalHeader;
|
47
|
+
$scope.modalBody = scope.modalBody;
|
48
48
|
|
49
49
|
$scope.ok = function () {
|
50
50
|
$modalInstance.close();
|
@@ -112,16 +112,16 @@ angular.module('Bastion.components')
|
|
112
112
|
scope: true,
|
113
113
|
controller: 'BstTableHeadController',
|
114
114
|
compile: function (tElement, tAttrs) {
|
115
|
-
if (tAttrs.rowSelect
|
115
|
+
if (angular.isDefined(tAttrs.rowSelect)) {
|
116
116
|
tElement.prepend(rowSelectTemplate());
|
117
|
-
} else if (tAttrs.rowChoice
|
117
|
+
} else if (angular.isDefined(tAttrs.rowChoice)) {
|
118
118
|
tElement.prepend(rowChoiceTemplate());
|
119
119
|
}
|
120
120
|
|
121
121
|
return function (scope, element, attrs, bstTableController) {
|
122
|
-
if (tAttrs.rowSelect
|
122
|
+
if (angular.isDefined(tAttrs.rowSelect)) {
|
123
123
|
scope.table.rowSelect = true;
|
124
|
-
} else
|
124
|
+
} else if (angular.isDefined(tAttrs.rowChoice)) {
|
125
125
|
scope.table.rowChoice = true;
|
126
126
|
}
|
127
127
|
|
@@ -156,19 +156,21 @@ angular.module('Bastion.components')
|
|
156
156
|
controller: ['$scope', function ($scope) {
|
157
157
|
$scope.column = { show: true };
|
158
158
|
}],
|
159
|
-
compile: function (
|
160
|
-
|
161
|
-
|
162
|
-
|
159
|
+
compile: function (tElement, tAttributes) {
|
160
|
+
var newElement;
|
161
|
+
|
162
|
+
if (tAttributes.hasOwnProperty("sortable")) {
|
163
|
+
newElement = angular.element(sortIconTemplate);
|
164
|
+
newElement.find('.sort-icon').before(tElement.html());
|
163
165
|
newElement.addClass('sortable');
|
164
|
-
newElement.addClass(
|
165
|
-
|
166
|
+
newElement.addClass(tElement.attr('class'));
|
167
|
+
tElement.replaceWith(newElement);
|
166
168
|
}
|
167
169
|
return function (scope, element, attributes, bstTableHeadController) {
|
168
170
|
if (attributes.hasOwnProperty("sortable")) {
|
169
171
|
$compile(element)(scope);
|
170
172
|
}
|
171
|
-
scope.column.id = attributes
|
173
|
+
scope.column.id = attributes.bstTableColumn;
|
172
174
|
bstTableHeadController.addColumn(scope.column);
|
173
175
|
|
174
176
|
scope.$watch('column.show', function (show) {
|
@@ -202,7 +204,7 @@ angular.module('Bastion.components')
|
|
202
204
|
|
203
205
|
activeRowTemplate = function (activeTest) {
|
204
206
|
return '<i class="fa fa-chevron-right selected-icon" ' +
|
205
|
-
'ng-show="' + activeTest
|
207
|
+
'ng-show="' + activeTest + ' "></i>';
|
206
208
|
};
|
207
209
|
|
208
210
|
return {
|
@@ -212,19 +214,19 @@ angular.module('Bastion.components')
|
|
212
214
|
controller: 'BstTableRowController',
|
213
215
|
compile: function (tElement, tAttrs) {
|
214
216
|
|
215
|
-
if (tAttrs.activeRow
|
217
|
+
if (angular.isDefined(tAttrs.activeRow)) {
|
216
218
|
tElement.find('td:first-child').append(activeRowTemplate(tAttrs.activeRow));
|
217
219
|
}
|
218
220
|
|
219
|
-
if (tAttrs.rowSelect
|
221
|
+
if (angular.isDefined(tAttrs.rowSelect)) {
|
220
222
|
tElement.prepend(rowSelectTemplate(tAttrs.rowSelect));
|
221
223
|
}
|
222
224
|
|
223
|
-
if (tAttrs.rowChoice
|
225
|
+
if (angular.isDefined(tAttrs.rowChoice)) {
|
224
226
|
tElement.prepend(rowChoiceTemplate(tAttrs.rowChoice));
|
225
227
|
}
|
226
228
|
|
227
|
-
if (tAttrs.activeRow
|
229
|
+
if (angular.isDefined(tAttrs.activeRow)) {
|
228
230
|
tElement.find('td').attr('ng-class', '{ "active-row": ' + tAttrs.activeRow + ' }');
|
229
231
|
}
|
230
232
|
|
@@ -25,10 +25,10 @@ angular.module('Bastion.components.formatters').filter('booleanToYesNo', ['trans
|
|
25
25
|
yesValue = yesValue || translate("Yes");
|
26
26
|
noValue = noValue || translate("No");
|
27
27
|
|
28
|
-
if (boolValue !== '' && boolValue !== null && boolValue
|
28
|
+
if (boolValue !== '' && boolValue !== null && angular.isDefined(boolValue)) {
|
29
29
|
return (boolValue === true) ? yesValue : noValue;
|
30
|
-
} else {
|
31
|
-
return "";
|
32
30
|
}
|
31
|
+
|
32
|
+
return "";
|
33
33
|
};
|
34
34
|
}]);
|
@@ -16,16 +16,9 @@ angular.module('Bastion.components').directive('nutupaneTable', ['$compile', '$w
|
|
16
16
|
var originalTable, clonedTable, clonedThs,
|
17
17
|
windowElement = angular.element($window);
|
18
18
|
|
19
|
-
scope.$on("$stateChangeSuccess", function (event, newState, newParams, oldState) {
|
20
|
-
// Only clone the table if the collapsed value changed or it's the first time.
|
21
|
-
if (newState.collapsed !== oldState.collapsed || !oldState.name) {
|
22
|
-
buildTable();
|
23
|
-
} else {
|
24
|
-
element.find("table:not(.cloned-nutupane-table)").find('thead').hide();
|
25
|
-
}
|
26
|
-
});
|
27
|
-
|
28
19
|
function buildTable() {
|
20
|
+
var rowSelect;
|
21
|
+
|
29
22
|
element.find('.cloned-nutupane-table').remove();
|
30
23
|
|
31
24
|
originalTable = element.find('table');
|
@@ -42,7 +35,7 @@ angular.module('Bastion.components').directive('nutupaneTable', ['$compile', '$w
|
|
42
35
|
$compile(element.find('.cloned-nutupane-table'))(scope);
|
43
36
|
|
44
37
|
// Need to remove duplicate row-select created by second $compile
|
45
|
-
|
38
|
+
rowSelect = element.find(".row-select")[0];
|
46
39
|
if (rowSelect) {
|
47
40
|
angular.element(rowSelect).remove();
|
48
41
|
}
|
@@ -69,6 +62,15 @@ angular.module('Bastion.components').directive('nutupaneTable', ['$compile', '$w
|
|
69
62
|
});
|
70
63
|
}
|
71
64
|
|
65
|
+
scope.$on("$stateChangeSuccess", function (event, newState, newParams, oldState) {
|
66
|
+
// Only clone the table if the collapsed value changed or it's the first time.
|
67
|
+
if (newState.collapsed !== oldState.collapsed || !oldState.name) {
|
68
|
+
buildTable();
|
69
|
+
} else {
|
70
|
+
element.find("table:not(.cloned-nutupane-table)").find('thead').hide();
|
71
|
+
}
|
72
|
+
});
|
73
|
+
|
72
74
|
buildTable();
|
73
75
|
}
|
74
76
|
};
|
@@ -116,10 +116,11 @@ angular.module('Bastion.components').factory('Nutupane',
|
|
116
116
|
};
|
117
117
|
|
118
118
|
self.table.autocomplete = function (term) {
|
119
|
-
var data, promise,
|
119
|
+
var data, promise, localParams;
|
120
|
+
|
120
121
|
if (resource.autocomplete) {
|
121
|
-
|
122
|
-
|
122
|
+
localParams = self.getParams();
|
123
|
+
localParams.search = term;
|
123
124
|
data = resource.autocomplete(params);
|
124
125
|
} else {
|
125
126
|
data = self.table.fetchAutocomplete(term);
|
@@ -127,13 +128,12 @@ angular.module('Bastion.components').factory('Nutupane',
|
|
127
128
|
|
128
129
|
promise = data.$promise;
|
129
130
|
if (promise) {
|
130
|
-
return promise.then(function (
|
131
|
-
return self.table.transformScopedSearch(
|
131
|
+
return promise.then(function (response) {
|
132
|
+
return self.table.transformScopedSearch(response);
|
132
133
|
});
|
133
134
|
}
|
134
|
-
|
135
|
-
|
136
|
-
}
|
135
|
+
|
136
|
+
return data;
|
137
137
|
};
|
138
138
|
|
139
139
|
self.table.transformScopedSearch = function (results) {
|
@@ -292,7 +292,7 @@ angular.module('Bastion.components').factory('Nutupane',
|
|
292
292
|
self.table.nextPage = function () {
|
293
293
|
var table = self.table;
|
294
294
|
if (table.working || !table.hasMore()) {
|
295
|
-
return;
|
295
|
+
return false;
|
296
296
|
}
|
297
297
|
return self.query();
|
298
298
|
};
|
@@ -300,12 +300,13 @@ angular.module('Bastion.components').factory('Nutupane',
|
|
300
300
|
self.table.hasMore = function () {
|
301
301
|
var length = self.table.rows.length,
|
302
302
|
subtotal = self.table.resource.subtotal,
|
303
|
-
hasMore = false
|
303
|
+
hasMore = false,
|
304
|
+
justBegun;
|
304
305
|
|
305
306
|
if (!subtotal) {
|
306
307
|
hasMore = false;
|
307
308
|
} else {
|
308
|
-
|
309
|
+
justBegun = (length === 0 && subtotal !== 0);
|
309
310
|
hasMore = (length < subtotal) || justBegun;
|
310
311
|
}
|
311
312
|
return hasMore;
|
@@ -33,18 +33,20 @@ angular.module('Bastion.components').directive('pageTitle', ['PageTitle', functi
|
|
33
33
|
var title;
|
34
34
|
|
35
35
|
return function (scope, iElem, iAttrs, ngModel) {
|
36
|
+
var unbind;
|
37
|
+
|
36
38
|
transclude(scope, function (clone) {
|
37
39
|
title = clone.text();
|
38
40
|
});
|
39
41
|
|
40
42
|
if (ngModel) {
|
41
|
-
|
43
|
+
unbind = scope.$watch(function () {
|
42
44
|
return ngModel.$viewValue;
|
43
45
|
}, function (model) {
|
44
46
|
unbind();
|
45
47
|
if (model.hasOwnProperty('$promise')) {
|
46
|
-
model.$promise.then(function (
|
47
|
-
scope[scope.modelName] =
|
48
|
+
model.$promise.then(function (data) {
|
49
|
+
scope[scope.modelName] = data;
|
48
50
|
PageTitle.setTitle(title, scope);
|
49
51
|
});
|
50
52
|
} else {
|
@@ -26,8 +26,10 @@ angular.module('Bastion.components').service('PageTitle', ['$window', '$interpol
|
|
26
26
|
this.titles = [];
|
27
27
|
|
28
28
|
this.setTitle = function (title, locals) {
|
29
|
+
var interpolated;
|
30
|
+
|
29
31
|
if (title) {
|
30
|
-
|
32
|
+
interpolated = $interpolate(title);
|
31
33
|
|
32
34
|
$window.document.title = interpolated(locals);
|
33
35
|
this.titles.push($window.document.title);
|
@@ -36,7 +36,32 @@ angular.module('Bastion.components').directive('pathSelector',
|
|
36
36
|
templateUrl: 'components/views/path-selector.html',
|
37
37
|
link: function (scope, element, attrs, ngModel) {
|
38
38
|
var activeItemId, convertPathObjects, selectionRequired;
|
39
|
-
selectionRequired = attrs
|
39
|
+
selectionRequired = attrs.selectionRequired ? attrs.selectionRequired === 'true' : true;
|
40
|
+
|
41
|
+
function forEachItem(callback) {
|
42
|
+
angular.forEach(scope.paths, function (path) {
|
43
|
+
angular.forEach(path, function (item) {
|
44
|
+
callback(item);
|
45
|
+
});
|
46
|
+
});
|
47
|
+
}
|
48
|
+
|
49
|
+
function selectById(id) {
|
50
|
+
forEachItem(function (item) {
|
51
|
+
if (item.id === id) {
|
52
|
+
ngModel.$setViewValue(item);
|
53
|
+
item.selected = true;
|
54
|
+
}
|
55
|
+
});
|
56
|
+
}
|
57
|
+
|
58
|
+
function unselectActive() {
|
59
|
+
forEachItem(function (item) {
|
60
|
+
if (item.id === activeItemId) {
|
61
|
+
item.selected = false;
|
62
|
+
}
|
63
|
+
});
|
64
|
+
}
|
40
65
|
|
41
66
|
scope.itemChanged = function (item) {
|
42
67
|
if (item && scope.mode === 'singleSelect') {
|
@@ -52,7 +77,7 @@ angular.module('Bastion.components').directive('pathSelector',
|
|
52
77
|
|
53
78
|
convertPathObjects = function (paths) {
|
54
79
|
if (scope.pathAttribute) {
|
55
|
-
paths =
|
80
|
+
paths = _.pluck(paths, scope.pathAttribute);
|
56
81
|
}
|
57
82
|
return paths;
|
58
83
|
};
|
@@ -79,31 +104,6 @@ angular.module('Bastion.components').directive('pathSelector',
|
|
79
104
|
item.disabled = disable;
|
80
105
|
});
|
81
106
|
});
|
82
|
-
|
83
|
-
function selectById(id) {
|
84
|
-
forEachItem(function (item) {
|
85
|
-
if (item.id === id) {
|
86
|
-
ngModel.$setViewValue(item);
|
87
|
-
item.selected = true;
|
88
|
-
}
|
89
|
-
});
|
90
|
-
}
|
91
|
-
|
92
|
-
function unselectActive() {
|
93
|
-
forEachItem(function (item) {
|
94
|
-
if (item.id === activeItemId) {
|
95
|
-
item.selected = false;
|
96
|
-
}
|
97
|
-
});
|
98
|
-
}
|
99
|
-
|
100
|
-
function forEachItem(callback) {
|
101
|
-
angular.forEach(scope.paths, function (path) {
|
102
|
-
angular.forEach(path, function (item) {
|
103
|
-
callback(item);
|
104
|
-
});
|
105
|
-
});
|
106
|
-
}
|
107
107
|
}
|
108
108
|
};
|
109
109
|
});
|
@@ -30,10 +30,9 @@ angular.module('Bastion.components').directive('typeaheadEmpty', function () {
|
|
30
30
|
require: 'ngModel',
|
31
31
|
link: function (scope, element, attrs, modelCtrl) {
|
32
32
|
element.bind('focus', function () {
|
33
|
-
if (modelCtrl.$viewValue
|
33
|
+
if (angular.isUndefined(modelCtrl.$viewValue) || modelCtrl.$viewValue === '') {
|
34
34
|
modelCtrl.$setViewValue(' ');
|
35
|
-
}
|
36
|
-
else {
|
35
|
+
} else {
|
37
36
|
modelCtrl.$setViewValue(modelCtrl.$viewValue);
|
38
37
|
}
|
39
38
|
});
|
@@ -48,7 +48,7 @@
|
|
48
48
|
* @returns {Boolean}
|
49
49
|
*/
|
50
50
|
this.featureEnabled = function (flag) {
|
51
|
-
return (featureFlags[flag]
|
51
|
+
return angular.isUndefined(featureFlags[flag]) ? true : featureFlags[flag].enabled;
|
52
52
|
};
|
53
53
|
|
54
54
|
/**
|
@@ -83,9 +83,9 @@
|
|
83
83
|
this.addStates = function (feature, states) {
|
84
84
|
feature = featureFlags[feature];
|
85
85
|
|
86
|
-
if (feature
|
86
|
+
if (angular.isUndefined(feature)) {
|
87
87
|
feature = {states: []};
|
88
|
-
} else if (
|
88
|
+
} else if (angular.isUndefined(undefined)) {
|
89
89
|
feature.states = [];
|
90
90
|
}
|
91
91
|
|
@@ -34,9 +34,9 @@ angular.module('Bastion.menu').service('MenuExpander', [function () {
|
|
34
34
|
this.getMenu = function (menuName) {
|
35
35
|
if (this.menu.hasOwnProperty(menuName)) {
|
36
36
|
return this.menu[menuName];
|
37
|
-
} else {
|
38
|
-
return [];
|
39
37
|
}
|
38
|
+
|
39
|
+
return [];
|
40
40
|
};
|
41
41
|
|
42
42
|
this.setMenu = function (menuName, items) {
|
data/bastion.js
CHANGED
@@ -4,6 +4,7 @@ module.exports = function (grunt) {
|
|
4
4
|
var configs = requireDir('./grunt');
|
5
5
|
|
6
6
|
grunt.loadTasks(__dirname + '/node_modules/grunt-contrib-jshint/tasks');
|
7
|
+
grunt.loadTasks(__dirname + '/node_modules/grunt-eslint/tasks');
|
7
8
|
grunt.loadTasks(__dirname + '/node_modules/grunt-htmlhint/tasks');
|
8
9
|
grunt.loadTasks(__dirname + '/node_modules/grunt-bower-task/tasks');
|
9
10
|
grunt.loadTasks(__dirname + '/node_modules/grunt-karma/tasks');
|
data/grunt/eslint.js
ADDED
data/lib/bastion/version.rb
CHANGED
data/package.json
CHANGED
@@ -15,7 +15,10 @@
|
|
15
15
|
"grunt-htmlhint": "~0.4.1",
|
16
16
|
"grunt-concurrent": "~1.0.0",
|
17
17
|
"generator-bastion": "~0.1.2",
|
18
|
-
"grunt-angular-gettext": "~0.2.15"
|
18
|
+
"grunt-angular-gettext": "~0.2.15",
|
19
|
+
"grunt-eslint": "~6.0.0",
|
20
|
+
"eslint": "~0.14.1",
|
21
|
+
"eslint-plugin-angular": "0.0.3"
|
19
22
|
},
|
20
23
|
"engines": {
|
21
24
|
"node": ">=0.8.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bastion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katello
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: angular-rails-templates
|
@@ -159,6 +159,7 @@ files:
|
|
159
159
|
- config/routes.rb
|
160
160
|
- config/routes/mount_engine.rb
|
161
161
|
- grunt/bower.js
|
162
|
+
- grunt/eslint.js
|
162
163
|
- grunt/htmlhint.js
|
163
164
|
- grunt/jshint.js
|
164
165
|
- grunt/karma.js
|