From 0a210530d1c482af61d030a016fd80ac37e34546 Mon Sep 17 00:00:00 2001 From: Brennan Novak Date: Mon, 4 Nov 2019 10:59:27 -0500 Subject: [PATCH] None WORK-IP of Catalyst Basic builder #78 --- app/views/catalyst/basic.html.erb | 197 ++++++++++++++++++++++++++++++ app/views/catalyst/index.html.erb | 4 +- public/js/catalyst.js | 81 ++++++++++++ 3 files changed, 280 insertions(+), 2 deletions(-) create mode 100644 app/views/catalyst/basic.html.erb diff --git a/app/views/catalyst/basic.html.erb b/app/views/catalyst/basic.html.erb new file mode 100644 index 0000000..48cff3f --- /dev/null +++ b/app/views/catalyst/basic.html.erb @@ -0,0 +1,197 @@ + +
+ <%= render partial: 'catalyst/tabs' %> +
+ + + +
+

Name Your Job

+

You can run Catalyst text miners on all your documents or only a specific subset of narrowed down documents.

+
+
+ +
+
+ + + + + + <% document_type_list.each do |classname, human_name| %> + <% if ['ArchiveDoc'].include? classname %> + + + <% end %> + <% end %> + +
+
+
+
+

+

+
+ +
+

Select Text Miners

+

Choose what types of entities or text you want Catalyst to look for.

+
+
+
+ +
+ +
+
+
+ + + +
+
+
+
+
+ +<% document_type_list.each do |classname, human_name| %> + +<% end %> + + + + + + + + diff --git a/app/views/catalyst/index.html.erb b/app/views/catalyst/index.html.erb index 575ab43..1793957 100644 --- a/app/views/catalyst/index.html.erb +++ b/app/views/catalyst/index.html.erb @@ -12,9 +12,9 @@ <%= render partial: 'job', :locals => { :recipe => recipe } %> <% end %> <% else %> -

Yo, you aint go no mining gigs. Time to make one. +

You currently do not have any mining gigs. Time to make one.

- + Get Started <% end %> diff --git a/public/js/catalyst.js b/public/js/catalyst.js index 651814d..b516a19 100644 --- a/public/js/catalyst.js +++ b/public/js/catalyst.js @@ -72,6 +72,82 @@ var renderAnnotatorItems = function(annotators) { }) } +var renderAnnotatorConfigsBasic = function() { + $('#step-2').find('h3').html('Miners Selected') + $('#step-2').find('p').addClass('hide') + $('.annotator-item.default').addClass('hide') + $('#select-miners').addClass('hide') + + // Render Step3 + $('.annotator-item.selected').each(function(item, key) { + var annotator_name = $(key).find('input').attr('name') + for (item in annotators) { + if (annotators[item].classname == annotator_name) { + annotator = annotators[item] + break; + } + } + + var annotator_id = 'annotator-config-' + annotator_name + var params_id = 'annotator-params-' + annotator_name + var fields_id = 'annotator-fields-' + annotator_name + var html_fields = $('#template-' + $('#select-dataspec').val()).html() + var html_template = $('#template-annotator-config').html() + var html = html_template.replace(new RegExp('{{AID}}', 'g'), annotator_name) + + $('#annotator-configs').append(html) + $('#' + annotator_id).find('input[name=filter_icon]').val(annotator.default_icon) + $('#' + annotator_id).find('input[name=filter_name]').val(annotator.default_human_readable_label) + $('#' + fields_id).html(html_fields) + + var input_params = '' + if (annotator.input_params.output_display_type) { + input_params = '\ + \ + ' + } else if (annotator.input_params.term_list) { + input_params = '\ + \ + \ + \ + \ + ' + } else if (annotator.input_params.number_of_keywords) { + input_params = '\ + \ + ' + } + + $('#' + params_id).html(input_params) + }) + + $('#step-3').removeClass('hide') + + $('.annotator-terms-select').on('click', function(e) { + $('#modal-annotator-terms').modal('show') + }) +} + var renderAnnotatorConfigs = function() { // Update Step 2 $('#step-2').find('h3').html('Miners Selected') @@ -295,6 +371,11 @@ $(document).ready(function() { recipeSearch() }) + $('#select-miners-basic').on('click', function(e) { + e.preventDefault() + renderAnnotatorConfigsBasic() + }) + $('#select-miners').on('click', function(e) { e.preventDefault() renderAnnotatorConfigs()