Skip to content

WG96/97 Content and Templates structure + design updates #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 56 commits into from
Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
214e48b
fix Pagination
AlinaGoaga Sep 2, 2021
244f5d0
Merge branch 'WGE32-style-apps' of github.com:weaveworks/weave-gitops…
AlinaGoaga Sep 2, 2021
73238cd
WG35 Templates Table - WIP
AlinaGoaga Sep 2, 2021
cd5d278
WG35 Templates Table - Switch between views
AlinaGoaga Sep 3, 2021
8bd9ca7
prevent backgrund svg from moving on scroll
AlinaGoaga Sep 3, 2021
85c9966
WG35 Templates Table - Sort and Row CTA
AlinaGoaga Sep 6, 2021
3d39a22
WG35 Templates Table - styling updates
AlinaGoaga Sep 7, 2021
49547d6
WG35 Templates Table - cleanup
AlinaGoaga Sep 7, 2021
401a893
WG35 Templates Table - cleanup2
AlinaGoaga Sep 7, 2021
bde0984
Merge branch 'main' of github.com:weaveworks/weave-gitops-enterprise …
AlinaGoaga Sep 7, 2021
85d4efe
WG35 Templates Table - remove sorting in useEffect and update mui import
AlinaGoaga Sep 7, 2021
197da55
WG36 Add react toastify to manage notifications
AlinaGoaga Sep 7, 2021
ca397e1
WG35 Templates Table - implement PR feedback
AlinaGoaga Sep 8, 2021
d72932f
Merge branch 'main' of github.com:weaveworks/weave-gitops-enterprise …
AlinaGoaga Sep 8, 2021
9f915f6
WG35 Templates Table - implement PR feedback - updated
AlinaGoaga Sep 8, 2021
ca2f817
Merge branch 'WG35-table-view-templates' of github.com:weaveworks/wea…
AlinaGoaga Sep 8, 2021
9ee079d
run through all notifications
AlinaGoaga Sep 8, 2021
d02ac55
WG36 Add styling to notifications
AlinaGoaga Sep 8, 2021
3e14920
remove old notifications component
AlinaGoaga Sep 8, 2021
a9e0a0f
Merge branch 'main' of github.com:weaveworks/weave-gitops-enterprise …
AlinaGoaga Sep 16, 2021
fd8f894
WG36 Avoid dupes + styling
AlinaGoaga Sep 16, 2021
a540dd6
fix warnings
AlinaGoaga Sep 16, 2021
fa1edb1
update notif logic
AlinaGoaga Sep 16, 2021
9a8f78e
update notif logic - updated
AlinaGoaga Sep 16, 2021
413c9b2
Merge branch 'main' of github.com:weaveworks/weave-gitops-enterprise …
AlinaGoaga Sep 16, 2021
c81465a
update error selector
AlinaGoaga Sep 17, 2021
ca787c0
WG65 Add object name to the fields returned by List Templates
AlinaGoaga Sep 17, 2021
b56eead
WG65 Add object name to the fields returned by List Templates - fix f…
AlinaGoaga Sep 17, 2021
04ef6d6
WG65 Switch to template object name in FE steps
AlinaGoaga Sep 20, 2021
77a44ce
Merge branch 'main' of github.com:weaveworks/weave-gitops-enterprise …
AlinaGoaga Sep 20, 2021
13d4b45
WG65 Switch to template object name in FE steps - updated
AlinaGoaga Sep 20, 2021
1763bdc
WG65 Switch to template object name in FE steps - updated2
AlinaGoaga Sep 20, 2021
4d32e71
WG65 Update remaining BE server tests
AlinaGoaga Sep 20, 2021
5e5897b
WG65 Update templates acceptance tests
AlinaGoaga Sep 20, 2021
4e1446d
WG65 Update templates acceptance tests - updated
AlinaGoaga Sep 20, 2021
349e4e4
Merge branch 'main' of github.com:weaveworks/weave-gitops-enterprise …
AlinaGoaga Sep 20, 2021
0b02d0a
WG65 Split form steps
AlinaGoaga Sep 20, 2021
3cee843
WG65 Update templates acceptance tests - updated2
AlinaGoaga Sep 20, 2021
19841e1
WG58 Get entitlement message from header
AlinaGoaga Sep 21, 2021
d53e18f
Merge branch 'main' of github.com:weaveworks/weave-gitops-enterprise …
AlinaGoaga Sep 21, 2021
ff4ba06
WG58 Add entitlement notification to content
AlinaGoaga Sep 21, 2021
e60ca69
WG58 Add entitlement notification to content - updated
AlinaGoaga Sep 21, 2021
d104a74
WG58 Add entitlement notification to apps page
AlinaGoaga Sep 22, 2021
eebb872
WG97 Update help section - WIP
AlinaGoaga Sep 23, 2021
9812fff
Merge branch 'main' of github.com:weaveworks/weave-gitops-enterprise …
AlinaGoaga Sep 23, 2021
618118a
WG96 Template Cards - transparent background
AlinaGoaga Sep 23, 2021
cafdfa1
WG96 Template Cards are all same height + add providers pics
AlinaGoaga Sep 23, 2021
23fff0d
WG96 Template Cards use provider images
AlinaGoaga Sep 23, 2021
defe1d9
WG96 Template Cards use provider images - solve conflict with main
AlinaGoaga Sep 23, 2021
e112ca3
WG96 GET Templates includes provider
AlinaGoaga Sep 24, 2021
369338d
WG96 Update server.go tests
AlinaGoaga Sep 24, 2021
8aa9d21
WG96 Update provider switch UI
AlinaGoaga Sep 24, 2021
51ff698
WG96 Update template response test
AlinaGoaga Sep 24, 2021
b3bc2d2
WG96 Implement PR feedback
AlinaGoaga Sep 27, 2021
9122a5c
Merge branch 'main' of github.com:weaveworks/weave-gitops-enterprise …
AlinaGoaga Sep 27, 2021
58969eb
WG96 Implement PR feedback - updated
AlinaGoaga Sep 27, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cmd/capi-server/api/capi_server.proto
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ message Template {
repeated Parameter parameters = 4;
string body = 5;
repeated TemplateObject objects = 6;
string error = 7;
string error = 7;
string provider = 8;
}

