diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-12 15:10:27 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-12 15:10:27 +0300 |
commit | ce07dcdcf59419b41b286fce079750aa1d0a478b (patch) | |
tree | c75477ac8821dc136c4cc3afb7b6eeb6b557ce21 /app | |
parent | 7717a594e88951ba2b92358aa9a10a0030799678 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue | 4 | ||||
-rw-r--r-- | app/assets/javascripts/lib/utils/url_utility.js | 6 | ||||
-rw-r--r-- | app/assets/javascripts/sidebar/components/time_tracking/report.vue | 8 | ||||
-rw-r--r-- | app/helpers/projects/security/configuration_helper.rb | 2 | ||||
-rw-r--r-- | app/models/blob_viewer/package_json.rb | 14 | ||||
-rw-r--r-- | app/models/project_authorization.rb | 5 | ||||
-rw-r--r-- | app/models/user.rb | 6 | ||||
-rw-r--r-- | app/services/users/refresh_authorized_projects_service.rb | 6 | ||||
-rw-r--r-- | app/views/clusters/clusters/_cluster_list.html.haml | 2 | ||||
-rw-r--r-- | app/views/dashboard/_projects_nav.html.haml | 27 | ||||
-rw-r--r-- | app/views/help/index.html.haml | 4 |
11 files changed, 48 insertions, 36 deletions
diff --git a/app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue b/app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue index a5f7b84446f..6b5aac57f1c 100644 --- a/app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue +++ b/app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue @@ -16,6 +16,7 @@ import { import * as Sentry from '@sentry/browser'; import { isEqual, isEmpty, omit } from 'lodash'; import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; +import { PROMO_URL } from 'jh_else_ce/lib/utils/url_utility'; import { integrationTypes, integrationSteps, @@ -129,6 +130,7 @@ export default { name: true, apiUrl: true, }, + pricingLink: `${PROMO_URL}/pricing`, }; }, computed: { @@ -436,7 +438,7 @@ export default { disabled="true" class="gl-display-inline-block gl-my-4" :message="$options.i18n.integrationFormSteps.selectType.enterprise" - link="https://about.gitlab.com/pricing" + :link="pricingLink" data-testid="multi-integrations-not-supported" /> </gl-form-group> diff --git a/app/assets/javascripts/lib/utils/url_utility.js b/app/assets/javascripts/lib/utils/url_utility.js index c70d23d06ec..e53a39cde06 100644 --- a/app/assets/javascripts/lib/utils/url_utility.js +++ b/app/assets/javascripts/lib/utils/url_utility.js @@ -5,6 +5,12 @@ const PATH_SEPARATOR_LEADING_REGEX = new RegExp(`^${PATH_SEPARATOR}+`); const PATH_SEPARATOR_ENDING_REGEX = new RegExp(`${PATH_SEPARATOR}+$`); const SHA_REGEX = /[\da-f]{40}/gi; +// About GitLab default host (overwrite in jh) +export const PROMO_HOST = 'about.gitlab.com'; + +// About Gitlab default url (overwrite in jh) +export const PROMO_URL = `https://${PROMO_HOST}`; + // Reset the cursor in a Regex so that multiple uses before a recompile don't fail function resetRegExp(regex) { regex.lastIndex = 0; /* eslint-disable-line no-param-reassign */ diff --git a/app/assets/javascripts/sidebar/components/time_tracking/report.vue b/app/assets/javascripts/sidebar/components/time_tracking/report.vue index d4a8abb81a8..5d4031ac68b 100644 --- a/app/assets/javascripts/sidebar/components/time_tracking/report.vue +++ b/app/assets/javascripts/sidebar/components/time_tracking/report.vue @@ -1,5 +1,5 @@ <script> -import { GlLoadingIcon, GlTable } from '@gitlab/ui'; +import { GlLoadingIcon, GlTableLite } from '@gitlab/ui'; import createFlash from '~/flash'; import { TYPE_ISSUE, TYPE_MERGE_REQUEST } from '~/graphql_shared/constants'; import { convertToGraphQLId } from '~/graphql_shared/utils'; @@ -12,7 +12,7 @@ const TIME_DATE_FORMAT = 'mmmm d, yyyy, HH:MM ("UTC:" o)'; export default { components: { GlLoadingIcon, - GlTable, + GlTableLite, }, inject: ['issuableType'], props: { @@ -89,7 +89,7 @@ export default { <template> <div> <div v-if="isLoading"><gl-loading-icon size="md" /></div> - <gl-table v-else :items="report" :fields="$options.fields" foot-clone> + <gl-table-lite v-else :items="report" :fields="$options.fields" foot-clone> <template #cell(spentAt)="{ item: { spentAt } }"> <div>{{ formatDate(spentAt) }}</div> </template> @@ -111,6 +111,6 @@ export default { <div>{{ getSummary(summary, note) }}</div> </template> <template #foot(note)> </template> - </gl-table> + </gl-table-lite> </div> </template> diff --git a/app/helpers/projects/security/configuration_helper.rb b/app/helpers/projects/security/configuration_helper.rb index dee106ab3ae..8281b1f8522 100644 --- a/app/helpers/projects/security/configuration_helper.rb +++ b/app/helpers/projects/security/configuration_helper.rb @@ -4,7 +4,7 @@ module Projects module Security module ConfigurationHelper def security_upgrade_path - 'https://about.gitlab.com/pricing/' + "https://#{ApplicationHelper.promo_host}/pricing/" end end end diff --git a/app/models/blob_viewer/package_json.rb b/app/models/blob_viewer/package_json.rb index 7cae60a74d6..1d10cc82a85 100644 --- a/app/models/blob_viewer/package_json.rb +++ b/app/models/blob_viewer/package_json.rb @@ -7,11 +7,15 @@ module BlobViewer self.file_types = %i(package_json) def manager_name - 'npm' + yarn? ? 'yarn' : 'npm' + end + + def yarn? + json_data['engines'].present? && json_data['engines']['yarn'].present? end def manager_url - 'https://www.npmjs.com/' + yarn? ? 'https://yarnpkg.com/' : 'https://www.npmjs.com/' end def package_name @@ -38,7 +42,11 @@ module BlobViewer end def npm_url - "https://www.npmjs.com/package/#{package_name}" + if yarn? + "https://yarnpkg.com/package/#{package_name}" + else + "https://www.npmjs.com/package/#{package_name}" + end end end end diff --git a/app/models/project_authorization.rb b/app/models/project_authorization.rb index 64e768007ee..fed19a37a16 100644 --- a/app/models/project_authorization.rb +++ b/app/models/project_authorization.rb @@ -24,8 +24,9 @@ class ProjectAuthorization < ApplicationRecord end connection.execute <<-EOF.strip_heredoc - INSERT INTO project_authorizations (user_id, project_id, access_level) - VALUES #{tuples.map { |tuple| "(#{tuple.join(', ')})" }.join(', ')} + INSERT INTO project_authorizations (user_id, project_id, access_level) + VALUES #{tuples.map { |tuple| "(#{tuple.join(', ')})" }.join(', ')} + ON CONFLICT DO NOTHING EOF end end diff --git a/app/models/user.rb b/app/models/user.rb index 394c64db3bf..3ab5b7ee364 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1020,8 +1020,10 @@ class User < ApplicationRecord end # rubocop: enable CodeReuse/ServiceClass - def remove_project_authorizations(project_ids) - project_authorizations.where(project_id: project_ids).delete_all + def remove_project_authorizations(project_ids, per_batch = 1000) + project_ids.each_slice(per_batch) do |project_ids_batch| + project_authorizations.where(project_id: project_ids_batch).delete_all + end end def authorized_projects(min_access_level = nil) diff --git a/app/services/users/refresh_authorized_projects_service.rb b/app/services/users/refresh_authorized_projects_service.rb index 1850fa9747d..2d9766c3c56 100644 --- a/app/services/users/refresh_authorized_projects_service.rb +++ b/app/services/users/refresh_authorized_projects_service.rb @@ -67,10 +67,8 @@ module Users def update_authorizations(remove = [], add = []) log_refresh_details(remove, add) - User.transaction do - user.remove_project_authorizations(remove) unless remove.empty? - ProjectAuthorization.insert_authorizations(add) unless add.empty? - end + user.remove_project_authorizations(remove) unless remove.empty? + ProjectAuthorization.insert_authorizations(add) unless add.empty? # Since we batch insert authorization rows, Rails' associations may get # out of sync. As such we force a reload of the User object. diff --git a/app/views/clusters/clusters/_cluster_list.html.haml b/app/views/clusters/clusters/_cluster_list.html.haml index 7657b72b619..e5e1b68225e 100644 --- a/app/views/clusters/clusters/_cluster_list.html.haml +++ b/app/views/clusters/clusters/_cluster_list.html.haml @@ -2,7 +2,7 @@ .top-area.adjust .gl-display-block.gl-text-right.gl-my-4.gl-w-full - if clusterable.can_add_cluster? - = link_to s_('ClusterIntegration|Connect cluster with certificate'), clusterable.new_path, class: 'btn gl-button btn-confirm js-add-cluster gl-py-2', qa_selector: :integrate_kubernetes_cluster_button + = link_to s_('ClusterIntegration|Connect cluster with certificate'), clusterable.new_path, class: 'btn gl-button btn-confirm js-add-cluster gl-py-2', data: { qa_selector: 'integrate_kubernetes_cluster_button' } - else %span.btn.gl-button.btn-confirm.js-add-cluster.disabled.gl-py-2 = s_("ClusterIntegration|Connect cluster with certificate") diff --git a/app/views/dashboard/_projects_nav.html.haml b/app/views/dashboard/_projects_nav.html.haml index b5512ea9efa..64aa1e01d06 100644 --- a/app/views/dashboard/_projects_nav.html.haml +++ b/app/views/dashboard/_projects_nav.html.haml @@ -1,18 +1,13 @@ -- feature_project_list_filter_bar = Feature.enabled?(:project_list_filter_bar) +- is_your_projects_path = current_page?(dashboard_projects_path) || current_page?(root_path) +- is_explore_projects_path = current_page?(explore_root_path) || current_page?(trending_explore_projects_path) || current_page?(starred_explore_projects_path) || current_page?(explore_projects_path) -%ul.nav-links.scrolling-tabs.mobile-separator.nav.nav-tabs{ class: ('gl-border-0!' if feature_project_list_filter_bar) } - = nav_link(page: [dashboard_projects_path, root_path]) do - = link_to dashboard_projects_path, class: 'shortcuts-activity', data: {placement: 'right'} do - = _("Your projects") - %span.badge.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm= limited_counter_with_delimiter(@total_user_projects_count) - = nav_link(page: starred_dashboard_projects_path) do - = link_to starred_dashboard_projects_path, data: {placement: 'right'} do - = _("Starred projects") - %span.badge.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm= limited_counter_with_delimiter(@total_starred_projects_count) - = nav_link(page: [explore_root_path, trending_explore_projects_path, starred_explore_projects_path, explore_projects_path]) do - = link_to explore_root_path, data: {placement: 'right'} do - = _("Explore projects") - = nav_link(page: topics_explore_projects_path) do - = link_to topics_explore_projects_path, data: {placement: 'right'} do - = _("Explore topics") += gl_tabs_nav({ class: 'scrolling-tabs nav-links gl-display-flex gl-flex-grow-1 gl-flex-nowrap gl-border-0' }) do + = gl_tab_link_to dashboard_projects_path, { item_active: is_your_projects_path, class: 'shortcuts-activity', data: { placement: 'right' } } do + = _("Your projects") + = gl_tab_counter_badge(limited_counter_with_delimiter(@total_user_projects_count)) + = gl_tab_link_to starred_dashboard_projects_path, { data: { placement: 'right' } } do + = _("Starred projects") + = gl_tab_counter_badge(limited_counter_with_delimiter(@total_starred_projects_count)) + = gl_tab_link_to _("Explore projects"), explore_root_path, { item_active: is_explore_projects_path, data: { placement: 'right' } } + = gl_tab_link_to _("Explore topics"), topics_explore_projects_path, { data: { placement: 'right' } } = render_if_exists "dashboard/removed_projects_tab", removed_projects_count: @removed_projects_count diff --git a/app/views/help/index.html.haml b/app/views/help/index.html.haml index 95888963947..f81afd0a82e 100644 --- a/app/views/help/index.html.haml +++ b/app/views/help/index.html.haml @@ -46,5 +46,5 @@ %button.btn-blank.btn-link.js-trigger-shortcut{ type: 'button' } = _('Use shortcuts') - unless Gitlab::CurrentSettings.help_page_hide_commercial_content? - %li= link_to _('Get a support subscription'), 'https://about.gitlab.com/pricing/' - %li= link_to _('Compare GitLab editions'), 'https://about.gitlab.com/features/#compare' + %li= link_to _('Get a support subscription'), "https://#{ApplicationHelper.promo_host}/pricing/" + %li= link_to _('Compare GitLab editions'), "https://#{ApplicationHelper.promo_host}/features/#compare" |