sw2at-ui 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/VERSION +1 -1
- data/app/assets/javascripts/swat/app/app.coffee +1 -0
- data/app/assets/javascripts/swat/app/controllers/revision.coffee +1 -0
- data/app/assets/javascripts/swat/app/controllers/revisions.coffee +3 -0
- data/app/assets/javascripts/swat/app/controllers/summary.coffee +3 -2
- data/app/assets/javascripts/swat/app/directives/revision_name.coffee +27 -0
- data/app/assets/javascripts/swat/app/services/revision.coffee +7 -2
- data/app/assets/stylesheets/swat/application.scss +3 -30
- data/app/assets/stylesheets/swat/header.scss +102 -0
- data/app/assets/stylesheets/swat/swat_theme.scss +34 -3
- data/app/controllers/swat/api/revisions_controller.rb +8 -1
- data/app/models/full_revision.rb +2 -2
- data/app/models/revision_status_calculator.rb +32 -7
- data/app/views/swat/pages/revisions/index.slim +1 -1
- data/app/views/swat/pages/revisions/name.slim +3 -0
- data/app/views/swat/pages/revisions/partials/_exceptions.slim +6 -2
- data/app/views/swat/pages/revisions/partials/_test_cases.slim +6 -2
- data/app/views/swat/pages/revisions/show.slim +3 -3
- data/app/views/swat/pages/revisions/summary.slim +3 -3
- data/app/views/swat/shared/_header.slim +5 -6
- data/config/routes.rb +2 -1
- data/lib/swat/engine.rb +2 -1
- data/lib/swat/ui/rspec_commands.rb +1 -1
- data/spec/models/calculator_spec.rb +49 -10
- data/spec/models/full_revision_spec.rb +1 -0
- data/sw2at-ui.gemspec +11 -5
- metadata +20 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3612cda6f489c48a3170bd5bb707fe0ca831f8b
|
4
|
+
data.tar.gz: c6d5a8639b2c725d93fbe8f0978755f770587ca8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bab12debf2d4514d6bc6a4637c23bfc34574c4626c43ea8dd9f50b15fe2beed7ce1fdc5deed111d724564ca3ee5e0a94816994fcc036beecd0588ffff94577c9
|
7
|
+
data.tar.gz: 2a5b81b6a3c0c541a4211bbef0ba6ef76cd74fc7bbe828837227722ace098219f0bb7ab836c60e44bae954bedfda50055a48fc503e3f16d184ae3f21ca48a68c
|
data/Gemfile
CHANGED
@@ -2,12 +2,13 @@ source 'http://rubygems.org'
|
|
2
2
|
|
3
3
|
gem 'rails', '>= 3.1'
|
4
4
|
|
5
|
-
gem 'fire-model', '~> 0.0.
|
5
|
+
gem 'fire-model', '~> 0.0.18'
|
6
6
|
gem 'slim-rails'
|
7
7
|
gem 'sass-rails'
|
8
8
|
gem 'coffee-rails'
|
9
9
|
gem 'bootstrap-sass'
|
10
10
|
gem 'tarvit-helpers'
|
11
|
+
gem 'time_difference'
|
11
12
|
|
12
13
|
group :development do
|
13
14
|
gem 'shoulda', '>= 0'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.11
|
@@ -4,6 +4,7 @@ angular.module("SWAT").controller "RevisionCtrl", ($rootScope, $scope, $state, $
|
|
4
4
|
$scope.init = ->
|
5
5
|
$scope.reloadData()
|
6
6
|
|
7
|
+
|
7
8
|
$scope.reloadData = ->
|
8
9
|
return if $scope.revisionPromise && !$scope.revisionPromise.$resolved
|
9
10
|
params = { branch: $stateParams.branch, user: $stateParams.user, time: $stateParams.time }
|
@@ -40,8 +40,6 @@ angular.module("SWAT").controller "SummaryCtrl", ($rootScope, $scope, $state, $s
|
|
40
40
|
|
41
41
|
$scope.initFailsStatsGraph = ->
|
42
42
|
$scope.failsStats = new FailsGraph($scope.tests, $scope.summary.fails)
|
43
|
-
return
|
44
|
-
$scope.failsStats =1
|
45
43
|
|
46
44
|
$scope.initMetrics = ->
|
47
45
|
result = []
|
@@ -67,6 +65,9 @@ angular.module("SWAT").controller "SummaryCtrl", ($rootScope, $scope, $state, $s
|
|
67
65
|
|
68
66
|
$scope.summary.metrics = result
|
69
67
|
|
68
|
+
$scope.isSpecTraceLine = (line)->
|
69
|
+
_.include(line, 'spec')
|
70
|
+
|
70
71
|
$scope.init()
|
71
72
|
|
72
73
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
angular.module("SWAT").directive "revisionName", ($document, RevisionService)->
|
2
|
+
restrict: 'AE'
|
3
|
+
replace: true
|
4
|
+
templateUrl: '/swat/pages/revisions/name.html'
|
5
|
+
scope:
|
6
|
+
revision: '='
|
7
|
+
|
8
|
+
controller: ($scope, $attrs, $timeout)->
|
9
|
+
$scope.init = ->
|
10
|
+
$scope.id = ('revision-name-'+$scope.revision.data.time+Math.floor(Math.random()*1000))
|
11
|
+
$scope.name = ($scope.revision.data.name || $scope.revision.data.time)
|
12
|
+
|
13
|
+
$scope.delayedSave = ->
|
14
|
+
$timeout($scope.save, 0)
|
15
|
+
|
16
|
+
$scope.save = ->
|
17
|
+
value = angular.element('#'+$scope.id).text()
|
18
|
+
window.Swat.log(value)
|
19
|
+
|
20
|
+
return if value == $scope.name
|
21
|
+
params = { branch: $scope.revision.data.branch, user: $scope.revision.data.user, time: $scope.revision.data.time, name: value }
|
22
|
+
RevisionService.setName(params).$promise.then((resp)->
|
23
|
+
window.Swat.log(resp)
|
24
|
+
$scope.name = value
|
25
|
+
)
|
26
|
+
|
27
|
+
$scope.init()
|
@@ -1,6 +1,6 @@
|
|
1
|
-
angular.module("SWAT").factory "RevisionService", ($resource, RevisionModelFactory) ->
|
1
|
+
angular.module("SWAT").factory "RevisionService", ($resource, GlResponse, RevisionModelFactory) ->
|
2
2
|
|
3
|
-
$resource "/swat/api/revisions", { id: "@id", branch: '@branch', user: '@user', time: '@time' },
|
3
|
+
$resource "/swat/api/revisions", { id: "@id", branch: '@branch', user: '@user', time: '@time', name: '@name' },
|
4
4
|
query:
|
5
5
|
method: 'GET'
|
6
6
|
isArray: true
|
@@ -11,6 +11,11 @@ angular.module("SWAT").factory "RevisionService", ($resource, RevisionModelFacto
|
|
11
11
|
method: 'GET'
|
12
12
|
transformResponse: RevisionModelFactory
|
13
13
|
|
14
|
+
setName:
|
15
|
+
url: '/swat/api/revision/name/:name'
|
16
|
+
method: 'PUT'
|
17
|
+
transformResponse: GlResponse
|
18
|
+
|
14
19
|
|
15
20
|
|
16
21
|
|
@@ -8,39 +8,12 @@ $greenMain: greenyellow;
|
|
8
8
|
|
9
9
|
#swat {
|
10
10
|
font-size: 13px;
|
11
|
-
|
12
|
-
|
13
|
-
padding: 12px;
|
14
|
-
a {
|
15
|
-
color: $greenMain;
|
16
|
-
&:hover {
|
17
|
-
text-decoration: none;
|
18
|
-
}
|
19
|
-
}
|
20
|
-
.label {
|
21
|
-
width: 100%;
|
22
|
-
float: left;
|
23
|
-
font-size: 12px;
|
24
|
-
color: $greenMain;
|
25
|
-
}
|
26
|
-
&:hover .label {
|
27
|
-
display: inline !important;
|
28
|
-
}
|
29
|
-
}
|
11
|
+
|
12
|
+
|
30
13
|
h1, h2, h3 {
|
31
14
|
text-align: center;
|
32
15
|
}
|
33
|
-
|
34
|
-
background-color: black;
|
35
|
-
color: white;
|
36
|
-
h2 {
|
37
|
-
color: $greenMain;
|
38
|
-
text-align: center;
|
39
|
-
sub {
|
40
|
-
font-size: 12px;
|
41
|
-
}
|
42
|
-
}
|
43
|
-
}
|
16
|
+
|
44
17
|
#subheader {
|
45
18
|
h3 {
|
46
19
|
margin: 5px;
|
@@ -0,0 +1,102 @@
|
|
1
|
+
#swat {
|
2
|
+
$greenMain: greenyellow;
|
3
|
+
|
4
|
+
header {
|
5
|
+
background-color: black;
|
6
|
+
color: white;
|
7
|
+
h2 {
|
8
|
+
color: $greenMain;
|
9
|
+
text-align: center;
|
10
|
+
margin: 6px 0px 0px 0px;
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
#header-label {
|
15
|
+
margin-top: 0;
|
16
|
+
padding: 12px;
|
17
|
+
|
18
|
+
a {
|
19
|
+
color: $greenMain;
|
20
|
+
&:hover {
|
21
|
+
text-decoration: none;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
.header-label {
|
26
|
+
a {
|
27
|
+
display: inline-block;
|
28
|
+
}
|
29
|
+
.S, .W, .to, .A, .T {
|
30
|
+
overflow: hidden;
|
31
|
+
display: inline-block;
|
32
|
+
transition: width 0.1s linear;
|
33
|
+
}
|
34
|
+
|
35
|
+
.S {
|
36
|
+
width: 20px;
|
37
|
+
&:after {
|
38
|
+
content: 'S'
|
39
|
+
}
|
40
|
+
}
|
41
|
+
.W {
|
42
|
+
width: 29px;
|
43
|
+
&:after {
|
44
|
+
content: 'W'
|
45
|
+
}
|
46
|
+
}
|
47
|
+
.to {
|
48
|
+
width: 12px;
|
49
|
+
font-size: 14px;
|
50
|
+
margin-right: 3px;
|
51
|
+
&:after {
|
52
|
+
content: '2'
|
53
|
+
}
|
54
|
+
}
|
55
|
+
.A {
|
56
|
+
width: 20px;
|
57
|
+
&:after {
|
58
|
+
content: 'A'
|
59
|
+
}
|
60
|
+
}
|
61
|
+
.T {
|
62
|
+
width: 20px;
|
63
|
+
&:after {
|
64
|
+
content: 'T'
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
.header-label a:hover {
|
69
|
+
.S {
|
70
|
+
width: 100px;
|
71
|
+
&:after {
|
72
|
+
content: 'Simple'
|
73
|
+
}
|
74
|
+
}
|
75
|
+
.W {
|
76
|
+
width: 70px;
|
77
|
+
&:after {
|
78
|
+
content: 'Way'
|
79
|
+
}
|
80
|
+
}
|
81
|
+
.to {
|
82
|
+
width: 31px;
|
83
|
+
font-size: 30px;
|
84
|
+
&:after {
|
85
|
+
content: 'to'
|
86
|
+
}
|
87
|
+
}
|
88
|
+
.A {
|
89
|
+
width: 140px;
|
90
|
+
&:after {
|
91
|
+
content: 'Automate'
|
92
|
+
}
|
93
|
+
}
|
94
|
+
.T {
|
95
|
+
width: 83px;
|
96
|
+
&:after {
|
97
|
+
content: 'Tests'
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}
|
102
|
+
}
|
@@ -13,20 +13,36 @@ html, body {
|
|
13
13
|
#swat {
|
14
14
|
height: 100%;
|
15
15
|
min-height: 100%;
|
16
|
+
|
16
17
|
#container {
|
17
18
|
|
18
19
|
.has-status {
|
19
20
|
|
20
|
-
&.in_progress_failed
|
21
|
+
&.in_progress_failed {
|
22
|
+
color: rgb(242, 40, 77);
|
23
|
+
background: #F2FFBA;
|
24
|
+
}
|
25
|
+
|
26
|
+
&.in_progress_success {
|
27
|
+
color: rgb(59, 153, 78);
|
28
|
+
background: #F2FFBA;
|
29
|
+
}
|
30
|
+
|
31
|
+
&.completed_failed {
|
21
32
|
color: rgb(242, 40, 77);
|
22
33
|
background: rgba(252, 226, 222, 0.49);
|
23
34
|
}
|
24
35
|
|
25
|
-
&.
|
36
|
+
&.completed_passed {
|
26
37
|
color: rgb(59, 153, 78);
|
27
38
|
background: rgba(134, 252, 148, 0.49);
|
28
39
|
}
|
29
40
|
|
41
|
+
&.terminated {
|
42
|
+
color: rgba(78, 73, 71, 0.68);
|
43
|
+
background: rgba(205, 202, 201, 0.36);
|
44
|
+
}
|
45
|
+
|
30
46
|
}
|
31
47
|
|
32
48
|
|
@@ -116,9 +132,10 @@ html, body {
|
|
116
132
|
#exceptions-groups {
|
117
133
|
.failed-tests {
|
118
134
|
.test-case {
|
119
|
-
color:
|
135
|
+
color: #3F3F3F;
|
120
136
|
margin-top: 3px;
|
121
137
|
}
|
138
|
+
|
122
139
|
}
|
123
140
|
}
|
124
141
|
|
@@ -127,6 +144,7 @@ html, body {
|
|
127
144
|
margin: 0;
|
128
145
|
padding-right: 50px;
|
129
146
|
padding-top: 8px;
|
147
|
+
min-height: 45px;
|
130
148
|
}
|
131
149
|
.list {
|
132
150
|
padding: 13px;
|
@@ -162,6 +180,9 @@ html, body {
|
|
162
180
|
&.exception {
|
163
181
|
width: 400px;
|
164
182
|
}
|
183
|
+
&.thread {
|
184
|
+
width: 250px;
|
185
|
+
}
|
165
186
|
}
|
166
187
|
td {
|
167
188
|
&:hover {}
|
@@ -181,7 +202,11 @@ html, body {
|
|
181
202
|
border-radius: 3px;
|
182
203
|
p {
|
183
204
|
margin-bottom: 0;
|
205
|
+
&.spec {
|
206
|
+
color: #ff5860;
|
207
|
+
}
|
184
208
|
}
|
209
|
+
|
185
210
|
}
|
186
211
|
}
|
187
212
|
}
|
@@ -233,6 +258,12 @@ html, body {
|
|
233
258
|
}
|
234
259
|
}
|
235
260
|
}
|
261
|
+
|
262
|
+
.revision-name-content {
|
263
|
+
width: auto;
|
264
|
+
display: inline-block;
|
265
|
+
}
|
266
|
+
|
236
267
|
}
|
237
268
|
.push {
|
238
269
|
height: $footerSize;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Swat
|
2
2
|
module Api
|
3
3
|
class RevisionsController < Swat::ApplicationController
|
4
|
-
before_filter :parse_revision_options, only: :show
|
4
|
+
before_filter :parse_revision_options, only: [ :show, :set_name ]
|
5
5
|
|
6
6
|
|
7
7
|
def index
|
@@ -12,6 +12,12 @@ module Swat
|
|
12
12
|
render json: FullRevision.revision_json(@options)
|
13
13
|
end
|
14
14
|
|
15
|
+
def set_name
|
16
|
+
revision = Revision.take(@options)
|
17
|
+
revision.update_field(:name, params[:name])
|
18
|
+
render json: { success: true }
|
19
|
+
end
|
20
|
+
|
15
21
|
private
|
16
22
|
|
17
23
|
def revisions
|
@@ -20,6 +26,7 @@ module Swat
|
|
20
26
|
|
21
27
|
def parse_revision_options
|
22
28
|
@options = params[:json_params] ? HashWithIndifferentAccess[JSON.parse(params[:json_params])] : params
|
29
|
+
@options[:time] = @options[:time].to_i if @options[:time]
|
23
30
|
end
|
24
31
|
|
25
32
|
end
|
data/app/models/full_revision.rb
CHANGED
@@ -68,7 +68,7 @@ class FullRevision
|
|
68
68
|
if update
|
69
69
|
update_status!(revision)
|
70
70
|
else
|
71
|
-
RevisionStatusCalulator.new
|
71
|
+
RevisionStatusCalulator.new(revision).set_status
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
@@ -77,7 +77,7 @@ class FullRevision
|
|
77
77
|
|
78
78
|
return if current_status[:completed]
|
79
79
|
|
80
|
-
new_status = RevisionStatusCalulator.new
|
80
|
+
new_status = RevisionStatusCalulator.new(revision).set_status
|
81
81
|
return if new_status[:passed] && current_status[:failed]
|
82
82
|
|
83
83
|
revision.save
|
@@ -1,6 +1,12 @@
|
|
1
1
|
class RevisionStatusCalulator
|
2
2
|
|
3
|
-
|
3
|
+
attr_reader :revision_root
|
4
|
+
|
5
|
+
def initialize(revision_root)
|
6
|
+
@revision_root = revision_root
|
7
|
+
end
|
8
|
+
|
9
|
+
def set_thread_statuses
|
4
10
|
threads = revision_root.nested_threads
|
5
11
|
(0..(revision_root.threads_count-1)).map do |index|
|
6
12
|
thread = threads.find{|t| t.thread_id == index }
|
@@ -8,14 +14,21 @@ class RevisionStatusCalulator
|
|
8
14
|
end
|
9
15
|
end
|
10
16
|
|
11
|
-
def set_status
|
12
|
-
thread_statuses = set_thread_statuses
|
17
|
+
def set_status
|
18
|
+
thread_statuses = set_thread_statuses
|
13
19
|
threads_completed = thread_statuses.all?{|ts| ts[:completed] }
|
14
20
|
|
15
21
|
completed = (thread_statuses.count == revision_root.threads_count && threads_completed )
|
16
22
|
failed = thread_statuses.any?{|ts| ts[:failed] }
|
17
23
|
|
18
|
-
revision_root.nested_status.set(status(failed, completed))
|
24
|
+
revision_root.nested_status.set(status(failed, completed, old_build?))
|
25
|
+
end
|
26
|
+
|
27
|
+
TERMINATION_TIME = 2 # days
|
28
|
+
|
29
|
+
def old_build?
|
30
|
+
diff = TimeDifference.between(Time.now.utc, Time.at(revision_root.time)).in_hours
|
31
|
+
diff >= TERMINATION_TIME
|
19
32
|
end
|
20
33
|
|
21
34
|
private
|
@@ -47,7 +60,8 @@ class RevisionStatusCalulator
|
|
47
60
|
end
|
48
61
|
|
49
62
|
def init_total_failed(thread)
|
50
|
-
|
63
|
+
tests = thread.tests || []
|
64
|
+
failed_tests = tests.select{|x|x.status == 'failed'}.count
|
51
65
|
unless thread.failed_examples
|
52
66
|
if (thread.tests||[]).count == thread.total_examples
|
53
67
|
thread.failed_examples = thread.total_failed = failed_tests
|
@@ -87,14 +101,25 @@ class RevisionStatusCalulator
|
|
87
101
|
completed: true,
|
88
102
|
failed: false,
|
89
103
|
},
|
104
|
+
terminated: {
|
105
|
+
name: 'terminated',
|
106
|
+
label: 'Terminated',
|
107
|
+
completed: true,
|
108
|
+
failed: true,
|
109
|
+
}
|
90
110
|
}
|
91
111
|
|
92
|
-
def status(failed, completed)
|
112
|
+
def status(failed, completed, old_build=false)
|
93
113
|
id = if completed
|
94
114
|
failed ? :completed_failed : :completed_passed
|
95
115
|
else
|
96
116
|
failed ? :in_progress_failed : :in_progress_success
|
97
117
|
end
|
98
|
-
STATUSES[id]
|
118
|
+
status_candidate = STATUSES[id]
|
119
|
+
|
120
|
+
return STATUSES[:terminated] if (old_build && !status_candidate[:completed])
|
121
|
+
|
122
|
+
status_candidate
|
99
123
|
end
|
124
|
+
|
100
125
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
span.loader ng-class="{ true: 'invisible' }[(revisions && revisions.$resolved)]"
|
3
3
|
h2.revisions-header Revisions
|
4
4
|
.controls
|
5
|
-
.list ng-if="revisions"
|
5
|
+
.list ng-if="revisions && (revisions.length > 0)"
|
6
6
|
table.revisions-table.table.table-bordered.table-hover
|
7
7
|
tr
|
8
8
|
th Name
|
@@ -5,6 +5,10 @@
|
|
5
5
|
th.exception Exception
|
6
6
|
th Tests
|
7
7
|
th.duration Count
|
8
|
+
tr ng-if="(summary.exceptions && summary.exceptions.length == 0)"
|
9
|
+
td colspan="4"
|
10
|
+
.cell
|
11
|
+
| No Exceptions
|
8
12
|
tr.failed ng-repeat="exception in summary.exceptions"
|
9
13
|
td title="{{ exception.message }}"
|
10
14
|
.cell
|
@@ -17,7 +21,7 @@
|
|
17
21
|
.main-info data-toggle="collapse" data-target="##{test_id}"
|
18
22
|
.test-case
|
19
23
|
strong
|
20
|
-
| {{ test.full_description }}
|
24
|
+
| {{ '#' + test.full_description }}
|
21
25
|
p
|
22
26
|
| {{ 'rspec '+test.location }}
|
23
27
|
.detailed-info.collapse id="#{test_id}"
|
@@ -25,7 +29,7 @@
|
|
25
29
|
strong
|
26
30
|
| {{ test.exception.message }}
|
27
31
|
.backtrace
|
28
|
-
p.trace-line ng-repeat="line in test.exception.backtrace track by $index"
|
32
|
+
p.trace-line class="{{ isSpecTraceLine(line) ? 'spec' : '' }}" ng-repeat="line in test.exception.backtrace track by $index"
|
29
33
|
| {{ line }}
|
30
34
|
|
31
35
|
th.count
|
@@ -2,11 +2,15 @@ table#test-cases.table.table-bordered.table-hover
|
|
2
2
|
tr
|
3
3
|
th Test
|
4
4
|
- if thread
|
5
|
-
th Thread
|
5
|
+
th.thread Thread
|
6
6
|
th.duration Duration
|
7
7
|
th.status Status
|
8
8
|
th.command Location
|
9
9
|
- test_id = '{{ "full_"+test.id }}'
|
10
|
+
tr ng-if="(#{object} && #{object}.length == 0)"
|
11
|
+
td colspan="#{ thread ? 5 : 4 }"
|
12
|
+
.cell
|
13
|
+
| No Failed Examples
|
10
14
|
tr ng-class="test.status" ng-repeat="test in #{ object }"
|
11
15
|
td title="{{ test.full_description }}"
|
12
16
|
.main-info.cell data-toggle="collapse" data-target="##{test_id}"
|
@@ -21,7 +25,7 @@ table#test-cases.table.table-bordered.table-hover
|
|
21
25
|
p.trace-line ng-repeat="line in test.exception.backtrace track by $index"
|
22
26
|
| {{ line }}
|
23
27
|
- if thread
|
24
|
-
td.thread
|
28
|
+
td.thread title="{{ test.thread_name }}"
|
25
29
|
span.cell
|
26
30
|
| {{ test.thread_name }}
|
27
31
|
td.duration
|
@@ -1,14 +1,14 @@
|
|
1
1
|
#revision-info
|
2
2
|
h1.revision
|
3
|
-
|
4
|
-
|
3
|
+
revision-name revision="revision" ng-if="(revisionPromise && revisionPromise.$resolved)"
|
4
|
+
|
5
5
|
span.revision-status ng-class="revision.data.status.name"
|
6
6
|
| {{ ' '+revision.data.status.label }}
|
7
7
|
span.loader ng-class="{ true: 'invisible' }[(revisionPromise && revisionPromise.$resolved)]"
|
8
8
|
.controls
|
9
9
|
button.btn.revisions ui-sref="revisions" title="See all revisions list"
|
10
10
|
| Go to Revisions
|
11
|
-
button.btn.revisions ui-sref="summary(revision.data)" title="See this revision summary"
|
11
|
+
button.btn.revisions ui-sref="summary(revision.data)" title="See this revision summary" ng-disabled="!revision"
|
12
12
|
| Summary
|
13
13
|
button.btn.reload ng-click="reloadData()" title="Refresh this revision"
|
14
14
|
| Refresh
|
@@ -1,14 +1,14 @@
|
|
1
1
|
#revision-info
|
2
2
|
h1.revision
|
3
|
-
|
4
|
-
|
3
|
+
revision-name revision="revision" ng-if="(revisionPromise && revisionPromise.$resolved)"
|
4
|
+
|
5
5
|
span.revision-status ng-class="revision.data.status.name"
|
6
6
|
| {{ ' '+revision.data.status.label }}
|
7
7
|
span.loader ng-class="{ true: 'invisible' }[(revisionPromise && revisionPromise.$resolved)]"
|
8
8
|
.controls
|
9
9
|
button.btn.revisions ui-sref="revisions" title="See all revisions list"
|
10
10
|
| Go to Revisions
|
11
|
-
button.btn.revisions ui-sref="revision(revision.data)" title="See this revision tests"
|
11
|
+
button.btn.revisions ui-sref="revision(revision.data)" title="See this revision tests" ng-disabled="!revision"
|
12
12
|
| Tests
|
13
13
|
button.btn.reload ng-click="reloadData()" title="Refresh this revision"
|
14
14
|
| Refresh
|
data/config/routes.rb
CHANGED
@@ -8,6 +8,7 @@ Swat::Engine.routes.draw do
|
|
8
8
|
resources :test_cases
|
9
9
|
resources :revisions
|
10
10
|
get 'revision', to: 'revisions#show'
|
11
|
+
put 'revision/name/:name', to: 'revisions#set_name'
|
11
12
|
end
|
12
13
|
|
13
14
|
# Helper Methods
|
@@ -28,7 +29,7 @@ Swat::Engine.routes.draw do
|
|
28
29
|
# Angular Pages
|
29
30
|
namespace :pages do
|
30
31
|
namespace :revisions do
|
31
|
-
pages = [ :index, :show, :summary ]
|
32
|
+
pages = [ :index, :show, :summary, :name ]
|
32
33
|
pages.each do |p|
|
33
34
|
get p, to: p
|
34
35
|
end
|
data/lib/swat/engine.rb
CHANGED
@@ -4,10 +4,49 @@ describe FullRevision do
|
|
4
4
|
|
5
5
|
context 'Calculations' do
|
6
6
|
|
7
|
-
|
7
|
+
before :each do
|
8
|
+
Fire.reset_tree!(FIREBASE_DATA)
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'Terminated Status' do
|
12
|
+
before :each do
|
13
|
+
allow_any_instance_of(RevisionStatusCalulator).to receive(:old_build?).and_return(true)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should calculate basic status (in_progress_failed)' do
|
17
|
+
rev = Revision::Root.all.first
|
18
|
+
|
19
|
+
t1 = rev.nested_threads.first
|
20
|
+
t1.failed_examples = 5
|
21
|
+
t1.save
|
22
|
+
|
23
|
+
t2 = rev.nested_threads.last
|
24
|
+
t2.failed_examples = nil
|
25
|
+
t2.save
|
26
|
+
|
27
|
+
rev = Revision::Root.all.first
|
28
|
+
|
29
|
+
ts = RevisionStatusCalulator.new(rev).set_thread_statuses
|
30
|
+
expect(ts).to eq(
|
31
|
+
[{:name=>"completed_failed",
|
32
|
+
:label=>"Failed",
|
33
|
+
:completed=>true,
|
34
|
+
:failed=>true},
|
35
|
+
{:name=>"in_progress_success",
|
36
|
+
:label=>"In Progress",
|
37
|
+
:completed=>false,
|
38
|
+
:failed=>false}]
|
39
|
+
)
|
40
|
+
status = RevisionStatusCalulator.new(rev).set_status
|
41
|
+
expect(status).to include({name: "terminated", label: "Terminated", completed: true, failed: true})
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'Statuses(without terminated)' do
|
8
47
|
|
9
48
|
before :each do
|
10
|
-
|
49
|
+
allow_any_instance_of(RevisionStatusCalulator).to receive(:old_build?).and_return(false)
|
11
50
|
end
|
12
51
|
|
13
52
|
it 'should set basic statuses' do
|
@@ -25,7 +64,7 @@ describe FullRevision do
|
|
25
64
|
it 'should calculate basic status (completed_passed)' do
|
26
65
|
rev = Revision::Root.all.first
|
27
66
|
|
28
|
-
ts = RevisionStatusCalulator.new
|
67
|
+
ts = RevisionStatusCalulator.new(rev).set_thread_statuses
|
29
68
|
expect(ts).to eq(
|
30
69
|
[{:name=>"completed_passed",
|
31
70
|
:label=>"Passed",
|
@@ -37,7 +76,7 @@ describe FullRevision do
|
|
37
76
|
:failed=>false}]
|
38
77
|
)
|
39
78
|
|
40
|
-
status = RevisionStatusCalulator.new
|
79
|
+
status = RevisionStatusCalulator.new(rev).set_status
|
41
80
|
expect(status).to include({name: "completed_passed", label: "Passed", completed: true, failed: false})
|
42
81
|
end
|
43
82
|
|
@@ -50,7 +89,7 @@ describe FullRevision do
|
|
50
89
|
|
51
90
|
rev = Revision::Root.all.first
|
52
91
|
|
53
|
-
ts = RevisionStatusCalulator.new
|
92
|
+
ts = RevisionStatusCalulator.new(rev).set_thread_statuses
|
54
93
|
expect(ts).to eq(
|
55
94
|
[{:name=>"completed_failed",
|
56
95
|
:label=>"Failed",
|
@@ -62,7 +101,7 @@ describe FullRevision do
|
|
62
101
|
:failed=>false}]
|
63
102
|
)
|
64
103
|
|
65
|
-
status = RevisionStatusCalulator.new
|
104
|
+
status = RevisionStatusCalulator.new(rev).set_status
|
66
105
|
expect(status).to include({name: "completed_failed", label: "Failed", completed: true, failed: true})
|
67
106
|
end
|
68
107
|
|
@@ -79,7 +118,7 @@ describe FullRevision do
|
|
79
118
|
|
80
119
|
rev = Revision::Root.all.first
|
81
120
|
|
82
|
-
ts = RevisionStatusCalulator.new
|
121
|
+
ts = RevisionStatusCalulator.new(rev).set_thread_statuses
|
83
122
|
expect(ts).to eq(
|
84
123
|
[{:name=>"completed_failed",
|
85
124
|
:label=>"Failed",
|
@@ -90,7 +129,7 @@ describe FullRevision do
|
|
90
129
|
:completed=>false,
|
91
130
|
:failed=>false}]
|
92
131
|
)
|
93
|
-
status = RevisionStatusCalulator.new
|
132
|
+
status = RevisionStatusCalulator.new(rev).set_status
|
94
133
|
expect(status).to include({name: "in_progress_failed", label: "In Progress", completed: false, failed: true})
|
95
134
|
end
|
96
135
|
|
@@ -103,7 +142,7 @@ describe FullRevision do
|
|
103
142
|
|
104
143
|
rev = Revision::Root.all.first
|
105
144
|
|
106
|
-
ts = RevisionStatusCalulator.new
|
145
|
+
ts = RevisionStatusCalulator.new(rev).set_thread_statuses
|
107
146
|
expect(ts).to eq(
|
108
147
|
[{:name=>"completed_passed",
|
109
148
|
:label=>"Passed",
|
@@ -119,7 +158,7 @@ describe FullRevision do
|
|
119
158
|
:failed=>false}
|
120
159
|
]
|
121
160
|
)
|
122
|
-
status = RevisionStatusCalulator.new
|
161
|
+
status = RevisionStatusCalulator.new(rev).set_status
|
123
162
|
expect(status).to include({name: "in_progress_success", label: "In Progress", completed: false, failed: false})
|
124
163
|
end
|
125
164
|
|
data/sw2at-ui.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: sw2at-ui 0.0.
|
5
|
+
# stub: sw2at-ui 0.0.11 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "sw2at-ui"
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.11"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
"app/assets/javascripts/swat/app/controllers/revisions.coffee",
|
34
34
|
"app/assets/javascripts/swat/app/controllers/root.coffee",
|
35
35
|
"app/assets/javascripts/swat/app/controllers/summary.coffee",
|
36
|
+
"app/assets/javascripts/swat/app/directives/revision_name.coffee",
|
36
37
|
"app/assets/javascripts/swat/app/factories/fails_graph.coffee",
|
37
38
|
"app/assets/javascripts/swat/app/factories/helpers.coffee",
|
38
39
|
"app/assets/javascripts/swat/app/factories/response.coffee",
|
@@ -369,6 +370,7 @@ Gem::Specification.new do |s|
|
|
369
370
|
"app/assets/stylesheets/swat/fonts/fontawesome-webfont.ttf",
|
370
371
|
"app/assets/stylesheets/swat/fonts/fontawesome-webfont.woff",
|
371
372
|
"app/assets/stylesheets/swat/fonts/fontawesome-webfont.woff2",
|
373
|
+
"app/assets/stylesheets/swat/header.scss",
|
372
374
|
"app/assets/stylesheets/swat/swat_theme.scss",
|
373
375
|
"app/controllers/swat/api/revisions_controller.rb",
|
374
376
|
"app/controllers/swat/api/test_cases_controller.rb",
|
@@ -387,6 +389,7 @@ Gem::Specification.new do |s|
|
|
387
389
|
"app/views/layouts/swat/page.slim",
|
388
390
|
"app/views/swat/application/index.slim",
|
389
391
|
"app/views/swat/pages/revisions/index.slim",
|
392
|
+
"app/views/swat/pages/revisions/name.slim",
|
390
393
|
"app/views/swat/pages/revisions/partials/_exceptions.slim",
|
391
394
|
"app/views/swat/pages/revisions/partials/_test_cases.slim",
|
392
395
|
"app/views/swat/pages/revisions/show.slim",
|
@@ -427,12 +430,13 @@ Gem::Specification.new do |s|
|
|
427
430
|
|
428
431
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
429
432
|
s.add_runtime_dependency(%q<rails>, [">= 3.1"])
|
430
|
-
s.add_runtime_dependency(%q<fire-model>, ["~> 0.0.
|
433
|
+
s.add_runtime_dependency(%q<fire-model>, ["~> 0.0.18"])
|
431
434
|
s.add_runtime_dependency(%q<slim-rails>, [">= 0"])
|
432
435
|
s.add_runtime_dependency(%q<sass-rails>, [">= 0"])
|
433
436
|
s.add_runtime_dependency(%q<coffee-rails>, [">= 0"])
|
434
437
|
s.add_runtime_dependency(%q<bootstrap-sass>, [">= 0"])
|
435
438
|
s.add_runtime_dependency(%q<tarvit-helpers>, [">= 0"])
|
439
|
+
s.add_runtime_dependency(%q<time_difference>, [">= 0"])
|
436
440
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
437
441
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
438
442
|
s.add_development_dependency(%q<rspec>, ["~> 3.2"])
|
@@ -442,12 +446,13 @@ Gem::Specification.new do |s|
|
|
442
446
|
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
443
447
|
else
|
444
448
|
s.add_dependency(%q<rails>, [">= 3.1"])
|
445
|
-
s.add_dependency(%q<fire-model>, ["~> 0.0.
|
449
|
+
s.add_dependency(%q<fire-model>, ["~> 0.0.18"])
|
446
450
|
s.add_dependency(%q<slim-rails>, [">= 0"])
|
447
451
|
s.add_dependency(%q<sass-rails>, [">= 0"])
|
448
452
|
s.add_dependency(%q<coffee-rails>, [">= 0"])
|
449
453
|
s.add_dependency(%q<bootstrap-sass>, [">= 0"])
|
450
454
|
s.add_dependency(%q<tarvit-helpers>, [">= 0"])
|
455
|
+
s.add_dependency(%q<time_difference>, [">= 0"])
|
451
456
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
452
457
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
453
458
|
s.add_dependency(%q<rspec>, ["~> 3.2"])
|
@@ -458,12 +463,13 @@ Gem::Specification.new do |s|
|
|
458
463
|
end
|
459
464
|
else
|
460
465
|
s.add_dependency(%q<rails>, [">= 3.1"])
|
461
|
-
s.add_dependency(%q<fire-model>, ["~> 0.0.
|
466
|
+
s.add_dependency(%q<fire-model>, ["~> 0.0.18"])
|
462
467
|
s.add_dependency(%q<slim-rails>, [">= 0"])
|
463
468
|
s.add_dependency(%q<sass-rails>, [">= 0"])
|
464
469
|
s.add_dependency(%q<coffee-rails>, [">= 0"])
|
465
470
|
s.add_dependency(%q<bootstrap-sass>, [">= 0"])
|
466
471
|
s.add_dependency(%q<tarvit-helpers>, [">= 0"])
|
472
|
+
s.add_dependency(%q<time_difference>, [">= 0"])
|
467
473
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
468
474
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
469
475
|
s.add_dependency(%q<rspec>, ["~> 3.2"])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sw2at-ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vitaly Tarasenko
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.0.
|
33
|
+
version: 0.0.18
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.0.
|
40
|
+
version: 0.0.18
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: slim-rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: time_difference
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: shoulda
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -229,6 +243,7 @@ files:
|
|
229
243
|
- app/assets/javascripts/swat/app/controllers/revisions.coffee
|
230
244
|
- app/assets/javascripts/swat/app/controllers/root.coffee
|
231
245
|
- app/assets/javascripts/swat/app/controllers/summary.coffee
|
246
|
+
- app/assets/javascripts/swat/app/directives/revision_name.coffee
|
232
247
|
- app/assets/javascripts/swat/app/factories/fails_graph.coffee
|
233
248
|
- app/assets/javascripts/swat/app/factories/helpers.coffee
|
234
249
|
- app/assets/javascripts/swat/app/factories/response.coffee
|
@@ -565,6 +580,7 @@ files:
|
|
565
580
|
- app/assets/stylesheets/swat/fonts/fontawesome-webfont.ttf
|
566
581
|
- app/assets/stylesheets/swat/fonts/fontawesome-webfont.woff
|
567
582
|
- app/assets/stylesheets/swat/fonts/fontawesome-webfont.woff2
|
583
|
+
- app/assets/stylesheets/swat/header.scss
|
568
584
|
- app/assets/stylesheets/swat/swat_theme.scss
|
569
585
|
- app/controllers/swat/api/revisions_controller.rb
|
570
586
|
- app/controllers/swat/api/test_cases_controller.rb
|
@@ -583,6 +599,7 @@ files:
|
|
583
599
|
- app/views/layouts/swat/page.slim
|
584
600
|
- app/views/swat/application/index.slim
|
585
601
|
- app/views/swat/pages/revisions/index.slim
|
602
|
+
- app/views/swat/pages/revisions/name.slim
|
586
603
|
- app/views/swat/pages/revisions/partials/_exceptions.slim
|
587
604
|
- app/views/swat/pages/revisions/partials/_test_cases.slim
|
588
605
|
- app/views/swat/pages/revisions/show.slim
|