diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-03 00:09:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-03 00:09:14 +0300 |
commit | 2c0e92d0314ca00907b75b103af507d9a28a2d62 (patch) | |
tree | 1f98c624119c49aafbda54dafb067aa2d6b66f8d /app/helpers | |
parent | 075ce5ae315d1b1d0623647714bc69bfa9df721a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/operations_helper.rb | 36 | ||||
-rw-r--r-- | app/helpers/services_helper.rb | 4 |
2 files changed, 38 insertions, 2 deletions
diff --git a/app/helpers/operations_helper.rb b/app/helpers/operations_helper.rb new file mode 100644 index 00000000000..faaa5f9d952 --- /dev/null +++ b/app/helpers/operations_helper.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +module OperationsHelper + include Gitlab::Utils::StrongMemoize + + def prometheus_service + strong_memoize(:prometheus_service) do + @project.find_or_initialize_service(::PrometheusService.to_param) + end + end + + def alerts_service + strong_memoize(:alerts_service) do + @project.find_or_initialize_service(::AlertsService.to_param) + end + end + + def alerts_settings_data + { + 'prometheus_activated' => prometheus_service.activated?.to_s, + 'activated' => alerts_service.activated?.to_s, + 'prometheus_form_path' => scoped_integration_path(prometheus_service), + 'form_path' => scoped_integration_path(alerts_service), + 'prometheus_reset_key_path' => reset_alerting_token_project_settings_operations_path(@project), + 'prometheus_authorization_key' => @project.alerting_setting&.token, + 'prometheus_api_url' => prometheus_service.api_url, + 'authorization_key' => alerts_service.token, + 'prometheus_url' => notify_project_prometheus_alerts_url(@project, format: :json), + 'url' => alerts_service.url, + 'alerts_setup_url' => help_page_path('user/project/integrations/generic_alerts.html', anchor: 'setting-up-generic-alerts'), + 'alerts_usage_url' => project_alert_management_index_path(@project) + } + end +end + +OperationsHelper.prepend_if_ee('EE::OperationsHelper') diff --git a/app/helpers/services_helper.rb b/app/helpers/services_helper.rb index 8fb884919d4..11bb275a035 100644 --- a/app/helpers/services_helper.rb +++ b/app/helpers/services_helper.rb @@ -48,8 +48,8 @@ module ServicesHelper end end - def service_save_button - button_tag(class: 'btn btn-success', type: 'submit', data: { qa_selector: 'save_changes_button' }) do + def service_save_button(disabled: false) + button_tag(class: 'btn btn-success', type: 'submit', disabled: disabled, data: { qa_selector: 'save_changes_button' }) do icon('spinner spin', class: 'hidden js-btn-spinner') + content_tag(:span, 'Save changes', class: 'js-btn-label') end |