show caching information for async dashboard block
This commit is contained in:
parent
329914c34b
commit
3f049da0a0
@ -223,6 +223,9 @@ module DashboardsHelper
|
|||||||
class: 'icon-only icon-settings',
|
class: 'icon-only icon-settings',
|
||||||
title: l(:label_options))
|
title: l(:label_options))
|
||||||
end
|
end
|
||||||
|
if block_definition.key? :async
|
||||||
|
icons << tag.span('', class: 'icon-only icon-warning', title: dashboard_block_sync_info(block_definition))
|
||||||
|
end
|
||||||
icons << tag.span('', class: 'icon-only icon-sort-handle sort-handle', title: l(:button_move))
|
icons << tag.span('', class: 'icon-only icon-sort-handle sort-handle', title: l(:button_move))
|
||||||
icons << delete_link(_remove_block_dashboard_path(@project, dashboard, block: block),
|
icons << delete_link(_remove_block_dashboard_path(@project, dashboard, block: block),
|
||||||
method: :post,
|
method: :post,
|
||||||
@ -430,6 +433,11 @@ module DashboardsHelper
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def dashboard_block_sync_info(block_definition)
|
||||||
|
sec = block_definition[:async][:cache_expires_in].presence || DashboardContent::RENDER_ASYNC_CACHE_EXPIRES_IN
|
||||||
|
l :dashboard_block_info_async, seconds: sec
|
||||||
|
end
|
||||||
|
|
||||||
# Renders a single block content
|
# Renders a single block content
|
||||||
def render_dashboard_block_content(block, block_definition, dashboard, **overwritten_settings)
|
def render_dashboard_block_content(block, block_definition, dashboard, **overwritten_settings)
|
||||||
settings = dashboard.layout_settings block
|
settings = dashboard.layout_settings block
|
||||||
|
@ -118,6 +118,28 @@ class DashboardContent
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def issues_cache_expires_in
|
||||||
|
issue_count = Rails.cache.fetch project.issues.visible.count, expires_in: 1.hour do
|
||||||
|
if project
|
||||||
|
project.issues.visible.count
|
||||||
|
else
|
||||||
|
Issue.visible.count
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if issue_count > 10_000
|
||||||
|
86_400 # 1 day
|
||||||
|
elsif issue_count > 1_000
|
||||||
|
3_600 # 1 hour
|
||||||
|
else
|
||||||
|
60
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def issues_cache_key
|
||||||
|
Digest::SHA256.hexdigest [project&.id, User.current.id].compact.join('-')
|
||||||
|
end
|
||||||
|
|
||||||
# if more the one permission is specified, all permissions are required
|
# if more the one permission is specified, all permissions are required
|
||||||
def block_permission_allowed?(permission)
|
def block_permission_allowed?(permission)
|
||||||
Array(permission).all? { |p| user.allowed_to?(p, project, global: true) }
|
Array(permission).all? { |p| user.allowed_to?(p, project, global: true) }
|
||||||
|
@ -197,3 +197,4 @@ cs:
|
|||||||
label_all_projects: "Všechny projekty"
|
label_all_projects: "Všechny projekty"
|
||||||
notice_failed_to_save_entries: "%{count} z %{total} vybrané %{name_plural} nelze uložit: %{ids}."
|
notice_failed_to_save_entries: "%{count} z %{total} vybrané %{name_plural} nelze uložit: %{ids}."
|
||||||
field_notes_count: "Počet komentářů"
|
field_notes_count: "Počet komentářů"
|
||||||
|
dashboard_block_info_async: This block is loaded asynchronous and cached for %{seconds} seconds.
|
||||||
|
@ -197,3 +197,4 @@ de:
|
|||||||
label_all_projects: Alle Projekte
|
label_all_projects: Alle Projekte
|
||||||
notice_failed_to_save_entries: "%{count} von %{total} ausgewählten %{name_plural} konnte(n) nicht gespeichert werden: %{ids}."
|
notice_failed_to_save_entries: "%{count} von %{total} ausgewählten %{name_plural} konnte(n) nicht gespeichert werden: %{ids}."
|
||||||
field_notes_count: Anzahl Kommentare
|
field_notes_count: Anzahl Kommentare
|
||||||
|
dashboard_block_info_async: Dieser Block wird asynchron geladen und %{seconds} Sekunden gecached.
|
||||||
|
@ -197,3 +197,4 @@ en:
|
|||||||
label_all_projects: All projects
|
label_all_projects: All projects
|
||||||
notice_failed_to_save_entries: "%{count} of %{total} selected %{name_plural} could not be saved : %{ids}."
|
notice_failed_to_save_entries: "%{count} of %{total} selected %{name_plural} could not be saved : %{ids}."
|
||||||
field_notes_count: Notes amount
|
field_notes_count: Notes amount
|
||||||
|
dashboard_block_info_async: This block is loaded asynchronous and cached for %{seconds} seconds.
|
||||||
|
@ -197,3 +197,4 @@ es:
|
|||||||
label_all_projects: Todos los proyectos
|
label_all_projects: Todos los proyectos
|
||||||
notice_failed_to_save_entries: "%{count} de %{total} %{name_plural} seleccionados no pudieron ser salvados: %{ids}."
|
notice_failed_to_save_entries: "%{count} de %{total} %{name_plural} seleccionados no pudieron ser salvados: %{ids}."
|
||||||
field_notes_count: "Número de comentarios"
|
field_notes_count: "Número de comentarios"
|
||||||
|
dashboard_block_info_async: This block is loaded asynchronous and cached for %{seconds} seconds.
|
||||||
|
@ -197,3 +197,4 @@ fr:
|
|||||||
label_all_projects: Tous les projets
|
label_all_projects: Tous les projets
|
||||||
notice_failed_to_save_entries: "%{count} des %{total} %{name_plural} sélectionnés n'ont pu être sauvegardés: %{ids}."
|
notice_failed_to_save_entries: "%{count} des %{total} %{name_plural} sélectionnés n'ont pu être sauvegardés: %{ids}."
|
||||||
field_notes_count: Total des commentaires
|
field_notes_count: Total des commentaires
|
||||||
|
dashboard_block_info_async: This block is loaded asynchronous and cached for %{seconds} seconds.
|
||||||
|
@ -197,3 +197,4 @@ it:
|
|||||||
label_all_projects: Tutti i progetti
|
label_all_projects: Tutti i progetti
|
||||||
notice_failed_to_save_entries: "Non è stato possibile salvare %{count} dei %{total} %{name_plural} selezionati: %{ids}."
|
notice_failed_to_save_entries: "Non è stato possibile salvare %{count} dei %{total} %{name_plural} selezionati: %{ids}."
|
||||||
field_notes_count: Totale dei commenti
|
field_notes_count: Totale dei commenti
|
||||||
|
dashboard_block_info_async: This block is loaded asynchronous and cached for %{seconds} seconds.
|
||||||
|
@ -197,3 +197,4 @@ ja:
|
|||||||
label_all_projects: すべてのプロジェクト
|
label_all_projects: すべてのプロジェクト
|
||||||
notice_failed_to_save_entries: "%{count} of %{total} selected %{name_plural} could not be saved: %{ids}."
|
notice_failed_to_save_entries: "%{count} of %{total} selected %{name_plural} could not be saved: %{ids}."
|
||||||
field_notes_count: コメント数
|
field_notes_count: コメント数
|
||||||
|
dashboard_block_info_async: This block is loaded asynchronous and cached for %{seconds} seconds.
|
||||||
|
@ -197,3 +197,4 @@ ko:
|
|||||||
label_all_projects: 모든 프로젝트
|
label_all_projects: 모든 프로젝트
|
||||||
notice_failed_to_save_entries: "%{count} of %{total} selected %{name_plural} could not be saved: %{ids}."
|
notice_failed_to_save_entries: "%{count} of %{total} selected %{name_plural} could not be saved: %{ids}."
|
||||||
field_notes_count: 메모의 수
|
field_notes_count: 메모의 수
|
||||||
|
dashboard_block_info_async: This block is loaded asynchronous and cached for %{seconds} seconds.
|
||||||
|
@ -197,3 +197,4 @@ pl:
|
|||||||
label_all_projects: Wszystkie projekty
|
label_all_projects: Wszystkie projekty
|
||||||
notice_failed_to_save_entries: "%{count} z %{total} wybranych %{name_plural} nie mogły zostać zapisane: %{ids}."
|
notice_failed_to_save_entries: "%{count} z %{total} wybranych %{name_plural} nie mogły zostać zapisane: %{ids}."
|
||||||
field_notes_count: Liczba uwag
|
field_notes_count: Liczba uwag
|
||||||
|
dashboard_block_info_async: This block is loaded asynchronous and cached for %{seconds} seconds.
|
||||||
|
@ -197,3 +197,4 @@ pt-BR:
|
|||||||
label_all_projects: Todos os Projekte
|
label_all_projects: Todos os Projekte
|
||||||
notice_failed_to_save_entries: "%{count} de %{total} %{name_plural} selecionados não puderam ser salvos: %{ids}."
|
notice_failed_to_save_entries: "%{count} de %{total} %{name_plural} selecionados não puderam ser salvos: %{ids}."
|
||||||
field_notes_count: "Volume de comentários"
|
field_notes_count: "Volume de comentários"
|
||||||
|
dashboard_block_info_async: This block is loaded asynchronous and cached for %{seconds} seconds.
|
||||||
|
@ -197,3 +197,4 @@ ru:
|
|||||||
label_all_projects: Все проекты
|
label_all_projects: Все проекты
|
||||||
notice_failed_to_save_entries: "%{count} из %{total} выбранных %{name_plural} не удалось сохранить: %{ids}."
|
notice_failed_to_save_entries: "%{count} из %{total} выбранных %{name_plural} не удалось сохранить: %{ids}."
|
||||||
field_notes_count: Количество комментариев
|
field_notes_count: Количество комментариев
|
||||||
|
dashboard_block_info_async: This block is loaded asynchronous and cached for %{seconds} seconds.
|
||||||
|
@ -197,3 +197,4 @@
|
|||||||
label_all_projects: 所有项目
|
label_all_projects: 所有项目
|
||||||
notice_failed_to_save_entries: "%{count} of %{total} selected %{name_plural} could not be saved : %{ids}."
|
notice_failed_to_save_entries: "%{count} of %{total} selected %{name_plural} could not be saved : %{ids}."
|
||||||
field_notes_count: 评论的数量
|
field_notes_count: 评论的数量
|
||||||
|
dashboard_block_info_async: This block is loaded asynchronous and cached for %{seconds} seconds.
|
||||||
|
@ -197,3 +197,4 @@ zh:
|
|||||||
label_all_projects: 所有项目
|
label_all_projects: 所有项目
|
||||||
notice_failed_to_save_entries: "%{count} of %{total} selected %{name_plural} could not be saved : %{ids}."
|
notice_failed_to_save_entries: "%{count} of %{total} selected %{name_plural} could not be saved : %{ids}."
|
||||||
field_notes_count: 评论的数量
|
field_notes_count: 评论的数量
|
||||||
|
dashboard_block_info_async: This block is loaded asynchronous and cached for %{seconds} seconds.
|
||||||
|
Loading…
Reference in New Issue
Block a user