Skip to content

Commit

Permalink
Add latest changes from gitlab-org/gitlab@master
Browse files Browse the repository at this point in the history
  • Loading branch information
GitLab Bot committed Nov 20, 2020
1 parent 13cacc2 commit d2add03
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 89 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/gfm_auto_complete.js
Expand Up @@ -42,7 +42,7 @@ export function membersBeforeSave(members) {
title: sanitize(title),
search: sanitize(`${member.username} ${member.name}`),
icon: avatarIcon,
availability: member.availability,
availability: member?.availability,
};
});
}
Expand Down
@@ -1,7 +1,6 @@
<script>
import { isNumber } from 'lodash';
import ArtifactsApp from './artifacts_list_app.vue';
import Deployment from './deployment/deployment.vue';
import MrWidgetContainer from './mr_widget_container.vue';
import MrWidgetPipeline from './mr_widget_pipeline.vue';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
Expand All @@ -18,7 +17,7 @@ export default {
name: 'MrWidgetPipelineContainer',
components: {
ArtifactsApp,
Deployment,
Deployment: () => import('./deployment/deployment.vue'),
MrWidgetContainer,
MrWidgetPipeline,
MergeTrainPositionIndicator: () =>
Expand Down
Expand Up @@ -16,7 +16,6 @@ import WidgetHeader from './components/mr_widget_header.vue';
import WidgetSuggestPipeline from './components/mr_widget_suggest_pipeline.vue';
import WidgetMergeHelp from './components/mr_widget_merge_help.vue';
import MrWidgetPipelineContainer from './components/mr_widget_pipeline_container.vue';
import Deployment from './components/deployment/deployment.vue';
import WidgetRelatedLinks from './components/mr_widget_related_links.vue';
import MrWidgetAlertMessage from './components/mr_widget_alert_message.vue';
import MergedState from './components/states/mr_widget_merged.vue';
Expand Down Expand Up @@ -63,7 +62,6 @@ export default {
'mr-widget-suggest-pipeline': WidgetSuggestPipeline,
'mr-widget-merge-help': WidgetMergeHelp,
MrWidgetPipelineContainer,
Deployment,
'mr-widget-related-links': WidgetRelatedLinks,
MrWidgetAlertMessage,
'mr-widget-merged': MergedState,
Expand Down
3 changes: 2 additions & 1 deletion app/services/concerns/users/participable_service.rb
Expand Up @@ -46,8 +46,9 @@ def user_as_hash(user)
username: user.username,
name: user.name,
avatar_url: user.avatar_url,
availability: user&.status&.availability
availability: nil
}
# Return nil for availability for now due to https://gitlab.com/gitlab-org/gitlab/-/issues/285442
end

def group_as_hash(group, group_counts)
Expand Down
2 changes: 1 addition & 1 deletion config/object_store_settings.rb
Expand Up @@ -132,7 +132,7 @@ def parse!

# If a storage type such as Pages defines its own connection and does not
# use Workhorse acceleration, we allow it to override the consolidated form.
next if allowed_storage_specific_settings?(store_type, section)
next if allowed_storage_specific_settings?(store_type, section.to_h)

# Map bucket (external name) -> remote_directory (internal representation)
target_config['remote_directory'] = target_config.delete('bucket')
Expand Down
69 changes: 68 additions & 1 deletion lib/bulk_imports/pipeline.rb
Expand Up @@ -3,10 +3,77 @@
module BulkImports
module Pipeline
extend ActiveSupport::Concern
include Gitlab::ClassAttributes

included do
include Attributes
include Runner

private

def extractors
@extractors ||= self.class.extractors.map(&method(:instantiate))
end

def transformers
@transformers ||= self.class.transformers.map(&method(:instantiate))
end

def loaders
@loaders ||= self.class.loaders.map(&method(:instantiate))
end

def after_run
@after_run ||= self.class.after_run_callback
end

def pipeline_name
@pipeline ||= self.class.name
end

def instantiate(class_config)
class_config[:klass].new(class_config[:options])
end
end

class_methods do
def extractor(klass, options = nil)
add_attribute(:extractors, klass, options)
end

def transformer(klass, options = nil)
add_attribute(:transformers, klass, options)
end

def loader(klass, options = nil)
add_attribute(:loaders, klass, options)
end

def after_run(&block)
class_attributes[:after_run] = block
end

def extractors
class_attributes[:extractors]
end

def transformers
class_attributes[:transformers]
end

def loaders
class_attributes[:loaders]
end

def after_run_callback
class_attributes[:after_run]
end

private

def add_attribute(sym, klass, options)
class_attributes[sym] ||= []
class_attributes[sym] << { klass: klass, options: options }
end
end
end
end
49 changes: 0 additions & 49 deletions lib/bulk_imports/pipeline/attributes.rb

This file was deleted.

28 changes: 0 additions & 28 deletions lib/bulk_imports/pipeline/runner.rb
Expand Up @@ -5,34 +5,6 @@ module Pipeline
module Runner
extend ActiveSupport::Concern

included do
private

def extractors
@extractors ||= self.class.extractors.map(&method(:instantiate))
end

def transformers
@transformers ||= self.class.transformers.map(&method(:instantiate))
end

def loaders
@loaders ||= self.class.loaders.map(&method(:instantiate))
end

def after_run
@after_run ||= self.class.after_run_callback
end

def pipeline_name
@pipeline ||= self.class.name
end

def instantiate(class_config)
class_config[:klass].new(class_config[:options])
end
end

def run(context)
info(context, message: "Pipeline started", pipeline: pipeline_name)

Expand Down
1 change: 1 addition & 0 deletions rubocop/rubocop-migrations.yml
Expand Up @@ -35,6 +35,7 @@ Migration/UpdateLargeTable:
- :taggings
- :todos
- :users
- :user_preferences
- :web_hook_logs
DeniedMethods:
- :change_column_type_concurrently
Expand Down
Expand Up @@ -72,7 +72,6 @@

describe 'pipeline parts' do
it { expect(described_class).to include_module(BulkImports::Pipeline) }
it { expect(described_class).to include_module(BulkImports::Pipeline::Attributes) }
it { expect(described_class).to include_module(BulkImports::Pipeline::Runner) }

it 'has extractors' do
Expand Down
Expand Up @@ -55,7 +55,6 @@

describe 'pipeline parts' do
it { expect(described_class).to include_module(BulkImports::Pipeline) }
it { expect(described_class).to include_module(BulkImports::Pipeline::Attributes) }
it { expect(described_class).to include_module(BulkImports::Pipeline::Runner) }

it 'has extractors' do
Expand Down
Expand Up @@ -2,15 +2,15 @@

require 'spec_helper'

RSpec.describe BulkImports::Pipeline::Attributes do
RSpec.describe BulkImports::Pipeline do
describe 'pipeline attributes' do
before do
stub_const('BulkImports::Extractor', Class.new)
stub_const('BulkImports::Transformer', Class.new)
stub_const('BulkImports::Loader', Class.new)

klass = Class.new do
include BulkImports::Pipeline::Attributes
include BulkImports::Pipeline

extractor BulkImports::Extractor, { foo: :bar }
transformer BulkImports::Transformer, { foo: :bar }
Expand Down

0 comments on commit d2add03

Please sign in to comment.