diff --git a/app/assets/javascripts/pipelines/components/nav_controls.vue b/app/assets/javascripts/pipelines/components/nav_controls.vue index a5717c23a44b61e2361f9cdc27be67e3c69e4059..f2d5f76c0ce1a3dfedb989a1910cd81d9474b2f5 100644 --- a/app/assets/javascripts/pipelines/components/nav_controls.vue +++ b/app/assets/javascripts/pipelines/components/nav_controls.vue @@ -50,10 +50,9 @@ export default { Get started with Pipelines </a> - <a :href="resetCachePath" - class="btn btn-default"> - Clear runner caches - </a> + <form :action="resetCachePath" method="post"> + <input type="submit" class="btn btn-default" value="Clear runner caches" /> + </form> <a :href="ciLintPath" diff --git a/config/routes/project.rb b/config/routes/project.rb index 2fbd71425012ba364b64d281131ed42d668cc999..bdf4b199c0a6ebb5f35ec9e921948ecca707cdca 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -409,7 +409,7 @@ constraints(ProjectUrlConstrainer.new) do namespace :settings do get :members, to: redirect("%{namespace_id}/%{project_id}/project_members") resource :ci_cd, only: [:show], controller: 'ci_cd' do - get :reset_cache + post :reset_cache end resource :integrations, only: [:show] resource :repository, only: [:show], controller: :repository diff --git a/spec/controllers/projects/settings/ci_cd_controller_spec.rb b/spec/controllers/projects/settings/ci_cd_controller_spec.rb index e8ba04c7f2436479e2b97886662da182e962d391..0202149f3359e2640badbd61a0a111acb3d21b10 100644 --- a/spec/controllers/projects/settings/ci_cd_controller_spec.rb +++ b/spec/controllers/projects/settings/ci_cd_controller_spec.rb @@ -27,7 +27,7 @@ describe Projects::Settings::CiCdController do allow(ResetProjectCacheService).to receive_message_chain(:new, :execute).and_return(true) end - subject { get :reset_cache, namespace_id: project.namespace, project_id: project } + subject { post :reset_cache, namespace_id: project.namespace, project_id: project } it 'calls reset project cache service' do expect(ResetProjectCacheService).to receive_message_chain(:new, :execute) diff --git a/spec/javascripts/pipelines/nav_controls_spec.js b/spec/javascripts/pipelines/nav_controls_spec.js index 09a0c14d96ceb7db518dc5785d01971d1a335e6e..cf9bbee2b139b3b500391a890831c0f81b553a14 100644 --- a/spec/javascripts/pipelines/nav_controls_spec.js +++ b/spec/javascripts/pipelines/nav_controls_spec.js @@ -58,7 +58,7 @@ describe('Pipelines Nav Controls', () => { }).$mount(); expect(component.$el.querySelectorAll('.btn-default')[0].textContent).toContain('Clear runner caches'); - expect(component.$el.querySelectorAll('.btn-default')[0].getAttribute('href')).toEqual(mockData.resetCachePath); + expect(component.$el.querySelector('form').getAttribute('action')).toEqual(mockData.resetCachePath); }); it('should render link for CI lint', () => {