From 3bb720ef65e9678b96decd6815838054189f6f68 Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Tue, 4 Sep 2018 20:06:57 +0200 Subject: split application settings into multiple sub pages --- .../admin/application_settings/ci_cd.html.haml | 38 ++++ .../application_settings/integrations.html.haml | 31 +++ .../metrics_and_profiling.html.haml | 51 +++++ .../admin/application_settings/network.html.haml | 37 +++ .../application_settings/preferences.html.haml | 70 ++++++ .../admin/application_settings/reporting.html.haml | 37 +++ .../application_settings/repository.html.haml | 37 +++ .../admin/application_settings/show.html.haml | 250 --------------------- .../admin/application_settings/templates.html.haml | 8 + app/views/layouts/nav/sidebar/_admin.html.haml | 47 +++- ...plit-admin-settings-into-multiple-sub-pages.yml | 5 + config/routes/admin.rb | 1 + 12 files changed, 361 insertions(+), 251 deletions(-) create mode 100644 app/views/admin/application_settings/ci_cd.html.haml create mode 100644 app/views/admin/application_settings/integrations.html.haml create mode 100644 app/views/admin/application_settings/metrics_and_profiling.html.haml create mode 100644 app/views/admin/application_settings/network.html.haml create mode 100644 app/views/admin/application_settings/preferences.html.haml create mode 100644 app/views/admin/application_settings/reporting.html.haml create mode 100644 app/views/admin/application_settings/repository.html.haml create mode 100644 app/views/admin/application_settings/templates.html.haml create mode 100644 changelogs/unreleased/44998-split-admin-settings-into-multiple-sub-pages.yml diff --git a/app/views/admin/application_settings/ci_cd.html.haml b/app/views/admin/application_settings/ci_cd.html.haml new file mode 100644 index 00000000000..25338d56d83 --- /dev/null +++ b/app/views/admin/application_settings/ci_cd.html.haml @@ -0,0 +1,38 @@ +- breadcrumb_title "Settings" +- page_title "Settings" +- @content_class = "limit-container-width" unless fluid_layout +- expanded = Rails.env.test? + +%section.settings.as-ci-cd.no-animate#js-ci-cd-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('Continuous Integration and Deployment') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Auto DevOps, runners and job artifacts') + .settings-content + = render 'ci_cd' + +%section.settings.as-repository-check.no-animate#js-repository-check-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('Repository maintenance') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Configure automatic git checks and housekeeping on repositories.') + .settings-content + = render 'repository_check' + +- if Gitlab.config.registry.enabled + %section.settings.as-registry.no-animate#js-registry-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('Container Registry') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Various container registry settings.') + .settings-content + = render 'registry' diff --git a/app/views/admin/application_settings/integrations.html.haml b/app/views/admin/application_settings/integrations.html.haml new file mode 100644 index 00000000000..bb6e6171390 --- /dev/null +++ b/app/views/admin/application_settings/integrations.html.haml @@ -0,0 +1,31 @@ +- breadcrumb_title "Settings" +- page_title "Settings" +- @content_class = "limit-container-width" unless fluid_layout +- expanded = Rails.env.test? + += render_if_exists 'admin/application_settings/elasticsearch_form', expanded: expanded + +%section.settings.as-plantuml.no-animate#js-plantuml-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('PlantUML') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Allow rendering of PlantUML diagrams in Asciidoc documents.') + .settings-content + = render 'plantuml' + += render_if_exists 'admin/application_settings/slack', expanded: expanded + +%section.settings.as-third-party-offers.no-animate#js-third-party-offers-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('Third party offers') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Control the display of third party offers.') + .settings-content + = render 'third_party_offers', application_setting: @application_setting + diff --git a/app/views/admin/application_settings/metrics_and_profiling.html.haml b/app/views/admin/application_settings/metrics_and_profiling.html.haml new file mode 100644 index 00000000000..0851527d30d --- /dev/null +++ b/app/views/admin/application_settings/metrics_and_profiling.html.haml @@ -0,0 +1,51 @@ +- breadcrumb_title "Settings" +- page_title "Settings" +- @content_class = "limit-container-width" unless fluid_layout +- expanded = Rails.env.test? + +%section.settings.as-influx.no-animate#js-influx-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('Metrics - Influx') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Enable and configure InfluxDB metrics.') + .settings-content + = render 'influx' + +%section.settings.as-prometheus.no-animate#js-prometheus-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('Metrics - Prometheus') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Enable and configure Prometheus metrics.') + .settings-content + = render 'prometheus' + +%section.settings.as-performance-bar.no-animate#js-performance-bar-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('Profiling - Performance bar') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Enable the Performance Bar for a given group.') + = link_to icon('question-circle'), help_page_path('administration/monitoring/performance/performance_bar') + .settings-content + = render 'performance_bar' + +%section.settings.as-usage.no-animate#js-usage-settings{ class: ('expanded' if expanded) } + .settings-header#usage-statistics + %h4 + = _('Usage statistics') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Enable or disable version check and usage ping.') + .settings-content + = render 'usage' + += render_if_exists 'admin/application_settings/pseudonymizer_settings', expanded: expanded diff --git a/app/views/admin/application_settings/network.html.haml b/app/views/admin/application_settings/network.html.haml new file mode 100644 index 00000000000..714a2e09a3c --- /dev/null +++ b/app/views/admin/application_settings/network.html.haml @@ -0,0 +1,37 @@ +- breadcrumb_title "Settings" +- page_title "Settings" +- @content_class = "limit-container-width" unless fluid_layout +- expanded = Rails.env.test? + +%section.settings.as-performance.no-animate#js-performance-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('Performance optimization') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Various settings that affect GitLab performance.') + .settings-content + = render 'performance' + +%section.settings.as-ip-limits.no-animate#js-ip-limits-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('User and IP Rate Limits') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Configure limits for web and API requests.') + .settings-content + = render 'ip_limits' + +%section.settings.as-outbound.no-animate#js-outbound-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('Outbound requests') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Allow requests to the local network from hooks and services.') + .settings-content + = render 'outbound' diff --git a/app/views/admin/application_settings/preferences.html.haml b/app/views/admin/application_settings/preferences.html.haml new file mode 100644 index 00000000000..b757692834b --- /dev/null +++ b/app/views/admin/application_settings/preferences.html.haml @@ -0,0 +1,70 @@ +- breadcrumb_title "Settings" +- page_title "Settings" +- @content_class = "limit-container-width" unless fluid_layout +- expanded = Rails.env.test? + +%section.settings.as-email.no-animate#js-email-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('Email') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Various email settings.') + .settings-content + = render 'email' + +%section.settings.as-help-page.no-animate#js-help-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('Help page') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Help page text and support page url.') + .settings-content + = render 'help_page' + +%section.settings.as-pages.no-animate#js-pages-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('Pages') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Size and domain settings for static websites') + .settings-content + = render 'pages' + +%section.settings.as-realtime.no-animate#js-realtime-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('Real-time features') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Change this value to influence how frequently the GitLab UI polls for updates.') + .settings-content + = render 'realtime' + +%section.settings.as-background.no-animate#js-background-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('Background jobs') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Configure Sidekiq job throttling.') + .settings-content + = render 'background_jobs' + +%section.settings.as-gitaly.no-animate#js-gitaly-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('Gitaly') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Configure Gitaly timeouts.') + .settings-content + = render 'gitaly' diff --git a/app/views/admin/application_settings/reporting.html.haml b/app/views/admin/application_settings/reporting.html.haml new file mode 100644 index 00000000000..ed5f2601841 --- /dev/null +++ b/app/views/admin/application_settings/reporting.html.haml @@ -0,0 +1,37 @@ +- breadcrumb_title "Settings" +- page_title "Settings" +- @content_class = "limit-container-width" unless fluid_layout +- expanded = Rails.env.test? + +%section.settings.as-spam.no-animate#js-spam-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('Spam and Anti-bot Protection') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Enable reCAPTCHA or Akismet and set IP limits.') + .settings-content + = render 'spam' + +%section.settings.as-abuse.no-animate#js-abuse-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('Abuse reports') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Set notification email for abuse reports.') + .settings-content + = render 'abuse' + +%section.settings.as-logging.no-animate#js-logging-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('Error Reporting and Logging') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Enable Sentry for error reporting and logging.') + .settings-content + = render 'logging' diff --git a/app/views/admin/application_settings/repository.html.haml b/app/views/admin/application_settings/repository.html.haml new file mode 100644 index 00000000000..fcbb2449bdf --- /dev/null +++ b/app/views/admin/application_settings/repository.html.haml @@ -0,0 +1,37 @@ +- breadcrumb_title "Settings" +- page_title "Settings" +- @content_class = "limit-container-width" unless fluid_layout +- expanded = Rails.env.test? + +%section.settings.as-mirror.no-animate#js-mirror-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('Repository mirror') + %button.btn.js-settings-toggle{ type: 'button' } + = expanded ? 'Collapse' : 'Expand' + %p + = _('Configure push mirrors.') + .settings-content + = render partial: 'repository_mirrors_form' + +%section.qa-repository-storage-settings.settings.as-repository-storage.no-animate#js-repository-storage-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('Repository storage') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Configure storage path and circuit breaker settings.') + .settings-content + = render 'repository_storage' + +%section.settings.as-repository-check.no-animate#js-repository-check-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('Repository maintenance') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Configure automatic git checks and housekeeping on repositories.') + .settings-content + = render 'repository_check' diff --git a/app/views/admin/application_settings/show.html.haml b/app/views/admin/application_settings/show.html.haml index 6133a7646f4..a5a664592a9 100644 --- a/app/views/admin/application_settings/show.html.haml +++ b/app/views/admin/application_settings/show.html.haml @@ -58,151 +58,6 @@ .settings-content = render 'terms' -%section.settings.as-help-page.no-animate#js-help-settings{ class: ('expanded' if expanded) } - .settings-header - %h4 - = _('Help page') - %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') - %p - = _('Help page text and support page url.') - .settings-content - = render 'help_page' - -%section.settings.as-pages.no-animate#js-pages-settings{ class: ('expanded' if expanded) } - .settings-header - %h4 - = _('Pages') - %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') - %p - = _('Size and domain settings for static websites') - .settings-content - = render 'pages' - -%section.settings.as-ci-cd.no-animate#js-ci-cd-settings{ class: ('expanded' if expanded) } - .settings-header - %h4 - = _('Continuous Integration and Deployment') - %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') - %p - = _('Auto DevOps, runners and job artifacts') - .settings-content - = render 'ci_cd' - -%section.settings.as-influx.no-animate#js-influx-settings{ class: ('expanded' if expanded) } - .settings-header - %h4 - = _('Metrics - Influx') - %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') - %p - = _('Enable and configure InfluxDB metrics.') - .settings-content - = render 'influx' - -%section.settings.as-prometheus.no-animate#js-prometheus-settings{ class: ('expanded' if expanded) } - .settings-header - %h4 - = _('Metrics - Prometheus') - %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') - %p - = _('Enable and configure Prometheus metrics.') - .settings-content - = render 'prometheus' - -%section.settings.as-performance-bar.no-animate#js-performance-bar-settings{ class: ('expanded' if expanded) } - .settings-header - %h4 - = _('Profiling - Performance bar') - %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') - %p - = _('Enable the Performance Bar for a given group.') - = link_to icon('question-circle'), help_page_path('administration/monitoring/performance/performance_bar') - .settings-content - = render 'performance_bar' - -%section.settings.as-background.no-animate#js-background-settings{ class: ('expanded' if expanded) } - .settings-header - %h4 - = _('Background jobs') - %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') - %p - = _('Configure Sidekiq job throttling.') - .settings-content - = render 'background_jobs' - -%section.settings.as-spam.no-animate#js-spam-settings{ class: ('expanded' if expanded) } - .settings-header - %h4 - = _('Spam and Anti-bot Protection') - %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') - %p - = _('Enable reCAPTCHA or Akismet and set IP limits.') - .settings-content - = render 'spam' - -%section.settings.as-abuse.no-animate#js-abuse-settings{ class: ('expanded' if expanded) } - .settings-header - %h4 - = _('Abuse reports') - %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') - %p - = _('Set notification email for abuse reports.') - .settings-content - = render 'abuse' - -%section.settings.as-logging.no-animate#js-logging-settings{ class: ('expanded' if expanded) } - .settings-header - %h4 - = _('Error Reporting and Logging') - %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') - %p - = _('Enable Sentry for error reporting and logging.') - .settings-content - = render 'logging' - -%section.qa-repository-storage-settings.settings.as-repository-storage.no-animate#js-repository-storage-settings{ class: ('expanded' if expanded) } - .settings-header - %h4 - = _('Repository storage') - %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') - %p - = _('Configure storage path and circuit breaker settings.') - .settings-content - = render 'repository_storage' - -%section.settings.as-repository-check.no-animate#js-repository-check-settings{ class: ('expanded' if expanded) } - .settings-header - %h4 - = _('Repository maintenance') - %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') - %p - = _('Configure automatic git checks and housekeeping on repositories.') - .settings-content - = render 'repository_check' - -- if Gitlab.config.registry.enabled - %section.settings.as-registry.no-animate#js-registry-settings{ class: ('expanded' if expanded) } - .settings-header - %h4 - = _('Container Registry') - %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') - %p - = _('Various container registry settings.') - .settings-content - = render 'registry' - - if koding_enabled? %section.settings.as-koding.no-animate#js-koding-settings{ class: ('expanded' if expanded) } .settings-header @@ -226,39 +81,6 @@ .settings-content = render 'plantuml' -%section.settings.as-usage.no-animate#js-usage-settings{ class: ('expanded' if expanded) } - .settings-header#usage-statistics - %h4 - = _('Usage statistics') - %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') - %p - = _('Enable or disable version check and usage ping.') - .settings-content - = render 'usage' - -%section.settings.as-email.no-animate#js-email-settings{ class: ('expanded' if expanded) } - .settings-header - %h4 - = _('Email') - %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') - %p - = _('Various email settings.') - .settings-content - = render 'email' - -%section.settings.as-gitaly.no-animate#js-gitaly-settings{ class: ('expanded' if expanded) } - .settings-header - %h4 - = _('Gitaly') - %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') - %p - = _('Configure Gitaly timeouts.') - .settings-content - = render 'gitaly' - %section.settings.as-terminal.no-animate#js-terminal-settings{ class: ('expanded' if expanded) } .settings-header %h4 @@ -270,76 +92,6 @@ .settings-content = render 'terminal' -%section.settings.as-realtime.no-animate#js-realtime-settings{ class: ('expanded' if expanded) } - .settings-header - %h4 - = _('Real-time features') - %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') - %p - = _('Change this value to influence how frequently the GitLab UI polls for updates.') - .settings-content - = render 'realtime' - -%section.settings.as-performance.no-animate#js-performance-settings{ class: ('expanded' if expanded) } - .settings-header - %h4 - = _('Performance optimization') - %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') - %p - = _('Various settings that affect GitLab performance.') - .settings-content - = render 'performance' - -%section.settings.as-ip-limits.no-animate#js-ip-limits-settings{ class: ('expanded' if expanded) } - .settings-header - %h4 - = _('User and IP Rate Limits') - %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') - %p - = _('Configure limits for web and API requests.') - .settings-content - = render 'ip_limits' - -%section.settings.as-outbound.no-animate#js-outbound-settings{ class: ('expanded' if expanded) } - .settings-header - %h4 - = _('Outbound requests') - %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') - %p - = _('Allow requests to the local network from hooks and services.') - .settings-content - = render 'outbound' - -%section.settings.as-mirror.no-animate#js-mirror-settings{ class: ('expanded' if expanded) } - .settings-header - %h4 - = _('Repository mirror') - %button.btn.js-settings-toggle{ type: 'button' } - = expanded ? 'Collapse' : 'Expand' - %p - = _('Configure push mirrors.') - .settings-content - = render partial: 'repository_mirrors_form' - -= render_if_exists 'admin/application_settings/templates', expanded: expanded - -%section.settings.as-third-party-offers.no-animate#js-third-party-offers-settings{ class: ('expanded' if expanded) } - .settings-header - %h4 - = _('Third party offers') - %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') - %p - = _('Control the display of third party offers.') - .settings-content - = render 'third_party_offers', application_setting: @application_setting - -= render_if_exists 'admin/application_settings/custom_templates_form', expanded: expanded - %section.settings.no-animate#js-web-ide-settings{ class: ('expanded' if expanded) } .settings-header %h4 @@ -362,5 +114,3 @@ = s_('IDE|Allow live previews of JavaScript projects in the Web IDE using CodeSandbox client side evaluation.') = f.submit _('Save changes'), class: "btn btn-success" - -= render_if_exists 'admin/application_settings/pseudonymizer_settings', expanded: expanded diff --git a/app/views/admin/application_settings/templates.html.haml b/app/views/admin/application_settings/templates.html.haml new file mode 100644 index 00000000000..eafb6c2ea27 --- /dev/null +++ b/app/views/admin/application_settings/templates.html.haml @@ -0,0 +1,8 @@ +- breadcrumb_title "Settings" +- page_title "Settings" +- @content_class = "limit-container-width" unless fluid_layout +- expanded = Rails.env.test? + += render_if_exists 'admin/application_settings/templates', expanded: expanded + += render_if_exists 'admin/application_settings/custom_templates_form', expanded: expanded diff --git a/app/views/layouts/nav/sidebar/_admin.html.haml b/app/views/layouts/nav/sidebar/_admin.html.haml index ff25b040913..396c904c1be 100644 --- a/app/views/layouts/nav/sidebar/_admin.html.haml +++ b/app/views/layouts/nav/sidebar/_admin.html.haml @@ -199,10 +199,55 @@ = sprite_icon('settings') %span.nav-item-name = _('Settings') - %ul.sidebar-sub-level-items.is-fly-out-only + %ul.sidebar-sub-level-items = nav_link(controller: :application_settings, html_options: { class: "fly-out-top-item" } ) do = link_to admin_application_settings_path do %strong.fly-out-top-item-name = _('Settings') + %li.divider.fly-out-top-item + = nav_link(path: 'application_settings#show') do + = link_to admin_application_settings_path, title: _('General') do + %span + = _('General') + %li.divider.fly-out-top-item + = nav_link(path: 'application_settings#integrations') do + = link_to integrations_admin_application_settings_path, title: _('Integrations') do + %span + = _('Integrations') + %li.divider.fly-out-top-item + = nav_link(path: 'application_settings#repository') do + = link_to repository_admin_application_settings_path, title: _('Repository') do + %span + = _('Repository') + %li.divider.fly-out-top-item + = nav_link(path: 'application_settings#templates') do + = link_to templates_admin_application_settings_path, title: _('Templates') do + %span + = _('Templates') + %li.divider.fly-out-top-item + = nav_link(path: 'application_settings#ci_cd') do + = link_to ci_cd_admin_application_settings_path, title: _('CI/CD') do + %span + = _('CI/CD') + %li.divider.fly-out-top-item + = nav_link(path: 'application_settings#reporting') do + = link_to reporting_admin_application_settings_path, title: _('Reporting') do + %span + = _('Reporting') + %li.divider.fly-out-top-item + = nav_link(path: 'application_settings#metrics_and_profiling') do + = link_to metrics_and_profiling_admin_application_settings_path, title: _('Metrics and profiling') do + %span + = _('Metrics and profiling') + %li.divider.fly-out-top-item + = nav_link(path: 'application_settings#network') do + = link_to network_admin_application_settings_path, title: _('Network') do + %span + = _('Network') + %li.divider.fly-out-top-item + = nav_link(path: 'application_settings#preferences') do + = link_to preferences_admin_application_settings_path, title: _('Preferences') do + %span + = _('Preferences') = render 'shared/sidebar_toggle_button' diff --git a/changelogs/unreleased/44998-split-admin-settings-into-multiple-sub-pages.yml b/changelogs/unreleased/44998-split-admin-settings-into-multiple-sub-pages.yml new file mode 100644 index 00000000000..4b398e9419d --- /dev/null +++ b/changelogs/unreleased/44998-split-admin-settings-into-multiple-sub-pages.yml @@ -0,0 +1,5 @@ +--- +title: Split admin settings into multiple sub pages +merge_request: 21467 +author: +type: other diff --git a/config/routes/admin.rb b/config/routes/admin.rb index fa1f79a90be..4aa56837587 100644 --- a/config/routes/admin.rb +++ b/config/routes/admin.rb @@ -110,6 +110,7 @@ namespace :admin do put :reset_runners_token put :reset_health_check_token put :clear_repository_check_states + get :integrations, :repository, :templates, :ci_cd, :reporting, :metrics_and_profiling, :network, :preferences end resources :labels -- cgit v1.2.1 From cc05ab032a8722fae6896db7c1c234468a6ac909 Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Wed, 5 Sep 2018 09:51:50 +0200 Subject: adds 'Geo' sub page to application settings --- app/views/admin/application_settings/geo.html.haml | 6 ++++++ app/views/layouts/nav/sidebar/_admin.html.haml | 5 +++++ config/routes/admin.rb | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 app/views/admin/application_settings/geo.html.haml diff --git a/app/views/admin/application_settings/geo.html.haml b/app/views/admin/application_settings/geo.html.haml new file mode 100644 index 00000000000..d06d249bda5 --- /dev/null +++ b/app/views/admin/application_settings/geo.html.haml @@ -0,0 +1,6 @@ +- breadcrumb_title "Settings" +- page_title "Settings" +- @content_class = "limit-container-width" unless fluid_layout +- expanded = Rails.env.test? + += render_if_exists 'admin/application_settings/geo', expanded: expanded diff --git a/app/views/layouts/nav/sidebar/_admin.html.haml b/app/views/layouts/nav/sidebar/_admin.html.haml index 396c904c1be..cceea58b98e 100644 --- a/app/views/layouts/nav/sidebar/_admin.html.haml +++ b/app/views/layouts/nav/sidebar/_admin.html.haml @@ -245,6 +245,11 @@ %span = _('Network') %li.divider.fly-out-top-item + = nav_link(path: 'application_settings#geo') do + = link_to geo_admin_application_settings_path, title: _('Geo') do + %span + = _('Geo') + %li.divider.fly-out-top-item = nav_link(path: 'application_settings#preferences') do = link_to preferences_admin_application_settings_path, title: _('Preferences') do %span diff --git a/config/routes/admin.rb b/config/routes/admin.rb index 4aa56837587..7489b01ded6 100644 --- a/config/routes/admin.rb +++ b/config/routes/admin.rb @@ -110,7 +110,7 @@ namespace :admin do put :reset_runners_token put :reset_health_check_token put :clear_repository_check_states - get :integrations, :repository, :templates, :ci_cd, :reporting, :metrics_and_profiling, :network, :preferences + get :integrations, :repository, :templates, :ci_cd, :reporting, :metrics_and_profiling, :network, :geo, :preferences end resources :labels -- cgit v1.2.1 From 7a6980659ee910747790c0225a11d5877265198a Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Wed, 5 Sep 2018 09:53:29 +0200 Subject: update PO file --- locale/gitlab.pot | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 936b85146d4..af2bfe54c28 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -1008,6 +1008,9 @@ msgstr "" msgid "CI / CD Settings" msgstr "" +msgid "CI/CD" +msgstr "" + msgid "CI/CD configuration" msgstr "" @@ -2765,6 +2768,9 @@ msgstr "" msgid "Generate a default set of labels" msgstr "" +msgid "Geo" +msgstr "" + msgid "Git" msgstr "" @@ -3611,6 +3617,9 @@ msgstr "" msgid "Metrics - Prometheus" msgstr "" +msgid "Metrics and profiling" +msgstr "" + msgid "Metrics|Check out the CI/CD documentation on deploying to an environment" msgstr "" @@ -4748,6 +4757,9 @@ msgstr "" msgid "Reply to this email directly or %{view_it_on_gitlab}." msgstr "" +msgid "Reporting" +msgstr "" + msgid "Reports|%{failedString} and %{resolvedString}" msgstr "" @@ -5483,6 +5495,9 @@ msgstr "" msgid "Template" msgstr "" +msgid "Templates" +msgstr "" + msgid "Terms of Service Agreement and Privacy Policy" msgstr "" -- cgit v1.2.1 From be41338b660e969564c16e800914f3f15de92ee1 Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Wed, 5 Sep 2018 11:22:18 +0200 Subject: redirect to the relevant sub page after updating application settings --- app/controllers/admin/application_settings_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb index 9723e400574..7d7221c2726 100644 --- a/app/controllers/admin/application_settings_controller.rb +++ b/app/controllers/admin/application_settings_controller.rb @@ -10,7 +10,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController .execute if successful - redirect_to admin_application_settings_path, + redirect_to request.referer, notice: 'Application settings saved successfully' else render :show -- cgit v1.2.1 From e11053d05c7625212bbf116209f240fed6bac414 Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Wed, 5 Sep 2018 11:22:25 +0200 Subject: fix tests --- spec/features/admin/admin_settings_spec.rb | 49 ++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index a3229fe1741..54be4199be2 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -9,10 +9,11 @@ describe 'Admin updates settings' do before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') sign_in(admin) - visit admin_application_settings_path end it 'Change visibility settings' do + visit admin_application_settings_path + page.within('.as-visibility-access') do choose "application_setting_default_project_visibility_20" click_button 'Save changes' @@ -22,6 +23,8 @@ describe 'Admin updates settings' do end it 'Uncheck all restricted visibility levels' do + visit admin_application_settings_path + page.within('.as-visibility-access') do find('#application_setting_visibility_level_0').set(false) find('#application_setting_visibility_level_10').set(false) @@ -36,6 +39,8 @@ describe 'Admin updates settings' do end it 'Modify import sources' do + visit admin_application_settings_path + expect(Gitlab::CurrentSettings.import_sources).not_to be_empty page.within('.as-visibility-access') do @@ -59,6 +64,8 @@ describe 'Admin updates settings' do end it 'Change Visibility and Access Controls' do + visit admin_application_settings_path + page.within('.as-visibility-access') do uncheck 'Project export enabled' click_button 'Save changes' @@ -69,6 +76,8 @@ describe 'Admin updates settings' do end it 'Change Account and Limit Settings' do + visit admin_application_settings_path + page.within('.as-account-limit') do uncheck 'Gravatar enabled' click_button 'Save changes' @@ -79,6 +88,8 @@ describe 'Admin updates settings' do end it 'Change New users set to external', :js do + visit admin_application_settings_path + user_internal_regex = find('#application_setting_user_default_internal_regex', visible: :all) expect(user_internal_regex).to be_readonly @@ -91,6 +102,8 @@ describe 'Admin updates settings' do end it 'Change Sign-in restrictions' do + visit admin_application_settings_path + page.within('.as-signin') do fill_in 'Home page URL', with: 'https://about.gitlab.com/' click_button 'Save changes' @@ -101,6 +114,8 @@ describe 'Admin updates settings' do end it 'Terms of Service' do + visit admin_application_settings_path + # Already have the admin accept terms, so they don't need to accept in this spec. _existing_terms = create(:term) accept_terms(admin) @@ -117,6 +132,8 @@ describe 'Admin updates settings' do end it 'Modify oauth providers' do + visit admin_application_settings_path + expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).to be_empty page.within('.as-signin') do @@ -137,6 +154,8 @@ describe 'Admin updates settings' do end it 'Oauth providers do not raise validation errors when saving unrelated changes' do + visit admin_application_settings_path + expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).to be_empty page.within('.as-signin') do @@ -151,7 +170,7 @@ describe 'Admin updates settings' do allow(Devise).to receive(:omniauth_providers).and_return([]) # Save an unrelated setting - page.within('.as-ci-cd') do + page.within('.as-terms') do click_button 'Save changes' end @@ -160,6 +179,8 @@ describe 'Admin updates settings' do end it 'Change Help page' do + visit preferences_admin_application_settings_path + page.within('.as-help-page') do fill_in 'Help page text', with: 'Example text' check 'Hide marketing-related entries from help' @@ -174,6 +195,8 @@ describe 'Admin updates settings' do end it 'Change Pages settings' do + visit preferences_admin_application_settings_path + page.within('.as-pages') do fill_in 'Maximum size of pages (MB)', with: 15 check 'Require users to prove ownership of custom domains' @@ -186,6 +209,8 @@ describe 'Admin updates settings' do end it 'Change CI/CD settings' do + visit ci_cd_admin_application_settings_path + page.within('.as-ci-cd') do check 'Default to Auto DevOps pipeline for all projects' fill_in 'Auto devops domain', with: 'domain.com' @@ -198,6 +223,8 @@ describe 'Admin updates settings' do end it 'Change Influx settings' do + visit metrics_and_profiling_admin_application_settings_path + page.within('.as-influx') do check 'Enable InfluxDB Metrics' click_button 'Save changes' @@ -208,6 +235,8 @@ describe 'Admin updates settings' do end it 'Change Prometheus settings' do + visit metrics_and_profiling_admin_application_settings_path + page.within('.as-prometheus') do check 'Enable Prometheus Metrics' click_button 'Save changes' @@ -218,6 +247,8 @@ describe 'Admin updates settings' do end it 'Change Performance bar settings' do + visit metrics_and_profiling_admin_application_settings_path + group = create(:group) page.within('.as-performance-bar') do @@ -241,6 +272,8 @@ describe 'Admin updates settings' do end it 'Change Background jobs settings' do + visit preferences_admin_application_settings_path + page.within('.as-background') do fill_in 'Throttling Factor', with: 1 click_button 'Save changes' @@ -251,6 +284,8 @@ describe 'Admin updates settings' do end it 'Change Spam settings' do + visit reporting_admin_application_settings_path + page.within('.as-spam') do check 'Enable reCAPTCHA' fill_in 'reCAPTCHA Site Key', with: 'key' @@ -265,6 +300,8 @@ describe 'Admin updates settings' do end it 'Configure web terminal' do + visit admin_application_settings_path + page.within('.as-terminal') do fill_in 'Max session time', with: 15 click_button 'Save changes' @@ -275,6 +312,8 @@ describe 'Admin updates settings' do end it 'Enable outbound requests' do + visit network_admin_application_settings_path + page.within('.as-outbound') do check 'Allow requests to the local network from hooks and services' click_button 'Save changes' @@ -285,6 +324,8 @@ describe 'Admin updates settings' do end it 'Enable hiding third party offers' do + visit integrations_admin_application_settings_path + page.within('.as-third-party-offers') do check 'Do not display offers from third parties within GitLab' click_button 'Save changes' @@ -295,6 +336,8 @@ describe 'Admin updates settings' do end it 'Change Slack Notifications Service template settings' do + visit integrations_admin_application_settings_path + first(:link, 'Service Templates').click click_link 'Slack notifications' fill_in 'Webhook', with: 'http://localhost' @@ -319,6 +362,8 @@ describe 'Admin updates settings' do end it 'Change Keys settings' do + visit admin_application_settings_path + page.within('.as-visibility-access') do select 'Are forbidden', from: 'RSA SSH keys' select 'Are allowed', from: 'DSA SSH keys' -- cgit v1.2.1 From c3be5cf58cac88f13e6ac3e73f76f0ef6a168164 Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Wed, 5 Sep 2018 11:41:25 +0200 Subject: fix qa selector --- app/views/admin/application_settings/repository.html.haml | 2 +- app/views/admin/application_settings/show.html.haml | 2 +- qa/qa/page/admin/settings/main.rb | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/views/admin/application_settings/repository.html.haml b/app/views/admin/application_settings/repository.html.haml index fcbb2449bdf..97cff3e469a 100644 --- a/app/views/admin/application_settings/repository.html.haml +++ b/app/views/admin/application_settings/repository.html.haml @@ -14,7 +14,7 @@ .settings-content = render partial: 'repository_mirrors_form' -%section.qa-repository-storage-settings.settings.as-repository-storage.no-animate#js-repository-storage-settings{ class: ('expanded' if expanded) } +%section.settings.as-repository-storage.no-animate#js-repository-storage-settings{ class: ('expanded' if expanded) } .settings-header %h4 = _('Repository storage') diff --git a/app/views/admin/application_settings/show.html.haml b/app/views/admin/application_settings/show.html.haml index a5a664592a9..44793db949c 100644 --- a/app/views/admin/application_settings/show.html.haml +++ b/app/views/admin/application_settings/show.html.haml @@ -47,7 +47,7 @@ .settings-content = render 'signin' -%section.settings.as-terms.no-animate#js-terms-settings{ class: ('expanded' if expanded) } +%section.qa-terms-settings.settings.as-terms.no-animate#js-terms-settings{ class: ('expanded' if expanded) } .settings-header %h4 = _('Terms of Service and Privacy Policy') diff --git a/qa/qa/page/admin/settings/main.rb b/qa/qa/page/admin/settings/main.rb index db3387b4557..f0b34b1f788 100644 --- a/qa/qa/page/admin/settings/main.rb +++ b/qa/qa/page/admin/settings/main.rb @@ -6,11 +6,12 @@ module QA include QA::Page::Settings::Common view 'app/views/admin/application_settings/show.html.haml' do - element :repository_storage_settings + element :terms_settings end def expand_repository_storage(&block) - expand_section(:repository_storage_settings) do + + expand_section(:terms_settings) do RepositoryStorage.perform(&block) end end -- cgit v1.2.1 From 02b86d39a4b414b86bb685cd711d4d5c4f2961ed Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Wed, 5 Sep 2018 11:54:59 +0200 Subject: fix tests --- spec/features/admin/admin_uses_repository_checks_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/admin/admin_uses_repository_checks_spec.rb b/spec/features/admin/admin_uses_repository_checks_spec.rb index e658f1b6738..d04bb9acd9e 100644 --- a/spec/features/admin/admin_uses_repository_checks_spec.rb +++ b/spec/features/admin/admin_uses_repository_checks_spec.rb @@ -33,7 +33,7 @@ describe 'Admin uses repository checks' do end it 'to clear all repository checks', :js do - visit admin_application_settings_path + visit repository_admin_application_settings_path expect(RepositoryCheck::ClearWorker).to receive(:perform_async) -- cgit v1.2.1 From e3d48eb19f0460c326ebaca8334967c63e703ea2 Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Wed, 5 Sep 2018 14:37:06 +0200 Subject: remove trailing whitespaces --- app/views/admin/application_settings/integrations.html.haml | 1 - qa/qa/page/admin/settings/main.rb | 1 - spec/features/admin/admin_settings_spec.rb | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/views/admin/application_settings/integrations.html.haml b/app/views/admin/application_settings/integrations.html.haml index bb6e6171390..1741cb6f935 100644 --- a/app/views/admin/application_settings/integrations.html.haml +++ b/app/views/admin/application_settings/integrations.html.haml @@ -28,4 +28,3 @@ = _('Control the display of third party offers.') .settings-content = render 'third_party_offers', application_setting: @application_setting - diff --git a/qa/qa/page/admin/settings/main.rb b/qa/qa/page/admin/settings/main.rb index f0b34b1f788..73034ffe0d8 100644 --- a/qa/qa/page/admin/settings/main.rb +++ b/qa/qa/page/admin/settings/main.rb @@ -10,7 +10,6 @@ module QA end def expand_repository_storage(&block) - expand_section(:terms_settings) do RepositoryStorage.perform(&block) end diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index 54be4199be2..8a4809f28cd 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -301,7 +301,7 @@ describe 'Admin updates settings' do it 'Configure web terminal' do visit admin_application_settings_path - + page.within('.as-terminal') do fill_in 'Max session time', with: 15 click_button 'Save changes' -- cgit v1.2.1 From 3b8994d1ee9642555e18a8a05c530aec50df087f Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Thu, 6 Sep 2018 15:37:26 +0200 Subject: add 'redirect_path' parameter to forms --- app/views/admin/application_settings/_abuse.html.haml | 2 ++ app/views/admin/application_settings/_account_and_limit.html.haml | 2 ++ app/views/admin/application_settings/_background_jobs.html.haml | 2 ++ app/views/admin/application_settings/_ci_cd.html.haml | 2 ++ app/views/admin/application_settings/_email.html.haml | 2 ++ app/views/admin/application_settings/_gitaly.html.haml | 2 ++ app/views/admin/application_settings/_help_page.html.haml | 2 ++ app/views/admin/application_settings/_influx.html.haml | 2 ++ app/views/admin/application_settings/_ip_limits.html.haml | 2 ++ app/views/admin/application_settings/_koding.html.haml | 2 ++ app/views/admin/application_settings/_logging.html.haml | 2 ++ app/views/admin/application_settings/_outbound.html.haml | 2 ++ app/views/admin/application_settings/_pages.html.haml | 2 ++ app/views/admin/application_settings/_performance.html.haml | 2 ++ app/views/admin/application_settings/_performance_bar.html.haml | 2 ++ app/views/admin/application_settings/_plantuml.html.haml | 2 ++ app/views/admin/application_settings/_prometheus.html.haml | 2 ++ app/views/admin/application_settings/_realtime.html.haml | 2 ++ app/views/admin/application_settings/_registry.html.haml | 2 ++ app/views/admin/application_settings/_repository_check.html.haml | 2 ++ app/views/admin/application_settings/_repository_mirrors_form.html.haml | 2 ++ app/views/admin/application_settings/_repository_storage.html.haml | 2 ++ app/views/admin/application_settings/_signin.html.haml | 2 ++ app/views/admin/application_settings/_signup.html.haml | 2 ++ app/views/admin/application_settings/_spam.html.haml | 2 ++ app/views/admin/application_settings/_terminal.html.haml | 2 ++ app/views/admin/application_settings/_terms.html.haml | 2 ++ app/views/admin/application_settings/_third_party_offers.html.haml | 2 ++ app/views/admin/application_settings/_usage.html.haml | 2 ++ app/views/admin/application_settings/_visibility_and_access.html.haml | 2 ++ 30 files changed, 60 insertions(+) diff --git a/app/views/admin/application_settings/_abuse.html.haml b/app/views/admin/application_settings/_abuse.html.haml index 5f8bd799d23..4e2fd48406c 100644 --- a/app/views/admin/application_settings/_abuse.html.haml +++ b/app/views/admin/application_settings/_abuse.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-abuse-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, reporting_admin_application_settings_path) + %fieldset .form-group = f.label :admin_notification_email, 'Abuse reports notification email', class: 'label-bold' diff --git a/app/views/admin/application_settings/_account_and_limit.html.haml b/app/views/admin/application_settings/_account_and_limit.html.haml index 9121e44d31b..62db0a28ce7 100644 --- a/app/views/admin/application_settings/_account_and_limit.html.haml +++ b/app/views/admin/application_settings/_account_and_limit.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-account-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, admin_application_settings_path) + %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_background_jobs.html.haml b/app/views/admin/application_settings/_background_jobs.html.haml index 7d1a64b645a..05ac629ef4b 100644 --- a/app/views/admin/application_settings/_background_jobs.html.haml +++ b/app/views/admin/application_settings/_background_jobs.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-background-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, preferences_admin_application_settings_path) + %fieldset %p These settings require a diff --git a/app/views/admin/application_settings/_ci_cd.html.haml b/app/views/admin/application_settings/_ci_cd.html.haml index 97be658cd34..7df22c20ba2 100644 --- a/app/views/admin/application_settings/_ci_cd.html.haml +++ b/app/views/admin/application_settings/_ci_cd.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-ci-cd-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, ci_cd_admin_application_settings_path) + %fieldset .form-group .card.auto-devops-card diff --git a/app/views/admin/application_settings/_email.html.haml b/app/views/admin/application_settings/_email.html.haml index 86339e61215..d57ec42ef9c 100644 --- a/app/views/admin/application_settings/_email.html.haml +++ b/app/views/admin/application_settings/_email.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-email-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, preferences_admin_application_settings_path) + %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_gitaly.html.haml b/app/views/admin/application_settings/_gitaly.html.haml index f39d5709811..f18375b9627 100644 --- a/app/views/admin/application_settings/_gitaly.html.haml +++ b/app/views/admin/application_settings/_gitaly.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-gitaly-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, preferences_admin_application_settings_path) + %fieldset .form-group = f.label :gitaly_timeout_default, 'Default Timeout Period', class: 'label-bold' diff --git a/app/views/admin/application_settings/_help_page.html.haml b/app/views/admin/application_settings/_help_page.html.haml index 70c8c74cc5d..4c4cee53a83 100644 --- a/app/views/admin/application_settings/_help_page.html.haml +++ b/app/views/admin/application_settings/_help_page.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-help-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, preferences_admin_application_settings_path) + %fieldset .form-group = f.label :help_page_text, class: 'label-bold' diff --git a/app/views/admin/application_settings/_influx.html.haml b/app/views/admin/application_settings/_influx.html.haml index a1eeacd8290..74b7e697a08 100644 --- a/app/views/admin/application_settings/_influx.html.haml +++ b/app/views/admin/application_settings/_influx.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-influx-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, metrics_and_profiling_admin_application_settings_path) + %fieldset %p Setup InfluxDB to measure a wide variety of statistics like the time spent diff --git a/app/views/admin/application_settings/_ip_limits.html.haml b/app/views/admin/application_settings/_ip_limits.html.haml index 5a5681830b8..1b88de9b184 100644 --- a/app/views/admin/application_settings/_ip_limits.html.haml +++ b/app/views/admin/application_settings/_ip_limits.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-ip-limits-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, network_admin_application_settings_path) + %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_koding.html.haml b/app/views/admin/application_settings/_koding.html.haml index 8b635b08abd..f8f41337131 100644 --- a/app/views/admin/application_settings/_koding.html.haml +++ b/app/views/admin/application_settings/_koding.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-koding-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, admin_application_settings_path) + %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_logging.html.haml b/app/views/admin/application_settings/_logging.html.haml index 41b787515b5..07b1d1d0086 100644 --- a/app/views/admin/application_settings/_logging.html.haml +++ b/app/views/admin/application_settings/_logging.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-logging-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, reporting_admin_application_settings_path) + %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_outbound.html.haml b/app/views/admin/application_settings/_outbound.html.haml index f4bfb5af385..a0c946742eb 100644 --- a/app/views/admin/application_settings/_outbound.html.haml +++ b/app/views/admin/application_settings/_outbound.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-outbound-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, outbound_admin_application_settings_path) + %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_pages.html.haml b/app/views/admin/application_settings/_pages.html.haml index ad5c8d4da22..d8d3a3bd2d7 100644 --- a/app/views/admin/application_settings/_pages.html.haml +++ b/app/views/admin/application_settings/_pages.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-pages-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, preferences_admin_application_settings_path) + %fieldset .form-group = f.label :max_pages_size, 'Maximum size of pages (MB)', class: 'label-bold' diff --git a/app/views/admin/application_settings/_performance.html.haml b/app/views/admin/application_settings/_performance.html.haml index e7076e7ed2f..a944b1b8b11 100644 --- a/app/views/admin/application_settings/_performance.html.haml +++ b/app/views/admin/application_settings/_performance.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-performance-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, network_admin_application_settings_path) + %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_performance_bar.html.haml b/app/views/admin/application_settings/_performance_bar.html.haml index 44ac8d94764..9bc1ce3002d 100644 --- a/app/views/admin/application_settings/_performance_bar.html.haml +++ b/app/views/admin/application_settings/_performance_bar.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-performance-bar-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, metrics_and_profiling_admin_application_settings_path) + %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_plantuml.html.haml b/app/views/admin/application_settings/_plantuml.html.haml index 5c2b7114426..c05ae72d233 100644 --- a/app/views/admin/application_settings/_plantuml.html.haml +++ b/app/views/admin/application_settings/_plantuml.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-plantuml-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, integrations_admin_application_settings_path) + %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_prometheus.html.haml b/app/views/admin/application_settings/_prometheus.html.haml index a923568e52d..bf5eb3be415 100644 --- a/app/views/admin/application_settings/_prometheus.html.haml +++ b/app/views/admin/application_settings/_prometheus.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-prometheus-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, metrics_and_profiling_admin_application_settings_path) + %fieldset %p Enable a Prometheus metrics endpoint at diff --git a/app/views/admin/application_settings/_realtime.html.haml b/app/views/admin/application_settings/_realtime.html.haml index 92f0c02eb6a..73d889fa477 100644 --- a/app/views/admin/application_settings/_realtime.html.haml +++ b/app/views/admin/application_settings/_realtime.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-realtime-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, preferences_admin_application_settings_path) + %fieldset .form-group = f.label :polling_interval_multiplier, 'Polling interval multiplier', class: 'label-bold' diff --git a/app/views/admin/application_settings/_registry.html.haml b/app/views/admin/application_settings/_registry.html.haml index 08c981db13f..bbfe0ff75e8 100644 --- a/app/views/admin/application_settings/_registry.html.haml +++ b/app/views/admin/application_settings/_registry.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-registry-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, ci_cd_admin_application_settings_path) + %fieldset .form-group = f.label :container_registry_token_expire_delay, 'Authorization token duration (minutes)', class: 'label-bold' diff --git a/app/views/admin/application_settings/_repository_check.html.haml b/app/views/admin/application_settings/_repository_check.html.haml index 925e39bc0a3..46d35872db0 100644 --- a/app/views/admin/application_settings/_repository_check.html.haml +++ b/app/views/admin/application_settings/_repository_check.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-repository-check-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, repository_admin_application_settings_path) + %fieldset .sub-section %h4 Repository checks diff --git a/app/views/admin/application_settings/_repository_mirrors_form.html.haml b/app/views/admin/application_settings/_repository_mirrors_form.html.haml index c94f4c74820..c605c1ec2b3 100644 --- a/app/views/admin/application_settings/_repository_mirrors_form.html.haml +++ b/app/views/admin/application_settings/_repository_mirrors_form.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-mirror-settings') do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, repository_admin_application_settings_path) + %fieldset .form-group = f.label :mirror_available, 'Enable mirror configuration', class: 'label-bold' diff --git a/app/views/admin/application_settings/_repository_storage.html.haml b/app/views/admin/application_settings/_repository_storage.html.haml index 4523332493b..3e89722a772 100644 --- a/app/views/admin/application_settings/_repository_storage.html.haml +++ b/app/views/admin/application_settings/_repository_storage.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-repository-storage-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, repository_admin_application_settings_path) + %fieldset .sub-section .form-group diff --git a/app/views/admin/application_settings/_signin.html.haml b/app/views/admin/application_settings/_signin.html.haml index 635a6751e5b..b2038faaf05 100644 --- a/app/views/admin/application_settings/_signin.html.haml +++ b/app/views/admin/application_settings/_signin.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-signin-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, admin_application_settings_path) + %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_signup.html.haml b/app/views/admin/application_settings/_signup.html.haml index a0a58b811ee..42d05d9e606 100644 --- a/app/views/admin/application_settings/_signup.html.haml +++ b/app/views/admin/application_settings/_signup.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-signup-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, admin_application_settings_path) + %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_spam.html.haml b/app/views/admin/application_settings/_spam.html.haml index 54cda531580..867209fd0e1 100644 --- a/app/views/admin/application_settings/_spam.html.haml +++ b/app/views/admin/application_settings/_spam.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-spam-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, reporting_admin_application_settings_path) + %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_terminal.html.haml b/app/views/admin/application_settings/_terminal.html.haml index 49980e1e1a7..a941d57caef 100644 --- a/app/views/admin/application_settings/_terminal.html.haml +++ b/app/views/admin/application_settings/_terminal.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-terminal-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, admin_application_settings_path) + %fieldset .form-group = f.label :terminal_max_session_time, 'Max session time', class: 'label-bold' diff --git a/app/views/admin/application_settings/_terms.html.haml b/app/views/admin/application_settings/_terms.html.haml index ef58e9b1128..ef3682ec8f0 100644 --- a/app/views/admin/application_settings/_terms.html.haml +++ b/app/views/admin/application_settings/_terms.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-terms-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, admin_application_settings_path) + %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_third_party_offers.html.haml b/app/views/admin/application_settings/_third_party_offers.html.haml index fae5b0b965f..b76fe93575d 100644 --- a/app/views/admin/application_settings/_third_party_offers.html.haml +++ b/app/views/admin/application_settings/_third_party_offers.html.haml @@ -3,6 +3,8 @@ = form_for application_setting, url: admin_application_settings_path(anchor: 'js-third-party-offers-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(application_setting) + = hidden_field(:redirect_path, integrations_admin_application_settings_path) + %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_usage.html.haml b/app/views/admin/application_settings/_usage.html.haml index 2495defb6a7..8f2dac34ec2 100644 --- a/app/views/admin/application_settings/_usage.html.haml +++ b/app/views/admin/application_settings/_usage.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-usage-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, metrics_and_profiling_admin_application_settings_path) + %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_visibility_and_access.html.haml b/app/views/admin/application_settings/_visibility_and_access.html.haml index 0725ffb7f6c..b397aab9de2 100644 --- a/app/views/admin/application_settings/_visibility_and_access.html.haml +++ b/app/views/admin/application_settings/_visibility_and_access.html.haml @@ -1,6 +1,8 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-visibility-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) + = hidden_field(:redirect_path, admin_application_settings_path) + %fieldset .form-group = f.label :default_branch_protection, class: 'label-bold' -- cgit v1.2.1 From 276e78e05885fe39e8ad72a41a01587f1e28cfd5 Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Thu, 6 Sep 2018 15:44:15 +0200 Subject: handle redirect properly --- app/controllers/admin/application_settings_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb index 7d7221c2726..f9451decc19 100644 --- a/app/controllers/admin/application_settings_controller.rb +++ b/app/controllers/admin/application_settings_controller.rb @@ -9,8 +9,10 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController .new(@application_setting, current_user, application_setting_params) .execute + redirect_path = params[:redirect_path] ? params[:redirect_path].to_h : admin_application_settings_path + if successful - redirect_to request.referer, + redirect_to redirect_path, notice: 'Application settings saved successfully' else render :show -- cgit v1.2.1 From d92b7f7ca738958add587188b4e415e4bf8fb394 Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Thu, 6 Sep 2018 16:00:32 +0200 Subject: add breadcrumb and page title for sub pages on admin settings --- app/views/admin/application_settings/ci_cd.html.haml | 4 ++-- app/views/admin/application_settings/geo.html.haml | 4 ++-- app/views/admin/application_settings/integrations.html.haml | 4 ++-- app/views/admin/application_settings/metrics_and_profiling.html.haml | 4 ++-- app/views/admin/application_settings/network.html.haml | 4 ++-- app/views/admin/application_settings/preferences.html.haml | 4 ++-- app/views/admin/application_settings/reporting.html.haml | 4 ++-- app/views/admin/application_settings/repository.html.haml | 4 ++-- app/views/admin/application_settings/templates.html.haml | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/views/admin/application_settings/ci_cd.html.haml b/app/views/admin/application_settings/ci_cd.html.haml index 25338d56d83..420b7746c98 100644 --- a/app/views/admin/application_settings/ci_cd.html.haml +++ b/app/views/admin/application_settings/ci_cd.html.haml @@ -1,5 +1,5 @@ -- breadcrumb_title "Settings" -- page_title "Settings" +- breadcrumb_title "CI/CD" +- page_title "CI/CD" - @content_class = "limit-container-width" unless fluid_layout - expanded = Rails.env.test? diff --git a/app/views/admin/application_settings/geo.html.haml b/app/views/admin/application_settings/geo.html.haml index d06d249bda5..b1741d9eef3 100644 --- a/app/views/admin/application_settings/geo.html.haml +++ b/app/views/admin/application_settings/geo.html.haml @@ -1,5 +1,5 @@ -- breadcrumb_title "Settings" -- page_title "Settings" +- breadcrumb_title "Geo" +- page_title "Geo" - @content_class = "limit-container-width" unless fluid_layout - expanded = Rails.env.test? diff --git a/app/views/admin/application_settings/integrations.html.haml b/app/views/admin/application_settings/integrations.html.haml index 1741cb6f935..91e1ab95089 100644 --- a/app/views/admin/application_settings/integrations.html.haml +++ b/app/views/admin/application_settings/integrations.html.haml @@ -1,5 +1,5 @@ -- breadcrumb_title "Settings" -- page_title "Settings" +- breadcrumb_title "Integrations" +- page_title "Integrations" - @content_class = "limit-container-width" unless fluid_layout - expanded = Rails.env.test? diff --git a/app/views/admin/application_settings/metrics_and_profiling.html.haml b/app/views/admin/application_settings/metrics_and_profiling.html.haml index 0851527d30d..a5ff14188bd 100644 --- a/app/views/admin/application_settings/metrics_and_profiling.html.haml +++ b/app/views/admin/application_settings/metrics_and_profiling.html.haml @@ -1,5 +1,5 @@ -- breadcrumb_title "Settings" -- page_title "Settings" +- breadcrumb_title "Metrics and profiling" +- page_title "Metrics and profiling" - @content_class = "limit-container-width" unless fluid_layout - expanded = Rails.env.test? diff --git a/app/views/admin/application_settings/network.html.haml b/app/views/admin/application_settings/network.html.haml index 714a2e09a3c..49eca70a71d 100644 --- a/app/views/admin/application_settings/network.html.haml +++ b/app/views/admin/application_settings/network.html.haml @@ -1,5 +1,5 @@ -- breadcrumb_title "Settings" -- page_title "Settings" +- breadcrumb_title "Network" +- page_title "Network" - @content_class = "limit-container-width" unless fluid_layout - expanded = Rails.env.test? diff --git a/app/views/admin/application_settings/preferences.html.haml b/app/views/admin/application_settings/preferences.html.haml index b757692834b..e92aa3f6e9f 100644 --- a/app/views/admin/application_settings/preferences.html.haml +++ b/app/views/admin/application_settings/preferences.html.haml @@ -1,5 +1,5 @@ -- breadcrumb_title "Settings" -- page_title "Settings" +- breadcrumb_title "Preferences" +- page_title "Preferences" - @content_class = "limit-container-width" unless fluid_layout - expanded = Rails.env.test? diff --git a/app/views/admin/application_settings/reporting.html.haml b/app/views/admin/application_settings/reporting.html.haml index ed5f2601841..edc2c37e248 100644 --- a/app/views/admin/application_settings/reporting.html.haml +++ b/app/views/admin/application_settings/reporting.html.haml @@ -1,5 +1,5 @@ -- breadcrumb_title "Settings" -- page_title "Settings" +- breadcrumb_title "Reporting" +- page_title "Reporting" - @content_class = "limit-container-width" unless fluid_layout - expanded = Rails.env.test? diff --git a/app/views/admin/application_settings/repository.html.haml b/app/views/admin/application_settings/repository.html.haml index 97cff3e469a..b5ff10f79e2 100644 --- a/app/views/admin/application_settings/repository.html.haml +++ b/app/views/admin/application_settings/repository.html.haml @@ -1,5 +1,5 @@ -- breadcrumb_title "Settings" -- page_title "Settings" +- breadcrumb_title "Repository" +- page_title "Repository" - @content_class = "limit-container-width" unless fluid_layout - expanded = Rails.env.test? diff --git a/app/views/admin/application_settings/templates.html.haml b/app/views/admin/application_settings/templates.html.haml index eafb6c2ea27..dd814e59960 100644 --- a/app/views/admin/application_settings/templates.html.haml +++ b/app/views/admin/application_settings/templates.html.haml @@ -1,5 +1,5 @@ -- breadcrumb_title "Settings" -- page_title "Settings" +- breadcrumb_title "Templates" +- page_title "Templates" - @content_class = "limit-container-width" unless fluid_layout - expanded = Rails.env.test? -- cgit v1.2.1 From 27319d58466a0b3e9b2c3dfa177f9a7c21acfcc2 Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Fri, 7 Sep 2018 07:05:45 +0200 Subject: fix broken path --- app/views/admin/application_settings/_outbound.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/application_settings/_outbound.html.haml b/app/views/admin/application_settings/_outbound.html.haml index a0c946742eb..1a378799fd7 100644 --- a/app/views/admin/application_settings/_outbound.html.haml +++ b/app/views/admin/application_settings/_outbound.html.haml @@ -1,7 +1,7 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-outbound-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, outbound_admin_application_settings_path) + = hidden_field(:redirect_path, network_admin_application_settings_path) %fieldset .form-group -- cgit v1.2.1 From bf5972e184c5f003b2db7d1aee63822b2b16cb21 Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Fri, 7 Sep 2018 11:59:30 +0200 Subject: fix test for usage statistics --- spec/features/admin/admin_settings_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index 3f175dcfb92..79413528291 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -382,6 +382,8 @@ describe 'Admin updates settings' do end it 'loads usage ping payload on click', :js do + visit metrics_and_profiling_admin_application_settings_path + expect(page).to have_button 'Preview payload' find('.js-usage-ping-payload-trigger').click -- cgit v1.2.1 From bfd2181310097f5c0a92a43ffc2b7b9540b96ad3 Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Mon, 10 Sep 2018 19:45:33 +0200 Subject: use referer for redirect instead of hidden field param from partials --- app/controllers/admin/application_settings_controller.rb | 2 +- app/views/admin/application_settings/_abuse.html.haml | 2 -- app/views/admin/application_settings/_account_and_limit.html.haml | 2 -- app/views/admin/application_settings/_background_jobs.html.haml | 2 -- app/views/admin/application_settings/_ci_cd.html.haml | 2 -- app/views/admin/application_settings/_email.html.haml | 2 -- app/views/admin/application_settings/_gitaly.html.haml | 2 -- app/views/admin/application_settings/_help_page.html.haml | 2 -- app/views/admin/application_settings/_influx.html.haml | 2 -- app/views/admin/application_settings/_ip_limits.html.haml | 2 -- app/views/admin/application_settings/_koding.html.haml | 2 -- app/views/admin/application_settings/_logging.html.haml | 2 -- app/views/admin/application_settings/_outbound.html.haml | 2 -- app/views/admin/application_settings/_pages.html.haml | 2 -- app/views/admin/application_settings/_performance.html.haml | 2 -- app/views/admin/application_settings/_performance_bar.html.haml | 2 -- app/views/admin/application_settings/_plantuml.html.haml | 2 -- app/views/admin/application_settings/_prometheus.html.haml | 2 -- app/views/admin/application_settings/_realtime.html.haml | 2 -- app/views/admin/application_settings/_registry.html.haml | 2 -- app/views/admin/application_settings/_repository_check.html.haml | 2 -- app/views/admin/application_settings/_repository_mirrors_form.html.haml | 2 -- app/views/admin/application_settings/_repository_storage.html.haml | 2 -- app/views/admin/application_settings/_signin.html.haml | 2 -- app/views/admin/application_settings/_signup.html.haml | 2 -- app/views/admin/application_settings/_spam.html.haml | 2 -- app/views/admin/application_settings/_terminal.html.haml | 2 -- app/views/admin/application_settings/_terms.html.haml | 2 -- app/views/admin/application_settings/_third_party_offers.html.haml | 2 -- app/views/admin/application_settings/_usage.html.haml | 2 -- app/views/admin/application_settings/_visibility_and_access.html.haml | 2 -- 31 files changed, 1 insertion(+), 61 deletions(-) diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb index f9451decc19..e38241bd71a 100644 --- a/app/controllers/admin/application_settings_controller.rb +++ b/app/controllers/admin/application_settings_controller.rb @@ -9,7 +9,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController .new(@application_setting, current_user, application_setting_params) .execute - redirect_path = params[:redirect_path] ? params[:redirect_path].to_h : admin_application_settings_path + redirect_path = request.referer.presence ? request.referer : admin_application_settings_path if successful redirect_to redirect_path, diff --git a/app/views/admin/application_settings/_abuse.html.haml b/app/views/admin/application_settings/_abuse.html.haml index 4e2fd48406c..5f8bd799d23 100644 --- a/app/views/admin/application_settings/_abuse.html.haml +++ b/app/views/admin/application_settings/_abuse.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-abuse-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, reporting_admin_application_settings_path) - %fieldset .form-group = f.label :admin_notification_email, 'Abuse reports notification email', class: 'label-bold' diff --git a/app/views/admin/application_settings/_account_and_limit.html.haml b/app/views/admin/application_settings/_account_and_limit.html.haml index 62db0a28ce7..9121e44d31b 100644 --- a/app/views/admin/application_settings/_account_and_limit.html.haml +++ b/app/views/admin/application_settings/_account_and_limit.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-account-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, admin_application_settings_path) - %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_background_jobs.html.haml b/app/views/admin/application_settings/_background_jobs.html.haml index 05ac629ef4b..7d1a64b645a 100644 --- a/app/views/admin/application_settings/_background_jobs.html.haml +++ b/app/views/admin/application_settings/_background_jobs.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-background-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, preferences_admin_application_settings_path) - %fieldset %p These settings require a diff --git a/app/views/admin/application_settings/_ci_cd.html.haml b/app/views/admin/application_settings/_ci_cd.html.haml index 7df22c20ba2..97be658cd34 100644 --- a/app/views/admin/application_settings/_ci_cd.html.haml +++ b/app/views/admin/application_settings/_ci_cd.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-ci-cd-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, ci_cd_admin_application_settings_path) - %fieldset .form-group .card.auto-devops-card diff --git a/app/views/admin/application_settings/_email.html.haml b/app/views/admin/application_settings/_email.html.haml index d57ec42ef9c..86339e61215 100644 --- a/app/views/admin/application_settings/_email.html.haml +++ b/app/views/admin/application_settings/_email.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-email-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, preferences_admin_application_settings_path) - %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_gitaly.html.haml b/app/views/admin/application_settings/_gitaly.html.haml index f18375b9627..f39d5709811 100644 --- a/app/views/admin/application_settings/_gitaly.html.haml +++ b/app/views/admin/application_settings/_gitaly.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-gitaly-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, preferences_admin_application_settings_path) - %fieldset .form-group = f.label :gitaly_timeout_default, 'Default Timeout Period', class: 'label-bold' diff --git a/app/views/admin/application_settings/_help_page.html.haml b/app/views/admin/application_settings/_help_page.html.haml index 4c4cee53a83..70c8c74cc5d 100644 --- a/app/views/admin/application_settings/_help_page.html.haml +++ b/app/views/admin/application_settings/_help_page.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-help-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, preferences_admin_application_settings_path) - %fieldset .form-group = f.label :help_page_text, class: 'label-bold' diff --git a/app/views/admin/application_settings/_influx.html.haml b/app/views/admin/application_settings/_influx.html.haml index 74b7e697a08..a1eeacd8290 100644 --- a/app/views/admin/application_settings/_influx.html.haml +++ b/app/views/admin/application_settings/_influx.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-influx-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, metrics_and_profiling_admin_application_settings_path) - %fieldset %p Setup InfluxDB to measure a wide variety of statistics like the time spent diff --git a/app/views/admin/application_settings/_ip_limits.html.haml b/app/views/admin/application_settings/_ip_limits.html.haml index 1b88de9b184..5a5681830b8 100644 --- a/app/views/admin/application_settings/_ip_limits.html.haml +++ b/app/views/admin/application_settings/_ip_limits.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-ip-limits-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, network_admin_application_settings_path) - %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_koding.html.haml b/app/views/admin/application_settings/_koding.html.haml index f8f41337131..8b635b08abd 100644 --- a/app/views/admin/application_settings/_koding.html.haml +++ b/app/views/admin/application_settings/_koding.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-koding-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, admin_application_settings_path) - %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_logging.html.haml b/app/views/admin/application_settings/_logging.html.haml index 07b1d1d0086..41b787515b5 100644 --- a/app/views/admin/application_settings/_logging.html.haml +++ b/app/views/admin/application_settings/_logging.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-logging-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, reporting_admin_application_settings_path) - %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_outbound.html.haml b/app/views/admin/application_settings/_outbound.html.haml index 1a378799fd7..f4bfb5af385 100644 --- a/app/views/admin/application_settings/_outbound.html.haml +++ b/app/views/admin/application_settings/_outbound.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-outbound-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, network_admin_application_settings_path) - %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_pages.html.haml b/app/views/admin/application_settings/_pages.html.haml index d8d3a3bd2d7..ad5c8d4da22 100644 --- a/app/views/admin/application_settings/_pages.html.haml +++ b/app/views/admin/application_settings/_pages.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-pages-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, preferences_admin_application_settings_path) - %fieldset .form-group = f.label :max_pages_size, 'Maximum size of pages (MB)', class: 'label-bold' diff --git a/app/views/admin/application_settings/_performance.html.haml b/app/views/admin/application_settings/_performance.html.haml index a944b1b8b11..e7076e7ed2f 100644 --- a/app/views/admin/application_settings/_performance.html.haml +++ b/app/views/admin/application_settings/_performance.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-performance-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, network_admin_application_settings_path) - %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_performance_bar.html.haml b/app/views/admin/application_settings/_performance_bar.html.haml index 9bc1ce3002d..44ac8d94764 100644 --- a/app/views/admin/application_settings/_performance_bar.html.haml +++ b/app/views/admin/application_settings/_performance_bar.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-performance-bar-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, metrics_and_profiling_admin_application_settings_path) - %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_plantuml.html.haml b/app/views/admin/application_settings/_plantuml.html.haml index c05ae72d233..5c2b7114426 100644 --- a/app/views/admin/application_settings/_plantuml.html.haml +++ b/app/views/admin/application_settings/_plantuml.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-plantuml-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, integrations_admin_application_settings_path) - %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_prometheus.html.haml b/app/views/admin/application_settings/_prometheus.html.haml index bf5eb3be415..a923568e52d 100644 --- a/app/views/admin/application_settings/_prometheus.html.haml +++ b/app/views/admin/application_settings/_prometheus.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-prometheus-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, metrics_and_profiling_admin_application_settings_path) - %fieldset %p Enable a Prometheus metrics endpoint at diff --git a/app/views/admin/application_settings/_realtime.html.haml b/app/views/admin/application_settings/_realtime.html.haml index 73d889fa477..92f0c02eb6a 100644 --- a/app/views/admin/application_settings/_realtime.html.haml +++ b/app/views/admin/application_settings/_realtime.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-realtime-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, preferences_admin_application_settings_path) - %fieldset .form-group = f.label :polling_interval_multiplier, 'Polling interval multiplier', class: 'label-bold' diff --git a/app/views/admin/application_settings/_registry.html.haml b/app/views/admin/application_settings/_registry.html.haml index bbfe0ff75e8..08c981db13f 100644 --- a/app/views/admin/application_settings/_registry.html.haml +++ b/app/views/admin/application_settings/_registry.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-registry-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, ci_cd_admin_application_settings_path) - %fieldset .form-group = f.label :container_registry_token_expire_delay, 'Authorization token duration (minutes)', class: 'label-bold' diff --git a/app/views/admin/application_settings/_repository_check.html.haml b/app/views/admin/application_settings/_repository_check.html.haml index 46d35872db0..925e39bc0a3 100644 --- a/app/views/admin/application_settings/_repository_check.html.haml +++ b/app/views/admin/application_settings/_repository_check.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-repository-check-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, repository_admin_application_settings_path) - %fieldset .sub-section %h4 Repository checks diff --git a/app/views/admin/application_settings/_repository_mirrors_form.html.haml b/app/views/admin/application_settings/_repository_mirrors_form.html.haml index c605c1ec2b3..c94f4c74820 100644 --- a/app/views/admin/application_settings/_repository_mirrors_form.html.haml +++ b/app/views/admin/application_settings/_repository_mirrors_form.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-mirror-settings') do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, repository_admin_application_settings_path) - %fieldset .form-group = f.label :mirror_available, 'Enable mirror configuration', class: 'label-bold' diff --git a/app/views/admin/application_settings/_repository_storage.html.haml b/app/views/admin/application_settings/_repository_storage.html.haml index 3e89722a772..4523332493b 100644 --- a/app/views/admin/application_settings/_repository_storage.html.haml +++ b/app/views/admin/application_settings/_repository_storage.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-repository-storage-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, repository_admin_application_settings_path) - %fieldset .sub-section .form-group diff --git a/app/views/admin/application_settings/_signin.html.haml b/app/views/admin/application_settings/_signin.html.haml index b2038faaf05..635a6751e5b 100644 --- a/app/views/admin/application_settings/_signin.html.haml +++ b/app/views/admin/application_settings/_signin.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-signin-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, admin_application_settings_path) - %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_signup.html.haml b/app/views/admin/application_settings/_signup.html.haml index 42d05d9e606..a0a58b811ee 100644 --- a/app/views/admin/application_settings/_signup.html.haml +++ b/app/views/admin/application_settings/_signup.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-signup-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, admin_application_settings_path) - %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_spam.html.haml b/app/views/admin/application_settings/_spam.html.haml index 867209fd0e1..54cda531580 100644 --- a/app/views/admin/application_settings/_spam.html.haml +++ b/app/views/admin/application_settings/_spam.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-spam-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, reporting_admin_application_settings_path) - %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_terminal.html.haml b/app/views/admin/application_settings/_terminal.html.haml index a941d57caef..49980e1e1a7 100644 --- a/app/views/admin/application_settings/_terminal.html.haml +++ b/app/views/admin/application_settings/_terminal.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-terminal-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, admin_application_settings_path) - %fieldset .form-group = f.label :terminal_max_session_time, 'Max session time', class: 'label-bold' diff --git a/app/views/admin/application_settings/_terms.html.haml b/app/views/admin/application_settings/_terms.html.haml index ef3682ec8f0..ef58e9b1128 100644 --- a/app/views/admin/application_settings/_terms.html.haml +++ b/app/views/admin/application_settings/_terms.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-terms-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, admin_application_settings_path) - %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_third_party_offers.html.haml b/app/views/admin/application_settings/_third_party_offers.html.haml index b76fe93575d..fae5b0b965f 100644 --- a/app/views/admin/application_settings/_third_party_offers.html.haml +++ b/app/views/admin/application_settings/_third_party_offers.html.haml @@ -3,8 +3,6 @@ = form_for application_setting, url: admin_application_settings_path(anchor: 'js-third-party-offers-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(application_setting) - = hidden_field(:redirect_path, integrations_admin_application_settings_path) - %fieldset .form-group .form-check diff --git a/app/views/admin/application_settings/_usage.html.haml b/app/views/admin/application_settings/_usage.html.haml index c2d1b4fb3ed..788595877ea 100644 --- a/app/views/admin/application_settings/_usage.html.haml +++ b/app/views/admin/application_settings/_usage.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-usage-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, metrics_and_profiling_admin_application_settings_path) - %fieldset .form-group.mb-2 .form-check diff --git a/app/views/admin/application_settings/_visibility_and_access.html.haml b/app/views/admin/application_settings/_visibility_and_access.html.haml index b397aab9de2..0725ffb7f6c 100644 --- a/app/views/admin/application_settings/_visibility_and_access.html.haml +++ b/app/views/admin/application_settings/_visibility_and_access.html.haml @@ -1,8 +1,6 @@ = form_for @application_setting, url: admin_application_settings_path(anchor: 'js-visibility-settings'), html: { class: 'fieldset-form' } do |f| = form_errors(@application_setting) - = hidden_field(:redirect_path, admin_application_settings_path) - %fieldset .form-group = f.label :default_branch_protection, class: 'label-bold' -- cgit v1.2.1 From b4c7e7225a4c48a8a78344a2de2dd585cfd62027 Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Tue, 11 Sep 2018 08:50:35 +0200 Subject: load usage ping script on admin settings subpage only --- app/assets/javascripts/pages/admin/application_settings/index.js | 5 ----- .../admin/application_settings/metrics_and_profiling/index.js | 8 ++++++++ 2 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 app/assets/javascripts/pages/admin/application_settings/metrics_and_profiling/index.js diff --git a/app/assets/javascripts/pages/admin/application_settings/index.js b/app/assets/javascripts/pages/admin/application_settings/index.js index 069f8ce55d0..47bd70537f1 100644 --- a/app/assets/javascripts/pages/admin/application_settings/index.js +++ b/app/assets/javascripts/pages/admin/application_settings/index.js @@ -1,13 +1,8 @@ import initSettingsPanels from '~/settings_panels'; import projectSelect from '~/project_select'; -import UsagePingPayload from './usage_ping_payload'; document.addEventListener('DOMContentLoaded', () => { // Initialize expandable settings panels initSettingsPanels(); projectSelect(); - new UsagePingPayload( - document.querySelector('.js-usage-ping-payload-trigger'), - document.querySelector('.js-usage-ping-payload'), - ).init(); }); diff --git a/app/assets/javascripts/pages/admin/application_settings/metrics_and_profiling/index.js b/app/assets/javascripts/pages/admin/application_settings/metrics_and_profiling/index.js new file mode 100644 index 00000000000..c40503603be --- /dev/null +++ b/app/assets/javascripts/pages/admin/application_settings/metrics_and_profiling/index.js @@ -0,0 +1,8 @@ +import UsagePingPayload from './../usage_ping_payload'; + +document.addEventListener('DOMContentLoaded', () => { + new UsagePingPayload( + document.querySelector('.js-usage-ping-payload-trigger'), + document.querySelector('.js-usage-ping-payload'), + ).init(); +}); -- cgit v1.2.1 From 48ee697bf2fa4536be6dbee9cb579fde625d50b4 Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Tue, 11 Sep 2018 17:24:34 +0200 Subject: remove 'Geo' and 'Templates' template from CE and display menu items for EE only --- app/helpers/application_helper.rb | 10 +++++++++- app/views/admin/application_settings/geo.html.haml | 6 ------ .../admin/application_settings/templates.html.haml | 8 -------- app/views/layouts/nav/sidebar/_admin.html.haml | 22 ++++++++++++---------- 4 files changed, 21 insertions(+), 25 deletions(-) delete mode 100644 app/views/admin/application_settings/geo.html.haml delete mode 100644 app/views/admin/application_settings/templates.html.haml diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index bb7ae03313c..7846de9f481 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -6,7 +6,15 @@ require 'uri' module ApplicationHelper # See https://docs.gitlab.com/ee/development/ee_features.html#code-in-app-views def render_if_exists(partial, locals = {}) - render(partial, locals) if lookup_context.exists?(partial, [], true) + render(partial, locals) if partial_exists?(partial) + end + + def partial_exists?(partial) + lookup_context.exists?(partial, [], true) + end + + def view_exists?(partial) + lookup_context.exists?(partial, [], false) end # Check if a particular controller is the current one diff --git a/app/views/admin/application_settings/geo.html.haml b/app/views/admin/application_settings/geo.html.haml deleted file mode 100644 index b1741d9eef3..00000000000 --- a/app/views/admin/application_settings/geo.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -- breadcrumb_title "Geo" -- page_title "Geo" -- @content_class = "limit-container-width" unless fluid_layout -- expanded = Rails.env.test? - -= render_if_exists 'admin/application_settings/geo', expanded: expanded diff --git a/app/views/admin/application_settings/templates.html.haml b/app/views/admin/application_settings/templates.html.haml deleted file mode 100644 index dd814e59960..00000000000 --- a/app/views/admin/application_settings/templates.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -- breadcrumb_title "Templates" -- page_title "Templates" -- @content_class = "limit-container-width" unless fluid_layout -- expanded = Rails.env.test? - -= render_if_exists 'admin/application_settings/templates', expanded: expanded - -= render_if_exists 'admin/application_settings/custom_templates_form', expanded: expanded diff --git a/app/views/layouts/nav/sidebar/_admin.html.haml b/app/views/layouts/nav/sidebar/_admin.html.haml index cceea58b98e..f1aad481820 100644 --- a/app/views/layouts/nav/sidebar/_admin.html.haml +++ b/app/views/layouts/nav/sidebar/_admin.html.haml @@ -219,11 +219,12 @@ = link_to repository_admin_application_settings_path, title: _('Repository') do %span = _('Repository') - %li.divider.fly-out-top-item - = nav_link(path: 'application_settings#templates') do - = link_to templates_admin_application_settings_path, title: _('Templates') do - %span - = _('Templates') + - if view_exists?('admin/application_settings/templates') + %li.divider.fly-out-top-item + = nav_link(path: 'application_settings#templates') do + = link_to templates_admin_application_settings_path, title: _('Templates') do + %span + = _('Templates') %li.divider.fly-out-top-item = nav_link(path: 'application_settings#ci_cd') do = link_to ci_cd_admin_application_settings_path, title: _('CI/CD') do @@ -244,11 +245,12 @@ = link_to network_admin_application_settings_path, title: _('Network') do %span = _('Network') - %li.divider.fly-out-top-item - = nav_link(path: 'application_settings#geo') do - = link_to geo_admin_application_settings_path, title: _('Geo') do - %span - = _('Geo') + - if view_exists?('admin/application_settings/geo') + %li.divider.fly-out-top-item + = nav_link(path: 'application_settings#geo') do + = link_to geo_admin_application_settings_path, title: _('Geo') do + %span + = _('Geo') %li.divider.fly-out-top-item = nav_link(path: 'application_settings#preferences') do = link_to preferences_admin_application_settings_path, title: _('Preferences') do -- cgit v1.2.1 From 08a52c4058316afeeabead8322b0cdd9247a8a7a Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Thu, 13 Sep 2018 15:22:51 +0200 Subject: Removes divider in flyout menu --- app/views/layouts/nav/sidebar/_admin.html.haml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/app/views/layouts/nav/sidebar/_admin.html.haml b/app/views/layouts/nav/sidebar/_admin.html.haml index f1aad481820..e4945f46d42 100644 --- a/app/views/layouts/nav/sidebar/_admin.html.haml +++ b/app/views/layouts/nav/sidebar/_admin.html.haml @@ -199,6 +199,7 @@ = sprite_icon('settings') %span.nav-item-name = _('Settings') + %ul.sidebar-sub-level-items = nav_link(controller: :application_settings, html_options: { class: "fly-out-top-item" } ) do = link_to admin_application_settings_path do @@ -209,49 +210,40 @@ = link_to admin_application_settings_path, title: _('General') do %span = _('General') - %li.divider.fly-out-top-item = nav_link(path: 'application_settings#integrations') do = link_to integrations_admin_application_settings_path, title: _('Integrations') do %span = _('Integrations') - %li.divider.fly-out-top-item = nav_link(path: 'application_settings#repository') do = link_to repository_admin_application_settings_path, title: _('Repository') do %span = _('Repository') - if view_exists?('admin/application_settings/templates') - %li.divider.fly-out-top-item = nav_link(path: 'application_settings#templates') do = link_to templates_admin_application_settings_path, title: _('Templates') do %span = _('Templates') - %li.divider.fly-out-top-item = nav_link(path: 'application_settings#ci_cd') do = link_to ci_cd_admin_application_settings_path, title: _('CI/CD') do %span = _('CI/CD') - %li.divider.fly-out-top-item = nav_link(path: 'application_settings#reporting') do = link_to reporting_admin_application_settings_path, title: _('Reporting') do %span = _('Reporting') - %li.divider.fly-out-top-item = nav_link(path: 'application_settings#metrics_and_profiling') do = link_to metrics_and_profiling_admin_application_settings_path, title: _('Metrics and profiling') do %span = _('Metrics and profiling') - %li.divider.fly-out-top-item = nav_link(path: 'application_settings#network') do = link_to network_admin_application_settings_path, title: _('Network') do %span = _('Network') - if view_exists?('admin/application_settings/geo') - %li.divider.fly-out-top-item = nav_link(path: 'application_settings#geo') do = link_to geo_admin_application_settings_path, title: _('Geo') do %span = _('Geo') - %li.divider.fly-out-top-item = nav_link(path: 'application_settings#preferences') do = link_to preferences_admin_application_settings_path, title: _('Preferences') do %span -- cgit v1.2.1 From 378242d760ae4377730efee1319305dd60ed2476 Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Fri, 14 Sep 2018 14:37:05 +0200 Subject: Adds empty methods for 'geo' and 'templates' --- app/controllers/admin/application_settings_controller.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb index eba30f6b186..c7692161e93 100644 --- a/app/controllers/admin/application_settings_controller.rb +++ b/app/controllers/admin/application_settings_controller.rb @@ -4,6 +4,12 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController def show end + def geo + end + + def templates + end + def update successful = ApplicationSettings::UpdateService .new(@application_setting, current_user, application_setting_params) -- cgit v1.2.1 From 4f5f14a6e7704035328ff34f2d88b73934a92d2e Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Fri, 14 Sep 2018 16:26:28 +0200 Subject: Removes duplicated sections --- app/views/admin/application_settings/ci_cd.html.haml | 11 ----------- app/views/admin/application_settings/show.html.haml | 11 ----------- 2 files changed, 22 deletions(-) diff --git a/app/views/admin/application_settings/ci_cd.html.haml b/app/views/admin/application_settings/ci_cd.html.haml index 420b7746c98..5d0a7045eca 100644 --- a/app/views/admin/application_settings/ci_cd.html.haml +++ b/app/views/admin/application_settings/ci_cd.html.haml @@ -14,17 +14,6 @@ .settings-content = render 'ci_cd' -%section.settings.as-repository-check.no-animate#js-repository-check-settings{ class: ('expanded' if expanded) } - .settings-header - %h4 - = _('Repository maintenance') - %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') - %p - = _('Configure automatic git checks and housekeeping on repositories.') - .settings-content - = render 'repository_check' - - if Gitlab.config.registry.enabled %section.settings.as-registry.no-animate#js-registry-settings{ class: ('expanded' if expanded) } .settings-header diff --git a/app/views/admin/application_settings/show.html.haml b/app/views/admin/application_settings/show.html.haml index 44793db949c..47fde6e97f4 100644 --- a/app/views/admin/application_settings/show.html.haml +++ b/app/views/admin/application_settings/show.html.haml @@ -70,17 +70,6 @@ .settings-content = render 'koding' -%section.settings.as-plantuml.no-animate#js-plantuml-settings{ class: ('expanded' if expanded) } - .settings-header - %h4 - = _('PlantUML') - %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') - %p - = _('Allow rendering of PlantUML diagrams in Asciidoc documents.') - .settings-content - = render 'plantuml' - %section.settings.as-terminal.no-animate#js-terminal-settings{ class: ('expanded' if expanded) } .settings-header %h4 -- cgit v1.2.1 From 5aa5593113f6d3cfbc1eb2da0a236fbab851b7b4 Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Fri, 14 Sep 2018 17:43:16 +0200 Subject: Moves 'External Authorization' before 'Web terminal' --- app/views/admin/application_settings/show.html.haml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/admin/application_settings/show.html.haml b/app/views/admin/application_settings/show.html.haml index 47fde6e97f4..19f80a73eca 100644 --- a/app/views/admin/application_settings/show.html.haml +++ b/app/views/admin/application_settings/show.html.haml @@ -70,6 +70,8 @@ .settings-content = render 'koding' += render_if_exists 'admin/application_settings/external_authorization_service_form', expanded: expanded + %section.settings.as-terminal.no-animate#js-terminal-settings{ class: ('expanded' if expanded) } .settings-header %h4 -- cgit v1.2.1 From 7cbda61269db7c40ae2264aab4280050a03bbe36 Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Fri, 14 Sep 2018 17:49:11 +0200 Subject: Adds 'Snowplow' section to Integrations --- app/views/admin/application_settings/integrations.html.haml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/admin/application_settings/integrations.html.haml b/app/views/admin/application_settings/integrations.html.haml index 91e1ab95089..5790ae17708 100644 --- a/app/views/admin/application_settings/integrations.html.haml +++ b/app/views/admin/application_settings/integrations.html.haml @@ -28,3 +28,5 @@ = _('Control the display of third party offers.') .settings-content = render 'third_party_offers', application_setting: @application_setting + += render_if_exists 'admin/application_settings/snowplow', expanded: expanded -- cgit v1.2.1 From cecb0fdd7a0342574c134cd3ed9475debbfa3133 Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Tue, 18 Sep 2018 10:42:11 +0200 Subject: Adds translations --- app/views/admin/application_settings/ci_cd.html.haml | 4 ++-- app/views/admin/application_settings/integrations.html.haml | 4 ++-- app/views/admin/application_settings/metrics_and_profiling.html.haml | 4 ++-- app/views/admin/application_settings/network.html.haml | 4 ++-- app/views/admin/application_settings/preferences.html.haml | 4 ++-- app/views/admin/application_settings/reporting.html.haml | 4 ++-- app/views/admin/application_settings/repository.html.haml | 4 ++-- app/views/admin/application_settings/show.html.haml | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/views/admin/application_settings/ci_cd.html.haml b/app/views/admin/application_settings/ci_cd.html.haml index 5d0a7045eca..e984c832985 100644 --- a/app/views/admin/application_settings/ci_cd.html.haml +++ b/app/views/admin/application_settings/ci_cd.html.haml @@ -1,5 +1,5 @@ -- breadcrumb_title "CI/CD" -- page_title "CI/CD" +- breadcrumb_title _("CI/CD") +- page_title _("CI/CD") - @content_class = "limit-container-width" unless fluid_layout - expanded = Rails.env.test? diff --git a/app/views/admin/application_settings/integrations.html.haml b/app/views/admin/application_settings/integrations.html.haml index 5790ae17708..700c2e15ae6 100644 --- a/app/views/admin/application_settings/integrations.html.haml +++ b/app/views/admin/application_settings/integrations.html.haml @@ -1,5 +1,5 @@ -- breadcrumb_title "Integrations" -- page_title "Integrations" +- breadcrumb_title _("Integrations") +- page_title _("Integrations") - @content_class = "limit-container-width" unless fluid_layout - expanded = Rails.env.test? diff --git a/app/views/admin/application_settings/metrics_and_profiling.html.haml b/app/views/admin/application_settings/metrics_and_profiling.html.haml index a5ff14188bd..821235c00c7 100644 --- a/app/views/admin/application_settings/metrics_and_profiling.html.haml +++ b/app/views/admin/application_settings/metrics_and_profiling.html.haml @@ -1,5 +1,5 @@ -- breadcrumb_title "Metrics and profiling" -- page_title "Metrics and profiling" +- breadcrumb_title _("Metrics and profiling") +- page_title _("Metrics and profiling") - @content_class = "limit-container-width" unless fluid_layout - expanded = Rails.env.test? diff --git a/app/views/admin/application_settings/network.html.haml b/app/views/admin/application_settings/network.html.haml index 49eca70a71d..27cea347bb1 100644 --- a/app/views/admin/application_settings/network.html.haml +++ b/app/views/admin/application_settings/network.html.haml @@ -1,5 +1,5 @@ -- breadcrumb_title "Network" -- page_title "Network" +- breadcrumb_title _("Network") +- page_title _("Network") - @content_class = "limit-container-width" unless fluid_layout - expanded = Rails.env.test? diff --git a/app/views/admin/application_settings/preferences.html.haml b/app/views/admin/application_settings/preferences.html.haml index e92aa3f6e9f..74be9d130c5 100644 --- a/app/views/admin/application_settings/preferences.html.haml +++ b/app/views/admin/application_settings/preferences.html.haml @@ -1,5 +1,5 @@ -- breadcrumb_title "Preferences" -- page_title "Preferences" +- breadcrumb_title _("Preferences") +- page_title _("Preferences") - @content_class = "limit-container-width" unless fluid_layout - expanded = Rails.env.test? diff --git a/app/views/admin/application_settings/reporting.html.haml b/app/views/admin/application_settings/reporting.html.haml index edc2c37e248..70da89694f8 100644 --- a/app/views/admin/application_settings/reporting.html.haml +++ b/app/views/admin/application_settings/reporting.html.haml @@ -1,5 +1,5 @@ -- breadcrumb_title "Reporting" -- page_title "Reporting" +- breadcrumb_title _("Reporting") +- page_title _("Reporting") - @content_class = "limit-container-width" unless fluid_layout - expanded = Rails.env.test? diff --git a/app/views/admin/application_settings/repository.html.haml b/app/views/admin/application_settings/repository.html.haml index b5ff10f79e2..b6289986a37 100644 --- a/app/views/admin/application_settings/repository.html.haml +++ b/app/views/admin/application_settings/repository.html.haml @@ -1,5 +1,5 @@ -- breadcrumb_title "Repository" -- page_title "Repository" +- breadcrumb_title _("Repository") +- page_title _("Repository") - @content_class = "limit-container-width" unless fluid_layout - expanded = Rails.env.test? diff --git a/app/views/admin/application_settings/show.html.haml b/app/views/admin/application_settings/show.html.haml index 19f80a73eca..70e276b8162 100644 --- a/app/views/admin/application_settings/show.html.haml +++ b/app/views/admin/application_settings/show.html.haml @@ -1,5 +1,5 @@ -- breadcrumb_title "Settings" -- page_title "Settings" +- breadcrumb_title _("Settings") +- page_title _("Settings") - @content_class = "limit-container-width" unless fluid_layout - expanded = Rails.env.test? -- cgit v1.2.1 From 68ac430af9989fe4f93075e5bc426f8e2c55cf3d Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Tue, 18 Sep 2018 10:43:19 +0200 Subject: Rename helper method --- app/helpers/application_helper.rb | 4 ++-- app/views/layouts/nav/sidebar/_admin.html.haml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7846de9f481..604ddd55ff5 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -13,8 +13,8 @@ module ApplicationHelper lookup_context.exists?(partial, [], true) end - def view_exists?(partial) - lookup_context.exists?(partial, [], false) + def template_exists?(template) + lookup_context.exists?(template, [], false) end # Check if a particular controller is the current one diff --git a/app/views/layouts/nav/sidebar/_admin.html.haml b/app/views/layouts/nav/sidebar/_admin.html.haml index e4945f46d42..a2636f8179a 100644 --- a/app/views/layouts/nav/sidebar/_admin.html.haml +++ b/app/views/layouts/nav/sidebar/_admin.html.haml @@ -218,7 +218,7 @@ = link_to repository_admin_application_settings_path, title: _('Repository') do %span = _('Repository') - - if view_exists?('admin/application_settings/templates') + - if template_exists?('admin/application_settings/templates') = nav_link(path: 'application_settings#templates') do = link_to templates_admin_application_settings_path, title: _('Templates') do %span @@ -239,7 +239,7 @@ = link_to network_admin_application_settings_path, title: _('Network') do %span = _('Network') - - if view_exists?('admin/application_settings/geo') + - if template_exists?('admin/application_settings/geo') = nav_link(path: 'application_settings#geo') do = link_to geo_admin_application_settings_path, title: _('Geo') do %span -- cgit v1.2.1 From a7071deddcdfc01c6a9ade261569569882cdb955 Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Tue, 18 Sep 2018 10:47:05 +0200 Subject: Parse request.referer properly --- app/controllers/admin/application_settings_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb index c7692161e93..6beed4b7dd2 100644 --- a/app/controllers/admin/application_settings_controller.rb +++ b/app/controllers/admin/application_settings_controller.rb @@ -19,7 +19,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController session[:ask_for_usage_stats_consent] = current_user.requires_usage_stats_consent? end - redirect_path = request.referer.presence ? request.referer : admin_application_settings_path + redirect_path = request.referer.presence ? URI(request.referer).path : admin_application_settings_path respond_to do |format| if successful -- cgit v1.2.1 From 0df11843bf014711cbefe92a8ad76cff731c4eb0 Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Tue, 18 Sep 2018 17:00:00 +0200 Subject: Groups test cases by context --- spec/features/admin/admin_settings_spec.rb | 544 ++++++++++++++--------------- 1 file changed, 266 insertions(+), 278 deletions(-) diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index 79413528291..3fb818af8f0 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -11,385 +11,373 @@ describe 'Admin updates settings' do sign_in(admin) end - it 'Change visibility settings' do - visit admin_application_settings_path - - page.within('.as-visibility-access') do - choose "application_setting_default_project_visibility_20" - click_button 'Save changes' + context 'General page' do + before do + visit admin_application_settings_path end - expect(page).to have_content "Application settings saved successfully" - end - - it 'Uncheck all restricted visibility levels' do - visit admin_application_settings_path + it 'Change visibility settings' do + page.within('.as-visibility-access') do + choose "application_setting_default_project_visibility_20" + click_button 'Save changes' + end - page.within('.as-visibility-access') do - find('#application_setting_visibility_level_0').set(false) - find('#application_setting_visibility_level_10').set(false) - find('#application_setting_visibility_level_20').set(false) - click_button 'Save changes' + expect(page).to have_content "Application settings saved successfully" end - expect(page).to have_content "Application settings saved successfully" - expect(find('#application_setting_visibility_level_0')).not_to be_checked - expect(find('#application_setting_visibility_level_10')).not_to be_checked - expect(find('#application_setting_visibility_level_20')).not_to be_checked - end + it 'Uncheck all restricted visibility levels' do + page.within('.as-visibility-access') do + find('#application_setting_visibility_level_0').set(false) + find('#application_setting_visibility_level_10').set(false) + find('#application_setting_visibility_level_20').set(false) + click_button 'Save changes' + end + + expect(page).to have_content "Application settings saved successfully" + expect(find('#application_setting_visibility_level_0')).not_to be_checked + expect(find('#application_setting_visibility_level_10')).not_to be_checked + expect(find('#application_setting_visibility_level_20')).not_to be_checked + end - it 'Modify import sources' do - visit admin_application_settings_path + it 'Modify import sources' do + expect(Gitlab::CurrentSettings.import_sources).not_to be_empty - expect(Gitlab::CurrentSettings.import_sources).not_to be_empty + page.within('.as-visibility-access') do + Gitlab::ImportSources.options.map do |name, _| + uncheck name + end - page.within('.as-visibility-access') do - Gitlab::ImportSources.options.map do |name, _| - uncheck name + click_button 'Save changes' end - click_button 'Save changes' - end + expect(page).to have_content "Application settings saved successfully" + expect(Gitlab::CurrentSettings.import_sources).to be_empty - expect(page).to have_content "Application settings saved successfully" - expect(Gitlab::CurrentSettings.import_sources).to be_empty + page.within('.as-visibility-access') do + check "Repo by URL" + click_button 'Save changes' + end - page.within('.as-visibility-access') do - check "Repo by URL" - click_button 'Save changes' + expect(page).to have_content "Application settings saved successfully" + expect(Gitlab::CurrentSettings.import_sources).to eq(['git']) end - expect(page).to have_content "Application settings saved successfully" - expect(Gitlab::CurrentSettings.import_sources).to eq(['git']) - end - - it 'Change Visibility and Access Controls' do - visit admin_application_settings_path + it 'Change Visibility and Access Controls' do + page.within('.as-visibility-access') do + uncheck 'Project export enabled' + click_button 'Save changes' + end - page.within('.as-visibility-access') do - uncheck 'Project export enabled' - click_button 'Save changes' + expect(Gitlab::CurrentSettings.project_export_enabled).to be_falsey + expect(page).to have_content "Application settings saved successfully" end - expect(Gitlab::CurrentSettings.project_export_enabled).to be_falsey - expect(page).to have_content "Application settings saved successfully" - end + it 'Change Keys settings' do + page.within('.as-visibility-access') do + select 'Are forbidden', from: 'RSA SSH keys' + select 'Are allowed', from: 'DSA SSH keys' + select 'Must be at least 384 bits', from: 'ECDSA SSH keys' + select 'Are forbidden', from: 'ED25519 SSH keys' + click_on 'Save changes' + end - it 'Change Account and Limit Settings' do - visit admin_application_settings_path + forbidden = ApplicationSetting::FORBIDDEN_KEY_VALUE.to_s - page.within('.as-account-limit') do - uncheck 'Gravatar enabled' - click_button 'Save changes' + expect(page).to have_content 'Application settings saved successfully' + expect(find_field('RSA SSH keys').value).to eq(forbidden) + expect(find_field('DSA SSH keys').value).to eq('0') + expect(find_field('ECDSA SSH keys').value).to eq('384') + expect(find_field('ED25519 SSH keys').value).to eq(forbidden) end - expect(Gitlab::CurrentSettings.gravatar_enabled).to be_falsey - expect(page).to have_content "Application settings saved successfully" - end + it 'Change Account and Limit Settings' do + page.within('.as-account-limit') do + uncheck 'Gravatar enabled' + click_button 'Save changes' + end - it 'Change New users set to external', :js do - visit admin_application_settings_path + expect(Gitlab::CurrentSettings.gravatar_enabled).to be_falsey + expect(page).to have_content "Application settings saved successfully" + end - user_internal_regex = find('#application_setting_user_default_internal_regex', visible: :all) + it 'Change New users set to external', :js do + user_internal_regex = find('#application_setting_user_default_internal_regex', visible: :all) - expect(user_internal_regex).to be_readonly - expect(user_internal_regex['placeholder']).to eq 'To define internal users, first enable new users set to external' + expect(user_internal_regex).to be_readonly + expect(user_internal_regex['placeholder']).to eq 'To define internal users, first enable new users set to external' - check 'application_setting_user_default_external' + check 'application_setting_user_default_external' - expect(user_internal_regex).not_to be_readonly - expect(user_internal_regex['placeholder']).to eq 'Regex pattern' - end + expect(user_internal_regex).not_to be_readonly + expect(user_internal_regex['placeholder']).to eq 'Regex pattern' + end - it 'Change Sign-in restrictions' do - visit admin_application_settings_path + it 'Change Sign-in restrictions' do + page.within('.as-signin') do + fill_in 'Home page URL', with: 'https://about.gitlab.com/' + click_button 'Save changes' + end - page.within('.as-signin') do - fill_in 'Home page URL', with: 'https://about.gitlab.com/' - click_button 'Save changes' + expect(Gitlab::CurrentSettings.home_page_url).to eq "https://about.gitlab.com/" + expect(page).to have_content "Application settings saved successfully" end - expect(Gitlab::CurrentSettings.home_page_url).to eq "https://about.gitlab.com/" - expect(page).to have_content "Application settings saved successfully" - end - - it 'Terms of Service' do - visit admin_application_settings_path + it 'Terms of Service' do + # Already have the admin accept terms, so they don't need to accept in this spec. + _existing_terms = create(:term) + accept_terms(admin) - # Already have the admin accept terms, so they don't need to accept in this spec. - _existing_terms = create(:term) - accept_terms(admin) + page.within('.as-terms') do + check 'Require all users to accept Terms of Service and Privacy Policy when they access GitLab.' + fill_in 'Terms of Service Agreement', with: 'Be nice!' + click_button 'Save changes' + end - page.within('.as-terms') do - check 'Require all users to accept Terms of Service and Privacy Policy when they access GitLab.' - fill_in 'Terms of Service Agreement', with: 'Be nice!' - click_button 'Save changes' + expect(Gitlab::CurrentSettings.enforce_terms).to be(true) + expect(Gitlab::CurrentSettings.terms).to eq 'Be nice!' + expect(page).to have_content 'Application settings saved successfully' end - expect(Gitlab::CurrentSettings.enforce_terms).to be(true) - expect(Gitlab::CurrentSettings.terms).to eq 'Be nice!' - expect(page).to have_content 'Application settings saved successfully' - end + it 'Modify oauth providers' do + expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).to be_empty - it 'Modify oauth providers' do - visit admin_application_settings_path + page.within('.as-signin') do + uncheck 'Google' + click_button 'Save changes' + end + + expect(page).to have_content "Application settings saved successfully" + expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).to include('google_oauth2') - expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).to be_empty + page.within('.as-signin') do + check "Google" + click_button 'Save changes' + end - page.within('.as-signin') do - uncheck 'Google' - click_button 'Save changes' + expect(page).to have_content "Application settings saved successfully" + expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).not_to include('google_oauth2') end - expect(page).to have_content "Application settings saved successfully" - expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).to include('google_oauth2') + it 'Oauth providers do not raise validation errors when saving unrelated changes' do + expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).to be_empty - page.within('.as-signin') do - check "Google" - click_button 'Save changes' - end + page.within('.as-signin') do + uncheck 'Google' + click_button 'Save changes' + end - expect(page).to have_content "Application settings saved successfully" - expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).not_to include('google_oauth2') - end + expect(page).to have_content "Application settings saved successfully" + expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).to include('google_oauth2') - it 'Oauth providers do not raise validation errors when saving unrelated changes' do - visit admin_application_settings_path + # Remove google_oauth2 from the Omniauth strategies + allow(Devise).to receive(:omniauth_providers).and_return([]) - expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).to be_empty + # Save an unrelated setting + page.within('.as-terms') do + click_button 'Save changes' + end - page.within('.as-signin') do - uncheck 'Google' - click_button 'Save changes' + expect(page).to have_content "Application settings saved successfully" + expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).to include('google_oauth2') end - expect(page).to have_content "Application settings saved successfully" - expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).to include('google_oauth2') - - # Remove google_oauth2 from the Omniauth strategies - allow(Devise).to receive(:omniauth_providers).and_return([]) + it 'Configure web terminal' do + page.within('.as-terminal') do + fill_in 'Max session time', with: 15 + click_button 'Save changes' + end - # Save an unrelated setting - page.within('.as-terms') do - click_button 'Save changes' + expect(page).to have_content "Application settings saved successfully" + expect(Gitlab::CurrentSettings.terminal_max_session_time).to eq(15) end - - expect(page).to have_content "Application settings saved successfully" - expect(Gitlab::CurrentSettings.disabled_oauth_sign_in_sources).to include('google_oauth2') end - it 'Change Help page' do - visit preferences_admin_application_settings_path - - page.within('.as-help-page') do - fill_in 'Help page text', with: 'Example text' - check 'Hide marketing-related entries from help' - fill_in 'Support page URL', with: 'http://example.com/help' - click_button 'Save changes' + context 'Integrations page' do + before do + visit integrations_admin_application_settings_path end - expect(Gitlab::CurrentSettings.help_page_text).to eq "Example text" - expect(Gitlab::CurrentSettings.help_page_hide_commercial_content).to be_truthy - expect(Gitlab::CurrentSettings.help_page_support_url).to eq "http://example.com/help" - expect(page).to have_content "Application settings saved successfully" - end - - it 'Change Pages settings' do - visit preferences_admin_application_settings_path + it 'Enable hiding third party offers' do + page.within('.as-third-party-offers') do + check 'Do not display offers from third parties within GitLab' + click_button 'Save changes' + end - page.within('.as-pages') do - fill_in 'Maximum size of pages (MB)', with: 15 - check 'Require users to prove ownership of custom domains' - click_button 'Save changes' + expect(page).to have_content "Application settings saved successfully" + expect(Gitlab::CurrentSettings.hide_third_party_offers).to be true end - expect(Gitlab::CurrentSettings.max_pages_size).to eq 15 - expect(Gitlab::CurrentSettings.pages_domain_verification_enabled?).to be_truthy - expect(page).to have_content "Application settings saved successfully" - end + it 'Change Slack Notifications Service template settings' do + first(:link, 'Service Templates').click + click_link 'Slack notifications' + fill_in 'Webhook', with: 'http://localhost' + fill_in 'Username', with: 'test_user' + fill_in 'service_push_channel', with: '#test_channel' + page.check('Notify only broken pipelines') + page.check('Notify only default branch') - it 'Change CI/CD settings' do - visit ci_cd_admin_application_settings_path + check_all_events + click_on 'Save' - page.within('.as-ci-cd') do - check 'Default to Auto DevOps pipeline for all projects' - fill_in 'Auto devops domain', with: 'domain.com' - click_button 'Save changes' - end + expect(page).to have_content 'Application settings saved successfully' - expect(Gitlab::CurrentSettings.auto_devops_enabled?).to be true - expect(Gitlab::CurrentSettings.auto_devops_domain).to eq('domain.com') - expect(page).to have_content "Application settings saved successfully" - end + click_link 'Slack notifications' - it 'Change Influx settings' do - visit metrics_and_profiling_admin_application_settings_path - - page.within('.as-influx') do - check 'Enable InfluxDB Metrics' - click_button 'Save changes' + page.all('input[type=checkbox]').each do |checkbox| + expect(checkbox).to be_checked + end + expect(find_field('Webhook').value).to eq 'http://localhost' + expect(find_field('Username').value).to eq 'test_user' + expect(find('#service_push_channel').value).to eq '#test_channel' end - - expect(Gitlab::CurrentSettings.metrics_enabled?).to be true - expect(page).to have_content "Application settings saved successfully" end - it 'Change Prometheus settings' do - visit metrics_and_profiling_admin_application_settings_path + context 'CI/CD page' do + it 'Change CI/CD settings' do + visit ci_cd_admin_application_settings_path - page.within('.as-prometheus') do - check 'Enable Prometheus Metrics' - click_button 'Save changes' - end + page.within('.as-ci-cd') do + check 'Default to Auto DevOps pipeline for all projects' + fill_in 'Auto devops domain', with: 'domain.com' + click_button 'Save changes' + end - expect(Gitlab::CurrentSettings.prometheus_metrics_enabled?).to be true - expect(page).to have_content "Application settings saved successfully" + expect(Gitlab::CurrentSettings.auto_devops_enabled?).to be true + expect(Gitlab::CurrentSettings.auto_devops_domain).to eq('domain.com') + expect(page).to have_content "Application settings saved successfully" + end end - it 'Change Performance bar settings' do - visit metrics_and_profiling_admin_application_settings_path + context 'Reporting page' do + it 'Change Spam settings' do + visit reporting_admin_application_settings_path - group = create(:group) + page.within('.as-spam') do + check 'Enable reCAPTCHA' + fill_in 'reCAPTCHA Site Key', with: 'key' + fill_in 'reCAPTCHA Private Key', with: 'key' + fill_in 'IPs per user', with: 15 + click_button 'Save changes' + end - page.within('.as-performance-bar') do - check 'Enable the Performance Bar' - fill_in 'Allowed group', with: group.path - click_on 'Save changes' + expect(page).to have_content "Application settings saved successfully" + expect(Gitlab::CurrentSettings.recaptcha_enabled).to be true + expect(Gitlab::CurrentSettings.unique_ips_limit_per_user).to eq(15) end + end - expect(page).to have_content "Application settings saved successfully" - expect(find_field('Enable the Performance Bar')).to be_checked - expect(find_field('Allowed group').value).to eq group.path - - page.within('.as-performance-bar') do - uncheck 'Enable the Performance Bar' - click_on 'Save changes' + context 'Metrics and profiling page' do + before do + visit metrics_and_profiling_admin_application_settings_path end - expect(page).to have_content 'Application settings saved successfully' - expect(find_field('Enable the Performance Bar')).not_to be_checked - expect(find_field('Allowed group').value).to be_nil - end - - it 'Change Background jobs settings' do - visit preferences_admin_application_settings_path + it 'Change Influx settings' do + page.within('.as-influx') do + check 'Enable InfluxDB Metrics' + click_button 'Save changes' + end - page.within('.as-background') do - fill_in 'Throttling Factor', with: 1 - click_button 'Save changes' + expect(Gitlab::CurrentSettings.metrics_enabled?).to be true + expect(page).to have_content "Application settings saved successfully" end - expect(Gitlab::CurrentSettings.sidekiq_throttling_factor).to eq(1) - expect(page).to have_content "Application settings saved successfully" - end - - it 'Change Spam settings' do - visit reporting_admin_application_settings_path + it 'Change Prometheus settings' do + page.within('.as-prometheus') do + check 'Enable Prometheus Metrics' + click_button 'Save changes' + end - page.within('.as-spam') do - check 'Enable reCAPTCHA' - fill_in 'reCAPTCHA Site Key', with: 'key' - fill_in 'reCAPTCHA Private Key', with: 'key' - fill_in 'IPs per user', with: 15 - click_button 'Save changes' + expect(Gitlab::CurrentSettings.prometheus_metrics_enabled?).to be true + expect(page).to have_content "Application settings saved successfully" end - expect(page).to have_content "Application settings saved successfully" - expect(Gitlab::CurrentSettings.recaptcha_enabled).to be true - expect(Gitlab::CurrentSettings.unique_ips_limit_per_user).to eq(15) - end - - it 'Configure web terminal' do - visit admin_application_settings_path + it 'Change Performance bar settings' do + group = create(:group) - page.within('.as-terminal') do - fill_in 'Max session time', with: 15 - click_button 'Save changes' - end + page.within('.as-performance-bar') do + check 'Enable the Performance Bar' + fill_in 'Allowed group', with: group.path + click_on 'Save changes' + end - expect(page).to have_content "Application settings saved successfully" - expect(Gitlab::CurrentSettings.terminal_max_session_time).to eq(15) - end + expect(page).to have_content "Application settings saved successfully" + expect(find_field('Enable the Performance Bar')).to be_checked + expect(find_field('Allowed group').value).to eq group.path - it 'Enable outbound requests' do - visit network_admin_application_settings_path + page.within('.as-performance-bar') do + uncheck 'Enable the Performance Bar' + click_on 'Save changes' + end - page.within('.as-outbound') do - check 'Allow requests to the local network from hooks and services' - click_button 'Save changes' + expect(page).to have_content 'Application settings saved successfully' + expect(find_field('Enable the Performance Bar')).not_to be_checked + expect(find_field('Allowed group').value).to be_nil end - expect(page).to have_content "Application settings saved successfully" - expect(Gitlab::CurrentSettings.allow_local_requests_from_hooks_and_services).to be true - end + it 'loads usage ping payload on click', :js do + expect(page).to have_button 'Preview payload' - it 'Enable hiding third party offers' do - visit integrations_admin_application_settings_path + find('.js-usage-ping-payload-trigger').click - page.within('.as-third-party-offers') do - check 'Do not display offers from third parties within GitLab' - click_button 'Save changes' + expect(page).to have_selector '.js-usage-ping-payload' + expect(page).to have_button 'Hide payload' end - - expect(page).to have_content "Application settings saved successfully" - expect(Gitlab::CurrentSettings.hide_third_party_offers).to be true end - it 'Change Slack Notifications Service template settings' do - visit integrations_admin_application_settings_path - - first(:link, 'Service Templates').click - click_link 'Slack notifications' - fill_in 'Webhook', with: 'http://localhost' - fill_in 'Username', with: 'test_user' - fill_in 'service_push_channel', with: '#test_channel' - page.check('Notify only broken pipelines') - page.check('Notify only default branch') - - check_all_events - click_on 'Save' - - expect(page).to have_content 'Application settings saved successfully' + context 'Network page' do + it 'Enable outbound requests' do + visit network_admin_application_settings_path - click_link 'Slack notifications' + page.within('.as-outbound') do + check 'Allow requests to the local network from hooks and services' + click_button 'Save changes' + end - page.all('input[type=checkbox]').each do |checkbox| - expect(checkbox).to be_checked + expect(page).to have_content "Application settings saved successfully" + expect(Gitlab::CurrentSettings.allow_local_requests_from_hooks_and_services).to be true end - expect(find_field('Webhook').value).to eq 'http://localhost' - expect(find_field('Username').value).to eq 'test_user' - expect(find('#service_push_channel').value).to eq '#test_channel' end - it 'Change Keys settings' do - visit admin_application_settings_path - - page.within('.as-visibility-access') do - select 'Are forbidden', from: 'RSA SSH keys' - select 'Are allowed', from: 'DSA SSH keys' - select 'Must be at least 384 bits', from: 'ECDSA SSH keys' - select 'Are forbidden', from: 'ED25519 SSH keys' - click_on 'Save changes' + context 'Preferences page' do + before do + visit preferences_admin_application_settings_path end - forbidden = ApplicationSetting::FORBIDDEN_KEY_VALUE.to_s + it 'Change Help page' do + page.within('.as-help-page') do + fill_in 'Help page text', with: 'Example text' + check 'Hide marketing-related entries from help' + fill_in 'Support page URL', with: 'http://example.com/help' + click_button 'Save changes' + end - expect(page).to have_content 'Application settings saved successfully' - expect(find_field('RSA SSH keys').value).to eq(forbidden) - expect(find_field('DSA SSH keys').value).to eq('0') - expect(find_field('ECDSA SSH keys').value).to eq('384') - expect(find_field('ED25519 SSH keys').value).to eq(forbidden) - end + expect(Gitlab::CurrentSettings.help_page_text).to eq "Example text" + expect(Gitlab::CurrentSettings.help_page_hide_commercial_content).to be_truthy + expect(Gitlab::CurrentSettings.help_page_support_url).to eq "http://example.com/help" + expect(page).to have_content "Application settings saved successfully" + end - it 'loads usage ping payload on click', :js do - visit metrics_and_profiling_admin_application_settings_path + it 'Change Pages settings' do + page.within('.as-pages') do + fill_in 'Maximum size of pages (MB)', with: 15 + check 'Require users to prove ownership of custom domains' + click_button 'Save changes' + end - expect(page).to have_button 'Preview payload' + expect(Gitlab::CurrentSettings.max_pages_size).to eq 15 + expect(Gitlab::CurrentSettings.pages_domain_verification_enabled?).to be_truthy + expect(page).to have_content "Application settings saved successfully" + end - find('.js-usage-ping-payload-trigger').click + it 'Change Background jobs settings' do + page.within('.as-background') do + fill_in 'Throttling Factor', with: 1 + click_button 'Save changes' + end - expect(page).to have_selector '.js-usage-ping-payload' - expect(page).to have_button 'Hide payload' + expect(Gitlab::CurrentSettings.sidekiq_throttling_factor).to eq(1) + expect(page).to have_content "Application settings saved successfully" + end end def check_all_events -- cgit v1.2.1 From df9cb93091838b6c4661c974436ce9120d9b1983 Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Wed, 19 Sep 2018 12:57:14 +0200 Subject: Add empty controller actions and utilize referer_path helper --- .../admin/application_settings_controller.rb | 26 ++++++++++++++++++++-- app/controllers/concerns/internal_redirect.rb | 6 +++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb index 6beed4b7dd2..51f75fb77f0 100644 --- a/app/controllers/admin/application_settings_controller.rb +++ b/app/controllers/admin/application_settings_controller.rb @@ -1,15 +1,37 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController + include InternalRedirect before_action :set_application_setting def show end - def geo + def integrations + end + + def repository end def templates end + def ci_cd + end + + def reporting + end + + def metrics_and_profiling + end + + def network + end + + def geo + end + + def preferences + end + def update successful = ApplicationSettings::UpdateService .new(@application_setting, current_user, application_setting_params) @@ -19,7 +41,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController session[:ask_for_usage_stats_consent] = current_user.requires_usage_stats_consent? end - redirect_path = request.referer.presence ? URI(request.referer).path : admin_application_settings_path + redirect_path = referer_path(request) || admin_application_settings_path respond_to do |format| if successful diff --git a/app/controllers/concerns/internal_redirect.rb b/app/controllers/concerns/internal_redirect.rb index 10b9852e329..6ac9e860437 100644 --- a/app/controllers/concerns/internal_redirect.rb +++ b/app/controllers/concerns/internal_redirect.rb @@ -36,4 +36,10 @@ module InternalRedirect path_with_query = [uri.path, uri.query].compact.join('?') [path_with_query, uri.fragment].compact.join("#") end + + def referer_path(request) + return unless request.referer.presence + + URI(request.referer).path + end end -- cgit v1.2.1 From 26225e778d7e5beb9861756890bf2fddb19af77b Mon Sep 17 00:00:00 2001 From: Martin Wortschack Date: Wed, 19 Sep 2018 12:57:57 +0200 Subject: Utilize expanded_by_default --- app/helpers/application_settings_helper.rb | 4 +++ .../admin/application_settings/ci_cd.html.haml | 9 +++--- .../application_settings/integrations.html.haml | 15 +++++----- .../metrics_and_profiling.html.haml | 19 ++++++------ .../admin/application_settings/network.html.haml | 13 ++++---- .../application_settings/preferences.html.haml | 25 ++++++++-------- .../admin/application_settings/reporting.html.haml | 13 ++++---- .../application_settings/repository.html.haml | 13 ++++---- .../admin/application_settings/show.html.haml | 35 +++++++++++----------- 9 files changed, 71 insertions(+), 75 deletions(-) diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb index 3ebf0162cb6..dc393968786 100644 --- a/app/helpers/application_settings_helper.rb +++ b/app/helpers/application_settings_helper.rb @@ -264,4 +264,8 @@ module ApplicationSettingsHelper :web_ide_clientside_preview_enabled ] end + + def expanded_by_default? + Rails.env.test? + end end diff --git a/app/views/admin/application_settings/ci_cd.html.haml b/app/views/admin/application_settings/ci_cd.html.haml index e984c832985..db24c9982f7 100644 --- a/app/views/admin/application_settings/ci_cd.html.haml +++ b/app/views/admin/application_settings/ci_cd.html.haml @@ -1,26 +1,25 @@ - breadcrumb_title _("CI/CD") - page_title _("CI/CD") - @content_class = "limit-container-width" unless fluid_layout -- expanded = Rails.env.test? -%section.settings.as-ci-cd.no-animate#js-ci-cd-settings{ class: ('expanded' if expanded) } +%section.settings.as-ci-cd.no-animate#js-ci-cd-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Continuous Integration and Deployment') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Auto DevOps, runners and job artifacts') .settings-content = render 'ci_cd' - if Gitlab.config.registry.enabled - %section.settings.as-registry.no-animate#js-registry-settings{ class: ('expanded' if expanded) } + %section.settings.as-registry.no-animate#js-registry-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Container Registry') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Various container registry settings.') .settings-content diff --git a/app/views/admin/application_settings/integrations.html.haml b/app/views/admin/application_settings/integrations.html.haml index 700c2e15ae6..310e86b1377 100644 --- a/app/views/admin/application_settings/integrations.html.haml +++ b/app/views/admin/application_settings/integrations.html.haml @@ -1,32 +1,31 @@ - breadcrumb_title _("Integrations") - page_title _("Integrations") - @content_class = "limit-container-width" unless fluid_layout -- expanded = Rails.env.test? -= render_if_exists 'admin/application_settings/elasticsearch_form', expanded: expanded += render_if_exists 'admin/application_settings/elasticsearch_form', expanded: expanded_by_default? -%section.settings.as-plantuml.no-animate#js-plantuml-settings{ class: ('expanded' if expanded) } +%section.settings.as-plantuml.no-animate#js-plantuml-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('PlantUML') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Allow rendering of PlantUML diagrams in Asciidoc documents.') .settings-content = render 'plantuml' -= render_if_exists 'admin/application_settings/slack', expanded: expanded += render_if_exists 'admin/application_settings/slack', expanded: expanded_by_default? -%section.settings.as-third-party-offers.no-animate#js-third-party-offers-settings{ class: ('expanded' if expanded) } +%section.settings.as-third-party-offers.no-animate#js-third-party-offers-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Third party offers') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Control the display of third party offers.') .settings-content = render 'third_party_offers', application_setting: @application_setting -= render_if_exists 'admin/application_settings/snowplow', expanded: expanded += render_if_exists 'admin/application_settings/snowplow', expanded: expanded_by_default? diff --git a/app/views/admin/application_settings/metrics_and_profiling.html.haml b/app/views/admin/application_settings/metrics_and_profiling.html.haml index 821235c00c7..f50aca32bdf 100644 --- a/app/views/admin/application_settings/metrics_and_profiling.html.haml +++ b/app/views/admin/application_settings/metrics_and_profiling.html.haml @@ -1,51 +1,50 @@ - breadcrumb_title _("Metrics and profiling") - page_title _("Metrics and profiling") - @content_class = "limit-container-width" unless fluid_layout -- expanded = Rails.env.test? -%section.settings.as-influx.no-animate#js-influx-settings{ class: ('expanded' if expanded) } +%section.settings.as-influx.no-animate#js-influx-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Metrics - Influx') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Enable and configure InfluxDB metrics.') .settings-content = render 'influx' -%section.settings.as-prometheus.no-animate#js-prometheus-settings{ class: ('expanded' if expanded) } +%section.settings.as-prometheus.no-animate#js-prometheus-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Metrics - Prometheus') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Enable and configure Prometheus metrics.') .settings-content = render 'prometheus' -%section.settings.as-performance-bar.no-animate#js-performance-bar-settings{ class: ('expanded' if expanded) } +%section.settings.as-performance-bar.no-animate#js-performance-bar-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Profiling - Performance bar') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Enable the Performance Bar for a given group.') = link_to icon('question-circle'), help_page_path('administration/monitoring/performance/performance_bar') .settings-content = render 'performance_bar' -%section.settings.as-usage.no-animate#js-usage-settings{ class: ('expanded' if expanded) } +%section.settings.as-usage.no-animate#js-usage-settings{ class: ('expanded' if expanded_by_default?) } .settings-header#usage-statistics %h4 = _('Usage statistics') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Enable or disable version check and usage ping.') .settings-content = render 'usage' -= render_if_exists 'admin/application_settings/pseudonymizer_settings', expanded: expanded += render_if_exists 'admin/application_settings/pseudonymizer_settings', expanded: expanded_by_default? diff --git a/app/views/admin/application_settings/network.html.haml b/app/views/admin/application_settings/network.html.haml index 27cea347bb1..26fd745f45f 100644 --- a/app/views/admin/application_settings/network.html.haml +++ b/app/views/admin/application_settings/network.html.haml @@ -1,36 +1,35 @@ - breadcrumb_title _("Network") - page_title _("Network") - @content_class = "limit-container-width" unless fluid_layout -- expanded = Rails.env.test? -%section.settings.as-performance.no-animate#js-performance-settings{ class: ('expanded' if expanded) } +%section.settings.as-performance.no-animate#js-performance-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Performance optimization') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Various settings that affect GitLab performance.') .settings-content = render 'performance' -%section.settings.as-ip-limits.no-animate#js-ip-limits-settings{ class: ('expanded' if expanded) } +%section.settings.as-ip-limits.no-animate#js-ip-limits-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('User and IP Rate Limits') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Configure limits for web and API requests.') .settings-content = render 'ip_limits' -%section.settings.as-outbound.no-animate#js-outbound-settings{ class: ('expanded' if expanded) } +%section.settings.as-outbound.no-animate#js-outbound-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Outbound requests') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Allow requests to the local network from hooks and services.') .settings-content diff --git a/app/views/admin/application_settings/preferences.html.haml b/app/views/admin/application_settings/preferences.html.haml index 74be9d130c5..75f76eea3b4 100644 --- a/app/views/admin/application_settings/preferences.html.haml +++ b/app/views/admin/application_settings/preferences.html.haml @@ -1,69 +1,68 @@ - breadcrumb_title _("Preferences") - page_title _("Preferences") - @content_class = "limit-container-width" unless fluid_layout -- expanded = Rails.env.test? -%section.settings.as-email.no-animate#js-email-settings{ class: ('expanded' if expanded) } +%section.settings.as-email.no-animate#js-email-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Email') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Various email settings.') .settings-content = render 'email' -%section.settings.as-help-page.no-animate#js-help-settings{ class: ('expanded' if expanded) } +%section.settings.as-help-page.no-animate#js-help-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Help page') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Help page text and support page url.') .settings-content = render 'help_page' -%section.settings.as-pages.no-animate#js-pages-settings{ class: ('expanded' if expanded) } +%section.settings.as-pages.no-animate#js-pages-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Pages') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Size and domain settings for static websites') .settings-content = render 'pages' -%section.settings.as-realtime.no-animate#js-realtime-settings{ class: ('expanded' if expanded) } +%section.settings.as-realtime.no-animate#js-realtime-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Real-time features') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Change this value to influence how frequently the GitLab UI polls for updates.') .settings-content = render 'realtime' -%section.settings.as-background.no-animate#js-background-settings{ class: ('expanded' if expanded) } +%section.settings.as-background.no-animate#js-background-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Background jobs') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Configure Sidekiq job throttling.') .settings-content = render 'background_jobs' -%section.settings.as-gitaly.no-animate#js-gitaly-settings{ class: ('expanded' if expanded) } +%section.settings.as-gitaly.no-animate#js-gitaly-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Gitaly') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Configure Gitaly timeouts.') .settings-content diff --git a/app/views/admin/application_settings/reporting.html.haml b/app/views/admin/application_settings/reporting.html.haml index 70da89694f8..1c2d9ccdb2d 100644 --- a/app/views/admin/application_settings/reporting.html.haml +++ b/app/views/admin/application_settings/reporting.html.haml @@ -1,36 +1,35 @@ - breadcrumb_title _("Reporting") - page_title _("Reporting") - @content_class = "limit-container-width" unless fluid_layout -- expanded = Rails.env.test? -%section.settings.as-spam.no-animate#js-spam-settings{ class: ('expanded' if expanded) } +%section.settings.as-spam.no-animate#js-spam-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Spam and Anti-bot Protection') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Enable reCAPTCHA or Akismet and set IP limits.') .settings-content = render 'spam' -%section.settings.as-abuse.no-animate#js-abuse-settings{ class: ('expanded' if expanded) } +%section.settings.as-abuse.no-animate#js-abuse-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Abuse reports') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Set notification email for abuse reports.') .settings-content = render 'abuse' -%section.settings.as-logging.no-animate#js-logging-settings{ class: ('expanded' if expanded) } +%section.settings.as-logging.no-animate#js-logging-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Error Reporting and Logging') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Enable Sentry for error reporting and logging.') .settings-content diff --git a/app/views/admin/application_settings/repository.html.haml b/app/views/admin/application_settings/repository.html.haml index b6289986a37..d8029e0c54a 100644 --- a/app/views/admin/application_settings/repository.html.haml +++ b/app/views/admin/application_settings/repository.html.haml @@ -1,36 +1,35 @@ - breadcrumb_title _("Repository") - page_title _("Repository") - @content_class = "limit-container-width" unless fluid_layout -- expanded = Rails.env.test? -%section.settings.as-mirror.no-animate#js-mirror-settings{ class: ('expanded' if expanded) } +%section.settings.as-mirror.no-animate#js-mirror-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Repository mirror') %button.btn.js-settings-toggle{ type: 'button' } - = expanded ? 'Collapse' : 'Expand' + = expanded_by_default? ? 'Collapse' : 'Expand' %p = _('Configure push mirrors.') .settings-content = render partial: 'repository_mirrors_form' -%section.settings.as-repository-storage.no-animate#js-repository-storage-settings{ class: ('expanded' if expanded) } +%section.settings.as-repository-storage.no-animate#js-repository-storage-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Repository storage') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Configure storage path and circuit breaker settings.') .settings-content = render 'repository_storage' -%section.settings.as-repository-check.no-animate#js-repository-check-settings{ class: ('expanded' if expanded) } +%section.settings.as-repository-check.no-animate#js-repository-check-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Repository maintenance') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Configure automatic git checks and housekeeping on repositories.') .settings-content diff --git a/app/views/admin/application_settings/show.html.haml b/app/views/admin/application_settings/show.html.haml index 70e276b8162..e2043183a97 100644 --- a/app/views/admin/application_settings/show.html.haml +++ b/app/views/admin/application_settings/show.html.haml @@ -1,94 +1,93 @@ - breadcrumb_title _("Settings") - page_title _("Settings") - @content_class = "limit-container-width" unless fluid_layout -- expanded = Rails.env.test? -%section.settings.as-visibility-access.no-animate#js-visibility-settings{ class: ('expanded' if expanded) } +%section.settings.as-visibility-access.no-animate#js-visibility-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Visibility and access controls') %button.btn.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Set default and restrict visibility levels. Configure import sources and git access protocol.') .settings-content = render 'visibility_and_access' -%section.settings.as-account-limit.no-animate#js-account-settings{ class: ('expanded' if expanded) } +%section.settings.as-account-limit.no-animate#js-account-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Account and limit') %button.btn.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Session expiration, projects limit and attachment size.') .settings-content = render 'account_and_limit' -%section.settings.as-signup.no-animate#js-signup-settings{ class: ('expanded' if expanded) } +%section.settings.as-signup.no-animate#js-signup-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Sign-up restrictions') %button.btn.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Configure the way a user creates a new account.') .settings-content = render 'signup' -%section.settings.as-signin.no-animate#js-signin-settings{ class: ('expanded' if expanded) } +%section.settings.as-signin.no-animate#js-signin-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Sign-in restrictions') %button.btn.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Set requirements for a user to sign-in. Enable mandatory two-factor authentication.') .settings-content = render 'signin' -%section.qa-terms-settings.settings.as-terms.no-animate#js-terms-settings{ class: ('expanded' if expanded) } +%section.qa-terms-settings.settings.as-terms.no-animate#js-terms-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Terms of Service and Privacy Policy') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Include a Terms of Service agreement and Privacy Policy that all users must accept.') .settings-content = render 'terms' - if koding_enabled? - %section.settings.as-koding.no-animate#js-koding-settings{ class: ('expanded' if expanded) } + %section.settings.as-koding.no-animate#js-koding-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Koding') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Online IDE integration settings.') .settings-content = render 'koding' -= render_if_exists 'admin/application_settings/external_authorization_service_form', expanded: expanded += render_if_exists 'admin/application_settings/external_authorization_service_form', expanded: expanded_by_default? -%section.settings.as-terminal.no-animate#js-terminal-settings{ class: ('expanded' if expanded) } +%section.settings.as-terminal.no-animate#js-terminal-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Web terminal') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Set max session time for web terminal.') .settings-content = render 'terminal' -%section.settings.no-animate#js-web-ide-settings{ class: ('expanded' if expanded) } +%section.settings.no-animate#js-web-ide-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4 = _('Web IDE') %button.btn.btn-default.js-settings-toggle{ type: 'button' } - = expanded ? _('Collapse') : _('Expand') + = expanded_by_default? ? _('Collapse') : _('Expand') %p = _('Manage Web IDE features') .settings-content -- cgit v1.2.1