diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-28 21:11:27 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-28 21:11:27 +0300 |
commit | e2b578805233659fed37300bbfa9435a4e880770 (patch) | |
tree | 4a6844a5d61a00b7cc9be0aab910fc3462d97ba8 | |
parent | 4abacac9af9ab869f6be50449345b07d7ed99af1 (diff) |
Add latest changes from gitlab-org/gitlab@master
30 files changed, 231 insertions, 80 deletions
@@ -355,7 +355,7 @@ group :development, :test do gem 'bullet', '~> 6.1.3' gem 'pry-byebug' gem 'pry-rails', '~> 0.3.9' - gem 'pry-shell', '~> 0.4.0' + gem 'pry-shell', '~> 0.5.0' gem 'awesome_print', require: false diff --git a/Gemfile.lock b/Gemfile.lock index ca0ffd6093f..dce696e4211 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -933,7 +933,7 @@ GEM pry (~> 0.13.0) pry-rails (0.3.9) pry (>= 0.10.4) - pry-shell (0.4.1) + pry-shell (0.5.0) pry (~> 0.13.0) tty-markdown tty-prompt @@ -1567,7 +1567,7 @@ DEPENDENCIES prometheus-client-mmap (~> 0.15.0) pry-byebug pry-rails (~> 0.3.9) - pry-shell (~> 0.4.0) + pry-shell (~> 0.5.0) puma (~> 5.3.1) puma_worker_killer (~> 0.3.1) rack (~> 2.2.3) diff --git a/app/assets/javascripts/repository/components/fork_suggestion.vue b/app/assets/javascripts/repository/components/fork_suggestion.vue new file mode 100644 index 00000000000..c266bea319b --- /dev/null +++ b/app/assets/javascripts/repository/components/fork_suggestion.vue @@ -0,0 +1,45 @@ +<script> +import { GlButton } from '@gitlab/ui'; +import { __ } from '~/locale'; + +export default { + i18n: { + message: __( + 'You can’t edit files directly in this project. Fork this project and submit a merge request with your changes.', + ), + fork: __('Fork'), + cancel: __('Cancel'), + }, + components: { + GlButton, + }, + props: { + forkPath: { + type: String, + required: true, + }, + }, +}; +</script> + +<template> + <div + class="gl-display-flex gl-justify-content-end gl-align-items-center gl-bg-gray-10 gl-px-5 gl-py-2 gl-border-1 gl-border-b-solid gl-border-gray-100" + > + <span class="gl-mr-6" data-testid="message">{{ $options.i18n.message }}</span> + + <gl-button + class="gl-mr-3" + category="secondary" + variant="confirm" + :href="forkPath" + data-testid="fork" + > + {{ $options.i18n.fork }} + </gl-button> + + <gl-button data-testid="cancel" @click="$emit('cancel')"> + {{ $options.i18n.cancel }} + </gl-button> + </div> +</template> diff --git a/app/assets/javascripts/vue_shared/security_reports/store/modules/sast/actions.js b/app/assets/javascripts/vue_shared/security_reports/store/modules/sast/actions.js index 4f92e181f9f..62a51abe038 100644 --- a/app/assets/javascripts/vue_shared/security_reports/store/modules/sast/actions.js +++ b/app/assets/javascripts/vue_shared/security_reports/store/modules/sast/actions.js @@ -1,3 +1,4 @@ +import { REPORT_TYPE_SAST } from '~/vue_shared/security_reports/constants'; import { fetchDiffData } from '../../utils'; import * as types from './mutation_types'; @@ -14,7 +15,7 @@ export const receiveDiffError = ({ commit }, response) => export const fetchDiff = ({ state, rootState, dispatch }) => { dispatch('requestDiff'); - return fetchDiffData(rootState, state.paths.diffEndpoint, 'sast') + return fetchDiffData(rootState, state.paths.diffEndpoint, REPORT_TYPE_SAST) .then((data) => { dispatch('receiveDiffSuccess', data); }) diff --git a/app/assets/javascripts/vue_shared/security_reports/store/modules/secret_detection/actions.js b/app/assets/javascripts/vue_shared/security_reports/store/modules/secret_detection/actions.js index e3ae5435f5d..722dcce3075 100644 --- a/app/assets/javascripts/vue_shared/security_reports/store/modules/secret_detection/actions.js +++ b/app/assets/javascripts/vue_shared/security_reports/store/modules/secret_detection/actions.js @@ -1,3 +1,4 @@ +import { REPORT_TYPE_SECRET_DETECTION } from '~/vue_shared/security_reports/constants'; import { fetchDiffData } from '../../utils'; import * as types from './mutation_types'; @@ -14,7 +15,7 @@ export const receiveDiffError = ({ commit }, response) => export const fetchDiff = ({ state, rootState, dispatch }) => { dispatch('requestDiff'); - return fetchDiffData(rootState, state.paths.diffEndpoint, 'secret_detection') + return fetchDiffData(rootState, state.paths.diffEndpoint, REPORT_TYPE_SECRET_DETECTION) .then((data) => { dispatch('receiveDiffSuccess', data); }) diff --git a/app/finders/error_tracking/errors_finder.rb b/app/finders/error_tracking/errors_finder.rb index d83a0c487e6..c361d6e2fc2 100644 --- a/app/finders/error_tracking/errors_finder.rb +++ b/app/finders/error_tracking/errors_finder.rb @@ -15,8 +15,7 @@ module ErrorTracking collection = by_status(collection) collection = sort(collection) - # Limit collection until pagination implemented. - limit(collection) + collection.keyset_paginate(cursor: params[:cursor], per_page: limit) end private @@ -39,9 +38,9 @@ module ErrorTracking params[:sort] ? collection.sort_by_attribute(params[:sort]) : collection.order_id_desc end - def limit(collection) + def limit # Restrict the maximum limit at 100 records. - collection.limit([(params[:limit] || 20).to_i, 100].min) + [(params[:limit] || 20).to_i, 100].min end end end diff --git a/app/services/error_tracking/list_issues_service.rb b/app/services/error_tracking/list_issues_service.rb index 86c7791e759..1979816b88d 100644 --- a/app/services/error_tracking/list_issues_service.rb +++ b/app/services/error_tracking/list_issues_service.rb @@ -76,16 +76,21 @@ module ErrorTracking filter_opts = { status: opts[:issue_status], sort: opts[:sort], - limit: opts[:limit] + limit: opts[:limit], + cursor: opts[:cursor] } errors = ErrorTracking::ErrorsFinder.new(current_user, project, filter_opts).execute + pagination = {} + pagination[:next] = { cursor: errors.cursor_for_next_page } if errors.has_next_page? + pagination[:previous] = { cursor: errors.cursor_for_previous_page } if errors.has_previous_page? + # We use the same response format as project_error_tracking_setting # method below for compatibility with existing code. { issues: errors.map(&:to_sentry_error), - pagination: {} + pagination: pagination } else project_error_tracking_setting.list_sentry_issues(**opts) diff --git a/config/feature_flags/development/infinitely_collapsible_sections.yml b/config/feature_flags/development/infinitely_collapsible_sections.yml index d0bf063c6f6..44f37c06d70 100644 --- a/config/feature_flags/development/infinitely_collapsible_sections.yml +++ b/config/feature_flags/development/infinitely_collapsible_sections.yml @@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/335297 milestone: '14.1' type: development group: group::pipeline execution -default_enabled: true +default_enabled: false diff --git a/config/feature_flags/development/usage_data_i_testing_test_case_parsed.yml b/config/feature_flags/development/usage_data_i_testing_test_case_parsed.yml deleted file mode 100644 index e6e3cd09c28..00000000000 --- a/config/feature_flags/development/usage_data_i_testing_test_case_parsed.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: usage_data_i_testing_test_case_parsed -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/41918 -rollout_issue_url: -milestone: '13.5' -type: development -group: group::testing -default_enabled: true diff --git a/db/migrate/20210928155022_improve_index_for_error_tracking.rb b/db/migrate/20210928155022_improve_index_for_error_tracking.rb new file mode 100644 index 00000000000..ec8427670d7 --- /dev/null +++ b/db/migrate/20210928155022_improve_index_for_error_tracking.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +class ImproveIndexForErrorTracking < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + + def up + add_concurrent_index :error_tracking_errors, %i(project_id status last_seen_at id), + order: { last_seen_at: :desc, id: :desc }, + name: 'index_et_errors_on_project_id_and_status_last_seen_at_id_desc' + + add_concurrent_index :error_tracking_errors, %i(project_id status first_seen_at id), + order: { first_seen_at: :desc, id: :desc }, + name: 'index_et_errors_on_project_id_and_status_first_seen_at_id_desc' + + add_concurrent_index :error_tracking_errors, %i(project_id status events_count id), + order: { events_count: :desc, id: :desc }, + name: 'index_et_errors_on_project_id_and_status_events_count_id_desc' + + remove_concurrent_index :error_tracking_errors, [:project_id, :status, :last_seen_at], name: 'index_et_errors_on_project_id_and_status_and_last_seen_at' + remove_concurrent_index :error_tracking_errors, [:project_id, :status, :first_seen_at], name: 'index_et_errors_on_project_id_and_status_and_first_seen_at' + remove_concurrent_index :error_tracking_errors, [:project_id, :status, :events_count], name: 'index_et_errors_on_project_id_and_status_and_events_count' + end + + def down + add_concurrent_index :error_tracking_errors, [:project_id, :status, :last_seen_at], name: 'index_et_errors_on_project_id_and_status_and_last_seen_at' + add_concurrent_index :error_tracking_errors, [:project_id, :status, :first_seen_at], name: 'index_et_errors_on_project_id_and_status_and_first_seen_at' + add_concurrent_index :error_tracking_errors, [:project_id, :status, :events_count], name: 'index_et_errors_on_project_id_and_status_and_events_count' + + remove_concurrent_index :error_tracking_errors, [:project_id, :status, :last_seen_at, :id], name: 'index_et_errors_on_project_id_and_status_last_seen_at_id_desc' + remove_concurrent_index :error_tracking_errors, [:project_id, :status, :first_seen_at, :id], name: 'index_et_errors_on_project_id_and_status_first_seen_at_id_desc' + remove_concurrent_index :error_tracking_errors, [:project_id, :status, :events_count, :id], name: 'index_et_errors_on_project_id_and_status_events_count_id_desc' + end +end diff --git a/db/schema_migrations/20210928155022 b/db/schema_migrations/20210928155022 new file mode 100644 index 00000000000..d953746413a --- /dev/null +++ b/db/schema_migrations/20210928155022 @@ -0,0 +1 @@ +41ea0971cd62ba43bf98c1901169e7bb8fcebe68025d947f26b0ccf6806c976e
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 7ace805e618..b9f69dd4437 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -25031,13 +25031,13 @@ CREATE UNIQUE INDEX index_escalation_rules_on_all_attributes ON incident_managem CREATE INDEX index_escalation_rules_on_user ON incident_management_escalation_rules USING btree (user_id); -CREATE INDEX index_et_errors_on_project_id_and_status_and_events_count ON error_tracking_errors USING btree (project_id, status, events_count); +CREATE INDEX index_et_errors_on_project_id_and_status_and_id ON error_tracking_errors USING btree (project_id, status, id); -CREATE INDEX index_et_errors_on_project_id_and_status_and_first_seen_at ON error_tracking_errors USING btree (project_id, status, first_seen_at); +CREATE INDEX index_et_errors_on_project_id_and_status_events_count_id_desc ON error_tracking_errors USING btree (project_id, status, events_count DESC, id DESC); -CREATE INDEX index_et_errors_on_project_id_and_status_and_id ON error_tracking_errors USING btree (project_id, status, id); +CREATE INDEX index_et_errors_on_project_id_and_status_first_seen_at_id_desc ON error_tracking_errors USING btree (project_id, status, first_seen_at DESC, id DESC); -CREATE INDEX index_et_errors_on_project_id_and_status_and_last_seen_at ON error_tracking_errors USING btree (project_id, status, last_seen_at); +CREATE INDEX index_et_errors_on_project_id_and_status_last_seen_at_id_desc ON error_tracking_errors USING btree (project_id, status, last_seen_at DESC, id DESC); CREATE INDEX index_events_on_action ON events USING btree (action); diff --git a/doc/administration/get_started.md b/doc/administration/get_started.md index 9798fb3b470..18e9264d6d7 100644 --- a/doc/administration/get_started.md +++ b/doc/administration/get_started.md @@ -128,7 +128,7 @@ The routine differs, depending on whether you deployed with Omnibus or the Helm When you backing up an Omnibus (single node) GitLab server, you can use a single Rake task. -Learn about [backing up Omnibus or Helm variations](../raketasks/backup_restore.md#back-up-gitlab). +Learn about [backing up Omnibus or Helm variations](../raketasks/backup_restore.md). This process backs up your entire instance, but does not back up the configuration files. Ensure those are backed up separately. Keep your configuration files and backup archives in a separate location to ensure the encryption keys are not kept with the encrypted data. diff --git a/doc/administration/logs.md b/doc/administration/logs.md index b3a6ce334c1..0af0143a704 100644 --- a/doc/administration/logs.md +++ b/doc/administration/logs.md @@ -1075,7 +1075,7 @@ GitLab also tracks [Prometheus metrics for Praefect](gitaly/#monitor-gitaly-clus For Omnibus installations, the backup log is located at `/var/log/gitlab/gitlab-rails/backup_json.log`. -This log is populated when a [GitLab backup is created](../raketasks/backup_restore.md#back-up-gitlab). You can use this log to understand how the backup process performed. +This log is populated when a [GitLab backup is created](../raketasks/backup_restore.md). You can use this log to understand how the backup process performed. ## Performance bar stats diff --git a/doc/administration/read_only_gitlab.md b/doc/administration/read_only_gitlab.md index cf45d3e15cf..2fbcb2a62e7 100644 --- a/doc/administration/read_only_gitlab.md +++ b/doc/administration/read_only_gitlab.md @@ -66,7 +66,7 @@ sudo gitlab-ctl start puma If you want to allow users to use the GitLab UI, then you'll need to ensure that the database is read-only: -1. Take a [GitLab backup](../raketasks/backup_restore.md#back-up-gitlab) +1. Take a [GitLab backup](../raketasks/backup_restore.md) in case things don't go as expected. 1. Enter PostgreSQL on the console as an administrator user: diff --git a/doc/api/group_import_export.md b/doc/api/group_import_export.md index 0a431cfdfbf..212a62516f1 100644 --- a/doc/api/group_import_export.md +++ b/doc/api/group_import_export.md @@ -57,8 +57,12 @@ GET /groups/:id/export/download | `id` | integer/string | yes | ID of the group owned by the authenticated user | ```shell -curl --header "PRIVATE-TOKEN: <your_access_token>" --remote-header-name \ - --remote-name "https://gitlab.example.com/api/v4/groups/1/export/download" +group=1 +token=secret +curl --request GET\ + --header "PRIVATE-TOKEN: ${token}" \ + --output download_group_${group}.tar.gz \ + "https://gitlab.example.com/api/v4/groups/${group}/export/download" ``` ```shell diff --git a/doc/ci/cloud_deployment/index.md b/doc/ci/cloud_deployment/index.md index 25b87366a30..408d68fb726 100644 --- a/doc/ci/cloud_deployment/index.md +++ b/doc/ci/cloud_deployment/index.md @@ -58,6 +58,9 @@ Some credentials are required to be able to run `aws` commands: | `AWS_SECRET_ACCESS_KEY` | Your Secret access key | | `AWS_DEFAULT_REGION` | Your region code | + NOTE: + When you create a variable it's set to be [protected by default](../variables/index.md#protect-a-cicd-variable). If you want to use the `aws` commands on branches or tags that are not protected, make sure to uncheck the **Protect variable** checkbox. + 1. You can now use `aws` commands in the `.gitlab-ci.yml` file of this project: ```yaml diff --git a/doc/install/aws/manual_install_aws.md b/doc/install/aws/manual_install_aws.md index 365edd213d5..2ad54a17715 100644 --- a/doc/install/aws/manual_install_aws.md +++ b/doc/install/aws/manual_install_aws.md @@ -748,7 +748,7 @@ Read more on configuring an ## Backup and restore -GitLab provides [a tool to back up](../../raketasks/backup_restore.md#back-up-gitlab) +GitLab provides [a tool to back up](../../raketasks/backup_restore.md) and restore its Git data, database, attachments, LFS objects, and so on. Some important things to know: diff --git a/doc/integration/mattermost/index.md b/doc/integration/mattermost/index.md index 4830f8ba84e..502dc262d10 100644 --- a/doc/integration/mattermost/index.md +++ b/doc/integration/mattermost/index.md @@ -175,7 +175,7 @@ sudo gitlab-psql -d mattermost_production ### Back up GitLab Mattermost -GitLab Mattermost is not included in the regular [Omnibus GitLab backup](../../raketasks/backup_restore.md#back-up-gitlab) Rake task. +GitLab Mattermost is not included in the regular [Omnibus GitLab backup](../../raketasks/backup_restore.md) Rake task. The general Mattermost [backup and disaster recovery](https://docs.mattermost.com/deploy/backup-disaster-recovery.html) documentation can be used as a guide on what needs to be backed up. diff --git a/doc/update/index.md b/doc/update/index.md index 90f3221553c..416841e319a 100644 --- a/doc/update/index.md +++ b/doc/update/index.md @@ -193,7 +193,7 @@ upgrade paths. | Target version | Your version | Supported upgrade path | Note | | -------------- | ------------ | ---------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | -| `14.1.2` | `13.9.2` | `13.9.2` -> `13.12.9` -> `14.0.7` -> `14.1.2` | Two intermediate versions are required: `13.12` and `14.0`, then `14.1`. | +| `14.1.6` | `13.9.2` | `13.9.2` -> `13.12.12` -> `14.0.11` -> `14.1.6` | Two intermediate versions are required: `13.12` and `14.0`, then `14.1`. | | `13.12.10` | `12.9.2` | `12.9.2` -> `12.10.14` -> `13.0.14` -> `13.1.11` -> `13.8.8` -> `13.12.10` | Four intermediate versions are required: `12.10`, `13.0`, `13.1` and `13.8.8`, then `13.12.10`. | | `13.2.10` | `11.5.0` | `11.5.0` -> `11.11.8` -> `12.0.12` -> `12.1.17` -> `12.10.14` -> `13.0.14` -> `13.1.11` -> `13.2.10` | Six intermediate versions are required: `11.11`, `12.0`, `12.1`, `12.10`, `13.0` and `13.1`, then `13.2.10`. | | `12.10.14` | `11.3.4` | `11.3.4` -> `11.11.8` -> `12.0.12` -> `12.1.17` -> `12.10.14` | Three intermediate versions are required: `11.11`, `12.0` and `12.1`, then `12.10.14`. | diff --git a/doc/update/package/downgrade.md b/doc/update/package/downgrade.md index 9a528f5ee44..96b17a7632b 100644 --- a/doc/update/package/downgrade.md +++ b/doc/update/package/downgrade.md @@ -12,7 +12,7 @@ of a package. WARNING: You must at least have a database backup created under the version you are downgrading to. Ideally, you should have a -[full backup archive](../../raketasks/backup_restore.md#back-up-gitlab) +[full backup archive](../../raketasks/backup_restore.md) on hand. The example below demonstrates the downgrade procedure when downgrading between minor diff --git a/doc/update/plan_your_upgrade.md b/doc/update/plan_your_upgrade.md index 406f8322218..1f1d49de14f 100644 --- a/doc/update/plan_your_upgrade.md +++ b/doc/update/plan_your_upgrade.md @@ -75,7 +75,7 @@ Create a backup of GitLab and all its data (database, repos, uploads, builds, artifacts, LFS objects, registry, pages). This is vital for making it possible to roll back GitLab to a working state if there's a problem with the upgrade: -- Create a [GitLab backup](../raketasks/backup_restore.md#back-up-gitlab). +- Create a [GitLab backup](../raketasks/backup_restore.md). Make sure to follow the instructions based on your installation method. Don't forget to back up the [secrets and configuration files](../raketasks/backup_restore.md#storing-configuration-files). - Alternatively, create a snapshot of your instance. If this is a multi-node diff --git a/doc/user/project/file_lock.md b/doc/user/project/file_lock.md index 5ffde38b348..db8c6f24063 100644 --- a/doc/user/project/file_lock.md +++ b/doc/user/project/file_lock.md @@ -49,7 +49,7 @@ This process allows you to lock single files or file extensions and it is done through the command line. It doesn't require GitLab paid subscriptions. Git LFS is well known for tracking files to reduce the storage of -Git repositories, but it can also be user for [locking files](https://github.com/git-lfs/git-lfs/wiki/File-Locking). +Git repositories, but it can also be used for [locking files](https://github.com/git-lfs/git-lfs/wiki/File-Locking). This is the method used for Exclusive File Locks. ### Install Git LFS diff --git a/doc/user/project/issues/managing_issues.md b/doc/user/project/issues/managing_issues.md index 7033b90b736..a2fa044be6b 100644 --- a/doc/user/project/issues/managing_issues.md +++ b/doc/user/project/issues/managing_issues.md @@ -212,7 +212,7 @@ that are not in status **closed** from one project to another. To access rails console run `sudo gitlab-rails console` on the GitLab server and run the below script. Please be sure to change `project`, `admin_user`, and `target_project` to your values. -We do also recommend [creating a backup](../../../raketasks/backup_restore.md#back-up-gitlab) before +We do also recommend [creating a backup](../../../raketasks/backup_restore.md) before attempting any changes in the console. ```ruby diff --git a/doc/user/project/quick_actions.md b/doc/user/project/quick_actions.md index 52b59d70302..45a83394c41 100644 --- a/doc/user/project/quick_actions.md +++ b/doc/user/project/quick_actions.md @@ -103,7 +103,7 @@ threads. Some quick actions might not be available to all subscription tiers. | `/target_branch <local branch name>` | **{dotted-circle}** No | **{check-circle}** Yes | **{dotted-circle}** No | Set target branch. | | `/title <new title>` | **{check-circle}** Yes | **{check-circle}** Yes | **{check-circle}** Yes | Change title. | | `/todo` | **{check-circle}** Yes | **{check-circle}** Yes | **{check-circle}** Yes | Add a to-do item. | -| `/unapprove` | **{dotted-circle}** No | **{check-circle}** Yes | **{dotted-circle}** No | Unapprove the merge request. ([introduced in GitLab 14.3](https://gitlab.com/gitlab-org/gitlab/-/issues/8003)| +| `/unapprove` | **{dotted-circle}** No | **{check-circle}** Yes | **{dotted-circle}** No | Unapprove the merge request. ([introduced in GitLab 14.3](https://gitlab.com/gitlab-org/gitlab/-/issues/8103)| | `/unassign @user1 @user2` | **{check-circle}** Yes | **{check-circle}** Yes | **{dotted-circle}** No | Remove specific assignees. | | `/unassign` | **{dotted-circle}** No | **{check-circle}** Yes | **{dotted-circle}** No | Remove all assignees. | | `/unassign_reviewer @user1 @user2` or `/remove_reviewer @user1 @user2` | **{dotted-circle}** No | **{check-circle}** Yes | **{dotted-circle}** No | Remove specific reviewers. | diff --git a/lib/gitlab/usage_data_counters/known_events/common.yml b/lib/gitlab/usage_data_counters/known_events/common.yml index 6c0a07d198f..dc1ce8fd08a 100644 --- a/lib/gitlab/usage_data_counters/known_events/common.yml +++ b/lib/gitlab/usage_data_counters/known_events/common.yml @@ -149,7 +149,6 @@ category: testing redis_slot: testing aggregation: weekly - feature_flag: usage_data_i_testing_test_case_parsed - name: i_testing_metrics_report_widget_total category: testing redis_slot: testing diff --git a/locale/gitlab.pot b/locale/gitlab.pot index a2ba826b491..a3bbf3a4d0e 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -38770,6 +38770,9 @@ msgstr "" msgid "You can’t %{tag_start}edit%{tag_end} files directly in this project. Fork this project and submit a merge request with your changes." msgstr "" +msgid "You can’t edit files directly in this project. Fork this project and submit a merge request with your changes." +msgstr "" + msgid "You could not create a new trigger." msgstr "" diff --git a/spec/finders/error_tracking/errors_finder_spec.rb b/spec/finders/error_tracking/errors_finder_spec.rb index 29053054f9d..66eb7769a4c 100644 --- a/spec/finders/error_tracking/errors_finder_spec.rb +++ b/spec/finders/error_tracking/errors_finder_spec.rb @@ -29,14 +29,25 @@ RSpec.describe ErrorTracking::ErrorsFinder do context 'with sort parameter' do let(:params) { { status: 'unresolved', sort: 'first_seen' } } - it { is_expected.to eq([error, error_yesterday]) } + it { expect(subject.to_a).to eq([error, error_yesterday]) } end - context 'with limit parameter' do + context 'pagination' do let(:params) { { limit: '1', sort: 'first_seen' } } # Sort by first_seen is DESC by default, so the most recent error is `error` it { is_expected.to contain_exactly(error) } + + it { expect(subject.has_next_page?).to be_truthy } + + it 'returns next page by cursor' do + params_with_cursor = params.merge(cursor: subject.cursor_for_next_page) + errors = described_class.new(user, project, params_with_cursor).execute + + expect(errors).to contain_exactly(error_resolved) + expect(errors.has_next_page?).to be_truthy + expect(errors.has_previous_page?).to be_truthy + end end end end diff --git a/spec/frontend/repository/components/fork_suggestion_spec.js b/spec/frontend/repository/components/fork_suggestion_spec.js new file mode 100644 index 00000000000..36a48a3fdb8 --- /dev/null +++ b/spec/frontend/repository/components/fork_suggestion_spec.js @@ -0,0 +1,44 @@ +import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; +import ForkSuggestion from '~/repository/components/fork_suggestion.vue'; + +const DEFAULT_PROPS = { forkPath: 'some_file.js/fork' }; + +describe('ForkSuggestion component', () => { + let wrapper; + + const createComponent = () => { + wrapper = shallowMountExtended(ForkSuggestion, { + propsData: { ...DEFAULT_PROPS }, + }); + }; + + beforeEach(() => createComponent()); + + afterEach(() => wrapper.destroy()); + + const { i18n } = ForkSuggestion; + const findMessage = () => wrapper.findByTestId('message'); + const findForkButton = () => wrapper.findByTestId('fork'); + const findCancelButton = () => wrapper.findByTestId('cancel'); + + it('renders a message', () => { + expect(findMessage().text()).toBe(i18n.message); + }); + + it('renders a Fork button', () => { + const forkButton = findForkButton(); + + expect(forkButton.text()).toBe(i18n.fork); + expect(forkButton.attributes('href')).toBe(DEFAULT_PROPS.forkPath); + }); + + it('renders a Cancel button', () => { + expect(findCancelButton().text()).toBe(i18n.cancel); + }); + + it('emits a cancel event when Cancel button is clicked', () => { + findCancelButton().vm.$emit('click'); + + expect(wrapper.emitted('cancel')).toEqual([[]]); + }); +}); diff --git a/spec/services/error_tracking/list_issues_service_spec.rb b/spec/services/error_tracking/list_issues_service_spec.rb index b49095ab8b9..a7bd6c75df5 100644 --- a/spec/services/error_tracking/list_issues_service_spec.rb +++ b/spec/services/error_tracking/list_issues_service_spec.rb @@ -5,56 +5,71 @@ require 'spec_helper' RSpec.describe ErrorTracking::ListIssuesService do include_context 'sentry error tracking context' - let(:params) { { search_term: 'something', sort: 'last_seen', cursor: 'some-cursor' } } - let(:list_sentry_issues_args) do - { - issue_status: 'unresolved', - limit: 20, - search_term: 'something', - sort: 'last_seen', - cursor: 'some-cursor' - } - end + let(:params) { {} } subject { described_class.new(project, user, params) } describe '#execute' do - context 'with authorized user' do - let(:issues) { [] } + context 'Sentry backend' do + let(:params) { { search_term: 'something', sort: 'last_seen', cursor: 'some-cursor' } } + + let(:list_sentry_issues_args) do + { + issue_status: 'unresolved', + limit: 20, + search_term: 'something', + sort: 'last_seen', + cursor: 'some-cursor' + } + end + + context 'with authorized user' do + let(:issues) { [] } + + described_class::ISSUE_STATUS_VALUES.each do |status| + it "returns the issues with #{status} issue_status" do + params[:issue_status] = status + list_sentry_issues_args[:issue_status] = status + expect_list_sentry_issues_with(list_sentry_issues_args) + + expect(result).to eq(status: :success, pagination: {}, issues: issues) + end + end - described_class::ISSUE_STATUS_VALUES.each do |status| - it "returns the issues with #{status} issue_status" do - params[:issue_status] = status - list_sentry_issues_args[:issue_status] = status + it 'returns the issues with no issue_status' do expect_list_sentry_issues_with(list_sentry_issues_args) expect(result).to eq(status: :success, pagination: {}, issues: issues) end - end - it 'returns the issues with no issue_status' do - expect_list_sentry_issues_with(list_sentry_issues_args) + it 'returns bad request for an issue_status not on the whitelist' do + params[:issue_status] = 'assigned' + + expect(error_tracking_setting).not_to receive(:list_sentry_issues) + expect(result).to eq(message: "Bad Request: Invalid issue_status", status: :error, http_status: :bad_request) + end - expect(result).to eq(status: :success, pagination: {}, issues: issues) + include_examples 'error tracking service data not ready', :list_sentry_issues + include_examples 'error tracking service sentry error handling', :list_sentry_issues + include_examples 'error tracking service http status handling', :list_sentry_issues end - it 'returns bad request for an issue_status not on the whitelist' do - params[:issue_status] = 'assigned' + include_examples 'error tracking service unauthorized user' + include_examples 'error tracking service disabled' - expect(error_tracking_setting).not_to receive(:list_sentry_issues) - expect(result).to eq(message: "Bad Request: Invalid issue_status", status: :error, http_status: :bad_request) + def expect_list_sentry_issues_with(list_sentry_issues_args) + expect(error_tracking_setting) + .to receive(:list_sentry_issues) + .with(list_sentry_issues_args) + .and_return(issues: [], pagination: {}) end - - include_examples 'error tracking service data not ready', :list_sentry_issues - include_examples 'error tracking service sentry error handling', :list_sentry_issues - include_examples 'error tracking service http status handling', :list_sentry_issues end - include_examples 'error tracking service unauthorized user' - include_examples 'error tracking service disabled' + context 'GitLab backend' do + let_it_be(:error1) { create(:error_tracking_error, name: 'foo', project: project) } + let_it_be(:error2) { create(:error_tracking_error, name: 'bar', project: project) } - context 'integrated error tracking' do - let_it_be(:error) { create(:error_tracking_error, project: project) } + let(:params) { { limit: '1' } } before do error_tracking_setting.update!(integrated: true) @@ -63,7 +78,9 @@ RSpec.describe ErrorTracking::ListIssuesService do it 'returns the error in expected format' do expect(result[:status]).to eq(:success) expect(result[:issues].size).to eq(1) - expect(result[:issues].first.to_json).to eq(error.to_sentry_error.to_json) + expect(result[:issues].first.to_json).to eq(error2.to_sentry_error.to_json) + expect(result[:pagination][:next][:cursor]).to be_present + expect(result[:pagination][:previous]).to be_nil end end end @@ -76,10 +93,3 @@ RSpec.describe ErrorTracking::ListIssuesService do end end end - -def expect_list_sentry_issues_with(list_sentry_issues_args) - expect(error_tracking_setting) - .to receive(:list_sentry_issues) - .with(list_sentry_issues_args) - .and_return(issues: [], pagination: {}) -end |