2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
class Groups::RunnersController < Groups::ApplicationController
|
2022-03-02 08:16:31 +05:30
|
|
|
before_action :authorize_read_group_runners!, only: [:index, :show]
|
|
|
|
before_action :authorize_admin_group_runners!, only: [:edit, :update, :destroy, :pause, :resume]
|
2018-10-15 14:42:47 +05:30
|
|
|
before_action :runner, only: [:edit, :update, :destroy, :pause, :resume, :show]
|
|
|
|
|
2021-09-30 23:02:18 +05:30
|
|
|
feature_category :runner
|
2022-07-16 23:28:13 +05:30
|
|
|
urgency :low
|
2021-01-03 14:25:43 +05:30
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
def index
|
2022-04-04 11:22:00 +05:30
|
|
|
finder = Ci::RunnersFinder.new(current_user: current_user, params: { group: @group })
|
|
|
|
@group_runners_limited_count = finder.execute.except(:limit, :offset).page.total_count_with_limit(:all, limit: 1000)
|
2022-06-21 17:19:12 +05:30
|
|
|
|
|
|
|
Gitlab::Tracking.event(self.class.name, 'index', user: current_user, namespace: @group)
|
2021-10-27 15:23:28 +05:30
|
|
|
end
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
def show
|
|
|
|
end
|
|
|
|
|
|
|
|
def edit
|
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
2022-05-07 20:08:51 +05:30
|
|
|
if Ci::Runners::UpdateRunnerService.new(@runner).update(runner_params)
|
2019-07-07 11:18:12 +05:30
|
|
|
redirect_to group_runner_path(@group, @runner), notice: _('Runner was successfully updated.')
|
2018-10-15 14:42:47 +05:30
|
|
|
else
|
|
|
|
render 'edit'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def runner
|
2022-04-04 11:22:00 +05:30
|
|
|
@runner ||= Ci::RunnersFinder.new(current_user: current_user, params: { group: @group }).execute
|
|
|
|
.except(:limit, :offset)
|
|
|
|
.find(params[:id])
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def runner_params
|
|
|
|
params.require(:runner).permit(Ci::Runner::FORM_EDITABLE)
|
|
|
|
end
|
|
|
|
end
|