diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-25 18:09:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-25 18:09:54 +0300 |
commit | d03aeb1110374d140a42622716597ccfa8e4ba57 (patch) | |
tree | 2f915a4c8935af179cb81c646a8e4a3f65c78c0d /app | |
parent | 85a825bbbfe51615f447d632a5f53c297ec1b33a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/packages_and_registries/shared/components/registry_list.vue | 124 | ||||
-rw-r--r-- | app/models/ci/build.rb | 9 | ||||
-rw-r--r-- | app/models/commit_status.rb | 4 | ||||
-rw-r--r-- | app/views/admin/application_settings/_snowplow.html.haml | 6 | ||||
-rw-r--r-- | app/views/profiles/show.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/_new_project_fields.html.haml | 2 |
6 files changed, 142 insertions, 5 deletions
diff --git a/app/assets/javascripts/packages_and_registries/shared/components/registry_list.vue b/app/assets/javascripts/packages_and_registries/shared/components/registry_list.vue new file mode 100644 index 00000000000..58350489435 --- /dev/null +++ b/app/assets/javascripts/packages_and_registries/shared/components/registry_list.vue @@ -0,0 +1,124 @@ +<script> +import { GlButton, GlFormCheckbox, GlKeysetPagination } from '@gitlab/ui'; +import { filter } from 'lodash'; +import { __ } from '~/locale'; + +export default { + name: 'RegistryList', + components: { + GlButton, + GlFormCheckbox, + GlKeysetPagination, + }, + props: { + title: { + type: String, + required: true, + }, + isLoading: { + type: Boolean, + default: false, + required: false, + }, + hiddenDelete: { + type: Boolean, + default: false, + required: false, + }, + pagination: { + type: Object, + required: false, + default: () => ({}), + }, + items: { + type: Array, + required: false, + default: () => [], + }, + idProperty: { + type: String, + required: false, + default: 'id', + }, + }, + data() { + return { + selectedReferences: {}, + }; + }, + computed: { + showPagination() { + return this.pagination.hasPreviousPage || this.pagination.hasNextPage; + }, + disableDeleteButton() { + return this.isLoading || filter(this.selectedReferences).length === 0; + }, + selectedItems() { + return this.items.filter(this.isSelected); + }, + selectAll: { + get() { + return this.items.every(this.isSelected); + }, + set(value) { + this.items.forEach((item) => { + const id = item[this.idProperty]; + this.$set(this.selectedReferences, id, value); + }); + }, + }, + }, + methods: { + selectItem(item) { + const id = item[this.idProperty]; + this.$set(this.selectedReferences, id, !this.selectedReferences[id]); + }, + isSelected(item) { + const id = item[this.idProperty]; + return this.selectedReferences[id]; + }, + }, + i18n: { + deleteSelected: __('Delete Selected'), + }, +}; +</script> + +<template> + <div> + <div class="gl-display-flex gl-justify-content-space-between gl-mb-3"> + <gl-form-checkbox v-if="!hiddenDelete" v-model="selectAll" class="gl-ml-2"> + <span class="gl-font-weight-bold">{{ title }}</span> + </gl-form-checkbox> + + <gl-button + v-if="!hiddenDelete" + :disabled="disableDeleteButton" + category="secondary" + variant="danger" + @click="$emit('delete', selectedItems)" + > + {{ $options.i18n.deleteSelected }} + </gl-button> + </div> + + <div v-for="(item, index) in items" :key="index"> + <slot + :select-item="selectItem" + :is-selected="isSelected" + :item="item" + :first="index === 0" + ></slot> + </div> + + <div class="gl-display-flex gl-justify-content-center"> + <gl-keyset-pagination + v-if="showPagination" + v-bind="pagination" + class="gl-mt-3" + @prev="$emit('prev-page')" + @next="$emit('next-page')" + /> + </div> + </div> +</template> diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 66283a03314..277e0ccbf23 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -10,6 +10,7 @@ module Ci include Presentable include Importable include Ci::HasRef + extend ::Gitlab::Utils::Override BuildArchivedError = Class.new(StandardError) @@ -723,6 +724,14 @@ module Ci self.token && ActiveSupport::SecurityUtils.secure_compare(token, self.token) end + # acts_as_taggable uses this method create/remove tags with contexts + # defined by taggings and to get those contexts it executes a query. + # We don't use any other contexts except `tags`, so we don't need it. + override :custom_contexts + def custom_contexts + [] + end + def tag_list if tags.loaded? tags.map(&:name) diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index d75f7984e2c..5d3a5ce9b21 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -217,6 +217,10 @@ class CommitStatus < Ci::ApplicationRecord false end + def self.bulk_insert_tags!(statuses, tag_list_by_build) + Gitlab::Ci::Tags::BulkInsert.new(statuses, tag_list_by_build).insert! + end + def locking_enabled? will_save_change_to_status? end diff --git a/app/views/admin/application_settings/_snowplow.html.haml b/app/views/admin/application_settings/_snowplow.html.haml index 756c0e770a6..f7a6a26c645 100644 --- a/app/views/admin/application_settings/_snowplow.html.haml +++ b/app/views/admin/application_settings/_snowplow.html.haml @@ -1,5 +1,5 @@ - expanded = integration_expanded?('snowplow_') -%section.settings.as-snowplow.no-animate#js-snowplow-settings{ class: ('expanded' if expanded) } +%section.settings.as-snowplow.no-animate#js-snowplow-settings{ class: ('expanded' if expanded), data: { qa_selector: 'snowplow_settings_content' } } .settings-header %h4 = _('Snowplow') @@ -15,7 +15,7 @@ %fieldset .form-group .form-check - = f.check_box :snowplow_enabled, class: 'form-check-input' + = f.check_box :snowplow_enabled, class: 'form-check-input', data: { qa_selector: 'snowplow_enabled_checkbox' } = f.label :snowplow_enabled, _('Enable Snowplow tracking'), class: 'form-check-label' .form-group = f.label :snowplow_collector_hostname, _('Collector hostname'), class: 'label-light' @@ -33,4 +33,4 @@ .form-text.text-muted = _('The Snowplow cookie domain.') - = f.submit _('Save changes'), class: 'gl-button btn btn-confirm' + = f.submit _('Save changes'), class: 'gl-button btn btn-confirm', data: { qa_selector: 'save_changes_button' } diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml index b1470520eea..f3993ad8c33 100644 --- a/app/views/profiles/show.html.haml +++ b/app/views/profiles/show.html.haml @@ -116,7 +116,7 @@ %h5= _('Private profile') .checkbox-icon-inline-wrapper - private_profile_label = capture do - = s_("Profiles|Don't display activity-related personal information on your profiles") + = s_("Profiles|Don't display activity-related personal information on your profile") = f.check_box :private_profile, label: private_profile_label, inline: true, wrapper_class: 'mr-0' = link_to sprite_icon('question-o'), help_page_path('user/profile/index.md', anchor: 'make-your-user-profile-page-private') %h5= s_("Profiles|Private contributions") diff --git a/app/views/projects/_new_project_fields.html.haml b/app/views/projects/_new_project_fields.html.haml index c21240b340c..c7648f2e79b 100644 --- a/app/views/projects/_new_project_fields.html.haml +++ b/app/views/projects/_new_project_fields.html.haml @@ -49,7 +49,7 @@ .gl-alert.gl-alert-success.gl-mb-4.gl-display-none.js-user-readme-repo = sprite_icon('check-circle', size: 16, css_class: 'gl-icon gl-alert-icon gl-alert-icon-no-title') .gl-alert-body - - help_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: help_page_path('user/profile/index', anchor: 'user-profile-readme') } + - help_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: help_page_path('user/profile/index', anchor: 'add-details-to-your-profile-with-a-readme') } = html_escape(_('%{project_path} is a project that you can use to add a README to your GitLab profile. Create a public project and initialize the repository with a README to get started. %{help_link_start}Learn more.%{help_link_end}')) % { project_path: "<strong>#{current_user.username} / #{current_user.username}</strong>".html_safe, help_link_start: help_link_start, help_link_end: '</a>'.html_safe } .form-group |