Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/import_entities')
-rw-r--r--app/assets/javascripts/import_entities/import_groups/components/import_table_row.vue20
-rw-r--r--app/assets/javascripts/import_entities/import_groups/graphql/queries/group.query.graphql5
-rw-r--r--app/assets/javascripts/import_entities/import_groups/graphql/queries/groupAndProject.query.graphql9
-rw-r--r--app/assets/javascripts/import_entities/import_projects/store/actions.js26
4 files changed, 37 insertions, 23 deletions
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 60cd5bb0a96..63c18f4d78e 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
@@ -15,7 +15,7 @@ import ImportStatus from '../../components/import_status.vue';
import { STATUSES } from '../../constants';
import addValidationErrorMutation from '../graphql/mutations/add_validation_error.mutation.graphql';
import removeValidationErrorMutation from '../graphql/mutations/remove_validation_error.mutation.graphql';
-import groupQuery from '../graphql/queries/group.query.graphql';
+import groupAndProjectQuery from '../graphql/queries/groupAndProject.query.graphql';
const DEBOUNCE_INTERVAL = 300;
@@ -47,21 +47,21 @@ export default {
},
apollo: {
- existingGroup: {
- query: groupQuery,
+ existingGroupAndProject: {
+ query: groupAndProjectQuery,
debounce: DEBOUNCE_INTERVAL,
variables() {
return {
fullPath: this.fullPath,
};
},
- update({ existingGroup }) {
+ update({ existingGroup, existingProject }) {
const variables = {
field: 'new_name',
sourceGroupId: this.group.id,
};
- if (!existingGroup) {
+ if (!existingGroup && !existingProject) {
this.$apollo.mutate({
mutation: removeValidationErrorMutation,
variables,
@@ -71,7 +71,7 @@ export default {
mutation: addValidationErrorMutation,
variables: {
...variables,
- message: s__('BulkImport|Name already exists.'),
+ message: this.$options.i18n.NAME_ALREADY_EXISTS,
},
});
}
@@ -115,6 +115,10 @@ export default {
return joinPaths(gon.relative_url_root || '/', this.fullPath);
},
},
+
+ i18n: {
+ NAME_ALREADY_EXISTS: s__('BulkImport|Name already exists.'),
+ },
};
</script>
@@ -153,7 +157,7 @@ export default {
:text="importTarget.target_namespace"
:disabled="isAlreadyImported"
toggle-class="gl-rounded-top-right-none! gl-rounded-bottom-right-none!"
- class="import-entities-namespace-dropdown gl-h-7 gl-flex-fill-1"
+ class="import-entities-namespace-dropdown gl-h-7 gl-flex-grow-1"
data-qa-selector="target_namespace_selector_dropdown"
>
<gl-dropdown-item @click="$emit('update-target-namespace', '')">{{
@@ -180,7 +184,7 @@ export default {
>
/
</div>
- <div class="gl-flex-fill-1">
+ <div class="gl-flex-grow-1">
<gl-form-input
class="gl-rounded-top-left-none gl-rounded-bottom-left-none"
:class="{ 'is-invalid': isInvalid && !isAlreadyImported }"
diff --git a/app/assets/javascripts/import_entities/import_groups/graphql/queries/group.query.graphql b/app/assets/javascripts/import_entities/import_groups/graphql/queries/group.query.graphql
deleted file mode 100644
index 52df3581ac4..00000000000
--- a/app/assets/javascripts/import_entities/import_groups/graphql/queries/group.query.graphql
+++ /dev/null
@@ -1,5 +0,0 @@
-query group($fullPath: ID!) {
- existingGroup: group(fullPath: $fullPath) {
- id
- }
-}
diff --git a/app/assets/javascripts/import_entities/import_groups/graphql/queries/groupAndProject.query.graphql b/app/assets/javascripts/import_entities/import_groups/graphql/queries/groupAndProject.query.graphql
new file mode 100644
index 00000000000..d6124f84025
--- /dev/null
+++ b/app/assets/javascripts/import_entities/import_groups/graphql/queries/groupAndProject.query.graphql
@@ -0,0 +1,9 @@
+query groupAndProject($fullPath: ID!) {
+ existingGroup: group(fullPath: $fullPath) {
+ id
+ }
+
+ existingProject: project(fullPath: $fullPath) {
+ id
+ }
+}
diff --git a/app/assets/javascripts/import_entities/import_projects/store/actions.js b/app/assets/javascripts/import_entities/import_projects/store/actions.js
index 33f8dbb8737..5cbc6e85bf3 100644
--- a/app/assets/javascripts/import_entities/import_projects/store/actions.js
+++ b/app/assets/javascripts/import_entities/import_projects/store/actions.js
@@ -1,5 +1,5 @@
import Visibility from 'visibilityjs';
-import { deprecatedCreateFlash as createFlash } from '~/flash';
+import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import httpStatusCodes from '~/lib/utils/http_status';
@@ -75,19 +75,19 @@ const fetchReposFactory = ({ reposPath = isRequired() }) => ({ state, commit })
if (hasRedirectInError(e)) {
redirectToUrlInError(e);
} else if (tooManyRequests(e)) {
- createFlash(
- sprintf(s__('ImportProjects|%{provider} rate limit exceeded. Try again later'), {
+ createFlash({
+ message: sprintf(s__('ImportProjects|%{provider} rate limit exceeded. Try again later'), {
provider: capitalizeFirstCharacter(provider),
}),
- );
+ });
commit(types.RECEIVE_REPOS_ERROR);
} else {
- createFlash(
- sprintf(s__('ImportProjects|Requesting your %{provider} repositories failed'), {
+ createFlash({
+ message: sprintf(s__('ImportProjects|Requesting your %{provider} repositories failed'), {
provider,
}),
- );
+ });
commit(types.RECEIVE_REPOS_ERROR);
}
@@ -126,7 +126,9 @@ const fetchImportFactory = (importPath = isRequired()) => ({ state, commit, gett
)
: s__('ImportProjects|Importing the project failed');
- createFlash(flashMessage);
+ createFlash({
+ message: flashMessage,
+ });
commit(types.RECEIVE_IMPORT_ERROR, repoId);
});
@@ -149,7 +151,9 @@ export const fetchJobsFactory = (jobsPath = isRequired()) => ({ state, commit, d
if (hasRedirectInError(e)) {
redirectToUrlInError(e);
} else {
- createFlash(s__('ImportProjects|Update of imported projects with realtime changes failed'));
+ createFlash({
+ message: s__('ImportProjects|Update of imported projects with realtime changes failed'),
+ });
}
},
});
@@ -175,7 +179,9 @@ const fetchNamespacesFactory = (namespacesPath = isRequired()) => ({ commit }) =
commit(types.RECEIVE_NAMESPACES_SUCCESS, convertObjectPropsToCamelCase(data, { deep: true })),
)
.catch(() => {
- createFlash(s__('ImportProjects|Requesting namespaces failed'));
+ createFlash({
+ message: s__('ImportProjects|Requesting namespaces failed'),
+ });
commit(types.RECEIVE_NAMESPACES_ERROR);
});