diff options
Diffstat (limited to 'app/finders/ci/runner_managers_finder.rb')
-rw-r--r-- | app/finders/ci/runner_managers_finder.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/app/finders/ci/runner_managers_finder.rb b/app/finders/ci/runner_managers_finder.rb new file mode 100644 index 00000000000..f24be74bbeb --- /dev/null +++ b/app/finders/ci/runner_managers_finder.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module Ci + class RunnerManagersFinder + def initialize(runner:, params:) + @runner = runner + @params = params + end + + def execute + items = runner_managers + + filter_by_status(items) + end + + private + + attr_reader :runner, :params + + def runner_managers + ::Ci::RunnerManager.for_runner(runner) + end + + def filter_by_status(items) + status = params[:status] + return items if status.blank? + + items.with_status(status) + end + end +end |