Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
94f8de45
Commit
94f8de45
authored
Dec 14, 2021
by
Illya Klymov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support legacy format response in importGroup
* normalize response to simplify deployment
parent
3fa034df
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
app/assets/javascripts/import_entities/import_groups/graphql/client_factory.js
...s/import_entities/import_groups/graphql/client_factory.js
+5
-1
spec/frontend/import_entities/import_groups/graphql/client_factory_spec.js
...ort_entities/import_groups/graphql/client_factory_spec.js
+20
-0
No files found.
app/assets/javascripts/import_entities/import_groups/graphql/client_factory.js
View file @
94f8de45
...
@@ -142,7 +142,7 @@ export function createResolvers({ endpoints }) {
...
@@ -142,7 +142,7 @@ export function createResolvers({ endpoints }) {
};
};
});
});
const
{
data
:
responses
}
=
await
axios
.
post
(
endpoints
.
createBulkImport
,
{
const
{
data
:
originalResponse
}
=
await
axios
.
post
(
endpoints
.
createBulkImport
,
{
bulk_import
:
importOperations
.
map
((
op
)
=>
({
bulk_import
:
importOperations
.
map
((
op
)
=>
({
source_type
:
'
group_entity
'
,
source_type
:
'
group_entity
'
,
source_full_path
:
op
.
group
.
fullPath
,
source_full_path
:
op
.
group
.
fullPath
,
...
@@ -151,6 +151,10 @@ export function createResolvers({ endpoints }) {
...
@@ -151,6 +151,10 @@ export function createResolvers({ endpoints }) {
})),
})),
});
});
const
responses
=
Array
.
isArray
(
originalResponse
)
?
originalResponse
:
[{
success
:
true
,
id
:
originalResponse
.
id
}];
return
importOperations
.
map
((
op
,
idx
)
=>
{
return
importOperations
.
map
((
op
,
idx
)
=>
{
const
response
=
responses
[
idx
];
const
response
=
responses
[
idx
];
const
lastImportTarget
=
{
const
lastImportTarget
=
{
...
...
spec/frontend/import_entities/import_groups/graphql/client_factory_spec.js
View file @
94f8de45
...
@@ -188,6 +188,26 @@ describe('Bulk import resolvers', () => {
...
@@ -188,6 +188,26 @@ describe('Bulk import resolvers', () => {
expect
(
results
[
0
].
progress
.
status
).
toBe
(
STATUSES
.
CREATED
);
expect
(
results
[
0
].
progress
.
status
).
toBe
(
STATUSES
.
CREATED
);
});
});
it
(
'
sets import status to CREATED for successful groups when request completes with legacy response
'
,
async
()
=>
{
axiosMockAdapter
.
onPost
(
FAKE_ENDPOINTS
.
createBulkImport
).
reply
(
httpStatus
.
OK
,
{
id
:
1
});
await
client
.
mutate
({
mutation
:
importGroupsMutation
,
variables
:
{
importRequests
:
[
{
sourceGroupId
:
statusEndpointFixture
.
importable_data
[
0
].
id
,
newName
:
'
test
'
,
targetNamespace
:
'
root
'
,
},
],
},
});
await
axios
.
waitForAll
();
expect
(
results
[
0
].
progress
.
status
).
toBe
(
STATUSES
.
CREATED
);
});
it
(
'
sets import status to FAILED and sets progress message for failed groups when request completes
'
,
async
()
=>
{
it
(
'
sets import status to FAILED and sets progress message for failed groups when request completes
'
,
async
()
=>
{
const
FAKE_ERROR_MESSAGE
=
'
foo
'
;
const
FAKE_ERROR_MESSAGE
=
'
foo
'
;
axiosMockAdapter
axiosMockAdapter
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment