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
d4e9dd96
Commit
d4e9dd96
authored
Jan 16, 2019
by
Paul Slaughter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add groupMembers to api.js
parent
609e5f7d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
app/assets/javascripts/api.js
app/assets/javascripts/api.js
+7
-0
spec/javascripts/api_spec.js
spec/javascripts/api_spec.js
+16
-0
No files found.
app/assets/javascripts/api.js
View file @
d4e9dd96
...
...
@@ -5,6 +5,7 @@ import axios from './lib/utils/axios_utils';
const
Api
=
{
groupsPath
:
'
/api/:version/groups.json
'
,
groupPath
:
'
/api/:version/groups/:id
'
,
groupMembersPath
:
'
/api/:version/groups/:id/members
'
,
subgroupsPath
:
'
/api/:version/groups/:id/subgroups
'
,
namespacesPath
:
'
/api/:version/namespaces.json
'
,
groupProjectsPath
:
'
/api/:version/groups/:id/projects.json
'
,
...
...
@@ -40,6 +41,12 @@ const Api = {
});
},
groupMembers
(
id
)
{
const
url
=
Api
.
buildUrl
(
this
.
groupMembersPath
).
replace
(
'
:id
'
,
encodeURIComponent
(
id
));
return
axios
.
get
(
url
);
},
// Return groups list. Filtered by query
groups
(
query
,
options
,
callback
=
$
.
noop
)
{
const
url
=
Api
.
buildUrl
(
Api
.
groupsPath
);
...
...
spec/javascripts/api_spec.js
View file @
d4e9dd96
...
...
@@ -49,6 +49,22 @@ describe('Api', () => {
});
});
describe
(
'
groupMembers
'
,
()
=>
{
it
(
'
fetches group members
'
,
done
=>
{
const
groupId
=
'
54321
'
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/groups/
${
groupId
}
/members`
;
const
expectedData
=
[{
id
:
7
}];
mock
.
onGet
(
expectedUrl
).
reply
(
200
,
expectedData
);
Api
.
groupMembers
(
groupId
)
.
then
(({
data
})
=>
{
expect
(
data
).
toEqual
(
expectedData
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
});
describe
(
'
groups
'
,
()
=>
{
it
(
'
fetches groups
'
,
done
=>
{
const
query
=
'
dummy query
'
;
...
...
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