Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
grid5000
g5k-api
Commits
adf0c5d6
Commit
adf0c5d6
authored
Nov 12, 2020
by
Samir Noir
🧀
Browse files
Add users and nodes to collection's links on vlans root
parent
e61e96df
Pipeline
#185849
waiting for manual action with stages
in 21 minutes and 21 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/controllers/vlans_controller.rb
View file @
adf0c5d6
...
...
@@ -144,6 +144,16 @@ class VlansController < ApplicationController
def
links_for_collection
[
{
'rel'
=>
'nodes'
,
'href'
=>
uri_to
(
File
.
join
(
collection_path
,
'nodes'
)),
'type'
=>
api_media_type
(
:g5kcollectionjson
)
},
{
'rel'
=>
'users'
,
'href'
=>
uri_to
(
File
.
join
(
collection_path
,
'users'
)),
'type'
=>
api_media_type
(
:g5kcollectionjson
)
},
{
'rel'
=>
'self'
,
'href'
=>
uri_to
(
collection_path
),
...
...
spec/controllers/vlans_controller_spec.rb
View file @
adf0c5d6
...
...
@@ -38,7 +38,7 @@ describe VlansController do
expect
(
json
[
'total'
]).
to
eq
(
22
)
expect
(
json
[
'offset'
]).
to
eq
(
0
)
expect
(
json
[
'items'
].
length
).
to
eq
(
22
)
expect
(
json
[
'links'
].
length
).
to
eq
(
2
)
expect
(
json
[
'links'
].
length
).
to
eq
(
4
)
expect
(
json
[
'items'
].
first
[
'uid'
]).
to
eq
(
'DEFAULT'
)
expect
(
json
[
'items'
].
map
{
|
i
|
i
[
'uid'
].
to_i
}.
sort
).
to
eq
(
0
..
21
).
to_a
.
sort
...
...
@@ -72,6 +72,16 @@ describe VlansController do
}
])
expect
(
json
[
'links'
]).
to
eq
([
{
'rel'
=>
'nodes'
,
'href'
=>
'/sites/rennes/vlans/nodes'
,
'type'
=>
api_media_type
(
:g5kcollectionjson
)
},
{
'rel'
=>
'users'
,
'href'
=>
'/sites/rennes/vlans/users'
,
'type'
=>
api_media_type
(
:g5kcollectionjson
)
},
{
'rel'
=>
'self'
,
'href'
=>
'/sites/rennes/vlans'
,
...
...
Write
Preview
Supports
Markdown
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