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 May 20, 2020
1 parent f781b0b commit 1902e25
Show file tree
Hide file tree
Showing 35 changed files with 254 additions and 112 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/scripts/
/tmp/
/vendor/
jest.config.js
jest.config.*.js
karma.config.js
webpack.config.js
4 changes: 0 additions & 4 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -354,19 +354,15 @@ RSpec/LeakyConstantDeclaration:
- 'spec/lib/gitlab/ci/config/entry/retry_spec.rb'
- 'spec/lib/gitlab/cluster/mixins/puma_cluster_spec.rb'
- 'spec/lib/gitlab/cluster/mixins/unicorn_http_server_spec.rb'
- 'spec/lib/gitlab/config/entry/factory_spec.rb'
- 'spec/lib/gitlab/config/entry/simplifiable_spec.rb'
- 'spec/lib/gitlab/database/migration_helpers_spec.rb'
- 'spec/lib/gitlab/database/obsolete_ignored_columns_spec.rb'
- 'spec/lib/gitlab/database/with_lock_retries_spec.rb'
- 'spec/lib/gitlab/git/diff_collection_spec.rb'
- 'spec/lib/gitlab/import_export/import_test_coverage_spec.rb'
- 'spec/lib/gitlab/import_export/project/relation_factory_spec.rb'
- 'spec/lib/gitlab/jira_import/issues_importer_spec.rb'
- 'spec/lib/gitlab/no_cache_headers_spec.rb'
- 'spec/lib/gitlab/path_regex_spec.rb'
- 'spec/lib/gitlab/quick_actions/dsl_spec.rb'
- 'spec/lib/gitlab/sidekiq_middleware/server_metrics_spec.rb'
- 'spec/lib/marginalia_spec.rb'
- 'spec/mailers/notify_spec.rb'
- 'spec/migrations/20191125114345_add_admin_mode_protected_path_spec.rb'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ document.addEventListener(
ciLintPath: this.dataset.ciLintPath,
resetCachePath: this.dataset.resetCachePath,
projectId: this.dataset.projectId,
params: JSON.parse(this.dataset.params),
},
});
},
Expand Down
14 changes: 12 additions & 2 deletions app/assets/javascripts/pipelines/components/pipelines.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import { isEqual } from 'lodash';
import { isEqual, pickBy } from 'lodash';
import { __, sprintf, s__ } from '../../locale';
import createFlash from '../../flash';
import PipelinesService from '../services/pipelines_service';
Expand All @@ -10,7 +10,7 @@ import NavigationControls from './nav_controls.vue';
import { getParameterByName } from '../../lib/utils/common_utils';
import CIPaginationMixin from '../../vue_shared/mixins/ci_pagination_api_mixin';
import PipelinesFilteredSearch from './pipelines_filtered_search.vue';
import { ANY_TRIGGER_AUTHOR, RAW_TEXT_WARNING } from '../constants';
import { ANY_TRIGGER_AUTHOR, RAW_TEXT_WARNING, SUPPORTED_FILTER_PARAMETERS } from '../constants';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
export default {
Expand Down Expand Up @@ -86,6 +86,10 @@ export default {
type: String,
required: true,
},
params: {
type: Object,
required: true,
},
},
data() {
return {
Expand Down Expand Up @@ -220,10 +224,15 @@ export default {
canFilterPipelines() {
return this.glFeatures.filterPipelinesSearch;
},
validatedParams() {
return pickBy(this.params, (val, key) => SUPPORTED_FILTER_PARAMETERS.includes(key) && val);
},
},
created() {
this.service = new PipelinesService(this.endpoint);
this.requestData = { page: this.page, scope: this.scope };
Object.assign(this.requestData, this.validatedParams);
},
methods: {
successCallback(resp) {
Expand Down Expand Up @@ -306,6 +315,7 @@ export default {
v-if="canFilterPipelines"
:pipelines="state.pipelines"
:project-id="projectId"
:params="validatedParams"
@filterPipelines="filterPipelines"
/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import { GlFilteredSearch } from '@gitlab/ui';
import { __, s__ } from '~/locale';
import PipelineTriggerAuthorToken from './tokens/pipeline_trigger_author_token.vue';
import PipelineBranchNameToken from './tokens/pipeline_branch_name_token.vue';
import Api from '~/api';
import createFlash from '~/flash';
import { FETCH_AUTHOR_ERROR_MESSAGE, FETCH_BRANCH_ERROR_MESSAGE } from '../constants';
import { map } from 'lodash';
export default {
components: {
Expand All @@ -20,12 +18,10 @@ export default {
type: String,
required: true,
},
},
data() {
return {
projectUsers: null,
projectBranches: null,
};
params: {
type: Object,
required: true,
},
},
computed: {
tokens() {
Expand All @@ -37,7 +33,6 @@ export default {
unique: true,
token: PipelineTriggerAuthorToken,
operators: [{ value: '=', description: __('is'), default: 'true' }],
triggerAuthors: this.projectUsers,
projectId: this.projectId,
},
{
Expand All @@ -47,30 +42,16 @@ export default {
unique: true,
token: PipelineBranchNameToken,
operators: [{ value: '=', description: __('is'), default: 'true' }],
branches: this.projectBranches,
projectId: this.projectId,
},
];
},
},
created() {
Api.projectUsers(this.projectId)
.then(users => {
this.projectUsers = users;
})
.catch(err => {
createFlash(FETCH_AUTHOR_ERROR_MESSAGE);
throw err;
});
Api.branches(this.projectId)
.then(({ data }) => {
this.projectBranches = data.map(branch => branch.name);
})
.catch(err => {
createFlash(FETCH_BRANCH_ERROR_MESSAGE);
throw err;
});
paramsValue() {
return map(this.params, (val, key) => ({
type: key,
value: { data: val, operator: '=' },
}));
},
},
methods: {
onSubmit(filters) {
Expand All @@ -85,6 +66,7 @@ export default {
<gl-filtered-search
:placeholder="__('Filter pipelines')"
:available-tokens="tokens"
:value="paramsValue"
@submit="onSubmit"
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,18 @@ export default {
},
data() {
return {
branches: this.config.branches,
branches: null,
loading: true,
};
},
created() {
this.fetchBranches();
},
methods: {
fetchBranchBySearchTerm(searchTerm) {
Api.branches(this.config.projectId, searchTerm)
.then(res => {
this.branches = res.data.map(branch => branch.name);
fetchBranches(searchterm) {
Api.branches(this.config.projectId, searchterm)
.then(({ data }) => {
this.branches = data.map(branch => branch.name);
this.loading = false;
})
.catch(err => {
Expand All @@ -41,7 +44,7 @@ export default {
});
},
searchBranches: debounce(function debounceSearch({ data }) {
this.fetchBranchBySearchTerm(data);
this.fetchBranches(data);
}, FILTER_PIPELINES_SEARCH_DELAY),
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default {
},
data() {
return {
users: this.config.triggerAuthors,
users: [],
loading: true,
};
},
Expand All @@ -50,11 +50,14 @@ export default {
});
},
},
created() {
this.fetchProjectUsers();
},
methods: {
fetchAuthorBySearchTerm(searchTerm) {
fetchProjectUsers(searchTerm) {
Api.projectUsers(this.config.projectId, searchTerm)
.then(res => {
this.users = res;
.then(users => {
this.users = users;
this.loading = false;
})
.catch(err => {
Expand All @@ -64,7 +67,7 @@ export default {
});
},
searchAuthors: debounce(function debounceSearch({ data }) {
this.fetchAuthorBySearchTerm(data);
this.fetchProjectUsers(data);
}, FILTER_PIPELINES_SEARCH_DELAY),
},
};
Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/pipelines/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const PIPELINES_TABLE = 'PIPELINES_TABLE';
export const LAYOUT_CHANGE_DELAY = 300;
export const FILTER_PIPELINES_SEARCH_DELAY = 200;
export const ANY_TRIGGER_AUTHOR = 'Any';
export const SUPPORTED_FILTER_PARAMETERS = ['username', 'ref'];

export const TestStatus = {
FAILED: 'failed',
Expand Down
7 changes: 4 additions & 3 deletions app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -483,11 +483,12 @@ def present_project
def export_rate_limit
prefixed_action = "project_#{params[:action]}".to_sym

if rate_limiter.throttled?(prefixed_action, scope: [current_user, prefixed_action, @project])
project_scope = params[:action] == :download_export ? @project : nil

if rate_limiter.throttled?(prefixed_action, scope: [current_user, prefixed_action, project_scope].compact)
rate_limiter.log_request(request, "#{prefixed_action}_request_limit".to_sym, current_user)

flash[:alert] = _('This endpoint has been requested too many times. Try again later.')
redirect_to edit_project_path(@project)
render plain: _('This endpoint has been requested too many times. Try again later.'), status: :too_many_requests
end
end

Expand Down
1 change: 1 addition & 0 deletions app/views/projects/pipelines/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#pipelines-list-vue{ data: { endpoint: project_pipelines_path(@project, format: :json),
project_id: @project.id,
params: params.to_json,
"help-page-path" => help_page_path('ci/quick_start/README'),
"help-auto-devops-path" => help_page_path('topics/autodevops/index.md'),
"empty-state-svg-path" => image_path('illustrations/pipelines_empty.svg'),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Filter pipelines based on url query params
merge_request: 32230
author:
type: added
5 changes: 5 additions & 0 deletions changelogs/unreleased/improve_issue_labels_api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Improve Add/Remove Issue Labels API
merge_request: 31864
author: Lee Tickett
type: added
5 changes: 5 additions & 0 deletions changelogs/unreleased/jh-rate_limit_project_export.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Rate limit project export by user
merge_request: 31719
author:
type: changed
5 changes: 5 additions & 0 deletions changelogs/unreleased/leaky-constant-fix-28.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Fix leaky constant issue in sidekiq middleware server metric spec
merge_request: 32104
author: Rajendra Kadam
type: fixed
5 changes: 5 additions & 0 deletions changelogs/unreleased/leaky-constant-fix-32.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Fix leaky constant issue importer and cache headers spec
merge_request: 32122
author: Rajendra Kadam
type: fixed
5 changes: 5 additions & 0 deletions changelogs/unreleased/leaky-constant-fix-38.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Fix leaky constant issue in factory spec
merge_request: 32174
author: Rajendra Kadam
type: fixed
2 changes: 2 additions & 0 deletions doc/api/issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,8 @@ PUT /projects/:id/issues/:issue_iid
| `assignee_ids` | integer array | no | The ID of the user(s) to assign the issue to. Set to `0` or provide an empty value to unassign all assignees. |
| `milestone_id` | integer | no | The global ID of a milestone to assign the issue to. Set to `0` or provide an empty value to unassign a milestone.|
| `labels` | string | no | Comma-separated label names for an issue. Set to an empty string to unassign all labels. |
| `add_labels` | string | no | Comma-separated label names to add to an issue. |
| `remove_labels`| string | no | Comma-separated label names to remove from an issue. |
| `state_event` | string | no | The state event of an issue. Set `close` to close the issue and `reopen` to reopen it |
| `updated_at` | string | no | Date time string, ISO 8601 formatted, for example `2016-03-11T03:45:40Z` (requires admin or project owner rights). Empty string or null values are not accepted.|
| `due_date` | string | no | Date time string in the format YEAR-MONTH-DAY, for example `2016-03-11` |
Expand Down
17 changes: 17 additions & 0 deletions doc/user/project/code_owners.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,23 @@ or more users or by the `@name` of one or more groups that should
be owners of the file. Groups must be added as [members of the project](members/index.md),
or they will be ignored.

Starting in [GitLab 13.0](https://gitlab.com/gitlab-org/gitlab/-/issues/32432), you can now specify
groups or subgroups from the project's group hierarchy as potential code owners.

For example, consider the following hierarchy for a given project:

```text
group >> sub-group >> sub-subgroup >> myproject >> file.md
```

Any of the following groups would be eligible to be specified as code owners:

- `@group`
- `@group/sub-group`
- `@group/sub-group/sub-subgroup`

In addition, any groups that have been invited to the project using the **Settings > Members** tool will also be recognized as eligible code owners.

The order in which the paths are defined is significant: the last
pattern that matches a given path will be used to find the code
owners.
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions lib/api/helpers/issues_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def self.update_params_at_least_one_of
:discussion_locked,
:due_date,
:labels,
:add_labels,
:remove_labels,
:milestone_id,
:state_event,
:title
Expand Down
2 changes: 2 additions & 0 deletions lib/api/issues.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class Issues < Grape::API
optional :assignee_id, type: Integer, desc: '[Deprecated] The ID of a user to assign issue'
optional :milestone_id, type: Integer, desc: 'The ID of a milestone to assign issue'
optional :labels, type: Array[String], coerce_with: Validations::Types::LabelsList.coerce, desc: 'Comma-separated list of label names'
optional :add_labels, type: Array[String], coerce_with: Validations::Types::LabelsList.coerce, desc: 'Comma-separated list of label names'
optional :remove_labels, type: Array[String], coerce_with: Validations::Types::LabelsList.coerce, desc: 'Comma-separated list of label names'
optional :due_date, type: String, desc: 'Date string in the format YEAR-MONTH-DAY'
optional :confidential, type: Boolean, desc: 'Boolean parameter if the issue should be confidential'
optional :discussion_locked, type: Boolean, desc: " Boolean parameter indicating if the issue's discussion is locked"
Expand Down
2 changes: 1 addition & 1 deletion lib/api/project_export.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ProjectExport < Grape::API
end
end
post ':id/export' do
check_rate_limit! :project_export, [current_user, :project_export, user_project]
check_rate_limit! :project_export, [current_user, :project_export]

project_export_params = declared_params(include_missing: false)
after_export_params = project_export_params.delete(:upload) || {}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"eslint-report": "eslint --max-warnings 0 --ext .js,.vue --format html --output-file ./eslint-report.html --no-inline-config .",
"file-coverage": "scripts/frontend/file_test_coverage.js",
"prejest": "yarn check-dependencies",
"jest": "jest --config jest.config.unit.js",
"jest": "jest --config jest.config.js",
"jest-debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
"jest:integration": "jest --config jest.config.integration.js",
"jsdoc": "jsdoc -c config/jsdocs.config.js",
Expand Down
Loading

0 comments on commit 1902e25

Please sign in to comment.