Commit c4ccb91b authored by Grzegorz Bizon's avatar Grzegorz Bizon

Resolve remaining conflicts in new runners view feature

parent 636382fb
...@@ -5,11 +5,7 @@ class Admin::RunnersController < Admin::ApplicationController ...@@ -5,11 +5,7 @@ class Admin::RunnersController < Admin::ApplicationController
def index def index
finder = Admin::RunnersFinder.new(params: params) finder = Admin::RunnersFinder.new(params: params)
@runners = finder.execute @runners = finder.execute
<<<<<<< HEAD
@active_runners_cnt = Ci::Runner.online.count
=======
@active_runners_count = Ci::Runner.online.count @active_runners_count = Ci::Runner.online.count
>>>>>>> upstream/master
@sort = finder.sort_key @sort = finder.sort_key
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
......
...@@ -32,15 +32,12 @@ module Ci ...@@ -32,15 +32,12 @@ module Ci
scope :active, -> { where(active: true) } scope :active, -> { where(active: true) }
scope :paused, -> { where(active: false) } scope :paused, -> { where(active: false) }
scope :online, -> { where('contacted_at > ?', contact_time_deadline) } scope :online, -> { where('contacted_at > ?', contact_time_deadline) }
<<<<<<< HEAD
=======
# The following query using negation is cheaper than using `contacted_at <= ?` # The following query using negation is cheaper than using `contacted_at <= ?`
# because there are less runners online than have been created. The # because there are less runners online than have been created. The
# resulting query is quickly finding online ones and then uses the regular # resulting query is quickly finding online ones and then uses the regular
# indexed search and rejects the ones that are in the previous set. If we # indexed search and rejects the ones that are in the previous set. If we
# did `contacted_at <= ?` the query would effectively have to do a seq # did `contacted_at <= ?` the query would effectively have to do a seq
# scan. # scan.
>>>>>>> upstream/master
scope :offline, -> { where.not(id: online) } scope :offline, -> { where.not(id: online) }
scope :ordered, -> { order(id: :desc) } scope :ordered, -> { order(id: :desc) }
......
...@@ -47,11 +47,7 @@ ...@@ -47,11 +47,7 @@
.bs-callout .bs-callout
%p %p
<<<<<<< HEAD
= _('Runners currently online: %{active_runners_cnt}') % { active_runners_cnt: @active_runners_cnt }
=======
= _('Runners currently online: %{active_runners_count}') % { active_runners_count: @active_runners_count } = _('Runners currently online: %{active_runners_count}') % { active_runners_count: @active_runners_count }
>>>>>>> upstream/master
.row-content-block.second-block .row-content-block.second-block
= form_tag admin_runners_path, id: 'runners-search', method: :get, class: 'filter-form js-filter-form' do = form_tag admin_runners_path, id: 'runners-search', method: :get, class: 'filter-form js-filter-form' do
...@@ -72,21 +68,13 @@ ...@@ -72,21 +68,13 @@
#js-dropdown-hint.filtered-search-input-dropdown-menu.dropdown-menu.hint-dropdown #js-dropdown-hint.filtered-search-input-dropdown-menu.dropdown-menu.hint-dropdown
%ul{ data: { dropdown: true } } %ul{ data: { dropdown: true } }
%li.filter-dropdown-item{ data: { action: 'submit' } } %li.filter-dropdown-item{ data: { action: 'submit' } }
<<<<<<< HEAD
%button.btn.btn-link
=======
= button_tag class: %w[btn btn-link] do = button_tag class: %w[btn btn-link] do
>>>>>>> upstream/master
= icon('search') = icon('search')
%span %span
= _('Press Enter or click to search') = _('Press Enter or click to search')
%ul.filter-dropdown{ data: { dynamic: true, dropdown: true } } %ul.filter-dropdown{ data: { dynamic: true, dropdown: true } }
%li.filter-dropdown-item %li.filter-dropdown-item
<<<<<<< HEAD
%button.btn.btn-link
=======
= button_tag class: %w[btn btn-link] do = button_tag class: %w[btn btn-link] do
>>>>>>> upstream/master
-# Encapsulate static class name `{{icon}}` inside #{} to bypass -# Encapsulate static class name `{{icon}}` inside #{} to bypass
-# haml lint's ClassAttributeWithStaticValue -# haml lint's ClassAttributeWithStaticValue
%i.fa{ class: "#{'{{icon}}'}" } %i.fa{ class: "#{'{{icon}}'}" }
...@@ -98,15 +86,9 @@ ...@@ -98,15 +86,9 @@
%ul{ data: { dropdown: true } } %ul{ data: { dropdown: true } }
- Ci::Runner::AVAILABLE_STATUSES.each do |status| - Ci::Runner::AVAILABLE_STATUSES.each do |status|
%li.filter-dropdown-item{ data: { value: status } } %li.filter-dropdown-item{ data: { value: status } }
<<<<<<< HEAD
%button.btn.btn-link
= status.titleize
%button.clear-search.hidden{ type: 'button' }
=======
= button_tag class: %w[btn btn-link] do = button_tag class: %w[btn btn-link] do
= status.titleize = status.titleize
= button_tag class: %w[clear-search hidden] do = button_tag class: %w[clear-search hidden] do
>>>>>>> upstream/master
= icon('times') = icon('times')
.filter-dropdown-container .filter-dropdown-container
= render 'sort_dropdown' = render 'sort_dropdown'
......
...@@ -14,11 +14,7 @@ module API ...@@ -14,11 +14,7 @@ module API
use :pagination use :pagination
end end
get do get do
<<<<<<< HEAD
runners = filter_runners(current_user.ci_owned_runners, params[:scope], only: Ci::Runner::AVAILABLE_STATUSES)
=======
runners = filter_runners(current_user.ci_owned_runners, params[:scope], allowed_scopes: Ci::Runner::AVAILABLE_STATUSES) runners = filter_runners(current_user.ci_owned_runners, params[:scope], allowed_scopes: Ci::Runner::AVAILABLE_STATUSES)
>>>>>>> upstream/master
present paginate(runners), with: Entities::Runner present paginate(runners), with: Entities::Runner
end end
...@@ -164,19 +160,10 @@ module API ...@@ -164,19 +160,10 @@ module API
end end
helpers do helpers do
<<<<<<< HEAD
def filter_runners(runners, scope, only: nil)
return runners unless scope.present?
available_scopes = only || ::Ci::Runner::AVAILABLE_SCOPES
unless available_scopes.include?(scope)
=======
def filter_runners(runners, scope, allowed_scopes: ::Ci::Runner::AVAILABLE_SCOPES) def filter_runners(runners, scope, allowed_scopes: ::Ci::Runner::AVAILABLE_SCOPES)
return runners unless scope.present? return runners unless scope.present?
unless allowed_scopes.include?(scope) unless allowed_scopes.include?(scope)
>>>>>>> upstream/master
render_api_error!('Scope contains invalid value', 400) render_api_error!('Scope contains invalid value', 400)
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