Commit 39192335 authored by Kerri Miller's avatar Kerri Miller

Merge branch 'justin_ho-rename-routes-for-project-services-to-integrations' into 'master'

Rename routes for project services to "integrations"

See merge request gitlab-org/gitlab!77376
parents 8a831edf 7c604bd6
......@@ -20,7 +20,7 @@ class Projects::MattermostsController < Projects::ApplicationController
if result
flash[:notice] = 'This service is now configured'
redirect_to edit_project_service_path(@project, integration)
redirect_to edit_project_integration_path(@project, integration)
else
flash[:alert] = message || 'Failed to configure service'
redirect_to new_project_mattermost_path(@project)
......
......@@ -66,7 +66,7 @@ module Projects
)
if @metric.persisted?
redirect_to edit_project_service_path(project, ::Integrations::Prometheus),
redirect_to edit_project_integration_path(project, ::Integrations::Prometheus),
notice: _('Metric was successfully added.')
else
render 'new'
......@@ -77,7 +77,7 @@ module Projects
@metric = update_metrics_service(prometheus_metric).execute
if @metric.persisted?
redirect_to edit_project_service_path(project, ::Integrations::Prometheus),
redirect_to edit_project_integration_path(project, ::Integrations::Prometheus),
notice: _('Metric was successfully updated.')
else
render 'edit'
......@@ -93,7 +93,7 @@ module Projects
respond_to do |format|
format.html do
redirect_to edit_project_service_path(project, ::Integrations::Prometheus), status: :see_other
redirect_to edit_project_integration_path(project, ::Integrations::Prometheus), status: :see_other
end
format.json do
head :ok
......
......@@ -7,13 +7,13 @@ class Projects::ServiceHookLogsController < Projects::HookLogsController
def retry
execute_hook
redirect_to edit_project_service_path(@project, @integration)
redirect_to edit_project_integration_path(@project, @integration)
end
private
def integration
@integration ||= @project.find_or_initialize_integration(params[:service_id])
@integration ||= @project.find_or_initialize_integration(params[:integration_id])
end
override :hook
......
......@@ -66,7 +66,7 @@ class Projects::ServicesController < Projects::ApplicationController
private
def redirect_path
safe_redirect_path(params[:redirect_to]).presence || edit_project_service_path(project, integration)
safe_redirect_path(params[:redirect_to]).presence || edit_project_integration_path(project, integration)
end
def service_test_response
......@@ -119,7 +119,7 @@ class Projects::ServicesController < Projects::ApplicationController
end
def redirect_deprecated_prometheus_integration
redirect_to edit_project_service_path(project, integration) if integration.is_a?(::Integrations::Prometheus) && Feature.enabled?(:settings_operations_prometheus_service, project)
redirect_to edit_project_integration_path(project, integration) if integration.is_a?(::Integrations::Prometheus) && Feature.enabled?(:settings_operations_prometheus_service, project)
end
def set_deprecation_notice_for_prometheus_integration
......
......@@ -5,7 +5,7 @@ module CustomMetricsHelper
{
'custom-metrics-path' => url_for([project, metric]),
'metric-persisted' => metric.persisted?.to_s,
'edit-project-service-path' => edit_project_service_path(project, ::Integrations::Prometheus),
'edit-project-service-path' => edit_project_integration_path(project, ::Integrations::Prometheus),
'validate-query-path' => validate_query_project_prometheus_metrics_path(project),
'title' => metric.title.to_s,
'query' => metric.query.to_s,
......
......@@ -59,7 +59,7 @@ module EnvironmentsHelper
return {} unless project
{
'settings_path' => edit_project_service_path(project, 'prometheus'),
'settings_path' => edit_project_integration_path(project, 'prometheus'),
'clusters_path' => project_clusters_path(project),
'dashboards_endpoint' => project_performance_monitoring_dashboards_path(project, format: :json),
'default_branch' => project.default_branch,
......
......@@ -29,7 +29,7 @@ module IntegrationsHelper
def scoped_integration_path(integration, project: nil, group: nil)
if project.present?
project_service_path(project, integration)
project_integration_path(project, integration)
elsif group.present?
group_settings_integration_path(group, integration)
else
......@@ -39,7 +39,7 @@ module IntegrationsHelper
def scoped_edit_integration_path(integration, project: nil, group: nil)
if project.present?
edit_project_service_path(project, integration)
edit_project_integration_path(project, integration)
elsif group.present?
edit_group_settings_integration_path(group, integration)
else
......@@ -53,7 +53,7 @@ module IntegrationsHelper
def scoped_test_integration_path(integration, project: nil, group: nil)
if project.present?
test_project_service_path(project, integration)
test_project_integration_path(project, integration)
elsif group.present?
test_group_settings_integration_path(group, integration)
else
......
......@@ -4,10 +4,10 @@ class ServiceHookPresenter < Gitlab::View::Presenter::Delegated
presents ::ServiceHook, as: :service_hook
def logs_details_path(log)
project_service_hook_log_path(integration.project, integration, log)
project_integration_hook_log_path(integration.project, integration, log)
end
def logs_retry_path(log)
retry_project_service_hook_log_path(integration.project, integration, log)
retry_project_integration_hook_log_path(integration.project, integration, log)
end
end
......@@ -10,7 +10,7 @@
%td
%strong
- if can?(current_user, :admin_project, project)
= link_to integration.title, edit_project_service_path(project, integration)
= link_to integration.title, edit_project_integration_path(project, integration)
- else
= integration.title
%td
......
.js-jira-import-root{ data: { project_path: @project.full_path,
issues_path: project_issues_path(@project),
jira_integration_path: edit_project_service_path(@project, :jira),
jira_integration_path: edit_project_integration_path(@project, :jira),
is_jira_configured: @project.jira_integration&.configured?.to_s,
in_progress_illustration: image_path('illustrations/export-import.svg'),
project_id: @project.id,
......
......@@ -15,4 +15,4 @@
and try again.
%hr
.clearfix
= link_to 'Go back', edit_project_service_path(@project, @integration), class: 'gl-button btn btn-lg float-right'
= link_to 'Go back', edit_project_integration_path(@project, @integration), class: 'gl-button btn btn-lg float-right'
......@@ -42,5 +42,5 @@
%hr
.clearfix
.float-right
= link_to _('Cancel'), edit_project_service_path(@project, @integration), class: 'gl-button btn btn-lg'
= link_to _('Cancel'), edit_project_integration_path(@project, @integration), class: 'gl-button btn btn-lg'
= f.submit 'Install', class: 'gl-button btn btn-success btn-lg'
- add_to_breadcrumbs _("Settings"), edit_project_path(@project)
- add_to_breadcrumbs _("Integrations"), project_settings_integrations_path(@project)
- add_to_breadcrumbs "Prometheus", edit_project_service_path(@project, ::Integrations::Prometheus)
- add_to_breadcrumbs "Prometheus", edit_project_integration_path(@project, ::Integrations::Prometheus)
- breadcrumb_title s_('Metrics|Edit metric')
- page_title @metric.title, s_('Metrics|Edit metric')
= render 'form', project: @project, metric: @metric
- add_to_breadcrumbs _("Settings"), edit_project_path(@project)
- add_to_breadcrumbs _("Integrations"), project_settings_integrations_path(@project)
- add_to_breadcrumbs "Prometheus", edit_project_service_path(@project, ::Integrations::Prometheus)
- add_to_breadcrumbs "Prometheus", edit_project_integration_path(@project, ::Integrations::Prometheus)
- breadcrumb_title s_('Metrics|New metric')
- page_title s_('Metrics|New metric')
= render 'form', project: @project, metric: @metric
......@@ -6,7 +6,7 @@
- if integration.operating?
= sprite_icon('check', css_class: 'gl-text-green-500')
= form_for(integration, as: :service, url: scoped_integration_path(integration, project: @project, group: @group), method: :put, html: { class: 'gl-show-field-errors integration-settings-form js-integration-settings-form', data: { 'test-url' => test_project_service_path(@project, integration) } }) do |form|
= form_for(integration, as: :service, url: scoped_integration_path(integration, project: @project, group: @group), method: :put, html: { class: 'gl-show-field-errors integration-settings-form js-integration-settings-form', data: { 'test-url' => test_project_integration_path(@project, integration) } }) do |form|
= render 'shared/service_settings', form: form, integration: integration
%input{ id: 'services_redirect_to', type: 'hidden', name: 'redirect_to', value: request.referer }
......
......@@ -13,7 +13,7 @@
= create_link
- if show_enable_confluence_integration?(@wiki.container)
= link_to s_('WikiEmpty|Enable the Confluence Wiki integration'),
edit_project_service_path(@project, :confluence),
edit_project_integration_path(@project, :confluence),
class: 'btn gl-button', title: s_('WikiEmpty|Enable the Confluence Wiki integration')
- elsif @project && can?(current_user, :read_issue, @project)
......
......@@ -212,7 +212,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
resources :services, constraints: { id: %r{[^/]+} }, only: [:edit, :update] do
resources :integrations, controller: :services, constraints: { id: %r{[^/]+} }, only: [:edit, :update] do
member do
put :test
end
......
......@@ -45,7 +45,7 @@ module Projects
private
def redirect_to_service_page
redirect_to edit_project_service_path(
redirect_to edit_project_integration_path(
project,
project.gitlab_slack_application_integration || project.build_gitlab_slack_application_integration
)
......
......@@ -15,7 +15,7 @@ module VulnerabilitiesHelper
new_issue_url: new_issue_url_for(vulnerability),
create_jira_issue_url: create_jira_issue_url_for(vulnerability),
related_jira_issues_path: project_integrations_jira_issues_path(vulnerability.project, vulnerability_ids: [vulnerability.id]),
jira_integration_settings_path: edit_project_service_path(vulnerability.project, ::Integrations::Jira),
jira_integration_settings_path: edit_project_integration_path(vulnerability.project, ::Integrations::Jira),
has_mr: !!vulnerability.finding.merge_request_feedback.try(:merge_request_id),
create_mr_url: create_vulnerability_feedback_merge_request_path(vulnerability.finding.project),
discussions_url: discussions_project_security_vulnerability_path(vulnerability.project, vulnerability),
......
......@@ -17,4 +17,4 @@
.footer-block.row-content-block
= form.submit _('Save changes'), class: "gl-button btn btn-confirm"
&nbsp;
= link_to _('Cancel'), edit_project_service_path(@project, @service), class: 'btn gl-button btn-cancel'
= link_to _('Cancel'), edit_project_integration_path(@project, @service), class: 'btn gl-button btn-cancel'
......@@ -13,7 +13,7 @@ RSpec.describe Projects::Settings::SlacksController do
describe 'GET show' do
def redirect_url(project)
edit_project_service_path(
edit_project_integration_path(
project,
project.build_gitlab_slack_application_integration
)
......
......@@ -13,7 +13,7 @@ RSpec.describe 'User activates GitHub Service' do
end
it 'renders 404 when trying to access service settings directly' do
visit edit_project_service_path(project, :github)
visit edit_project_integration_path(project, :github)
expect(page).to have_gitlab_http_status(:not_found)
end
......
......@@ -7,7 +7,7 @@ RSpec.describe 'Slack application' do
let(:user) { create(:user) }
let(:role) { :developer }
let(:integration) { create(:gitlab_slack_application_integration, project: project) }
let(:slack_application_form_path) { edit_project_service_path(project, integration) }
let(:slack_application_form_path) { edit_project_integration_path(project, integration) }
before do
gitlab_sign_in(user)
......
......@@ -66,7 +66,7 @@ RSpec.describe VulnerabilitiesHelper do
new_issue_url: "/#{project.full_path}/-/issues/new?vulnerability_id=#{vulnerability.id}",
create_jira_issue_url: nil,
related_jira_issues_path: "/#{project.full_path}/-/integrations/jira/issues?vulnerability_ids%5B%5D=#{vulnerability.id}",
jira_integration_settings_path: "/#{project.full_path}/-/services/jira/edit",
jira_integration_settings_path: "/#{project.full_path}/-/integrations/jira/edit",
has_mr: anything,
create_mr_url: "/#{project.full_path}/-/vulnerability_feedback",
discussions_url: "/#{project.full_path}/-/security/vulnerabilities/#{vulnerability.id}/discussions",
......
......@@ -60,9 +60,9 @@ RSpec.describe Projects::MattermostsController do
it 'redirects to the new page' do
subject
service = project.integrations.last
integration = project.integrations.last
expect(subject).to redirect_to(edit_project_service_url(project, service))
expect(subject).to redirect_to(edit_project_integration_path(project, integration))
end
end
end
......
......@@ -141,7 +141,7 @@ RSpec.describe Projects::Prometheus::MetricsController do
expect(flash[:notice]).to include('Metric was successfully added.')
expect(response).to redirect_to(edit_project_service_path(project, ::Integrations::Prometheus))
expect(response).to redirect_to(edit_project_integration_path(project, ::Integrations::Prometheus))
end
end
......@@ -157,6 +157,22 @@ RSpec.describe Projects::Prometheus::MetricsController do
end
end
describe 'PUT #update' do
context 'metric is updated' do
let_it_be(:metric) { create(:prometheus_metric, project: project) }
let(:metric_params) { { prometheus_metric: { title: 'new_title' }, id: metric.id } }
it 'shows a success flash message' do
put :update, params: project_params(metric_params)
expect(metric.reload.title).to eq('new_title')
expect(flash[:notice]).to include('Metric was successfully updated.')
expect(response).to redirect_to(edit_project_integration_path(project, ::Integrations::Prometheus))
end
end
end
describe 'DELETE #destroy' do
context 'format html' do
let!(:metric) { create(:prometheus_metric, project: project) }
......@@ -164,7 +180,7 @@ RSpec.describe Projects::Prometheus::MetricsController do
it 'destroys the metric' do
delete :destroy, params: project_params(id: metric.id)
expect(response).to redirect_to(edit_project_service_path(project, ::Integrations::Prometheus))
expect(response).to redirect_to(edit_project_integration_path(project, ::Integrations::Prometheus))
expect(PrometheusMetric.find_by(id: metric.id)).to be_nil
end
end
......
......@@ -11,7 +11,7 @@ RSpec.describe Projects::ServiceHookLogsController do
{
namespace_id: project.namespace,
project_id: project,
service_id: integration.to_param,
integration_id: integration.to_param,
id: log.id
}
end
......@@ -44,7 +44,7 @@ RSpec.describe Projects::ServiceHookLogsController do
it 'executes the hook and redirects to the service form' do
expect_any_instance_of(ServiceHook).to receive(:execute)
expect_any_instance_of(described_class).to receive(:set_hook_execution_notice)
expect(subject).to redirect_to(edit_project_service_path(project, integration))
expect(subject).to redirect_to(edit_project_integration_path(project, integration))
end
it 'renders a 404 if the hook does not exist' do
......
......@@ -183,7 +183,7 @@ RSpec.describe Projects::ServicesController do
let(:params) { project_params(service: integration_params) }
let(:message) { 'Jira settings saved and active.' }
let(:redirect_url) { edit_project_service_path(project, integration) }
let(:redirect_url) { edit_project_integration_path(project, integration) }
before do
stub_jira_integration_test
......@@ -341,7 +341,7 @@ RSpec.describe Projects::ServicesController do
it 'redirects user back to edit page with alert' do
put :update, params: project_params.merge(service: integration_params)
expect(response).to redirect_to(edit_project_service_path(project, integration))
expect(response).to redirect_to(edit_project_integration_path(project, integration))
expected_alert = [
"You can now manage your Prometheus settings on the",
%(<a href="#{project_settings_operations_path(project)}">Operations</a> page.),
......
......@@ -20,7 +20,7 @@ RSpec.describe 'User activates Jira', :js do
it 'activates the Jira service' do
expect(page).to have_content('Jira settings saved and active.')
expect(current_path).to eq(edit_project_service_path(project, :jira))
expect(current_path).to eq(edit_project_integration_path(project, :jira))
end
unless Gitlab.ee?
......@@ -55,7 +55,7 @@ RSpec.describe 'User activates Jira', :js do
click_test_then_save_integration
expect(page).to have_content('Jira settings saved and active.')
expect(current_path).to eq(edit_project_service_path(project, :jira))
expect(current_path).to eq(edit_project_integration_path(project, :jira))
end
end
end
......@@ -72,7 +72,7 @@ RSpec.describe 'User activates Jira', :js do
it 'saves but does not activate the Jira service' do
expect(page).to have_content('Jira settings saved, but not active.')
expect(current_path).to eq(edit_project_service_path(project, :jira))
expect(current_path).to eq(edit_project_integration_path(project, :jira))
end
it 'does not show the Jira link in the menu' do
......
......@@ -34,7 +34,7 @@ RSpec.describe 'User activates issue tracker', :js do
it 'activates the service' do
expect(page).to have_content("#{tracker} settings saved and active.")
expect(current_path).to eq(edit_project_service_path(project, tracker.parameterize(separator: '_')))
expect(current_path).to eq(edit_project_integration_path(project, tracker.parameterize(separator: '_')))
end
it 'shows the link in the menu' do
......@@ -58,7 +58,7 @@ RSpec.describe 'User activates issue tracker', :js do
end
expect(page).to have_content("#{tracker} settings saved and active.")
expect(current_path).to eq(edit_project_service_path(project, tracker.parameterize(separator: '_')))
expect(current_path).to eq(edit_project_integration_path(project, tracker.parameterize(separator: '_')))
end
end
end
......@@ -73,7 +73,7 @@ RSpec.describe 'User activates issue tracker', :js do
it 'saves but does not activate the service' do
expect(page).to have_content("#{tracker} settings saved, but not active.")
expect(current_path).to eq(edit_project_service_path(project, tracker.parameterize(separator: '_')))
expect(current_path).to eq(edit_project_integration_path(project, tracker.parameterize(separator: '_')))
end
it 'does not show the external tracker link in the menu' do
......
......@@ -15,7 +15,7 @@ RSpec.describe 'Set up Mattermost slash commands', :js do
let(:mattermost_enabled) { true }
describe 'activation' do
let(:edit_path) { edit_project_service_path(project, :mattermost_slash_commands) }
let(:edit_path) { edit_project_integration_path(project, :mattermost_slash_commands) }
include_examples 'user activates the Mattermost Slash Command integration'
end
......
......@@ -34,7 +34,7 @@ RSpec.describe 'User activates Slack notifications', :js do
pipeline_channel: 6,
wiki_page_channel: 7)
visit(edit_project_service_path(project, integration))
visit(edit_project_integration_path(project, integration))
end
it 'filters events by channel' do
......
......@@ -24,7 +24,7 @@ RSpec.describe 'Slack slash commands', :js do
click_active_checkbox
click_on 'Save'
expect(current_path).to eq(edit_project_service_path(project, :slack_slash_commands))
expect(current_path).to eq(edit_project_integration_path(project, :slack_slash_commands))
expect(page).to have_content('Slack slash commands settings saved, but not active.')
end
......@@ -32,7 +32,7 @@ RSpec.describe 'Slack slash commands', :js do
fill_in 'Token', with: 'token'
click_on 'Save'
expect(current_path).to eq(edit_project_service_path(project, :slack_slash_commands))
expect(current_path).to eq(edit_project_integration_path(project, :slack_slash_commands))
expect(page).to have_content('Slack slash commands settings saved and active.')
end
......
......@@ -128,7 +128,7 @@ exports[`Dashboard template matches the default snapshot 1`] = `
emptynodatasvgpath="/images/illustrations/monitoring/no_data.svg"
emptyunabletoconnectsvgpath="/images/illustrations/monitoring/unable_to_connect.svg"
selectedstate="gettingStarted"
settingspath="/monitoring/monitor-project/-/services/prometheus/edit"
settingspath="/monitoring/monitor-project/-/integrations/prometheus/edit"
/>
</div>
`;
......@@ -18,7 +18,7 @@ RSpec.describe EnvironmentsHelper do
it 'returns data' do
expect(metrics_data).to include(
'settings_path' => edit_project_service_path(project, 'prometheus'),
'settings_path' => edit_project_integration_path(project, 'prometheus'),
'clusters_path' => project_clusters_path(project),
'metrics_dashboard_base_path' => environment_metrics_path(environment),
'current_environment_name' => environment.name,
......
......@@ -32,7 +32,7 @@ RSpec.describe OperationsHelper do
expect(subject).to eq(
'alerts_setup_url' => help_page_path('operations/incident_management/integrations.md', anchor: 'configuration'),
'alerts_usage_url' => project_alert_management_index_path(project),
'prometheus_form_path' => project_service_path(project, prometheus_integration),
'prometheus_form_path' => project_integration_path(project, prometheus_integration),
'prometheus_reset_key_path' => reset_alerting_token_project_settings_operations_path(project),
'prometheus_authorization_key' => nil,
'prometheus_api_url' => nil,
......
......@@ -12,7 +12,7 @@ RSpec.describe ServiceHookPresenter do
subject { service_hook.present.logs_details_path(web_hook_log) }
let(:expected_path) do
"/#{project.namespace.path}/#{project.name}/-/services/#{integration.to_param}/hook_logs/#{web_hook_log.id}"
"/#{project.namespace.path}/#{project.name}/-/integrations/#{integration.to_param}/hook_logs/#{web_hook_log.id}"
end
it { is_expected.to eq(expected_path) }
......@@ -22,7 +22,7 @@ RSpec.describe ServiceHookPresenter do
subject { service_hook.present.logs_retry_path(web_hook_log) }
let(:expected_path) do
"/#{project.namespace.path}/#{project.name}/-/services/#{integration.to_param}/hook_logs/#{web_hook_log.id}/retry"
"/#{project.namespace.path}/#{project.name}/-/integrations/#{integration.to_param}/hook_logs/#{web_hook_log.id}/retry"
end
it { is_expected.to eq(expected_path) }
......
......@@ -21,7 +21,7 @@ RSpec.describe WebHookLogPresenter do
let(:web_hook) { create(:service_hook, integration: integration) }
let(:integration) { create(:drone_ci_integration, project: project) }
it { is_expected.to eq(project_service_hook_log_path(project, integration, web_hook_log)) }
it { is_expected.to eq(project_integration_hook_log_path(project, integration, web_hook_log)) }
end
end
......@@ -41,7 +41,7 @@ RSpec.describe WebHookLogPresenter do
let(:web_hook) { create(:service_hook, integration: integration) }
let(:integration) { create(:drone_ci_integration, project: project) }
it { is_expected.to eq(retry_project_service_hook_log_path(project, integration, web_hook_log)) }
it { is_expected.to eq(retry_project_integration_hook_log_path(project, integration, web_hook_log)) }
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment