Improved imap folder support in admin interface.

This commit is contained in:
Martin Edenhofer 2016-03-10 16:47:42 +01:00
parent ec1c9a548e
commit 2c50fcfa39
5 changed files with 140 additions and 10 deletions

View file

@ -446,6 +446,7 @@ class App.ChannelEmailAccountWizard extends App.WizardModal
'change .js-outbound [name=adapter]': 'toggleOutboundAdapter' 'change .js-outbound [name=adapter]': 'toggleOutboundAdapter'
'submit .js-outbound': 'probleOutbound' 'submit .js-outbound': 'probleOutbound'
'click .js-goToSlide': 'goToSlide' 'click .js-goToSlide': 'goToSlide'
'click .js-expert': 'probeBasedOnIntro'
'click .js-close': 'hide' 'click .js-close': 'hide'
constructor: -> constructor: ->
@ -495,13 +496,12 @@ class App.ChannelEmailAccountWizard extends App.WizardModal
# base # base
configureAttributesBase = [ configureAttributesBase = [
{ name: 'realname', display: 'Department Name', tag: 'input', type: 'text', limit: 160, null: false, placeholder: 'Organization Support', autocomplete: 'off' }, { name: 'realname', display: 'Organization & Department Name', tag: 'input', type: 'text', limit: 160, null: false, placeholder: 'Organization Support', autocomplete: 'off' },
{ name: 'email', display: 'Email', tag: 'input', type: 'email', limit: 120, null: false, placeholder: 'support@example.com', autocapitalize: false, autocomplete: 'off' }, { name: 'email', display: 'Email', tag: 'input', type: 'email', limit: 120, null: false, placeholder: 'support@example.com', autocapitalize: false, autocomplete: 'off' },
{ name: 'password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: false, autocapitalize: false, autocomplete: 'new-password', single: true }, { name: 'password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: false, autocapitalize: false, autocomplete: 'new-password', single: true },
{ name: 'group_id', display: 'Destination Group', tag: 'select', null: false, relation: 'Group', nulloption: true }, { name: 'group_id', display: 'Destination Group', tag: 'select', null: false, relation: 'Group', nulloption: true },
{ name: 'folder', display: 'Folder', tag: 'input', type: 'text', limit: 120, null: true, autocapitalize: false },
] ]
new App.ControllerForm( @formMeta = new App.ControllerForm(
el: @$('.base-settings'), el: @$('.base-settings'),
model: model:
configure_attributes: configureAttributesBase configure_attributes: configureAttributesBase
@ -587,6 +587,19 @@ class App.ChannelEmailAccountWizard extends App.WizardModal
if @channel if @channel
params.channel_id = @channel.id params.channel_id = @channel.id
if $(e.currentTarget).hasClass('js-expert')
# validate form
errors = @formMeta.validate(params)
if errors
@formValidate(form: e.target, errors: errors)
return
@showSlide('js-inbound')
@$('.js-inbound [name="options::user"]').val(params.email)
@$('.js-inbound [name="options::password"]').val(params.password)
return
@disable(e) @disable(e)
@$('.js-probe .js-email').text(params.email) @$('.js-probe .js-email').text(params.email)
@showSlide('js-probe') @showSlide('js-probe')
@ -777,7 +790,7 @@ class App.ChannelEmailAccountWizard extends App.WizardModal
else else
if data.subject && @account if data.subject && @account
@account.subject = data.subject @account.subject = data.subject
@verify( @account, count + 1 ) @verify(@account, count + 1)
fail: => fail: =>
@showSlide('js-intro') @showSlide('js-intro')
@showAlert('js-intro', 'Unable to verify sending and receiving. Please check your settings.') @showAlert('js-intro', 'Unable to verify sending and receiving. Please check your settings.')

View file

@ -18,8 +18,11 @@
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<div class="modal-centerFooter"> <div class="modal-leftFooter">
<button class="btn btn--primary align-center"><%- @T('Connect') %></button> <button class="btn btn--text btn--secondary align-left js-expert"><%- @T('Experts') %></button>
</div>
<div class="modal-rightFooter">
<button class="btn btn--primary align-right js-submit"><%- @T('Connect') %></button>
</div> </div>
</div> </div>
</form> </form>
@ -98,7 +101,7 @@
<a class="btn btn--text btn--secondary js-goToSlide align-left" data-slide="js-intro"><%- @T('Go Back') %></a> <a class="btn btn--text btn--secondary js-goToSlide align-left" data-slide="js-intro"><%- @T('Go Back') %></a>
</div> </div>
<div class="modal-rightFooter"> <div class="modal-rightFooter">
<button class="btn btn--primary align-right"><%- @T('Continue') %></button> <button class="btn btn--primary align-right js-submit"><%- @T('Continue') %></button>
</div> </div>
</div> </div>
</form> </form>
@ -121,7 +124,7 @@
<a class="btn btn--text btn--secondary js-goToSlide js-back align-left" data-slide="js-inbound"><%- @T('Go Back') %></a> <a class="btn btn--text btn--secondary js-goToSlide js-back align-left" data-slide="js-inbound"><%- @T('Go Back') %></a>
</div> </div>
<div class="modal-rightFooter"> <div class="modal-rightFooter">
<button class="btn btn--primary js-goToSlide js-next align-right" data-slide="js-outbound"><%- @T('Continue') %></button> <button class="btn btn--primary js-goToSlide js-next align-right js-submit" data-slide="js-outbound"><%- @T('Continue') %></button>
</div> </div>
</div> </div>
</form> </form>
@ -149,7 +152,7 @@
<a class="btn btn--text btn--secondary js-goToSlide align-left" data-slide="js-inbound"><%- @T('Go Back') %></a> <a class="btn btn--text btn--secondary js-goToSlide align-left" data-slide="js-inbound"><%- @T('Go Back') %></a>
</div> </div>
<div class="modal-rightFooter"> <div class="modal-rightFooter">
<button class="btn btn--primary align-right"><%- @T('Continue') %></button> <button class="btn btn--primary align-right js-submit"><%- @T('Continue') %></button>
</div> </div>
</div> </div>
</form> </form>

View file

@ -5,6 +5,7 @@ if [ "$LEVEL" == '1' ]; then
echo "slicing level 1" echo "slicing level 1"
# no ticket action # no ticket action
rm test/browser/admin_channel_email_test.rb
rm test/browser/agent_user_profile_test.rb rm test/browser/agent_user_profile_test.rb
rm test/browser/agent_organization_profile_test.rb rm test/browser/agent_organization_profile_test.rb
rm test/browser/agent_ticket_*.rb rm test/browser/agent_ticket_*.rb
@ -21,6 +22,7 @@ elif [ "$LEVEL" == '2' ]; then
rm test/browser/aab_unit_test.rb rm test/browser/aab_unit_test.rb
rm test/browser/aac_basic_richtext_test.rb rm test/browser/aac_basic_richtext_test.rb
rm test/browser/aab_basic_urls_test.rb rm test/browser/aab_basic_urls_test.rb
rm test/browser/admin_channel_email_test.rb
rm test/browser/agent_organization_profile_test.rb rm test/browser/agent_organization_profile_test.rb
rm test/browser/agent_user_*.rb rm test/browser/agent_user_*.rb
rm test/browser/auth_test.rb rm test/browser/auth_test.rb

View file

@ -0,0 +1,112 @@
# encoding: utf-8
require 'browser_test_helper'
class AdminChannelEmailTest < TestCase
def test_account_add
if !ENV['MAILBOX_INIT']
#raise "Need MAILBOX_INIT as ENV variable like export MAILBOX_INIT='unittest01@znuny.com:somepass'"
puts "NOTICE: Need MAILBOX_INIT as ENV variable like export MAILBOX_INIT='unittest01@znuny.com:somepass'"
return
end
mailbox_user = ENV['MAILBOX_INIT'].split(':')[0]
mailbox_password = ENV['MAILBOX_INIT'].split(':')[1]
@browser = browser_instance
login(
username: 'master@example.com',
password: 'test',
url: browser_url,
)
tasks_close_all()
click(css: 'a[href="#manage"]')
click(css: 'a[href="#channels/email"]')
click(css: '#content .js-channelNew')
sleep 2
set(
css: '.modal input[name="realname"]',
value: 'My System',
)
set(
css: '.modal input[name="email"]',
value: mailbox_user,
)
set(
css: '.modal input[name="password"]',
value: mailbox_password,
)
select(
css: '.modal select[name="group_id"]',
value: 'Users',
)
click(css: '.modal button.js-submit')
sleep 4
watch_for(
css: '.modal',
value: 'already exists',
)
click(css: '.modal .js-close')
# delete
click(css: '#content .js-channelDelete')
sleep 2
click(css: '.modal .js-submit')
# re-create
click(css: '#content .js-channelNew')
sleep 2
set(
css: '.modal input[name="realname"]',
value: 'My System',
)
set(
css: '.modal input[name="email"]',
value: mailbox_user,
)
set(
css: '.modal input[name="password"]',
value: mailbox_password,
)
select(
css: '.modal select[name="group_id"]',
value: 'Users',
)
click(css: '.modal button.js-submit')
sleep 2
watch_for_disappear(
css: '.modal',
)
sleep 2
exists_not(css: '.modal')
watch_for(
css: '#content',
value: mailbox_user,
)
# set invalid folder
click(css: '#content .js-editInbound')
sleep 2
set(
css: '.modal input[name="options::folder"]',
value: 'not_existing_folder',
)
click(css: '.modal .js-inbound button.js-submit')
watch_for(
css: '.modal',
value: 'Mailbox doesn\'t exist',
)
end
end