coupler 0.0.7-java → 0.0.8-java
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/coupler.gemspec +11 -2
- data/db/migrate/024_add_error_msg_to_jobs.rb +5 -0
- data/db/migrate/025_add_notifications.rb +16 -0
- data/db/migrate/026_add_status_to_resources.rb +7 -0
- data/db/migrate/027_add_notification_id_to_jobs.rb +8 -0
- data/lib/coupler.rb +6 -2
- data/lib/coupler/base.rb +1 -0
- data/lib/coupler/extensions.rb +3 -1
- data/lib/coupler/extensions/imports.rb +11 -14
- data/lib/coupler/extensions/notifications.rb +26 -0
- data/lib/coupler/models.rb +1 -0
- data/lib/coupler/models/comparison.rb +0 -1
- data/lib/coupler/models/connection.rb +0 -1
- data/lib/coupler/models/field.rb +6 -6
- data/lib/coupler/models/import.rb +9 -3
- data/lib/coupler/models/job.rb +64 -20
- data/lib/coupler/models/matcher.rb +0 -1
- data/lib/coupler/models/notification.rb +7 -0
- data/lib/coupler/models/project.rb +0 -1
- data/lib/coupler/models/resource.rb +52 -31
- data/lib/coupler/models/result.rb +0 -1
- data/lib/coupler/models/scenario.rb +0 -1
- data/lib/coupler/models/transformation.rb +2 -3
- data/lib/coupler/models/transformer.rb +0 -1
- data/lib/coupler/scheduler.rb +8 -0
- data/tasks/db.rake +2 -2
- data/test/functional/test_imports.rb +21 -13
- data/test/functional/test_notifications.rb +38 -0
- data/test/integration/test_import.rb +25 -1
- data/test/unit/models/test_field.rb +2 -13
- data/test/unit/models/test_import.rb +4 -0
- data/test/unit/models/test_job.rb +59 -6
- data/test/unit/models/test_notification.rb +17 -0
- data/test/unit/models/test_resource.rb +114 -29
- data/test/unit/models/test_transformation.rb +4 -4
- data/test/unit/test_base.rb +1 -1
- data/test/unit/test_scheduler.rb +11 -0
- data/webroot/public/css/style.css +23 -0
- data/webroot/public/js/application.js +31 -10
- data/webroot/views/jobs/list.erb +2 -0
- data/webroot/views/layout.erb +3 -1
- data/webroot/views/notifications/index.erb +16 -0
- data/webroot/views/resources/list.erb +12 -7
- data/webroot/views/sidebar.erb +2 -0
- metadata +11 -2
@@ -41,7 +41,7 @@ module CouplerUnitTests
|
|
41
41
|
|
42
42
|
def setup
|
43
43
|
super
|
44
|
-
@resource = stub('resource', :pk => 3, :id => 3, :associations => {}, :
|
44
|
+
@resource = stub('resource', :pk => 3, :id => 3, :associations => {}, :transformations_updated! => nil)
|
45
45
|
@transformer = stub('transformer', {
|
46
46
|
:pk => 1, :id => 1, :associations => {},
|
47
47
|
:allowed_types => %w{string}, :name => "foobar"
|
@@ -137,7 +137,7 @@ module CouplerUnitTests
|
|
137
137
|
|
138
138
|
test "updates resource fields on save" do
|
139
139
|
transformation = new_transformation
|
140
|
-
@resource.expects(:
|
140
|
+
@resource.expects(:transformations_updated!)
|
141
141
|
transformation.save!
|
142
142
|
end
|
143
143
|
|
@@ -178,8 +178,8 @@ module CouplerUnitTests
|
|
178
178
|
end
|
179
179
|
|
180
180
|
test "sets position by resource" do
|
181
|
-
resource_1 = stub('resource', :pk => 1, :id => 1, :associations => {}, :
|
182
|
-
resource_2 = stub('resource', :pk => 2, :id => 2, :associations => {}, :
|
181
|
+
resource_1 = stub('resource', :pk => 1, :id => 1, :associations => {}, :transformations_updated! => nil)
|
182
|
+
resource_2 = stub('resource', :pk => 2, :id => 2, :associations => {}, :transformations_updated! => nil)
|
183
183
|
|
184
184
|
xformation_1 = new_transformation(:resource => resource_1).save!
|
185
185
|
xformation_2 = new_transformation(:resource => resource_1).save!
|
data/test/unit/test_base.rb
CHANGED
data/test/unit/test_scheduler.rb
CHANGED
@@ -24,6 +24,17 @@ module CouplerUnitTests
|
|
24
24
|
Scheduler.instance.schedule_run_scenario_job(scenario)
|
25
25
|
end
|
26
26
|
|
27
|
+
test "schedule import job" do
|
28
|
+
import = mock('import')
|
29
|
+
Models::Job.expects(:create).with({
|
30
|
+
:name => "import",
|
31
|
+
:import => import,
|
32
|
+
:status => "scheduled"
|
33
|
+
})
|
34
|
+
|
35
|
+
Scheduler.instance.schedule_import_job(import)
|
36
|
+
end
|
37
|
+
|
27
38
|
test "run_jobs executes first scheduled job" do
|
28
39
|
running_dataset = mock('dataset')
|
29
40
|
scheduled_dataset = mock('dataset')
|
@@ -24,6 +24,7 @@ body {
|
|
24
24
|
#sidebar .accordion h3 {
|
25
25
|
margin-top: 3px;
|
26
26
|
font-family: verdana, arial, helvetica, sans-serif;
|
27
|
+
position: relative;
|
27
28
|
}
|
28
29
|
#sidebar .accordion h3.ui-state-active a {
|
29
30
|
text-shadow: 1px 1px 1px black;
|
@@ -504,3 +505,25 @@ table.summary tr {
|
|
504
505
|
.result-group-left .record-navigation {
|
505
506
|
border-right: 2px solid #333;
|
506
507
|
}
|
508
|
+
|
509
|
+
#notifications {
|
510
|
+
position: absolute;
|
511
|
+
top: 0;
|
512
|
+
left: 0;
|
513
|
+
width: 100%;
|
514
|
+
}
|
515
|
+
#notifications ul {
|
516
|
+
background-color: lightyellow;
|
517
|
+
-moz-border-radius-bottomright: 10px;
|
518
|
+
-webkit-border-bottom-right-radius: 10px;
|
519
|
+
border-bottom-right-radius: 10px;
|
520
|
+
-moz-border-radius-bottomleft: 10px;
|
521
|
+
-webkit-border-bottom-left-radius: 10px;
|
522
|
+
border-bottom-left-radius: 10px;
|
523
|
+
list-style-type: none;
|
524
|
+
text-align: center;
|
525
|
+
}
|
526
|
+
#notifications ul li {
|
527
|
+
margin: 0;
|
528
|
+
display: inline;
|
529
|
+
}
|
@@ -1,12 +1,32 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
/*
|
2
|
+
function updateJobCount() {
|
3
|
+
$.get("/jobs/count", function(data) {
|
4
|
+
if (data == "0") {
|
5
|
+
$('#job-count').html("")
|
6
|
+
} else {
|
7
|
+
$('#job-count').html("("+data+")")
|
8
|
+
}
|
9
|
+
});
|
10
|
+
}
|
11
|
+
*/
|
12
|
+
function updateNotifications() {
|
13
|
+
$.get("/notifications/unseen.json", function(data, textStatus, jqXHR) {
|
14
|
+
var n = $('#notifications');
|
15
|
+
if (data.length == 0) {
|
16
|
+
n.find('ul').html('');
|
17
|
+
n.hide();
|
18
|
+
} else {
|
19
|
+
var ids = [];
|
20
|
+
$.each(data, function() {
|
21
|
+
var id = 'notification-'+this.id;
|
22
|
+
ids.push(id);
|
23
|
+
n.find('ul:not(:has(#'+id+'))').append('<li id="'+id+'"><a href="'+this.url+'">'+this.message+'</a></li>');
|
24
|
+
});
|
25
|
+
n.find('ul li:not(#'+ids.join(',#')+')').remove();
|
26
|
+
$('#notifications').show();
|
27
|
+
}
|
28
|
+
}, 'json');
|
29
|
+
}
|
10
30
|
$(function() {
|
11
31
|
$('.timeago').timeago();
|
12
32
|
var accordion = $('#sidebar .accordion').accordion({
|
@@ -36,5 +56,6 @@ $(function() {
|
|
36
56
|
window.location.href = href;
|
37
57
|
});
|
38
58
|
});
|
39
|
-
|
59
|
+
setInterval(updateNotifications, 10000);
|
60
|
+
updateNotifications();
|
40
61
|
});
|
data/webroot/views/jobs/list.erb
CHANGED
@@ -17,6 +17,8 @@
|
|
17
17
|
<td><a href="/projects/<%= job.resource.project.id %>/resources/<%= job.resource.id %>"><%= job.resource.name %></a></td>
|
18
18
|
<%- elsif job.scenario -%>
|
19
19
|
<td><a href="/projects/<%= job.scenario.project.id %>/scenarios/<%= job.scenario.id %>"><%= job.scenario.name %></a></td>
|
20
|
+
<%- elsif job.import -%>
|
21
|
+
<td><%= job.import.name %> (Project: <a href="/projects/<%= job.import.project_id %>"><%= job.import.project.name %></a>)</td>
|
20
22
|
<%- else -%>
|
21
23
|
<td>N/A</td>
|
22
24
|
<%- end -%>
|
data/webroot/views/layout.erb
CHANGED
@@ -3,12 +3,14 @@
|
|
3
3
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
4
|
<head>
|
5
5
|
<title>Coupler</title>
|
6
|
-
<meta http-equiv="
|
6
|
+
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
7
7
|
<meta http-equiv="Content-Style-Type" content="text/css" />
|
8
8
|
<%= stylesheet_links %>
|
9
9
|
<%= javascript_includes %>
|
10
10
|
</head>
|
11
11
|
<body>
|
12
|
+
|
13
|
+
<div id="notifications"><ul></ul></div>
|
12
14
|
<div id="main" class="container_16">
|
13
15
|
|
14
16
|
<div id="sidebar" class="grid_3">
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%- @breadcrumbs = ["Notifications"] -%>
|
2
|
+
<%- if @notifications.empty? -%>
|
3
|
+
<p>There are currently no notifications.</p>
|
4
|
+
<%- else -%>
|
5
|
+
<ul class="notifications">
|
6
|
+
<%- @notifications.each do |notification| -%>
|
7
|
+
<li class="notification">
|
8
|
+
<% if notification.url %>
|
9
|
+
<a href="<%= notification.url %>"><%= notification.message %></a>
|
10
|
+
<% else %>
|
11
|
+
<%= notification.message %>
|
12
|
+
<% end %>
|
13
|
+
</li>
|
14
|
+
<%- end -%>
|
15
|
+
</ul>
|
16
|
+
<%- end -%>
|
@@ -12,13 +12,18 @@
|
|
12
12
|
<tbody>
|
13
13
|
<% @resources.each_with_index do |resource, i| %>
|
14
14
|
<tr<%= ' class="alt"' if i % 2 == 1 %>>
|
15
|
-
|
16
|
-
|
17
|
-
<td colspan="
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
<% if resource.status == 'pending' %>
|
16
|
+
<td><%= resource.name %></td>
|
17
|
+
<td colspan="2" class='centered'>(pending)</td>
|
18
|
+
<% else %>
|
19
|
+
<td><a href="/projects/<%= resource.project_id %>/resources/<%= resource.id %>"><%= resource.name %></a></td>
|
20
|
+
<%- if resource.import_id -%>
|
21
|
+
<td colspan="2" class='centered'>(imported)</td>
|
22
|
+
<%- else -%>
|
23
|
+
<% unless @hide_connection %><td><%= resource.connection.name %></td><% end %>
|
24
|
+
<td><%= resource.table_name %></td>
|
25
|
+
<%- end -%>
|
26
|
+
<% end %>
|
22
27
|
</tr>
|
23
28
|
<% end %>
|
24
29
|
</tbody>
|
data/webroot/views/sidebar.erb
CHANGED
@@ -97,6 +97,8 @@
|
|
97
97
|
<a href="/jobs">Transform: <%= job.resource.name %></a>
|
98
98
|
<%- elsif job.scenario -%>
|
99
99
|
<a href="/jobs">Run: <%= job.scenario.name %></a>
|
100
|
+
<%- elsif job.import -%>
|
101
|
+
<a href="/jobs">Import: <%= job.import.name %></a>
|
100
102
|
<%- end -%>
|
101
103
|
</li>
|
102
104
|
<%- end -%>
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: coupler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.8
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- Jeremy Stephens
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-08-16 00:00:00 -05:00
|
14
14
|
default_executable: coupler
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -293,6 +293,10 @@ files:
|
|
293
293
|
- db/migrate/021_add_fields_to_connections.rb
|
294
294
|
- db/migrate/022_remove_database_name_from_resources.rb
|
295
295
|
- db/migrate/023_add_import_jobs.rb
|
296
|
+
- db/migrate/024_add_error_msg_to_jobs.rb
|
297
|
+
- db/migrate/025_add_notifications.rb
|
298
|
+
- db/migrate/026_add_status_to_resources.rb
|
299
|
+
- db/migrate/027_add_notification_id_to_jobs.rb
|
296
300
|
- features/connections.feature
|
297
301
|
- features/matchers.feature
|
298
302
|
- features/projects.feature
|
@@ -320,6 +324,7 @@ files:
|
|
320
324
|
- lib/coupler/extensions/imports.rb
|
321
325
|
- lib/coupler/extensions/jobs.rb
|
322
326
|
- lib/coupler/extensions/matchers.rb
|
327
|
+
- lib/coupler/extensions/notifications.rb
|
323
328
|
- lib/coupler/extensions/projects.rb
|
324
329
|
- lib/coupler/extensions/resources.rb
|
325
330
|
- lib/coupler/extensions/results.rb
|
@@ -338,6 +343,7 @@ files:
|
|
338
343
|
- lib/coupler/models/job.rb
|
339
344
|
- lib/coupler/models/jobify.rb
|
340
345
|
- lib/coupler/models/matcher.rb
|
346
|
+
- lib/coupler/models/notification.rb
|
341
347
|
- lib/coupler/models/project.rb
|
342
348
|
- lib/coupler/models/resource.rb
|
343
349
|
- lib/coupler/models/result.rb
|
@@ -372,6 +378,7 @@ files:
|
|
372
378
|
- test/functional/test_imports.rb
|
373
379
|
- test/functional/test_jobs.rb
|
374
380
|
- test/functional/test_matchers.rb
|
381
|
+
- test/functional/test_notifications.rb
|
375
382
|
- test/functional/test_projects.rb
|
376
383
|
- test/functional/test_resources.rb
|
377
384
|
- test/functional/test_results.rb
|
@@ -392,6 +399,7 @@ files:
|
|
392
399
|
- test/unit/models/test_import.rb
|
393
400
|
- test/unit/models/test_job.rb
|
394
401
|
- test/unit/models/test_matcher.rb
|
402
|
+
- test/unit/models/test_notification.rb
|
395
403
|
- test/unit/models/test_project.rb
|
396
404
|
- test/unit/models/test_resource.rb
|
397
405
|
- test/unit/models/test_result.rb
|
@@ -476,6 +484,7 @@ files:
|
|
476
484
|
- webroot/views/layout.erb
|
477
485
|
- webroot/views/matchers/form.erb
|
478
486
|
- webroot/views/matchers/list.erb
|
487
|
+
- webroot/views/notifications/index.erb
|
479
488
|
- webroot/views/projects/form.erb
|
480
489
|
- webroot/views/projects/index.erb
|
481
490
|
- webroot/views/projects/show.erb
|