Merge pull request #7828 from betagouv/improve_admin_procedure_perf
perf: amélioration de la rapidité de la page admin/procedure/show
This commit is contained in:
commit
ffb81e6d72
4 changed files with 14 additions and 6 deletions
|
@ -1,7 +1,6 @@
|
||||||
class Procedure::Card::AnnotationsComponent < ApplicationComponent
|
class Procedure::Card::AnnotationsComponent < ApplicationComponent
|
||||||
def initialize(procedure:)
|
def initialize(procedure:)
|
||||||
@procedure = procedure
|
@procedure = procedure
|
||||||
@procedure.validate(:publication)
|
|
||||||
@count = @procedure.draft_revision.types_de_champ.private_only.size
|
@count = @procedure.draft_revision.types_de_champ.private_only.size
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
class Procedure::Card::ChampsComponent < ApplicationComponent
|
class Procedure::Card::ChampsComponent < ApplicationComponent
|
||||||
def initialize(procedure:)
|
def initialize(procedure:)
|
||||||
@procedure = procedure
|
@procedure = procedure
|
||||||
@procedure.validate(:publication)
|
|
||||||
@count = @procedure.draft_revision.types_de_champ.public_only.size
|
@count = @procedure.draft_revision.types_de_champ.public_only.size
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -93,11 +93,13 @@ module Administrateurs
|
||||||
@procedure = current_administrateur
|
@procedure = current_administrateur
|
||||||
.procedures
|
.procedures
|
||||||
.includes(
|
.includes(
|
||||||
published_revision: { revision_types_de_champ: :type_de_champ },
|
published_revision: :types_de_champ,
|
||||||
draft_revision: { revision_types_de_champ: :type_de_champ }
|
draft_revision: :types_de_champ
|
||||||
)
|
)
|
||||||
.find(params[:id])
|
.find(params[:id])
|
||||||
|
|
||||||
|
@procedure.validate(:publication)
|
||||||
|
|
||||||
@current_administrateur = current_administrateur
|
@current_administrateur = current_administrateur
|
||||||
@procedure_lien = commencer_url(path: @procedure.path)
|
@procedure_lien = commencer_url(path: @procedure.path)
|
||||||
@procedure_lien_test = commencer_test_url(path: @procedure.path)
|
@procedure_lien_test = commencer_test_url(path: @procedure.path)
|
||||||
|
@ -233,6 +235,13 @@ module Administrateurs
|
||||||
end
|
end
|
||||||
|
|
||||||
def publication
|
def publication
|
||||||
|
@procedure = current_administrateur
|
||||||
|
.procedures
|
||||||
|
.includes(
|
||||||
|
published_revision: :types_de_champ,
|
||||||
|
draft_revision: :types_de_champ
|
||||||
|
).find(params[:procedure_id])
|
||||||
|
|
||||||
@procedure_lien = commencer_url(path: @procedure.path)
|
@procedure_lien = commencer_url(path: @procedure.path)
|
||||||
@procedure_lien_test = commencer_test_url(path: @procedure.path)
|
@procedure_lien_test = commencer_test_url(path: @procedure.path)
|
||||||
@procedure.path = @procedure.suggested_path(current_administrateur)
|
@procedure.path = @procedure.suggested_path(current_administrateur)
|
||||||
|
|
|
@ -4,8 +4,9 @@
|
||||||
- else
|
- else
|
||||||
- changes.filter { |change| change[:model] == :attestation_template }.each do |change|
|
- changes.filter { |change| change[:model] == :attestation_template }.each do |change|
|
||||||
= render partial: 'administrateurs/procedures/revision_change_attestation_template', locals: { change: change }
|
= render partial: 'administrateurs/procedures/revision_change_attestation_template', locals: { change: change }
|
||||||
- changes.filter { |change| change[:model] == :type_de_champ }.each do |change|
|
= render partial: "administrateurs/procedures/revision_change_type_de_champ",
|
||||||
= render partial: 'administrateurs/procedures/revision_change_type_de_champ', locals: { change: change }
|
collection: changes.filter { |change| change[:model] == :type_de_champ },
|
||||||
|
as: :change
|
||||||
- move_changes, move_private_changes = changes.filter { |change| change[:op] == :move }.partition { |change| !change[:private] }
|
- move_changes, move_private_changes = changes.filter { |change| change[:op] == :move }.partition { |change| !change[:private] }
|
||||||
- if move_changes.present?
|
- if move_changes.present?
|
||||||
%li.mb-1= t(:move, scope: [:administrateurs, :revision_changes], count: move_changes.size)
|
%li.mb-1= t(:move, scope: [:administrateurs, :revision_changes], count: move_changes.size)
|
||||||
|
|
Loading…
Reference in a new issue