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: elements:
'.modal-body': 'body' '.modal-body': 'body'
'.js-foldersSelect': 'foldersSelect' '.js-foldersSelect': 'foldersSelect'
'.js-folders .js-submitTry': 'foldersSelectSubmit'
'.js-userMappingForm': 'userMappingForm' '.js-userMappingForm': 'userMappingForm'
'.js-expertForm': 'expertForm' '.js-expertForm': 'expertForm'
@ -321,6 +322,11 @@ class ConnectionWizard extends App.WizardModal
nulloption: false nulloption: false
options: options options: options
value: selected value: selected
onChange: (val) =>
if val && val.length > 0
@foldersSelectSubmit.removeClass('is-disabled')
else
@foldersSelectSubmit.addClass('is-disabled')
) )
mapping: (e) => mapping: (e) =>

View file

@ -33,6 +33,11 @@ class App.ColumnSelect extends Spine.Controller
@select @pickedValue @select @pickedValue
, 300, {trailing: false} , 300, {trailing: false}
if @attribute.onChange
@shadow.on('change', =>
@attribute.onChange(@shadow.val())
)
render: -> render: ->
@values = [] @values = []
_.each @options.attribute.options, (option) => _.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> <a class="btn btn--text btn--secondary js-goToSlide align-left" data-slide="js-bind"><%- @T('Go Back') %></a>
</div> </div>
<div class="modal-rightFooter"> <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>
</div> </div>
</form> </form>

View file

@ -33,15 +33,20 @@ class Integration::ExchangeController < ApplicationController
def mapping def mapping
answer_with do answer_with do
Sequencer.process('Import::Exchange::AttributesExamples', raise 'Please select at least one folder.' if params[:folders].blank?
parameters: {
ews_folder_ids: params[:folders], examples = Sequencer.process('Import::Exchange::AttributesExamples',
ews_config: { parameters: {
endpoint: params[:endpoint], ews_folder_ids: params[:folders],
user: params[:user], ews_config: {
password: params[:password], 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
end end

View file

@ -16,10 +16,17 @@ class Sequencer
ews_folder_ids.collect do |folder_id| ews_folder_ids.collect do |folder_id|
ews_folder.find(folder_id).items.each do |resource| begin
attributes = ::Import::Exchange::ItemAttributes.extract(resource) ews_folder.find(folder_id).items.each do |resource|
extractor.extract(attributes) attributes = ::Import::Exchange::ItemAttributes.extract(resource)
break if extractor.enough 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 end
end.examples end.examples