diff --git a/app/assets/javascripts/app/controllers/_integration/exchange.coffee b/app/assets/javascripts/app/controllers/_integration/exchange.coffee index 26aaef204..5e6cd1843 100644 --- a/app/assets/javascripts/app/controllers/_integration/exchange.coffee +++ b/app/assets/javascripts/app/controllers/_integration/exchange.coffee @@ -187,6 +187,7 @@ class ConnectionWizard extends App.WizardModal elements: '.modal-body': 'body' '.js-foldersSelect': 'foldersSelect' + '.js-folders .js-submitTry': 'foldersSelectSubmit' '.js-userMappingForm': 'userMappingForm' '.js-expertForm': 'expertForm' @@ -321,6 +322,11 @@ class ConnectionWizard extends App.WizardModal nulloption: false options: options value: selected + onChange: (val) => + if val && val.length > 0 + @foldersSelectSubmit.removeClass('is-disabled') + else + @foldersSelectSubmit.addClass('is-disabled') ) mapping: (e) => diff --git a/app/assets/javascripts/app/lib/app_post/column_select.coffee b/app/assets/javascripts/app/lib/app_post/column_select.coffee index d58354f5d..728c2d499 100644 --- a/app/assets/javascripts/app/lib/app_post/column_select.coffee +++ b/app/assets/javascripts/app/lib/app_post/column_select.coffee @@ -33,6 +33,11 @@ class App.ColumnSelect extends Spine.Controller @select @pickedValue , 300, {trailing: false} + if @attribute.onChange + @shadow.on('change', => + @attribute.onChange(@shadow.val()) + ) + render: -> @values = [] _.each @options.attribute.options, (option) => diff --git a/app/assets/javascripts/app/views/integration/exchange_wizard.jst.eco b/app/assets/javascripts/app/views/integration/exchange_wizard.jst.eco index 25cdbcade..d1b5dc25f 100644 --- a/app/assets/javascripts/app/views/integration/exchange_wizard.jst.eco +++ b/app/assets/javascripts/app/views/integration/exchange_wizard.jst.eco @@ -115,7 +115,7 @@ <%- @T('Go Back') %> diff --git a/app/controllers/integration/exchange_controller.rb b/app/controllers/integration/exchange_controller.rb index 66e4ca30d..74d7f178c 100644 --- a/app/controllers/integration/exchange_controller.rb +++ b/app/controllers/integration/exchange_controller.rb @@ -33,15 +33,20 @@ class Integration::ExchangeController < ApplicationController def mapping answer_with do - Sequencer.process('Import::Exchange::AttributesExamples', - parameters: { - ews_folder_ids: params[:folders], - ews_config: { - endpoint: params[:endpoint], - user: params[:user], - password: params[:password], - } - }) + raise 'Please select at least one folder.' if params[:folders].blank? + + examples = Sequencer.process('Import::Exchange::AttributesExamples', + parameters: { + ews_folder_ids: params[:folders], + ews_config: { + endpoint: params[:endpoint], + user: params[:user], + password: params[:password], + } + }) + examples.tap do |result| + raise 'No entries found in selected folder(s).' if result[:attributes].blank? + end end end diff --git a/lib/sequencer/unit/import/exchange/attribute_examples.rb b/lib/sequencer/unit/import/exchange/attribute_examples.rb index 19401609d..f4c59c45a 100644 --- a/lib/sequencer/unit/import/exchange/attribute_examples.rb +++ b/lib/sequencer/unit/import/exchange/attribute_examples.rb @@ -16,10 +16,17 @@ class Sequencer ews_folder_ids.collect do |folder_id| - ews_folder.find(folder_id).items.each do |resource| - attributes = ::Import::Exchange::ItemAttributes.extract(resource) - extractor.extract(attributes) - break if extractor.enough + begin + ews_folder.find(folder_id).items.each do |resource| + attributes = ::Import::Exchange::ItemAttributes.extract(resource) + extractor.extract(attributes) + break if extractor.enough + end + rescue NoMethodError => e + raise if e.message !~ /Viewpoint::EWS::/ + + logger.error e + logger.error "Skipping folder_id '#{folder_id}' due to unsupported entries." end end end.examples