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