opsask 2.1.9 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/opsask/app.rb +19 -3
- data/lib/opsask/helpers.rb +21 -0
- data/views/_count.erb +8 -10
- data/views/days.erb +14 -0
- data/views/index.erb +4 -8
- metadata +3 -3
- data/views/glance.erb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39de33ba0a9dba8e6de6179eecf083507bf82457
|
4
|
+
data.tar.gz: 2a6d56152445dbf4f2747bb71eb69b488ccaac47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20b178f635d9337c99cb2098665bd4f0cc64db6d92d435ac5de720faa4d68e4cb599ede166b493d2e8fa96b889c086188299e80ca3df629507fd164d5e0a93da
|
7
|
+
data.tar.gz: 980a1b120ec1d936754d830266f2c1951228705377a27dff6514ddb7be0bdc9c9408ae67720ea683b724b7b9169c036e72ef09c50ad424557dcf2d447ddf9a08
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.2.0
|
data/lib/opsask/app.rb
CHANGED
@@ -4,6 +4,7 @@ require 'sinatra/partial'
|
|
4
4
|
require 'rack-flash'
|
5
5
|
require 'json'
|
6
6
|
require 'jira'
|
7
|
+
require 'tilt/erb'
|
7
8
|
|
8
9
|
require_relative 'helpers'
|
9
10
|
require_relative 'metadata'
|
@@ -35,9 +36,24 @@ module OpsAsk
|
|
35
36
|
end
|
36
37
|
|
37
38
|
get '/glance' do
|
38
|
-
erb :
|
39
|
-
|
40
|
-
|
39
|
+
erb :days, locals: {
|
40
|
+
jiras_by_day: issues_for_days(2),
|
41
|
+
untracked_jiras: untracked_issues,
|
42
|
+
stragglers: straggling_issues
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
get '/week' do
|
47
|
+
erb :days, locals: {
|
48
|
+
jiras_by_day: issues_for_days(4),
|
49
|
+
untracked_jiras: untracked_issues,
|
50
|
+
stragglers: straggling_issues
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
get '/days/:n' do
|
55
|
+
erb :days, locals: {
|
56
|
+
jiras_by_day: issues_for_days(params[:n].to_i),
|
41
57
|
untracked_jiras: untracked_issues,
|
42
58
|
stragglers: straggling_issues
|
43
59
|
}
|
data/lib/opsask/helpers.rb
CHANGED
@@ -4,6 +4,12 @@ module OpsAsk
|
|
4
4
|
!!session[:jira_auth]
|
5
5
|
end
|
6
6
|
|
7
|
+
def no_ops jiras
|
8
|
+
jiras.reject do |jira|
|
9
|
+
jira.fields['labels'].include? 'OpsOnly'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
7
13
|
def ops?
|
8
14
|
return false unless logged_in?
|
9
15
|
@myself['groups']['items'].each do |i|
|
@@ -281,6 +287,21 @@ module OpsAsk
|
|
281
287
|
return "#{idx}-#{jira.key}"
|
282
288
|
end
|
283
289
|
|
290
|
+
def today? date
|
291
|
+
Time.new.to_date.strftime('%Y-%m-%d') == date
|
292
|
+
end
|
293
|
+
|
294
|
+
def issues_for_days n
|
295
|
+
now = Time.new.to_date
|
296
|
+
0.upto(n-1).inject({}) do |h,i|
|
297
|
+
date = (now + i).strftime('%Y-%m-%d')
|
298
|
+
h[date] = jiras_for(date).sort_by do |jira|
|
299
|
+
sorting_key_for(jira)
|
300
|
+
end.reverse
|
301
|
+
h
|
302
|
+
end
|
303
|
+
end
|
304
|
+
|
284
305
|
def issues_for date
|
285
306
|
jiras_for(date).sort_by do |jira|
|
286
307
|
sorting_key_for(jira)
|
data/views/_count.erb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
|
-
<%
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
<span class="count label radius">empty</span>
|
10
|
-
<% end %>
|
1
|
+
<% if count >= settings.config[:queue_size] %>
|
2
|
+
<span class="count label alert radius">full</span>
|
3
|
+
<% elsif today and now.hour >= settings.config[:cutoff_hour] %>
|
4
|
+
<span class="count label alert radius">cutoff</span>
|
5
|
+
<% elsif count > 0 && count < settings.config[:queue_size] %>
|
6
|
+
<span class="count label radius"><%= count %> of <%= settings.config[:queue_size] %></span>
|
7
|
+
<% else # count == 0 %>
|
8
|
+
<span class="count label radius">empty</span>
|
11
9
|
<% end %>
|
data/views/days.erb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<% c = 12.0 / jiras_by_day.keys.length.to_f ; c = c.floor %>
|
3
|
+
<% i = 0 %>
|
4
|
+
<% jiras_by_day.each do |date, jiras| %>
|
5
|
+
<div id="ops-queue-<%= i %>" class="ops-queue small-<%= c %> columns">
|
6
|
+
<h2>
|
7
|
+
<%= date %>
|
8
|
+
<%= partial :count, locals: { count: no_ops(jiras).length, today: today?(date) } %>
|
9
|
+
</h2>
|
10
|
+
<%= partial :queue, locals: { jiras: jiras } %>
|
11
|
+
</div>
|
12
|
+
<% i += 1 %>
|
13
|
+
<% end %>
|
14
|
+
</div>
|
data/views/index.erb
CHANGED
@@ -1,28 +1,24 @@
|
|
1
1
|
<div class="row">
|
2
2
|
<% if its_the_weekend? %>
|
3
3
|
<div id="ops-queue-for-coming-week" class="ops-queue small-8 columns">
|
4
|
-
<h2><%= name_for_coming_week %> <%= partial :count, locals: { count:
|
4
|
+
<h2><%= name_for_coming_week %> <%= partial :count, locals: { count: no_ops(jiras_for_today).length, today: false } %></h2>
|
5
5
|
<%= partial :queue, locals: { jiras: jiras_for_today } %>
|
6
6
|
</div>
|
7
7
|
|
8
8
|
<% else %>
|
9
9
|
<div id="ops-queue-for-today" class="ops-queue small-4 columns">
|
10
|
-
<h2><%= name_for_today %> <%= partial :count, locals: { count:
|
10
|
+
<h2><%= name_for_today %> <%= partial :count, locals: { count: no_ops(jiras_for_today).length, today: true } %></h2>
|
11
11
|
<%= partial :queue, locals: { jiras: jiras_for_today } %>
|
12
12
|
</div>
|
13
13
|
|
14
14
|
<div id="ops-queue-for-tomorrow" class="ops-queue small-4 columns">
|
15
|
-
<h2><%= name_for_tomorrow %> <%= partial :count, locals: { count:
|
15
|
+
<h2><%= name_for_tomorrow %> <%= partial :count, locals: { count: no_ops(jiras_for_tomorrow).length, today: false } %></h2>
|
16
16
|
<%= partial :queue, locals: { jiras: jiras_for_tomorrow } %>
|
17
17
|
</div>
|
18
18
|
<% end %>
|
19
19
|
|
20
20
|
<section id="ops-ask" class="small-4 columns">
|
21
|
-
<h2>Create JIRA
|
22
|
-
<% unless logged_in? && ops? && room_for_new_jiras?(true) %>
|
23
|
-
<span id="opsonly-full" class="alert label radius">Full</span>
|
24
|
-
<% end %>
|
25
|
-
</h2>
|
21
|
+
<h2>Create JIRA</h2>
|
26
22
|
<%= partial :form, locals: {
|
27
23
|
jiras_for_today: jiras_for_today,
|
28
24
|
jiras_for_tomorrow: jiras_for_tomorrow
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opsask
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Clemmer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -180,7 +180,7 @@ files:
|
|
180
180
|
- views/_flash.erb
|
181
181
|
- views/_form.erb
|
182
182
|
- views/_queue.erb
|
183
|
-
- views/
|
183
|
+
- views/days.erb
|
184
184
|
- views/index.erb
|
185
185
|
- views/layout.erb
|
186
186
|
- views/stats.erb
|
data/views/glance.erb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
<div class="row">
|
2
|
-
<% if its_the_weekend? %>
|
3
|
-
<div id="ops-queue-for-coming-week" class="ops-queue small-6 small-offset-3 columns">
|
4
|
-
<h2><%= name_for_coming_week %> <%= partial :count, locals: { count: jira_count_for_today, today: false } %></h2>
|
5
|
-
<%= partial :queue, locals: { jiras: jiras_for_today } %>
|
6
|
-
</div>
|
7
|
-
|
8
|
-
<% else %>
|
9
|
-
<div id="ops-queue-for-today" class="ops-queue small-6 columns">
|
10
|
-
<h2><%= name_for_today %> <%= partial :count, locals: { count: jira_count_for_today, today: true } %></h2>
|
11
|
-
<%= partial :queue, locals: { jiras: jiras_for_today } %>
|
12
|
-
</div>
|
13
|
-
|
14
|
-
<div id="ops-queue-for-tomorrow" class="ops-queue small-6 columns">
|
15
|
-
<h2><%= name_for_tomorrow %> <%= partial :count, locals: { count: jira_count_for_tomorrow, today: false } %></h2>
|
16
|
-
<%= partial :queue, locals: { jiras: jiras_for_tomorrow } %>
|
17
|
-
</div>
|
18
|
-
<% end %>
|
19
|
-
</div>
|