Fixed naming and added split of url to fqdn and http_type.
This commit is contained in:
parent
29115451cd
commit
bf1f53d60f
3 changed files with 24 additions and 16 deletions
|
@ -45,7 +45,7 @@ class Base extends App.ControllerContent
|
|||
className: 'getstarted fit'
|
||||
events:
|
||||
'change [name=adapter]': 'toggleAdapter'
|
||||
'submit .base': 'storeFqdn'
|
||||
'submit .base': 'storeUrl'
|
||||
'submit .base-outbound': 'storeOutbound'
|
||||
'submit .base-inbound': 'storeInbound'
|
||||
'click .js-next': 'submit'
|
||||
|
@ -87,12 +87,12 @@ class Base extends App.ControllerContent
|
|||
|
||||
@html App.view('getting_started/base')()
|
||||
|
||||
# fqdn
|
||||
# url
|
||||
configureAttributesBase = [
|
||||
{ name: 'fqdn', display: 'System URL (where the system can be reached)', tag: 'input', null: false, placeholder: 'http://yourhost' },
|
||||
{ name: 'url', display: 'System URL (where the system can be reached)', tag: 'input', null: false, placeholder: 'http://yourhost' },
|
||||
]
|
||||
new App.ControllerForm(
|
||||
el: @$('.base-fqdn'),
|
||||
el: @$('.base-url'),
|
||||
model: { configure_attributes: configureAttributesBase, className: '' },
|
||||
)
|
||||
|
||||
|
@ -163,7 +163,7 @@ class Base extends App.ControllerContent
|
|||
@$('.wizard-controls .btn').text('Check').attr('data-form', 'base-inbound').addClass('btn--primary').removeClass('btn--danger').removeClass('btn--success')
|
||||
@enable( @$('.btn') )
|
||||
|
||||
storeFqdn: (e) =>
|
||||
storeUrl: (e) =>
|
||||
e.preventDefault()
|
||||
|
||||
# get params
|
||||
|
@ -172,10 +172,10 @@ class Base extends App.ControllerContent
|
|||
@disable(e)
|
||||
|
||||
@ajax(
|
||||
id: 'base_fqdn'
|
||||
id: 'base_url'
|
||||
type: 'POST'
|
||||
url: @apiPath + '/getting_started/base_fqdn'
|
||||
data: JSON.stringify( {fqdn:params.fqdn} )
|
||||
url: @apiPath + '/getting_started/base_url'
|
||||
data: JSON.stringify( {url:params.url} )
|
||||
processData: true
|
||||
success: (data, status, xhr) =>
|
||||
if data.result is 'ok'
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</ol>
|
||||
|
||||
<form class="base">
|
||||
<div class="base-fqdn"></div>
|
||||
<div class="base-url"></div>
|
||||
</form>
|
||||
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
|||
<form class="base-inbound hide">
|
||||
<%- @T('E-Mail Inbound') %>
|
||||
<div class="base-inbound-settings"></div>
|
||||
<div class="base-inbound-state"></div>
|
||||
</form>
|
||||
|
||||
<div class="wizard-controls horizontal center">
|
||||
|
|
|
@ -47,23 +47,32 @@ curl http://localhost/api/v1/getting_started.json -v -u #{login}:#{password}
|
|||
}
|
||||
end
|
||||
|
||||
def base_fqdn
|
||||
def base_url
|
||||
return if setup_done_response
|
||||
|
||||
# validate
|
||||
if !params[:fqdn] ||params[:fqdn] !~ /^(http|https):\/\/.+?$/
|
||||
if !params[:url] ||params[:url] !~ /^(http|https):\/\/.+?$/
|
||||
render :json => {
|
||||
:result => 'invalid',
|
||||
:message => 'Invalid!',
|
||||
}
|
||||
return true
|
||||
return
|
||||
end
|
||||
|
||||
Setting.set('fqdn', params[:fqdn])
|
||||
# split url in http_type and fqdn
|
||||
if params[:url] =~ /^(http|https):\/\/(.+?)$/
|
||||
Setting.set('http_type', $1)
|
||||
Setting.set('fqdn', $2)
|
||||
|
||||
render :json => {
|
||||
:result => 'ok',
|
||||
}
|
||||
return
|
||||
end
|
||||
|
||||
# return result
|
||||
render :json => {
|
||||
:result => 'ok',
|
||||
:result => 'invalid',
|
||||
:message => 'Unable to parse url!',
|
||||
}
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue