Skip to content

Commit 400420b

Browse files
authored
Refactor list view types and structures into apiview package (#529)
1 parent fce92f2 commit 400420b

File tree

2 files changed

+56
-45
lines changed

2 files changed

+56
-45
lines changed

pkg/apicontracts/v2/apilistview/listview.go

Lines changed: 0 additions & 45 deletions
This file was deleted.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package apiview
2+
3+
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
4+
5+
type ViewType string
6+
7+
const (
8+
ViewTypeGrid ViewType = "grid"
9+
ViewTypeTable ViewType = "table"
10+
ViewTypeChart ViewType = "chart"
11+
)
12+
13+
type ViewFieldType string
14+
15+
type ViewMetadata struct {
16+
Id string
17+
Description string
18+
Name string
19+
Version string
20+
}
21+
22+
const (
23+
ViewFieldTypeString ViewFieldType = "string"
24+
ViewFieldTypeNumber ViewFieldType = "number"
25+
ViewFieldTypeDate ViewFieldType = "date"
26+
ViewFieldTypeDateTime ViewFieldType = "datetime"
27+
ViewFieldTypeBoolean ViewFieldType = "boolean"
28+
ViewFieldTypeEnum ViewFieldType = "enum"
29+
)
30+
31+
type View struct {
32+
Type ViewType `json:"type,omitempty"`
33+
Columns []ViewField `json:"columns,omitempty"`
34+
Rows []ViewRow `json:"rows,omitempty"`
35+
}
36+
37+
type ViewRow []ViewData
38+
39+
type ViewField struct {
40+
Name string `json:"name"`
41+
Description string `json:"description,omitempty"`
42+
Order int `json:"order"`
43+
Default bool `json:"default"`
44+
Writeable bool `json:"writeable,omitempty"`
45+
Type ViewFieldType `json:"type,omitempty"`
46+
PossibleValues []string `json:"possibleValues,omitempty"`
47+
ResourceType metav1.TypeMeta `json:"resourceType,omitempty"`
48+
ResourceFieldRef string `json:"resourceFieldRef,omitempty"` //"spec.clusterdata.clustername"
49+
}
50+
51+
type ViewData struct {
52+
FieldName string `json:"fieldName"`
53+
FieldValue string `json:"fieldValue"`
54+
Description string `json:"description,omitempty"`
55+
ResourceUid string `json:"resourceUid,omitempty"`
56+
}

0 commit comments

Comments
 (0)