Merge pull request #10964 from influxdata/view-label-links
fix(http): add labels to view links responsespull/10974/head
commit
dcf606da9d
|
@ -72,7 +72,8 @@ func NewViewHandler(mappingService platform.UserResourceMappingService, labelSer
|
|||
}
|
||||
|
||||
type viewLinks struct {
|
||||
Self string `json:"self"`
|
||||
Self string `json:"self"`
|
||||
Labels string `json:"labels"`
|
||||
}
|
||||
|
||||
type viewResponse struct {
|
||||
|
@ -100,7 +101,8 @@ func (r viewResponse) MarshalJSON() ([]byte, error) {
|
|||
func newViewResponse(c *platform.View) viewResponse {
|
||||
return viewResponse{
|
||||
Links: viewLinks{
|
||||
Self: fmt.Sprintf("/api/v2/views/%s", c.ID),
|
||||
Self: fmt.Sprintf("/api/v2/views/%s", c.ID),
|
||||
Labels: fmt.Sprintf("/api/v2/views/%s/labels", c.ID),
|
||||
},
|
||||
View: *c,
|
||||
}
|
||||
|
|
|
@ -77,6 +77,7 @@ func TestService_handleGetViews(t *testing.T) {
|
|||
"id": "7365637465747572",
|
||||
"name": "hello",
|
||||
"links": {
|
||||
"labels": "/api/v2/views/7365637465747572/labels",
|
||||
"self": "/api/v2/views/7365637465747572"
|
||||
},
|
||||
"properties": {
|
||||
|
@ -95,6 +96,7 @@ func TestService_handleGetViews(t *testing.T) {
|
|||
"id": "6167697474697320",
|
||||
"name": "example",
|
||||
"links": {
|
||||
"labels": "/api/v2/views/6167697474697320/labels",
|
||||
"self": "/api/v2/views/6167697474697320"
|
||||
},
|
||||
"properties": {
|
||||
|
@ -210,6 +212,7 @@ func TestService_handleGetView(t *testing.T) {
|
|||
"id": "020f755c3c082000",
|
||||
"name": "example",
|
||||
"links": {
|
||||
"labels": "/api/v2/views/020f755c3c082000/labels",
|
||||
"self": "/api/v2/views/020f755c3c082000"
|
||||
},
|
||||
"properties": {
|
||||
|
@ -326,6 +329,7 @@ func TestService_handlePostViews(t *testing.T) {
|
|||
"id": "020f755c3c082000",
|
||||
"name": "hello",
|
||||
"links": {
|
||||
"labels": "/api/v2/views/020f755c3c082000/labels",
|
||||
"self": "/api/v2/views/020f755c3c082000"
|
||||
},
|
||||
"properties": {
|
||||
|
@ -529,6 +533,7 @@ func TestService_handlePatchView(t *testing.T) {
|
|||
"id": "020f755c3c082000",
|
||||
"name": "example",
|
||||
"links": {
|
||||
"labels": "/api/v2/views/020f755c3c082000/labels",
|
||||
"self": "/api/v2/views/020f755c3c082000"
|
||||
},
|
||||
"properties": {
|
||||
|
|
Loading…
Reference in New Issue