Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

WIP: update event system #2189

Closed
wants to merge 13 commits into from
15 changes: 15 additions & 0 deletions controller/codebase.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,21 @@ func getBranch(projects []che.WorkspaceProject, codebaseURL string) string {
return ""
}

// ConvertCodebaseSimple converts a simple codebase ID into a Generic Relationship
func ConvertCodebaseSimple(request *http.Request, id interface{}) (*app.GenericData, *app.GenericLinks) {
i := fmt.Sprint(id)
data := &app.GenericData{
Type: ptr.String(APIStringTypeCodebase),
ID: &i,
}
relatedURL := rest.AbsoluteURL(request, app.CodebaseHref(i))
links := &app.GenericLinks{
Self: &relatedURL,
Related: &relatedURL,
}
return data, links
}

// ConvertCodebase converts between internal and external REST representation
func ConvertCodebase(request *http.Request, codebase codebase.Codebase, options ...CodebaseConvertFunc) *app.Codebase {
relatedURL := rest.AbsoluteURL(request, app.CodebaseHref(codebase.ID))
Expand Down
4 changes: 2 additions & 2 deletions controller/label.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/fabric8-services/fabric8-wit/jsonapi"
"github.com/fabric8-services/fabric8-wit/label"
"github.com/fabric8-services/fabric8-wit/login"
"github.com/fabric8-services/fabric8-wit/ptr"
"github.com/fabric8-services/fabric8-wit/rest"
"github.com/fabric8-services/fabric8-wit/space"
"github.com/goadesign/goa"
Expand Down Expand Up @@ -164,10 +165,9 @@ func ConvertLabelsSimple(request *http.Request, labelIDs []interface{}) []*app.G

// ConvertLabelSimple converts a Label ID into a Generic Relationship
func ConvertLabelSimple(request *http.Request, labelID interface{}) *app.GenericData {
t := label.APIStringTypeLabels
i := fmt.Sprint(labelID)
return &app.GenericData{
Type: &t,
Type: ptr.String(label.APIStringTypeLabels),
ID: &i,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
{
"attributes": {
"name": "system.area",
"newValue": null,
"oldValue": null,
"timestamp": "0001-01-01T00:00:00Z"
},
"id": "00000000-0000-0000-0000-000000000001",
Expand All @@ -30,10 +28,15 @@
"oldValue": {
"data": [
{
"id": "",
"id": "\u003cnil\u003e",
"type": "areas"
}
]
},
"workItemType": {
"links": {
"self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000004"
}
}
},
"type": "events"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
{
"attributes": {
"name": "system.assignees",
"newValue": null,
"oldValue": null,
"timestamp": "0001-01-01T00:00:00Z"
},
"id": "00000000-0000-0000-0000-000000000001",
Expand All @@ -27,7 +25,11 @@
}
]
},
"oldValue": {}
"workItemType": {
"links": {
"self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000003"
}
}
},
"type": "events"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
{
"attributes": {
"name": "system.description",
"newValue": null,
"newValue": {
"content": "# Description is modified1",
"markup": "Markdown"
},
"oldValue": null,
"timestamp": "0001-01-01T00:00:00Z"
},
Expand All @@ -18,6 +21,11 @@
"related": "http:///api/users/00000000-0000-0000-0000-000000000002",
"self": "http:///api/users/00000000-0000-0000-0000-000000000002"
}
},
"workItemType": {
"links": {
"self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000003"
}
}
},
"type": "events"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
{
"attributes": {
"name": "system.iteration",
"newValue": null,
"oldValue": null,
"timestamp": "0001-01-01T00:00:00Z"
},
"id": "00000000-0000-0000-0000-000000000001",
Expand All @@ -30,10 +28,15 @@
"oldValue": {
"data": [
{
"id": "",
"id": "\u003cnil\u003e",
"type": "iterations"
}
]
},
"workItemType": {
"links": {
"self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000004"
}
}
},
"type": "events"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
{
"attributes": {
"name": "myFloatType",
"newValue": "2.99",
"oldValue": "1.99",
"newValue": 2.99,
"oldValue": 1.99,
"timestamp": "0001-01-01T00:00:00Z"
},
"id": "00000000-0000-0000-0000-000000000001",
Expand All @@ -18,6 +18,11 @@
"related": "http:///api/users/00000000-0000-0000-0000-000000000002",
"self": "http:///api/users/00000000-0000-0000-0000-000000000002"
}
},
"workItemType": {
"links": {
"self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000003"
}
}
},
"type": "events"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
{
"attributes": {
"name": "myIntType",
"newValue": "4235",
"oldValue": "200",
"newValue": 4235,
"oldValue": 200,
"timestamp": "0001-01-01T00:00:00Z"
},
"id": "00000000-0000-0000-0000-000000000001",
Expand All @@ -18,6 +18,11 @@
"related": "http:///api/users/00000000-0000-0000-0000-000000000002",
"self": "http:///api/users/00000000-0000-0000-0000-000000000002"
}
},
"workItemType": {
"links": {
"self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000003"
}
}
},
"type": "events"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
{
"attributes": {
"name": "system.labels",
"newValue": null,
"oldValue": null,
"timestamp": "0001-01-01T00:00:00Z"
},
"id": "00000000-0000-0000-0000-000000000001",
Expand All @@ -31,7 +29,11 @@
}
]
},
"oldValue": {}
"workItemType": {
"links": {
"self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000005"
}
}
},
"type": "events"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
"related": "http:///api/users/00000000-0000-0000-0000-000000000002",
"self": "http:///api/users/00000000-0000-0000-0000-000000000002"
}
},
"workItemType": {
"links": {
"self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000003"
}
}
},
"type": "events"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
"related": "http:///api/users/00000000-0000-0000-0000-000000000003",
"self": "http:///api/users/00000000-0000-0000-0000-000000000003"
}
},
"workItemType": {
"links": {
"self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000004"
}
}
},
"type": "events"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"data": [
{
"attributes": {
"name": "bool_single",
"newValue": true,
"oldValue": null,
"timestamp": "0001-01-01T00:00:00Z"
},
"id": "00000000-0000-0000-0000-000000000001",
"relationships": {
"modifier": {
"data": {
"id": "00000000-0000-0000-0000-000000000002",
"type": "users"
},
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000002",
"self": "http:///api/users/00000000-0000-0000-0000-000000000002"
}
},
"workItemType": {
"links": {
"self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000003"
}
}
},
"type": "events"
},
{
"attributes": {
"name": "bool_list",
"newValue": [
true,
false
],
"timestamp": "0001-01-01T00:00:00Z"
},
"id": "00000000-0000-0000-0000-000000000004",
"relationships": {
"modifier": {
"data": {
"id": "00000000-0000-0000-0000-000000000002",
"type": "users"
},
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000002",
"self": "http:///api/users/00000000-0000-0000-0000-000000000002"
}
},
"workItemType": {
"links": {
"self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000003"
}
}
},
"type": "events"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"data": [
{
"attributes": {
"name": "bool_single",
"newValue": true,
"oldValue": null,
"timestamp": "0001-01-01T00:00:00Z"
},
"id": "00000000-0000-0000-0000-000000000001",
"relationships": {
"modifier": {
"data": {
"id": "00000000-0000-0000-0000-000000000002",
"type": "users"
},
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000002",
"self": "http:///api/users/00000000-0000-0000-0000-000000000002"
}
},
"workItemType": {
"links": {
"self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000003"
}
}
},
"type": "events"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"data": [
{
"attributes": {
"name": "float_single",
"newValue": 0.1,
"oldValue": null,
"timestamp": "0001-01-01T00:00:00Z"
},
"id": "00000000-0000-0000-0000-000000000001",
"relationships": {
"modifier": {
"data": {
"id": "00000000-0000-0000-0000-000000000002",
"type": "users"
},
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000002",
"self": "http:///api/users/00000000-0000-0000-0000-000000000002"
}
},
"workItemType": {
"links": {
"self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000003"
}
}
},
"type": "events"
},
{
"attributes": {
"name": "float_list",
"newValue": [
0.1,
-1111.1
],
"timestamp": "0001-01-01T00:00:00Z"
},
"id": "00000000-0000-0000-0000-000000000004",
"relationships": {
"modifier": {
"data": {
"id": "00000000-0000-0000-0000-000000000002",
"type": "users"
},
"links": {
"related": "http:///api/users/00000000-0000-0000-0000-000000000002",
"self": "http:///api/users/00000000-0000-0000-0000-000000000002"
}
},
"workItemType": {
"links": {
"self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000003"
}
}
},
"type": "events"
}
]
}
Loading