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
029c864c
Commit
029c864c
authored
Aug 11, 2020
by
jakeburden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add group milestones API method to api.js
parent
5b4dc684
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
0 deletions
+42
-0
app/assets/javascripts/api.js
app/assets/javascripts/api.js
+12
-0
spec/frontend/api_spec.js
spec/frontend/api_spec.js
+30
-0
No files found.
app/assets/javascripts/api.js
View file @
029c864c
...
...
@@ -9,6 +9,7 @@ const Api = {
groupsPath
:
'
/api/:version/groups.json
'
,
groupPath
:
'
/api/:version/groups/:id
'
,
groupMembersPath
:
'
/api/:version/groups/:id/members
'
,
groupMilestonesPath
:
'
/api/:version/groups/:id/milestones
'
,
subgroupsPath
:
'
/api/:version/groups/:id/subgroups
'
,
namespacesPath
:
'
/api/:version/namespaces.json
'
,
groupPackagesPath
:
'
/api/:version/groups/:id/packages
'
,
...
...
@@ -110,6 +111,17 @@ const Api = {
});
},
groupMilestones
(
id
,
options
)
{
const
url
=
Api
.
buildUrl
(
this
.
groupMilestonesPath
).
replace
(
'
:id
'
,
encodeURIComponent
(
id
));
return
axios
.
get
(
url
,
{
params
:
{
per_page
:
DEFAULT_PER_PAGE
,
...
options
,
},
});
},
// Return groups list. Filtered by query
groups
(
query
,
options
,
callback
=
()
=>
{})
{
const
url
=
Api
.
buildUrl
(
Api
.
groupsPath
);
...
...
spec/frontend/api_spec.js
View file @
029c864c
...
...
@@ -149,6 +149,36 @@ describe('Api', () => {
});
});
describe
(
'
groupMilestones
'
,
()
=>
{
it
(
'
fetches group milestones
'
,
done
=>
{
const
groupId
=
'
16
'
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/groups/
${
groupId
}
/milestones`
;
const
expectedData
=
[
{
id
:
12
,
iid
:
3
,
group_id
:
16
,
title
:
'
10.0
'
,
description
:
'
Version
'
,
due_date
:
'
2013-11-29
'
,
start_date
:
'
2013-11-10
'
,
state
:
'
active
'
,
updated_at
:
'
2013-10-02T09:24:18Z
'
,
created_at
:
'
2013-10-02T09:24:18Z
'
,
web_url
:
'
https://gitlab.com/groups/gitlab-org/-/milestones/42
'
,
},
];
mock
.
onGet
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
expectedData
);
Api
.
groupMilestones
(
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