diff options
Diffstat (limited to 'app/assets/javascripts/import_entities')
3 files changed, 38 insertions, 6 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 7c5f48dcafc..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() { @@ -147,10 +152,15 @@ export default { </div> <gl-loading-icon v-if="$apollo.loading" size="md" class="gl-mt-5" /> <template v-else> - <gl-empty-state v-if="hasEmptyFilter" :title="__('Sorry, your filter produced no results')" /> + <gl-empty-state + v-if="hasEmptyFilter" + :title="__('Sorry, your filter produced no results')" + :description="__('To widen your search, change or remove filters above.')" + /> <gl-empty-state v-else-if="!hasGroups" - :title="s__('BulkImport|No groups available for import')" + :title="s__('BulkImport|You have no groups to import')" + :description="s__('Check your source instance permissions.')" /> <div v-else class="gl-display-flex gl-flex-direction-column gl-align-items-center"> <table class="gl-w-full"> @@ -166,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), }, }); }, |