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
8b4059d3
Commit
8b4059d3
authored
Jan 29, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated ldap_groups to axios
parent
6def9128
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
14 deletions
+19
-14
app/assets/javascripts/api.js
app/assets/javascripts/api.js
+8
-6
spec/javascripts/api_spec.js
spec/javascripts/api_spec.js
+11
-8
No files found.
app/assets/javascripts/api.js
View file @
8b4059d3
...
...
@@ -196,15 +196,17 @@ const Api = {
ldap_groups
(
query
,
provider
,
callback
)
{
const
url
=
Api
.
buildUrl
(
this
.
ldapGroupsPath
).
replace
(
'
:provider
'
,
provider
);
return
Api
.
wrapAjaxCall
({
url
,
data
:
Object
.
assign
({
return
axios
.
get
(
url
,
{
params
:
{
search
:
query
,
per_page
:
20
,
active
:
true
,
}),
dataType
:
'
json
'
,
}).
then
(
groups
=>
callback
(
groups
));
},
}).
then
(({
data
})
=>
{
callback
(
data
);
return
data
;
});
},
buildUrl
(
url
)
{
...
...
spec/javascripts/api_spec.js
View file @
8b4059d3
...
...
@@ -145,16 +145,16 @@ describe('Api', () => {
const
expectedData
=
{
label
:
labelData
,
};
spyOn
(
jQuery
,
'
ajax
'
).
and
.
callFake
((
request
)
=>
{
expect
(
request
.
url
).
toEqual
(
expectedUrl
);
expect
(
request
.
dataType
).
toEqual
(
'
json
'
);
expect
(
request
.
type
).
toEqual
(
'
POST
'
);
expect
(
request
.
data
).
toEqual
(
expectedData
);
return
sendDummyResponse
()
;
mock
.
onPost
(
expectedUrl
).
reply
((
config
)
=>
{
expect
(
config
.
data
).
toBe
(
JSON
.
stringify
(
expectedData
)
);
return
[
200
,
{
name
:
'
test
'
,
}]
;
});
Api
.
newLabel
(
namespace
,
null
,
labelData
,
(
response
)
=>
{
expect
(
response
).
toBe
(
dummyResponse
);
expect
(
response
.
name
).
toBe
(
'
test
'
);
done
();
});
});
...
...
@@ -270,8 +270,11 @@ describe('Api', () => {
const
query
=
'
query
'
;
const
provider
=
'
provider
'
;
const
callback
=
jasmine
.
createSpy
();
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/ldap/
${
provider
}
/groups.json`
;
spyOn
(
jQuery
,
'
ajax
'
).
and
.
callFake
(()
=>
$
.
Deferred
().
resolve
());
mock
.
onGet
(
expectedUrl
).
reply
(
200
,
[{
name
:
'
test
'
,
}]);
Api
.
ldap_groups
(
query
,
provider
,
callback
)
.
then
((
response
)
=>
{
...
...
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