diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-06 21:12:19 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-06 21:12:19 +0300 |
commit | 30e5ae4c2b9c1674dc222e4bde0daa3f9795782e (patch) | |
tree | 9e19ad1a246e986cd3a8e3842179a972b808ccd1 /app | |
parent | 47d926e838b670f5bfeebab36ddd524f5397c5ca (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
20 files changed, 30 insertions, 93 deletions
diff --git a/app/assets/javascripts/packages/details/index.js b/app/assets/javascripts/packages/details/index.js deleted file mode 100644 index 5b9d58a3860..00000000000 --- a/app/assets/javascripts/packages/details/index.js +++ /dev/null @@ -1,32 +0,0 @@ -import Vue from 'vue'; -import Translate from '~/vue_shared/translate'; -import PackagesApp from './components/app.vue'; -import createStore from './store'; - -Vue.use(Translate); - -export default () => { - const el = document.querySelector('#js-vue-packages-detail'); - const { package: packageJson, canDelete: canDeleteStr, ...rest } = el.dataset; - const packageEntity = JSON.parse(packageJson); - const canDelete = canDeleteStr === 'true'; - - const store = createStore({ - packageEntity, - packageFiles: packageEntity.package_files, - canDelete, - ...rest, - }); - - // eslint-disable-next-line no-new - new Vue({ - el, - components: { - PackagesApp, - }, - store, - render(createElement) { - return createElement('packages-app'); - }, - }); -}; diff --git a/app/assets/javascripts/packages/details/components/app.vue b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/components/app.vue index 462252ce944..6016757c1b9 100644 --- a/app/assets/javascripts/packages/details/components/app.vue +++ b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/components/app.vue @@ -13,13 +13,13 @@ import { mapActions, mapState } from 'vuex'; import { numberToHumanSize } from '~/lib/utils/number_utils'; import { objectToQuery } from '~/lib/utils/url_utility'; import { s__, __ } from '~/locale'; -import TerraformTitle from '~/packages_and_registries/infrastructure_registry/components/details_title.vue'; -import TerraformInstallation from '~/packages_and_registries/infrastructure_registry/components/terraform_installation.vue'; +import TerraformTitle from '~/packages_and_registries/infrastructure_registry/details/components/details_title.vue'; +import TerraformInstallation from '~/packages_and_registries/infrastructure_registry/details/components/terraform_installation.vue'; import Tracking from '~/tracking'; -import PackageListRow from '../../shared/components/package_list_row.vue'; -import PackagesListLoader from '../../shared/components/packages_list_loader.vue'; -import { TrackingActions, SHOW_DELETE_SUCCESS_ALERT } from '../../shared/constants'; -import { packageTypeToTrackCategory } from '../../shared/utils'; +import PackageListRow from '~/packages/shared/components/package_list_row.vue'; +import PackagesListLoader from '~/packages/shared/components/packages_list_loader.vue'; +import { TrackingActions, SHOW_DELETE_SUCCESS_ALERT } from '~/packages/shared/constants'; +import { packageTypeToTrackCategory } from '~/packages/shared/utils'; import PackageFiles from './package_files.vue'; import PackageHistory from './package_history.vue'; diff --git a/app/assets/javascripts/packages_and_registries/infrastructure_registry/components/details_title.vue b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/components/details_title.vue index 3e551706ed0..3e551706ed0 100644 --- a/app/assets/javascripts/packages_and_registries/infrastructure_registry/components/details_title.vue +++ b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/components/details_title.vue diff --git a/app/assets/javascripts/packages/details/components/file_sha.vue b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/components/file_sha.vue index a25839be7e1..a25839be7e1 100644 --- a/app/assets/javascripts/packages/details/components/file_sha.vue +++ b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/components/file_sha.vue diff --git a/app/assets/javascripts/packages/details/components/package_files.vue b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/components/package_files.vue index 0563b612d04..ab4cfccd023 100644 --- a/app/assets/javascripts/packages/details/components/package_files.vue +++ b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/components/package_files.vue @@ -3,10 +3,10 @@ import { GlLink, GlTable, GlDropdownItem, GlDropdown, GlIcon, GlButton } from '@ import { last } from 'lodash'; import { numberToHumanSize } from '~/lib/utils/number_utils'; import { __ } from '~/locale'; -import FileSha from '~/packages/details/components/file_sha.vue'; import Tracking from '~/tracking'; import FileIcon from '~/vue_shared/components/file_icon.vue'; import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; +import FileSha from './file_sha.vue'; export default { name: 'PackageFiles', diff --git a/app/assets/javascripts/packages/details/components/package_history.vue b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/components/package_history.vue index 27d2f208a42..33abc0341b7 100644 --- a/app/assets/javascripts/packages/details/components/package_history.vue +++ b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/components/package_history.vue @@ -4,7 +4,7 @@ import { GlLink, GlSprintf } from '@gitlab/ui'; import { first } from 'lodash'; import { truncateSha } from '~/lib/utils/text_utility'; import { s__, n__ } from '~/locale'; -import { HISTORY_PIPELINES_LIMIT } from '~/packages/details/constants'; +import { HISTORY_PIPELINES_LIMIT } from '~/packages_and_registries/shared/constants'; import HistoryItem from '~/vue_shared/components/registry/history_item.vue'; import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; diff --git a/app/assets/javascripts/packages_and_registries/infrastructure_registry/components/terraform_installation.vue b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/components/terraform_installation.vue index c62bf7fb722..c62bf7fb722 100644 --- a/app/assets/javascripts/packages_and_registries/infrastructure_registry/components/terraform_installation.vue +++ b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/components/terraform_installation.vue diff --git a/app/assets/javascripts/packages/details/constants.js b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/constants.js index a1981797c0c..c0c67faffba 100644 --- a/app/assets/javascripts/packages/details/constants.js +++ b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/constants.js @@ -3,5 +3,3 @@ import { s__ } from '~/locale'; export const FETCH_PACKAGE_VERSIONS_ERROR = s__( 'PackageRegistry|Unable to fetch package version information.', ); - -export const HISTORY_PIPELINES_LIMIT = 5; diff --git a/app/assets/javascripts/packages/details/store/actions.js b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/store/actions.js index a03fa8d9d63..a03fa8d9d63 100644 --- a/app/assets/javascripts/packages/details/store/actions.js +++ b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/store/actions.js diff --git a/app/assets/javascripts/packages/details/store/getters.js b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/store/getters.js index 6a17e7aa6d6..6a17e7aa6d6 100644 --- a/app/assets/javascripts/packages/details/store/getters.js +++ b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/store/getters.js diff --git a/app/assets/javascripts/packages/details/store/index.js b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/store/index.js index 15e17bcfaac..15e17bcfaac 100644 --- a/app/assets/javascripts/packages/details/store/index.js +++ b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/store/index.js diff --git a/app/assets/javascripts/packages/details/store/mutation_types.js b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/store/mutation_types.js index 590f2d9f970..590f2d9f970 100644 --- a/app/assets/javascripts/packages/details/store/mutation_types.js +++ b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/store/mutation_types.js diff --git a/app/assets/javascripts/packages/details/store/mutations.js b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/store/mutations.js index 762fd5a4040..762fd5a4040 100644 --- a/app/assets/javascripts/packages/details/store/mutations.js +++ b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/store/mutations.js diff --git a/app/assets/javascripts/packages_and_registries/infrastructure_registry/details_app_bundle.js b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details_app_bundle.js index 98942b1e578..32fbc9382fd 100644 --- a/app/assets/javascripts/packages_and_registries/infrastructure_registry/details_app_bundle.js +++ b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details_app_bundle.js @@ -1,7 +1,7 @@ import Vue from 'vue'; import { parseBoolean } from '~/lib/utils/common_utils'; -import PackagesApp from '~/packages/details/components/app.vue'; -import createStore from '~/packages/details/store'; +import PackagesApp from '~/packages_and_registries/infrastructure_registry/details/components/app.vue'; +import createStore from '~/packages_and_registries/infrastructure_registry/details/store'; import Translate from '~/vue_shared/translate'; Vue.use(Translate); diff --git a/app/assets/javascripts/packages_and_registries/package_registry/components/details/package_history.vue b/app/assets/javascripts/packages_and_registries/package_registry/components/details/package_history.vue index 408bd2e3dfe..f47040ebf26 100644 --- a/app/assets/javascripts/packages_and_registries/package_registry/components/details/package_history.vue +++ b/app/assets/javascripts/packages_and_registries/package_registry/components/details/package_history.vue @@ -5,7 +5,7 @@ import { first } from 'lodash'; import { getIdFromGraphQLId } from '~/graphql_shared/utils'; import { truncateSha } from '~/lib/utils/text_utility'; import { s__, n__ } from '~/locale'; -import { HISTORY_PIPELINES_LIMIT } from '~/packages/details/constants'; +import { HISTORY_PIPELINES_LIMIT } from '~/packages_and_registries/shared/constants'; import HistoryItem from '~/vue_shared/components/registry/history_item.vue'; import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; diff --git a/app/assets/javascripts/packages_and_registries/shared/constants.js b/app/assets/javascripts/packages_and_registries/shared/constants.js index d38a849ade9..7d2971bd8c7 100644 --- a/app/assets/javascripts/packages_and_registries/shared/constants.js +++ b/app/assets/javascripts/packages_and_registries/shared/constants.js @@ -1,2 +1,3 @@ export const FILTERED_SEARCH_TERM = 'filtered-search-term'; export const FILTERED_SEARCH_TYPE = 'type'; +export const HISTORY_PIPELINES_LIMIT = 5; diff --git a/app/assets/javascripts/tracking/tracking.js b/app/assets/javascripts/tracking/tracking.js index c305709a22b..c26abc261ed 100644 --- a/app/assets/javascripts/tracking/tracking.js +++ b/app/assets/javascripts/tracking/tracking.js @@ -177,9 +177,12 @@ export default class Tracking { } const referrers = getReferrersCache(); - const pageLinks = Object.seal({ url: '', referrer: '', originalUrl: window.location.href }); + const pageLinks = Object.seal({ + url: pageUrl, + referrer: '', + originalUrl: window.location.href, + }); - pageLinks.url = `${pageUrl}${window.location.hash}`; window.snowplow('setCustomUrl', pageLinks.url); if (document.referrer) { diff --git a/app/graphql/mutations/issues/create.rb b/app/graphql/mutations/issues/create.rb index 32f96f1bfe6..70a8f539ccf 100644 --- a/app/graphql/mutations/issues/create.rb +++ b/app/graphql/mutations/issues/create.rb @@ -71,7 +71,7 @@ module Mutations def resolve(project_path:, **attributes) project = authorized_find!(project_path) - params = build_create_issue_params(attributes.merge(author_id: current_user.id)) + params = build_create_issue_params(attributes.merge(author_id: current_user.id), project) spam_params = ::Spam::SpamParams.new_from_request(request: context[:request]) issue = ::Issues::CreateService.new(project: project, current_user: current_user, params: params, spam_params: spam_params).execute @@ -88,7 +88,8 @@ module Mutations private - def build_create_issue_params(params) + # _project argument is unused here, but it is necessary on the EE version of the method + def build_create_issue_params(params, _project) params[:milestone_id] &&= params[:milestone_id]&.model_id params[:assignee_ids] &&= params[:assignee_ids].map { |assignee_id| assignee_id&.model_id } params[:label_ids] &&= params[:label_ids].map { |label_id| label_id&.model_id } diff --git a/app/models/loose_foreign_keys/deleted_record.rb b/app/models/loose_foreign_keys/deleted_record.rb index a39d88b2e49..ca5a2800a03 100644 --- a/app/models/loose_foreign_keys/deleted_record.rb +++ b/app/models/loose_foreign_keys/deleted_record.rb @@ -2,48 +2,4 @@ class LooseForeignKeys::DeletedRecord < ApplicationRecord extend SuppressCompositePrimaryKeyWarning - include PartitionedTable - - partitioned_by :created_at, strategy: :monthly, retain_for: 3.months, retain_non_empty_partitions: true - - scope :ordered_by_primary_keys, -> { order(:created_at, :deleted_table_name, :deleted_table_primary_key_value) } - - def self.load_batch(batch_size) - ordered_by_primary_keys - .limit(batch_size) - .to_a - end - - # Because the table has composite primary keys, the delete_all or delete methods are not going to work. - # This method implements deletion that benefits from the primary key index, example: - # - # > DELETE - # > FROM "loose_foreign_keys_deleted_records" - # > WHERE (created_at, - # > deleted_table_name, - # > deleted_table_primary_key_value) IN - # > (SELECT created_at::TIMESTAMP WITH TIME ZONE, - # > deleted_table_name, - # > deleted_table_primary_key_value - # > FROM (VALUES (LIST_OF_VALUES)) AS primary_key_values (created_at, deleted_table_name, deleted_table_primary_key_value)) - def self.delete_records(records) - values = records.pluck(:created_at, :deleted_table_name, :deleted_table_primary_key_value) - - primary_keys = connection.primary_keys(table_name).join(', ') - - primary_keys_with_type_cast = [ - Arel.sql('created_at::timestamp with time zone'), - Arel.sql('deleted_table_name'), - Arel.sql('deleted_table_primary_key_value') - ] - - value_list = Arel::Nodes::ValuesList.new(values) - - # (SELECT primary keys FROM VALUES) - inner_query = Arel::SelectManager.new - inner_query.from("#{Arel::Nodes::Grouping.new([value_list]).as('primary_key_values').to_sql} (#{primary_keys})") - inner_query.projections = primary_keys_with_type_cast - - where(Arel::Nodes::Grouping.new([Arel.sql(primary_keys)]).in(inner_query)).delete_all - end end diff --git a/app/services/base_project_service.rb b/app/services/base_project_service.rb index fb466e61673..1bf4a235a79 100644 --- a/app/services/base_project_service.rb +++ b/app/services/base_project_service.rb @@ -2,6 +2,8 @@ # Base class, scoped by project class BaseProjectService < ::BaseContainerService + include ::Gitlab::Utils::StrongMemoize + attr_accessor :project def initialize(project:, current_user: nil, params: {}) @@ -11,4 +13,12 @@ class BaseProjectService < ::BaseContainerService end delegate :repository, to: :project + + private + + def project_group + strong_memoize(:project_group) do + project.group + end + end end |