Fixes #3461 - Dashboard stats widgets are sometimes lost/empty

This commit is contained in:
Martin Edenhofer 2021-03-21 15:02:32 +00:00
parent 53ceb9de9d
commit 68d815da27
8 changed files with 93 additions and 102 deletions

View file

@ -19,8 +19,17 @@ class App.DashboardStats extends App.Controller
for widget in widgets
if @permissionCheck(widget.permission)
try
el = @el.find(".column.#{widget.className}")
localEl = $("<div class=\"column #{widget.className}\"></div>")
if !el.get(0)
@el.append(localEl)
else
el.replaceWith(localEl)
new widget.controller(
parentEl: @el
el: localEl
className: widget.className
)
@$('.js-stat-help').tooltip()

View file

@ -1,12 +1,6 @@
class App.ControllerDashboardStatsBase extends App.Controller
constructor: (params) ->
if params.parentEl
el = params.parentEl.find(".column.#{params.className}")
if !el.get(0)
el = $("<div class=\"column #{params.className}\"></div>")
params.parentEl.append(el)
params.el = el
super(params)
constructor: ->
super
@load()
load: =>

View file

@ -1,4 +1,3 @@
<div class="column ticket_channel_distribution">
<div class="stat-widget vertical">
<div class="stat-title">
<%- @T('Channel Distribution') %>
@ -22,4 +21,3 @@
<% end %>
</div>
</div>
</div>

View file

@ -1,4 +1,3 @@
<div class="column ticket_escalation">
<div class="stat-widget vertical">
<div class="stat-title">
<%- @T('Mood') %>
@ -12,4 +11,3 @@
<div class="stat-label"><%- @T('%s of my tickets escalated.', @StatsTicketEscalation.own) %></div>
<div class="stat-detail"><%- @T('Total: %s', @StatsTicketEscalation.total) %></div>
</div>
</div>

View file

@ -1,4 +1,3 @@
<div class="column ticket_in_process">
<div class="stat-widget vertical">
<div class="stat-title">
<%- @T('Your tickets in process') %>
@ -12,4 +11,3 @@
<div class="stat-label" title="<%- @T('%s of your tickets are currently in process.', @StatsTicketInProcess.in_process) %>"><%- @T('%s% are currently in process', @StatsTicketInProcess.percent) %></div>
<div class="stat-detail"><%- @T('Average: %s%', @StatsTicketInProcess.average_per_agent) %></div>
</div>
</div>

View file

@ -1,4 +1,3 @@
<div class="column ticket_load_measure">
<div class="stat-widget vertical">
<div class="stat-title">
<%- @T('Assigned') %>
@ -19,4 +18,3 @@
<div class="stat-label"><%- @T('Tickets assigned to me: %s of %s', @StatsTicketLoadMeasure.own, @StatsTicketLoadMeasure.total) %></div>
<div class="stat-detail"><%- @T('Average: %s', @StatsTicketLoadMeasure.average_per_agent) %></div>
</div>
</div>

View file

@ -1,4 +1,3 @@
<div class="column ticket_reopen">
<div class="stat-widget vertical">
<div class="stat-title">
<%- @T('Reopening rate') %>
@ -12,4 +11,3 @@
<div class="stat-label"><%- @T('%s% have been reopened', @StatsTicketReopen.percent) %></div>
<div class="stat-detail"><%- @T('Average: %s%', @StatsTicketReopen.average_per_agent) %></div>
</div>
</div>

View file

@ -1,4 +1,3 @@
<div class="column ticket_waiting_time">
<div class="time stat-widget vertical">
<div class="stat-title">
<%- @T('∅ Waiting time today') %>
@ -16,4 +15,3 @@
<div class="stat-label"><%- @T('My handling time: %s minutes', @StatsTicketWaitingTime.handling_time) %></div>
<div class="stat-detail"><%- @T('Average: %s minutes', @StatsTicketWaitingTime.average_per_agent) %></div>
</div>
</div>