coupler 0.0.1-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (258) hide show
  1. data/.document +5 -0
  2. data/.gitmodules +3 -0
  3. data/.rvmrc +1 -0
  4. data/.vimrc +40 -0
  5. data/Gemfile +27 -0
  6. data/Gemfile.lock +71 -0
  7. data/LICENSE +20 -0
  8. data/NOTES +6 -0
  9. data/README.rdoc +18 -0
  10. data/Rakefile +42 -0
  11. data/TODO +11 -0
  12. data/VERSION +1 -0
  13. data/bin/coupler +7 -0
  14. data/db/.gitignore +6 -0
  15. data/db/migrate/001_initial_schema.rb +166 -0
  16. data/db/migrate/002_stub.rb +4 -0
  17. data/db/migrate/003_stub.rb +4 -0
  18. data/db/migrate/004_create_comparisons.rb +28 -0
  19. data/db/migrate/005_move_database_name.rb +19 -0
  20. data/db/migrate/006_upgrade_comparisons.rb +34 -0
  21. data/db/migrate/007_add_which_to_comparisons.rb +23 -0
  22. data/db/migrate/008_add_result_field_to_transformations.rb +33 -0
  23. data/db/migrate/009_add_generated_flag_to_fields.rb +13 -0
  24. data/db/migrate/010_create_imports.rb +24 -0
  25. data/db/migrate/011_add_primary_key_type.rb +13 -0
  26. data/db/migrate/012_add_transformed_with_to_resources.rb +13 -0
  27. data/db/migrate/013_add_run_count_to_scenarios.rb +13 -0
  28. data/db/migrate/014_add_last_accessed_at_to_some_tables.rb +13 -0
  29. data/db/migrate/015_add_run_number_to_results.rb +15 -0
  30. data/db/migrate/016_fix_scenario_run_count.rb +27 -0
  31. data/db/migrate/017_rename_comparison_columns.rb +14 -0
  32. data/db/migrate/018_fix_scenario_linkage_type.rb +8 -0
  33. data/db/migrate/019_add_columns_to_imports.rb +24 -0
  34. data/db/migrate/020_rename_import_columns.rb +12 -0
  35. data/db/migrate/021_add_fields_to_connections.rb +15 -0
  36. data/db/migrate/022_remove_database_name_from_resources.rb +11 -0
  37. data/features/connections.feature +28 -0
  38. data/features/matchers.feature +35 -0
  39. data/features/projects.feature +11 -0
  40. data/features/resources.feature +62 -0
  41. data/features/scenarios.feature +45 -0
  42. data/features/step_definitions/coupler_steps.rb +145 -0
  43. data/features/step_definitions/matchers_steps.rb +26 -0
  44. data/features/step_definitions/resources_steps.rb +12 -0
  45. data/features/step_definitions/scenarios_steps.rb +7 -0
  46. data/features/step_definitions/transformations_steps.rb +3 -0
  47. data/features/support/env.rb +128 -0
  48. data/features/transformations.feature +22 -0
  49. data/features/wizard.feature +10 -0
  50. data/gfx/coupler-header.svg +213 -0
  51. data/gfx/coupler-sidebar.svg +656 -0
  52. data/gfx/coupler.svg +184 -0
  53. data/gfx/icon.svg +75 -0
  54. data/lib/coupler/base.rb +63 -0
  55. data/lib/coupler/config.rb +128 -0
  56. data/lib/coupler/data_uploader.rb +20 -0
  57. data/lib/coupler/database.rb +31 -0
  58. data/lib/coupler/extensions/connections.rb +57 -0
  59. data/lib/coupler/extensions/exceptions.rb +58 -0
  60. data/lib/coupler/extensions/imports.rb +43 -0
  61. data/lib/coupler/extensions/jobs.rb +21 -0
  62. data/lib/coupler/extensions/matchers.rb +64 -0
  63. data/lib/coupler/extensions/projects.rb +62 -0
  64. data/lib/coupler/extensions/resources.rb +89 -0
  65. data/lib/coupler/extensions/results.rb +100 -0
  66. data/lib/coupler/extensions/scenarios.rb +50 -0
  67. data/lib/coupler/extensions/transformations.rb +70 -0
  68. data/lib/coupler/extensions/transformers.rb +58 -0
  69. data/lib/coupler/extensions.rb +16 -0
  70. data/lib/coupler/helpers.rb +121 -0
  71. data/lib/coupler/import_buffer.rb +48 -0
  72. data/lib/coupler/logger.rb +16 -0
  73. data/lib/coupler/models/common_model.rb +104 -0
  74. data/lib/coupler/models/comparison.rb +166 -0
  75. data/lib/coupler/models/connection.rb +59 -0
  76. data/lib/coupler/models/field.rb +55 -0
  77. data/lib/coupler/models/import.rb +238 -0
  78. data/lib/coupler/models/job.rb +42 -0
  79. data/lib/coupler/models/jobify.rb +17 -0
  80. data/lib/coupler/models/matcher.rb +36 -0
  81. data/lib/coupler/models/project.rb +40 -0
  82. data/lib/coupler/models/resource.rb +287 -0
  83. data/lib/coupler/models/result.rb +92 -0
  84. data/lib/coupler/models/scenario/runner.rb +357 -0
  85. data/lib/coupler/models/scenario.rb +115 -0
  86. data/lib/coupler/models/transformation.rb +117 -0
  87. data/lib/coupler/models/transformer/runner.rb +28 -0
  88. data/lib/coupler/models/transformer.rb +110 -0
  89. data/lib/coupler/models.rb +30 -0
  90. data/lib/coupler/runner.rb +76 -0
  91. data/lib/coupler/scheduler.rb +56 -0
  92. data/lib/coupler.rb +34 -0
  93. data/log/.gitignore +1 -0
  94. data/misc/README +5 -0
  95. data/misc/jruby-json.license +57 -0
  96. data/misc/rack-flash.license +22 -0
  97. data/script/dbconsole.rb +5 -0
  98. data/src/edu/vanderbilt/coupler/Main.java +116 -0
  99. data/src/edu/vanderbilt/coupler/jruby.properties +1 -0
  100. data/tasks/annotations.rake +84 -0
  101. data/tasks/db.rake +120 -0
  102. data/tasks/environment.rake +12 -0
  103. data/tasks/jeweler.rake +43 -0
  104. data/tasks/package.rake +58 -0
  105. data/tasks/rdoc.rake +13 -0
  106. data/tasks/test.rake +63 -0
  107. data/tasks/vendor.rake +43 -0
  108. data/test/README.txt +6 -0
  109. data/test/config.yml +9 -0
  110. data/test/coupler/models/test_import.rb +221 -0
  111. data/test/factories.rb +91 -0
  112. data/test/fixtures/duplicate-keys.csv +5 -0
  113. data/test/fixtures/no-headers.csv +50 -0
  114. data/test/fixtures/people.csv +51 -0
  115. data/test/fixtures/varying-row-size.csv +4 -0
  116. data/test/helper.rb +156 -0
  117. data/test/integration/extensions/test_connections.rb +80 -0
  118. data/test/integration/extensions/test_imports.rb +94 -0
  119. data/test/integration/extensions/test_jobs.rb +52 -0
  120. data/test/integration/extensions/test_matchers.rb +134 -0
  121. data/test/integration/extensions/test_projects.rb +82 -0
  122. data/test/integration/extensions/test_resources.rb +150 -0
  123. data/test/integration/extensions/test_results.rb +89 -0
  124. data/test/integration/extensions/test_scenarios.rb +88 -0
  125. data/test/integration/extensions/test_transformations.rb +113 -0
  126. data/test/integration/extensions/test_transformers.rb +80 -0
  127. data/test/integration/test_field.rb +45 -0
  128. data/test/integration/test_import.rb +78 -0
  129. data/test/integration/test_running_scenarios.rb +379 -0
  130. data/test/integration/test_transformation.rb +56 -0
  131. data/test/integration/test_transforming.rb +154 -0
  132. data/test/table_sets.rb +76 -0
  133. data/test/unit/models/test_common_model.rb +130 -0
  134. data/test/unit/models/test_comparison.rb +619 -0
  135. data/test/unit/models/test_connection.rb +115 -0
  136. data/test/unit/models/test_field.rb +99 -0
  137. data/test/unit/models/test_import.rb +130 -0
  138. data/test/unit/models/test_job.rb +115 -0
  139. data/test/unit/models/test_matcher.rb +82 -0
  140. data/test/unit/models/test_project.rb +102 -0
  141. data/test/unit/models/test_resource.rb +564 -0
  142. data/test/unit/models/test_result.rb +90 -0
  143. data/test/unit/models/test_scenario.rb +199 -0
  144. data/test/unit/models/test_transformation.rb +193 -0
  145. data/test/unit/models/test_transformer.rb +188 -0
  146. data/test/unit/test_base.rb +60 -0
  147. data/test/unit/test_data_uploader.rb +27 -0
  148. data/test/unit/test_database.rb +23 -0
  149. data/test/unit/test_helpers.rb +58 -0
  150. data/test/unit/test_logger.rb +10 -0
  151. data/test/unit/test_models.rb +12 -0
  152. data/test/unit/test_runner.rb +76 -0
  153. data/test/unit/test_scheduler.rb +66 -0
  154. data/uploads/.gitignore +2 -0
  155. data/vendor/java/.gitignore +5 -0
  156. data/webroot/public/css/960.css +1 -0
  157. data/webroot/public/css/dataTables.css +1057 -0
  158. data/webroot/public/css/jquery-ui.css +572 -0
  159. data/webroot/public/css/jquery.treeview.css +68 -0
  160. data/webroot/public/css/reset.css +1 -0
  161. data/webroot/public/css/style.css +504 -0
  162. data/webroot/public/css/text.css +1 -0
  163. data/webroot/public/favicon.ico +0 -0
  164. data/webroot/public/images/12_col.gif +0 -0
  165. data/webroot/public/images/16_col.gif +0 -0
  166. data/webroot/public/images/add.png +0 -0
  167. data/webroot/public/images/ajax-loader.gif +0 -0
  168. data/webroot/public/images/cog.png +0 -0
  169. data/webroot/public/images/coupler.png +0 -0
  170. data/webroot/public/images/foo.png +0 -0
  171. data/webroot/public/images/hammer.png +0 -0
  172. data/webroot/public/images/header.png +0 -0
  173. data/webroot/public/images/home.gif +0 -0
  174. data/webroot/public/images/jobs.gif +0 -0
  175. data/webroot/public/images/sidebar-bottom.png +0 -0
  176. data/webroot/public/images/sidebar.png +0 -0
  177. data/webroot/public/images/treeview-default-line.gif +0 -0
  178. data/webroot/public/images/treeview-default.gif +0 -0
  179. data/webroot/public/images/ui-anim_basic_16x16.gif +0 -0
  180. data/webroot/public/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  181. data/webroot/public/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  182. data/webroot/public/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  183. data/webroot/public/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  184. data/webroot/public/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  185. data/webroot/public/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  186. data/webroot/public/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  187. data/webroot/public/images/ui-bg_highlight-hard_30_565356_1x100.png +0 -0
  188. data/webroot/public/images/ui-bg_highlight-hard_75_888588_1x100.png +0 -0
  189. data/webroot/public/images/ui-bg_highlight-soft_30_6e3b3a_1x100.png +0 -0
  190. data/webroot/public/images/ui-bg_highlight-soft_35_8e8b8e_1x100.png +0 -0
  191. data/webroot/public/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  192. data/webroot/public/images/ui-icons_222222_256x240.png +0 -0
  193. data/webroot/public/images/ui-icons_2e83ff_256x240.png +0 -0
  194. data/webroot/public/images/ui-icons_454545_256x240.png +0 -0
  195. data/webroot/public/images/ui-icons_888888_256x240.png +0 -0
  196. data/webroot/public/images/ui-icons_cd0a0a_256x240.png +0 -0
  197. data/webroot/public/images/ui-icons_ffffff_256x240.png +0 -0
  198. data/webroot/public/js/ajaxupload.js +673 -0
  199. data/webroot/public/js/application.js +40 -0
  200. data/webroot/public/js/jquery-ui.combobox.js +98 -0
  201. data/webroot/public/js/jquery-ui.js +9867 -0
  202. data/webroot/public/js/jquery-ui.min.js +559 -0
  203. data/webroot/public/js/jquery.dataTables.min.js +587 -0
  204. data/webroot/public/js/jquery.min.js +154 -0
  205. data/webroot/public/js/jquery.timeago.js +140 -0
  206. data/webroot/public/js/jquery.tooltip.min.js +19 -0
  207. data/webroot/public/js/jquery.treeview.min.js +15 -0
  208. data/webroot/public/js/resource.js +11 -0
  209. data/webroot/public/js/results.js +56 -0
  210. data/webroot/public/js/transformations.js +95 -0
  211. data/webroot/views/connections/index.erb +5 -0
  212. data/webroot/views/connections/list.erb +34 -0
  213. data/webroot/views/connections/new.erb +55 -0
  214. data/webroot/views/connections/show.erb +36 -0
  215. data/webroot/views/imports/edit.erb +60 -0
  216. data/webroot/views/imports/form.erb +81 -0
  217. data/webroot/views/imports/new.erb +89 -0
  218. data/webroot/views/index.erb +12 -0
  219. data/webroot/views/jobs/index.erb +7 -0
  220. data/webroot/views/jobs/list.erb +24 -0
  221. data/webroot/views/layout.erb +38 -0
  222. data/webroot/views/matchers/form.erb +250 -0
  223. data/webroot/views/matchers/list.erb +32 -0
  224. data/webroot/views/projects/form.erb +14 -0
  225. data/webroot/views/projects/index.erb +96 -0
  226. data/webroot/views/projects/show.erb +24 -0
  227. data/webroot/views/resources/edit.erb +88 -0
  228. data/webroot/views/resources/index.erb +5 -0
  229. data/webroot/views/resources/list.erb +27 -0
  230. data/webroot/views/resources/new.erb +121 -0
  231. data/webroot/views/resources/show.erb +86 -0
  232. data/webroot/views/resources/transform.erb +2 -0
  233. data/webroot/views/results/csv.erb +12 -0
  234. data/webroot/views/results/details.erb +15 -0
  235. data/webroot/views/results/index.erb +2 -0
  236. data/webroot/views/results/list.erb +22 -0
  237. data/webroot/views/results/record.erb +24 -0
  238. data/webroot/views/results/show.erb +68 -0
  239. data/webroot/views/scenarios/index.erb +5 -0
  240. data/webroot/views/scenarios/list.erb +20 -0
  241. data/webroot/views/scenarios/new.erb +99 -0
  242. data/webroot/views/scenarios/run.erb +2 -0
  243. data/webroot/views/scenarios/show.erb +50 -0
  244. data/webroot/views/sidebar.erb +106 -0
  245. data/webroot/views/transformations/create.erb +115 -0
  246. data/webroot/views/transformations/for.erb +16 -0
  247. data/webroot/views/transformations/index.erb +2 -0
  248. data/webroot/views/transformations/list.erb +29 -0
  249. data/webroot/views/transformations/new.erb +126 -0
  250. data/webroot/views/transformations/preview.erb +46 -0
  251. data/webroot/views/transformers/edit.erb +6 -0
  252. data/webroot/views/transformers/form.erb +58 -0
  253. data/webroot/views/transformers/index.erb +2 -0
  254. data/webroot/views/transformers/list.erb +25 -0
  255. data/webroot/views/transformers/new.erb +5 -0
  256. data/webroot/views/transformers/preview.erb +23 -0
  257. data/webroot/views/transformers/show.erb +0 -0
  258. metadata +558 -0
