Commit 1fd3099a authored by Miguel Rincon's avatar Miguel Rincon

Add notice when runner projects are updated

This UI improvement adds a simple 'Changes saved.' notice
when projects of a runner are updated.

Changelog: changed
parent 39e940d8
...@@ -9,7 +9,7 @@ class Admin::RunnerProjectsController < Admin::ApplicationController ...@@ -9,7 +9,7 @@ class Admin::RunnerProjectsController < Admin::ApplicationController
@runner = Ci::Runner.find(params[:runner_project][:runner_id]) @runner = Ci::Runner.find(params[:runner_project][:runner_id])
if @runner.assign_to(@project, current_user) if @runner.assign_to(@project, current_user)
redirect_to admin_runner_path(@runner) redirect_to admin_runner_path(@runner), notice: s_('Runners|Runner assigned to project.')
else else
redirect_to admin_runner_path(@runner), alert: 'Failed adding runner to project' redirect_to admin_runner_path(@runner), alert: 'Failed adding runner to project'
end end
...@@ -20,7 +20,7 @@ class Admin::RunnerProjectsController < Admin::ApplicationController ...@@ -20,7 +20,7 @@ class Admin::RunnerProjectsController < Admin::ApplicationController
runner = rp.runner runner = rp.runner
rp.destroy rp.destroy
redirect_to admin_runner_path(runner), status: :found redirect_to admin_runner_path(runner), status: :found, notice: s_('Runners|Runner unassigned from project.')
end end
private private
......
...@@ -15,7 +15,7 @@ class Projects::RunnerProjectsController < Projects::ApplicationController ...@@ -15,7 +15,7 @@ class Projects::RunnerProjectsController < Projects::ApplicationController
path = project_runners_path(project) path = project_runners_path(project)
if @runner.assign_to(project, current_user) if @runner.assign_to(project, current_user)
redirect_to path redirect_to path, notice: s_('Runners|Runner assigned to project.')
else else
assign_to_messages = @runner.errors.messages[:assign_to] assign_to_messages = @runner.errors.messages[:assign_to]
alert = assign_to_messages&.join(',') || 'Failed adding runner to project' alert = assign_to_messages&.join(',') || 'Failed adding runner to project'
...@@ -28,6 +28,6 @@ class Projects::RunnerProjectsController < Projects::ApplicationController ...@@ -28,6 +28,6 @@ class Projects::RunnerProjectsController < Projects::ApplicationController
runner_project = project.runner_projects.find(params[:id]) runner_project = project.runner_projects.find(params[:id])
runner_project.destroy runner_project.destroy
redirect_to project_runners_path(project), status: :found redirect_to project_runners_path(project), status: :found, notice: s_('Runners|Runner unassigned from project.')
end end
end end
...@@ -29094,6 +29094,9 @@ msgstr "" ...@@ -29094,6 +29094,9 @@ msgstr ""
msgid "Runners|Runner #%{runner_id}" msgid "Runners|Runner #%{runner_id}"
msgstr "" msgstr ""
msgid "Runners|Runner assigned to project."
msgstr ""
msgid "Runners|Runner is offline, last contact was %{runner_contact} ago" msgid "Runners|Runner is offline, last contact was %{runner_contact} ago"
msgstr "" msgstr ""
...@@ -29106,6 +29109,9 @@ msgstr "" ...@@ -29106,6 +29109,9 @@ msgstr ""
msgid "Runners|Runner registration" msgid "Runners|Runner registration"
msgstr "" msgstr ""
msgid "Runners|Runner unassigned from project."
msgstr ""
msgid "Runners|Runners" msgid "Runners|Runners"
msgstr "" msgstr ""
......
...@@ -356,6 +356,7 @@ RSpec.describe "Admin Runners" do ...@@ -356,6 +356,7 @@ RSpec.describe "Admin Runners" do
assigned_project = page.find('[data-testid="assigned-projects"]') assigned_project = page.find('[data-testid="assigned-projects"]')
expect(page).to have_content('Runner assigned to project.')
expect(assigned_project).to have_content(@project2.path) expect(assigned_project).to have_content(@project2.path)
end end
end end
...@@ -399,13 +400,14 @@ RSpec.describe "Admin Runners" do ...@@ -399,13 +400,14 @@ RSpec.describe "Admin Runners" do
visit admin_runner_path(runner) visit admin_runner_path(runner)
end end
it 'enables specific runner for project' do it 'removed specific runner from project' do
within '[data-testid="assigned-projects"]' do within '[data-testid="assigned-projects"]' do
click_on 'Disable' click_on 'Disable'
end end
new_runner_project = page.find('[data-testid="unassigned-projects"]') new_runner_project = page.find('[data-testid="unassigned-projects"]')
expect(page).to have_content('Runner unassigned from project.')
expect(new_runner_project).to have_content(@project1.path) expect(new_runner_project).to have_content(@project1.path)
end 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