diff --git a/app/assets/javascripts/app/controllers/ticket_overview.js.coffee b/app/assets/javascripts/app/controllers/ticket_overview.js.coffee index 810ebb939..9d2997eb5 100644 --- a/app/assets/javascripts/app/controllers/ticket_overview.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_overview.js.coffee @@ -98,6 +98,10 @@ class Table extends App.Controller @bind 'ticket_overview_fetch_force', => @fetch() + # force fetch ticket overview + @bind 'ticket_overview_local', => + @render(true) + update: (params) => for key, value of params @[key] = value @@ -144,17 +148,19 @@ class Table extends App.Controller return data false - render: => + render: (overview_changed = false) => #console.log('RENDER', @cache, @view) return if !@cache return if !@cache[@view] + # use cache overview = @cache[@view].overview tickets_count = @cache[@view].tickets_count ticket_ids = @cache[@view].ticket_ids - # get meta data - App.Overview.refresh( overview, { clear: true } ) + # use cache if no local change + if !overview_changed + App.Overview.refresh( overview, { clear: true } ) # get ticket list ticket_list_show = [] @@ -505,7 +511,6 @@ class Table extends App.Controller overview_id: @overview.id view_mode: @view_mode container: @el.closest('.content') - callback: @render, ) class App.OverviewSettings extends App.ControllerModal @@ -696,18 +701,18 @@ class App.OverviewSettings extends App.ControllerModal @overview.group_by = params.group_by - # rerender overview - if !@reload_needed - @callback() - @overview.save( done: => # fetch overview data again if @reload_needed App.Event.trigger('ticket_overview_fetch_force') + else + App.Event.trigger('ticket_overview_local') + + # hide modal + @hide() ) - @hide() class Navbar extends App.Controller constructor: -> diff --git a/test/browser/agent_ticket_overview_level0_test.rb b/test/browser/agent_ticket_overview_level0_test.rb index c1a77757e..7fe813f18 100644 --- a/test/browser/agent_ticket_overview_level0_test.rb +++ b/test/browser/agent_ticket_overview_level0_test.rb @@ -74,7 +74,6 @@ class AgentTicketOverviewLevel0Test < TestCase # remember current overview count overview_counter_before = overview_counter() - # click options and enable number and article count click( :css => '.active [data-type="settings"]' ) @@ -101,7 +100,7 @@ class AgentTicketOverviewLevel0Test < TestCase :css => '.modal input[value="article_count"]', ) click( :css => '.modal .js-submit' ) - sleep 10 + sleep 4 # check if number and article count is shown match( @@ -141,7 +140,7 @@ class AgentTicketOverviewLevel0Test < TestCase :css => '.modal input[value="article_count"]', ) click( :css => '.modal .js-submit' ) - sleep 2 + sleep 4 # check if number and article count is gone match_not(