blinkr 0.3.6 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/blinkr/report.html.slim +55 -18
- data/lib/blinkr/report.rb +12 -1
- data/lib/blinkr/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54dd678842389391ab5a75a1c3b24fc1498e4c34
|
4
|
+
data.tar.gz: c69c3d35db9d2198ded5eeea890bac39151d4eec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60ec55073e024c042f2bb2981b779d915edffe746460f8e3715f7ff664e187f41a1924b2f2e79b49e95a4758ce32f4420027d208945356413e7975628fa5a03f
|
7
|
+
data.tar.gz: 42df2a58c03eaa041bfd887c13fb7271166b67c0311c52bfb74988a8ccb6a6d92ab6ccb7512334f7b0d3ef4a819652d8a1972e18143d0bc209c6ca55002d696b
|
data/lib/blinkr/report.html.slim
CHANGED
@@ -2,8 +2,19 @@ doctype html
|
|
2
2
|
html[ng-app="blinkr"]
|
3
3
|
head
|
4
4
|
meta[http-equiv="Content-Type" content="text/html; charset=UTF-8"]
|
5
|
-
link[href="http://maxcdn.bootstrapcdn.com/bootstrap/3.
|
5
|
+
link[href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"]
|
6
6
|
link[href="http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet"]
|
7
|
+
script[src="https://code.jquery.com/jquery-2.1.4.js"]
|
8
|
+
script[src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.js"]
|
9
|
+
script[src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.js"]
|
10
|
+
/script[src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"]
|
11
|
+
/script[src="https://code.jquery.com/jquery-2.1.4.min.js"]
|
12
|
+
/script[src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"]
|
13
|
+
|
14
|
+
/script[src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.13.4/ui-bootstrap.min.js"]
|
15
|
+
/script[src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.13.4/ui-bootstrap.js"]
|
16
|
+
/script[src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.13.4/ui-bootstrap-tpls.min.js"]
|
17
|
+
/script[src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.13.4/ui-bootstrap-tpls.js"]
|
7
18
|
title
|
8
19
|
| Blinkr
|
9
20
|
meta[content="width=device-width, initial-scale=1" name="viewport"]
|
@@ -73,7 +84,14 @@ html[ng-app="blinkr"]
|
|
73
84
|
| {{key}}
|
74
85
|
.label.label-default
|
75
86
|
| {{value.count}}
|
76
|
-
.
|
87
|
+
.text-center
|
88
|
+
button.btn.btn-default.btn-lg[ng-disabled="currentPage == 0" ng-click="currentPage = currentPage - 1"] Previous
|
89
|
+
'
|
90
|
+
{{currentPage + 1}} / {{numberOfPages()}}
|
91
|
+
button.btn.btn-default.btn-lg[ng-disabled="currentPage >= numberOfPages() - 1" ng-click="currentPage = currentPage + 1"] Next
|
92
|
+
br
|
93
|
+
br
|
94
|
+
.page[ng-repeat="page in report.pages | showPage:filters | startFrom:currentPage * limitSize | limitTo:limitSize"]
|
77
95
|
div[class="panel panel-{{page.max_severity}}"]
|
78
96
|
.panel-heading
|
79
97
|
.panel-title
|
@@ -81,12 +99,12 @@ html[ng-app="blinkr"]
|
|
81
99
|
li
|
82
100
|
a>[data-toggle="collapse" href="#"]
|
83
101
|
i.fa.fa-caret-square-o-right
|
84
|
-
| {{url}} ({{page.errors.length}} total errors)
|
102
|
+
| {{page.url}} ({{page.errors.length}} total errors)
|
85
103
|
li
|
86
|
-
a[href="{{url}}" target="_blank"]
|
104
|
+
a[href="{{page.url}}" target="_blank"]
|
87
105
|
i.fa.fa-external-link
|
88
106
|
li
|
89
|
-
a[href="{{url}}" target="_blank"]
|
107
|
+
a[href="{{page.url}}" target="_blank"]
|
90
108
|
i.fa.fa-file-code-o
|
91
109
|
.panel-body.collapse.panel-collapse
|
92
110
|
ul
|
@@ -96,13 +114,10 @@ html[ng-app="blinkr"]
|
|
96
114
|
| {{page_error.code}} {{page_error.message}}
|
97
115
|
div
|
98
116
|
' {{page_error.title}}
|
99
|
-
a[href="{{page_error.title}}" target="_blank"]
|
117
|
+
a[href="{{page_error.title}}" target="_blank" ng-if="page_error.title.startsWith('http')"]
|
100
118
|
i.fa.fa-external-link
|
101
119
|
pre
|
102
120
|
| {{page_error.snippet}}
|
103
|
-
script[src="http://code.jquery.com/jquery-2.1.4.min.js"]
|
104
|
-
script[src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"]
|
105
|
-
script[src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"]
|
106
121
|
javascript:
|
107
122
|
var blinkr = angular.module('blinkr', []);
|
108
123
|
blinkr.factory('report', function reportFactory() {
|
@@ -113,7 +128,10 @@ html[ng-app="blinkr"]
|
|
113
128
|
$scope.report = report;
|
114
129
|
$scope.filters = {severities: {}, categories: {}, types: {}};
|
115
130
|
$scope.report = report;
|
116
|
-
$scope.numPages =
|
131
|
+
$scope.numPages = report.pages.length;
|
132
|
+
$scope.filteredNumPages = 0;
|
133
|
+
$scope.currentPage = 0;
|
134
|
+
$scope.limitSize = 25;
|
117
135
|
window.scope = $scope;
|
118
136
|
|
119
137
|
Object.keys($scope.report.severity).forEach(function (s) {
|
@@ -127,8 +145,19 @@ html[ng-app="blinkr"]
|
|
127
145
|
Object.keys($scope.report.type).forEach(function (t) {
|
128
146
|
$scope.filters.types[t] = {enabled: false, count: report.type[t].count};
|
129
147
|
});
|
148
|
+
|
149
|
+
$scope.numberOfPages = function () {
|
150
|
+
return Math.ceil($scope.filteredNumPages / $scope.limitSize);
|
151
|
+
}
|
130
152
|
}]);
|
131
153
|
|
154
|
+
blinkr.filter('startFrom', function () {
|
155
|
+
return function (input, start) {
|
156
|
+
start = +start; //parse to int
|
157
|
+
return input.slice(start);
|
158
|
+
}
|
159
|
+
});
|
160
|
+
|
132
161
|
blinkr.filter('displayError', function () {
|
133
162
|
return function (errors, filters) {
|
134
163
|
var returned_errors = [];
|
@@ -144,15 +173,17 @@ html[ng-app="blinkr"]
|
|
144
173
|
|
145
174
|
blinkr.filter('showPage', function () {
|
146
175
|
return function (all_pages, filters) {
|
147
|
-
var pages =
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
176
|
+
var pages = [];
|
177
|
+
all_pages.forEach(function (page) {
|
178
|
+
if ($.arrayIntersect(enabledFilters(filters, 'categories'), page.categories).length > 0) {
|
179
|
+
pages.push(page);
|
180
|
+
} else if ($.arrayIntersect(enabledFilters(filters, 'types'), page.types).length > 0) {
|
181
|
+
pages.push(page);
|
182
|
+
} else if ($.arrayIntersect(enabledFilters(filters, 'severities'), page.severities).length > 0) {
|
183
|
+
pages.push(page);
|
184
|
+
}
|
155
185
|
});
|
186
|
+
scope.filteredNumPages = pages.length;
|
156
187
|
return pages;
|
157
188
|
}
|
158
189
|
});
|
@@ -212,3 +243,9 @@ html[ng-app="blinkr"]
|
|
212
243
|
angular.element(document).ready(function () {
|
213
244
|
panelBind();
|
214
245
|
});
|
246
|
+
|
247
|
+
$.arrayIntersect = function (a, b) {
|
248
|
+
return $.grep(a, function (i) {
|
249
|
+
return $.inArray(i, b) > -1;
|
250
|
+
});
|
251
|
+
};
|
data/lib/blinkr/report.rb
CHANGED
@@ -22,21 +22,32 @@ module Blinkr
|
|
22
22
|
@context.severity = {}
|
23
23
|
@context.category = {}
|
24
24
|
@context.type = {}
|
25
|
-
@context.pages.each do |
|
25
|
+
@context.pages.each do |url, page|
|
26
|
+
page.url = url
|
26
27
|
page.max_severity = ::Blinkr::SEVERITY.first # :success
|
28
|
+
page.severities = []
|
29
|
+
page.categories = []
|
30
|
+
page.types = []
|
27
31
|
page.errors.each do |error|
|
28
32
|
raise "#{error.severity} not a valid severity. Must be one of #{::Blinkr::SEVERITY.join(',')}" unless ::Blinkr::SEVERITY.include? error.severity
|
29
33
|
raise "#{error.category} must be specified." if error.category.nil?
|
30
34
|
@context.total += 1
|
31
35
|
@context.severity[error.severity] ||= OpenStruct.new({:count => 0})
|
32
36
|
@context.severity[error.severity].count += 1
|
37
|
+
page.severities << error.severity
|
33
38
|
page.max_severity = error.severity if ::Blinkr::SEVERITY.index(error.severity) > ::Blinkr::SEVERITY.index(page.max_severity)
|
34
39
|
@context.category[error.category] ||= OpenStruct.new({:count => 0})
|
35
40
|
@context.category[error.category].count += 1
|
41
|
+
page.categories << error.category
|
36
42
|
@context.type[error.type] ||= OpenStruct.new({:count => 0})
|
37
43
|
@context.type[error.type].count += 1
|
44
|
+
page.types << error.type
|
38
45
|
end
|
46
|
+
page.severities.uniq!
|
47
|
+
page.categories.uniq!
|
48
|
+
page.types.uniq!
|
39
49
|
end
|
50
|
+
@context.pages = @context.pages.values
|
40
51
|
File.open(@config.report, 'w') do |file|
|
41
52
|
file.write(Slim::Template.new(TMPL).render(OpenStruct.new({:blinkr => @context, :engine => @engine,
|
42
53
|
:errors => @context.to_json})))
|
data/lib/blinkr/version.rb
CHANGED