From 0dea53d5e575c6c15ce7384da73b8d4a95b1c8cf Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 11 Oct 2019 09:06:43 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- app/assets/javascripts/notebook/cells/code.vue | 1 + .../javascripts/notebook/cells/code/index.vue | 12 ++- .../javascripts/notebook/cells/output/index.vue | 5 + app/assets/javascripts/pager.js | 4 + app/assets/stylesheets/framework/files.scss | 5 + .../instance_configuration/_ssh_info.html.haml | 27 ++++-- bin/secpick | 2 +- .../sh-disable-pager-on-small-counts.yml | 5 + .../user-friendly-instance-configuration.yml | 5 + doc/user/project/pages/introduction.md | 5 - lib/gitlab/tracking.rb | 11 +++ locale/gitlab.pot | 27 ++++++ package.json | 4 +- .../3_create/repository/add_file_template_spec.rb | 6 +- spec/javascripts/pager_spec.js | 20 +++- spec/lib/gitlab/tracking_spec.rb | 101 +++++++++++++++------ yarn.lock | 18 ++-- 17 files changed, 197 insertions(+), 61 deletions(-) create mode 100644 changelogs/unreleased/sh-disable-pager-on-small-counts.yml create mode 100644 changelogs/unreleased/user-friendly-instance-configuration.yml diff --git a/app/assets/javascripts/notebook/cells/code.vue b/app/assets/javascripts/notebook/cells/code.vue index eefc801ed7a..1782e5bfe5a 100644 --- a/app/assets/javascripts/notebook/cells/code.vue +++ b/app/assets/javascripts/notebook/cells/code.vue @@ -49,6 +49,7 @@ export default { v-if="hasOutput" :count="cell.execution_count" :outputs="outputs" + :metadata="cell.metadata" :code-css-class="codeCssClass" /> diff --git a/app/assets/javascripts/notebook/cells/code/index.vue b/app/assets/javascripts/notebook/cells/code/index.vue index 98b6cdd0944..470d8c87d59 100644 --- a/app/assets/javascripts/notebook/cells/code/index.vue +++ b/app/assets/javascripts/notebook/cells/code/index.vue @@ -26,6 +26,10 @@ export default { type: String, required: true, }, + metadata: { + type: Object, + default: () => ({}), + }, }, computed: { code() { @@ -36,6 +40,12 @@ export default { return type.charAt(0).toUpperCase() + type.slice(1); }, + cellCssClass() { + return { + [this.codeCssClass]: true, + 'jupyter-notebook-scrolled': this.metadata.scrolled, + }; + }, }, mounted() { Prism.highlightElement(this.$refs.code); @@ -46,6 +56,6 @@ export default { diff --git a/app/assets/javascripts/notebook/cells/output/index.vue b/app/assets/javascripts/notebook/cells/output/index.vue index b59ddd0d57a..d8b0e099bc4 100644 --- a/app/assets/javascripts/notebook/cells/output/index.vue +++ b/app/assets/javascripts/notebook/cells/output/index.vue @@ -19,6 +19,10 @@ export default { type: Array, required: true, }, + metadata: { + type: Object, + default: () => ({}), + }, }, methods: { outputType(output) { @@ -78,6 +82,7 @@ export default { :count="count" :index="index" :raw-code="rawCode(output)" + :metadata="metadata" :code-css-class="codeCssClass" /> diff --git a/app/assets/javascripts/pager.js b/app/assets/javascripts/pager.js index 386a9b2c740..46e80ba72e3 100644 --- a/app/assets/javascripts/pager.js +++ b/app/assets/javascripts/pager.js @@ -56,6 +56,10 @@ export default { $('.content_list').append(html); if (count > 0) { this.offset += count; + + if (count < this.limit) { + this.disable = true; + } } else { this.disable = true; } diff --git a/app/assets/stylesheets/framework/files.scss b/app/assets/stylesheets/framework/files.scss index 536a26a6ffe..b793a12317e 100644 --- a/app/assets/stylesheets/framework/files.scss +++ b/app/assets/stylesheets/framework/files.scss @@ -479,3 +479,8 @@ span.idiff { padding: $gl-padding; } } + +.jupyter-notebook-scrolled { + overflow-y: auto; + max-height: 20rem; +} diff --git a/app/views/help/instance_configuration/_ssh_info.html.haml b/app/views/help/instance_configuration/_ssh_info.html.haml index 987cc61b3f6..a7ee37b2784 100644 --- a/app/views/help/instance_configuration/_ssh_info.html.haml +++ b/app/views/help/instance_configuration/_ssh_info.html.haml @@ -1,22 +1,29 @@ - ssh_info = @instance_configuration.settings[:ssh_algorithms_hashes] -- if ssh_info.any? - - content_for :table_content do - %li= link_to 'SSH host keys fingerprints', '#ssh-host-keys-fingerprints' +- content_for :table_content do + %li + = link_to _('SSH host key fingerprints'), '#ssh-host-keys-fingerprints' - - content_for :settings_content do - %h2#ssh-host-keys-fingerprints - SSH host keys fingerprints +- content_for :settings_content do + %h2#ssh-host-keys-fingerprints + = _('SSH host key fingerprints') + - if ssh_info.blank? %p - Below are the fingerprints for the current instance SSH host keys. + = _('SSH host keys are not available on this system. Please use ssh-keyscan command or contact your GitLab administrator for more information.').html_safe + - else + %p + = _('Below are the fingerprints for the current instance SSH host keys.') .table-responsive %table %thead %tr - %th Algorithm - %th MD5 - %th SHA256 + %th + = _('Algorithm') + %th + = _('MD5') + %th + = _('SHA256') %tbody - ssh_info.each do |algorithm| %tr diff --git a/bin/secpick b/bin/secpick index 8a61356a088..a44867846d0 100755 --- a/bin/secpick +++ b/bin/secpick @@ -20,7 +20,7 @@ module Secpick end def ee? - File.exist?('./CHANGELOG-EE.md') + File.exist?('./ee/app/models/license.rb') end def dry_run? diff --git a/changelogs/unreleased/sh-disable-pager-on-small-counts.yml b/changelogs/unreleased/sh-disable-pager-on-small-counts.yml new file mode 100644 index 00000000000..1d86d9aaf94 --- /dev/null +++ b/changelogs/unreleased/sh-disable-pager-on-small-counts.yml @@ -0,0 +1,5 @@ +--- +title: Fix erroneous "No activities found" message +merge_request: 18434 +author: +type: fixed diff --git a/changelogs/unreleased/user-friendly-instance-configuration.yml b/changelogs/unreleased/user-friendly-instance-configuration.yml new file mode 100644 index 00000000000..07a0250dff9 --- /dev/null +++ b/changelogs/unreleased/user-friendly-instance-configuration.yml @@ -0,0 +1,5 @@ +--- +title: Make instance configuration user friendly +merge_request: 18363 +author: Takuya Noguchi +type: other diff --git a/doc/user/project/pages/introduction.md b/doc/user/project/pages/introduction.md index 1147fa16333..86257e2aa03 100644 --- a/doc/user/project/pages/introduction.md +++ b/doc/user/project/pages/introduction.md @@ -71,11 +71,6 @@ don't have to create and edit HTML files manually. For example, Jekyll has the > [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/issues/33422) in GitLab 11.5. -NOTE: **Note:** -GitLab Pages access control is not activated on GitLab.com. You can check its -progress on the -[infrastructure issue tracker](https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/5576). - You can enable Pages access control on your project, so that only [members of your project](../../permissions.md#project-members-permissions) (at least Guest) can access your website: diff --git a/lib/gitlab/tracking.rb b/lib/gitlab/tracking.rb index 34eaf45aa75..2470685bc00 100644 --- a/lib/gitlab/tracking.rb +++ b/lib/gitlab/tracking.rb @@ -15,6 +15,10 @@ module Gitlab category = args.delete(:category) || self.class.name Gitlab::Tracking.event(category, action.to_s, **args) end + + def track_self_describing_event(schema_url, event_data_json, **args) + Gitlab::Tracking.self_describing_event(schema_url, event_data_json, **args) + end end class << self @@ -28,6 +32,13 @@ module Gitlab snowplow.track_struct_event(category, action, label, property, value, context, Time.now.to_i) end + def self_describing_event(schema_url, event_data_json, context: nil) + return unless enabled? + + event_json = SnowplowTracker::SelfDescribingJson.new(schema_url, event_data_json) + snowplow.track_self_describing_event(event_json, context, Time.now.to_i) + end + def snowplow_options(group) additional_features = Feature.enabled?(:additional_snowplow_tracking, group) { diff --git a/locale/gitlab.pot b/locale/gitlab.pot index b69867f117a..c3c1b551b50 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -1323,6 +1323,9 @@ msgstr "" msgid "Alerts endpoint" msgstr "" +msgid "Algorithm" +msgstr "" + msgid "All" msgstr "" @@ -2358,6 +2361,9 @@ msgstr "" msgid "Below are examples of regex for existing tools:" msgstr "" +msgid "Below are the fingerprints for the current instance SSH host keys." +msgstr "" + msgid "Below you will find all the groups that are public." msgstr "" @@ -3999,6 +4005,9 @@ msgstr "" msgid "Code" msgstr "" +msgid "Code Analytics" +msgstr "" + msgid "Code Owners" msgstr "" @@ -8524,6 +8533,12 @@ msgstr "" msgid "Identifier" msgstr "" +msgid "Identify areas of the codebase associated with a lot of churn, which can indicate potential code hotspots." +msgstr "" + +msgid "Identify the most frequently changed files in your repository" +msgstr "" + msgid "Identities" msgstr "" @@ -9707,6 +9722,9 @@ msgstr "" msgid "Logs" msgstr "" +msgid "MD5" +msgstr "" + msgid "MERGED" msgstr "" @@ -13912,6 +13930,9 @@ msgstr "" msgid "SAML for %{group_name}" msgstr "" +msgid "SHA256" +msgstr "" + msgid "SSH Key" msgstr "" @@ -13921,9 +13942,15 @@ msgstr "" msgid "SSH Keys Help" msgstr "" +msgid "SSH host key fingerprints" +msgstr "" + msgid "SSH host keys" msgstr "" +msgid "SSH host keys are not available on this system. Please use ssh-keyscan command or contact your GitLab administrator for more information." +msgstr "" + msgid "SSH keys allow you to establish a secure connection between your computer and GitLab." msgstr "" diff --git a/package.json b/package.json index 4c11d971e3e..29fb22d4caa 100644 --- a/package.json +++ b/package.json @@ -37,8 +37,8 @@ "@babel/plugin-syntax-dynamic-import": "^7.2.0", "@babel/plugin-syntax-import-meta": "^7.2.0", "@babel/preset-env": "^7.6.2", - "@gitlab/svgs": "^1.76.0", - "@gitlab/ui": "5.27.0", + "@gitlab/svgs": "^1.78.0", + "@gitlab/ui": "5.32.0", "@gitlab/visual-review-tools": "1.0.3", "apollo-cache-inmemory": "^1.5.1", "apollo-client": "^2.5.1", diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/add_file_template_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/add_file_template_spec.rb index c4a6ce13f4c..5b4ffadf0ff 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/add_file_template_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/add_file_template_spec.rb @@ -57,12 +57,10 @@ module QA @project.visit! Page::Project::Show.perform(&:create_new_file!) - Page::File::Form.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName - page.select_template template[:file_name], template[:name] + Page::File::Form.perform do |form| + form.select_template template[:file_name], template[:name] end - expect(page).to have_content('Template applied') - expect(page).to have_button('Undo') expect(page).to have_content(content[0..100]) Page::File::Form.perform(&:commit_changes) diff --git a/spec/javascripts/pager_spec.js b/spec/javascripts/pager_spec.js index 93efc139254..c95a8400c6c 100644 --- a/spec/javascripts/pager_spec.js +++ b/spec/javascripts/pager_spec.js @@ -63,9 +63,9 @@ describe('pager', () => { describe('getOld', () => { const urlRegex = /(.*)some_list(.*)$/; - function mockSuccess() { + function mockSuccess(count = 0) { axiosMock.onGet(urlRegex).reply(200, { - count: 0, + count, html: '', }); } @@ -142,5 +142,21 @@ describe('pager', () => { done(); }); }); + + it('disables if return count is less than limit', done => { + Pager.offset = 0; + Pager.limit = 20; + + mockSuccess(1); + spyOn(Pager.loading, 'hide'); + Pager.getOld(); + + setTimeout(() => { + expect(Pager.loading.hide).toHaveBeenCalled(); + expect(Pager.disable).toBe(true); + + done(); + }); + }); }); }); diff --git a/spec/lib/gitlab/tracking_spec.rb b/spec/lib/gitlab/tracking_spec.rb index 6891349a1dc..50488dba48c 100644 --- a/spec/lib/gitlab/tracking_spec.rb +++ b/spec/lib/gitlab/tracking_spec.rb @@ -12,10 +12,8 @@ describe Gitlab::Tracking do end describe '.snowplow_options' do - subject(&method(:described_class)) - it 'returns useful client options' do - expect(subject.snowplow_options(nil)).to eq( + expect(described_class.snowplow_options(nil)).to eq( namespace: 'gl', hostname: 'gitfoo.com', cookieDomain: '.gitfoo.com', @@ -32,23 +30,35 @@ describe Gitlab::Tracking do '_group_' ).and_return(false) - expect(subject.snowplow_options('_group_')).to include( + expect(described_class.snowplow_options('_group_')).to include( formTracking: false, linkClickTracking: false ) end end - describe '.event' do - subject(&method(:described_class)) + describe 'tracking events' do + shared_examples 'events not tracked' do + it 'does not track events' do + stub_application_setting(snowplow_enabled: false) + expect(SnowplowTracker::AsyncEmitter).not_to receive(:new) + expect(SnowplowTracker::Tracker).not_to receive(:new) + + track_event + end + end around do |example| Timecop.freeze(timestamp) { example.run } end - it 'can track events' do - tracker = double + before do + described_class.instance_variable_set("@snowplow", nil) + end + let(:tracker) { double } + + def receive_events expect(SnowplowTracker::AsyncEmitter).to receive(:new).with( 'gitfoo.com', { protocol: 'https' } ).and_return('_emitter_') @@ -59,30 +69,67 @@ describe Gitlab::Tracking do 'gl', '_abc123_' ).and_return(tracker) + end - expect(tracker).to receive(:track_struct_event).with( - 'category', - 'action', - '_label_', - '_property_', - '_value_', - '_context_', - timestamp.to_i - ) + describe '.event' do + let(:track_event) do + described_class.event('category', 'action', + label: '_label_', + property: '_property_', + value: '_value_', + context: nil + ) + end - subject.event('category', 'action', - label: '_label_', - property: '_property_', - value: '_value_', - context: '_context_' - ) + it_behaves_like 'events not tracked' + + it 'can track events' do + receive_events + expect(tracker).to receive(:track_struct_event).with( + 'category', + 'action', + '_label_', + '_property_', + '_value_', + nil, + timestamp.to_i + ) + + track_event + end end - it 'does not track when not enabled' do - stub_application_setting(snowplow_enabled: false) - expect(SnowplowTracker::Tracker).not_to receive(:new) + describe '.self_describing_event' do + let(:track_event) do + described_class.self_describing_event('iglu:com.gitlab/example/jsonschema/1-0-2', + { + foo: 'bar', + foo_count: 42 + }, + context: nil + ) + end + + it_behaves_like 'events not tracked' + + it 'can track self describing events' do + receive_events + expect(SnowplowTracker::SelfDescribingJson).to receive(:new).with( + 'iglu:com.gitlab/example/jsonschema/1-0-2', + { + foo: 'bar', + foo_count: 42 + } + ).and_return('_event_json_') + + expect(tracker).to receive(:track_self_describing_event).with( + '_event_json_', + nil, + timestamp.to_i + ) - subject.event('epics', 'action', property: 'what', value: 'doit') + track_event + end end end end diff --git a/yarn.lock b/yarn.lock index 58e229ec569..45375114d43 100644 --- a/yarn.lock +++ b/yarn.lock @@ -990,15 +990,15 @@ dependencies: vue-eslint-parser "^6.0.4" -"@gitlab/svgs@^1.76.0": - version "1.76.0" - resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-1.76.0.tgz#2def3b5542d23259e81c889c75059a5d1f1e3f61" - integrity sha512-wTCNSq3CxNrEzrJdEbf8GwHfhzEsUMJNEuGTBGGhe1qc0sY5z/U3s3HG7tdAOrB5pec9JarRXzc7g5ax9bsopQ== - -"@gitlab/ui@5.27.0": - version "5.27.0" - resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-5.27.0.tgz#2c65ed2612b2089a9445aaf9f303701efaf2a3a7" - integrity sha512-/tqVKlpepl423jpM6ZK95kkn3urS48873ZFeJFtf69mqRmHtVMB9GR4Fz99OyOR252Fpa7XTHx0dVxb5kKs+xA== +"@gitlab/svgs@^1.78.0": + version "1.78.0" + resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-1.78.0.tgz#469493bd6cdd254eb5d1271edeab22bbbee2f4c4" + integrity sha512-dBgEB/Q4FRD0NapmNrD86DF1FsV0uSgTx0UOJloHnGE2DNR2P1HQrCmLW2fX+QgN4P9CDAzdi2buVHuholofWw== + +"@gitlab/ui@5.32.0": + version "5.32.0" + resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-5.32.0.tgz#21bb70b6c8b68bdcbb53ffebde80ff3cd93851c8" + integrity sha512-xTFz4/WbR1e6zj2xI2DULcAGicA6qidb9Reoa02V5snqWcQY+iHDup/XzgXmttTPCiBlqPIFo/CMhH4gSJWuPQ== dependencies: "@babel/standalone" "^7.0.0" "@gitlab/vue-toasted" "^1.2.1" -- cgit v1.2.3