Read about our upcoming Code of Conduct on this issue

Unverified Commit c4853946 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Expose Namespace#full_path in namespaces API


Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 8a6acb1e9382
......@@ -29,7 +29,7 @@
if (selected.id == null) {
return selected.text;
} else {
return selected.kind + ": " + selected.path;
return selected.kind + ": " + selected.full_path;
}
},
data: function(term, dataCallback) {
......@@ -50,7 +50,7 @@
if (namespace.id == null) {
return namespace.text;
} else {
return namespace.kind + ": " + namespace.path;
return namespace.kind + ": " + namespace.full_path;
}
},
renderRow: this.renderRow,
......
......@@ -30,7 +30,7 @@
- toggle_text = 'Namespace'
- if params[:namespace_id].present?
- 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-menu.dropdown-select.dropdown-menu-align-right
= dropdown_title('Namespaces')
......
......@@ -35,6 +35,12 @@ Example response:
"id": 2,
"path": "group1",
"kind": "group"
},
{
"id": 3,
"path": "bar",
"kind": "group",
"full_path": "foo/bar",
}
]
```
......@@ -64,7 +70,8 @@ Example response:
{
"id": 4,
"path": "twitter",
"kind": "group"
"kind": "group",
"full_path": "twitter",
}
]
```
......@@ -414,7 +414,7 @@ class Todo < Grape::Entity
end
class Namespace < Grape::Entity
expose :id, :name, :path, :kind
expose :id, :name, :path, :kind, :full_path
end
class MemberAccess < Grape::Entity
......
......@@ -5,7 +5,7 @@
let(:admin) { create(:admin) }
let(:user) { create(:user) }
let!(:group1) { create(:group) }
let!(:group2) { create(:group) }
let!(:group2) { create(:group, :nested) }
describe "GET /namespaces" do
context "when unauthenticated" do
......@@ -25,11 +25,13 @@
end
it "admin: returns an array of matched namespaces" do
get api("/namespaces?search=#{group1.name}", admin)
get api("/namespaces?search=#{group2.name}", admin)
expect(response).to have_http_status(200)
expect(json_response).to be_an Array
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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment