Commit c0fafb6b authored by Stan Hu's avatar Stan Hu

Merge branch 'dz-refactor-group-labels-finder' into 'master'

Fix group labels page timeout if many projects and labels

Closes #51221

See merge request gitlab-org/gitlab-ce!21594
parents c155ddd7 534f8152
...@@ -2,7 +2,6 @@ class Groups::LabelsController < Groups::ApplicationController ...@@ -2,7 +2,6 @@ class Groups::LabelsController < Groups::ApplicationController
include ToggleSubscriptionAction include ToggleSubscriptionAction
before_action :label, only: [:edit, :update, :destroy] before_action :label, only: [:edit, :update, :destroy]
before_action :available_labels, only: [:index]
before_action :authorize_admin_labels!, only: [:new, :create, :edit, :update, :destroy] before_action :authorize_admin_labels!, only: [:new, :create, :edit, :update, :destroy]
before_action :save_previous_label_path, only: [:edit] before_action :save_previous_label_path, only: [:edit]
...@@ -11,10 +10,12 @@ class Groups::LabelsController < Groups::ApplicationController ...@@ -11,10 +10,12 @@ class Groups::LabelsController < Groups::ApplicationController
def index def index
respond_to do |format| respond_to do |format|
format.html do format.html do
@labels = @available_labels.page(params[:page]) @labels = @group.labels
.optionally_search(params[:search])
.page(params[:page])
end end
format.json do format.json do
render json: LabelSerializer.new.represent_appearance(@available_labels) render json: LabelSerializer.new.represent_appearance(available_labels)
end end
end end
end end
......
...@@ -5,6 +5,7 @@ class Label < ActiveRecord::Base ...@@ -5,6 +5,7 @@ class Label < ActiveRecord::Base
include Referable include Referable
include Subscribable include Subscribable
include Gitlab::SQL::Pattern include Gitlab::SQL::Pattern
include OptionallySearch
# Represents a "No Label" state used for filtering Issues and Merge # Represents a "No Label" state used for filtering Issues and Merge
# Requests that have no label assigned. # Requests that have no label assigned.
......
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