bumbleworks-gui 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/config.ru CHANGED
@@ -10,7 +10,7 @@ Bumbleworks.start_worker!
10
10
  Widget.truncate!
11
11
  WidgetyFidget.truncate!
12
12
 
13
- widget_processes = 20.times.collect do |i|
13
+ widget_processes = 45.times.collect do |i|
14
14
  Widget.new(i).launch_process('task_process')
15
15
  end
16
16
 
@@ -20,7 +20,7 @@ end
20
20
 
21
21
  wp = Bumbleworks.launch!('waiting_process')
22
22
 
23
- wait_until { wp.reload.trackers.count == 4 }
23
+ wait_until(:timeout => 30) { wp.reload.trackers.count == 4 }
24
24
 
25
25
  widget_processes.first.tasks.each do |t|
26
26
  t.complete
@@ -62,4 +62,12 @@ dd {
62
62
 
63
63
  .action-button-group {
64
64
  width: 7.5em;
65
+ }
66
+
67
+ /* pagination */
68
+
69
+ .pagination li.active a {
70
+ color: #000;
71
+ pointer-events: none;
72
+ cursor: default;
65
73
  }
@@ -10,6 +10,7 @@ Bumbleworks::Gui::Application.set_routes do
10
10
  match '/processes/:pid/expressions/:id/cancel', :to => 'expressions#cancel', :methods => [:delete]
11
11
  match '/processes/:pid/expressions/:id/kill', :to => 'expressions#kill', :methods => [:delete]
12
12
  match '/processes/:id', :to => 'processes#show', :methods => [:get]
13
+ match '/processes/page/:page', :to => 'processes#index', :methods => [:get]
13
14
  match '/processes', :to => 'processes#index', :methods => [:get]
14
15
  match '/tasks/:id', :to => 'tasks#show', :methods => [:get]
15
16
  match '/tasks', :to => 'tasks#index', :methods => [:get]
@@ -2,7 +2,9 @@ module Bumbleworks
2
2
  module Gui
3
3
  class ProcessesController < ApplicationController
4
4
  def index
5
- expose :processes => Bumbleworks::Process.all
5
+ redirect path_to('processes_index', :page => 1) unless params[:page]
6
+ expose :processes => Bumbleworks::Process.all(:limit => 10, :offset => (params[:page].to_i - 1) * 10),
7
+ :current_page => params[:page]
6
8
  end
7
9
 
8
10
  def show
@@ -1,5 +1,5 @@
1
1
  module Bumbleworks
2
2
  module Gui
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -4,7 +4,7 @@
4
4
  <%= render 'shared/entity_types', :locals => { :entity_classes => entity_classes} %>
5
5
  </dd>
6
6
 
7
- <dt>Recent Processes (<a href="<%= path_to 'processes_index' %>">View All <%= Bumbleworks::Process.count %></a>)</dt>
7
+ <dt>Recent Processes (<a href="<%= path_to 'processes_index', :page => 1 %>">View All <%= Bumbleworks::Process.count %></a>)</dt>
8
8
  <dd>
9
9
  <%= render 'shared/processes', :locals => { :processes => recent_processes } %>
10
10
  </dd>
@@ -28,7 +28,7 @@
28
28
  <a class="pure-menu-heading" href="<%= path_to 'dashboards_show' %>">bumbleworks</a>
29
29
  <ul>
30
30
  <li><a href="<%= path_to 'entities_types' %>">Entities</a></li>
31
- <li><a href="<%= path_to 'processes_index' %>">Processes</a></li>
31
+ <li><a href="<%= path_to 'processes_index', :page => 1 %>">Processes</a></li>
32
32
  <li><a href="<%= path_to 'trackers_index' %>">Trackers</a></li>
33
33
  <li><a href="<%= path_to 'tasks_index' %>">Tasks</a></li>
34
34
  </ul>
@@ -1,3 +1,3 @@
1
1
  <div>
2
- <%= render 'shared/processes', :locals => { :processes => processes } %>
2
+ <%= render 'shared/processes', :locals => { :processes => processes, :current_page => current_page } %>
3
3
  </div>
@@ -0,0 +1,15 @@
1
+ <div class="pagination pure-menu pure-menu-open pure-menu-horizontal">
2
+ <ul class="pagination">
3
+ <% pages.times.map { |p| p + 1 }.each do |page_number| %>
4
+ <% if page_number == 1 || page_number == pages || (current_page - page_number).abs < 4 %>
5
+ <li <%= (current_page == page_number) ? 'class="active"' : '' %>>
6
+ <a href="<%= path_to paginated_route, :page => page_number %>"><%= page_number %></a>
7
+ </li>
8
+ <% elsif (current_page - page_number).abs == 4 %>
9
+ <li class="disabled">
10
+ <a>...</a>
11
+ </li>
12
+ <% end %>
13
+ <% end %>
14
+ </ul>
15
+ </div>
@@ -3,15 +3,13 @@
3
3
  <table class="pure-table pure-table-bordered">
4
4
  <thead>
5
5
  <tr>
6
- <th class="sort" data-sort="id">ID</th>
7
- <th class="sort" data-sort="entity">Entity</th>
8
- <th class="sort" data-sort="definition">Type</th>
9
- <% if false # see below %>
10
- <th class="sort" data-sort="subscribed-events">Subscribed Events</th>
11
- <th class="sort" data-sort="task-count">Tasks</th>
12
- <th class="sort" data-sort="error-count">Errors</th>
13
- <th class="sort" data-sort="tracker-count">Trackers</th>
14
- <% end %>
6
+ <th data-sort="id">ID</th>
7
+ <th data-sort="entity">Entity</th>
8
+ <th data-sort="definition">Type</th>
9
+ <th data-sort="subscribed-events">Subscribed Events</th>
10
+ <th data-sort="task-count">Tasks</th>
11
+ <th data-sort="error-count">Errors</th>
12
+ <th data-sort="tracker-count">Trackers</th>
15
13
  </tr>
16
14
  </thead>
17
15
  <tbody class="list">
@@ -21,12 +19,10 @@
21
19
  <td class="id"><a href="<%= path_to 'processes_show', :id => process.id %>"><%= process.id %></a></td>
22
20
  <td class="entity"><%= process.entity_name %></td>
23
21
  <td class="definition"><%= process.definition_name %></td>
24
- <% if false # need optimization before these will work %>
25
- <td class="subscribed-events"><%= process.subscribed_events %></td>
26
- <td class="task-count"><%= process.tasks.count %></td>
27
- <td class="error-count"><%= process.errors.count %></td>
28
- <td class="tracker-count"><%= process.trackers.count %></td>
29
- <% end %>
22
+ <td class="subscribed-events"><%= process.subscribed_events %></td>
23
+ <td class="task-count"><%= process.tasks.count %></td>
24
+ <td class="error-count"><%= process.errors.count %></td>
25
+ <td class="tracker-count"><%= process.trackers.count %></td>
30
26
  </tr>
31
27
  <% else %>
32
28
  <tr>
@@ -38,6 +34,10 @@
38
34
  </table>
39
35
  </div>
40
36
 
37
+ <% if respond_to?(:current_page) %>
38
+ <%= render 'shared/pagination', :locals => { :pages => (existing_wfids.count / 10.0).ceil, :current_page => current_page.to_i, :paginated_route => 'processes_index' } %>
39
+ <% end %>
40
+
41
41
  <%= render 'shared/list_js_script', :locals => {
42
42
  :list_id => 'processes',
43
43
  :rows => processes.count
@@ -7,7 +7,7 @@ feature "Process management" do
7
7
  process2 = Bumbleworks.launch!('task_process')
8
8
  wait_until { process1.tasks.count == 2 && process2.tasks.count == 2 }
9
9
 
10
- visit_scoped '/processes'
10
+ visit_scoped '/processes/page/1'
11
11
 
12
12
  expect(process_index).to have_processes([process1, process2])
13
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bumbleworks-gui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-06 00:00:00.000000000 Z
12
+ date: 2014-06-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bumbleworks
@@ -188,6 +188,7 @@ files:
188
188
  - lib/bumbleworks/gui/views/shared/entity_types.html.erb
189
189
  - lib/bumbleworks/gui/views/shared/expressions.html.erb
190
190
  - lib/bumbleworks/gui/views/shared/list_js_script.html.erb
191
+ - lib/bumbleworks/gui/views/shared/pagination.html.erb
191
192
  - lib/bumbleworks/gui/views/shared/processes.html.erb
192
193
  - lib/bumbleworks/gui/views/shared/tasks.html.erb
193
194
  - lib/bumbleworks/gui/views/shared/trackers.html.erb
@@ -239,7 +240,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
239
240
  version: '0'
240
241
  segments:
241
242
  - 0
242
- hash: 1316044860917591903
243
+ hash: -1894466735461666084
243
244
  required_rubygems_version: !ruby/object:Gem::Requirement
244
245
  none: false
245
246
  requirements:
@@ -248,7 +249,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
249
  version: '0'
249
250
  segments:
250
251
  - 0
251
- hash: 1316044860917591903
252
+ hash: -1894466735461666084
252
253
  requirements: []
253
254
  rubyforge_project:
254
255
  rubygems_version: 1.8.23