From d2ebc9b931d12cb2cb120d6f7c940744bc1be39c Mon Sep 17 00:00:00 2001 From: James Edwards-Jones Date: Thu, 19 Oct 2017 17:47:11 +0300 Subject: [PATCH 001/120] Prevent schema.rb reverting from datetime_with_timezone to datetime --- .../initializers/active_record_data_types.rb | 5 ++++ .../20171019141859_fix_dev_timezone_schema.rb | 25 +++++++++++++++++++ db/schema.rb | 8 +++--- 3 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20171019141859_fix_dev_timezone_schema.rb diff --git a/config/initializers/active_record_data_types.rb b/config/initializers/active_record_data_types.rb index fef591c397d..0359e14b232 100644 --- a/config/initializers/active_record_data_types.rb +++ b/config/initializers/active_record_data_types.rb @@ -79,3 +79,8 @@ elsif Gitlab::Database.mysql? NATIVE_DATABASE_TYPES[:datetime_with_timezone] = { name: 'timestamp' } end end + +# Ensure `datetime_with_timezone` columns are correctly written to schema.rb +if (ActiveRecord::Base.connection.active? rescue false) + ActiveRecord::Base.connection.send :reload_type_map +end diff --git a/db/migrate/20171019141859_fix_dev_timezone_schema.rb b/db/migrate/20171019141859_fix_dev_timezone_schema.rb new file mode 100644 index 00000000000..fb7c17dd747 --- /dev/null +++ b/db/migrate/20171019141859_fix_dev_timezone_schema.rb @@ -0,0 +1,25 @@ +class FixDevTimezoneSchema < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + # The this migrations tries to help solve unwanted changes to `schema.rb` + # while developing GitLab. Installations created before we started using + # `datetime_with_timezone` are likely to face this problem. Updating those + # columns to the new type should help fix this. + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + TIMEZONE_TABLES = %i(appearances ci_group_variables ci_pipeline_schedule_variables events gpg_keys gpg_signatures project_auto_devops) + + def up + return unless Rails.env.development? || Rails.env.test? + + TIMEZONE_TABLES.each do |table| + change_column table, :created_at, :datetime_with_timezone + change_column table, :updated_at, :datetime_with_timezone + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 0984ca6487f..990456648b7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -649,8 +649,8 @@ ActiveRecord::Schema.define(version: 20171124150326) do t.datetime "created_at" t.datetime "updated_at" t.string "confirmation_token" - t.datetime "confirmed_at" - t.datetime "confirmation_sent_at" + t.datetime_with_timezone "confirmed_at" + t.datetime_with_timezone "confirmation_sent_at" end add_index "emails", ["confirmation_token"], name: "index_emails_on_confirmation_token", unique: true, using: :btree @@ -1762,8 +1762,8 @@ ActiveRecord::Schema.define(version: 20171124150326) do add_index "user_agent_details", ["subject_id", "subject_type"], name: "index_user_agent_details_on_subject_id_and_subject_type", using: :btree create_table "user_custom_attributes", force: :cascade do |t| - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime_with_timezone "created_at", null: false + t.datetime_with_timezone "updated_at", null: false t.integer "user_id", null: false t.string "key", null: false t.string "value", null: false From e391fe1d6d39837d6aebb14f90e200fc6ff42d81 Mon Sep 17 00:00:00 2001 From: Pawel Chojnacki Date: Tue, 12 Dec 2017 15:11:34 +0100 Subject: [PATCH 002/120] Reduce cardinality of gitlab_cache_operation_duration_seconds histogram --- lib/gitlab/metrics/subscribers/rails_cache.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gitlab/metrics/subscribers/rails_cache.rb b/lib/gitlab/metrics/subscribers/rails_cache.rb index efd3c9daf79..250897a79c2 100644 --- a/lib/gitlab/metrics/subscribers/rails_cache.rb +++ b/lib/gitlab/metrics/subscribers/rails_cache.rb @@ -66,7 +66,7 @@ module Gitlab :gitlab_cache_operation_duration_seconds, 'Cache access time', Transaction::BASE_LABELS.merge({ action: nil }), - [0.001, 0.002, 0.005, 0.01, 0.02, 0.05, 0.1, 0.500, 2.0, 10.0] + [0.001, 0.01, 0.1, 1, 10] ) end From b02db1f4931060d9e28bd0d651dbea34c79340e2 Mon Sep 17 00:00:00 2001 From: Pawel Chojnacki Date: Tue, 12 Dec 2017 16:54:11 +0100 Subject: [PATCH 003/120] Fix gitaly_call_histogram to observe times in seconds correctly --- lib/gitlab/gitaly_client.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gitlab/gitaly_client.rb b/lib/gitlab/gitaly_client.rb index b753ac46291..7aa2eafbb73 100644 --- a/lib/gitlab/gitaly_client.rb +++ b/lib/gitlab/gitaly_client.rb @@ -132,7 +132,7 @@ module Gitlab self.query_time += duration gitaly_call_histogram.observe( current_transaction_labels.merge(gitaly_service: service.to_s, rpc: rpc.to_s), - duration) + duration / 1000.0) end def self.current_transaction_labels From a8ebed6016726722a2283458e4176fc9177558af Mon Sep 17 00:00:00 2001 From: Pawel Chojnacki Date: Tue, 12 Dec 2017 18:12:49 +0100 Subject: [PATCH 004/120] Make `System.monotonic_time` retun seconds represented by float with microsecond precision --- lib/gitlab/gitaly_client.rb | 2 +- lib/gitlab/metrics/method_call.rb | 18 +++++++++++------- lib/gitlab/metrics/samplers/ruby_sampler.rb | 2 +- lib/gitlab/metrics/system.rb | 9 +++++---- lib/gitlab/metrics/transaction.rb | 8 ++++++-- spec/lib/gitlab/metrics/system_spec.rb | 4 ++-- 6 files changed, 26 insertions(+), 17 deletions(-) diff --git a/lib/gitlab/gitaly_client.rb b/lib/gitlab/gitaly_client.rb index 7aa2eafbb73..b753ac46291 100644 --- a/lib/gitlab/gitaly_client.rb +++ b/lib/gitlab/gitaly_client.rb @@ -132,7 +132,7 @@ module Gitlab self.query_time += duration gitaly_call_histogram.observe( current_transaction_labels.merge(gitaly_service: service.to_s, rpc: rpc.to_s), - duration / 1000.0) + duration) end def self.current_transaction_labels diff --git a/lib/gitlab/metrics/method_call.rb b/lib/gitlab/metrics/method_call.rb index 65d55576ac2..6fb8f564237 100644 --- a/lib/gitlab/metrics/method_call.rb +++ b/lib/gitlab/metrics/method_call.rb @@ -4,7 +4,7 @@ module Gitlab class MethodCall MUTEX = Mutex.new BASE_LABELS = { module: nil, method: nil }.freeze - attr_reader :real_time, :cpu_time, :call_count, :labels + attr_reader :real_time_seconds, :cpu_time, :call_count, :labels def self.call_duration_histogram return @call_duration_histogram if @call_duration_histogram @@ -27,37 +27,41 @@ module Gitlab @transaction = transaction @name = name @labels = { module: @module_name, method: @method_name } - @real_time = 0 + @real_time_seconds = 0 @cpu_time = 0 @call_count = 0 end # Measures the real and CPU execution time of the supplied block. def measure - start_real = System.monotonic_time + start_real_seconds = System.monotonic_time start_cpu = System.cpu_time retval = yield - real_time = System.monotonic_time - start_real + real_time_seconds = System.monotonic_time - start_real_seconds cpu_time = System.cpu_time - start_cpu - @real_time += real_time + @real_time_seconds += real_time_seconds @cpu_time += cpu_time @call_count += 1 if call_measurement_enabled? && above_threshold? - self.class.call_duration_histogram.observe(@transaction.labels.merge(labels), real_time / 1000.0) + self.class.call_duration_histogram.observe(@transaction.labels.merge(labels), real_time_seconds) end retval end + def real_time_milliseconds + (real_time_seconds * 1000.0).to_i + end + # Returns a Metric instance of the current method call. def to_metric Metric.new( Instrumentation.series, { - duration: real_time, + duration: real_time_milliseconds, cpu_duration: cpu_time, call_count: call_count }, diff --git a/lib/gitlab/metrics/samplers/ruby_sampler.rb b/lib/gitlab/metrics/samplers/ruby_sampler.rb index b68800417a2..4e1ea62351f 100644 --- a/lib/gitlab/metrics/samplers/ruby_sampler.rb +++ b/lib/gitlab/metrics/samplers/ruby_sampler.rb @@ -52,7 +52,7 @@ module Gitlab metrics[:memory_usage].set(labels, System.memory_usage) metrics[:file_descriptors].set(labels, System.file_descriptor_count) - metrics[:sampler_duration].observe(labels.merge(worker_label), (System.monotonic_time - start_time) / 1000.0) + metrics[:sampler_duration].observe(labels.merge(worker_label), System.monotonic_time - start_time) ensure GC::Profiler.clear end diff --git a/lib/gitlab/metrics/system.rb b/lib/gitlab/metrics/system.rb index c2cbd3c16a1..b31cc6236d1 100644 --- a/lib/gitlab/metrics/system.rb +++ b/lib/gitlab/metrics/system.rb @@ -51,11 +51,12 @@ module Gitlab Process.clock_gettime(Process::CLOCK_REALTIME, precision) end - # Returns the current monotonic clock time in a given precision. + # Returns the current monotonic clock time as seconds with microseconds precision. # - # Returns the time as a Fixnum. - def self.monotonic_time(precision = :millisecond) - Process.clock_gettime(Process::CLOCK_MONOTONIC, precision) + # Returns the time as a Float. + def self.monotonic_time + + Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_second) end end end diff --git a/lib/gitlab/metrics/transaction.rb b/lib/gitlab/metrics/transaction.rb index ee3afc5ffdb..16f0969ab74 100644 --- a/lib/gitlab/metrics/transaction.rb +++ b/lib/gitlab/metrics/transaction.rb @@ -35,6 +35,10 @@ module Gitlab @finished_at ? (@finished_at - @started_at) : 0.0 end + def duration_milliseconds + (duration * 1000).to_i + end + def allocated_memory @memory_after - @memory_before end @@ -50,7 +54,7 @@ module Gitlab @memory_after = System.memory_usage @finished_at = System.monotonic_time - self.class.metric_transaction_duration_seconds.observe(labels, duration * 1000) + self.class.metric_transaction_duration_seconds.observe(labels, duration) self.class.metric_transaction_allocated_memory_bytes.observe(labels, allocated_memory * 1024.0) Thread.current[THREAD_KEY] = nil @@ -97,7 +101,7 @@ module Gitlab end def track_self - values = { duration: duration, allocated_memory: allocated_memory } + values = { duration: duration_milliseconds, allocated_memory: allocated_memory } @values.each do |name, value| values[name] = value diff --git a/spec/lib/gitlab/metrics/system_spec.rb b/spec/lib/gitlab/metrics/system_spec.rb index 4d94d8705fb..ea3bd00970e 100644 --- a/spec/lib/gitlab/metrics/system_spec.rb +++ b/spec/lib/gitlab/metrics/system_spec.rb @@ -40,8 +40,8 @@ describe Gitlab::Metrics::System do end describe '.monotonic_time' do - it 'returns a Fixnum' do - expect(described_class.monotonic_time).to be_an(Integer) + it 'returns a Float' do + expect(described_class.monotonic_time).to be_an(Float) end end end From df4fe43d73c10db447fb08317bf4bf20878a2bfc Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 15 Dec 2017 20:08:21 +0000 Subject: [PATCH 005/120] Fixed diff_worker not compiling correctly Closes #41182 --- app/assets/javascripts/repo/lib/diff/diff_worker.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/repo/lib/diff/diff_worker.js b/app/assets/javascripts/repo/lib/diff/diff_worker.js index e74c4046330..105431442af 100644 --- a/app/assets/javascripts/repo/lib/diff/diff_worker.js +++ b/app/assets/javascripts/repo/lib/diff/diff_worker.js @@ -1,6 +1,7 @@ import { computeDiff } from './diff'; -self.addEventListener('message', (e) => { +// eslint-disable-next-line prefer-arrow-callback +self.addEventListener('message', function diffWorker(e) { const data = e.data; self.postMessage({ From a69e7affbca9bbfe8fb9a51ab1646f81d8ade339 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Sat, 16 Dec 2017 00:24:18 +0000 Subject: [PATCH 006/120] changed webpack config --- app/assets/javascripts/repo/lib/diff/diff_worker.js | 3 +-- config/webpack.config.js | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/repo/lib/diff/diff_worker.js b/app/assets/javascripts/repo/lib/diff/diff_worker.js index 105431442af..e74c4046330 100644 --- a/app/assets/javascripts/repo/lib/diff/diff_worker.js +++ b/app/assets/javascripts/repo/lib/diff/diff_worker.js @@ -1,7 +1,6 @@ import { computeDiff } from './diff'; -// eslint-disable-next-line prefer-arrow-callback -self.addEventListener('message', function diffWorker(e) { +self.addEventListener('message', (e) => { const data = e.data; self.postMessage({ diff --git a/config/webpack.config.js b/config/webpack.config.js index 78ced4c3e8c..e850f6174b1 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -118,7 +118,10 @@ var config = { }, { test: /\_worker\.js$/, - loader: 'worker-loader', + use: [ + { loader: 'worker-loader' }, + { loader: 'babel-loader' }, + ], }, { test: /\.(worker(\.min)?\.js|pdf|bmpr)$/, From b7f59772b16b39baca7dbe2cb5dd830b7382c038 Mon Sep 17 00:00:00 2001 From: Christiaan Van den Poel Date: Sun, 17 Dec 2017 21:07:29 +0100 Subject: [PATCH 007/120] remove the label --- app/assets/javascripts/boards/boards_bundle.js | 1 - 1 file changed, 1 deletion(-) diff --git a/app/assets/javascripts/boards/boards_bundle.js b/app/assets/javascripts/boards/boards_bundle.js index 20d23162940..0c1cff1da7a 100644 --- a/app/assets/javascripts/boards/boards_bundle.js +++ b/app/assets/javascripts/boards/boards_bundle.js @@ -102,7 +102,6 @@ $(() => { if (list.type === 'closed') { list.position = Infinity; - list.label = { description: 'Shows all closed issues. Moving an issue to this list closes it' }; } else if (list.type === 'backlog') { list.position = -1; } From 148c7533d701490eb5cd8aebc4fa033e0f0f6ec4 Mon Sep 17 00:00:00 2001 From: Christiaan Van den Poel Date: Sun, 17 Dec 2017 21:09:57 +0100 Subject: [PATCH 008/120] added changelog --- ...er_labels_in_board_issue_sidebar_when_issue_is_closed.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelogs/unreleased/show_proper_labels_in_board_issue_sidebar_when_issue_is_closed.yml diff --git a/changelogs/unreleased/show_proper_labels_in_board_issue_sidebar_when_issue_is_closed.yml b/changelogs/unreleased/show_proper_labels_in_board_issue_sidebar_when_issue_is_closed.yml new file mode 100644 index 00000000000..c2ab34b20a5 --- /dev/null +++ b/changelogs/unreleased/show_proper_labels_in_board_issue_sidebar_when_issue_is_closed.yml @@ -0,0 +1,5 @@ +--- +title: show None when issue is in closed list and no labels assigned +merge_request: 15976 +author: Christiaan Van den Poel +type: fixed From 3c545133e8f23b57698046bae8be23e2bc457aca Mon Sep 17 00:00:00 2001 From: Pawel Chojnacki Date: Tue, 19 Dec 2017 17:45:25 +0100 Subject: [PATCH 009/120] Fix tests and formatting --- lib/gitlab/metrics/influx_db.rb | 1 + lib/gitlab/metrics/method_call.rb | 2 +- lib/gitlab/metrics/system.rb | 1 - spec/lib/gitlab/metrics/method_call_spec.rb | 11 ++++++----- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/gitlab/metrics/influx_db.rb b/lib/gitlab/metrics/influx_db.rb index bdf7910b7c7..153e236d018 100644 --- a/lib/gitlab/metrics/influx_db.rb +++ b/lib/gitlab/metrics/influx_db.rb @@ -38,6 +38,7 @@ module Gitlab # This is memoized since this method is called for every instrumented # method. Loading data from an external cache on every method call slows # things down too much. + # in milliseconds @method_call_threshold ||= settings[:method_call_threshold] end diff --git a/lib/gitlab/metrics/method_call.rb b/lib/gitlab/metrics/method_call.rb index 6fb8f564237..a030092df37 100644 --- a/lib/gitlab/metrics/method_call.rb +++ b/lib/gitlab/metrics/method_call.rb @@ -72,7 +72,7 @@ module Gitlab # Returns true if the total runtime of this method exceeds the method call # threshold. def above_threshold? - real_time >= Metrics.method_call_threshold + real_time_milliseconds >= Metrics.method_call_threshold end def call_measurement_enabled? diff --git a/lib/gitlab/metrics/system.rb b/lib/gitlab/metrics/system.rb index b31cc6236d1..4852017bf38 100644 --- a/lib/gitlab/metrics/system.rb +++ b/lib/gitlab/metrics/system.rb @@ -55,7 +55,6 @@ module Gitlab # # Returns the time as a Float. def self.monotonic_time - Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_second) end end diff --git a/spec/lib/gitlab/metrics/method_call_spec.rb b/spec/lib/gitlab/metrics/method_call_spec.rb index 5341addf911..91a70ba01a0 100644 --- a/spec/lib/gitlab/metrics/method_call_spec.rb +++ b/spec/lib/gitlab/metrics/method_call_spec.rb @@ -8,7 +8,8 @@ describe Gitlab::Metrics::MethodCall do it 'measures the performance of the supplied block' do method_call.measure { 'foo' } - expect(method_call.real_time).to be_a_kind_of(Numeric) + expect(method_call.real_time_seconds).to be_a_kind_of(Numeric) + expect(method_call.real_time_milliseconds).to be_a_kind_of(Numeric) expect(method_call.cpu_time).to be_a_kind_of(Numeric) expect(method_call.call_count).to eq(1) end @@ -84,13 +85,13 @@ describe Gitlab::Metrics::MethodCall do end it 'returns false when the total call time is not above the threshold' do - expect(method_call).to receive(:real_time).and_return(9) + expect(method_call).to receive(:real_time_seconds).and_return(0.009) expect(method_call.above_threshold?).to eq(false) end it 'returns true when the total call time is above the threshold' do - expect(method_call).to receive(:real_time).and_return(9000) + expect(method_call).to receive(:real_time_seconds).and_return(9) expect(method_call.above_threshold?).to eq(true) end @@ -131,7 +132,7 @@ describe Gitlab::Metrics::MethodCall do describe '#real_time' do context 'without timings' do it 'returns 0.0' do - expect(method_call.real_time).to eq(0.0) + expect(method_call.real_time_seconds).to eq(0.0) end end @@ -139,7 +140,7 @@ describe Gitlab::Metrics::MethodCall do it 'returns the total real time' do method_call.measure { 'foo' } - expect(method_call.real_time >= 0.0).to be(true) + expect(method_call.real_time_seconds >= 0.0).to be(true) end end end From a623ddb0dcdc42b0bd4f9d20c79e82387d9b5547 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Thu, 16 Nov 2017 13:34:15 -0600 Subject: [PATCH 010/120] replaced download icon for the sprite based one --- .../pipelines/components/pipelines_artifacts.vue | 11 +++++++---- .../components/mr_widget_header.js | 7 +++++-- app/helpers/blob_helper.rb | 2 +- app/views/projects/artifacts/browse.html.haml | 2 +- app/views/projects/blob/viewers/_download.html.haml | 2 +- app/views/projects/buttons/_download.html.haml | 2 +- app/views/projects/ci/builds/_build.html.haml | 2 +- 7 files changed, 17 insertions(+), 11 deletions(-) diff --git a/app/assets/javascripts/pipelines/components/pipelines_artifacts.vue b/app/assets/javascripts/pipelines/components/pipelines_artifacts.vue index 751a20991af..fada8fd90df 100644 --- a/app/assets/javascripts/pipelines/components/pipelines_artifacts.vue +++ b/app/assets/javascripts/pipelines/components/pipelines_artifacts.vue @@ -1,5 +1,6 @@ diff --git a/app/assets/javascripts/cycle_analytics/components/stage_staging_component.vue b/app/assets/javascripts/cycle_analytics/components/stage_staging_component.vue index 5d95ddcd90e..508a411e599 100644 --- a/app/assets/javascripts/cycle_analytics/components/stage_staging_component.vue +++ b/app/assets/javascripts/cycle_analytics/components/stage_staging_component.vue @@ -3,6 +3,7 @@ import iconBranch from '../svg/icon_branch.svg'; import limitWarning from './limit_warning_component.vue'; import totalTime from './total_time_component.vue'; + import icon from '../../vue_shared/components/icon.vue'; export default { props: { @@ -13,6 +14,7 @@ userAvatarImage, totalTime, limitWarning, + icon, }, computed: { iconBranch() { @@ -37,7 +39,10 @@
#{{ build.id }} - + + {{ build.branch.name }} {{ build.shortSha }} diff --git a/app/assets/javascripts/cycle_analytics/components/stage_test_component.vue b/app/assets/javascripts/cycle_analytics/components/stage_test_component.vue index 04d5440b77b..88fa6b073ca 100644 --- a/app/assets/javascripts/cycle_analytics/components/stage_test_component.vue +++ b/app/assets/javascripts/cycle_analytics/components/stage_test_component.vue @@ -3,6 +3,7 @@ import iconBranch from '../svg/icon_branch.svg'; import limitWarning from './limit_warning_component.vue'; import totalTime from './total_time_component.vue'; + import icon from '../../vue_shared/components/icon.vue'; export default { props: { @@ -12,6 +13,7 @@ components: { totalTime, limitWarning, + icon, }, computed: { iconBuildStatus() { @@ -40,7 +42,10 @@ {{ build.name }} · #{{ build.id }} - + + {{ build.branch.name }} {{ build.shortSha }} diff --git a/app/assets/javascripts/pipelines/components/pipelines_artifacts.vue b/app/assets/javascripts/pipelines/components/pipelines_artifacts.vue index fada8fd90df..831aa92ac4f 100644 --- a/app/assets/javascripts/pipelines/components/pipelines_artifacts.vue +++ b/app/assets/javascripts/pipelines/components/pipelines_artifacts.vue @@ -1,6 +1,6 @@ diff --git a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.js b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.js index 38c3ec874c6..85bfd03a3cf 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.js +++ b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.js @@ -1,6 +1,6 @@ import tooltip from '../../vue_shared/directives/tooltip'; import { pluralize } from '../../lib/utils/text_utility'; -import Icon from '../../vue_shared/components/icon.vue'; +import icon from '../../vue_shared/components/icon.vue'; export default { name: 'MRWidgetHeader', @@ -11,7 +11,7 @@ export default { tooltip, }, components: { - Icon, + icon, }, computed: { shouldShowCommitsBehindText() { diff --git a/app/assets/stylesheets/framework/wells.scss b/app/assets/stylesheets/framework/wells.scss index 735fc4babd7..2f3a80daa90 100644 --- a/app/assets/stylesheets/framework/wells.scss +++ b/app/assets/stylesheets/framework/wells.scss @@ -16,6 +16,10 @@ .commit-sha, .commit-info { margin-left: 4px; + + .fork-svg { + margin-right: 4px; + } } .ref-name { @@ -79,7 +83,7 @@ } .limit-icon { - margin: 0 8px; + margin: 0 4px; } .limit-message { diff --git a/app/assets/stylesheets/pages/merge_requests.scss b/app/assets/stylesheets/pages/merge_requests.scss index 373e01931ad..f887a11004f 100644 --- a/app/assets/stylesheets/pages/merge_requests.scss +++ b/app/assets/stylesheets/pages/merge_requests.scss @@ -725,7 +725,5 @@ } .fork-sprite { - width: 12px; - height: 12px; margin-right: -5px; } diff --git a/app/assets/stylesheets/pages/pipeline_schedules.scss b/app/assets/stylesheets/pages/pipeline_schedules.scss index 7e2297c283f..b698a4f9afa 100644 --- a/app/assets/stylesheets/pages/pipeline_schedules.scss +++ b/app/assets/stylesheets/pages/pipeline_schedules.scss @@ -39,6 +39,10 @@ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; + + svg { + vertical-align: middle; + } } .next-run-cell { diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index 2d304f7eb91..0333c29e2fd 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -63,7 +63,7 @@ module CommitsHelper # Returns a link formatted as a commit branch link def commit_branch_link(url, text) link_to(url, class: 'label label-gray ref-name branch-link') do - icon('code-fork', class: 'append-right-5') + "#{text}" + sprite_icon('fork', size: 16, css_class: 'fork-svg') + "#{text}" end end diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml index 8a8011c27b4..acf67b83890 100644 --- a/app/views/projects/branches/_branch.html.haml +++ b/app/views/projects/branches/_branch.html.haml @@ -8,7 +8,7 @@ %li{ class: "js-branch-#{branch.name}" } %div = link_to project_tree_path(@project, branch.name), class: 'item-title str-truncated ref-name' do - = sprite_icon('fork', size: 8) + = sprite_icon('fork', size: 12) = branch.name   - if branch.name == @repository.root_ref diff --git a/app/views/projects/commit/_limit_exceeded_message.html.haml b/app/views/projects/commit/_limit_exceeded_message.html.haml index 84a52d49487..a264f3517c4 100644 --- a/app/views/projects/commit/_limit_exceeded_message.html.haml +++ b/app/views/projects/commit/_limit_exceeded_message.html.haml @@ -1,7 +1,7 @@ .has-tooltip{ class: "limit-box limit-box-#{objects} prepend-left-5", data: { title: "Project has too many #{label_for_message} to search"} } .limit-icon - if objects == :branch - = icon('code-fork') + = sprite_icon('fork', size: 12) - else = icon('tag') .limit-message diff --git a/app/views/projects/deployments/_commit.html.haml b/app/views/projects/deployments/_commit.html.haml index 014486be868..c7ac687e4a6 100644 --- a/app/views/projects/deployments/_commit.html.haml +++ b/app/views/projects/deployments/_commit.html.haml @@ -2,7 +2,7 @@ .branch-commit - if deployment.ref %span.icon-container - = deployment.tag? ? icon('tag') : icon('code-fork') + = deployment.tag? ? icon('tag') : sprite_icon('fork', css_class: 'sprite') = link_to deployment.ref, project_ref_path(@project, deployment.ref), class: "ref-name" .icon-container.commit-icon = custom_icon("icon_commit") diff --git a/app/views/projects/forks/error.html.haml b/app/views/projects/forks/error.html.haml index d365bcd4ecc..e8a89b8c6fc 100644 --- a/app/views/projects/forks/error.html.haml +++ b/app/views/projects/forks/error.html.haml @@ -2,7 +2,7 @@ - if @forked_project && !@forked_project.saved? .alert.alert-danger.alert-block %h4 - %i.fa.fa-code-fork + = sprite_icon('fork', size: 16) Fork Error! %p You tried to fork @@ -21,5 +21,4 @@ %p = link_to new_project_fork_path(@project), title: "Fork", class: "btn" do - %i.fa.fa-code-fork Try to fork again diff --git a/app/views/projects/generic_commit_statuses/_generic_commit_status.html.haml b/app/views/projects/generic_commit_statuses/_generic_commit_status.html.haml index b98dc09534f..2599ce5c4b8 100644 --- a/app/views/projects/generic_commit_statuses/_generic_commit_status.html.haml +++ b/app/views/projects/generic_commit_statuses/_generic_commit_status.html.haml @@ -19,7 +19,7 @@ - if ref - if generic_commit_status.ref .icon-container - = generic_commit_status.tags.any? ? icon('tag') : icon('code-fork') + = generic_commit_status.tags.any? ? icon('tag') : sprite_icon('fork', size: 10) = link_to generic_commit_status.ref, project_commits_path(generic_commit_status.project, generic_commit_status.ref) - else .light none diff --git a/app/views/projects/merge_requests/_merge_request.html.haml b/app/views/projects/merge_requests/_merge_request.html.haml index 591da3b6638..f45a000833b 100644 --- a/app/views/projects/merge_requests/_merge_request.html.haml +++ b/app/views/projects/merge_requests/_merge_request.html.haml @@ -30,7 +30,7 @@ %span.project-ref-path   = link_to project_ref_path(merge_request.project, merge_request.target_branch), class: 'ref-name' do - = sprite_icon('fork', css_class: 'fork-sprite') + = sprite_icon('fork', size: 12, css_class: 'fork-sprite') = merge_request.target_branch - if merge_request.labels.any?   diff --git a/app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml b/app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml index f8c4005a9e0..800e234275c 100644 --- a/app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml +++ b/app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml @@ -3,7 +3,7 @@ %td = pipeline_schedule.description %td.branch-name-cell - = icon('code-fork') + = sprite_icon('fork', size: 12) - if pipeline_schedule.ref.present? = link_to pipeline_schedule.ref, project_ref_path(@project, pipeline_schedule.ref), class: "ref-name" %td diff --git a/spec/javascripts/vue_shared/components/commit_spec.js b/spec/javascripts/vue_shared/components/commit_spec.js index d5754aaa9e7..fdead874209 100644 --- a/spec/javascripts/vue_shared/components/commit_spec.js +++ b/spec/javascripts/vue_shared/components/commit_spec.js @@ -10,7 +10,7 @@ describe('Commit component', () => { CommitComponent = Vue.extend(commitComp); }); - it('should render a code-fork icon if it does not represent a tag', () => { + it('should render a fork icon if it does not represent a tag', () => { component = new CommitComponent({ propsData: { tag: false, @@ -30,7 +30,7 @@ describe('Commit component', () => { }, }).$mount(); - expect(component.$el.querySelector('.icon-container i').classList).toContain('fa-code-fork'); + expect(component.$el.querySelector('.icon-container').children).toContain('svg'); }); describe('Given all the props', () => { From ce8b53ea89b40e16c8da2e3b90c7ef3f1b148920 Mon Sep 17 00:00:00 2001 From: asaparov Date: Tue, 19 Dec 2017 19:10:14 -0500 Subject: [PATCH 014/120] Bumped mysql2 gem version from 0.4.5 to 0.4.10. --- Gemfile | 2 +- Gemfile.lock | 4 ++-- changelogs/unreleased/bump_mysql_gem.yml | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 changelogs/unreleased/bump_mysql_gem.yml diff --git a/Gemfile b/Gemfile index b6ffaf80f24..cc39714295e 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,7 @@ gem 'sprockets', '~> 3.7.0' gem 'default_value_for', '~> 3.0.0' # Supported DBs -gem 'mysql2', '~> 0.4.5', group: :mysql +gem 'mysql2', '~> 0.4.10', group: :mysql gem 'pg', '~> 0.18.2', group: :postgres gem 'rugged', '~> 0.26.0' diff --git a/Gemfile.lock b/Gemfile.lock index a6e3c9e27cc..d11cadeec30 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -501,7 +501,7 @@ GEM mustermann (1.0.0) mustermann-grape (1.0.0) mustermann (~> 1.0.0) - mysql2 (0.4.5) + mysql2 (0.4.10) net-ldap (0.16.0) net-ssh (4.1.0) netrc (0.11.0) @@ -1082,7 +1082,7 @@ DEPENDENCIES method_source (~> 0.8) minitest (~> 5.7.0) mousetrap-rails (~> 1.4.6) - mysql2 (~> 0.4.5) + mysql2 (~> 0.4.10) net-ldap net-ssh (~> 4.1.0) nokogiri (~> 1.8.1) diff --git a/changelogs/unreleased/bump_mysql_gem.yml b/changelogs/unreleased/bump_mysql_gem.yml new file mode 100644 index 00000000000..58166949d72 --- /dev/null +++ b/changelogs/unreleased/bump_mysql_gem.yml @@ -0,0 +1,5 @@ +--- +title: Bump mysql2 gem version from 0.4.5 to 0.4.10 +merge_request: +author: asaparov +type: other From a331a06aa8da542afa985d61370b9518cc44b1e9 Mon Sep 17 00:00:00 2001 From: julien MILLAU Date: Wed, 20 Dec 2017 08:11:13 +0000 Subject: [PATCH 015/120] Ignore "lost+found" folder during backup on a volume --- lib/backup/files.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/backup/files.rb b/lib/backup/files.rb index 30a91647b77..287d591e88d 100644 --- a/lib/backup/files.rb +++ b/lib/backup/files.rb @@ -18,7 +18,7 @@ module Backup FileUtils.rm_f(backup_tarball) if ENV['STRATEGY'] == 'copy' - cmd = %W(cp -a #{app_files_dir} #{Gitlab.config.backup.path}) + cmd = %W(rsync -a --exclude=lost+found #{app_files_dir} #{Gitlab.config.backup.path}) output, status = Gitlab::Popen.popen(cmd) unless status.zero? @@ -26,10 +26,10 @@ module Backup abort 'Backup failed' end - run_pipeline!([%W(tar -C #{@backup_files_dir} -cf - .), %w(gzip -c -1)], out: [backup_tarball, 'w', 0600]) + run_pipeline!([%W(tar --exclude=lost+found -C #{@backup_files_dir} -cf - .), %w(gzip -c -1)], out: [backup_tarball, 'w', 0600]) FileUtils.rm_rf(@backup_files_dir) else - run_pipeline!([%W(tar -C #{app_files_dir} -cf - .), %w(gzip -c -1)], out: [backup_tarball, 'w', 0600]) + run_pipeline!([%W(tar --exclude=lost+found -C #{app_files_dir} -cf - .), %w(gzip -c -1)], out: [backup_tarball, 'w', 0600]) end end From 091c4989b3c1e18723aef2b28475866b1a89e282 Mon Sep 17 00:00:00 2001 From: julien MILLAU Date: Wed, 20 Dec 2017 08:55:15 +0000 Subject: [PATCH 016/120] Add changelog --- ...36-ignore-lost-found-folder-during-backup-on-a-volume.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelogs/unreleased/16036-ignore-lost-found-folder-during-backup-on-a-volume.yml diff --git a/changelogs/unreleased/16036-ignore-lost-found-folder-during-backup-on-a-volume.yml b/changelogs/unreleased/16036-ignore-lost-found-folder-during-backup-on-a-volume.yml new file mode 100644 index 00000000000..833650559a3 --- /dev/null +++ b/changelogs/unreleased/16036-ignore-lost-found-folder-during-backup-on-a-volume.yml @@ -0,0 +1,5 @@ +--- +title: "Ignore lost+found folder during backup on a volume" +merge_request: 16036 +author: Julien Millau +type: fixed \ No newline at end of file From e7b0fe36d78a4462baf623bda5d34089a19e6c23 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Wed, 20 Dec 2017 17:26:21 +0800 Subject: [PATCH 017/120] It should escape spaces to %20 rather than + `CGI.escape` would escape spaces to +, which is fine in some cases, but doesn't work for git clone. --- qa/qa/git/repository.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qa/qa/git/repository.rb b/qa/qa/git/repository.rb index 59cd147e055..8f999511d58 100644 --- a/qa/qa/git/repository.rb +++ b/qa/qa/git/repository.rb @@ -23,7 +23,7 @@ module QA def password=(pass) @password = pass - @uri.password = CGI.escape(pass) + @uri.password = CGI.escape(pass).gsub('+', '%20') end def use_default_credentials From cfe3c238f5d9b7f91e01a549ee365a04158541a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Wed, 20 Dec 2017 10:58:34 +0100 Subject: [PATCH 018/120] Update installation and upgrade guides to use Ruby 2.3.6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- doc/install/installation.md | 8 +- doc/update/10.1-to-10.2.md | 4 +- doc/update/10.2-to-10.3.md | 4 +- doc/update/10.3-to-10.4.md | 360 ++++++++++++++++++++++++++++++++++++ 4 files changed, 368 insertions(+), 8 deletions(-) create mode 100644 doc/update/10.3-to-10.4.md diff --git a/doc/install/installation.md b/doc/install/installation.md index 56888b05609..67b89d608cc 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -133,9 +133,9 @@ Remove the old Ruby 1.8 if present: Download Ruby and compile it: mkdir /tmp/ruby && cd /tmp/ruby - curl --remote-name --progress https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.5.tar.gz - echo '3247e217d6745c27ef23bdc77b6abdb4b57a118f ruby-2.3.5.tar.gz' | shasum -c - && tar xzf ruby-2.3.5.tar.gz - cd ruby-2.3.5 + curl --remote-name --progress https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.6.tar.gz + echo '4e6a0f828819e15d274ae58485585fc8b7caace0 ruby-2.3.6.tar.gz' | shasum -c - && tar xzf ruby-2.3.6.tar.gz + cd ruby-2.3.6 ./configure --disable-install-rdoc make sudo make install @@ -367,7 +367,7 @@ sudo usermod -aG redis git # Enable packfile bitmaps sudo -u git -H git config --global repack.writeBitmaps true - + # Enable push options sudo -u git -H git config --global receive.advertisePushOptions true diff --git a/doc/update/10.1-to-10.2.md b/doc/update/10.1-to-10.2.md index 9e0d8f79522..632e8befa74 100644 --- a/doc/update/10.1-to-10.2.md +++ b/doc/update/10.1-to-10.2.md @@ -339,11 +339,11 @@ sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production If all items are green, then congratulations, the upgrade is complete! -## Things went south? Revert to previous version (10.0) +## Things went south? Revert to previous version (10.1) ### 1. Revert the code to the previous version -Follow the [upgrade guide from 9.5 to 10.0](9.5-to-10.0.md), except for the +Follow the [upgrade guide from 10.0 to 10.1](10.0-to-10.1.md), except for the database migration (the backup is already migrated to the previous version). ### 2. Restore from the backup diff --git a/doc/update/10.2-to-10.3.md b/doc/update/10.2-to-10.3.md index 07f9ee965f0..d6e2db8a353 100644 --- a/doc/update/10.2-to-10.3.md +++ b/doc/update/10.2-to-10.3.md @@ -339,11 +339,11 @@ sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production If all items are green, then congratulations, the upgrade is complete! -## Things went south? Revert to previous version (10.0) +## Things went south? Revert to previous version (10.2) ### 1. Revert the code to the previous version -Follow the [upgrade guide from 9.5 to 10.0](9.5-to-10.0.md), except for the +Follow the [upgrade guide from 10.1 to 10.2](10.1-to-10.2.md), except for the database migration (the backup is already migrated to the previous version). ### 2. Restore from the backup diff --git a/doc/update/10.3-to-10.4.md b/doc/update/10.3-to-10.4.md new file mode 100644 index 00000000000..850cb3103f4 --- /dev/null +++ b/doc/update/10.3-to-10.4.md @@ -0,0 +1,360 @@ +--- +comments: false +--- + +# From 10.3 to 10.4 + +Make sure you view this update guide from the tag (version) of GitLab you would +like to install. In most cases this should be the highest numbered production +tag (without rc in it). You can select the tag in the version dropdown at the +top left corner of GitLab (below the menu bar). + +If the highest number stable branch is unclear please check the +[GitLab Blog](https://about.gitlab.com/blog/archives.html) for installation +guide links by version. + +### 1. Stop server + +```bash +sudo service gitlab stop +``` + +### 2. Backup + +```bash +cd /home/git/gitlab + +sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production +``` + +### 3. Update Ruby + +NOTE: GitLab 9.0 and higher only support Ruby 2.3.x and dropped support for Ruby 2.1.x. Be +sure to upgrade your interpreter if necessary. + +You can check which version you are running with `ruby -v`. + +Download and compile Ruby: + +```bash +mkdir /tmp/ruby && cd /tmp/ruby +curl --remote-name --progress https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.6.tar.gz +echo '4e6a0f828819e15d274ae58485585fc8b7caace0 ruby-2.3.6.tar.gz' | shasum -c - && tar xzf ruby-2.3.6.tar.gz +cd ruby-2.3.6 +./configure --disable-install-rdoc +make +sudo make install +``` + +Install Bundler: + +```bash +sudo gem install bundler --no-ri --no-rdoc +``` + +### 4. Update Node + +GitLab now runs [webpack](http://webpack.js.org) to compile frontend assets and +it has a minimum requirement of node v4.3.0. + +You can check which version you are running with `node -v`. If you are running +a version older than `v4.3.0` you will need to update to a newer version. You +can find instructions to install from community maintained packages or compile +from source at the nodejs.org website. + + + + +Since 8.17, GitLab requires the use of yarn `>= v0.17.0` to manage +JavaScript dependencies. + +```bash +curl --silent --show-error https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - +echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list +sudo apt-get update +sudo apt-get install yarn +``` + +More information can be found on the [yarn website](https://yarnpkg.com/en/docs/install). + +### 5. Update Go + +NOTE: GitLab 9.2 and higher only supports Go 1.8.3 and dropped support for Go +1.5.x through 1.7.x. Be sure to upgrade your installation if necessary. + +You can check which version you are running with `go version`. + +Download and install Go: + +```bash +# Remove former Go installation folder +sudo rm -rf /usr/local/go + +curl --remote-name --progress https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz +echo '1862f4c3d3907e59b04a757cfda0ea7aa9ef39274af99a784f5be843c80c6772 go1.8.3.linux-amd64.tar.gz' | shasum -a256 -c - && \ + sudo tar -C /usr/local -xzf go1.8.3.linux-amd64.tar.gz +sudo ln -sf /usr/local/go/bin/{go,godoc,gofmt} /usr/local/bin/ +rm go1.8.3.linux-amd64.tar.gz +``` + +### 6. Get latest code + +```bash +cd /home/git/gitlab + +sudo -u git -H git fetch --all +sudo -u git -H git checkout -- db/schema.rb # local changes will be restored automatically +sudo -u git -H git checkout -- locale +``` + +For GitLab Community Edition: + +```bash +cd /home/git/gitlab + +sudo -u git -H git checkout 10-4-stable +``` + +OR + +For GitLab Enterprise Edition: + +```bash +cd /home/git/gitlab + +sudo -u git -H git checkout 10-4-stable-ee +``` + +### 7. Update gitlab-shell + +```bash +cd /home/git/gitlab-shell + +sudo -u git -H git fetch --all --tags +sudo -u git -H git checkout v$( Date: Tue, 19 Dec 2017 19:40:43 +0100 Subject: [PATCH 019/120] use in_milliseconds rails helper --- lib/gitlab/metrics/method_call.rb | 4 ++-- lib/gitlab/metrics/transaction.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/gitlab/metrics/method_call.rb b/lib/gitlab/metrics/method_call.rb index a030092df37..bb39b1d5462 100644 --- a/lib/gitlab/metrics/method_call.rb +++ b/lib/gitlab/metrics/method_call.rb @@ -27,7 +27,7 @@ module Gitlab @transaction = transaction @name = name @labels = { module: @module_name, method: @method_name } - @real_time_seconds = 0 + @real_time_seconds = 0.0 @cpu_time = 0 @call_count = 0 end @@ -53,7 +53,7 @@ module Gitlab end def real_time_milliseconds - (real_time_seconds * 1000.0).to_i + real_time_seconds.in_milliseconds.to_i end # Returns a Metric instance of the current method call. diff --git a/lib/gitlab/metrics/transaction.rb b/lib/gitlab/metrics/transaction.rb index 16f0969ab74..e7975c023a9 100644 --- a/lib/gitlab/metrics/transaction.rb +++ b/lib/gitlab/metrics/transaction.rb @@ -36,7 +36,7 @@ module Gitlab end def duration_milliseconds - (duration * 1000).to_i + duration.in_milliseconds.to_i end def allocated_memory From 58b8b80787c47185bbca59bbb2039c2ba9022d27 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Wed, 20 Dec 2017 17:16:37 -0600 Subject: [PATCH 020/120] properly handle naming for dispatcher route chunks --- config/webpack.config.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/config/webpack.config.js b/config/webpack.config.js index 78ced4c3e8c..0cb69141a73 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -176,8 +176,13 @@ var config = { return chunk.name; } return chunk.mapModules((m) => { - var chunkPath = m.request.split('!').pop(); - return path.relative(m.context, chunkPath); + const pagesBase = path.join(ROOT_PATH, 'app/assets/javascripts/pages'); + if (m.resource.indexOf(pagesBase) === 0) { + return path.relative(pagesBase, m.resource) + .replace(/\/index\.[a-z]+$/, '') + .replace(/\//g, '__'); + } + return path.relative(m.context, m.resource); }).join('_'); }), From 0e50e9d9d48752a58b640064075f7786f86e7433 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Wed, 20 Dec 2017 17:20:51 -0600 Subject: [PATCH 021/120] update dispatcher to allow for dynamic imports until webpack plugin is updated --- app/assets/javascripts/dispatcher.js | 4 +++- app/assets/javascripts/pages/users/show/index.js | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 app/assets/javascripts/pages/users/show/index.js diff --git a/app/assets/javascripts/dispatcher.js b/app/assets/javascripts/dispatcher.js index 62867c56214..13fa553047a 100644 --- a/app/assets/javascripts/dispatcher.js +++ b/app/assets/javascripts/dispatcher.js @@ -111,6 +111,8 @@ import Activities from './activities'; return false; } + const fail = () => Flash('Error loading dynamic module'); + path = page.split(':'); shortcut_handler = null; @@ -545,7 +547,7 @@ import Activities from './activities'; new CILintEditor(); break; case 'users:show': - new UserCallout(); + import('./pages/users/show').then(m => m.default()).catch(fail); break; case 'admin:conversational_development_index:show': new UserCallout(); diff --git a/app/assets/javascripts/pages/users/show/index.js b/app/assets/javascripts/pages/users/show/index.js new file mode 100644 index 00000000000..f18f98b4e9a --- /dev/null +++ b/app/assets/javascripts/pages/users/show/index.js @@ -0,0 +1,3 @@ +import UserCallout from '~/user_callout'; + +export default () => new UserCallout(); From 040167f0724027020f2d63b6e43481fb3e29dbfc Mon Sep 17 00:00:00 2001 From: Pawel Chojnacki Date: Wed, 20 Dec 2017 19:30:58 +0100 Subject: [PATCH 022/120] Use seconds where possible, and convert to milliseconds for Influxdb consumption --- ...duce_cardinality_of_prometheus_metrics.yml | 5 ++++ lib/gitlab/metrics/method_call.rb | 24 ++++++++----------- lib/gitlab/metrics/system.rb | 8 +++---- spec/lib/gitlab/metrics/method_call_spec.rb | 18 +++++++------- spec/lib/gitlab/metrics/system_spec.rb | 4 ++-- 5 files changed, 31 insertions(+), 28 deletions(-) create mode 100644 changelogs/unreleased/pawel-reduce_cardinality_of_prometheus_metrics.yml diff --git a/changelogs/unreleased/pawel-reduce_cardinality_of_prometheus_metrics.yml b/changelogs/unreleased/pawel-reduce_cardinality_of_prometheus_metrics.yml new file mode 100644 index 00000000000..8213b493903 --- /dev/null +++ b/changelogs/unreleased/pawel-reduce_cardinality_of_prometheus_metrics.yml @@ -0,0 +1,5 @@ +--- +title: Reduce the number of buckets in gitlab_cache_operation_duration_seconds +merge_request: 15881 +author: +type: changed diff --git a/lib/gitlab/metrics/method_call.rb b/lib/gitlab/metrics/method_call.rb index bb39b1d5462..f4a916f154d 100644 --- a/lib/gitlab/metrics/method_call.rb +++ b/lib/gitlab/metrics/method_call.rb @@ -4,7 +4,7 @@ module Gitlab class MethodCall MUTEX = Mutex.new BASE_LABELS = { module: nil, method: nil }.freeze - attr_reader :real_time_seconds, :cpu_time, :call_count, :labels + attr_reader :real_time, :cpu_time, :call_count, :labels def self.call_duration_histogram return @call_duration_histogram if @call_duration_histogram @@ -27,42 +27,38 @@ module Gitlab @transaction = transaction @name = name @labels = { module: @module_name, method: @method_name } - @real_time_seconds = 0.0 - @cpu_time = 0 + @real_time = 0.0 + @cpu_time = 0.0 @call_count = 0 end # Measures the real and CPU execution time of the supplied block. def measure - start_real_seconds = System.monotonic_time + start_real = System.monotonic_time start_cpu = System.cpu_time retval = yield - real_time_seconds = System.monotonic_time - start_real_seconds + real_time = System.monotonic_time - start_real cpu_time = System.cpu_time - start_cpu - @real_time_seconds += real_time_seconds + @real_time += real_time @cpu_time += cpu_time @call_count += 1 if call_measurement_enabled? && above_threshold? - self.class.call_duration_histogram.observe(@transaction.labels.merge(labels), real_time_seconds) + self.class.call_duration_histogram.observe(@transaction.labels.merge(labels), real_time) end retval end - def real_time_milliseconds - real_time_seconds.in_milliseconds.to_i - end - # Returns a Metric instance of the current method call. def to_metric Metric.new( Instrumentation.series, { - duration: real_time_milliseconds, - cpu_duration: cpu_time, + duration: real_time.in_milliseconds.to_i, + cpu_duration: cpu_time.in_milliseconds.to_i, call_count: call_count }, method: @name @@ -72,7 +68,7 @@ module Gitlab # Returns true if the total runtime of this method exceeds the method call # threshold. def above_threshold? - real_time_milliseconds >= Metrics.method_call_threshold + real_time.in_milliseconds >= Metrics.method_call_threshold end def call_measurement_enabled? diff --git a/lib/gitlab/metrics/system.rb b/lib/gitlab/metrics/system.rb index 4852017bf38..e60e245cf89 100644 --- a/lib/gitlab/metrics/system.rb +++ b/lib/gitlab/metrics/system.rb @@ -35,19 +35,19 @@ module Gitlab if Process.const_defined?(:CLOCK_THREAD_CPUTIME_ID) def self.cpu_time Process - .clock_gettime(Process::CLOCK_THREAD_CPUTIME_ID, :millisecond) + .clock_gettime(Process::CLOCK_THREAD_CPUTIME_ID, :float_second) end else def self.cpu_time Process - .clock_gettime(Process::CLOCK_PROCESS_CPUTIME_ID, :millisecond) + .clock_gettime(Process::CLOCK_PROCESS_CPUTIME_ID, :float_second) end end # Returns the current real time in a given precision. # - # Returns the time as a Fixnum. - def self.real_time(precision = :millisecond) + # Returns the time as a Float for precision = :float_second. + def self.real_time(precision = :float_second) Process.clock_gettime(Process::CLOCK_REALTIME, precision) end diff --git a/spec/lib/gitlab/metrics/method_call_spec.rb b/spec/lib/gitlab/metrics/method_call_spec.rb index 91a70ba01a0..448246ff513 100644 --- a/spec/lib/gitlab/metrics/method_call_spec.rb +++ b/spec/lib/gitlab/metrics/method_call_spec.rb @@ -8,8 +8,7 @@ describe Gitlab::Metrics::MethodCall do it 'measures the performance of the supplied block' do method_call.measure { 'foo' } - expect(method_call.real_time_seconds).to be_a_kind_of(Numeric) - expect(method_call.real_time_milliseconds).to be_a_kind_of(Numeric) + expect(method_call.real_time).to be_a_kind_of(Numeric) expect(method_call.cpu_time).to be_a_kind_of(Numeric) expect(method_call.call_count).to eq(1) end @@ -65,14 +64,17 @@ describe Gitlab::Metrics::MethodCall do describe '#to_metric' do it 'returns a Metric instance' do + expect(method_call).to receive(:real_time).and_return(4.0001) + expect(method_call).to receive(:cpu_time).and_return(3.0001) + method_call.measure { 'foo' } metric = method_call.to_metric expect(metric).to be_an_instance_of(Gitlab::Metrics::Metric) expect(metric.series).to eq('rails_method_calls') - expect(metric.values[:duration]).to be_a_kind_of(Numeric) - expect(metric.values[:cpu_duration]).to be_a_kind_of(Numeric) + expect(metric.values[:duration]).to eq(4000) + expect(metric.values[:cpu_duration]).to eq(3000) expect(metric.values[:call_count]).to be_an(Integer) expect(metric.tags).to eq({ method: 'Foo#bar' }) @@ -85,13 +87,13 @@ describe Gitlab::Metrics::MethodCall do end it 'returns false when the total call time is not above the threshold' do - expect(method_call).to receive(:real_time_seconds).and_return(0.009) + expect(method_call).to receive(:real_time).and_return(0.009) expect(method_call.above_threshold?).to eq(false) end it 'returns true when the total call time is above the threshold' do - expect(method_call).to receive(:real_time_seconds).and_return(9) + expect(method_call).to receive(:real_time).and_return(9) expect(method_call.above_threshold?).to eq(true) end @@ -132,7 +134,7 @@ describe Gitlab::Metrics::MethodCall do describe '#real_time' do context 'without timings' do it 'returns 0.0' do - expect(method_call.real_time_seconds).to eq(0.0) + expect(method_call.real_time).to eq(0.0) end end @@ -140,7 +142,7 @@ describe Gitlab::Metrics::MethodCall do it 'returns the total real time' do method_call.measure { 'foo' } - expect(method_call.real_time_seconds >= 0.0).to be(true) + expect(method_call.real_time >= 0.0).to be(true) end end end diff --git a/spec/lib/gitlab/metrics/system_spec.rb b/spec/lib/gitlab/metrics/system_spec.rb index ea3bd00970e..14afcdf5daa 100644 --- a/spec/lib/gitlab/metrics/system_spec.rb +++ b/spec/lib/gitlab/metrics/system_spec.rb @@ -29,13 +29,13 @@ describe Gitlab::Metrics::System do describe '.cpu_time' do it 'returns a Fixnum' do - expect(described_class.cpu_time).to be_an(Integer) + expect(described_class.cpu_time).to be_an(Float) end end describe '.real_time' do it 'returns a Fixnum' do - expect(described_class.real_time).to be_an(Integer) + expect(described_class.real_time).to be_an(Float) end end From 10af36f0e8dff3629c404adac0e5553086e72481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chojnacki?= Date: Wed, 20 Dec 2017 23:42:37 +0000 Subject: [PATCH 023/120] add missing word to pawel-reduce_cardinality_of_prometheus_metrics.yml --- .../pawel-reduce_cardinality_of_prometheus_metrics.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelogs/unreleased/pawel-reduce_cardinality_of_prometheus_metrics.yml b/changelogs/unreleased/pawel-reduce_cardinality_of_prometheus_metrics.yml index 8213b493903..0cee0b634d6 100644 --- a/changelogs/unreleased/pawel-reduce_cardinality_of_prometheus_metrics.yml +++ b/changelogs/unreleased/pawel-reduce_cardinality_of_prometheus_metrics.yml @@ -1,5 +1,5 @@ --- -title: Reduce the number of buckets in gitlab_cache_operation_duration_seconds +title: Reduce the number of buckets in gitlab_cache_operation_duration_seconds metric merge_request: 15881 author: type: changed From 51b416338a2ee9e287787850d11a3474e16f1474 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Wed, 20 Dec 2017 17:08:28 +0100 Subject: [PATCH 024/120] Backport a change made in EE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- lib/api/members.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/api/members.rb b/lib/api/members.rb index 22e4bdead41..5446f6b54b1 100644 --- a/lib/api/members.rb +++ b/lib/api/members.rb @@ -59,7 +59,9 @@ module API member = source.add_user(params[:user_id], params[:access_level], current_user: current_user, expires_at: params[:expires_at]) - if member.persisted? && member.valid? + if !member + not_allowed! # This currently can only be reached in EE + elsif member.persisted? && member.valid? present member.user, with: Entities::Member, member: member else render_validation_error!(member) From 2ef5741b18d9e580025b1f93b3bb5c5488e1cc9e Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Thu, 21 Dec 2017 12:58:39 +0000 Subject: [PATCH 025/120] Update Dependencies --- app/assets/images/icons.json | 2 +- app/assets/images/icons.svg | 2 +- app/assets/images/illustrations/job_not_triggered.svg | 1 + app/assets/images/illustrations/manual_action.svg | 1 + .../images/illustrations/merge_request_changes_empty.svg | 2 +- app/assets/images/illustrations/service_desk_callout.svg | 1 + app/assets/images/illustrations/service_desk_empty.svg | 1 + package.json | 2 +- yarn.lock | 6 +++--- 9 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 app/assets/images/illustrations/job_not_triggered.svg create mode 100644 app/assets/images/illustrations/manual_action.svg create mode 100644 app/assets/images/illustrations/service_desk_callout.svg create mode 100644 app/assets/images/illustrations/service_desk_empty.svg diff --git a/app/assets/images/icons.json b/app/assets/images/icons.json index 68d6528758b..38c1faccbf1 100644 --- a/app/assets/images/icons.json +++ b/app/assets/images/icons.json @@ -1 +1 @@ -{"iconCount":181,"spriteSize":81482,"icons":["abuse","account","admin","angle-double-left","angle-double-right","angle-down","angle-left","angle-right","angle-up","appearance","applications","approval","arrow-down","arrow-right","assignee","bold","book","branch","bullhorn","calendar","cancel","chart","chevron-down","chevron-left","chevron-right","chevron-up","clock","close","code","collapse","comment-dots","comment-next","comment","comments","commit","credit-card","cut","dashboard","disk","doc_code","doc_image","doc_text","double-headed-arrow","download","duplicate","earth","ellipsis_v","emoji_slightly_smiling_face","emoji_smile","emoji_smiley","epic","external-link","eye-slash","eye","file-addition","file-deletion","file-modified","filter","folder","fork","geo-nodes","git-merge","group","history","home","hook","hourglass","image-comment-dark","image-comment-light","import","issue-block","issue-child","issue-close","issue-duplicate","issue-new","issue-open-m","issue-open","issue-parent","issues","italic","key-2","key","label","labels","leave","level-up","license","link","list-bulleted","list-numbered","location-dot","location","lock-open","lock","log","mail","menu","merge-request-close","messages","mobile-issue-close","monitor","more","notifications-off","notifications","overview","pencil-square","pencil","pipeline","play","plus-square-o","plus-square","plus","preferences","profile","project","push-rules","question-o","question","quote","redo","remove","repeat","retry","scale","screen-full","screen-normal","scroll_down","scroll_up","search","settings","shield","slight-frown","slight-smile","smile","smiley","snippet","spam","spinner","star-o","star","status_canceled_borderless","status_canceled","status_closed","status_created_borderless","status_created","status_failed_borderless","status_failed","status_manual_borderless","status_manual","status_notfound_borderless","status_open","status_pending_borderless","status_pending","status_running_borderless","status_running","status_skipped_borderless","status_skipped","status_success_borderless","status_success_solid","status_success","status_warning_borderless","status_warning","stop","task-done","template","terminal","thumb-down","thumb-up","thumbtack","timer","todo-add","todo-done","token","unapproval","unassignee","unlink","user","users","volume-up","warning","work"]} \ No newline at end of file +{"iconCount":186,"spriteSize":84748,"icons":["abuse","account","admin","angle-double-left","angle-double-right","angle-down","angle-left","angle-right","angle-up","appearance","applications","approval","arrow-down","arrow-right","assignee","bold","book","bookmark","branch","bullhorn","calendar","cancel","chart","chevron-down","chevron-left","chevron-right","chevron-up","clock","close","code","collapse","comment-dots","comment-next","comment","comments","commit","credit-card","cut","dashboard","disk","doc_code","doc_image","doc_text","double-headed-arrow","download","duplicate","earth","ellipsis_v","emoji_slightly_smiling_face","emoji_smile","emoji_smiley","epic","external-link","eye-slash","eye","file-addition","file-deletion","file-modified","filter","folder-o","folder-open","folder","fork","geo-nodes","git-merge","group","history","home","hook","hourglass","image-comment-dark","image-comment-light","import","issue-block","issue-child","issue-close","issue-duplicate","issue-external","issue-new","issue-open-m","issue-open","issue-parent","issues","italic","key-2","key","label","labels","leave","level-up","license","link","list-bulleted","list-numbered","location-dot","location","lock-open","lock","log","mail","menu","merge-request-close","messages","mobile-issue-close","monitor","more","notifications-off","notifications","overview","pencil-square","pencil","pipeline","play","plus-square-o","plus-square","plus","podcast","preferences","profile","project","push-rules","question-o","question","quote","redo","remove","repeat","retry","scale","screen-full","screen-normal","scroll_down","scroll_up","search","settings","shield","slight-frown","slight-smile","smile","smiley","snippet","spam","spinner","star-o","star","status_canceled_borderless","status_canceled","status_closed","status_created_borderless","status_created","status_failed_borderless","status_failed","status_manual_borderless","status_manual","status_notfound_borderless","status_open","status_pending_borderless","status_pending","status_running_borderless","status_running","status_skipped_borderless","status_skipped","status_success_borderless","status_success_solid","status_success","status_warning_borderless","status_warning","stop","task-done","template","terminal","thumb-down","thumb-up","thumbtack","timer","todo-add","todo-done","token","unapproval","unassignee","unlink","user","users","volume-up","warning","work"]} \ No newline at end of file diff --git a/app/assets/images/icons.svg b/app/assets/images/icons.svg index fd8f7862911..42f5377a10e 100644 --- a/app/assets/images/icons.svg +++ b/app/assets/images/icons.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/app/assets/images/illustrations/job_not_triggered.svg b/app/assets/images/illustrations/job_not_triggered.svg new file mode 100644 index 00000000000..e13c1cb0a7d --- /dev/null +++ b/app/assets/images/illustrations/job_not_triggered.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/assets/images/illustrations/manual_action.svg b/app/assets/images/illustrations/manual_action.svg new file mode 100644 index 00000000000..85735855b46 --- /dev/null +++ b/app/assets/images/illustrations/manual_action.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/assets/images/illustrations/merge_request_changes_empty.svg b/app/assets/images/illustrations/merge_request_changes_empty.svg index 707efa736e4..40efeb2de57 100644 --- a/app/assets/images/illustrations/merge_request_changes_empty.svg +++ b/app/assets/images/illustrations/merge_request_changes_empty.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/app/assets/images/illustrations/service_desk_callout.svg b/app/assets/images/illustrations/service_desk_callout.svg new file mode 100644 index 00000000000..2886388279e --- /dev/null +++ b/app/assets/images/illustrations/service_desk_callout.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/assets/images/illustrations/service_desk_empty.svg b/app/assets/images/illustrations/service_desk_empty.svg new file mode 100644 index 00000000000..daaaeae6a17 --- /dev/null +++ b/app/assets/images/illustrations/service_desk_empty.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/package.json b/package.json index a5bf2309a0f..48d9b125fb8 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "worker-loader": "^1.1.0" }, "devDependencies": { - "@gitlab-org/gitlab-svgs": "^1.3.0", + "@gitlab-org/gitlab-svgs": "^1.4.0", "babel-plugin-istanbul": "^4.1.5", "eslint": "^3.10.1", "eslint-config-airbnb-base": "^10.0.1", diff --git a/yarn.lock b/yarn.lock index 55d0d33c9f2..438bfb46c79 100644 --- a/yarn.lock +++ b/yarn.lock @@ -54,9 +54,9 @@ lodash "^4.2.0" to-fast-properties "^2.0.0" -"@gitlab-org/gitlab-svgs@^1.3.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@gitlab-org/gitlab-svgs/-/gitlab-svgs-1.3.0.tgz#07f2aa75d6e0e857eaa20c38a3bad7e6c22c420c" +"@gitlab-org/gitlab-svgs@^1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@gitlab-org/gitlab-svgs/-/gitlab-svgs-1.4.0.tgz#83c0a76485c1378babf2e83456b4d2442efa98e8" "@types/jquery@^2.0.40": version "2.0.48" From 66c03aaa4c5fd8902310740b229d9caf49d7bc25 Mon Sep 17 00:00:00 2001 From: Sam Galson Date: Thu, 21 Dec 2017 13:05:19 +0000 Subject: [PATCH 026/120] Fix prometheus arg in prometheus.yml --- doc/user/project/integrations/samples/prometheus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user/project/integrations/samples/prometheus.yml b/doc/user/project/integrations/samples/prometheus.yml index 30b59e172a1..3a4735d282f 100644 --- a/doc/user/project/integrations/samples/prometheus.yml +++ b/doc/user/project/integrations/samples/prometheus.yml @@ -94,7 +94,7 @@ spec: - name: prometheus image: prom/prometheus:latest args: - - '-config.file=/prometheus-data/prometheus.yml' + - '--config.file=/prometheus-data/prometheus.yml' ports: - name: prometheus containerPort: 9090 From 6b23e9d923c816fd9ed903424fd909a08f3c51fe Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 21 Dec 2017 08:31:56 -0500 Subject: [PATCH 027/120] docs: fix a typo in LFS documentation --- doc/workflow/lfs/manage_large_binaries_with_git_lfs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/workflow/lfs/manage_large_binaries_with_git_lfs.md b/doc/workflow/lfs/manage_large_binaries_with_git_lfs.md index 195285f9157..f7b87dee8e1 100644 --- a/doc/workflow/lfs/manage_large_binaries_with_git_lfs.md +++ b/doc/workflow/lfs/manage_large_binaries_with_git_lfs.md @@ -170,4 +170,4 @@ GitLab checks files to detect LFS pointers on push. If LFS pointers are detected Verify that LFS in installed locally and consider a manual push with `git lfs push --all`. -If you are storing LFS files outside of GitLab you can disable LFS on the project by settting `lfs_enabled: false` with the [projets api](../../api/projects.md#edit-project). +If you are storing LFS files outside of GitLab you can disable LFS on the project by settting `lfs_enabled: false` with the [projects api](../../api/projects.md#edit-project). From c27c65f97ac6c02a73661ebd66e728b6fd4a6039 Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Thu, 21 Dec 2017 14:03:15 +0100 Subject: [PATCH 028/120] Fall back to the `MergeRequestWidgetEntity` When no serializer was passed. --- app/serializers/merge_request_serializer.rb | 2 +- .../projects/merge_requests_controller_spec.rb | 8 ++++++++ spec/serializers/merge_request_serializer_spec.rb | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/serializers/merge_request_serializer.rb b/app/serializers/merge_request_serializer.rb index 52eb30d688a..caf193bdae3 100644 --- a/app/serializers/merge_request_serializer.rb +++ b/app/serializers/merge_request_serializer.rb @@ -7,7 +7,7 @@ class MergeRequestSerializer < BaseSerializer case opts[:serializer] when 'basic', 'sidebar' MergeRequestBasicEntity - when 'widget' + else # It's 'widget' MergeRequestWidgetEntity end diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb index 58116e6e0fe..45c424af8c4 100644 --- a/spec/controllers/projects/merge_requests_controller_spec.rb +++ b/spec/controllers/projects/merge_requests_controller_spec.rb @@ -98,6 +98,14 @@ describe Projects::MergeRequestsController do expect(response).to match_response_schema('entities/merge_request_widget') end end + + context 'when no serialiser was passed' do + it 'renders widget MR entity as json' do + go(serializer: nil, format: :json) + + expect(response).to match_response_schema('entities/merge_request_widget') + end + end end describe "as diff" do diff --git a/spec/serializers/merge_request_serializer_spec.rb b/spec/serializers/merge_request_serializer_spec.rb index 1ad974c774b..b259cb92962 100644 --- a/spec/serializers/merge_request_serializer_spec.rb +++ b/spec/serializers/merge_request_serializer_spec.rb @@ -36,8 +36,8 @@ describe MergeRequestSerializer do context 'no serializer' do let(:serializer) { nil } - it 'raises an error' do - expect { json_entity }.to raise_error(NoMethodError) + it 'falls back to the widget entity' do + expect(json_entity).to match_schema('entities/merge_request_widget') end end end From d2f1d585e10e3e728f968ceae6b275e4d9bc59f4 Mon Sep 17 00:00:00 2001 From: Jan Provaznik Date: Fri, 15 Dec 2017 11:21:12 +0100 Subject: [PATCH 029/120] Skip projects filter on merge requests search When searching for merge requests, an additional subquery is added which by default filters only merge requests which belong to source or target project user has permission for. This filter is not needed because more restrictive filter which checks if user has permission for target project is used in the query. So unless a custom projects filter is used by user, it's possible to skip the default projects filter and speed up the final query. Related to #40540 --- app/services/search/global_service.rb | 5 ++++- app/services/search/group_service.rb | 1 + .../unreleased/15955-improve-search-query.yml | 5 +++++ lib/gitlab/search_results.rb | 15 +++++++++++++-- spec/lib/gitlab/search_results_spec.rb | 11 +++++++++++ 5 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 changelogs/unreleased/15955-improve-search-query.yml diff --git a/app/services/search/global_service.rb b/app/services/search/global_service.rb index ff188102b62..92a32e703af 100644 --- a/app/services/search/global_service.rb +++ b/app/services/search/global_service.rb @@ -1,13 +1,16 @@ module Search class GlobalService attr_accessor :current_user, :params + attr_reader :default_project_filter def initialize(user, params) @current_user, @params = user, params.dup + @default_project_filter = true end def execute - Gitlab::SearchResults.new(current_user, projects, params[:search]) + Gitlab::SearchResults.new(current_user, projects, params[:search], + default_project_filter: default_project_filter) end def projects diff --git a/app/services/search/group_service.rb b/app/services/search/group_service.rb index 29478e3251f..b4efba68715 100644 --- a/app/services/search/group_service.rb +++ b/app/services/search/group_service.rb @@ -5,6 +5,7 @@ module Search def initialize(user, group, params) super(user, params) + @default_project_filter = false @group = group end diff --git a/changelogs/unreleased/15955-improve-search-query.yml b/changelogs/unreleased/15955-improve-search-query.yml new file mode 100644 index 00000000000..80cb8af617f --- /dev/null +++ b/changelogs/unreleased/15955-improve-search-query.yml @@ -0,0 +1,5 @@ +--- +title: Improve search query for merge requests. +merge_request: +author: +type: performance diff --git a/lib/gitlab/search_results.rb b/lib/gitlab/search_results.rb index fef9d3e31d4..7037e2e61cc 100644 --- a/lib/gitlab/search_results.rb +++ b/lib/gitlab/search_results.rb @@ -27,10 +27,17 @@ module Gitlab # It allows us to search only for projects user has access to attr_reader :limit_projects - def initialize(current_user, limit_projects, query) + # Whether a custom filter is used to restrict scope of projects. + # If the default filter (which lists all projects user has access to) + # is used, we can skip it when filtering merge requests and optimize the + # query + attr_reader :default_project_filter + + def initialize(current_user, limit_projects, query, default_project_filter: false) @current_user = current_user @limit_projects = limit_projects || Project.all @query = query + @default_project_filter = default_project_filter end def objects(scope, page = nil) @@ -94,7 +101,11 @@ module Gitlab end def merge_requests - merge_requests = MergeRequestsFinder.new(current_user).execute.in_projects(project_ids_relation) + merge_requests = MergeRequestsFinder.new(current_user).execute + unless default_project_filter + merge_requests = merge_requests.in_projects(project_ids_relation) + end + merge_requests = if query =~ /[#!](\d+)\z/ merge_requests.where(iid: $1) diff --git a/spec/lib/gitlab/search_results_spec.rb b/spec/lib/gitlab/search_results_spec.rb index e44a7c23452..a958baab44f 100644 --- a/spec/lib/gitlab/search_results_spec.rb +++ b/spec/lib/gitlab/search_results_spec.rb @@ -51,6 +51,17 @@ describe Gitlab::SearchResults do expect(results.objects('merge_requests')).to include merge_request_2 end + + it 'includes project filter by default' do + expect(results).to receive(:project_ids_relation).and_call_original + results.objects('merge_requests') + end + + it 'it skips project filter if default is used' do + allow(results).to receive(:default_project_filter).and_return(true) + expect(results).not_to receive(:project_ids_relation) + results.objects('merge_requests') + end end it 'does not list issues on private projects' do From 5cdd246bd994b09815a14d550c2c334cc48aa35a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Tue, 19 Dec 2017 16:44:14 +0100 Subject: [PATCH 030/120] Update Ruby version to 2.3.6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- .gitlab-ci.yml | 2 +- .ruby-version | 2 +- changelogs/unreleased/41268-bump-ruby-to-2-3-6.yml | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 changelogs/unreleased/41268-bump-ruby-to-2-3-6.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c26e7f0aeba..edb1069e54f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: "dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.3.5-golang-1.8-git-2.14-chrome-63.0-node-8.x-yarn-1.2-postgresql-9.6" +image: "dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.3.6-golang-1.9-git-2.14-chrome-63.0-node-8.x-yarn-1.2-postgresql-9.6" .dedicated-runner: &dedicated-runner retry: 1 diff --git a/.ruby-version b/.ruby-version index cc6c9a491e0..e75da3e63d6 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.3.5 +2.3.6 diff --git a/changelogs/unreleased/41268-bump-ruby-to-2-3-6.yml b/changelogs/unreleased/41268-bump-ruby-to-2-3-6.yml new file mode 100644 index 00000000000..188a854ebee --- /dev/null +++ b/changelogs/unreleased/41268-bump-ruby-to-2-3-6.yml @@ -0,0 +1,5 @@ +--- +title: Upgrade Ruby to 2.3.6 to include security patches +merge_request: 16016 +author: +type: security From 213e91d43926f09eb969859aa2c306eeb127deb4 Mon Sep 17 00:00:00 2001 From: Tim Zallmann Date: Thu, 21 Dec 2017 15:05:47 +0000 Subject: [PATCH 031/120] Resolve "Decouple multi-file editor from file list" --- app/assets/javascripts/api.js | 14 +- app/assets/javascripts/dispatcher.js | 5 - app/assets/javascripts/fly_out_nav.js | 15 +- .../helpers/user_feature_helper.js | 7 - .../ide/components/commit_sidebar/list.vue | 66 ++++ .../commit_sidebar/list_collapsed.vue | 0 .../components/commit_sidebar/list_item.vue | 0 app/assets/javascripts/ide/components/ide.vue | 73 ++++ .../ide/components/ide_context_bar.vue | 75 ++++ .../components/ide_project_branches_tree.vue | 47 +++ .../ide/components/ide_project_tree.vue | 47 +++ .../ide/components/ide_repo_tree.vue | 66 ++++ .../ide/components/ide_side_bar.vue | 62 ++++ .../ide/components/ide_status_bar.vue | 71 ++++ .../components/new_branch_form.vue | 2 +- .../ide/components/new_dropdown/index.vue | 101 ++++++ .../components/new_dropdown/modal.vue | 16 +- .../components/new_dropdown/upload.vue | 35 +- .../components/repo_commit_section.vue | 45 +-- .../components/repo_edit_button.vue | 0 .../{repo => ide}/components/repo_editor.vue | 42 ++- .../{repo => ide}/components/repo_file.vue | 74 +++- .../components/repo_file_buttons.vue | 0 .../components/repo_loading_file.vue | 8 +- .../components/repo_prev_directory.vue | 8 +- .../{repo => ide}/components/repo_preview.vue | 0 .../{repo => ide}/components/repo_tab.vue | 6 +- .../{repo => ide}/components/repo_tabs.vue | 0 app/assets/javascripts/ide/ide_router.js | 101 ++++++ app/assets/javascripts/ide/index.js | 55 +++ .../{repo => ide}/lib/common/disposable.js | 0 .../{repo => ide}/lib/common/model.js | 8 + .../{repo => ide}/lib/common/model_manager.js | 0 .../lib/decorations/controller.js | 0 .../{repo => ide}/lib/diff/controller.js | 0 .../{repo => ide}/lib/diff/diff.js | 0 .../{repo => ide}/lib/diff/diff_worker.js | 0 .../javascripts/{repo => ide}/lib/editor.js | 30 ++ .../{repo => ide}/lib/editor_options.js | 0 .../{repo => ide}/monaco_loader.js | 0 .../{repo => ide}/services/index.js | 7 +- app/assets/javascripts/ide/stores/actions.js | 179 ++++++++++ .../javascripts/ide/stores/actions/branch.js | 43 +++ .../{repo => ide}/stores/actions/file.js | 41 ++- .../javascripts/ide/stores/actions/project.js | 25 ++ .../javascripts/ide/stores/actions/tree.js | 188 ++++++++++ app/assets/javascripts/ide/stores/getters.js | 19 + .../javascripts/{repo => ide}/stores/index.js | 0 .../{repo => ide}/stores/mutation_types.js | 19 +- .../{repo => ide}/stores/mutations.js | 18 +- .../ide/stores/mutations/branch.js | 28 ++ .../{repo => ide}/stores/mutations/file.js | 20 ++ .../ide/stores/mutations/project.js | 23 ++ .../{repo => ide}/stores/mutations/tree.js | 9 + .../javascripts/{repo => ide}/stores/state.js | 20 +- .../javascripts/{repo => ide}/stores/utils.js | 64 +++- app/assets/javascripts/new_commit_form.js | 7 +- .../repo/components/commit_sidebar/list.vue | 89 ----- .../repo/components/new_dropdown/index.vue | 89 ----- .../javascripts/repo/components/repo.vue | 63 ---- .../repo/components/repo_sidebar.vue | 85 ----- app/assets/javascripts/repo/index.js | 106 ------ app/assets/javascripts/repo/stores/actions.js | 146 -------- .../javascripts/repo/stores/actions/branch.js | 20 -- .../javascripts/repo/stores/actions/tree.js | 163 --------- app/assets/javascripts/repo/stores/getters.js | 40 --- .../repo/stores/mutations/branch.js | 9 - .../components/project_avatar/image.vue | 103 ++++++ .../framework/contextual-sidebar.scss | 1 - .../stylesheets/framework/variables.scss | 1 + app/assets/stylesheets/pages/repo.scss | 241 +++++++++++-- app/controllers/ide_controller.rb | 6 + app/helpers/application_helper.rb | 2 +- app/helpers/blob_helper.rb | 43 ++- app/views/ide/index.html.haml | 12 + app/views/layouts/nav_only.html.haml | 13 + app/views/projects/_files.html.haml | 2 +- app/views/projects/blob/_header.html.haml | 1 + app/views/projects/blob/show.html.haml | 15 +- .../projects/tree/_old_tree_content.html.haml | 24 -- .../projects/tree/_old_tree_header.html.haml | 64 ---- .../projects/tree/_tree_content.html.haml | 29 +- .../projects/tree/_tree_header.html.haml | 78 ++++- app/views/projects/tree/show.html.haml | 7 +- app/views/shared/_ref_switcher.html.haml | 2 +- app/views/shared/repo/_repo.html.haml | 13 - ...ouple-multi-file-editor-from-file-list.yml | 5 + config/routes.rb | 2 + config/webpack.config.js | 4 +- package.json | 1 + spec/features/projects/ref_switcher_spec.rb | 78 ----- .../projects/tree/create_directory_spec.rb | 26 +- .../projects/tree/create_file_spec.rb | 16 +- .../projects/tree/upload_file_spec.rb | 9 +- .../commit_sidebar/list_collapsed_spec.js | 4 +- .../commit_sidebar/list_item_spec.js | 2 +- .../components/commit_sidebar/list_spec.js | 29 +- .../repo/components/ide_context_bar_spec.js | 49 +++ ..._sidebar_spec.js => ide_repo_tree_spec.js} | 23 +- .../repo/components/ide_side_bar_spec.js | 43 +++ .../components/{repo_spec.js => ide_spec.js} | 12 +- .../repo/components/new_branch_form_spec.js | 4 +- .../components/new_dropdown/index_spec.js | 17 +- .../components/new_dropdown/modal_spec.js | 149 +++++--- .../components/new_dropdown/upload_spec.js | 81 ++++- .../components/repo_commit_section_spec.js | 33 +- .../repo/components/repo_edit_button_spec.js | 8 +- .../repo/components/repo_editor_spec.js | 6 +- .../repo/components/repo_file_buttons_spec.js | 4 +- .../repo/components/repo_file_spec.js | 13 +- .../repo/components/repo_loading_file_spec.js | 5 +- .../components/repo_prev_directory_spec.js | 4 +- .../repo/components/repo_preview_spec.js | 4 +- .../repo/components/repo_tab_spec.js | 10 +- .../repo/components/repo_tabs_spec.js | 4 +- spec/javascripts/repo/helpers.js | 5 +- .../repo/lib/common/disposable_spec.js | 2 +- .../repo/lib/common/model_manager_spec.js | 4 +- .../javascripts/repo/lib/common/model_spec.js | 4 +- .../repo/lib/decorations/controller_spec.js | 8 +- .../repo/lib/diff/controller_spec.js | 12 +- spec/javascripts/repo/lib/diff/diff_spec.js | 2 +- .../repo/lib/editor_options_spec.js | 2 +- spec/javascripts/repo/lib/editor_spec.js | 4 +- spec/javascripts/repo/monaco_loader_spec.js | 2 +- .../repo/stores/actions/branch_spec.js | 20 +- .../repo/stores/actions/file_spec.js | 75 ++-- .../repo/stores/actions/tree_spec.js | 326 ++++++------------ spec/javascripts/repo/stores/actions_spec.js | 95 ++--- spec/javascripts/repo/stores/getters_spec.js | 38 +- .../repo/stores/mutations/branch_spec.js | 6 +- .../repo/stores/mutations/file_spec.js | 4 +- .../repo/stores/mutations/tree_spec.js | 4 +- .../javascripts/repo/stores/mutations_spec.js | 40 ++- spec/javascripts/repo/stores/utils_spec.js | 43 ++- yarn.lock | 4 + 136 files changed, 2867 insertions(+), 1734 deletions(-) delete mode 100644 app/assets/javascripts/helpers/user_feature_helper.js create mode 100644 app/assets/javascripts/ide/components/commit_sidebar/list.vue rename app/assets/javascripts/{repo => ide}/components/commit_sidebar/list_collapsed.vue (100%) rename app/assets/javascripts/{repo => ide}/components/commit_sidebar/list_item.vue (100%) create mode 100644 app/assets/javascripts/ide/components/ide.vue create mode 100644 app/assets/javascripts/ide/components/ide_context_bar.vue create mode 100644 app/assets/javascripts/ide/components/ide_project_branches_tree.vue create mode 100644 app/assets/javascripts/ide/components/ide_project_tree.vue create mode 100644 app/assets/javascripts/ide/components/ide_repo_tree.vue create mode 100644 app/assets/javascripts/ide/components/ide_side_bar.vue create mode 100644 app/assets/javascripts/ide/components/ide_status_bar.vue rename app/assets/javascripts/{repo => ide}/components/new_branch_form.vue (99%) create mode 100644 app/assets/javascripts/ide/components/new_dropdown/index.vue rename app/assets/javascripts/{repo => ide}/components/new_dropdown/modal.vue (84%) rename app/assets/javascripts/{repo => ide}/components/new_dropdown/upload.vue (70%) rename app/assets/javascripts/{repo => ide}/components/repo_commit_section.vue (83%) rename app/assets/javascripts/{repo => ide}/components/repo_edit_button.vue (100%) rename app/assets/javascripts/{repo => ide}/components/repo_editor.vue (64%) rename app/assets/javascripts/{repo => ide}/components/repo_file.vue (58%) rename app/assets/javascripts/{repo => ide}/components/repo_file_buttons.vue (100%) rename app/assets/javascripts/{repo => ide}/components/repo_loading_file.vue (85%) rename app/assets/javascripts/{repo => ide}/components/repo_prev_directory.vue (74%) rename app/assets/javascripts/{repo => ide}/components/repo_preview.vue (100%) rename app/assets/javascripts/{repo => ide}/components/repo_tab.vue (92%) rename app/assets/javascripts/{repo => ide}/components/repo_tabs.vue (100%) create mode 100644 app/assets/javascripts/ide/ide_router.js create mode 100644 app/assets/javascripts/ide/index.js rename app/assets/javascripts/{repo => ide}/lib/common/disposable.js (100%) rename app/assets/javascripts/{repo => ide}/lib/common/model.js (89%) rename app/assets/javascripts/{repo => ide}/lib/common/model_manager.js (100%) rename app/assets/javascripts/{repo => ide}/lib/decorations/controller.js (100%) rename app/assets/javascripts/{repo => ide}/lib/diff/controller.js (100%) rename app/assets/javascripts/{repo => ide}/lib/diff/diff.js (100%) rename app/assets/javascripts/{repo => ide}/lib/diff/diff_worker.js (100%) rename app/assets/javascripts/{repo => ide}/lib/editor.js (73%) rename app/assets/javascripts/{repo => ide}/lib/editor_options.js (100%) rename app/assets/javascripts/{repo => ide}/monaco_loader.js (100%) rename app/assets/javascripts/{repo => ide}/services/index.js (83%) create mode 100644 app/assets/javascripts/ide/stores/actions.js create mode 100644 app/assets/javascripts/ide/stores/actions/branch.js rename app/assets/javascripts/{repo => ide}/stores/actions/file.js (66%) create mode 100644 app/assets/javascripts/ide/stores/actions/project.js create mode 100644 app/assets/javascripts/ide/stores/actions/tree.js create mode 100644 app/assets/javascripts/ide/stores/getters.js rename app/assets/javascripts/{repo => ide}/stores/index.js (100%) rename app/assets/javascripts/{repo => ide}/stores/mutation_types.js (62%) rename app/assets/javascripts/{repo => ide}/stores/mutations.js (80%) create mode 100644 app/assets/javascripts/ide/stores/mutations/branch.js rename app/assets/javascripts/{repo => ide}/stores/mutations/file.js (74%) create mode 100644 app/assets/javascripts/ide/stores/mutations/project.js rename app/assets/javascripts/{repo => ide}/stores/mutations/tree.js (76%) rename app/assets/javascripts/{repo => ide}/stores/state.js (54%) rename app/assets/javascripts/{repo => ide}/stores/utils.js (52%) delete mode 100644 app/assets/javascripts/repo/components/commit_sidebar/list.vue delete mode 100644 app/assets/javascripts/repo/components/new_dropdown/index.vue delete mode 100644 app/assets/javascripts/repo/components/repo.vue delete mode 100644 app/assets/javascripts/repo/components/repo_sidebar.vue delete mode 100644 app/assets/javascripts/repo/index.js delete mode 100644 app/assets/javascripts/repo/stores/actions.js delete mode 100644 app/assets/javascripts/repo/stores/actions/branch.js delete mode 100644 app/assets/javascripts/repo/stores/actions/tree.js delete mode 100644 app/assets/javascripts/repo/stores/getters.js delete mode 100644 app/assets/javascripts/repo/stores/mutations/branch.js create mode 100644 app/assets/javascripts/vue_shared/components/project_avatar/image.vue create mode 100644 app/controllers/ide_controller.rb create mode 100644 app/views/ide/index.html.haml create mode 100644 app/views/layouts/nav_only.html.haml delete mode 100644 app/views/projects/tree/_old_tree_content.html.haml delete mode 100644 app/views/projects/tree/_old_tree_header.html.haml delete mode 100644 app/views/shared/repo/_repo.html.haml create mode 100644 changelogs/unreleased/40040-decouple-multi-file-editor-from-file-list.yml delete mode 100644 spec/features/projects/ref_switcher_spec.rb create mode 100644 spec/javascripts/repo/components/ide_context_bar_spec.js rename spec/javascripts/repo/components/{repo_sidebar_spec.js => ide_repo_tree_spec.js} (65%) create mode 100644 spec/javascripts/repo/components/ide_side_bar_spec.js rename spec/javascripts/repo/components/{repo_spec.js => ide_spec.js} (73%) diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js index d963101028a..21d8c790e90 100644 --- a/app/assets/javascripts/api.js +++ b/app/assets/javascripts/api.js @@ -1,4 +1,5 @@ import $ from 'jquery'; +import axios from './lib/utils/axios_utils'; const Api = { groupsPath: '/api/:version/groups.json', @@ -6,6 +7,7 @@ const Api = { namespacesPath: '/api/:version/namespaces.json', groupProjectsPath: '/api/:version/groups/:id/projects.json', projectsPath: '/api/:version/projects.json', + projectPath: '/api/:version/projects/:id', projectLabelsPath: '/:namespace_path/:project_path/labels', groupLabelsPath: '/groups/:namespace_path/labels', licensePath: '/api/:version/templates/licenses/:key', @@ -76,6 +78,14 @@ const Api = { .done(projects => callback(projects)); }, + // Return single project + project(projectPath) { + const url = Api.buildUrl(Api.projectPath) + .replace(':id', encodeURIComponent(projectPath)); + + return axios.get(url); + }, + newLabel(namespacePath, projectPath, data, callback) { let url; @@ -115,7 +125,7 @@ const Api = { commitMultiple(id, data) { // see https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions const url = Api.buildUrl(Api.commitPath) - .replace(':id', id); + .replace(':id', encodeURIComponent(id)); return this.wrapAjaxCall({ url, type: 'POST', @@ -127,7 +137,7 @@ const Api = { branchSingle(id, branch) { const url = Api.buildUrl(Api.branchSinglePath) - .replace(':id', id) + .replace(':id', encodeURIComponent(id)) .replace(':branch', branch); return this.wrapAjaxCall({ diff --git a/app/assets/javascripts/dispatcher.js b/app/assets/javascripts/dispatcher.js index 62867c56214..07df3c216b1 100644 --- a/app/assets/javascripts/dispatcher.js +++ b/app/assets/javascripts/dispatcher.js @@ -73,7 +73,6 @@ import initLegacyFilters from './init_legacy_filters'; import initIssuableSidebar from './init_issuable_sidebar'; import initProjectVisibilitySelector from './project_visibility'; import GpgBadges from './gpg_badges'; -import UserFeatureHelper from './helpers/user_feature_helper'; import initChangesDropdown from './init_changes_dropdown'; import NewGroupChild from './groups/new_group_child'; import AbuseReports from './abuse_reports'; @@ -447,9 +446,6 @@ import Activities from './activities'; break; case 'projects:tree:show': shortcut_handler = new ShortcutsNavigation(); - - if (UserFeatureHelper.isNewRepoEnabled()) break; - new TreeView(); new BlobViewer(); new NewCommitForm($('.js-create-dir-form')); @@ -468,7 +464,6 @@ import Activities from './activities'; shortcut_handler = true; break; case 'projects:blob:show': - if (UserFeatureHelper.isNewRepoEnabled()) break; new BlobViewer(); initBlob(); break; diff --git a/app/assets/javascripts/fly_out_nav.js b/app/assets/javascripts/fly_out_nav.js index 6110d961609..abb04d77f8f 100644 --- a/app/assets/javascripts/fly_out_nav.js +++ b/app/assets/javascripts/fly_out_nav.js @@ -161,13 +161,16 @@ export default () => { const items = [...sidebar.querySelectorAll('.sidebar-top-level-items > li')]; - sidebar.querySelector('.sidebar-top-level-items').addEventListener('mouseleave', () => { - clearTimeout(timeoutId); + const topItems = sidebar.querySelector('.sidebar-top-level-items'); + if (topItems) { + sidebar.querySelector('.sidebar-top-level-items').addEventListener('mouseleave', () => { + clearTimeout(timeoutId); - timeoutId = setTimeout(() => { - if (currentOpenMenu) hideMenu(currentOpenMenu); - }, getHideSubItemsInterval()); - }); + timeoutId = setTimeout(() => { + if (currentOpenMenu) hideMenu(currentOpenMenu); + }, getHideSubItemsInterval()); + }); + } headerHeight = document.querySelector('.nav-sidebar').offsetTop; diff --git a/app/assets/javascripts/helpers/user_feature_helper.js b/app/assets/javascripts/helpers/user_feature_helper.js deleted file mode 100644 index 638118a5204..00000000000 --- a/app/assets/javascripts/helpers/user_feature_helper.js +++ /dev/null @@ -1,7 +0,0 @@ -import Cookies from 'js-cookie'; - -export default { - isNewRepoEnabled() { - return Cookies.get('new_repo') === 'true'; - }, -}; diff --git a/app/assets/javascripts/ide/components/commit_sidebar/list.vue b/app/assets/javascripts/ide/components/commit_sidebar/list.vue new file mode 100644 index 00000000000..704dff981df --- /dev/null +++ b/app/assets/javascripts/ide/components/commit_sidebar/list.vue @@ -0,0 +1,66 @@ + + + diff --git a/app/assets/javascripts/repo/components/commit_sidebar/list_collapsed.vue b/app/assets/javascripts/ide/components/commit_sidebar/list_collapsed.vue similarity index 100% rename from app/assets/javascripts/repo/components/commit_sidebar/list_collapsed.vue rename to app/assets/javascripts/ide/components/commit_sidebar/list_collapsed.vue diff --git a/app/assets/javascripts/repo/components/commit_sidebar/list_item.vue b/app/assets/javascripts/ide/components/commit_sidebar/list_item.vue similarity index 100% rename from app/assets/javascripts/repo/components/commit_sidebar/list_item.vue rename to app/assets/javascripts/ide/components/commit_sidebar/list_item.vue diff --git a/app/assets/javascripts/ide/components/ide.vue b/app/assets/javascripts/ide/components/ide.vue new file mode 100644 index 00000000000..7f29a355eca --- /dev/null +++ b/app/assets/javascripts/ide/components/ide.vue @@ -0,0 +1,73 @@ + + + diff --git a/app/assets/javascripts/ide/components/ide_context_bar.vue b/app/assets/javascripts/ide/components/ide_context_bar.vue new file mode 100644 index 00000000000..5a08718e386 --- /dev/null +++ b/app/assets/javascripts/ide/components/ide_context_bar.vue @@ -0,0 +1,75 @@ + + + diff --git a/app/assets/javascripts/ide/components/ide_project_branches_tree.vue b/app/assets/javascripts/ide/components/ide_project_branches_tree.vue new file mode 100644 index 00000000000..bd3a521ff43 --- /dev/null +++ b/app/assets/javascripts/ide/components/ide_project_branches_tree.vue @@ -0,0 +1,47 @@ + + + diff --git a/app/assets/javascripts/ide/components/ide_project_tree.vue b/app/assets/javascripts/ide/components/ide_project_tree.vue new file mode 100644 index 00000000000..61daba6d176 --- /dev/null +++ b/app/assets/javascripts/ide/components/ide_project_tree.vue @@ -0,0 +1,47 @@ + + + diff --git a/app/assets/javascripts/ide/components/ide_repo_tree.vue b/app/assets/javascripts/ide/components/ide_repo_tree.vue new file mode 100644 index 00000000000..b6b089e6b25 --- /dev/null +++ b/app/assets/javascripts/ide/components/ide_repo_tree.vue @@ -0,0 +1,66 @@ + + + diff --git a/app/assets/javascripts/ide/components/ide_side_bar.vue b/app/assets/javascripts/ide/components/ide_side_bar.vue new file mode 100644 index 00000000000..535398d98c2 --- /dev/null +++ b/app/assets/javascripts/ide/components/ide_side_bar.vue @@ -0,0 +1,62 @@ + + + diff --git a/app/assets/javascripts/ide/components/ide_status_bar.vue b/app/assets/javascripts/ide/components/ide_status_bar.vue new file mode 100644 index 00000000000..a24abadd936 --- /dev/null +++ b/app/assets/javascripts/ide/components/ide_status_bar.vue @@ -0,0 +1,71 @@ + + + diff --git a/app/assets/javascripts/repo/components/new_branch_form.vue b/app/assets/javascripts/ide/components/new_branch_form.vue similarity index 99% rename from app/assets/javascripts/repo/components/new_branch_form.vue rename to app/assets/javascripts/ide/components/new_branch_form.vue index ba7090e4a9d..2119d373d31 100644 --- a/app/assets/javascripts/repo/components/new_branch_form.vue +++ b/app/assets/javascripts/ide/components/new_branch_form.vue @@ -44,7 +44,7 @@ this.branchName = ''; if (this.dropdownText) { - this.dropdownText.textContent = this.currentBranch; + this.dropdownText.textContent = this.currentBranchId; } this.toggleDropdown(); diff --git a/app/assets/javascripts/ide/components/new_dropdown/index.vue b/app/assets/javascripts/ide/components/new_dropdown/index.vue new file mode 100644 index 00000000000..6e67e99a70f --- /dev/null +++ b/app/assets/javascripts/ide/components/new_dropdown/index.vue @@ -0,0 +1,101 @@ + + + diff --git a/app/assets/javascripts/repo/components/new_dropdown/modal.vue b/app/assets/javascripts/ide/components/new_dropdown/modal.vue similarity index 84% rename from app/assets/javascripts/repo/components/new_dropdown/modal.vue rename to app/assets/javascripts/ide/components/new_dropdown/modal.vue index c191af7dec3..a0650d37690 100644 --- a/app/assets/javascripts/repo/components/new_dropdown/modal.vue +++ b/app/assets/javascripts/ide/components/new_dropdown/modal.vue @@ -1,10 +1,18 @@ diff --git a/app/assets/javascripts/repo/components/repo_commit_section.vue b/app/assets/javascripts/ide/components/repo_commit_section.vue similarity index 83% rename from app/assets/javascripts/repo/components/repo_commit_section.vue rename to app/assets/javascripts/ide/components/repo_commit_section.vue index 4e0178072cb..470db2c9650 100644 --- a/app/assets/javascripts/repo/components/repo_commit_section.vue +++ b/app/assets/javascripts/ide/components/repo_commit_section.vue @@ -20,12 +20,13 @@ export default { submitCommitsLoading: false, startNewMR: false, commitMessage: '', - collapsed: true, }; }, computed: { ...mapState([ - 'currentBranch', + 'currentProjectId', + 'currentBranchId', + 'rightPanelCollapsed', ]), ...mapGetters([ 'changedFiles', @@ -42,12 +43,13 @@ export default { 'checkCommitStatus', 'commitChanges', 'getTreeData', + 'setPanelCollapsedStatus', ]), makeCommit(newBranch = false) { const createNewBranch = newBranch || this.startNewMR; const payload = { - branch: createNewBranch ? `${this.currentBranch}-${new Date().getTime().toString()}` : this.currentBranch, + branch: createNewBranch ? `${this.currentBranchId}-${new Date().getTime().toString()}` : this.currentBranchId, commit_message: this.commitMessage, actions: this.changedFiles.map(f => ({ action: f.tempFile ? 'create' : 'update', @@ -55,7 +57,7 @@ export default { content: f.content, encoding: f.base64 ? 'base64' : 'text', })), - start_branch: createNewBranch ? this.currentBranch : undefined, + start_branch: createNewBranch ? this.currentBranchId : undefined, }; this.showNewBranchModal = false; @@ -64,7 +66,12 @@ export default { this.commitChanges({ payload, newMr: this.startNewMR }) .then(() => { this.submitCommitsLoading = false; - this.getTreeData(); + this.$store.dispatch('getTreeData', { + projectId: this.currentProjectId, + branch: this.currentBranchId, + endpoint: `/tree/${this.currentBranchId}`, + force: true, + }); }) .catch(() => { this.submitCommitsLoading = false; @@ -86,19 +93,17 @@ export default { }); }, toggleCollapsed() { - this.collapsed = !this.collapsed; + this.setPanelCollapsedStatus({ + side: 'right', + collapsed: !this.rightPanelCollapsed, + }); }, }, };