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
910eacbb
Commit
910eacbb
authored
Mar 09, 2017
by
Sam Rose
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update frontend to use v4 API
parent
b1e567ff
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
32 deletions
+15
-32
app/assets/javascripts/admin_email_select.js
app/assets/javascripts/admin_email_select.js
+4
-2
app/assets/javascripts/api.js
app/assets/javascripts/api.js
+5
-24
app/assets/javascripts/project_select.js
app/assets/javascripts/project_select.js
+2
-2
app/assets/javascripts/search.js
app/assets/javascripts/search.js
+1
-1
app/views/help/ui.html.haml
app/views/help/ui.html.haml
+1
-1
lib/gitlab/gon_helper.rb
lib/gitlab/gon_helper.rb
+1
-1
spec/javascripts/project_title_spec.js
spec/javascripts/project_title_spec.js
+1
-1
No files found.
app/assets/javascripts/admin_email_select.js
View file @
910eacbb
...
...
@@ -18,8 +18,10 @@ window.AdminEmailSelect = (function() {
group_result
=
Api
.
groups
(
query
.
term
,
{},
function
(
groups
)
{
return
groups
;
});
// Should be replaced with "Api.projects" when API v4 is frozen (9.1)
project_result
=
Api
.
allProjects
(
query
.
term
,
'
id
'
,
function
(
projects
)
{
project_result
=
Api
.
projects
(
query
.
term
,
{
order_by
:
'
id
'
,
membership
:
false
},
function
(
projects
)
{
return
projects
;
});
return
$
.
when
(
project_result
,
group_result
).
done
(
function
(
projects
,
groups
)
{
...
...
app/assets/javascripts/api.js
View file @
910eacbb
...
...
@@ -6,7 +6,6 @@ var Api = {
namespacesPath
:
"
/api/:version/namespaces.json
"
,
groupProjectsPath
:
"
/api/:version/groups/:id/projects.json
"
,
projectsPath
:
"
/api/:version/projects.json?simple=true
"
,
allProjectsPath
:
"
/api/:version/projects/all.json?simple=true
"
,
// Deprecated. Valid for API v3 only.
labelsPath
:
"
/:namespace_path/:project_path/labels
"
,
licensePath
:
"
/api/:version/templates/licenses/:key
"
,
gitignorePath
:
"
/api/:version/templates/gitignores/:key
"
,
...
...
@@ -53,33 +52,15 @@ var Api = {
});
},
// Return projects list. Filtered by query
projects
:
function
(
query
,
o
rder
,
callback
)
{
projects
:
function
(
query
,
o
ptions
,
callback
)
{
var
url
=
Api
.
buildUrl
(
Api
.
projectsPath
);
return
$
.
ajax
({
url
:
url
,
data
:
{
search
:
query
,
order_by
:
order
,
per_page
:
20
},
dataType
:
"
json
"
}).
done
(
function
(
projects
)
{
return
callback
(
projects
);
});
},
// Deprecated and should be deleted for 9.1
// Also the 'Api.allProjectsPath' should be deleted as well.
// Basically, the whole commit that adds this comment should be reverted when API v4 is frozen (9.1)
// Details here: https://gitlab.com/gitlab-org/gitlab-ce/issues/28853#note_24410695
allProjects
:
function
(
query
,
order
,
callback
)
{
var
url
=
Api
.
buildUrl
(
Api
.
allProjectsPath
);
return
$
.
ajax
({
url
:
url
,
data
:
{
data
:
$
.
extend
({
search
:
query
,
order_by
:
order
,
per_page
:
20
},
per_page
:
20
,
membership
:
true
},
options
),
dataType
:
"
json
"
}).
done
(
function
(
projects
)
{
return
callback
(
projects
);
...
...
app/assets/javascripts/project_select.js
View file @
910eacbb
...
...
@@ -35,7 +35,7 @@
if
(
this
.
groupId
)
{
return
Api
.
groupProjects
(
this
.
groupId
,
term
,
projectsCallback
);
}
else
{
return
Api
.
projects
(
term
,
orderBy
,
projectsCallback
);
return
Api
.
projects
(
term
,
{
order_by
:
orderBy
}
,
projectsCallback
);
}
},
url
:
function
(
project
)
{
...
...
@@ -84,7 +84,7 @@
if
(
_this
.
groupId
)
{
return
Api
.
groupProjects
(
_this
.
groupId
,
query
.
term
,
projectsCallback
);
}
else
{
return
Api
.
projects
(
query
.
term
,
_this
.
orderBy
,
projectsCallback
);
return
Api
.
projects
(
query
.
term
,
{
order_by
:
_this
.
orderBy
}
,
projectsCallback
);
}
};
})(
this
),
...
...
app/assets/javascripts/search.js
View file @
910eacbb
...
...
@@ -47,7 +47,7 @@
fields
:
[
'
name
'
]
},
data
:
function
(
term
,
callback
)
{
return
Api
.
projects
(
term
,
'
id
'
,
function
(
data
)
{
return
Api
.
projects
(
term
,
{
order_by
:
'
id
'
}
,
function
(
data
)
{
data
.
unshift
({
name_with_namespace
:
'
Any
'
});
...
...
app/views/help/ui.html.haml
View file @
910eacbb
...
...
@@ -410,7 +410,7 @@
:javascript
$
(
'
#js-project-dropdown
'
).
glDropdown
({
data
:
function
(
term
,
callback
)
{
Api
.
projects
(
term
,
"
last_activity_at
"
,
function
(
data
)
{
Api
.
projects
(
term
,
{
order_by
:
'
last_activity_at
'
}
,
function
(
data
)
{
callback
(
data
);
});
},
...
...
lib/gitlab/gon_helper.rb
View file @
910eacbb
module
Gitlab
module
GonHelper
def
add_gon_variables
gon
.
api_version
=
'v
3'
# v4 Is not officially released yet, therefore can't be considered as "frozen"
gon
.
api_version
=
'v
4'
gon
.
default_avatar_url
=
URI
.
join
(
Gitlab
.
config
.
gitlab
.
url
,
ActionController
::
Base
.
helpers
.
image_path
(
'no_avatar.png'
)).
to_s
gon
.
max_file_size
=
current_application_settings
.
max_attachment_size
gon
.
asset_host
=
ActionController
::
Base
.
asset_host
...
...
spec/javascripts/project_title_spec.js
View file @
910eacbb
...
...
@@ -26,7 +26,7 @@ require('~/project');
var
fakeAjaxResponse
=
function
fakeAjaxResponse
(
req
)
{
var
d
;
expect
(
req
.
url
).
toBe
(
'
/api/v3/projects.json?simple=true
'
);
expect
(
req
.
data
).
toEqual
({
search
:
''
,
order_by
:
'
last_activity_at
'
,
per_page
:
20
});
expect
(
req
.
data
).
toEqual
({
search
:
''
,
order_by
:
'
last_activity_at
'
,
membership
:
true
,
per_page
:
20
});
d
=
$
.
Deferred
();
d
.
resolve
(
this
.
projects_data
);
return
d
.
promise
();
...
...
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