diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-22 15:10:38 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-22 15:10:38 +0300 |
commit | 980d813e90c70f09861e39b9269e73b2c9a4e936 (patch) | |
tree | 56bbceba907009181439a7c3a0855418b965b39e /app/assets/javascripts/import_entities | |
parent | 2e9f877e8b6dd58c8011745b1d9a28dd67c8179c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/import_entities')
3 files changed, 31 insertions, 4 deletions
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 c0fd076ee6b..a0a44ee74dc 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 @@ -33,6 +33,11 @@ export default { type: String, required: true, }, + canCreateGroup: { + type: Boolean, + required: false, + default: false, + }, }, data() { @@ -171,6 +176,7 @@ export default { :key="group.id" :group="group" :available-namespaces="availableNamespaces" + :can-create-group="canCreateGroup" @update-target-namespace="updateTargetNamespace(group.id, $event)" @update-new-name="updateNewName(group.id, $event)" @import-group="importGroup(group.id)" diff --git a/app/assets/javascripts/import_entities/import_groups/components/import_table_row.vue b/app/assets/javascripts/import_entities/import_groups/components/import_table_row.vue index 1707ab10c89..1f3eee0c141 100644 --- a/app/assets/javascripts/import_entities/import_groups/components/import_table_row.vue +++ b/app/assets/javascripts/import_entities/import_groups/components/import_table_row.vue @@ -1,6 +1,7 @@ <script> import { GlButton, GlIcon, GlLink, GlFormInput } from '@gitlab/ui'; import { joinPaths } from '~/lib/utils/url_utility'; +import { s__ } from '~/locale'; import Select2Select from '~/vue_shared/components/select2_select.vue'; import ImportStatus from '../../components/import_status.vue'; import { STATUSES } from '../../constants'; @@ -23,6 +24,11 @@ export default { type: Array, required: true, }, + canCreateGroup: { + type: Boolean, + required: false, + default: false, + }, }, computed: { isDisabled() { @@ -34,11 +40,23 @@ export default { }, select2Options() { + const availableNamespacesData = this.availableNamespaces.map((namespace) => ({ + id: namespace.full_path, + text: namespace.full_path, + })); + + if (!this.canCreateGroup) { + return { data: availableNamespacesData }; + } + return { - data: this.availableNamespaces.map((namespace) => ({ - id: namespace.full_path, - text: namespace.full_path, - })), + data: [ + { id: '', text: s__('BulkImport|No parent') }, + { + text: s__('BulkImport|Existing groups'), + children: availableNamespacesData, + }, + ], }; }, }, diff --git a/app/assets/javascripts/import_entities/import_groups/index.js b/app/assets/javascripts/import_entities/import_groups/index.js index cd837a840e4..0700358f6ce 100644 --- a/app/assets/javascripts/import_entities/import_groups/index.js +++ b/app/assets/javascripts/import_entities/import_groups/index.js @@ -1,5 +1,6 @@ import Vue from 'vue'; import VueApollo from 'vue-apollo'; +import { parseBoolean } from '~/lib/utils/common_utils'; import Translate from '~/vue_shared/translate'; import ImportTable from './components/import_table.vue'; import { createApolloClient } from './graphql/client_factory'; @@ -16,6 +17,7 @@ export function mountImportGroupsApp(mountElement) { createBulkImportPath, jobsPath, sourceUrl, + canCreateGroup, } = mountElement.dataset; const apolloProvider = new VueApollo({ defaultClient: createApolloClient({ @@ -35,6 +37,7 @@ export function mountImportGroupsApp(mountElement) { return createElement(ImportTable, { props: { sourceUrl, + canCreateGroup: parseBoolean(canCreateGroup), }, }); }, |