Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2018-01-08 22:19:52 +0300
committerFilipa Lacerda <filipa@gitlab.com>2018-01-08 22:19:52 +0300
commite2b759a2f483663e0771180de6b97bb9344a56cd (patch)
tree32cd72a70e405dc0858d774ca3354d6aef1bf445 /app/controllers
parent7ca5a3f99dd3a3c1800f65da7b4f08395a97395a (diff)
parentdf74461014bbdbc691f4f4039b02962dad292362 (diff)
Merge branch 'master' into 34312-eslint-vue-plugin
* master: (140 commits) Add Gitter room link to I want to contribute since you always have questions Use workhorse 3.4.0 chore: remove symbolic link Add memoization for properties Resolve "Allow QA tests to run with `CHROME_HEADLESS=false`" Resolve "Add graph value to hover" Fix slash commands dropdown description disables the shortcut to the issue boards when issues are disabled Fix static analysys Disable STI of ActiveRecord. Refactoring specs. Fix StaticSnalysys Fix change log Add changelog Revert bulk_insert and bring back AR insert(one by one) Add a new test for emptified params Use batch update for Service deactivation Fix query to look for proper unmanaged kubernetes service Fix static anylysy Use bulk_insert instead of AR create Opitmize migration process by using both unmanaged_kubernetes_service and kubernetes_service_without_template ...
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/concerns/issues_action.rb2
-rw-r--r--app/controllers/concerns/merge_requests_action.rb1
-rw-r--r--app/controllers/projects/application_controller.rb4
-rw-r--r--app/controllers/projects/boards_controller.rb1
-rw-r--r--app/controllers/projects/clusters/gcp_controller.rb29
-rw-r--r--app/controllers/projects/issues_controller.rb4
-rw-r--r--app/controllers/projects/settings/ci_cd_controller.rb10
7 files changed, 38 insertions, 13 deletions
diff --git a/app/controllers/concerns/issues_action.rb b/app/controllers/concerns/issues_action.rb
index d4cccbe6442..3ba1235cee0 100644
--- a/app/controllers/concerns/issues_action.rb
+++ b/app/controllers/concerns/issues_action.rb
@@ -5,8 +5,6 @@ module IssuesAction
# rubocop:disable Gitlab/ModuleWithInstanceVariables
def issues
@finder_type = IssuesFinder
- @label = finder.labels.first
-
@issues = issuables_collection
.non_archived
.page(params[:page])
diff --git a/app/controllers/concerns/merge_requests_action.rb b/app/controllers/concerns/merge_requests_action.rb
index 4d44df3bba9..a9cc13038bf 100644
--- a/app/controllers/concerns/merge_requests_action.rb
+++ b/app/controllers/concerns/merge_requests_action.rb
@@ -5,7 +5,6 @@ module MergeRequestsAction
# rubocop:disable Gitlab/ModuleWithInstanceVariables
def merge_requests
@finder_type = MergeRequestsFinder
- @label = finder.labels.first
@merge_requests = issuables_collection.page(params[:page])
diff --git a/app/controllers/projects/application_controller.rb b/app/controllers/projects/application_controller.rb
index 9e79852e378..6025a40348b 100644
--- a/app/controllers/projects/application_controller.rb
+++ b/app/controllers/projects/application_controller.rb
@@ -86,4 +86,8 @@ class Projects::ApplicationController < ApplicationController
def require_pages_enabled!
not_found unless @project.pages_available?
end
+
+ def check_issues_available!
+ return render_404 unless @project.feature_available?(:issues, current_user)
+ end
end
diff --git a/app/controllers/projects/boards_controller.rb b/app/controllers/projects/boards_controller.rb
index e36105ddc11..949e54ff819 100644
--- a/app/controllers/projects/boards_controller.rb
+++ b/app/controllers/projects/boards_controller.rb
@@ -2,6 +2,7 @@ class Projects::BoardsController < Projects::ApplicationController
include BoardsResponses
include IssuableCollections
+ before_action :check_issues_available!
before_action :authorize_read_board!, only: [:index, :show]
before_action :assign_endpoint_vars
diff --git a/app/controllers/projects/clusters/gcp_controller.rb b/app/controllers/projects/clusters/gcp_controller.rb
index d3b9d8a9bbc..25608df0b9c 100644
--- a/app/controllers/projects/clusters/gcp_controller.rb
+++ b/app/controllers/projects/clusters/gcp_controller.rb
@@ -1,6 +1,7 @@
class Projects::Clusters::GcpController < Projects::ApplicationController
before_action :authorize_read_cluster!
before_action :authorize_google_api, except: [:login]
+ before_action :authorize_google_project_billing, only: [:new]
before_action :authorize_create_cluster!, only: [:new, :create]
def login
@@ -22,15 +23,20 @@ class Projects::Clusters::GcpController < Projects::ApplicationController
end
def create
- @cluster = ::Clusters::CreateService
- .new(project, current_user, create_params)
- .execute(token_in_session)
+ case google_project_billing_status
+ when 'true'
+ @cluster = ::Clusters::CreateService
+ .new(project, current_user, create_params)
+ .execute(token_in_session)
- if @cluster.persisted?
- redirect_to project_cluster_path(project, @cluster)
+ return redirect_to project_cluster_path(project, @cluster) if @cluster.persisted?
+ when 'false'
+ flash[:error] = _('Please enable billing for one of your projects to be able to create a cluster.')
else
- render :new
+ flash[:error] = _('We could not verify that one of your projects on GCP has billing enabled. Please try again.')
end
+
+ render :new
end
private
@@ -58,6 +64,17 @@ class Projects::Clusters::GcpController < Projects::ApplicationController
end
end
+ def authorize_google_project_billing
+ redis_token_key = CheckGcpProjectBillingWorker.store_session_token(token_in_session)
+ CheckGcpProjectBillingWorker.perform_async(redis_token_key)
+ end
+
+ def google_project_billing_status
+ Gitlab::Redis::SharedState.with do |redis|
+ redis.get(CheckGcpProjectBillingWorker.redis_shared_state_key_for(token_in_session))
+ end
+ end
+
def token_in_session
@token_in_session ||=
session[GoogleApi::CloudPlatform::Client.session_key_for_token]
diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb
index d7a3441a245..384f18b316c 100644
--- a/app/controllers/projects/issues_controller.rb
+++ b/app/controllers/projects/issues_controller.rb
@@ -194,10 +194,6 @@ class Projects::IssuesController < Projects::ApplicationController
render_404 unless can?(current_user, :push_code, @project) && @issue.can_be_worked_on?(current_user)
end
- def check_issues_available!
- return render_404 unless @project.feature_available?(:issues, current_user)
- end
-
def render_issue_json
if @issue.valid?
render json: serializer.represent(@issue)
diff --git a/app/controllers/projects/settings/ci_cd_controller.rb b/app/controllers/projects/settings/ci_cd_controller.rb
index b029b31f9af..86717bb7242 100644
--- a/app/controllers/projects/settings/ci_cd_controller.rb
+++ b/app/controllers/projects/settings/ci_cd_controller.rb
@@ -11,6 +11,16 @@ module Projects
define_auto_devops_variables
end
+ def reset_cache
+ if ResetProjectCacheService.new(@project, current_user).execute
+ flash[:notice] = _("Project cache successfully reset.")
+ else
+ flash[:error] = _("Unable to reset project cache.")
+ end
+
+ redirect_to project_pipelines_path(@project)
+ end
+
private
def define_runners_variables