Commit 9fd6f1b6 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Improve displaying validation messages for runner

parent 2ee24bd9
......@@ -20,7 +20,6 @@ class Projects::RunnersController < Projects::ApplicationController
if @runner.update_attributes(runner_params)
redirect_to runner_path(@runner), notice: 'Runner was successfully updated.'
else
flash[:alert] = @runner.errors.full_messages.to_sentence
render 'edit'
end
end
......
......@@ -27,9 +27,9 @@ module Ci
end
validate do |runner|
if runner.tag_list.empty? && !runner.run_untagged?
errors.add(:tags_errors,
'Runner without tags must be able to pick untagged jobs!')
unless runner.has_tags? || runner.run_untagged?
errors.add(:tags_list,
'can not be empty when runner is not allowed to pick untagged jobs')
end
end
......@@ -103,5 +103,9 @@ module Ci
def short_sha
token[0...8] if token
end
def has_tags?
tag_list.any?
end
end
end
- page_title "Edit", "#{@runner.description} ##{@runner.id}", "Runners"
%h4 Runner ##{@runner.id}
- if @runner.errors.any?
.error-message.js-errors
- @runner.errors.full_messages.each do |error|
%div= error
%hr
= render 'form', runner: @runner, runner_form_url: runner_path(@runner)
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