From fcb08d9dff1824d4a5514393e9eac8078d8cef31 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 5 Nov 2015 16:25:20 +0100 Subject: [PATCH] Renamed "Overviews" to "Tickets". --- .../app/controllers/ticket_overview.coffee | 2 +- db/migrate/20151105000003_update_overview6.rb | 227 ++++++++++++++++++ db/seeds.rb | 77 +++--- .../agent_ticket_overview_level0_test.rb | 2 +- 4 files changed, 271 insertions(+), 37 deletions(-) create mode 100644 db/migrate/20151105000003_update_overview6.rb diff --git a/app/assets/javascripts/app/controllers/ticket_overview.coffee b/app/assets/javascripts/app/controllers/ticket_overview.coffee index 457832ab6..ffa53f1e6 100644 --- a/app/assets/javascripts/app/controllers/ticket_overview.coffee +++ b/app/assets/javascripts/app/controllers/ticket_overview.coffee @@ -739,4 +739,4 @@ class TicketOverviewRouter extends App.ControllerPermanent App.Config.set( 'ticket/view', TicketOverviewRouter, 'Routes' ) App.Config.set( 'ticket/view/:view', TicketOverviewRouter, 'Routes' ) App.Config.set( 'TicketOverview', { controller: 'TicketOverview', authentication: true }, 'permanentTask' ) -App.Config.set( 'TicketOverview', { prio: 1000, parent: '', name: 'Overviews', target: '#ticket/view', role: ['Agent', 'Customer'], class: 'overviews' }, 'NavBar' ) +App.Config.set( 'TicketOverview', { prio: 1000, parent: '', name: 'Tickets', target: '#ticket/view', role: ['Agent', 'Customer'], class: 'overviews' }, 'NavBar' ) diff --git a/db/migrate/20151105000003_update_overview6.rb b/db/migrate/20151105000003_update_overview6.rb new file mode 100644 index 000000000..f67c1bc37 --- /dev/null +++ b/db/migrate/20151105000003_update_overview6.rb @@ -0,0 +1,227 @@ +class UpdateOverview6 < ActiveRecord::Migration + def up + + # return if it's a new setup + return if !Setting.find_by(name: 'system_init_done') + + UserInfo.current_user_id = 1 + Overview.destroy_all + overview_role = Role.where( name: 'Agent' ).first + Overview.create_or_update( + name: 'My assigned Tickets', + link: 'my_assigned', + prio: 1000, + role_id: overview_role.id, + condition: { + 'ticket.state_id' => { + operator: 'is', + value: [ 1, 2, 3, 7 ], + }, + 'ticket.owner_id' => { + operator: 'is', + pre_condition: 'current_user.id', + }, + }, + order: { + by: 'created_at', + direction: 'ASC', + }, + view: { + d: %w(title customer group created_at), + s: %w(title customer group created_at), + m: %w(number title customer group created_at), + view_mode_default: 's', + }, + ) + + Overview.create_or_update( + name: 'Unassigned & Open', + link: 'all_unassigned', + prio: 1010, + role_id: overview_role.id, + condition: { + 'ticket.state_id' => { + operator: 'is', + value: [1, 2, 3], + }, + 'ticket.owner_id' => { + operator: 'is', + value: 1, + }, + }, + order: { + by: 'created_at', + direction: 'ASC', + }, + view: { + d: %w(title customer group created_at), + s: %w(title customer group created_at), + m: %w(number title customer group created_at), + view_mode_default: 's', + }, + ) + + Overview.create_or_update( + name: 'My pending reached Tickets', + link: 'my_pending_reached', + prio: 1020, + role_id: overview_role.id, + condition: { + 'ticket.state_id' => { + operator: 'is', + value: 3, + }, + 'ticket.owner_id' => { + operator: 'is', + pre_condition: 'current_user.id', + }, + 'ticket.pending_time' => { + operator: 'within next (relative)', + value: 0, + range: 'minute', + }, + }, + order: { + by: 'created_at', + direction: 'ASC', + }, + view: { + d: %w(title customer group created_at), + s: %w(title customer group created_at), + m: %w(number title customer group created_at), + view_mode_default: 's', + }, + ) + + Overview.create_or_update( + name: 'Open', + link: 'all_open', + prio: 1030, + role_id: overview_role.id, + condition: { + 'ticket.state_id' => { + operator: 'is', + value: [1, 2, 3], + }, + }, + order: { + by: 'created_at', + direction: 'ASC', + }, + view: { + d: %w(title customer group state owner created_at), + s: %w(title customer group state owner created_at), + m: %w(number title customer group state owner created_at), + view_mode_default: 's', + }, + ) + + Overview.create_or_update( + name: 'Pending reached', + link: 'all_pending_reached', + prio: 1040, + role_id: overview_role.id, + condition: { + 'ticket.state_id' => { + operator: 'is', + value: [3], + }, + 'ticket.pending_time' => { + operator: 'within next (relative)', + value: 0, + range: 'minute', + }, + }, + order: { + by: 'created_at', + direction: 'ASC', + }, + view: { + d: %w(title customer group owner created_at), + s: %w(title customer group owner created_at), + m: %w(number title customer group owner created_at), + view_mode_default: 's', + }, + ) + + Overview.create_or_update( + name: 'Escalated', + link: 'all_escalated', + prio: 1050, + role_id: overview_role.id, + condition: { + 'ticket.escalation_time' => { + operator: 'within next (relative)', + value: '10', + range: 'minute', + }, + }, + order: { + by: 'escalation_time', + direction: 'ASC', + }, + view: { + d: %w(title customer group owner escalation_time), + s: %w(title customer group owner escalation_time), + m: %w(number title customer group owner escalation_time), + view_mode_default: 's', + }, + ) + + overview_role = Role.where( name: 'Customer' ).first + Overview.create_or_update( + name: 'My Tickets', + link: 'my_tickets', + prio: 1100, + role_id: overview_role.id, + condition: { + 'ticket.state_id' => { + operator: 'is', + value: [ 1, 2, 3, 4, 6, 7 ], + }, + 'ticket.customer_id' => { + operator: 'is', + pre_condition: 'current_user.id', + }, + }, + order: { + by: 'created_at', + direction: 'DESC', + }, + view: { + d: %w(title customer state created_at), + s: %w(number title state created_at), + m: %w(number title state created_at), + view_mode_default: 's', + }, + ) + Overview.create_or_update( + name: 'My Organization Tickets', + link: 'my_organization_tickets', + prio: 1200, + role_id: overview_role.id, + organization_shared: true, + condition: { + 'ticket.state_id' => { + operator: 'is', + value: [ 1, 2, 3, 4, 6, 7 ], + }, + 'ticket.organization_id' => { + operator: 'is', + pre_condition: 'current_user.organization_id', + }, + }, + order: { + by: 'created_at', + direction: 'DESC', + }, + view: { + d: %w(title customer state created_at), + s: %w(number title customer state created_at), + m: %w(number title customer state created_at), + view_mode_default: 's', + }, + ) + + end +end diff --git a/db/seeds.rb b/db/seeds.rb index 8824661ea..576077fff 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1494,6 +1494,13 @@ Role.create_if_not_exists( created_by_id: 1, updated_by_id: 1, ) +Role.create_if_not_exists( + id: 5, + name: 'Chat', + note: 'Access to chat feature.', + updated_by_id: 1, + created_by_id: 1 +) Group.create_if_not_exists( id: 1, @@ -1652,10 +1659,37 @@ Overview.create_if_not_exists( }, ) +Overview.create_if_not_exists( + name: 'Unassigned & Open', + link: 'all_unassigned', + prio: 1010, + role_id: overview_role.id, + condition: { + 'ticket.state_id' => { + operator: 'is', + value: [1, 2, 3], + }, + 'ticket.owner_id' => { + operator: 'is', + value: 1, + }, + }, + order: { + by: 'created_at', + direction: 'ASC', + }, + view: { + d: %w(title customer group created_at), + s: %w(title customer group created_at), + m: %w(number title customer group created_at), + view_mode_default: 's', + }, +) + Overview.create_if_not_exists( name: 'My pending reached Tickets', link: 'my_pending_reached', - prio: 1010, + prio: 1020, role_id: overview_role.id, condition: { 'ticket.state_id' => { @@ -1685,34 +1719,7 @@ Overview.create_if_not_exists( ) Overview.create_if_not_exists( - name: 'Unassigned & Open Tickets', - link: 'all_unassigned', - prio: 1020, - role_id: overview_role.id, - condition: { - 'ticket.state_id' => { - operator: 'is', - value: [1, 2, 3], - }, - 'ticket.owner_id' => { - operator: 'is', - value: 1, - }, - }, - order: { - by: 'created_at', - direction: 'ASC', - }, - view: { - d: %w(title customer group created_at), - s: %w(title customer group created_at), - m: %w(number title customer group created_at), - view_mode_default: 's', - }, -) - -Overview.create_if_not_exists( - name: 'All Open Tickets', + name: 'Open', link: 'all_open', prio: 1030, role_id: overview_role.id, @@ -1735,9 +1742,9 @@ Overview.create_if_not_exists( ) Overview.create_if_not_exists( - name: 'All pending reached Tickets', + name: 'Pending reached', link: 'all_pending_reached', - prio: 1035, + prio: 1040, role_id: overview_role.id, condition: { 'ticket.state_id' => { @@ -1763,9 +1770,9 @@ Overview.create_if_not_exists( ) Overview.create_if_not_exists( - name: 'Escalated Tickets', + name: 'Escalated', link: 'all_escalated', - prio: 1040, + prio: 1050, role_id: overview_role.id, condition: { 'ticket.escalation_time' => { @@ -1790,7 +1797,7 @@ overview_role = Role.where( name: 'Customer' ).first Overview.create_if_not_exists( name: 'My Tickets', link: 'my_tickets', - prio: 1000, + prio: 1100, role_id: overview_role.id, condition: { 'ticket.state_id' => { @@ -1816,7 +1823,7 @@ Overview.create_if_not_exists( Overview.create_if_not_exists( name: 'My Organization Tickets', link: 'my_organization_tickets', - prio: 1100, + prio: 1200, role_id: overview_role.id, organization_shared: true, condition: { diff --git a/test/browser/agent_ticket_overview_level0_test.rb b/test/browser/agent_ticket_overview_level0_test.rb index d9c333148..97e4b0c6a 100644 --- a/test/browser/agent_ticket_overview_level0_test.rb +++ b/test/browser/agent_ticket_overview_level0_test.rb @@ -38,7 +38,7 @@ class AgentTicketOverviewLevel0Test < TestCase js: '$(".content.active .sidebar").css("display", "block")', ) - click( text: 'Unassigned & Open Tickets' ) + click( text: 'Unassigned & Open' ) sleep 4 # till overview is rendered # select both via bulk action