From 4927cb75e6ab82500b3d055f35ea621483c224fe Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Thu, 1 Mar 2018 14:25:13 +0000 Subject: Remove IDE from CE --- app/controllers/ide_controller.rb | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 app/controllers/ide_controller.rb (limited to 'app/controllers') diff --git a/app/controllers/ide_controller.rb b/app/controllers/ide_controller.rb deleted file mode 100644 index 1ff25a45398..00000000000 --- a/app/controllers/ide_controller.rb +++ /dev/null @@ -1,6 +0,0 @@ -class IdeController < ApplicationController - layout 'nav_only' - - def index - end -end -- cgit v1.2.3 From 30ef73afac3d57af87ee948bb7c90743f49e6da8 Mon Sep 17 00:00:00 2001 From: julien MILLAU Date: Fri, 2 Mar 2018 10:10:39 +0000 Subject: Remove impersonate token from flash scope --- app/controllers/admin/impersonation_tokens_controller.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'app/controllers') diff --git a/app/controllers/admin/impersonation_tokens_controller.rb b/app/controllers/admin/impersonation_tokens_controller.rb index 7a2c7234a1e..a7b562b1d8e 100644 --- a/app/controllers/admin/impersonation_tokens_controller.rb +++ b/app/controllers/admin/impersonation_tokens_controller.rb @@ -9,7 +9,6 @@ class Admin::ImpersonationTokensController < Admin::ApplicationController @impersonation_token = finder.build(impersonation_token_params) if @impersonation_token.save - flash[:impersonation_token] = @impersonation_token.token redirect_to admin_user_impersonation_tokens_path, notice: "A new impersonation token has been created." else set_index_vars -- cgit v1.2.3 From 8ae57909a1ac5f398098f9d1c4581b3cf3d61674 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Thu, 1 Mar 2018 18:24:25 -0600 Subject: Backport BE changes from CI/CD projects ee!4567 See https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/4567 --- app/controllers/projects_controller.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 913689a1e74..4a2f5ab3f88 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -41,7 +41,7 @@ class ProjectsController < Projects::ApplicationController cookies[:issue_board_welcome_hidden] = { path: project_path(@project), value: nil, expires: Time.at(0) } redirect_to( - project_path(@project), + project_path(@project, custom_import_params), notice: _("Project '%{project_name}' was successfully created.") % { project_name: @project.name } ) else @@ -103,7 +103,7 @@ class ProjectsController < Projects::ApplicationController def show if @project.import_in_progress? - redirect_to project_import_path(@project) + redirect_to project_import_path(@project, custom_import_params) return end @@ -359,6 +359,10 @@ class ProjectsController < Projects::ApplicationController ] end + def custom_import_params + {} + end + def repo_exists? project.repository_exists? && !project.empty_repo? -- cgit v1.2.3 From 0a4ee10eda01e23ddea0e6b4f80f61df3ffaabde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Rodr=C3=ADguez?= Date: Wed, 28 Feb 2018 19:22:44 -0300 Subject: Fix n+1 issue by not reloading fully loaded blobs --- app/controllers/projects/compare_controller.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/projects/compare_controller.rb b/app/controllers/projects/compare_controller.rb index 3cb4eb23981..2b0c2ca97c0 100644 --- a/app/controllers/projects/compare_controller.rb +++ b/app/controllers/projects/compare_controller.rb @@ -17,10 +17,8 @@ class Projects::CompareController < Projects::ApplicationController def show apply_diff_view_cookie! - # n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/37430 - Gitlab::GitalyClient.allow_n_plus_1_calls do - render - end + + render end def diff_for_path -- cgit v1.2.3 From 8fe9995f11010749c5fb183f2d8129f547ae6d4a Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 5 Mar 2018 16:15:26 +0200 Subject: Replace deprecated name_with_namespace with full_name in app and spec Signed-off-by: Dmitriy Zaporozhets --- app/controllers/invites_controller.rb | 2 +- app/controllers/projects/blob_controller.rb | 2 +- app/controllers/projects/tree_controller.rb | 2 +- app/controllers/projects_controller.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/invites_controller.rb b/app/controllers/invites_controller.rb index 52430ea771f..025d8270b7c 100644 --- a/app/controllers/invites_controller.rb +++ b/app/controllers/invites_controller.rb @@ -62,7 +62,7 @@ class InvitesController < ApplicationController case source when Project project = member.source - label = "project #{project.name_with_namespace}" + label = "project #{project.full_name}" path = project_path(project) when Group group = member.source diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb index 74c25505e36..405726c017c 100644 --- a/app/controllers/projects/blob_controller.rb +++ b/app/controllers/projects/blob_controller.rb @@ -38,7 +38,7 @@ class Projects::BlobController < Projects::ApplicationController end format.json do - page_title @blob.path, @ref, @project.name_with_namespace + page_title @blob.path, @ref, @project.full_name show_json end diff --git a/app/controllers/projects/tree_controller.rb b/app/controllers/projects/tree_controller.rb index f752a46f828..ee9b5458282 100644 --- a/app/controllers/projects/tree_controller.rb +++ b/app/controllers/projects/tree_controller.rb @@ -36,7 +36,7 @@ class Projects::TreeController < Projects::ApplicationController end format.json do - page_title @path.presence || _("Files"), @ref, @project.name_with_namespace + page_title @path.presence || _("Files"), @ref, @project.full_name # n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/38261 Gitlab::GitalyClient.allow_n_plus_1_calls do diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 913689a1e74..af9281e0d02 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -130,7 +130,7 @@ class ProjectsController < Projects::ApplicationController return access_denied! unless can?(current_user, :remove_project, @project) ::Projects::DestroyService.new(@project, current_user, {}).async_execute - flash[:notice] = _("Project '%{project_name}' is in the process of being deleted.") % { project_name: @project.name_with_namespace } + flash[:notice] = _("Project '%{project_name}' is in the process of being deleted.") % { project_name: @project.full_name } redirect_to dashboard_projects_path, status: 302 rescue Projects::DestroyService::DestroyError => ex -- cgit v1.2.3 From 32d121343d91eea44d1de344b398d30014180da0 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Tue, 20 Feb 2018 20:23:49 -0600 Subject: CI/CD-only projects FE See https://gitlab.com/gitlab-org/gitlab-ee/issues/3839 Conflicts: app/assets/javascripts/projects/project_new.js app/views/shared/_import_form.html.haml ee/app/controllers/ee/projects_controller.rb ee/spec/features/projects/new_project_spec.rb locale/gitlab.pot --- app/controllers/projects_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app/controllers') diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 4a2f5ab3f88..67fad15ff92 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -45,7 +45,7 @@ class ProjectsController < Projects::ApplicationController notice: _("Project '%{project_name}' was successfully created.") % { project_name: @project.name } ) else - render 'new', locals: { active_tab: ('import' if project_params[:import_url].present?) } + render 'new', locals: { active_tab: active_new_project_tab } end end @@ -363,6 +363,10 @@ class ProjectsController < Projects::ApplicationController {} end + def active_new_project_tab + project_params[:import_url].present? ? 'import' : 'blank' + end + def repo_exists? project.repository_exists? && !project.empty_repo? -- cgit v1.2.3 From 580d8953636266e40802fd8ea525c4908ebc8b9f Mon Sep 17 00:00:00 2001 From: Takuya Noguchi Date: Wed, 15 Nov 2017 23:56:36 +0900 Subject: Add overview of branches and a filter for active/stale branches --- app/controllers/projects/branches_controller.rb | 41 ++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 5 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb index cabafe26357..965cece600e 100644 --- a/app/controllers/projects/branches_controller.rb +++ b/app/controllers/projects/branches_controller.rb @@ -7,13 +7,19 @@ class Projects::BranchesController < Projects::ApplicationController before_action :authorize_download_code! before_action :authorize_push_code!, only: [:new, :create, :destroy, :destroy_all_merged] - def index - @sort = params[:sort].presence || sort_value_recently_updated - @branches = BranchesFinder.new(@repository, params.merge(sort: @sort)).execute - @branches = Kaminari.paginate_array(@branches).page(params[:page]) + # Support legacy URLs + before_action :redirect_for_legacy_index_sort_or_search, only: [:index] + def index respond_to do |format| format.html do + @sort = params[:sort].presence || sort_value_recently_updated + @mode = params[:state].presence || 'overview' + @overview_max_branches = 5 + + # Fetch branches for the specified mode + fetch_branches_by_mode + @refs_pipelines = @project.pipelines.latest_successful_for_refs(@branches.map(&:name)) @merged_branch_names = repository.merged_branch_names(@branches.map(&:name)) @@ -28,7 +34,9 @@ class Projects::BranchesController < Projects::ApplicationController end end format.json do - render json: @branches.map(&:name) + branches = BranchesFinder.new(@repository, params).execute + branches = Kaminari.paginate_array(branches).page(params[:page]) + render json: branches.map(&:name) end end end @@ -123,4 +131,27 @@ class Projects::BranchesController < Projects::ApplicationController context: 'autodeploy' ) end + + def redirect_for_legacy_index_sort_or_search + # Normalize a legacy URL with redirect + if request.format != :json && !params[:state].presence && [:sort, :search, :page].any? { |key| params[key].presence } + redirect_to project_branches_filtered_path(@project, state: 'all'), notice: 'Update your bookmarked URLs as filtered/sorted branches URL has been changed.' + end + end + + def fetch_branches_by_mode + if @mode == 'overview' + # overview mode + @active_branches, @stale_branches = BranchesFinder.new(@repository, sort: sort_value_recently_updated).execute.partition(&:active?) + # Here we get one more branch to indicate if there are more data we're not showing + @active_branches = @active_branches.first(@overview_max_branches + 1) + @stale_branches = @stale_branches.first(@overview_max_branches + 1) + @branches = @active_branches + @stale_branches + else + # active/stale/all view mode + @branches = BranchesFinder.new(@repository, params.merge(sort: @sort)).execute + @branches = @branches.select { |b| b.state.to_s == @mode } if %w[active stale].include?(@mode) + @branches = Kaminari.paginate_array(@branches).page(params[:page]) + end + end end -- cgit v1.2.3 From b5ec6097b75819626083726d1073978d11aba7e3 Mon Sep 17 00:00:00 2001 From: Andrew Newdigate Date: Tue, 6 Mar 2018 13:32:48 +0000 Subject: Fix Gitaly n+1 in NetworkController#show --- app/controllers/projects/network_controller.rb | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/projects/network_controller.rb b/app/controllers/projects/network_controller.rb index 3b10a93e97f..35fec229db7 100644 --- a/app/controllers/projects/network_controller.rb +++ b/app/controllers/projects/network_controller.rb @@ -9,25 +9,22 @@ class Projects::NetworkController < Projects::ApplicationController before_action :assign_commit def show - # n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/37602 - Gitlab::GitalyClient.allow_n_plus_1_calls do - @url = project_network_path(@project, @ref, @options.merge(format: :json)) - @commit_url = project_commit_path(@project, 'ae45ca32').gsub("ae45ca32", "%s") - - respond_to do |format| - format.html do - if @options[:extended_sha1] && !@commit - flash.now[:alert] = "Git revision '#{@options[:extended_sha1]}' does not exist." - end - end + @url = project_network_path(@project, @ref, @options.merge(format: :json)) + @commit_url = project_commit_path(@project, 'ae45ca32').gsub("ae45ca32", "%s") - format.json do - @graph = Network::Graph.new(project, @ref, @commit, @options[:filter_ref]) + respond_to do |format| + format.html do + if @options[:extended_sha1] && !@commit + flash.now[:alert] = "Git revision '#{@options[:extended_sha1]}' does not exist." end end - render + format.json do + @graph = Network::Graph.new(project, @ref, @commit, @options[:filter_ref]) + end end + + render end def assign_commit -- cgit v1.2.3