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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
c4853946
Commit
c4853946
authored
Feb 14, 2017
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose Namespace#full_path in namespaces API
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
c867fbab
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
7 deletions
+16
-7
app/assets/javascripts/namespace_select.js
app/assets/javascripts/namespace_select.js
+2
-2
app/views/admin/projects/index.html.haml
app/views/admin/projects/index.html.haml
+1
-1
doc/api/namespaces.md
doc/api/namespaces.md
+8
-1
lib/api/entities.rb
lib/api/entities.rb
+1
-1
spec/requests/api/namespaces_spec.rb
spec/requests/api/namespaces_spec.rb
+4
-2
No files found.
app/assets/javascripts/namespace_select.js
View file @
c4853946
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
if
(
selected
.
id
==
null
)
{
if
(
selected
.
id
==
null
)
{
return
selected
.
text
;
return
selected
.
text
;
}
else
{
}
else
{
return
selected
.
kind
+
"
:
"
+
selected
.
path
;
return
selected
.
kind
+
"
:
"
+
selected
.
full_
path
;
}
}
},
},
data
:
function
(
term
,
dataCallback
)
{
data
:
function
(
term
,
dataCallback
)
{
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
if
(
namespace
.
id
==
null
)
{
if
(
namespace
.
id
==
null
)
{
return
namespace
.
text
;
return
namespace
.
text
;
}
else
{
}
else
{
return
namespace
.
kind
+
"
:
"
+
namespace
.
path
;
return
namespace
.
kind
+
"
:
"
+
namespace
.
full_
path
;
}
}
},
},
renderRow
:
this
.
renderRow
,
renderRow
:
this
.
renderRow
,
...
...
app/views/admin/projects/index.html.haml
View file @
c4853946
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
-
toggle_text
=
'Namespace'
-
toggle_text
=
'Namespace'
-
if
params
[
:namespace_id
].
present?
-
if
params
[
:namespace_id
].
present?
-
namespace
=
Namespace
.
find
(
params
[
:namespace_id
])
-
namespace
=
Namespace
.
find
(
params
[
:namespace_id
])
-
toggle_text
=
"
#{
namespace
.
kind
}
:
#{
namespace
.
path
}
"
-
toggle_text
=
"
#{
namespace
.
kind
}
:
#{
namespace
.
full_
path
}
"
=
dropdown_toggle
(
toggle_text
,
{
toggle:
'dropdown'
},
{
toggle_class:
'js-namespace-select large'
})
=
dropdown_toggle
(
toggle_text
,
{
toggle:
'dropdown'
},
{
toggle_class:
'js-namespace-select large'
})
.dropdown-menu.dropdown-select.dropdown-menu-align-right
.dropdown-menu.dropdown-select.dropdown-menu-align-right
=
dropdown_title
(
'Namespaces'
)
=
dropdown_title
(
'Namespaces'
)
...
...
doc/api/namespaces.md
View file @
c4853946
...
@@ -35,6 +35,12 @@ Example response:
...
@@ -35,6 +35,12 @@ Example response:
"id"
:
2
,
"id"
:
2
,
"path"
:
"group1"
,
"path"
:
"group1"
,
"kind"
:
"group"
"kind"
:
"group"
},
{
"id"
:
3
,
"path"
:
"bar"
,
"kind"
:
"group"
,
"full_path"
:
"foo/bar"
,
}
}
]
]
```
```
...
@@ -64,7 +70,8 @@ Example response:
...
@@ -64,7 +70,8 @@ Example response:
{
{
"id"
:
4
,
"id"
:
4
,
"path"
:
"twitter"
,
"path"
:
"twitter"
,
"kind"
:
"group"
"kind"
:
"group"
,
"full_path"
:
"twitter"
,
}
}
]
]
```
```
lib/api/entities.rb
View file @
c4853946
...
@@ -414,7 +414,7 @@ module API
...
@@ -414,7 +414,7 @@ module API
end
end
class
Namespace
<
Grape
::
Entity
class
Namespace
<
Grape
::
Entity
expose
:id
,
:name
,
:path
,
:kind
expose
:id
,
:name
,
:path
,
:kind
,
:full_path
end
end
class
MemberAccess
<
Grape
::
Entity
class
MemberAccess
<
Grape
::
Entity
...
...
spec/requests/api/namespaces_spec.rb
View file @
c4853946
...
@@ -5,7 +5,7 @@ describe API::Namespaces, api: true do
...
@@ -5,7 +5,7 @@ describe API::Namespaces, api: true do
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:group1
)
{
create
(
:group
)
}
let!
(
:group1
)
{
create
(
:group
)
}
let!
(
:group2
)
{
create
(
:group
)
}
let!
(
:group2
)
{
create
(
:group
,
:nested
)
}
describe
"GET /namespaces"
do
describe
"GET /namespaces"
do
context
"when unauthenticated"
do
context
"when unauthenticated"
do
...
@@ -25,11 +25,13 @@ describe API::Namespaces, api: true do
...
@@ -25,11 +25,13 @@ describe API::Namespaces, api: true do
end
end
it
"admin: returns an array of matched namespaces"
do
it
"admin: returns an array of matched namespaces"
do
get
api
(
"/namespaces?search=
#{
group
1
.
name
}
"
,
admin
)
get
api
(
"/namespaces?search=
#{
group
2
.
name
}
"
,
admin
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
last
[
'path'
]).
to
eq
(
group2
.
path
)
expect
(
json_response
.
last
[
'full_path'
]).
to
eq
(
group2
.
full_path
)
end
end
end
end
...
...
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