Fixed issue #1381: Exchange folder with unsupported entries fails configuration. Also improved error handling of empty folders or not selected folders.

This commit is contained in:
Thorsten Eckel 2017-09-05 17:35:53 +02:00
parent 4573308f66
commit 4011c88493
5 changed files with 37 additions and 14 deletions

View file

@ -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) =>

View file

@ -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) =>

View file

@ -115,7 +115,7 @@
<a class="btn btn--text btn--secondary js-goToSlide align-left" data-slide="js-bind"><%- @T('Go Back') %></a>
</div>
<div class="modal-rightFooter">
<button class="btn btn--primary align-right js-submitTry"><%- @T('Continue') %></button>
<button class="btn btn--primary align-right js-submitTry is-disabled"><%- @T('Continue') %></button>
</div>
</div>
</form>

View file

@ -33,7 +33,9 @@ class Integration::ExchangeController < ApplicationController
def mapping
answer_with do
Sequencer.process('Import::Exchange::AttributesExamples',
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: {
@ -42,6 +44,9 @@ class Integration::ExchangeController < ApplicationController
password: params[:password],
}
})
examples.tap do |result|
raise 'No entries found in selected folder(s).' if result[:attributes].blank?
end
end
end

View file

@ -16,11 +16,18 @@ class Sequencer
ews_folder_ids.collect do |folder_id|
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
end