summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2017-05-19 19:52:45 +0000
committerFatih Acet <acetfatih@gmail.com>2017-05-19 19:52:45 +0000
commit5460153c9f1a0b1679e4f31f1d588cb77857b714 (patch)
treebbee0c9665f835a7834995374b15ab32d86eded9 /app
parentdb4bbbabcafa78cfa0176fefac1b4c1dd33d098f (diff)
parentb3cf3d046b8a319c0dbca7cb9aeaea027c080e6f (diff)
downloadgitlab-ce-5460153c9f1a0b1679e4f31f1d588cb77857b714.tar.gz
Merge branch '32536-mr-widget-performance-improvements' into 'master'
Load improvements related to MR widget See merge request !11518
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js1
-rw-r--r--app/assets/javascripts/vue_merge_request_widget/services/mr_widget_service.js2
-rw-r--r--app/controllers/projects/merge_requests_controller.rb18
-rw-r--r--app/serializers/merge_request_basic_entity.rb1
-rw-r--r--app/serializers/merge_request_entity.rb7
-rw-r--r--app/views/shared/issuable/_sidebar.html.haml2
6 files changed, 13 insertions, 18 deletions
diff --git a/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js b/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js
index 5452e19bd8e..99600b6664e 100644
--- a/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js
+++ b/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js
@@ -175,7 +175,6 @@ export default {
});
},
handleMounted() {
- this.checkStatus();
this.setFavicon();
this.initDeploymentsPolling();
},
diff --git a/app/assets/javascripts/vue_merge_request_widget/services/mr_widget_service.js b/app/assets/javascripts/vue_merge_request_widget/services/mr_widget_service.js
index 42493be3372..79c3d335679 100644
--- a/app/assets/javascripts/vue_merge_request_widget/services/mr_widget_service.js
+++ b/app/assets/javascripts/vue_merge_request_widget/services/mr_widget_service.js
@@ -6,7 +6,7 @@ Vue.use(VueResource);
export default class MRWidgetService {
constructor(endpoints) {
this.mergeResource = Vue.resource(endpoints.mergePath);
- this.mergeCheckResource = Vue.resource(endpoints.mergeCheckPath);
+ this.mergeCheckResource = Vue.resource(endpoints.statusPath);
this.cancelAutoMergeResource = Vue.resource(endpoints.cancelAutoMergePath);
this.removeWIPResource = Vue.resource(endpoints.removeWIPPath);
this.removeSourceBranchResource = Vue.resource(endpoints.sourceBranchPath);
diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb
index b99ccd453b8..0352065998b 100644
--- a/app/controllers/projects/merge_requests_controller.rb
+++ b/app/controllers/projects/merge_requests_controller.rb
@@ -9,14 +9,15 @@ class Projects::MergeRequestsController < Projects::ApplicationController
before_action :module_enabled
before_action :merge_request, only: [
- :edit, :update, :show, :diffs, :commits, :conflicts, :conflict_for_path, :pipelines, :merge, :merge_check,
+ :edit, :update, :show, :diffs, :commits, :conflicts, :conflict_for_path, :pipelines, :merge,
:pipeline_status, :ci_environments_status, :toggle_subscription, :cancel_merge_when_pipeline_succeeds, :remove_wip, :resolve_conflicts, :assign_related_issues, :commit_change_content
]
before_action :validates_merge_request, only: [:show, :diffs, :commits, :pipelines]
- before_action :define_show_vars, only: [:show, :diffs, :commits, :conflicts, :conflict_for_path, :builds, :pipelines]
+ before_action :define_show_vars, only: [:diffs, :commits, :conflicts, :conflict_for_path, :builds, :pipelines]
before_action :define_commit_vars, only: [:diffs]
before_action :ensure_ref_fetched, only: [:show, :diffs, :commits, :builds, :conflicts, :conflict_for_path, :pipelines]
before_action :close_merge_request_without_source_project, only: [:show, :diffs, :commits, :builds, :pipelines]
+ before_action :check_if_can_be_merged, only: :show
before_action :apply_diff_view_cookie!, only: [:new_diffs]
before_action :build_merge_request, only: [:new, :new_diffs]
@@ -75,9 +76,12 @@ class Projects::MergeRequestsController < Projects::ApplicationController
respond_to do |format|
format.html do
define_discussion_vars
+ define_show_vars
end
format.json do
+ Gitlab::PollingInterval.set_header(response, interval: 10_000)
+
render json: serializer.represent(@merge_request, basic: params[:basic])
end
@@ -309,12 +313,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
render json: serializer.represent(@merge_request)
end
- def merge_check
- @merge_request.check_if_can_be_merged
-
- render json: serializer.represent(@merge_request)
- end
-
def commit_change_content
render partial: 'projects/merge_requests/widget/commit_change_content', layout: false
end
@@ -640,6 +638,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController
private
+ def check_if_can_be_merged
+ @merge_request.check_if_can_be_merged
+ end
+
def merge!
# Disable the CI check if merge_when_pipeline_succeeds is enabled since we have
# to wait until CI completes to know
diff --git a/app/serializers/merge_request_basic_entity.rb b/app/serializers/merge_request_basic_entity.rb
index 8771345c135..8461f158bb5 100644
--- a/app/serializers/merge_request_basic_entity.rb
+++ b/app/serializers/merge_request_basic_entity.rb
@@ -1,4 +1,5 @@
class MergeRequestBasicEntity < Grape::Entity
+ expose :assignee_id
expose :merge_status
expose :merge_error
expose :state
diff --git a/app/serializers/merge_request_entity.rb b/app/serializers/merge_request_entity.rb
index a49f4d834cd..b3247ae36dd 100644
--- a/app/serializers/merge_request_entity.rb
+++ b/app/serializers/merge_request_entity.rb
@@ -1,7 +1,6 @@
class MergeRequestEntity < IssuableEntity
include RequestAwareEntity
- expose :assignee_id
expose :in_progress_merge_commit_sha
expose :locked_at
expose :merge_commit_sha
@@ -154,12 +153,6 @@ class MergeRequestEntity < IssuableEntity
format: :json)
end
- expose :merge_check_path do |merge_request|
- merge_check_namespace_project_merge_request_path(merge_request.project.namespace,
- merge_request.project,
- merge_request)
- end
-
expose :ci_environments_status_path do |merge_request|
ci_environments_status_namespace_project_merge_request_path(merge_request.project.namespace,
merge_request.project,
diff --git a/app/views/shared/issuable/_sidebar.html.haml b/app/views/shared/issuable/_sidebar.html.haml
index ac84fffe831..e49bd5ebb13 100644
--- a/app/views/shared/issuable/_sidebar.html.haml
+++ b/app/views/shared/issuable/_sidebar.html.haml
@@ -140,7 +140,7 @@
:javascript
gl.sidebarOptions = {
- endpoint: "#{issuable_json_path(issuable)}",
+ endpoint: "#{issuable_json_path(issuable)}?basic=true",
editable: #{can_edit_issuable ? true : false},
currentUser: #{current_user.to_json(only: [:username, :id, :name], methods: :avatar_url)},
rootPath: "#{root_path}"