diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-17 15:16:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-17 15:16:21 +0300 |
commit | 5d92a0af93588db9c6bef9ab5d81b73daebc782a (patch) | |
tree | c77e1c9c1a80e91de5d3e04c48d5082a971920be /app/assets/javascripts/import_entities | |
parent | 4a52a162d1b5c7dfe7b0ef90f42fd39e4bb2a863 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/import_entities')
6 files changed, 98 insertions, 3 deletions
diff --git a/app/assets/javascripts/import_entities/import_groups/components/import_actions_cell.vue b/app/assets/javascripts/import_entities/import_groups/components/import_actions_cell.vue index e004bc35087..deaf2654424 100644 --- a/app/assets/javascripts/import_entities/import_groups/components/import_actions_cell.vue +++ b/app/assets/javascripts/import_entities/import_groups/components/import_actions_cell.vue @@ -44,7 +44,7 @@ export default { :size="16" name="information-o" :title=" - s__('BulkImports|Re-import creates a new group. It does not sync with the existing group.') + s__('BulkImport|Re-import creates a new group. It does not sync with the existing group.') " class="gl-ml-3" /> diff --git a/app/assets/javascripts/import_entities/import_groups/components/import_table.vue b/app/assets/javascripts/import_entities/import_groups/components/import_table.vue index 9125b8a2f44..028197ec9b1 100644 --- a/app/assets/javascripts/import_entities/import_groups/components/import_table.vue +++ b/app/assets/javascripts/import_entities/import_groups/components/import_table.vue @@ -1,5 +1,6 @@ <script> import { + GlAlert, GlButton, GlEmptyState, GlIcon, @@ -12,7 +13,7 @@ import { } from '@gitlab/ui'; import { debounce } from 'lodash'; import createFlash from '~/flash'; -import { s__, __, n__ } from '~/locale'; +import { s__, __, n__, sprintf } from '~/locale'; import PaginationBar from '~/vue_shared/components/pagination_bar/pagination_bar.vue'; import { getGroupPathAvailability } from '~/rest_api'; import axios from '~/lib/utils/axios_utils'; @@ -40,6 +41,7 @@ const DEFAULT_TD_CLASSES = 'gl-vertical-align-top!'; export default { components: { + GlAlert, GlButton, GlEmptyState, GlIcon, @@ -79,6 +81,7 @@ export default { selectedGroupsIds: [], pendingGroupsIds: [], importTargets: {}, + unavailableFeaturesAlertVisible: true, }; }, @@ -200,6 +203,23 @@ export default { return { start, end, total }; }, + + unavailableFeatures() { + if (!this.hasGroups) { + return []; + } + + return Object.entries(this.bulkImportSourceGroups.versionValidation.features) + .filter(([, { available }]) => available === false) + .map(([k, v]) => ({ title: i18n.features[k] || k, version: v.minVersion })); + }, + + unavailableFeaturesAlertTitle() { + return sprintf(s__('BulkImport| %{host} is running outdated GitLab version (v%{version})'), { + host: this.sourceUrl, + version: this.bulkImportSourceGroups.versionValidation.features.sourceInstanceVersion, + }); + }, }, watch: { @@ -471,6 +491,38 @@ export default { <img :src="$options.gitlabLogo" class="gl-w-6 gl-h-6 gl-mb-2 gl-display-inline gl-mr-2" /> {{ s__('BulkImport|Import groups from GitLab') }} </h1> + <gl-alert + v-if="unavailableFeatures.length > 0 && unavailableFeaturesAlertVisible" + variant="warning" + :title="unavailableFeaturesAlertTitle" + @dismiss="unavailableFeaturesAlertVisible = false" + > + <gl-sprintf + :message=" + s__( + 'BulkImport|Following data will not be migrated: %{bullets} Contact system administrator of %{host} to upgrade GitLab if you need this data in your migration', + ) + " + > + <template #host> + <gl-link :href="sourceUrl" target="_blank"> + {{ sourceUrl }}<gl-icon name="external-link" class="vertical-align-middle" /> + </gl-link> + </template> + <template #bullets> + <ul> + <li v-for="feature in unavailableFeatures" :key="feature.title"> + <gl-sprintf :message="s__('BulkImport|%{feature} (require v%{version})')"> + <template #feature>{{ feature.title }}</template> + <template #version> + <strong>{{ feature.version }}</strong> + </template> + </gl-sprintf> + </li> + </ul> + </template> + </gl-sprintf> + </gl-alert> <div class="gl-py-5 gl-border-solid gl-border-gray-200 gl-border-0 gl-border-b-1 gl-display-flex" > @@ -490,7 +542,7 @@ export default { </template> <template #link> <gl-link :href="sourceUrl" target="_blank"> - {{ sourceUrl }} <gl-icon name="external-link" class="vertical-align-middle" /> + {{ sourceUrl }}<gl-icon name="external-link" class="vertical-align-middle" /> </gl-link> </template> </gl-sprintf> diff --git a/app/assets/javascripts/import_entities/import_groups/constants.js b/app/assets/javascripts/import_entities/import_groups/constants.js index aa9cf3897e6..ac1466238d0 100644 --- a/app/assets/javascripts/import_entities/import_groups/constants.js +++ b/app/assets/javascripts/import_entities/import_groups/constants.js @@ -11,6 +11,10 @@ export const i18n = { ), ERROR_IMPORT: s__('BulkImport|Importing the group failed.'), ERROR_IMPORT_COMPLETED: s__('BulkImport|Import is finished. Pick another name for re-import'), + + features: { + projectMigration: __('projects'), + }, }; export const NEW_NAME_FIELD = 'newName'; diff --git a/app/assets/javascripts/import_entities/import_groups/graphql/client_factory.js b/app/assets/javascripts/import_entities/import_groups/graphql/client_factory.js index 31352bbc8bb..36da996ea17 100644 --- a/app/assets/javascripts/import_entities/import_groups/graphql/client_factory.js +++ b/app/assets/javascripts/import_entities/import_groups/graphql/client_factory.js @@ -14,6 +14,9 @@ export const clientTypenames = { BulkImportPageInfo: 'ClientBulkImportPageInfo', BulkImportTarget: 'ClientBulkImportTarget', BulkImportProgress: 'ClientBulkImportProgress', + BulkImportVersionValidation: 'ClientBulkImportVersionValidation', + BulkImportVersionValidationFeature: 'ClientBulkImportVersionValidationFeature', + BulkImportVersionValidationFeatures: 'ClientBulkImportVersionValidationFeatures', }; function makeLastImportTarget(data) { @@ -92,6 +95,18 @@ export function createResolvers({ endpoints }) { __typename: clientTypenames.BulkImportPageInfo, ...pagination, }, + versionValidation: { + __typename: clientTypenames.BulkImportVersionValidation, + features: { + __typename: clientTypenames.BulkImportVersionValidationFeatures, + sourceInstanceVersion: data.version_validation.features.source_instance_version, + projectMigration: { + __typename: clientTypenames.BulkImportVersionValidationFeature, + available: data.version_validation.features.project_migration.available, + minVersion: data.version_validation.features.project_migration.min_version, + }, + }, + }, }; return response; }, diff --git a/app/assets/javascripts/import_entities/import_groups/graphql/queries/bulk_import_source_groups.query.graphql b/app/assets/javascripts/import_entities/import_groups/graphql/queries/bulk_import_source_groups.query.graphql index 28dfefdf8a7..ace8bffc012 100644 --- a/app/assets/javascripts/import_entities/import_groups/graphql/queries/bulk_import_source_groups.query.graphql +++ b/app/assets/javascripts/import_entities/import_groups/graphql/queries/bulk_import_source_groups.query.graphql @@ -11,5 +11,14 @@ query bulkImportSourceGroups($page: Int = 1, $perPage: Int = 20, $filter: String total totalPages } + versionValidation { + features { + sourceInstanceVersion + projectMigration { + available + minVersion + } + } + } } } diff --git a/app/assets/javascripts/import_entities/import_groups/graphql/typedefs.graphql b/app/assets/javascripts/import_entities/import_groups/graphql/typedefs.graphql index 1639ce16758..c48e22a7717 100644 --- a/app/assets/javascripts/import_entities/import_groups/graphql/typedefs.graphql +++ b/app/assets/javascripts/import_entities/import_groups/graphql/typedefs.graphql @@ -11,6 +11,7 @@ type ClientBulkImportTarget { type ClientBulkImportSourceGroupConnection { nodes: [ClientBulkImportSourceGroup!]! pageInfo: ClientBulkImportPageInfo! + versionValidation: ClientBulkImportVersionValidation! } type ClientBulkImportProgress { @@ -46,6 +47,20 @@ type ClientBulkImportNamespaceSuggestion { suggestions: [String!]! } +type ClientBulkImportVersionValidation { + features: ClientBulkImportVersionValidationFeatures! +} + +type ClientBulkImportVersionValidationFeatures { + project_migration: ClientBulkImportVersionValidationFeature! + sourceInstanceVersion: String! +} + +type ClientBulkImportVersionValidationFeature { + available: Boolean! + min_version: String! +} + extend type Query { bulkImportSourceGroups( page: Int! |