Working on issue #981 - Added possibility to manually start LDAP import.
This commit is contained in:
parent
ea926d1095
commit
ec6a4a199c
3 changed files with 33 additions and 10 deletions
|
@ -24,12 +24,26 @@ class Index extends App.ControllerIntegrationBase
|
||||||
facility: 'ldap'
|
facility: 'ldap'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
switch: =>
|
||||||
|
super
|
||||||
|
active = @$('.js-switch input').prop('checked')
|
||||||
|
if active
|
||||||
|
@ajax(
|
||||||
|
id: 'jobs_config'
|
||||||
|
type: 'POST'
|
||||||
|
url: "#{@apiPath}/integration/ldap/job_start"
|
||||||
|
processData: true
|
||||||
|
success: (data, status, xhr) =>
|
||||||
|
@render(true)
|
||||||
|
)
|
||||||
|
|
||||||
class Form extends App.Controller
|
class Form extends App.Controller
|
||||||
elements:
|
elements:
|
||||||
'.js-lastImport': 'lastImport'
|
'.js-lastImport': 'lastImport'
|
||||||
'.js-wizard': 'wizardButton'
|
'.js-wizard': 'wizardButton'
|
||||||
events:
|
events:
|
||||||
'click .js-wizard': 'startWizard'
|
'click .js-wizard': 'startWizard'
|
||||||
|
'click .js-start-sync': 'startSync'
|
||||||
|
|
||||||
constructor: ->
|
constructor: ->
|
||||||
super
|
super
|
||||||
|
@ -42,14 +56,7 @@ class Form extends App.Controller
|
||||||
|
|
||||||
setConfig: (value) =>
|
setConfig: (value) =>
|
||||||
App.Setting.set('ldap_config', value, {notify: true})
|
App.Setting.set('ldap_config', value, {notify: true})
|
||||||
@ajax(
|
@startSync()
|
||||||
id: 'jobs_config'
|
|
||||||
type: 'POST'
|
|
||||||
url: "#{@apiPath}/integration/ldap/job_start"
|
|
||||||
processData: true
|
|
||||||
success: (data, status, xhr) =>
|
|
||||||
@render(true)
|
|
||||||
)
|
|
||||||
|
|
||||||
render: (top = false) =>
|
render: (top = false) =>
|
||||||
@config = @currentConfig()
|
@config = @currentConfig()
|
||||||
|
@ -69,6 +76,16 @@ class Form extends App.Controller
|
||||||
@scrollToIfNeeded($('.content.active .page-header'))
|
@scrollToIfNeeded($('.content.active .page-header'))
|
||||||
@delay(a, 500)
|
@delay(a, 500)
|
||||||
|
|
||||||
|
startSync: =>
|
||||||
|
@ajax(
|
||||||
|
id: 'jobs_config'
|
||||||
|
type: 'POST'
|
||||||
|
url: "#{@apiPath}/integration/ldap/job_start"
|
||||||
|
processData: true
|
||||||
|
success: (data, status, xhr) =>
|
||||||
|
@render(true)
|
||||||
|
)
|
||||||
|
|
||||||
startWizard: (e) =>
|
startWizard: (e) =>
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
new ConnectionWizard(
|
new ConnectionWizard(
|
||||||
|
|
|
@ -45,5 +45,8 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if @job.finished_at: %>
|
||||||
|
<button type="submit" class="btn btn--primary js-start-sync"><%- @T('Start new') %></button>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -71,8 +71,11 @@ class Integration::LdapController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def job_start_create
|
def job_start_create
|
||||||
job = ImportJob.create(name: 'Import::Ldap', payload: Setting.get('ldap_config'))
|
backend = 'Import::Ldap'
|
||||||
|
if !ImportJob.exists?(name: backend, finished_at: nil)
|
||||||
|
job = ImportJob.create(name: backend, payload: Setting.get('ldap_config'))
|
||||||
job.delay.start
|
job.delay.start
|
||||||
|
end
|
||||||
render json: {
|
render json: {
|
||||||
result: 'ok',
|
result: 'ok',
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue