From bbc305b1a24785d780fe0672d9e49f2c53af463b Mon Sep 17 00:00:00 2001 From: Alexis Reigel Date: Thu, 7 Jun 2018 17:43:23 +0200 Subject: [PATCH] dry up available scopes to constants --- app/models/ci/runner.rb | 4 +++- lib/api/runners.rb | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb index c0f632c2c9a..a041ea1a1c8 100644 --- a/app/models/ci/runner.rb +++ b/app/models/ci/runner.rb @@ -11,7 +11,9 @@ module Ci RUNNER_QUEUE_EXPIRY_TIME = 60.minutes ONLINE_CONTACT_TIMEOUT = 1.hour UPDATE_DB_RUNNER_INFO_EVERY = 40.minutes - AVAILABLE_SCOPES = %w[specific shared active paused online].freeze + AVAILABLE_TYPES = %w[specific shared].freeze + AVAILABLE_STATUSES = %w[active paused online offline].freeze + AVAILABLE_SCOPES = (AVAILABLE_TYPES + AVAILABLE_STATUSES).freeze FORM_EDITABLE = %i[description tag_list active run_untagged locked access_level maximum_timeout_human_readable].freeze ignore_column :is_shared diff --git a/lib/api/runners.rb b/lib/api/runners.rb index bf9cd6234a3..3ddf6694e57 100644 --- a/lib/api/runners.rb +++ b/lib/api/runners.rb @@ -9,7 +9,7 @@ module API success Entities::Runner end params do - optional :scope, type: String, values: %w[active paused online offline], + optional :scope, type: String, values: Ci::Runner::AVAILABLE_STATUSES, desc: 'The scope of specific runners to show' use :pagination end @@ -22,7 +22,7 @@ module API success Entities::Runner end params do - optional :scope, type: String, values: %w[active paused online offline specific shared], + optional :scope, type: String, values: Ci::Runner::AVAILABLE_SCOPES, desc: 'The scope of specific runners to show' use :pagination end @@ -114,7 +114,7 @@ module API success Entities::Runner end params do - optional :scope, type: String, values: %w[active paused online offline specific shared], + optional :scope, type: String, values: Ci::Runner::AVAILABLE_SCOPES, desc: 'The scope of specific runners to show' use :pagination end