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,5 +1,4 @@
<div class="column ticket_channel_distribution">
<div class="stat-widget vertical">
<div class="stat-widget vertical">
<div class="stat-title">
<%- @T('Channel Distribution') %>
<div class="stat-icon-help js-stat-help" title="<%- @Ti(@StatsTicketChannelDistribution.description) %>" data-placement="left">
@ -21,5 +20,4 @@
<div class="stat-label"></div>
<% end %>
</div>
</div>
</div>

View file

@ -1,5 +1,4 @@
<div class="column ticket_escalation">
<div class="stat-widget vertical">
<div class="stat-widget vertical">
<div class="stat-title">
<%- @T('Mood') %>
<div class="stat-icon-help js-stat-help" title="<%- @Ti(@StatsTicketEscalation.description) %>" data-placement="bottom">
@ -11,5 +10,4 @@
</div>
<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,5 +1,4 @@
<div class="column ticket_in_process">
<div class="stat-widget vertical">
<div class="stat-widget vertical">
<div class="stat-title">
<%- @T('Your tickets in process') %>
<div class="stat-icon-help js-stat-help" title="<%- @Ti(@StatsTicketInProcess.description) %>" data-placement="bottom">
@ -11,5 +10,4 @@
</div>
<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,5 +1,4 @@
<div class="column ticket_load_measure">
<div class="stat-widget vertical">
<div class="stat-widget vertical">
<div class="stat-title">
<%- @T('Assigned') %>
<div class="stat-icon-help js-stat-help" title="<%- @Ti(@StatsTicketLoadMeasure.description) %>" data-placement="bottom">
@ -18,5 +17,4 @@
<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,5 +1,4 @@
<div class="column ticket_reopen">
<div class="stat-widget vertical">
<div class="stat-widget vertical">
<div class="stat-title">
<%- @T('Reopening rate') %>
<div class="stat-icon-help js-stat-help" title="<%- @Ti(@StatsTicketReopen.description) %>" data-placement="left">
@ -11,5 +10,4 @@
</div>
<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,5 +1,4 @@
<div class="column ticket_waiting_time">
<div class="time stat-widget vertical">
<div class="time stat-widget vertical">
<div class="stat-title">
<%- @T('∅ Waiting time today') %>
<div class="stat-icon-help js-stat-help" title="<%- @Ti(@StatsTicketWaitingTime.description) %>" data-placement="bottom">
@ -15,5 +14,4 @@
</div>
<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>