message Parameter {
Expand Down
3 changes: 3 additions & 0 deletions cmd/capi-server/api/capi_server.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,9 @@
},
"error": {
"type": "string"
},
"provider": {
"type": "string"
}
}
},
Expand Down
217 changes: 113 additions & 104 deletions cmd/capi-server/pkg/protos/capi_server.pb.go

Large diffs are not rendered by default.

44 changes: 30 additions & 14 deletions cmd/capi-server/pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,32 +51,48 @@ func (s *server) ListTemplates(ctx context.Context, msg *capiv1_proto.ListTempla
}
templates := []*capiv1_proto.Template{}

if msg.Provider != "" {
tl = filterTemplatesByProvider(tl, msg.Provider)
}

for _, t := range tl {
templates = append(templates, ToTemplateResponse(t))
}

if msg.Provider != "" {
templates = filterTemplatesByProvider(templates, msg.Provider)
}

sort.Slice(templates, func(i, j int) bool { return templates[i].Name < templates[j].Name })
return &capiv1_proto.ListTemplatesResponse{Templates: templates, Total: int32(len(tl))}, err
}

func filterTemplatesByProvider(tl map[string]*capiv1.CAPITemplate, provider string) map[string]*capiv1.CAPITemplate {
templates := map[string]*capiv1.CAPITemplate{}
func getProvider(t *capiv1.CAPITemplate) string {
meta, err := capi.ParseTemplateMeta(t)

for name, t := range tl {
providerKind := formatProviderName(provider)
meta, err := capi.ParseTemplateMeta(t)
if err != nil {
continue
if err != nil {
return ""
}

for _, obj := range meta.Objects {
switch obj.Kind {
case "AWSCluster":
return "AWSCluster"
case "AzureCluster":
return "AzureCluster"
case "VSphereCluster":
return "VSphereCluster"
}
}

for _, obj := range meta.Objects {
if obj.Kind == providerKind {
templates[name] = t
}
return "Generic"
}

func filterTemplatesByProvider(tl []*capiv1_proto.Template, provider string) []*capiv1_proto.Template {
templates := []*capiv1_proto.Template{}

for _, t := range tl {
providerKind := formatProviderName(provider)

if (t.Provider == providerKind) {
templates = append(templates, t)
}
}

Expand Down
10 changes: 8 additions & 2 deletions cmd/capi-server/pkg/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,18 @@ func TestListTemplates(t *testing.T) {
{
name: "1 template",
clusterState: []runtime.Object{
makeTemplateConfigMap("template1", makeTemplate(t)),
makeTemplateConfigMap("template1", makeTemplateWithProvider(t, "AWSCluster")),
},
expected: []*capiv1_protos.Template{
{
Name: "cluster-template-1",
Description: "this is test template 1",
Provider: "AWSCluster",
Objects: []*capiv1_protos.TemplateObject{
{
Name: string("${CLUSTER_NAME}"),
ApiVersion: "fooversion",
Kind: "fookind",
Kind: "AWSCluster",
Parameters: []string{"CLUSTER_NAME"},
},
},
Expand All @@ -88,6 +89,7 @@ func TestListTemplates(t *testing.T) {
{
Name: "cluster-template-1",
Description: "this is test template 1",
Provider: "Generic",
Objects: []*capiv1_protos.TemplateObject{
{
Name: string("${CLUSTER_NAME}"),
Expand All @@ -106,6 +108,7 @@ func TestListTemplates(t *testing.T) {
{
Name: "cluster-template-2",
Description: "this is test template 2",
Provider: "Generic",
Objects: []*capiv1_protos.TemplateObject{
{
Name: string("${CLUSTER_NAME}"),
Expand Down Expand Up @@ -170,6 +173,7 @@ func TestListTemplates_FilterByProvider(t *testing.T) {
{
Name: "cluster-template-2",
Description: "this is test template 2",
Provider: "AWSCluster",
Objects: []*capiv1_protos.TemplateObject{
{
Name: string("${CLUSTER_NAME}"),
Expand Down Expand Up @@ -200,6 +204,7 @@ func TestListTemplates_FilterByProvider(t *testing.T) {
{
Name: "cluster-template-2",
Description: "this is test template 2",
Provider: "AWSCluster",
Objects: []*capiv1_protos.TemplateObject{
{
Name: string("${CLUSTER_NAME}"),
Expand Down Expand Up @@ -274,6 +279,7 @@ func TestGetTemplate(t *testing.T) {
expected: &capiv1_protos.Template{
Name: "cluster-template-1",
Description: "this is test template 1",
Provider: "Generic",
Objects: []*capiv1_protos.TemplateObject{
{
Name: string("${CLUSTER_NAME}"),
Expand Down
1 change: 1 addition & 0 deletions cmd/capi-server/pkg/server/template_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ func ToTemplateResponse(t *capiv1.CAPITemplate) *capiv1_proto.Template {
res := &capiv1_proto.Template{
Name: t.GetName(),
Description: t.Spec.Description,
Provider: getProvider(t),
}

meta, err := capi.ParseTemplateMeta(t)
Expand Down
12 changes: 8 additions & 4 deletions cmd/capi-server/pkg/server/template_response_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ func TestToTemplate(t *testing.T) {
err error
}{
{
name: "empty",
value: "",
expected: &capiv1_protos.Template{},
name: "empty",
value: "",
expected: &capiv1_protos.Template{
Provider: "Generic",
},
},
{
name: "Basics",
Expand All @@ -31,7 +33,8 @@ metadata:
name: foo
`,
expected: &capiv1_protos.Template{
Name: "foo",
Name: "foo",
Provider: "Generic",
},
},
{
Expand All @@ -57,6 +60,7 @@ metadata:
expected: &capiv1_protos.Template{
Name: "cluster-template-1",
Description: "this is test template 1",
Provider: "Generic",
Objects: []*capiv1_protos.TemplateObject{
{
ApiVersion: "fooversion",
Expand Down
1 change: 0 additions & 1 deletion ui-cra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"moment": "2.25.3",
"polished": "3.6.3",
"prettier": "^2.3.0",
"randomcolor": "^0.6.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-jsonschema-form": "^1.8.1",
Expand Down
14 changes: 14 additions & 0 deletions ui-cra/src/assets/img/templates/eks.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions ui-cra/src/assets/img/templates/generic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions ui-cra/src/assets/img/templates/gke.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading