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
4860e459
Commit
4860e459
authored
Dec 02, 2021
by
Enrique Alcántara
Committed by
Natalia Tepluhina
Dec 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert GraphQLID to RestID when fetching project data in WebIDE
parent
c8776ac7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
app/assets/javascripts/ide/services/index.js
app/assets/javascripts/ide/services/index.js
+5
-1
spec/frontend/ide/services/index_spec.js
spec/frontend/ide/services/index_spec.js
+7
-1
No files found.
app/assets/javascripts/ide/services/index.js
View file @
4860e459
...
...
@@ -4,6 +4,7 @@ import dismissUserCallout from '~/graphql_shared/mutations/dismiss_user_callout.
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
joinPaths
,
escapeFileUrl
}
from
'
~/lib/utils/url_utility
'
;
import
ciConfig
from
'
~/pipeline_editor/graphql/queries/ci_config.graphql
'
;
import
{
getIdFromGraphQLId
}
from
'
~/graphql_shared/utils
'
;
import
{
query
,
mutate
}
from
'
./gql
'
;
const
fetchApiProjectData
=
(
projectPath
)
=>
Api
.
project
(
projectPath
).
then
(({
data
})
=>
data
);
...
...
@@ -12,7 +13,10 @@ const fetchGqlProjectData = (projectPath) =>
query
({
query
:
getIdeProject
,
variables
:
{
projectPath
},
}).
then
(({
data
})
=>
data
.
project
);
}).
then
(({
data
})
=>
({
...
data
.
project
,
id
:
getIdFromGraphQLId
(
data
.
project
.
id
),
}));
export
default
{
getFileData
(
endpoint
)
{
...
...
spec/frontend/ide/services/index_spec.js
View file @
4860e459
...
...
@@ -219,15 +219,21 @@ describe('IDE services', () => {
describe
(
'
getProjectData
'
,
()
=>
{
it
(
'
combines gql and API requests
'
,
()
=>
{
const
gqlProjectData
=
{
id
:
'
gid://gitlab/Project/1
'
,
userPermissions
:
{
bogus
:
true
,
},
};
const
expectedResponse
=
{
...
projectData
,
...
gqlProjectData
,
id
:
1
,
};
Api
.
project
.
mockReturnValue
(
Promise
.
resolve
({
data
:
{
...
projectData
}
}));
query
.
mockReturnValue
(
Promise
.
resolve
({
data
:
{
project
:
gqlProjectData
}
}));
return
services
.
getProjectData
(
TEST_NAMESPACE
,
TEST_PROJECT
).
then
((
response
)
=>
{
expect
(
response
).
toEqual
({
data
:
{
...
projectData
,
...
gqlProjectData
}
});
expect
(
response
).
toEqual
({
data
:
expectedResponse
});
expect
(
Api
.
project
).
toHaveBeenCalledWith
(
TEST_PROJECT_ID
);
expect
(
query
).
toHaveBeenCalledWith
({
query
:
getIdeProject
,
...
...
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