diff --git a/app/controllers/server/websites_controller.rb b/app/controllers/server/websites_controller.rb index 8602ece51702eadb80c460609dc846b1ce865f76..c1df647abc7d7c9f1ab98a450a32142d8e04414c 100644 --- a/app/controllers/server/websites_controller.rb +++ b/app/controllers/server/websites_controller.rb @@ -29,6 +29,11 @@ class Server::WebsitesController < Server::ApplicationController @website.update_theme_version end + def unlock_for_background_jobs + @website.unlock_for_background_jobs! + redirect_back(fallback_location: server_website_path(@website), notice: t('server_admin.websites.unlock_for_background_jobs_notice')) + end + def show @layouts = @website.git_file_layouts.ordered breadcrumb @@ -36,7 +41,7 @@ class Server::WebsitesController < Server::ApplicationController def analyse Git::OrphanAndLayoutAnalyzer.new(@website).launch - redirect_back fallback_location: server_website_path(@website), + redirect_back fallback_location: server_website_path(@website), notice: t('admin.communication.website.git_file.analysis.launched') end diff --git a/app/views/server/websites/show.html.erb b/app/views/server/websites/show.html.erb index dd8cd85971d356bedc4dbd5b7876d0fbad7ba663..3ef796266ac87c2f604ac06d48023d0086337b5d 100644 --- a/app/views/server/websites/show.html.erb +++ b/app/views/server/websites/show.html.erb @@ -46,7 +46,7 @@ </div> </div> -<% if @website.git_files_analysed_at %> +<% if @website.git_files_analysed_at %> <div class="table-responsive"> <table class="<%= table_classes(with_actions: false) %>"> <thead> @@ -66,12 +66,19 @@ <p>Analyse le <%= l @website.git_files_analysed_at %></p> <% end %> +<% if @website.locked_at.present? %> + <div class="alert alert-warning"> + <p><%= Communication::Website.human_attribute_name(:locked_at) %> : <%= l(@website.locked_at, format: :long) %></p> + <%= link_to t('server_admin.websites.unlock_for_background_jobs_btn'), unlock_for_background_jobs_server_website_path(@website), method: :post, class: "btn btn-primary" %> + </div> +<% end %> + <% content_for :action_bar_right do %> - <%= link_to 'Analyser', + <%= link_to 'Analyser', analyse_server_website_path(@website), - method: :post, + method: :post, class: button_classes %> - <%= link_to 'Changer d\'université', - edit_server_website_path(@website), + <%= link_to 'Changer d\'université', + edit_server_website_path(@website), class: button_classes %> <% end %> diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index 3e7cca0a5224fbbce6f54eb62fd90d077d6d1cd4..86900dfb93955d89c74772cdec6ca37189f59651 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -103,6 +103,7 @@ en: in_production: Production in_showcase: In showcase languages: Languages + locked_at: Locked for background jobs at name: Name plausible_url: Plausible dashboard URL repository: Repository @@ -314,7 +315,7 @@ en: label: Editorial description: Everything related to content git_file: - analysis: + analysis: launch: Launch analysis launched: Analysis launched title: Git analysis diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index 7333f57f952d09c7127389577ce6189d16a48da7..bd6dc5a37c760f855175abde0974f31bc9c8d044 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -103,6 +103,7 @@ fr: in_production: Site en production in_showcase: Dans le showcase languages: Langues + locked_at: Verrouillé pour les background jobs à name: Nom plausible_url: Tableau de bord Plausible repository: Référentiel @@ -314,7 +315,7 @@ fr: label: Éditorial description: Tout ce qui est lié au contenu git_file: - analysis: + analysis: launch: Lancer une analyse launched: Analyse lancée title: Analyse Git diff --git a/config/locales/server_admin/en.yml b/config/locales/server_admin/en.yml index 8a004f7864a56138173b2ff362faf29b16bc02dd..aa1283e09704b424a54669c4372a476a7008a0cb 100644 --- a/config/locales/server_admin/en.yml +++ b/config/locales/server_admin/en.yml @@ -53,9 +53,9 @@ en: clean_and_rebuild_all_websites_notice: All themes will be updated. This can take a few minutes. connections_count: "%{count} connexions" details: detail - events_count: "%{count} events" + events_count: "%{count} events" force_clean_and_rebuild: Force clean&rebuild of every websites - git_repo: + git_repo: full: Git Repository short: Repository status: Status @@ -70,6 +70,8 @@ en: sync_theme_version_notice: The theme's version of %{website} has been synced theme_version: Theme version university_html: "University: %{university}" + unlock_for_background_jobs_btn: Unlock for background jobs + unlock_for_background_jobs_notice: The website is unlocked for background jobs. update_all_themes: Sync all themes versions update_mode: Update mode updatable_theme_filter: diff --git a/config/locales/server_admin/fr.yml b/config/locales/server_admin/fr.yml index 706fe26c205fb2a7de03c1c2f6a441c962152f75..374655e523498edf21bb0237e01b34b70ee0c892 100644 --- a/config/locales/server_admin/fr.yml +++ b/config/locales/server_admin/fr.yml @@ -53,9 +53,9 @@ fr: clean_and_rebuild_all_websites_notice: Tous les thèmes vont être mis à jour. Cela peut prendre quelques minutes. connections_count: "%{count} connexions" details: détail - events_count: "%{count} événements" + events_count: "%{count} événements" force_clean_and_rebuild: Forcer le clean&rebuild de tous les sites - git_repo: + git_repo: full: Référentiel Git short: Référentiel status: Statut @@ -70,6 +70,8 @@ fr: sync_theme_version_notice: La version du thème de %{website} a été synchronisée theme_version: Version du thème university_html: "Université : %{university}" + unlock_for_background_jobs_btn: Déverrouiller pour les background jobs + unlock_for_background_jobs_notice: Le site est déverrouillé pour les background jobs. update_all_themes: Synchroniser toutes les versions de thème update_mode: Mode de mise à jour updatable_theme_filter: diff --git a/config/routes/server.rb b/config/routes/server.rb index 7429619b9660a84bee65e0a0c536c926a8d66105..83c59eff57b5c62b594c5c1d5e785ab62205a895 100644 --- a/config/routes/server.rb +++ b/config/routes/server.rb @@ -9,6 +9,7 @@ namespace :server do post :sync_theme_version post :analyse post :update_theme + post :unlock_for_background_jobs end end resources :blocks, only: [:index, :show] do