@@ -0,0 +1,95 @@
1
+ function previewTransformation() {
2
+ $('#transformation-preview').html('');
3
+ $('#spinner').show();
4
+ $('#transformation-result').fadeIn('fast');
5
+ $.post(previewUrl, $('form').serialize(), function(data, status, xhr) {
6
+ $('#spinner').hide();
7
+ $('#transformation-preview').html(data);
8
+ }, 'html');
9
+ }
10
+ $.fn.disableInputs = function() {
11
+ this.find(':input').attr('disabled', true);
12
+ return this;
13
+ }
14
+ $.fn.enableInputs = function() {
15
+ this.find(':input').removeAttr('disabled');
16
+ return this;
17
+ }
18
+ $(function() {
19
+ $('#source_field_id').combobox().change(function() {
20
+ var source_field_id = $(this).val();
21
+ $('input[name=transformation\\[source_field_id\\]]').val(source_field_id);
22
+
23
+ var field = fields[source_field_id];
24
+ $('#source-field-name').html(field.name);
25
+ $('#field-type').html(field.type);
26
+ $('#field-db-type').html(field.db_type);
27
+ $('#field-info').fadeIn('fast');
28
+ $('#result-field-same').val(source_field_id);
29
+
30
+ /* populate transformer select box */
31
+ var sel = $('#transformer_id').html('<option></option>');
32
+ var empty = true;
33
+ $.each(transformers, function(id, transformer) {
34
+ if ($.inArray(field.type, transformer.allowed_types) >= 0) {
35
+ $('<option></option>')
36
+ .attr('value', id)
37
+ .html(transformer.name)
38
+ .appendTo(sel);
39
+ empty = false;
40
+ }
41
+ });
42
+ if (empty) {
43
+ $('#transformer-attributes').enableInputs().show();
44
+ $('#result-field-selection').enableInputs().fadeIn('fast');
45
+ }
46
+ else {
47
+ $('#transformer-select').enableInputs().show();
48
+ }
49
+ $('#transformer').fadeIn('fast');
50
+ });
51
+ $('#transformer_id').combobox().change(function() {
52
+ var transformer_id = $(this).val();
53
+ $('input[name=transformation\\[transformer_id\\]]').val(transformer_id);
54
+
55
+ var transformer = transformers[transformer_id];
56
+ $('#transformer-name').html(transformer.name);
57
+ $('#transformer-result-type').html(transformer.result_type);
58
+ $('#transformer-info').fadeIn('fast');
59
+ $('#result-field-selection').enableInputs().fadeIn('fast');
60
+ });
61
+ $('#create-transformer').button().click(function(e) {
62
+ $('input[name=transformation\\[transformer_id\\]]').val('');
63
+ $('#transformer-select').disableInputs().fadeOut('fast', function() {
64
+ $('#transformer-attributes').enableInputs().fadeIn('fast');
65
+ $('#result-field-selection').enableInputs().fadeIn('fast');
66
+ });
67
+ e.preventDefault();
68
+ });
69
+ $('input[name=transformation\\[result_field_id\\]]').change(function() {
70
+ var val = $(this).val();
71
+ if (val) {
72
+ $('#result-field-attributes').disableInputs().hide();
73
+ previewTransformation();
74
+ }
75
+ else {
76
+ $('#result-field-attributes').enableInputs().fadeIn('fast');
77
+ if ($('#result-field-name').val()) {
78
+ previewTransformation();
79
+ }
80
+ else {
81
+ $('#transformation-result').hide();
82
+ }
83
+ }
84
+ $('#preview-button').show();
85
+ });
86
+ $('#preview-button button').button().click(function(e) {
87
+ previewTransformation();
88
+ e.preventDefault();
89
+ });
90
+ $('#transformer-code').change(function() {
91
+ if ($('#transformation-result').is(':visible')) {
92
+ previewTransformation();
93
+ }
94
+ });
95
+ });
@@ -0,0 +1,5 @@
1
+ <%- @breadcrumbs = ["Connections"] -%>
2
+ <%= erb(:"connections/list", :layout => false) %>
3
+ <p>
4
+ <a href="/connections/new">New Connection</a>
5
+ </p>
@@ -0,0 +1,34 @@
1
+ <% if @connections.empty? %>
2
+ <p>There are currently no connections.</p>
3
+ <% else %>
4
+ <table class="list">
5
+ <thead>
6
+ <tr>
7
+ <th>Name</th>
8
+ <th>Adapter</th>
9
+ <th>Host</th>
10
+ <th>Port</th>
11
+ <th>Username</th>
12
+ <th>Database</th>
13
+ <th></th>
14
+ </tr>
15
+ </thead>
16
+ <tbody>
17
+ <% @connections.each do |connection| %>
18
+ <tr<%= cycle('', ' class="alt"') %>>
19
+ <td><a href="/connections/<%= connection.id %>"><%= connection.name %></a></td>
20
+ <td><%= connection.adapter %></td>
21
+ <td><%= connection.host %></td>
22
+ <td><%= connection.port %></td>
23
+ <td><%= connection.username %></td>
24
+ <td><%= connection.database_name %></td>
25
+ <td>
26
+ <%- if connection.deletable? -%>
27
+ <%= delete_link("<span class='ui-icon ui-icon-trash'></span>", "/connections/#{connection.id}") %>
28
+ <%- end -%>
29
+ </td>
30
+ </tr>
31
+ <% end %>
32
+ </tbody>
33
+ </table>
34
+ <% end %>
@@ -0,0 +1,55 @@
1
+ <% @breadcrumbs = [@connection] %>
2
+ <%= error_messages_for @connection %>
3
+ <form method="post" action="/connections">
4
+ <table class="form">
5
+ <tr>
6
+ <td class="left"><label for="name">Name</label></td>
7
+ <td>
8
+ <input id="name" name="connection[name]" type="text" value="<%= @connection.name %>" />
9
+ </td>
10
+ </tr>
11
+ <tr class="alt">
12
+ <td class="left"><label for="adapter">Type</label></td>
13
+ <td>
14
+ <select id="adapter" name="connection[adapter]">
15
+ <% Coupler::Models::Connection::ADAPTERS.each do |(value, label)| %>
16
+ <option value="<%= value %>"<%= ' selected="selected"' if @connection.adapter == value %>><%= label %></option>
17
+ <% end %>
18
+ </select>
19
+ </td>
20
+ </tr>
21
+ <tr>
22
+ <td class="left"><label for="host">Host</label></td>
23
+ <td>
24
+ <input id="host" name="connection[host]" type="text" value="<%= @connection.host %>" />
25
+ </td>
26
+ </tr>
27
+ <tr class="alt">
28
+ <td class="left"><label for="port">Port</label></td>
29
+ <td>
30
+ <input id="port" name="connection[port]" type="text" value="<%= @connection.port %>" />
31
+ </td>
32
+ </tr>
33
+ <tr>
34
+ <td class="left"><label for="username">Username</label></td>
35
+ <td>
36
+ <input id="username" name="connection[username]" type="text" value="<%= @connection.username %>" />
37
+ </td>
38
+ </tr>
39
+ <tr class="alt">
40
+ <td class="left"><label for="password">Password</label><br/></td>
41
+ <td>
42
+ <input id="password" name="connection[password]" type="password" value="<%= @connection.password %>" />
43
+ </td>
44
+ </tr>
45
+ <tr>
46
+ <td class="left"><label for="database_name">Database</label></td>
47
+ <td>
48
+ <input id="database_name" name="connection[database_name]" type="text" value="<%= @connection.database_name %>" />
49
+ </td>
50
+ </tr>
51
+ </table>
52
+ <p>
53
+ <input type="submit" value="Submit" /> or <a href="/connections">Cancel</a>
54
+ </p>
55
+ </form>
@@ -0,0 +1,36 @@
1
+ <% @breadcrumbs = [@connection] %>
2
+
3
+ <table class="show">
4
+ <tr>
5
+ <td class="col1">Name</td>
6
+ <td><%= @connection.name %></td>
7
+ </tr>
8
+ <tr>
9
+ <td class="col1">Adapter</td>
10
+ <td><%= @connection.adapter %></td>
11
+ </tr>
12
+ <tr>
13
+ <td class="col1">Host</td>
14
+ <td><%= @connection.host %></td>
15
+ </tr>
16
+ <tr>
17
+ <td class="col1">Port</td>
18
+ <td><%= @connection.port %></td>
19
+ </tr>
20
+ <tr>
21
+ <td class="col1">Username</td>
22
+ <td><%= @connection.username %></td>
23
+ </tr>
24
+ <tr>
25
+ <td class="col1">Database</td>
26
+ <td><%= @connection.database_name %></td>
27
+ </tr>
28
+ </table>
29
+
30
+ <h2>Related Resources</h2>
31
+ <div class="section">
32
+ <%- @hide_connection = true -%>
33
+ <%= erb(:'resources/list', :layout => false) %>
34
+ </div>
35
+
36
+ <a href="/connections">Back to connections</a>
@@ -0,0 +1,60 @@
1
+ <% @breadcrumbs = [@project, @import, 'Edit'] %>
2
+ <%- add_javascript('jquery.dataTables.min.js') -%>
3
+ <%- add_stylesheet('dataTables.css') -%>
4
+ <%= error_messages_for @import %>
5
+
6
+ <style type="text/css">
7
+ #keylist thead tr.one th { border: 1px gray; border-style: solid none solid solid; }
8
+ #keylist thead tr.one th.two { vertical-align: middle; border-width: 1px 1px 2px 1px; border-style: solid; }
9
+
10
+ #keylist thead tr.two th { border-color: gray; border-width: 0 0 2px 0px; border-style: none none solid none; }
11
+ #keylist thead tr.two th.one { border-width: 0 0 2px 1px; border-style: none none solid solid; }
12
+
13
+ #keylist tbody tr { border: 1px gray; border-style: none solid; }
14
+ #keylist tbody tr.bottom { border-style: none solid solid solid; }
15
+ #keylist tbody tr td.choice { text-align: center; border: 1px gray; border-style: none solid; }
16
+
17
+ #keylist input.text { width: 50px; }
18
+ </style>
19
+ <%- if @import.has_duplicate_keys -%>
20
+ <h2>Duplicate Keys</h2>
21
+ <div class="section">
22
+ <p>There were some records in your dataset with duplicate keys. If any
23
+ rows are legitimate duplicates, you can check the box to have the row
24
+ removed. Otherwise, new keys will be automatically generated.</p>
25
+
26
+ <%- @import.dataset do |ds| -%>
27
+ <%- primary_key = @import.primary_key_sym -%>
28
+ <%- ds = ds.filter(~{:dup_key_count => nil}).order(primary_key, :dup_key_count) -%>
29
+ <form action="/projects/<%= @project.id %>/imports/<%= @import.id %>" method="post">
30
+ <input type="hidden" name="_method" value="put" />
31
+ <table id="keylist" class="list">
32
+ <thead>
33
+ <tr class="one">
34
+ <th class="one" colspan="<%= @import.field_names.length %>">Current Values</th>
35
+ <th class="two" rowspan="2">Remove<br/>Row</th>
36
+ </tr>
37
+ <tr class="two">
38
+ <%- @import.field_names.each_with_index do |name, i| -%>
39
+ <th<%= %{ class="one"} if i == 0 %>><%= name %></th>
40
+ <%- end -%>
41
+ </tr>
42
+ </thead>
43
+ <tbody>
44
+ <%- count = ds.count -%>
45
+ <%- ds.each_with_index do |row, i| -%>
46
+ <%- klasses = []; klasses << 'alt' if i % 2 == 1; klasses << "bottom" if i == count - 1 -%>
47
+ <tr<%= %{ class="#{klasses.join(" ")}"} if !klasses.empty? %>>
48
+ <%- @import.field_names.each do |name| -%>
49
+ <td><%= row[name.to_sym] %></td>
50
+ <%- end -%>
51
+ <td class="choice"><input type="checkbox" name="delete[<%= row[primary_key] %>][]" value="<%= row[:dup_key_count] %>" /></td>
52
+ </tr>
53
+ <%- end -%>
54
+ </tbody>
55
+ </table>
56
+ <input type="submit" value="Submit" />
57
+ </form>
58
+ <%- end -%>
59
+ </div>
60
+ <%- end -%>
@@ -0,0 +1,81 @@
1
+ <form action="/projects/<%= @project.id %>/imports/<%= @import.id %>" method="post">
2
+ <div style="display: none;"><input type="hidden" name="_method" value="put" /></div>
3
+ <p>
4
+ <label for="name"><strong>Name:</strong></label>
5
+ <input id="name" type="text" name="import[name]" value="<%= @import.name %>" />
6
+ </p>
7
+
8
+ <h3>Fields</h3>
9
+ <div class="section">
10
+ <p>
11
+ Change the field types below if they are incorrect, then click the <strong>Begin Importing</strong> button.
12
+ </p>
13
+ <table class="list">
14
+ <thead>
15
+ <tr>
16
+ <th>Name</th>
17
+ <th>Type</th>
18
+ <th>Key</th>
19
+ </tr>
20
+ </thead>
21
+ <tbody>
22
+ <%- @import.field_types.each_with_index do |field_type, i| -%>
23
+ <%- field_name = @import.field_names ? @import.field_names[i] : nil -%>
24
+ <tr<%= " class='alt'" if i % 2 == 1 %>>
25
+ <td><input id="field-name-<%= i %>" class="field-name" name="import[field_names][]" value="<%= field_name %>" /></td>
26
+ <td>
27
+ <select id="field-type-<%= i %>" name="import[field_types][]">
28
+ <%- %w{string integer datetime boolean float enum}.each do |type| -%>
29
+ <option<%= ' selected="selected"' if type == field_type %>><%= type %></option>
30
+ <%- end -%>
31
+ </select>
32
+ </td>
33
+ <td>
34
+ <input id="field-key-<%= i %>" type="radio" name="import[primary_key_name]" value="<%= field_name %>" <%= 'checked="checked"' if field_name && field_name == @import.primary_key_name %> />
35
+ </td>
36
+ </tr>
37
+ <%- end -%>
38
+ </tbody>
39
+ </table>
40
+ </div>
41
+
42
+ <h3>Data Preview</h3>
43
+ <div class="section">
44
+ <table id="data-preview" class="dataTable">
45
+ <thead>
46
+ <tr>
47
+ <%- if @import.field_names -%>
48
+ <%- @import.field_names.each do |name| -%>
49
+ <th><%= name %></th>
50
+ <%- end -%>
51
+ <%- else -%>
52
+ <%- @import.field_types.each_index do |i| -%>
53
+ <th>Field <%= i+1 %></th>
54
+ <%- end -%>
55
+ <%- end -%>
56
+ </tr>
57
+ </thead>
58
+ <tbody>
59
+ <%- @import.preview.each_with_index do |row, i| -%>
60
+ <tr>
61
+ <%- row.each do |value| -%>
62
+ <td><%=h value %></td>
63
+ <%- end -%>
64
+ <%- end -%>
65
+ </tbody>
66
+ </table>
67
+ </div>
68
+ <p>
69
+ <input type="submit" value="Begin Importing" />
70
+ </p>
71
+ </form>
72
+
73
+ <script type="text/javascript">
74
+ $(function() {
75
+ $('#data-preview').dataTable({ bJQueryUI: true, aLengthMenu: [10, 25, 50] });
76
+ $('.field-name').change(function() {
77
+ var obj = $(this);
78
+ $('#'+obj.attr('id').replace('name', 'key')).val(obj.val());
79
+ });
80
+ });
81
+ </script>
@@ -0,0 +1,89 @@
1
+ <% @breadcrumbs = [@project, "CSV Import"] %>
2
+ <%- add_javascript('jquery.dataTables.min.js') -%>
3
+ <%- add_stylesheet('dataTables.css') -%>
4
+
5
+ <form action="/projects/<%= @project.id %>/imports" method="post">
6
+ <input type="hidden" name="import[data_cache]" value="<%= @import.data_cache %>" />
7
+ <p>
8
+ <label for="name"><strong>Name:</strong></label>
9
+ <input id="name" type="text" name="import[name]" value="<%= @import.name %>" />
10
+ </p>
11
+
12
+ <h3>Fields</h3>
13
+ <div class="section">
14
+ <p>
15
+ Change the field types below if they are incorrect, then click the <strong>Begin Importing</strong> button.
16
+ </p>
17
+ <table class="list">
18
+ <thead>
19
+ <tr>
20
+ <th>Name</th>
21
+ <th>Type</th>
22
+ <th>Key</th>
23
+ </tr>
24
+ </thead>
25
+ <tbody>
26
+ <%- @import.field_types.each_with_index do |field_type, i| -%>
27
+ <%- field_name = @import.field_names ? @import.field_names[i] : nil -%>
28
+ <tr<%= " class='alt'" if i % 2 == 1 %>>
29
+ <td><input id="field-name-<%= i %>" class="field-name" name="import[field_names][]" value="<%= field_name %>" /></td>
30
+ <td>
31
+ <select id="field-type-<%= i %>" name="import[field_types][]">
32
+ <%- %w{string integer datetime boolean float enum}.each do |type| -%>
33
+ <option<%= ' selected="selected"' if type == field_type %>><%= type %></option>
34
+ <%- end -%>
35
+ </select>
36
+ </td>
37
+ <td>
38
+ <input id="field-key-<%= i %>" type="radio" name="import[primary_key_name]" value="<%= field_name %>" <%= 'checked="checked"' if field_name && field_name == @import.primary_key_name %> />
39
+ </td>
40
+ </tr>
41
+ <%- end -%>
42
+ </tbody>
43
+ </table>
44
+ <p>
45
+ <input id="import_has_headers" type="checkbox" name="import[has_headers]" <%= 'checked="checked"' if @import.has_headers %> />
46
+ <label for="import_has_headers">Has header row?</label>
47
+ </p>
48
+ </div>
49
+
50
+ <h3>Data Preview</h3>
51
+ <div class="section">
52
+ <table id="data-preview" class="dataTable">
53
+ <thead>
54
+ <tr>
55
+ <%- if @import.field_names -%>
56
+ <%- @import.field_names.each do |name| -%>
57
+ <th><%= name %></th>
58
+ <%- end -%>
59
+ <%- else -%>
60
+ <%- @import.field_types.each_index do |i| -%>
61
+ <th>Field <%= i+1 %></th>
62
+ <%- end -%>
63
+ <%- end -%>
64
+ </tr>
65
+ </thead>
66
+ <tbody>
67
+ <%- @import.preview.each_with_index do |row, i| -%>
68
+ <tr>
69
+ <%- row.each do |value| -%>
70
+ <td><%=h value %></td>
71
+ <%- end -%>
72
+ <%- end -%>
73
+ </tbody>
74
+ </table>
75
+ </div>
76
+ <p>
77
+ <input type="submit" value="Begin Importing" />
78
+ </p>
79
+ </form>
80
+
81
+ <script type="text/javascript">
82
+ $(function() {
83
+ $('#data-preview').dataTable({ bJQueryUI: true, aLengthMenu: [10, 25, 50] });
84
+ $('.field-name').change(function() {
85
+ var obj = $(this);
86
+ $('#'+obj.attr('id').replace('name', 'key')).val(obj.val());
87
+ });
88
+ });
89
+ </script>
@@ -0,0 +1,12 @@
1
+ <h1>Welcome to Coupler!</h1>
2
+
3
+ <p>
4
+ Coupler is an application for linking your data.
5
+ </p>
6
+ <br/>
7
+
8
+ <h2>Getting Started</h2>
9
+
10
+ <p>
11
+ To get started, first you need to <a href="/projects/new">create a project</a>.
12
+ </p>
@@ -0,0 +1,7 @@
1
+ <% @breadcrumbs = ["Jobs"] %>
2
+
3
+ <% if @jobs.empty? %>
4
+ <p>There are currently no jobs scheduled.</p>
5
+ <% else %>
6
+ <%= erb(:'jobs/list', {:layout => false}, {:jobs => @jobs, :show_target => true}) %>
7
+ <% end %>
@@ -0,0 +1,24 @@
1
+ <table class="list">
2
+ <tr>
3
+ <th>Type</th>
4
+ <th>Status</th>
5
+ <% if show_target %><th>Target</th><% end %>
6
+ <th>Created</th>
7
+ </tr>
8
+ <% jobs.each_with_index do |job, i| %>
9
+ <tr<%= cycle("", " class='alt'") %>>
10
+ <td><%= job.name %></td>
11
+ <td><%= job.status %></td>
12
+ <%- if show_target -%>
13
+ <%- if job.resource -%>
14
+ <td><a href="/projects/<%= job.resource.project.id %>/resources/<%= job.resource.id %>"><%= job.resource.name %></a></td>
15
+ <%- elsif job.scenario -%>
16
+ <td><a href="/projects/<%= job.scenario.project.id %>/scenarios/<%= job.scenario.id %>"><%= job.scenario.name %></a></td>
17
+ <%- else -%>
18
+ <td>N/A</td>
19
+ <%- end -%>
20
+ <%- end -%>
21
+ <td><%= timeago(job.created_at) %></td>
22
+ </tr>
23
+ <% end %>
24
+ </table>
@@ -0,0 +1,38 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <title>Coupler</title>
6
+ <meta http-equiv="content-type" content="text/html;charset=utf-8" />
7
+ <meta http-equiv="Content-Style-Type" content="text/css" />
8
+ <%= stylesheet_links %>
9
+ <%= javascript_includes %>
10
+ </head>
11
+ <body>
12
+ <div id="main" class="container_16">
13
+
14
+ <div id="sidebar" class="grid_3">
15
+ <%= erb(:sidebar, :layout => false) %>
16
+ </div>
17
+
18
+ <div id="content" class="grid_13">
19
+ <%= breadcrumbs %>
20
+ <div class="inner">
21
+ <%- if flash[:notice] -%>
22
+ <div id="notice"<%= " class='#{flash[:notice_class]}'" if flash[:notice_class] %>><%= flash[:notice] %></div>
23
+ <%- end -%>
24
+ <%= yield %>
25
+ </div>
26
+ </div>
27
+ <div class="clear"></div>
28
+
29
+ <div id="about">
30
+ <div class="text">
31
+ Coupler is open source software.<br/>
32
+ View the source <a href="http://github.com/coupler/coupler">here</a>.
33
+ </div>
34
+ </div>
35
+
36
+ </div>
37
+ </body>
38
+ </html>