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
500e131f
Commit
500e131f
authored
Jul 17, 2018
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-07-17
parents
2497cd1e
ddae884c
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
84 additions
and
39 deletions
+84
-39
app/assets/javascripts/vue_shared/components/memory_graph.vue
...assets/javascripts/vue_shared/components/memory_graph.vue
+1
-1
app/finders/projects_finder.rb
app/finders/projects_finder.rb
+2
-1
app/helpers/submodule_helper.rb
app/helpers/submodule_helper.rb
+4
-4
changelogs/unreleased/49291-fix-memory-graph-component-typo.yml
...logs/unreleased/49291-fix-memory-graph-component-typo.yml
+5
-0
changelogs/unreleased/fix-project-api-archived.yml
changelogs/unreleased/fix-project-api-archived.yml
+5
-0
doc/api/pipelines.md
doc/api/pipelines.md
+2
-2
doc/api/users.md
doc/api/users.md
+15
-15
lib/api/helpers.rb
lib/api/helpers.rb
+7
-1
lib/api/projects.rb
lib/api/projects.rb
+1
-1
spec/helpers/submodule_helper_spec.rb
spec/helpers/submodule_helper_spec.rb
+8
-13
spec/javascripts/vue_shared/components/memory_graph_spec.js
spec/javascripts/vue_shared/components/memory_graph_spec.js
+1
-1
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+33
-0
No files found.
app/assets/javascripts/vue_shared/components/memory_graph.vue
View file @
500e131f
...
...
@@ -126,7 +126,7 @@ export default {
:cx=
"dotX"
:cy=
"dotY"
r=
"1.5"
tranform=
"translate(0 -1)"
tran
s
form=
"translate(0 -1)"
/>
</svg>
</div>
...
...
app/finders/projects_finder.rb
View file @
500e131f
...
...
@@ -16,6 +16,7 @@
# personal: boolean
# search: string
# non_archived: boolean
# archived: 'only' or boolean
#
class
ProjectsFinder
<
UnionFinder
include
CustomAttributesFilter
...
...
@@ -130,7 +131,7 @@ class ProjectsFinder < UnionFinder
def
by_archived
(
projects
)
if
params
[
:non_archived
]
projects
.
non_archived
elsif
params
.
key?
(
:archived
)
# Back-compatibility with the places where `params[:archived]` can be set explicitly to `false`
elsif
params
.
key?
(
:archived
)
if
params
[
:archived
]
==
'only'
projects
.
archived
elsif
Gitlab
::
Utils
.
to_boolean
(
params
[
:archived
])
...
...
app/helpers/submodule_helper.rb
View file @
500e131f
...
...
@@ -8,7 +8,7 @@ module SubmoduleHelper
url
=
repository
.
submodule_url_for
(
ref
,
submodule_item
.
path
)
if
url
==
'.'
||
url
==
'./'
url
=
File
.
join
(
Gitlab
.
config
.
gitlab
.
url
,
@
project
.
full_path
)
url
=
File
.
join
(
Gitlab
.
config
.
gitlab
.
url
,
repository
.
project
.
full_path
)
end
if
url
=~
%r{([^/:]+)/([^/]+(?:
\.
git)?)
\Z
}
...
...
@@ -31,7 +31,7 @@ module SubmoduleHelper
[
namespace_project_path
(
namespace
,
project
),
namespace_project_tree_path
(
namespace
,
project
,
submodule_item
.
id
)]
elsif
relative_self_url?
(
url
)
relative_self_links
(
url
,
submodule_item
.
id
)
relative_self_links
(
url
,
submodule_item
.
id
,
repository
.
project
)
elsif
github_dot_com_url?
(
url
)
standard_links
(
'github.com'
,
namespace
,
project
,
submodule_item
.
id
)
elsif
gitlab_dot_com_url?
(
url
)
...
...
@@ -73,7 +73,7 @@ module SubmoduleHelper
[
base
,
[
base
,
'/tree/'
,
commit
].
join
(
''
)]
end
def
relative_self_links
(
url
,
commit
)
def
relative_self_links
(
url
,
commit
,
project
)
url
.
rstrip!
# Map relative links to a namespace and project
# For example:
...
...
@@ -85,7 +85,7 @@ module SubmoduleHelper
namespace
=
components
.
pop
.
gsub
(
/^\.\.$/
,
''
)
if
namespace
.
empty?
namespace
=
@
project
.
namespace
.
full_path
namespace
=
project
.
namespace
.
full_path
end
begin
...
...
changelogs/unreleased/49291-fix-memory-graph-component-typo.yml
0 → 100644
View file @
500e131f
---
title
:
Fix typo in CSS transform property for Memory Graph component
merge_request
:
20650
author
:
type
:
fixed
changelogs/unreleased/fix-project-api-archived.yml
0 → 100644
View file @
500e131f
---
title
:
Fix archived parameter for projects API
merge_request
:
20566
author
:
Peter Marko
type
:
fixed
doc/api/pipelines.md
View file @
500e131f
...
...
@@ -151,7 +151,7 @@ POST /projects/:id/pipelines/:pipeline_id/retry
|
`pipeline_id`
| integer | yes | The ID of a pipeline |
```
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/pipelines/46/retry"
curl --
request POST --
header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/pipelines/46/retry"
```
Response:
...
...
@@ -197,7 +197,7 @@ POST /projects/:id/pipelines/:pipeline_id/cancel
|
`pipeline_id`
| integer | yes | The ID of a pipeline |
```
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/pipelines/46/cancel"
curl --
request POST --
header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/pipelines/46/cancel"
```
Response:
...
...
doc/api/users.md
View file @
500e131f
...
...
@@ -35,6 +35,20 @@ GET /users
]
```
You can also search for users by email or username with:
`/users?search=John`
In addition, you can lookup users by username:
```
GET /users?username=:username
```
For example:
```
GET /users?username=jack_smith
```
In addition, you can filter users based on states eg.
`blocked`
,
`active`
This works only to filter users who are
`blocked`
or
`active`
.
It does not support
`active=false`
or
`blocked=false`
.
...
...
@@ -128,21 +142,7 @@ GET /users
]
```
You can search for users by email or username with:
`/users?search=John`
In addition, you can lookup users by username:
```
GET /users?username=:username
```
For example:
```
GET /users?username=jack_smith
```
You can also lookup users by external UID and provider:
You can lookup users by external UID and provider:
```
GET /users?extern_uid=:extern_uid&provider=:provider
...
...
lib/api/helpers.rb
View file @
500e131f
...
...
@@ -398,7 +398,7 @@ module API
finder_params
[
:non_public
]
=
true
if
params
[
:membership
].
present?
finder_params
[
:starred
]
=
true
if
params
[
:starred
].
present?
finder_params
[
:visibility_level
]
=
Gitlab
::
VisibilityLevel
.
level_value
(
params
[
:visibility
])
if
params
[
:visibility
]
finder_params
[
:archived
]
=
params
[
:archived
]
finder_params
[
:archived
]
=
archived_param
unless
params
[
:archived
].
nil?
finder_params
[
:search
]
=
params
[
:search
]
if
params
[
:search
]
finder_params
[
:user
]
=
params
.
delete
(
:user
)
if
params
[
:user
]
finder_params
[
:custom_attributes
]
=
params
[
:custom_attributes
]
if
params
[
:custom_attributes
]
...
...
@@ -535,5 +535,11 @@ module API
exception
.
status
==
500
end
def
archived_param
return
'only'
if
params
[
:archived
]
params
[
:archived
]
end
end
end
lib/api/projects.rb
View file @
500e131f
...
...
@@ -30,7 +30,7 @@ module API
end
params
:filter_params
do
optional
:archived
,
type:
Boolean
,
de
fault:
false
,
de
sc:
'Limit by archived status'
optional
:archived
,
type:
Boolean
,
desc:
'Limit by archived status'
optional
:visibility
,
type:
String
,
values:
Gitlab
::
VisibilityLevel
.
string_values
,
desc:
'Limit by visibility'
optional
:search
,
type:
String
,
desc:
'Return list of projects matching the search criteria'
...
...
spec/helpers/submodule_helper_spec.rb
View file @
500e131f
...
...
@@ -92,11 +92,10 @@ describe SubmoduleHelper do
context
'in-repository submodule'
do
let
(
:group
)
{
create
(
:group
,
name:
"Master Project"
,
path:
"master-project"
)
}
let
(
:project
)
{
create
(
:project
,
group:
group
)
}
before
do
self
.
instance_variable_set
(
:@project
,
project
)
end
it
'in-repository'
do
allow
(
repo
).
to
receive
(
:project
).
and_return
(
project
)
stub_url
(
'./'
)
expect
(
submodule_links
(
submodule_item
)).
to
eq
([
"/master-project/
#{
project
.
path
}
"
,
"/master-project/
#{
project
.
path
}
/tree/hash"
])
end
...
...
@@ -167,32 +166,28 @@ describe SubmoduleHelper do
let
(
:project
)
{
create
(
:project
,
group:
group
)
}
let
(
:commit_id
)
{
sample_commit
[
:id
]
}
before
do
self
.
instance_variable_set
(
:@project
,
project
)
end
it
'one level down'
do
result
=
relative_self_links
(
'../test.git'
,
commit_id
)
result
=
relative_self_links
(
'../test.git'
,
commit_id
,
project
)
expect
(
result
).
to
eq
([
"/
#{
group
.
path
}
/test"
,
"/
#{
group
.
path
}
/test/tree/
#{
commit_id
}
"
])
end
it
'with trailing whitespace'
do
result
=
relative_self_links
(
'../test.git '
,
commit_id
)
result
=
relative_self_links
(
'../test.git '
,
commit_id
,
project
)
expect
(
result
).
to
eq
([
"/
#{
group
.
path
}
/test"
,
"/
#{
group
.
path
}
/test/tree/
#{
commit_id
}
"
])
end
it
'two levels down'
do
result
=
relative_self_links
(
'../../test.git'
,
commit_id
)
result
=
relative_self_links
(
'../../test.git'
,
commit_id
,
project
)
expect
(
result
).
to
eq
([
"/
#{
group
.
path
}
/test"
,
"/
#{
group
.
path
}
/test/tree/
#{
commit_id
}
"
])
end
it
'one level down with namespace and repo'
do
result
=
relative_self_links
(
'../foobar/test.git'
,
commit_id
)
result
=
relative_self_links
(
'../foobar/test.git'
,
commit_id
,
project
)
expect
(
result
).
to
eq
([
"/foobar/test"
,
"/foobar/test/tree/
#{
commit_id
}
"
])
end
it
'two levels down with namespace and repo'
do
result
=
relative_self_links
(
'../foobar/baz/test.git'
,
commit_id
)
result
=
relative_self_links
(
'../foobar/baz/test.git'
,
commit_id
,
project
)
expect
(
result
).
to
eq
([
"/baz/test"
,
"/baz/test/tree/
#{
commit_id
}
"
])
end
...
...
@@ -201,7 +196,7 @@ describe SubmoduleHelper do
let
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
it
'one level down with personal project'
do
result
=
relative_self_links
(
'../test.git'
,
commit_id
)
result
=
relative_self_links
(
'../test.git'
,
commit_id
,
project
)
expect
(
result
).
to
eq
([
"/
#{
user
.
username
}
/test"
,
"/
#{
user
.
username
}
/test/tree/
#{
commit_id
}
"
])
end
end
...
...
spec/javascripts/vue_shared/components/memory_graph_spec.js
View file @
500e131f
...
...
@@ -113,7 +113,7 @@ describe('MemoryGraph', () => {
const
circleEl
=
el
.
querySelector
(
'
circle
'
);
expect
(
circleEl
).
toBeDefined
();
expect
(
circleEl
.
getAttribute
(
'
r
'
)).
toBe
(
'
1.5
'
);
expect
(
circleEl
.
getAttribute
(
'
tranform
'
)).
toBe
(
'
translate(0 -1)
'
);
expect
(
circleEl
.
getAttribute
(
'
tran
s
form
'
)).
toBe
(
'
translate(0 -1)
'
);
expect
(
circleEl
.
getAttribute
(
'
cx
'
)).
toBe
(
`
${
dotX
}
`
);
expect
(
circleEl
.
getAttribute
(
'
cy
'
)).
toBe
(
`
${
dotY
}
`
);
done
();
...
...
spec/requests/api/projects_spec.rb
View file @
500e131f
...
...
@@ -237,6 +237,39 @@ describe API::Projects do
end
end
context
'and using archived'
do
let!
(
:archived_project
)
{
create
(
:project
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
,
archived:
true
)
}
it
'returns archived projects'
do
get
api
(
'/projects?archived=true'
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
Project
.
public_or_visible_to_user
(
user
).
where
(
archived:
true
).
size
)
expect
(
json_response
.
map
{
|
project
|
project
[
'id'
]
}).
to
include
(
archived_project
.
id
)
end
it
'returns non-archived projects'
do
get
api
(
'/projects?archived=false'
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
Project
.
public_or_visible_to_user
(
user
).
where
(
archived:
false
).
size
)
expect
(
json_response
.
map
{
|
project
|
project
[
'id'
]
}).
not_to
include
(
archived_project
.
id
)
end
it
'returns every project'
do
get
api
(
'/projects'
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
map
{
|
project
|
project
[
'id'
]
}).
to
contain_exactly
(
*
Project
.
public_or_visible_to_user
(
user
).
pluck
(
:id
))
end
end
context
'and using search'
do
it_behaves_like
'projects response'
do
let
(
:filter
)
{
{
search:
project
.
name
}
}
...
...
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