Improved UI for ignore certains agents to not use auto assignment - follow up for issue #1825.
This commit is contained in:
parent
312278c2d6
commit
fd120eda96
6 changed files with 145 additions and 10 deletions
|
@ -22,18 +22,32 @@ class App.SettingTicketAutoAssignment extends App.ControllerSubContent
|
||||||
@html(App.view('settings/ticket_auto_assignment')())
|
@html(App.view('settings/ticket_auto_assignment')())
|
||||||
|
|
||||||
configure_attributes = [
|
configure_attributes = [
|
||||||
{ name: 'condition', display: 'Conditions for effected objects', tag: 'ticket_selector', null: false, preview: false, action: false, hasChanged: false },
|
{ name: 'condition', display: 'Conditions for effected objects', tag: 'ticket_selector', null: false, preview: false, action: false, hasChanged: false },
|
||||||
]
|
]
|
||||||
|
|
||||||
filter_params = App.Setting.get('ticket_auto_assignment_selector')
|
ticket_auto_assignment_selector = App.Setting.get('ticket_auto_assignment_selector')
|
||||||
@filter = new App.ControllerForm(
|
@filter = new App.ControllerForm(
|
||||||
el: @$('.js-selector')
|
el: @$('.js-selector')
|
||||||
model:
|
model:
|
||||||
configure_attributes: configure_attributes,
|
configure_attributes: configure_attributes,
|
||||||
params: filter_params
|
params:
|
||||||
|
condition: ticket_auto_assignment_selector.condition
|
||||||
autofocus: true
|
autofocus: true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
configure_attributes = [
|
||||||
|
{ name: 'user_ids', display: 'Exception users', tag: 'column_select', multiple: true, null: true, relation: 'User', sortBy: 'firstname' },
|
||||||
|
]
|
||||||
|
|
||||||
|
ticket_auto_assignment_user_ids_ignore = App.Setting.get('ticket_auto_assignment_user_ids_ignore')
|
||||||
|
@filter = new App.ControllerForm(
|
||||||
|
el: @$('.js-users')
|
||||||
|
model:
|
||||||
|
configure_attributes: configure_attributes,
|
||||||
|
params:
|
||||||
|
user_ids: ticket_auto_assignment_user_ids_ignore
|
||||||
|
autofocus: false
|
||||||
|
)
|
||||||
|
|
||||||
setFilter: (e) =>
|
setFilter: (e) =>
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
@ -41,14 +55,16 @@ class App.SettingTicketAutoAssignment extends App.ControllerSubContent
|
||||||
# get form data
|
# get form data
|
||||||
params = @formParam(@filter.form)
|
params = @formParam(@filter.form)
|
||||||
|
|
||||||
# save filter settings
|
# save settings
|
||||||
App.Setting.set('ticket_auto_assignment_selector', params, notify: true)
|
App.Setting.set('ticket_auto_assignment_selector', { condition: params.condition }, notify: true)
|
||||||
|
App.Setting.set('ticket_auto_assignment_user_ids_ignore', params.user_ids, notify: false)
|
||||||
|
|
||||||
resetFilter: (e) ->
|
resetFilter: (e) ->
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
# save filter settings
|
# save filter settings
|
||||||
App.Setting.set('ticket_auto_assignment_selector', {}, notify: true)
|
App.Setting.set('ticket_auto_assignment_selector', {}, notify: true)
|
||||||
|
App.Setting.set('ticket_auto_assignment_user_ids_ignore', [], notify: false)
|
||||||
|
|
||||||
setTicketAutoAssignment: (e) =>
|
setTicketAutoAssignment: (e) =>
|
||||||
value = @ticketAutoAssignment.prop('checked')
|
value = @ticketAutoAssignment.prop('checked')
|
||||||
|
|
|
@ -8,12 +8,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
<div class="settings-entry">
|
<form class="settings-entry">
|
||||||
<p><%- @T('Enable automatic assignment the first time an agent opens a ticket.') %></p>
|
<p><%- @T('Enable automatic assignment the first time an agent opens a ticket.') %></p>
|
||||||
<p><%- @T('Tickets are only assigned automatically if they do not already have an owner.') %></p>
|
<p><%- @T('Tickets are only assigned automatically if they do not already have an owner.') %></p>
|
||||||
<div class="js-selector"></div>
|
<div class="js-selector"></div>
|
||||||
|
<p><%- @T('Define an exception of "automatic assignment" for certain users (e.g. executives).') %></p>
|
||||||
|
<div class="js-users"></div>
|
||||||
<button type="submit" class="btn btn--primary js-timeAccountingFilter"><%- @T('Save') %></button>
|
<button type="submit" class="btn btn--primary js-timeAccountingFilter"><%- @T('Save') %></button>
|
||||||
<button type="submit" class="btn btn--danger js-timeAccountingFilterReset"><%- @T('Reset') %></button>
|
<button type="submit" class="btn btn--danger js-timeAccountingFilterReset"><%- @T('Reset') %></button>
|
||||||
</div>
|
</form>
|
||||||
<div class="settings-entry">
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
class SettingAddTicketAutoAssignment2 < ActiveRecord::Migration[5.1]
|
||||||
|
def up
|
||||||
|
|
||||||
|
# return if it's a new setup
|
||||||
|
return if !Setting.find_by(name: 'system_init_done')
|
||||||
|
|
||||||
|
Setting.create_if_not_exists(
|
||||||
|
title: 'Auto Assigment',
|
||||||
|
name: 'ticket_auto_assignment',
|
||||||
|
area: 'Web::Base',
|
||||||
|
description: 'Enable ticket auto assignment.',
|
||||||
|
options: {
|
||||||
|
form: [
|
||||||
|
{
|
||||||
|
display: '',
|
||||||
|
null: true,
|
||||||
|
name: 'ticket_auto_assignment',
|
||||||
|
tag: 'boolean',
|
||||||
|
options: {
|
||||||
|
true => 'yes',
|
||||||
|
false => 'no',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
preferences: {
|
||||||
|
authentication: true,
|
||||||
|
permission: ['admin.ticket_auto_assignment'],
|
||||||
|
},
|
||||||
|
state: false,
|
||||||
|
frontend: true
|
||||||
|
)
|
||||||
|
Setting.create_if_not_exists(
|
||||||
|
title: 'Time Accounting Selector',
|
||||||
|
name: 'ticket_auto_assignment_selector',
|
||||||
|
area: 'Web::Base',
|
||||||
|
description: 'Enable auto assignment for following matching tickets.',
|
||||||
|
options: {
|
||||||
|
form: [
|
||||||
|
{},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
preferences: {
|
||||||
|
authentication: true,
|
||||||
|
permission: ['admin.ticket_auto_assignment'],
|
||||||
|
},
|
||||||
|
state: { condition: { 'ticket.state_id' => { operator: 'is', value: Ticket::State.by_category(:work_on).pluck(:id) } } },
|
||||||
|
frontend: true
|
||||||
|
)
|
||||||
|
Setting.create_or_update(
|
||||||
|
title: 'Time Accounting Selector',
|
||||||
|
name: 'ticket_auto_assignment_user_ids_ignore',
|
||||||
|
area: 'Web::Base',
|
||||||
|
description: 'Define an exception of "automatic assignment" for certain users (e.g. executives).',
|
||||||
|
options: {
|
||||||
|
form: [
|
||||||
|
{},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
preferences: {
|
||||||
|
authentication: true,
|
||||||
|
permission: ['admin.ticket_auto_assignment'],
|
||||||
|
},
|
||||||
|
state: [],
|
||||||
|
frontend: true
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
|
@ -1974,7 +1974,23 @@ Setting.create_if_not_exists(
|
||||||
state: { condition: { 'ticket.state_id' => { operator: 'is', value: Ticket::State.by_category(:work_on).pluck(:id) } } },
|
state: { condition: { 'ticket.state_id' => { operator: 'is', value: Ticket::State.by_category(:work_on).pluck(:id) } } },
|
||||||
frontend: true
|
frontend: true
|
||||||
)
|
)
|
||||||
|
Setting.create_or_update(
|
||||||
|
title: 'Time Accounting Selector',
|
||||||
|
name: 'ticket_auto_assignment_user_ids_ignore',
|
||||||
|
area: 'Web::Base',
|
||||||
|
description: 'Define an exception of "automatic assignment" for certain users (e.g. executives).',
|
||||||
|
options: {
|
||||||
|
form: [
|
||||||
|
{},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
preferences: {
|
||||||
|
authentication: true,
|
||||||
|
permission: ['admin.ticket_auto_assignment'],
|
||||||
|
},
|
||||||
|
state: [],
|
||||||
|
frontend: true
|
||||||
|
)
|
||||||
Setting.create_if_not_exists(
|
Setting.create_if_not_exists(
|
||||||
title: 'Ticket Number ignore system_id',
|
title: 'Ticket Number ignore system_id',
|
||||||
name: 'ticket_number_ignore_system_id',
|
name: 'ticket_number_ignore_system_id',
|
||||||
|
|
|
@ -35,6 +35,15 @@ class AgentTicketAutoAssignmentTest < TestCase
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ticket3 = ticket_create(
|
||||||
|
data: {
|
||||||
|
customer: 'nico',
|
||||||
|
group: 'Users',
|
||||||
|
title: 'test_auto_assignment_3 - ticket 3',
|
||||||
|
body: 'test_auto_assignment_3 - ticket 3 - no auto assignment',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
tasks_close_all()
|
tasks_close_all()
|
||||||
|
|
||||||
logout()
|
logout()
|
||||||
|
@ -103,6 +112,31 @@ class AgentTicketAutoAssignmentTest < TestCase
|
||||||
timeout: 2,
|
timeout: 2,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# define auto assignment exception
|
||||||
|
click(css: 'a[href="#manage"]')
|
||||||
|
click(css: '.content.active a[href="#settings/ticket"]')
|
||||||
|
click(css: '.content.active a[href="#auto_assignment"]')
|
||||||
|
click(css: '.content.active .js-select.js-option[title="master@example.com"]')
|
||||||
|
click(css: '.content.active .js-timeAccountingFilter')
|
||||||
|
|
||||||
|
watch_for_disappear(
|
||||||
|
css: '.content.active .sidebar select[name="owner_id"]',
|
||||||
|
value: 'Test Master',
|
||||||
|
timeout: 10,
|
||||||
|
)
|
||||||
|
|
||||||
|
# open ticket#3
|
||||||
|
ticket_open_by_search(
|
||||||
|
number: ticket3[:number],
|
||||||
|
)
|
||||||
|
|
||||||
|
# verify if owner is not set
|
||||||
|
sleep 6
|
||||||
|
match(
|
||||||
|
css: '.content.active .sidebar select[name="owner_id"]',
|
||||||
|
value: '-',
|
||||||
|
)
|
||||||
|
|
||||||
tasks_close_all()
|
tasks_close_all()
|
||||||
|
|
||||||
# disable auto assignment
|
# disable auto assignment
|
||||||
|
|
|
@ -2032,7 +2032,7 @@ wait untill text in selector disabppears
|
||||||
number: number,
|
number: number,
|
||||||
title: data[:title],
|
title: data[:title],
|
||||||
}
|
}
|
||||||
sleep 3 # wait until notify is gone
|
sleep 2 # wait until notify is gone
|
||||||
return ticket
|
return ticket
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue